28169 3 tygodni temu
rodzic
commit
7c8c77b367

BIN
XT_New.exe Wyświetl plik


+ 4 - 4
controllers/base_api_controller.go Wyświetl plik

@@ -83,7 +83,7 @@ func (this *BaseAuthAPIController) Prepare() {
83 83
 		userAdmin.ModifyTime = 1530786071
84 84
 		var subscibe models.ServeSubscibe
85 85
 		subscibe.ID = 11
86
-		subscibe.OrgId = 10745 //机构id
86
+		subscibe.OrgId = 10751 //机构id
87 87
 		subscibe.PeriodStart = 1547447814
88 88
 		subscibe.PeriodEnd = 1550039814
89 89
 		subscibe.State = 1
@@ -93,7 +93,7 @@ func (this *BaseAuthAPIController) Prepare() {
93 93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94 94
 		subscibes[4] = &subscibe
95 95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10745 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10751 //机构id小英9675或4
97 97
 		adminUserInfo.CurrentAppId = 18734 //4
98 98
 		adminUserInfo.AdminUser = &userAdmin
99 99
 		adminUserInfo.Subscibes = subscibes
@@ -329,7 +329,7 @@ func (this *BaseServeAPIController) Prepare() {
329 329
 		userAdmin.ModifyTime = 1530786071
330 330
 		var subscibe models.ServeSubscibe
331 331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10745 //机构id小英9675或4
332
+		subscibe.OrgId = 10751 //机构id小英9675或4
333 333
 		subscibe.PeriodStart = 1538035409
334 334
 		subscibe.PeriodEnd = 1569571409
335 335
 		subscibe.State = 1
@@ -339,7 +339,7 @@ func (this *BaseServeAPIController) Prepare() {
339 339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340 340
 		subscibes[4] = &subscibe
341 341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10745 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10751 //机构id小英9675或4
343 343
 		adminUserInfo.CurrentAppId = 18734 //4
344 344
 		adminUserInfo.AdminUser = &userAdmin
345 345
 		adminUserInfo.Subscibes = subscibes

+ 1 - 15
controllers/common_api_controller.go Wyświetl plik

@@ -1436,7 +1436,7 @@ func (this *CommonApiController) GetPatientscontrol() {
1436 1436
 	startimeStrUnix := startimeStr.Unix()
1437 1437
 
1438 1438
 	endtime := this.GetString("endtime")
1439
-	fmt.Println("结束时间", endtime)
1439
+
1440 1440
 	endtimeStr := endtime + " 23:59:59"
1441 1441
 	endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
1442 1442
 	endtimeStrsUnix := endtimeStrs.Unix()
@@ -1467,34 +1467,20 @@ func (this *CommonApiController) GetPatientscontrol() {
1467 1467
 func (this *CommonApiController) GetCartogramList() {
1468 1468
 	adminUser := this.GetAdminUserInfo()
1469 1469
 	orgid := adminUser.CurrentOrgId
1470
-	//fmt.Println("orgid", orgid)
1471 1470
 	lapstor, _ := this.GetInt64("lapstor")
1472 1471
 	fmt.Println("lapstor", lapstor)
1473 1472
 	startime := this.GetString("startime")
1474
-	//fmt.Println("开始时间", startime)
1475 1473
 	startimeStr, _ := utils.ParseTimeStringToTime("2006-01-02", startime)
1476 1474
 	startimeStrUnix := startimeStr.Unix()
1477
-	//fmt.Println("时间搓", startimeStrUnix)
1478 1475
 	endtime := this.GetString("endtime")
1479
-	//fmt.Println("结束时间", endtime)
1480 1476
 	endtimeStr := endtime + " 23:59:59"
1481 1477
 	endtimeStrs, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", endtimeStr)
1482 1478
 	endtimeStrsUnix := endtimeStrs.Unix()
1483
-	//fmt.Println("结束时间搓", endtimeStrsUnix)
1484
-	//limit, _ := this.GetInt64("limit")
1485
-	//page, _ := this.GetInt64("page")
1486
-
1487 1479
 	//统计总共
1488 1480
 	_, total, err := service.GetTotalPatientsControl(orgid, startimeStrUnix, endtimeStrsUnix)
1489
-	//fmt.Println("total=================", total)
1490 1481
 	//统计rangetype= 1
1491 1482
 	_, standtotal, err := service.GetStandControl(orgid, startimeStrUnix, endtimeStrsUnix)
1492
-	//fmt.Println(standtotal)
1493 1483
 	_, standtotalOne, err := service.GetStandControlOne(orgid, startimeStrUnix, endtimeStrsUnix)
1494
-	//fmt.Println(standtotalOne)
1495
-	//cartogramlist, err := service.GetLastPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
1496
-	//infectiouscontrol, err := service.GetInfectiousPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix)
1497
-	//_, total, err := service.GetPatientsControl(orgid, lapstor, startimeStrUnix, endtimeStrsUnix, page, limit)
1498 1484
 	if err != nil {
1499 1485
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1500 1486
 		return

+ 52 - 3
controllers/drug_stock_api_contorller.go Wyświetl plik

@@ -3473,7 +3473,6 @@ func (c *StockDrugApiController) CheckWarehousingInfo() {
3473 3473
 
3474 3474
 		flowList, _ := service.GetNewDrugFlowList(item.DrugId, item.OrgId, item.ID, tx)
3475 3475
 
3476
-		fmt.Println("FlowList=================", flowList)
3477 3476
 		var his_count int64
3478 3477
 		if len(flowList) > 0 {
3479 3478
 			for _, item := range flowList {
@@ -3489,8 +3488,6 @@ func (c *StockDrugApiController) CheckWarehousingInfo() {
3489 3488
 				}
3490 3489
 			}
3491 3490
 		}
3492
-		fmt.Println("incount_0000000000000000", in_cout)
3493
-		fmt.Println("his_count--------------", his_count)
3494 3491
 
3495 3492
 		if in_cout != his_count {
3496 3493
 			is_success = 1
@@ -3498,6 +3495,32 @@ func (c *StockDrugApiController) CheckWarehousingInfo() {
3498 3495
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeFlow)
3499 3496
 			return
3500 3497
 		}
3498
+
3499
+		goodcodelist := strings.Split(item.DrugCode, ",")
3500
+
3501
+		if len(goodcodelist) > 0 {
3502
+			goodInfo, _ := service.GetNewDrugByIdIsStop(item.DrugId, item.OrgId, tx)
3503
+			for _, it := range goodcodelist {
3504
+				if it != "" {
3505
+					codeInfo := models.XtDrugCodeInfo{
3506
+						DrugId:          item.DrugId,
3507
+						BatchNumber:     item.Number,
3508
+						DrugCode:        it,
3509
+						WarehouseInfoId: item.ID,
3510
+						IsUserCount:     0,
3511
+						IsOutStatus:     2,
3512
+						Status:          1,
3513
+						UserOrgId:       item.OrgId,
3514
+						Ctime:           time.Now().Unix(),
3515
+						Mtime:           time.Now().Unix(),
3516
+						SplitOfNumber:   goodInfo.SplitOfNumber,
3517
+					}
3518
+					service.CreateDrugCodeInfo(codeInfo, tx)
3519
+				}
3520
+
3521
+			}
3522
+		}
3523
+
3501 3524
 	}
3502 3525
 
3503 3526
 	if is_success != 1 {
@@ -3600,6 +3623,32 @@ func (c *StockDrugApiController) ReturnCheckWarehouseingInfo() {
3600 3623
 		//扣减库存
3601 3624
 		service.ReduceNewDrugStockCount(item.StorehouseId, item.DrugId, item.OrgId, total_count, over_count, tx)
3602 3625
 
3626
+		//改变扫码库里面的状态
3627
+		goodcodelist := strings.Split(item.DrugCode, ",")
3628
+
3629
+		if len(goodcodelist) > 0 {
3630
+			goodInfo, _ := service.GetNewGoodByIdIsStop(item.DrugId, item.OrgId, tx)
3631
+			for _, it := range goodcodelist {
3632
+				if it != "" {
3633
+					codeInfo := models.XtDrugCodeInfo{
3634
+						DrugId:          item.DrugId,
3635
+						BatchNumber:     item.Number,
3636
+						DrugCode:        it,
3637
+						WarehouseInfoId: item.ID,
3638
+						IsUserCount:     0,
3639
+						IsOutStatus:     2,
3640
+						Status:          0,
3641
+						UserOrgId:       item.OrgId,
3642
+						Ctime:           time.Now().Unix(),
3643
+						Mtime:           time.Now().Unix(),
3644
+						SplitOfNumber:   goodInfo.SplitOfNumber,
3645
+					}
3646
+					service.UpdateDrugCodeInfo(codeInfo, tx)
3647
+				}
3648
+
3649
+			}
3650
+		}
3651
+
3603 3652
 	}
3604 3653
 	//更新审核
3605 3654
 	err := service.ReturnNewCheckWarehouseingInfo(warehousing_id, orgId, tx)

+ 10 - 2
controllers/manager_center_api_controller.go Wyświetl plik

@@ -172,6 +172,8 @@ func (c *ManagerCenterApiController) CreateBaseDrugLib() {
172 172
 	scan_code := c.GetString("scan_code")
173 173
 	drug_identification_code := c.GetString("drug_identification_code")
174 174
 
175
+	split_of_number, _ := c.GetInt64("split_of_number")
176
+
175 177
 	hans := drug_name // 要转换的汉字字符串
176 178
 
177 179
 	// 创建一个拼音转换器
@@ -266,6 +268,7 @@ func (c *ManagerCenterApiController) CreateBaseDrugLib() {
266 268
 		IsZeroFlag:                  is_zero_flag,
267 269
 		ScanCode:                    scan_code,
268 270
 		DrugIdentificationCode:      drug_identification_code,
271
+		SplitOfNumber:               split_of_number,
269 272
 	}
270 273
 	drugLib.FirstLetter = firstLetter
271 274
 	drugLib.Pinyin = firstLetter
@@ -393,7 +396,7 @@ func (c *ManagerCenterApiController) EditBaseDrugLib() {
393 396
 	is_zero_flag, _ := c.GetInt64("is_zero_flag")
394 397
 	scan_code := c.GetString("scan_code")
395 398
 	drug_identification_code := c.GetString("drug_identification_code")
396
-
399
+	split_of_number, _ := c.GetInt64("split_of_number")
397 400
 	adminInfo := c.GetAdminUserInfo()
398 401
 	drug, _ := service.FindBaseDrugLibRecord(adminInfo.CurrentOrgId, id)
399 402
 
@@ -494,6 +497,7 @@ func (c *ManagerCenterApiController) EditBaseDrugLib() {
494 497
 		IsZeroFlag:                  is_zero_flag,
495 498
 		ScanCode:                    scan_code,
496 499
 		DrugIdentificationCode:      drug_identification_code,
500
+		SplitOfNumber:               split_of_number,
497 501
 	}
498 502
 	if adminInfo.CurrentOrgId == 10206 || adminInfo.CurrentOrgId == 10344 {
499 503
 
@@ -1661,6 +1665,8 @@ func (c *ManagerCenterApiController) CreateGoodInfo() {
1661 1665
 	is_show, _ := c.GetInt64("is_show")
1662 1666
 	is_zero_flag, _ := c.GetInt64("is_zero_flag")
1663 1667
 
1668
+	split_of_number, _ := c.GetInt64("split_of_number")
1669
+
1664 1670
 	adminUserInfo := c.GetAdminUserInfo()
1665 1671
 
1666 1672
 	totals := service.FindGoodInfoByNameTwo(specification_name, adminUserInfo.CurrentOrgId, good_id, good_name)
@@ -1745,6 +1751,7 @@ func (c *ManagerCenterApiController) CreateGoodInfo() {
1745 1751
 		Bck01b:                      "55",
1746 1752
 		IsShow:                      is_show,
1747 1753
 		IsZeroFlag:                  is_zero_flag,
1754
+		SplitOfNumber:               split_of_number,
1748 1755
 	}
1749 1756
 	err, goodInfos := service.AddSigleGoodInfo(&goodInfo)
1750 1757
 	if err == nil {
@@ -1816,7 +1823,7 @@ func (c *ManagerCenterApiController) ModifyGoodInfo() {
1816 1823
 	bby01 := c.GetString("bby01")
1817 1824
 	is_show, _ := c.GetInt64("is_show")
1818 1825
 	is_zero_flag, _ := c.GetInt64("is_zero_flag")
1819
-
1826
+	split_of_number, _ := c.GetInt64("split_of_number")
1820 1827
 	// 创建一个拼音转换器
1821 1828
 	p := pinyin.NewArgs()
1822 1829
 
@@ -1893,6 +1900,7 @@ func (c *ManagerCenterApiController) ModifyGoodInfo() {
1893 1900
 		Bck01b:                      "55",
1894 1901
 		IsShow:                      is_show,
1895 1902
 		IsZeroFlag:                  is_zero_flag,
1903
+		SplitOfNumber:               split_of_number,
1896 1904
 	}
1897 1905
 
1898 1906
 	totals := service.FindGoodInfoByNameOne(specification_name, adminUserInfo.CurrentOrgId, good_id, id, good_name)

+ 22 - 18
controllers/mobile_api_controllers/dialysis_api_controller.go Wyświetl plik

@@ -4388,7 +4388,7 @@ func (this *DialysisAPIController) StartDialysis() {
4388 4388
 				}
4389 4389
 			}
4390 4390
 
4391
-			if adminUserInfo.Org.Id == 10766 || adminUserInfo.Org.Id == 10768 {
4391
+			if adminUserInfo.Org.Id == 10766 || adminUserInfo.Org.Id == 10768 || adminUserInfo.Org.Id == 9478 {
4392 4392
 				if prescription.ModeId == 2 || prescription.ModeId == 13 {
4393 4393
 					totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
4394 4394
 					if totalMin == 0 {
@@ -5953,25 +5953,8 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5953 5953
 		var displacement_quantity float64
5954 5954
 		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5955 5955
 
5956
-		//replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*60) / 1000
5957
-		////乘10 除10是为了保留一位小数
5958 5956
 		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
5959
-		fmt.Println("replacement_rate", replacement_rate)
5960
-		record.ReplacementRate = replacement_rate
5961
-		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
5962
-		record.DisplacementQuantity = displacement_quantity
5963
-		//fmt.Println("totalMin", totalMin)
5964
-		//fmt.Println("math.Floor(prescription", math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*60))
5965
-		//fmt.Println("replacement_rate", replacement_rate)
5966
-		//fmt.Println("math.Floor", math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600))
5967
-		//fmt.Println("displacement_quantity===================", displacement_quantity)
5968
-	}
5969 5957
 
5970
-	if adminInfo.Org.Id == 9478 {
5971
-		var replacement_rate float64
5972
-		var displacement_quantity float64
5973
-		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5974
-		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*60) / 1000
5975 5958
 		record.ReplacementRate = replacement_rate
5976 5959
 		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
5977 5960
 		record.DisplacementQuantity = displacement_quantity
@@ -5996,6 +5979,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
5996 5979
 		var displacement_quantity float64
5997 5980
 		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
5998 5981
 		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*60) / 1000
5982
+
5999 5983
 		record.ReplacementRate = replacement_rate
6000 5984
 		displacement_quantity = math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime)/3600) * replacement_rate
6001 5985
 		record.DisplacementQuantity = displacement_quantity
@@ -6032,6 +6016,22 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
6032 6016
 		record.UltrafiltrationVolume = ultrafiltration_volume / 1000
6033 6017
 	}
6034 6018
 
6019
+	if adminInfo.Org.Id == 9478 {
6020
+		totalMin := prescription.DialysisDurationHour*60 + prescription.DialysisDurationMinute
6021
+		if totalMin == 0 {
6022
+			totalMin = 240
6023
+		}
6024
+		if prescription.DisplaceLiquiValue == 0 {
6025
+			prescription.DisplaceLiquiValue = 15
6026
+		}
6027
+		var replacement_rate float64
6028
+		//乘10 除10是为了保留一位小数
6029
+		replacement_rate = math.Floor(prescription.DisplaceLiquiValue*1000/float64(totalMin)*10) / 10
6030
+
6031
+		fmt.Println("hahahahahhaahahah", replacement_rate)
6032
+		record.ReplacementRate = replacement_rate
6033
+	}
6034
+
6035 6035
 	lastMonitorRecordList, _ := service.GetLastMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)
6036 6036
 
6037 6037
 	fisrtMonitorRecordList, _ := service.GetFisrtMonitorRecordList(patientID, monitorDate, adminInfo.Org.Id)
@@ -13353,6 +13353,7 @@ func (c *DialysisAPIController) BatchAdviceExeCutionList() {
13353 13353
 
13354 13354
 	dataBody := make(map[string]interface{}, 0)
13355 13355
 	err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
13356
+
13356 13357
 	if err != nil {
13357 13358
 		utils.ErrorLog(err.Error())
13358 13359
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -13360,6 +13361,7 @@ func (c *DialysisAPIController) BatchAdviceExeCutionList() {
13360 13361
 	}
13361 13362
 	orgId := c.GetMobileAdminUserInfo().Org.Id
13362 13363
 	patient_id := int64(dataBody["patient_id"].(float64))
13364
+
13363 13365
 	record_date := int64(dataBody["record_date"].(float64))
13364 13366
 
13365 13367
 	execution_staff := int64(dataBody["execution_staff"].(float64))
@@ -13367,6 +13369,7 @@ func (c *DialysisAPIController) BatchAdviceExeCutionList() {
13367 13369
 	execution_time := dataBody["execution_time"].(string)
13368 13370
 
13369 13371
 	executionTime, parseStartDateErr := utils.ParseTimeStringToTime("2006-01-02 15:04:05", execution_time)
13372
+
13370 13373
 	if parseStartDateErr != nil {
13371 13374
 		c.ErrorLog("时间解析失败:%v", parseStartDateErr)
13372 13375
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -13378,6 +13381,7 @@ func (c *DialysisAPIController) BatchAdviceExeCutionList() {
13378 13381
 	var team_list []int64
13379 13382
 	if dataBody["new_advice_list"] != nil && reflect.TypeOf(dataBody["new_advice_list"]).String() == "[]interface {}" {
13380 13383
 		newAdviceList, _ := dataBody["new_advice_list"].([]interface{})
13384
+
13381 13385
 		if len(newAdviceList) > 0 {
13382 13386
 			for _, item := range newAdviceList {
13383 13387
 				items := item.(map[string]interface{})

+ 6 - 9
controllers/mobile_api_controllers/dialysis_api_controller_extend.go Wyświetl plik

@@ -2,7 +2,6 @@ package mobile_api_controllers
2 2
 
3 3
 import (
4 4
 	"encoding/json"
5
-	"fmt"
6 5
 	"strconv"
7 6
 	"time"
8 7
 
@@ -60,8 +59,6 @@ func (this *DialysisAPIController) AddMonitorRecord() {
60 59
 		operateTime = 0
61 60
 		// recordTime = ""
62 61
 	}
63
-	fmt.Println(date)
64
-	fmt.Println(operateTime)
65 62
 
66 63
 	pulseFrequency, _ := this.GetFloat("pulse_frequency")
67 64
 	//breathingRated, _ := this.GetFloat("breathing_rated")
@@ -267,7 +264,7 @@ func (this *DialysisAPIController) AddMonitorRecord() {
267 264
 		AccumulatedBloodVolumeOne:        accumulated_blood_volume_one,
268 265
 	}
269 266
 
270
-	err := service.CreateMonitor(&record)
267
+	service.CreateMonitor(&record)
271 268
 	//记录日志
272 269
 	byterequest, _ := json.Marshal(record)
273 270
 	monitorRecordLog := models.XtMonitorRecordLog{
@@ -297,7 +294,7 @@ func (this *DialysisAPIController) AddMonitorRecord() {
297 294
 		PatientId:  patientID,
298 295
 	}
299 296
 
300
-	dialysisFinish, err := service.GetDialysisFinish(record.UserOrgId, record.MonitoringDate, 7, patientID)
297
+	dialysisFinish, _ := service.GetDialysisFinish(record.UserOrgId, record.MonitoringDate, 7, patientID)
301 298
 	if dialysisFinish.ID == 0 {
302 299
 		service.CreateDialysisFinish(finish)
303 300
 	}
@@ -308,10 +305,10 @@ func (this *DialysisAPIController) AddMonitorRecord() {
308 305
 	keyOne := strconv.FormatInt(adminInfo.Org.Id, 10) + ":" + strconv.FormatInt(date, 10) + ":monitor_record_list_all"
309 306
 	redis.Set(keyOne, "", time.Second)
310 307
 	defer redis.Close()
311
-	if err != nil {
312
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeMonitorCreate)
313
-		return
314
-	}
308
+	//if err != nil {
309
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeMonitorCreate)
310
+	//	return
311
+	//}
315 312
 
316 313
 	this.ServeSuccessJSON(map[string]interface{}{
317 314
 		"monitor": record,

+ 1 - 0
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go Wyświetl plik

@@ -3068,6 +3068,7 @@ func (this *NewDialysisApiController) GetInspectionGroup() {
3068 3068
 	org_id := this.GetMobileAdminUserInfo().Org.Id
3069 3069
 
3070 3070
 	patient, _ := service.GetPatientDetailTwo(patient_id)
3071
+
3071 3072
 	inspection, _ := service.GetInspectionGroup(patient.BloodId, org_id)
3072 3073
 
3073 3074
 	if len(inspection) > 0 {

+ 29 - 6
controllers/self_drug_api_congtroller.go Wyświetl plik

@@ -203,6 +203,8 @@ func SelfDrugRouters() {
203 203
 
204 204
 	beego.Router("/api/drug/getdrugwarehouseinfoprintlist", &SelfDrugApiController{}, "Get:GetDrugWarehouseInfoPrintList")
205 205
 
206
+	beego.Router("/api/patient/changegoodwarehouseinfo", &SelfDrugApiController{}, "Post:ChangeGoodWarehouseInfo")
207
+
206 208
 }
207 209
 
208 210
 func (this *SelfDrugApiController) GetCurrentPatient() {
@@ -2960,6 +2962,7 @@ func (this *SelfDrugApiController) GetGoodNewQuery() {
2960 2962
 	keyword := this.GetString("keyword")
2961 2963
 	page, _ := this.GetInt64("page")
2962 2964
 	limit, _ := this.GetInt64("limit")
2965
+	good_type_id, _ := this.GetInt64("good_type_id")
2963 2966
 
2964 2967
 	// 查询该机构所有耗材入库信息
2965 2968
 	//goodList, _ := service.GetAllGoodListSeven(orgId)
@@ -2983,7 +2986,7 @@ func (this *SelfDrugApiController) GetGoodNewQuery() {
2983 2986
 		}
2984 2987
 	}
2985 2988
 
2986
-	stockList, total, err := service.GetGoodStockList(orgId, storehouse_id, good_type, keyword, page, limit, ids)
2989
+	stockList, total, err := service.GetGoodStockList(orgId, storehouse_id, good_type, keyword, page, limit, ids, good_type_id)
2987 2990
 
2988 2991
 	if err != nil {
2989 2992
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取查询信息失败")
@@ -3867,6 +3870,8 @@ func (this *SelfDrugApiController) GetGoodNewPurchaseStockQuery() {
3867 3870
 	start_time := this.GetString("start_time")
3868 3871
 	end_time := this.GetString("end_time")
3869 3872
 	orgId := this.GetAdminUserInfo().CurrentOrgId
3873
+
3874
+	query_type, _ := this.GetInt64("query_type")
3870 3875
 	timeLayout := "2006-01-02"
3871 3876
 	loc, _ := time.LoadLocation("Local")
3872 3877
 	var startTime int64
@@ -3906,10 +3911,10 @@ func (this *SelfDrugApiController) GetGoodNewPurchaseStockQuery() {
3906 3911
 	medicalInsuranceLevelParent, _ := service.GetDrugDataConfig(0, medicalInsuranceLevel)
3907 3912
 	medicalInsuranceLevelList, _ := service.GetParentDataConfig(medicalInsuranceLevelParent.ID, orgId)
3908 3913
 
3909
-	if orgId == 10265 {
3914
+	if orgId == 10265 || orgId == 10138 {
3910 3915
 		//storeConfig, _ := service.GetAllStoreHouseConfig(orgId)
3911 3916
 
3912
-		list, total, err := service.GetGoodNewPurchaseStockQuery(good_type, keyword, page, limit, orgId, ids, goodIds)
3917
+		list, total, err := service.GetGoodNewPurchaseStockQuery(good_type, keyword, page, limit, orgId, ids, goodIds, query_type)
3913 3918
 
3914 3919
 		for _, item := range list {
3915 3920
 
@@ -3979,8 +3984,8 @@ func (this *SelfDrugApiController) GetGoodNewPurchaseStockQuery() {
3979 3984
 		})
3980 3985
 	}
3981 3986
 
3982
-	if orgId != 10265 {
3983
-		list, total, err := service.GetGoodNewPurchaseStockQueryOne(good_type, keyword, page, limit, orgId, ids, goodIds)
3987
+	if orgId != 10265 && orgId != 10138 {
3988
+		list, total, err := service.GetGoodNewPurchaseStockQueryOne(good_type, keyword, page, limit, orgId, ids, goodIds, query_type)
3984 3989
 		storeConfig, _ := service.GetAllStoreHouseConfig(orgId)
3985 3990
 		for _, item := range list {
3986 3991
 
@@ -4094,6 +4099,8 @@ func (this *SelfDrugApiController) GetPurchaseNewDrugQuery() {
4094 4099
 
4095 4100
 	start_time := this.GetString("start_time")
4096 4101
 	end_time := this.GetString("end_time")
4102
+
4103
+	query_type, _ := this.GetInt64("query_type")
4097 4104
 	orgId := this.GetAdminUserInfo().CurrentOrgId
4098 4105
 	timeLayout := "2006-01-02"
4099 4106
 	loc, _ := time.LoadLocation("Local")
@@ -4130,7 +4137,7 @@ func (this *SelfDrugApiController) GetPurchaseNewDrugQuery() {
4130 4137
 	}
4131 4138
 
4132 4139
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
4133
-	list, total, err := service.GetDrugNewPurchaseStockQuery(good_type, keyword, page, limit, orgId, startTime, endTime, ids, infoIds)
4140
+	list, total, err := service.GetDrugNewPurchaseStockQuery(good_type, keyword, page, limit, orgId, startTime, endTime, ids, infoIds, query_type)
4134 4141
 
4135 4142
 	for _, item := range list {
4136 4143
 
@@ -6910,3 +6917,19 @@ func (this *SelfDrugApiController) GetDrugWarehouseInfoPrintList() {
6910 6917
 	})
6911 6918
 
6912 6919
 }
6920
+
6921
+func (this *SelfDrugApiController) ChangeGoodWarehouseInfo() {
6922
+
6923
+	dataBody := make(map[string]interface{}, 0)
6924
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
6925
+	fmt.Println(err)
6926
+	id := int64(dataBody["id"].(float64))
6927
+	good_code := dataBody["good_code"].(string)
6928
+
6929
+	service.ModifyGoodCodeWarehouseInfo(id, good_code)
6930
+
6931
+	this.ServeSuccessJSON(map[string]interface{}{
6932
+		"msg": "ok",
6933
+	})
6934
+
6935
+}

+ 51 - 0
controllers/stock_in_api_controller.go Wyświetl plik

@@ -7616,6 +7616,31 @@ func (this *StockManagerApiController) CheckWarehouseInfo() {
7616 7616
 				return
7617 7617
 			}
7618 7618
 
7619
+			goodcodelist := strings.Split(item.GoodCode, ",")
7620
+
7621
+			if len(goodcodelist) > 0 {
7622
+				goodInfo, _ := service.GetNewGoodByIdIsStop(item.GoodId, item.OrgId, tx)
7623
+				for _, it := range goodcodelist {
7624
+					if it != "" {
7625
+						codeInfo := models.XtGoodCodeInfo{
7626
+							GoodId:          item.GoodId,
7627
+							BatchNumber:     item.Number,
7628
+							GoodCode:        it,
7629
+							WarehouseInfoId: item.ID,
7630
+							IsUserCount:     0,
7631
+							IsOutStatus:     2,
7632
+							Status:          1,
7633
+							UserOrgId:       item.OrgId,
7634
+							Ctime:           time.Now().Unix(),
7635
+							Mtime:           time.Now().Unix(),
7636
+							SplitOfNumber:   goodInfo.SplitOfNumber,
7637
+						}
7638
+						service.CreateCodeInfo(codeInfo, tx)
7639
+					}
7640
+
7641
+				}
7642
+			}
7643
+
7619 7644
 		}
7620 7645
 	}
7621 7646
 	if is_success != 1 {
@@ -7657,6 +7682,32 @@ func (this *StockManagerApiController) ReturnCheckWarehouseInfo() {
7657 7682
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCheckGoodParamWrong)
7658 7683
 			return
7659 7684
 		}
7685
+
7686
+		//改变扫码库里面的状态
7687
+		goodcodelist := strings.Split(item.GoodCode, ",")
7688
+
7689
+		if len(goodcodelist) > 0 {
7690
+			goodInfo, _ := service.GetNewGoodByIdIsStop(item.GoodId, item.OrgId, tx)
7691
+			for _, it := range goodcodelist {
7692
+				if it != "" {
7693
+					codeInfo := models.XtGoodCodeInfo{
7694
+						GoodId:          item.GoodId,
7695
+						BatchNumber:     item.Number,
7696
+						GoodCode:        it,
7697
+						WarehouseInfoId: item.ID,
7698
+						IsUserCount:     0,
7699
+						IsOutStatus:     2,
7700
+						Status:          0,
7701
+						UserOrgId:       item.OrgId,
7702
+						Ctime:           time.Now().Unix(),
7703
+						Mtime:           time.Now().Unix(),
7704
+						SplitOfNumber:   goodInfo.SplitOfNumber,
7705
+					}
7706
+					service.UpdateCodeInfo(codeInfo, tx)
7707
+				}
7708
+
7709
+			}
7710
+		}
7660 7711
 	}
7661 7712
 
7662 7713
 	err := service.UpdateNewWarehouseInfoMap(list, warehousing_info_id, orgId, tx)

+ 2 - 0
models/drug.go Wyświetl plik

@@ -94,6 +94,7 @@ type BaseDrugLib struct {
94 94
 	IsZeroFlag             int64  `gorm:"column:is_zero_flag" json:"is_zero_flag" form:"is_zero_flag"`
95 95
 	ScanCode               string `gorm:"column:scan_code" json:"scan_code" form:"scan_code"`
96 96
 	DrugIdentificationCode string `gorm:"column:drug_identification_code" json:"drug_identification_code" form:"drug_identification_code"`
97
+	SplitOfNumber          int64  `gorm:"column:split_of_number" json:"split_of_number" form:"split_of_number"`
97 98
 }
98 99
 
99 100
 func (BaseDrugLib) TableName() string {
@@ -118,6 +119,7 @@ type BaseDrugLibSeven struct {
118 119
 	IsZeroFlag                  int64  `gorm:"column:is_zero_flag" json:"is_zero_flag" form:"is_zero_flag"`
119 120
 	MedicalInsuranceLevel       int64  `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
120 121
 	SocialSecurityDirectoryCode string `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
122
+	SplitOfNumber               int64  `gorm:"column:split_of_number" json:"split_of_number" form:"split_of_number"`
121 123
 }
122 124
 
123 125
 func (BaseDrugLibSeven) TableName() string {

+ 3 - 2
models/good_models.go Wyświetl plik

@@ -106,8 +106,8 @@ type GoodInfo struct {
106 106
 	Bby01                       string               `gorm:"column:bby01" json:"bby01" form:"bby01"`
107 107
 	Bck01b                      string               `gorm:"column:bck01b" json:"bck01b" form:"bck01b"`
108 108
 	IsZeroFlag                  int64                `gorm:"column:is_zero_flag" json:"is_zero_flag" form:"is_zero_flag"`
109
-
110
-	ZuobiaoId string `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
109
+	SplitOfNumber               int64                `gorm:"column:split_of_number" json:"split_of_number" form:"split_of_number"`
110
+	ZuobiaoId                   string               `gorm:"column:zuobiao_id" json:"zuobiao_id" form:"zuobiao_id"`
111 111
 
112 112
 	WarehousingInfoOne []*StartWarehousingInfo `gorm:"json:"warehouse_info"` //期间增加
113 113
 
@@ -330,6 +330,7 @@ type GoodInfoSeven struct {
330 330
 	GoodStatus        string `gorm:"column:good_status" json:"good_status" form:"good_status"`
331 331
 	SpecificationName string `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
332 332
 	SumCount          int64  `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
333
+	SplitOfNumber     int64  `gorm:"column:split_of_number" json:"split_of_number" form:"split_of_number"`
333 334
 }
334 335
 
335 336
 func (GoodInfoSeven) TableName() string {

+ 2 - 0
models/new_stock_models.go Wyświetl plik

@@ -290,6 +290,7 @@ type GoodInfoTwenty struct {
290 290
 	GoodNumber                  string                  `gorm:"column:good_number" json:"good_number" form:"good_number"`
291 291
 	SocialSecurityDirectoryCode string                  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
292 292
 	MedicalInsuranceLevel       int64                   `gorm:"column:medical_insurance_level" json:"medical_insurance_level" form:"medical_insurance_level"`
293
+	StockWarnCount              int64                   `gorm:"column:stock_warn_count" json:"stock_warn_count" form:"stock_warn_count"`
293 294
 	StWarehousingInfo           []*StWarehousingInfo    `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"xt_warehouse_info"`
294 295
 	WarehousingInfoOne          []*StartWarehousingInfo `gorm:"json:"warehouse_info"` //期间增加
295 296
 	WarehousingInfoStart        []*StartWarehousingInfo `gorm:"json:"warehouse_info_start"`
@@ -428,6 +429,7 @@ type VmBaseDrugTwenty struct {
428 429
 	Mtime                            int64             `gorm:"column:mtime" json:"mtime" form:"mtime"`
429 430
 	OrgId                            int64             `gorm:"column:org_id" json:"org_id" form:"org_id"`
430 431
 	IsSelfDrug                       int64             `gorm:"column:is_self_drug" json:"is_self_drug" form:"is_self_drug"`
432
+	DrugStockLimitCount              int64             `gorm:"column:drug_stock_limit_count" json:"drug_stock_limit_count" form:"drug_stock_limit_count"`
431 433
 	MedicalInsuranceNumber           string            `gorm:"column:medical_insurance_number" json:"medical_insurance_number" form:"medical_insurance_number"`
432 434
 	DrugFlowWarehouseInfo            []*DrugFlowTwenty `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_flow_info"`
433 435
 	DrugActFlowWarehouseInfo         []*DrugFlowTwenty `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_act_flow_info"`

+ 39 - 0
models/stock_models.go Wyświetl plik

@@ -1783,6 +1783,7 @@ type XtWarehouseInfoEight struct {
1783 1783
 	IsUpload                  int64   `gorm:"column:is_upload" json:"is_upload" form:"is_upload"`
1784 1784
 	ManafacturerName          string  `gorm:"column:manafacturer_name" json:"manafacturer_name" form:"manafacturer_name"`
1785 1785
 	DealerName                string  `gorm:"column:dealer_name" json:"dealer_name" form:"dealer_name"`
1786
+	GoodCode                  string  `gorm:"column:good_code" json:"good_code" form:"good_code"`
1786 1787
 }
1787 1788
 
1788 1789
 func (XtWarehouseInfoEight) TableName() string {
@@ -1953,3 +1954,41 @@ type PrintDrugWarehouseInfo struct {
1953 1954
 func (PrintDrugWarehouseInfo) TableName() string {
1954 1955
 	return "xt_drug_warehouse_info"
1955 1956
 }
1957
+
1958
+type XtGoodCodeInfo struct {
1959
+	ID              int64  `gorm:"column:id" json:"id" form:"id"`
1960
+	GoodId          int64  `gorm:"column:good_id" json:"good_id" form:"good_id"`
1961
+	BatchNumber     string `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
1962
+	GoodCode        string `gorm:"column:good_code" json:"good_code" form:"good_code"`
1963
+	WarehouseInfoId int64  `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
1964
+	IsUserCount     int64  `gorm:"column:is_user_count" json:"is_user_count" form:"is_user_count"`
1965
+	IsOutStatus     int64  `gorm:"column:is_out_status" json:"is_out_status" form:"is_out_status"`
1966
+	Status          int64  `gorm:"column:status" json:"status" form:"status"`
1967
+	UserOrgId       int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1968
+	Ctime           int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1969
+	Mtime           int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1970
+	SplitOfNumber   int64  `gorm:"column:split_of_number" json:"split_of_number" form:"split_of_number"`
1971
+}
1972
+
1973
+func (XtGoodCodeInfo) TableName() string {
1974
+	return "xt_good_code_info"
1975
+}
1976
+
1977
+type XtDrugCodeInfo struct {
1978
+	ID              int64  `gorm:"column:id" json:"id" form:"id"`
1979
+	DrugId          int64  `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
1980
+	BatchNumber     string `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
1981
+	DrugCode        string `gorm:"column:drug_code" json:"drug_code" form:"drug_code"`
1982
+	WarehouseInfoId int64  `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
1983
+	IsUserCount     int64  `gorm:"column:is_user_count" json:"is_user_count" form:"is_user_count"`
1984
+	IsOutStatus     int64  `gorm:"column:is_out_status" json:"is_out_status" form:"is_out_status"`
1985
+	Status          int64  `gorm:"column:status" json:"status" form:"status"`
1986
+	UserOrgId       int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
1987
+	Ctime           int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
1988
+	Mtime           int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
1989
+	SplitOfNumber   int64  `gorm:"column:split_of_number" json:"split_of_number" form:"split_of_number"`
1990
+}
1991
+
1992
+func (XtDrugCodeInfo) TableName() string {
1993
+	return "xt_drug_code_info"
1994
+}

+ 3 - 3
service/common_service.go Wyświetl plik

@@ -2493,7 +2493,7 @@ func GetMonthProjectListThree(orgid int64, lapseto int64, modetype int64, januar
2493 2493
 func GetPatientsControl(orgid int64, lapstor int64, startime int64, endtime int64, page int64, limit int64) (inspection []*models.PatientInspectionCount, total int64, err error) {
2494 2494
 
2495 2495
 	db := readDb.Table("xt_inspection as x").Where("x.status =1")
2496
-	table := readDb.Table("xt_patients as s")
2496
+	table := readDb.Table("xt_patients as s").Where("s.patient_type =1")
2497 2497
 	fmt.Println(table)
2498 2498
 	d := readDb.Table(" xt_inspection_reference as r")
2499 2499
 	fmt.Println(d)
@@ -2557,7 +2557,7 @@ func GetPatientsControl(orgid int64, lapstor int64, startime int64, endtime int6
2557 2557
 func GetLastPatientsControl(orgid int64, lapstor int64, startime int64, endtime int64) (inspection []*models.PatientInspectionCount, err error) {
2558 2558
 
2559 2559
 	db := readDb.Table("xt_inspection as x").Where("x.status =1")
2560
-	table := readDb.Table("xt_patients as s")
2560
+	table := readDb.Table("xt_patients as s").Where("s.patient_type =1")
2561 2561
 	//fmt.Println(table)
2562 2562
 	d := readDb.Table(" xt_inspection_reference as r")
2563 2563
 	fmt.Println(d)
@@ -2673,7 +2673,7 @@ func GetInfectiousPatientsControl(orgid int64, lapstor int64, startime int64, en
2673 2673
 
2674 2674
 func GetInfectiousControl(orgid int64, lapstor int64, startime int64, endtime int64) (inspection []*models.PatientInspectionCount, err error) {
2675 2675
 	db := readDb.Table("xt_inspection as x").Where("x.status =1")
2676
-	table := readDb.Table("xt_patients as s")
2676
+	table := readDb.Table("xt_patients as s").Where("s.patient_type =1")
2677 2677
 	fmt.Println(table)
2678 2678
 	d := readDb.Table(" xt_inspection_reference as r")
2679 2679
 	fmt.Println(d)

+ 2 - 2
service/doctor_advice_service.go Wyświetl plik

@@ -550,7 +550,7 @@ func GetDoctorAdivceMonthList(user_org_id int64, start_time int64, end_time int6
550 550
 		db = db.Where("advice_date<=?", end_time)
551 551
 	}
552 552
 
553
-	err = db.Find(&list).Error
553
+	err = db.Order("advice_name").Find(&list).Error
554 554
 
555 555
 	return list, err
556 556
 }
@@ -569,7 +569,7 @@ func GetHisDoctorAdivceMonthList(user_org_id int64, start_time int64, end_time i
569 569
 		db = db.Where("advice_date<=?", end_time)
570 570
 	}
571 571
 
572
-	err = db.Preload("Drug", "status=1 and org_id = ?", user_org_id).Find(&list).Error
572
+	err = db.Preload("Drug", "status=1 and org_id = ?", user_org_id).Order("advice_name").Find(&list).Error
573 573
 
574 574
 	return list, err
575 575
 }

+ 66 - 0
service/his_service.go Wyświetl plik

@@ -3117,6 +3117,72 @@ func GetGoodByIdIsStop(good_id int64, org_id int64) (models.GoodInfoSeven, error
3117 3117
 	return goodInfoSeven, err
3118 3118
 }
3119 3119
 
3120
+func GetNewGoodByIdIsStop(good_id int64, org_id int64, tx *gorm.DB) (models.GoodInfoSeven, error) {
3121
+
3122
+	goodInfoSeven := models.GoodInfoSeven{}
3123
+	err = tx.Where("org_id = ? and status = 1  and id =?", org_id, good_id).Find(&goodInfoSeven).Error
3124
+	if err != gorm.ErrRecordNotFound {
3125
+		if err != nil {
3126
+			tx.Rollback()
3127
+			return goodInfoSeven, err
3128
+		}
3129
+	}
3130
+	return goodInfoSeven, err
3131
+}
3132
+
3133
+func GetNewDrugByIdIsStop(good_id int64, org_id int64, tx *gorm.DB) (models.BaseDrugLibSeven, error) {
3134
+
3135
+	goodInfoSeven := models.BaseDrugLibSeven{}
3136
+	err = tx.Where("org_id = ? and status = 1  and id =?", org_id, good_id).Find(&goodInfoSeven).Error
3137
+	if err != gorm.ErrRecordNotFound {
3138
+		if err != nil {
3139
+			tx.Rollback()
3140
+			return goodInfoSeven, err
3141
+		}
3142
+	}
3143
+	return goodInfoSeven, err
3144
+}
3145
+
3146
+func CreateCodeInfo(info models.XtGoodCodeInfo, tx *gorm.DB) error {
3147
+
3148
+	err := tx.Create(&info).Error
3149
+	if err != nil {
3150
+		tx.Rollback()
3151
+		return err
3152
+	}
3153
+	return err
3154
+}
3155
+
3156
+func CreateDrugCodeInfo(info models.XtDrugCodeInfo, tx *gorm.DB) error {
3157
+
3158
+	err := tx.Create(&info).Error
3159
+	if err != nil {
3160
+		tx.Rollback()
3161
+		return err
3162
+	}
3163
+	return err
3164
+}
3165
+
3166
+func UpdateCodeInfo(info models.XtGoodCodeInfo, tx *gorm.DB) error {
3167
+
3168
+	err := tx.Model(&info).Where("warehouse_info_id = ? and good_code =? and status=1 and user_org_id =?", info.WarehouseInfoId, info.GoodCode, info.UserOrgId).Updates(map[string]interface{}{"status": 0}).Error
3169
+	if err != nil {
3170
+		tx.Rollback()
3171
+		return err
3172
+	}
3173
+	return err
3174
+}
3175
+
3176
+func UpdateDrugCodeInfo(info models.XtDrugCodeInfo, tx *gorm.DB) error {
3177
+
3178
+	err := tx.Model(&info).Where("warehouse_info_id = ? and drug_code =? and status=1 and user_org_id =?", info.WarehouseInfoId, info.DrugCode, info.UserOrgId).Updates(map[string]interface{}{"status": 0}).Error
3179
+	if err != nil {
3180
+		tx.Rollback()
3181
+		return err
3182
+	}
3183
+	return err
3184
+}
3185
+
3120 3186
 func GetHisPrescriptionByBatchNumber(org_id int64, number string) (prescription []*models.HisPrescription, err error) {
3121 3187
 	err = readDb.Model(&models.HisPrescription{}).
3122 3188
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {

+ 9 - 0
service/manage_center_service.go Wyświetl plik

@@ -1140,3 +1140,12 @@ func UpdateHisAdviceListTemplate(id int64, price float64) error {
1140 1140
 	err := XTWriteDB().Model(&models.HisPrescriptionAdviceTemplate{}).Where("id =? and status=1", id).Updates(map[string]interface{}{"price": price}).Error
1141 1141
 	return err
1142 1142
 }
1143
+
1144
+func ModifyGoodCodeWarehouseInfo(id int64, good_code string) (models.XtWarehouseInfoEight, error) {
1145
+
1146
+	info := models.XtWarehouseInfoEight{}
1147
+
1148
+	err := XTWriteDB().Model(&info).Where("id = ? and status=1", id).Updates(map[string]interface{}{"good_code": good_code}).Error
1149
+
1150
+	return info, err
1151
+}

+ 6 - 2
service/new_stock_service.go Wyświetl plik

@@ -110,14 +110,18 @@ func CreateGoodErrcode(errcode models.XtGoodErrcode) error {
110 110
 	return err
111 111
 }
112 112
 
113
-func GetGoodStockList(orgId int64, storehouse_id int64, good_type int64, keyword string, page int64, limit int64, ids []int64) (good []*models.GoodInformation, total int64, err error) {
113
+func GetGoodStockList(orgId int64, storehouse_id int64, good_type int64, keyword string, page int64, limit int64, ids []int64, good_type_id int64) (good []*models.GoodInformation, total int64, err error) {
114 114
 	offset := (page - 1) * limit
115 115
 	likeKey := "%" + keyword + "%"
116 116
 
117 117
 	db := XTReadDB().Table("xt_good_information as x").Where("x.status = 1  and x.org_id =? and find_in_set('停用',x.good_status) = 0", orgId)
118 118
 
119
+	if good_type_id > 0 {
120
+		db = db.Where("x.good_type_id = ?", good_type_id)
121
+	}
122
+
119 123
 	if good_type == 2 {
120
-		db = db.Where(" x.total_count<=x.stock_warn_count")
124
+		db = db.Where(" x.sum_count<=x.stock_warn_count")
121 125
 	}
122 126
 
123 127
 	if good_type == 3 {

+ 36 - 3
service/self_drug_service.go Wyświetl plik

@@ -2858,7 +2858,7 @@ func CreateDrugStockCount(stockCount models.XtDrugStockCount) error {
2858 2858
 	return err
2859 2859
 }
2860 2860
 
2861
-func GetGoodNewPurchaseStockQuery(good_type int64, keyword string, page int64, limit int64, orgid int64, ids []int64, goodIds []int64) (goodinfo []*models.GoodInfoTwenty, total int64, err error) {
2861
+func GetGoodNewPurchaseStockQuery(good_type int64, keyword string, page int64, limit int64, orgid int64, ids []int64, goodIds []int64, query_type int64) (goodinfo []*models.GoodInfoTwenty, total int64, err error) {
2862 2862
 
2863 2863
 	db := XTReadDB().Model(&goodinfo).Where("status = 1")
2864 2864
 	offset := (page - 1) * limit
@@ -2870,6 +2870,17 @@ func GetGoodNewPurchaseStockQuery(good_type int64, keyword string, page int64, l
2870 2870
 	if orgid > 0 {
2871 2871
 		db = db.Where("org_id = ?", orgid)
2872 2872
 	}
2873
+
2874
+	if query_type == 2 {
2875
+		db = db.Where("sum_count<=stock_warn_count")
2876
+	}
2877
+	if query_type == 3 {
2878
+		db = db.Where("sum_count = 0")
2879
+	}
2880
+
2881
+	if query_type == 4 {
2882
+		db = db.Where("sum_count > 0")
2883
+	}
2873 2884
 	//if len(ids) > 0 {
2874 2885
 	//	db = db.Where("id in(?)", goodIds)
2875 2886
 	//}
@@ -2881,7 +2892,7 @@ func GetGoodNewPurchaseStockQuery(good_type int64, keyword string, page int64, l
2881 2892
 	return goodinfo, total, err
2882 2893
 }
2883 2894
 
2884
-func GetGoodNewPurchaseStockQueryOne(good_type int64, keyword string, page int64, limit int64, orgid int64, ids []int64, goodIds []int64) (goodinfo []*models.GoodInfoTwenty, total int64, err error) {
2895
+func GetGoodNewPurchaseStockQueryOne(good_type int64, keyword string, page int64, limit int64, orgid int64, ids []int64, goodIds []int64, query_type int64) (goodinfo []*models.GoodInfoTwenty, total int64, err error) {
2885 2896
 
2886 2897
 	db := XTReadDB().Model(&goodinfo).Where("status = 1")
2887 2898
 	if orgid == 10697 || orgid == 10644 {
@@ -2893,6 +2904,17 @@ func GetGoodNewPurchaseStockQueryOne(good_type int64, keyword string, page int64
2893 2904
 		db = db.Where("good_type_id = ?", good_type)
2894 2905
 	}
2895 2906
 
2907
+	if query_type == 2 {
2908
+		db = db.Where("sum_count<=stock_warn_count")
2909
+	}
2910
+	if query_type == 3 {
2911
+		db = db.Where("sum_count = 0")
2912
+	}
2913
+
2914
+	if query_type == 4 {
2915
+		db = db.Where("sum_count > 0")
2916
+	}
2917
+
2896 2918
 	if orgid > 0 {
2897 2919
 		db = db.Where("org_id = ?", orgid)
2898 2920
 	}
@@ -2942,7 +2964,7 @@ func GetGoodWarehosueInfo(id int64) (models.WarehousingInfo, error) {
2942 2964
 	return info, err
2943 2965
 }
2944 2966
 
2945
-func GetDrugNewPurchaseStockQuery(good_type int64, keyword string, page int64, limit int64, orgid int64, startime int64, endtime int64, ids []int64, infos []int64) (druginfo []*models.VmBaseDrugTwenty, total int64, err error) {
2967
+func GetDrugNewPurchaseStockQuery(good_type int64, keyword string, page int64, limit int64, orgid int64, startime int64, endtime int64, ids []int64, infos []int64, query_type int64) (druginfo []*models.VmBaseDrugTwenty, total int64, err error) {
2946 2968
 
2947 2969
 	db := XTReadDB().Model(&druginfo).Where("status = 1 and is_self_drug!=1")
2948 2970
 	offset := (page - 1) * limit
@@ -2954,6 +2976,17 @@ func GetDrugNewPurchaseStockQuery(good_type int64, keyword string, page int64, l
2954 2976
 		db = db.Where("find_in_set('停用',drug_status) = 0")
2955 2977
 	}
2956 2978
 
2979
+	if query_type == 2 {
2980
+		db = db.Where("sum_count<=drug_stock_limit_count")
2981
+	}
2982
+	if query_type == 3 {
2983
+		db = db.Where("sum_count = 0")
2984
+	}
2985
+
2986
+	if query_type == 4 {
2987
+		db = db.Where("sum_count > 0")
2988
+	}
2989
+
2957 2990
 	if orgid > 0 {
2958 2991
 		db = db.Where("org_id = ?", orgid)
2959 2992
 	}

+ 1 - 0
service/stock_service.go Wyświetl plik

@@ -280,6 +280,7 @@ func ModifyGoodInfo(goodInfo *models.GoodInfo) (error, *models.GoodInfo) {
280 280
 		"first_letter":                   goodInfo.FirstLetter,
281 281
 		"is_show":                        goodInfo.IsShow,
282 282
 		"is_zero_flag":                   goodInfo.IsZeroFlag,
283
+		"split_of_number":                goodInfo.SplitOfNumber,
283 284
 	}).Error
284 285
 
285 286
 	writeDb.Model(&models.WarehousingInfo{}).Where("good_id = ? AND org_id = ?", goodInfo.ID, goodInfo.OrgId).Updates(map[string]interface{}{"good_type_id": goodInfo.GoodTypeId})