Przeglądaj źródła

Merge branch '20230223_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20230223_xt_api_new_branch

XMLWAN 2 lat temu
rodzic
commit
e1e2f38082

+ 1 - 1
conf/app.conf Wyświetl plik

@@ -1,6 +1,6 @@
1 1
 appname = 血透
2 2
 httpport = 9531
3
-runmode = prod
3
+runmode = dev
4 4
 #dev/prod
5 5
 
6 6
 #

+ 6 - 1
controllers/dialysis_api_controller.go Wyświetl plik

@@ -1354,6 +1354,8 @@ func (c *DialysisApiController) PostDouleCheck() {
1354 1354
 	pipeline_connection_desc := c.GetString("pipeline_connection_desc")
1355 1355
 	collator, _ := c.GetInt64("collator", 0)
1356 1356
 	employee_number := c.GetString("employee_number")
1357
+	dialyzer_batch_number := c.GetString("dialyzer_batch_number")
1358
+	needle_batch_number := c.GetString("needle_batch_number")
1357 1359
 	if id <= 0 {
1358 1360
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1359 1361
 		return
@@ -1424,6 +1426,8 @@ func (c *DialysisApiController) PostDouleCheck() {
1424 1426
 		UpdatedTime:                time.Now().Unix(),
1425 1427
 		CheckDate:                  recordDate.Unix(),
1426 1428
 		EmployeeNumber:             employee_number,
1429
+		DialyzerBatchNumber:        dialyzer_batch_number,
1430
+		NeedleBatchNumber:          needle_batch_number,
1427 1431
 	}
1428 1432
 
1429 1433
 	_, check := service.FindDoubleCheckByReordDate(id, recordDate.Unix(), adminUserInfo.CurrentOrgId)
@@ -1461,6 +1465,7 @@ func (c *DialysisApiController) PostDouleCheck() {
1461 1465
 		doubleCheck.CreatedTime = check.CreatedTime
1462 1466
 		doubleCheck.UpdatedTime = time.Now().Unix()
1463 1467
 		doubleCheck.ID = check.ID
1468
+
1464 1469
 		redis := service.RedisClient()
1465 1470
 		err := service.UpdateDoubleCheck(&doubleCheck)
1466 1471
 		key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(id, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":double_check"
@@ -5136,7 +5141,7 @@ func (this *DialysisApiController) GetDialysisGoodTotalCount() {
5136 5141
 	var ids []string
5137 5142
 
5138 5143
 	ids = strings.Split(partion_type, ",")
5139
-	fmt.Println("ids------------------------", ids)
5144
+
5140 5145
 	timeLayout := "2006-01-02"
5141 5146
 	loc, _ := time.LoadLocation("Local")
5142 5147
 	startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", start_time+" 00:00:00", loc)

+ 1 - 1
controllers/his_api_controller.go Wyświetl plik

@@ -1475,7 +1475,7 @@ func (c *HisApiController) CreateHisPrescription() {
1475 1475
 														c.ServeDynamicFailJsonSend(drug.DrugName + "该批次剩余库存不足,剩余库存:" + strconv.FormatInt(info.StockMaxNumber, 10) + drug.MaxUnit + strconv.FormatInt(info.StockMinNumber, 10) + drug.MinUnit)
1476 1476
 														return
1477 1477
 													}
1478
-													if adminInfo.CurrentOrgId == 10215 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 3877 || adminInfo.CurrentOrgId == 9671 {
1478
+													if adminInfo.CurrentOrgId == 10215 || adminInfo.CurrentOrgId == 10164 || adminInfo.CurrentOrgId == 3877 {
1479 1479
 														// 查询该药品最后一次出库记录
1480 1480
 														outInfo, _ := service.GetLastDrugWarehouseOutByDrugIdTwenty(drug_id, patient_id, recordDateTime, adviceId)
1481 1481
 

+ 28 - 0
controllers/his_hospital_api_controller.go Wyświetl plik

@@ -38,6 +38,8 @@ func HisHospitalManagerApiRegistRouters() {
38 38
 
39 39
 	beego.Router("/api/monthhospitaldetail/get", &HisHospitalApiController{}, "get:GetHisHospitalMonthDetailInfo")
40 40
 
41
+	beego.Router("/api/exportuncharge/get", &HisHospitalApiController{}, "get:GetExportHisHospitalUnChargeData")
42
+
41 43
 }
42 44
 func (c *HisHospitalApiController) RefundDetail() {
43 45
 	patient_id, _ := c.GetInt64("patient_id")
@@ -1056,3 +1058,29 @@ func (c *HisHospitalApiController) GetHisHospitalMonthDetailInfo() {
1056 1058
 		"his_info":            record,
1057 1059
 	})
1058 1060
 }
1061
+
1062
+func (c *HisHospitalApiController) GetExportHisHospitalUnChargeData() {
1063
+	start_time_str := c.GetString("start_time")
1064
+	end_time_str := c.GetString("end_time")
1065
+	timeLayout := "2006-01-02"
1066
+	loc, _ := time.LoadLocation("Local")
1067
+	adminInfo := c.GetAdminUserInfo()
1068
+	theStartTime, err := time.ParseInLocation(timeLayout+" 15:04:05", start_time_str+" 00:00:00", loc)
1069
+	if err != nil {
1070
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1071
+		return
1072
+	}
1073
+	recordStartTime := theStartTime.Unix()
1074
+	theEndTime, err := time.ParseInLocation(timeLayout+" 15:04:05", end_time_str+" 00:00:00", loc)
1075
+	if err != nil {
1076
+		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
1077
+		return
1078
+	}
1079
+	recordEndTime := theEndTime.Unix()
1080
+	//var prescriptions []*models.HisPrescription
1081
+	var prescriptions []*models.ExportHisPrescription
1082
+	prescriptions, _ = service.GetUnChargeHisHospitalPrescription(adminInfo.CurrentOrgId, recordStartTime, recordEndTime)
1083
+	c.ServeSuccessJSON(map[string]interface{}{
1084
+		"month_prescriptions": prescriptions,
1085
+	})
1086
+}

+ 67 - 1
controllers/mobile_api_controllers/dialysis_api_controller.go Wyświetl plik

@@ -744,7 +744,8 @@ func (c *DialysisAPIController) PostDoubleCheck() {
744 744
 	pipeline_connection_desc := c.GetString("pipeline_connection_desc")
745 745
 	collator, _ := c.GetInt64("collator", 0)
746 746
 	employee_number := c.GetString("employee_number")
747
-
747
+	dialyzer_batch_number := c.GetString("dialyzer_batch_number")
748
+	needle_batch_number := c.GetString("needle_batch_number")
748 749
 	if id <= 0 {
749 750
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
750 751
 		return
@@ -828,6 +829,8 @@ func (c *DialysisAPIController) PostDoubleCheck() {
828 829
 		CheckDate:                  recordDate.Unix(),
829 830
 		UpdatedTime:                time.Now().Unix(),
830 831
 		EmployeeNumber:             employee_number,
832
+		DialyzerBatchNumber:        dialyzer_batch_number,
833
+		NeedleBatchNumber:          needle_batch_number,
831 834
 	}
832 835
 
833 836
 	_, check := service.FindDoubleCheckByReordDate(id, recordDate.Unix(), adminUserInfo.Org.Id)
@@ -840,6 +843,19 @@ func (c *DialysisAPIController) PostDoubleCheck() {
840 843
 			order, _ := service.GetDialysisOrder(recordDate.Unix(), id, adminUserInfo.Org.Id)
841 844
 			doubleCheck.Creater = order.StartNurse
842 845
 		}
846
+
847
+		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
848
+			//查询未核对的医嘱
849
+			doctorList, err := service.GetDoctorAdviceCheckList(id, recordDate.Unix(), adminUserInfo.Org.Id)
850
+			for _, advice := range doctorList {
851
+				if advice.ExecutionStaff == modifier {
852
+
853
+					c.ErrorLog("医嘱核对人不能和执行人为同一人!", err)
854
+					c.ServeFailJSONWithSGJErrorCode(enums.AdviceCodeParamWrong)
855
+					return
856
+				}
857
+			}
858
+		}
843 859
 		err := service.AddSigleDoubleCheck(&doubleCheck)
844 860
 
845 861
 		//针对长沙南雅
@@ -848,6 +864,7 @@ func (c *DialysisAPIController) PostDoubleCheck() {
848 864
 			doctorList, _ := service.GetDoctorAdviceCheckList(id, recordDate.Unix(), adminUserInfo.Org.Id)
849 865
 			if len(doctorList) > 0 && modifier > 0 {
850 866
 				for _, advice := range doctorList {
867
+
851 868
 					service.UpdateDoctorAdviceList(advice.ID, modifier)
852 869
 					key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(advice.PatientId, 10) + ":" + strconv.FormatInt(advice.AdviceDate, 10) + ":doctor_advices"
853 870
 					redis := service.RedisClient()
@@ -885,7 +902,23 @@ func (c *DialysisAPIController) PostDoubleCheck() {
885 902
 		doubleCheck.CreatedTime = check.CreatedTime
886 903
 		doubleCheck.ID = check.ID
887 904
 		doubleCheck.EmployeeNumber = employee_number
905
+		doubleCheck.NeedleBatchNumber = needle_batch_number
906
+		doubleCheck.DialyzerBatchNumber = dialyzer_batch_number
907
+
908
+		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
909
+			//查询未核对的医嘱
910
+			doctorList, err := service.GetDoctorAdviceCheckList(id, recordDate.Unix(), adminUserInfo.Org.Id)
911
+			for _, advice := range doctorList {
912
+				if advice.ExecutionStaff == modifier {
913
+
914
+					c.ErrorLog("医嘱核对人不能和执行人为同一人!", err)
915
+					c.ServeFailJSONWithSGJErrorCode(enums.AdviceCodeParamWrong)
916
+					return
917
+				}
918
+			}
919
+		}
888 920
 		err := service.UpdateDoubleCheck(&doubleCheck)
921
+
889 922
 		//针对长沙南雅
890 923
 		if adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 3877 {
891 924
 			//查询未核对的医嘱
@@ -1696,6 +1729,13 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1696 1729
 			if prescribing_number == 0 {
1697 1730
 				prescribing_number = 1
1698 1731
 			}
1732
+			if prescribing_number == 0 && id == 14682 {
1733
+				prescribing_number = 2
1734
+			}
1735
+
1736
+			if prescribing_number == 0 && id == 18560 {
1737
+				prescribing_number = 2
1738
+			}
1699 1739
 			advice := models.DoctorAdvice{
1700 1740
 				UserOrgId:             adminUserInfo.Org.Id,
1701 1741
 				PatientId:             id,
@@ -3289,6 +3329,32 @@ func (c *DialysisAPIController) PostSolution() {
3289 3329
 		}
3290 3330
 	}
3291 3331
 
3332
+	if adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 10340 {
3333
+
3334
+		if solution.PrescribingNumber == 0 {
3335
+			solution.PrescribingNumber = 1
3336
+		}
3337
+		if prescription.PrescribingNumber == 0 {
3338
+			prescription.PrescribingNumber = 1
3339
+		}
3340
+
3341
+		if solution.PrescribingNumber == 0 && id == 14682 {
3342
+			solution.PrescribingNumber = 2
3343
+		}
3344
+
3345
+		if solution.PrescribingNumber == 0 && id == 18560 {
3346
+			solution.PrescribingNumber = 2
3347
+		}
3348
+
3349
+		if prescription.PrescribingNumber == 0 && id == 14682 {
3350
+			prescription.PrescribingNumber = 2
3351
+		}
3352
+
3353
+		if prescription.PrescribingNumber == 0 && id == 18560 {
3354
+			prescription.PrescribingNumber = 2
3355
+		}
3356
+	}
3357
+
3292 3358
 	service.SavePrescriptionAndCreateSolution(&solution, &prescription)
3293 3359
 	//获取最新1条
3294 3360
 	dialysisSolution, _ := service.GetLastPatientDialysisSolution(id, adminUserInfo.Org.Id)

+ 1 - 1
controllers/mobile_api_controllers/mobile_api_router_register.go Wyświetl plik

@@ -163,7 +163,7 @@ func MobileAPIControllersRegisterRouters() {
163 163
 
164 164
 	beego.Router("/m/api/updatestockgoods", &DialysisAPIController{}, "Get:UpdateStockGoods")
165 165
 
166
-	beego.Router("/m/api/getmobileschedulelist", &DialysisAPIController{}, "Get:GetMobileScheduleList")
166
+	//beego.Router("/m/api/getmobileschedulelist", &DialysisAPIController{}, "Get:GetMobileScheduleList")
167 167
 
168 168
 	beego.Router("/m/api/getrolelist", &DialysisAPIController{}, "Get:GetRoleList")
169 169
 

+ 12 - 3
controllers/schedule_api_controller.go Wyświetl plik

@@ -1260,6 +1260,10 @@ func (c *ScheduleApiController) GetSchedules() {
1260 1260
 	partition_id, _ := c.GetInt64("partition_id")
1261 1261
 	schedule_type, _ := c.GetInt64("schedule_type")
1262 1262
 
1263
+	is_before, _ := c.GetInt64("is_before")
1264
+	start_time := c.GetString("start_time")
1265
+	end_time := c.GetString("end_time")
1266
+
1263 1267
 	adminInfo := c.GetAdminUserInfo()
1264 1268
 
1265 1269
 	thisTime := time.Now()
@@ -1303,6 +1307,14 @@ func (c *ScheduleApiController) GetSchedules() {
1303 1307
 	theEndTime, _ := time.ParseInLocation(timeLayout, weekEndTime, loc)
1304 1308
 	weekStartPoint := theStarTime.Unix()
1305 1309
 	weekEndPoint := theEndTime.Unix()
1310
+	if is_before > 0 {
1311
+		timeLayout := "2006-01-02 15:04:05"
1312
+		loc, _ := time.LoadLocation("Local")
1313
+		theStarTime, _ := time.ParseInLocation(timeLayout, start_time, loc)
1314
+		theEndTime, _ := time.ParseInLocation(timeLayout, end_time, loc)
1315
+		weekStartPoint = theStarTime.Unix()
1316
+		weekEndPoint = theEndTime.Unix()
1317
+	}
1306 1318
 
1307 1319
 	schdules, _ := service.GetWeekScheduleOne(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, partition_id, schedule_type)
1308 1320
 	c.ServeSuccessJSON(map[string]interface{}{
@@ -4322,11 +4334,9 @@ func (c *ScheduleApiController) GetScheduleOne() {
4322 4334
 
4323 4335
 	week, _ := c.GetInt64("weekTime", 0) //1:last, 2:this 3:next 4 nextTwo
4324 4336
 	patitionIdStr := c.GetString("patitionid")
4325
-
4326 4337
 	ids := strings.Split(patitionIdStr, ",")
4327 4338
 	fmt.Println("patitonStr", ids)
4328 4339
 	schedule_type, _ := c.GetInt64("schedule_type")
4329
-
4330 4340
 	adminInfo := c.GetAdminUserInfo()
4331 4341
 
4332 4342
 	thisTime := time.Now()
@@ -4372,7 +4382,6 @@ func (c *ScheduleApiController) GetScheduleOne() {
4372 4382
 	weekEndPoint := theEndTime.Unix()
4373 4383
 
4374 4384
 	schdules, _ := service.GetWeekScheduleTwo(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4375
-
4376 4385
 	schedulesGroup, _ := service.GetScheduleTotalCount(adminInfo.CurrentOrgId, weekStartPoint, weekEndPoint, ids, schedule_type)
4377 4386
 	c.ServeSuccessJSON(map[string]interface{}{
4378 4387
 		"days":           days,

+ 11 - 82
controllers/self_drug_api_congtroller.go Wyświetl plik

@@ -2722,9 +2722,9 @@ func (this *SelfDrugApiController) GetStorehouseList() {
2722 2722
 	orgId := this.GetAdminUserInfo().CurrentOrgId
2723 2723
 
2724 2724
 	list, err := service.GetAllStoreHouseList(orgId)
2725
-	manufacturerList, _ := service.GetAllManufacturerList(orgId)
2726
-	goodType, _ := service.GetAllGoodType(orgId)
2727
-	patientList, _ := service.GetAllpatient(orgId)
2725
+	manufacturerList, _ := service.GetNewAllManufacturerList(orgId)
2726
+	goodType, _ := service.GetAllNewGoodType(orgId)
2727
+	patientList, _ := service.GetAllpatientThirty(orgId)
2728 2728
 	if err != nil {
2729 2729
 		this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取仓库失败")
2730 2730
 		return
@@ -2761,16 +2761,16 @@ func (this *SelfDrugApiController) GetGoodNewQuery() {
2761 2761
 	}
2762 2762
 
2763 2763
 	var ids []int64
2764
-	var goodIds []int64
2764
+	//var goodIds []int64
2765 2765
 	manufacturerList, _ := service.GetManufacturerListByKeyword(orgId, keyword)
2766 2766
 	for _, it := range manufacturerList {
2767 2767
 		ids = append(ids, it.ID)
2768 2768
 	}
2769 2769
 
2770
-	infoList, _ := service.GetGoodWarehouseInfoByOrgId(orgId, storehouse_id)
2771
-	for _, it := range infoList {
2772
-		goodIds = append(goodIds, it.GoodId)
2773
-	}
2770
+	//infoList, _ := service.GetGoodWarehouseInfoByOrgId(orgId, storehouse_id)
2771
+	//for _, it := range infoList {
2772
+	//	goodIds = append(goodIds, it.GoodId)
2773
+	//}
2774 2774
 
2775 2775
 	stockList, total, err := service.GetGoodStockList(orgId, storehouse_id, good_type, keyword, page, limit, ids)
2776 2776
 
@@ -3262,7 +3262,7 @@ func (this *SelfDrugApiController) GetPurchaseDrugQuery() {
3262 3262
 	for _, it := range infoList {
3263 3263
 		infoIds = append(infoIds, it.DrugId)
3264 3264
 	}
3265
-	manufacturerList, _ := service.GetAllManufacturerList(orgId)
3265
+	manufacturerList, _ := service.GetNewAllManufacturerList(orgId)
3266 3266
 	list, total, err := service.GetDrugPurchaseStockQuery(good_type, keyword, page, limit, orgId, startTime, endTime, ids, infoIds)
3267 3267
 
3268 3268
 	for _, item := range list {
@@ -3428,7 +3428,6 @@ func (this *SelfDrugApiController) GetDrugNewQuery() {
3428 3428
 	for _, it := range infoList {
3429 3429
 		goodIds = append(goodIds, it.DrugId)
3430 3430
 	}
3431
-	//list, total, err := service.GetDrugNewQuery(orgId, storehouse_id, good_type, keyword, page, limit, ids, goodIds, startTime, endTime)
3432 3431
 
3433 3432
 	countList, total, err := service.GetDrugStockCountList(orgId, storehouse_id, good_type, keyword, page, limit, ids, goodIds, startTime, endTime)
3434 3433
 
@@ -3441,8 +3440,7 @@ func (this *SelfDrugApiController) GetDrugNewQuery() {
3441 3440
 	drugTypeList, _ := service.GetParentDataConfig(drugTypeParent.ID, orgId)
3442 3441
 
3443 3442
 	this.ServeSuccessJSON(map[string]interface{}{
3444
-		"total": total,
3445
-		//"list":  list,
3443
+		"total":        total,
3446 3444
 		"drugTypeList": drugTypeList,
3447 3445
 		"countList":    countList,
3448 3446
 	})
@@ -3665,7 +3663,7 @@ func (this *SelfDrugApiController) GetGoodNewPurchaseStockQuery() {
3665 3663
 	for _, it := range manufacturers {
3666 3664
 		ids = append(ids, it.ID)
3667 3665
 	}
3668
-	manufacturerList, _ := service.GetAllManufacturerList(orgId)
3666
+	manufacturerList, _ := service.GetNewAllManufacturerList(orgId)
3669 3667
 	list, total, err := service.GetGoodNewPurchaseStockQuery(good_type, keyword, page, limit, orgId, ids, goodIds)
3670 3668
 
3671 3669
 	for _, item := range list {
@@ -3680,18 +3678,6 @@ func (this *SelfDrugApiController) GetGoodNewPurchaseStockQuery() {
3680 3678
 
3681 3679
 		item.GoodEndFlowInfo = flow
3682 3680
 
3683
-		//获取期初结余数量
3684
-		//infoList, _ := service.GetStartGoodWarehouseInfoList(item.ID, orgId, startTime)
3685
-		//for _, it := range infoList {
3686
-		//  item.WarehousingInfoStart = append(item.WarehousingInfoStart, it)
3687
-		//}
3688
-		//
3689
-		////获取期末结余数量
3690
-		//warehouseInfoList, _ := service.GetEndGoodWarehouseInfoList(item.ID, orgId, endTime)
3691
-		//for _, it := range warehouseInfoList {
3692
-		//  item.WarehousingInfoEnd = append(item.WarehousingInfoEnd, it)
3693
-		//}
3694
-
3695 3681
 		//获取期间增加
3696 3682
 		goodWarehouseInfoList, _ := service.GetAddGoodWarehouseInfoList(item.ID, orgId, startTime, endTime)
3697 3683
 		for _, it := range goodWarehouseInfoList {
@@ -3720,63 +3706,6 @@ func (this *SelfDrugApiController) GetGoodNewPurchaseStockQuery() {
3720 3706
 			item.WarehouseOutInfoEnd = append(item.WarehouseOutInfoEnd, it)
3721 3707
 		}
3722 3708
 
3723
-		////获取期初结余
3724
-		//info, _ := service.FindeStartFlowInfo(item.ID, orgId, startTime)
3725
-		//for _, it := range info {
3726
-		//  item.StartFlowInfo = append(item.StartFlowInfo, it)
3727
-		//}
3728
-		////获取期初结余
3729
-		//flowOutInfo, _ := service.FindeStartFlowOutInfo(item.ID, orgId, startTime)
3730
-		//for _, it := range flowOutInfo {
3731
-		//  item.StartOutFlowInfo = append(item.StartOutFlowInfo, it)
3732
-		//}
3733
-		//
3734
-		////获取期初退库
3735
-		//cancelInfo, _ := service.FindeStartCancelInfo(item.ID, orgId, startTime)
3736
-		//for _, it := range cancelInfo {
3737
-		//  item.StartCancelFlowInfo = append(item.StartCancelFlowInfo, it)
3738
-		//}
3739
-
3740
-		////获取期末结余
3741
-		//flowInfo, _ := service.FindEndStartFlowInfo(item.ID, orgId, endTime)
3742
-		//for _, it := range flowInfo {
3743
-		//  item.EndFlowInfo = append(item.EndFlowInfo, it)
3744
-		//}
3745
-		//
3746
-		////获取期末出库
3747
-		//lowOutInfo, _ := service.FindeEndFLowOutInfo(item.ID, orgId, endTime)
3748
-		//for _, it := range lowOutInfo {
3749
-		//  item.EndFlowOutInfo = append(item.EndFlowOutInfo, it)
3750
-		//}
3751
-		//
3752
-		////获取期末退库
3753
-		//endCancelInfo, _ := service.FindEndCancelInfo(item.ID, orgId, endTime)
3754
-		//for _, it := range endCancelInfo {
3755
-		//  item.EndCancelFLowInfo = append(item.EndCancelFLowInfo, it)
3756
-		//}
3757
-
3758
-		////期初盘赢
3759
-		//inventory, _ := service.FindeStartStockInventoryProfit(item.ID, orgId, startTime)
3760
-		//for _, it := range inventory {
3761
-		//  item.WareStartStockInventoryProfit = append(item.WareStartStockInventoryProfit, it)
3762
-		//}
3763
-		////期初盘亏
3764
-		//stockInventory, _ := service.FindStartStockInventoryLosses(item.ID, orgId, startTime)
3765
-		//for _, it := range stockInventory {
3766
-		//  item.WareStartStockInventoryLosses = append(item.WareStartStockInventoryLosses, it)
3767
-		//}
3768
-
3769
-		////期末盘盈
3770
-		//inventoryProfit, _ := service.FindeStartStockInventoryProfit(item.ID, orgId, endTime)
3771
-		//for _, it := range inventoryProfit {
3772
-		//  item.WareEndStockInventoryProfit = append(item.WareEndStockInventoryProfit, it)
3773
-		//}
3774
-		////期末盘亏
3775
-		//inventoryLosses, _ := service.FindStartStockInventoryLosses(item.ID, orgId, endTime)
3776
-		//for _, it := range inventoryLosses {
3777
-		//  item.WareEndStockInventoryLosses = append(item.WareEndStockInventoryLosses, it)
3778
-		//}
3779
-
3780 3709
 		//期中盘盈
3781 3710
 		profit, _ := service.FindeEndStokInventoryProfit(item.ID, orgId, startTime, endTime)
3782 3711
 		for _, it := range profit {

+ 3 - 0
enums/error_code.go Wyświetl plik

@@ -275,6 +275,8 @@ const ( // ErrorCode
275 275
 	ErrorCodeDelScheduleFailByDialysisTwo = 60000003
276 276
 
277 277
 	ErrorCodeSyncWrong = 60000006
278
+
279
+	AdviceCodeParamWrong = 600000007
278 280
 )
279 281
 
280 282
 var ErrCodeMsgs = map[int]string{
@@ -533,6 +535,7 @@ var ErrCodeMsgs = map[int]string{
533 535
 	ErrorCodePatientDialysisOrderTwo:      "被替换的患者已经上机,无法替换排班",
534 536
 	ErrorCodePatientScheduleRepeat:        "一天只能存在一次排班",
535 537
 	ErrorCodeDelScheduleFailByDialysisTwo: "已经上机透析,不能操作排班",
538
+	AdviceCodeParamWrong:                  "医嘱核对人和执行人不能为同一人,请更换第二核对人!",
536 539
 }
537 540
 
538 541
 type SGJError struct {

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

@@ -549,6 +549,8 @@ type DoubleCheck struct {
549 549
 	CheckTime                  int64  `gorm:"column:check_time" json:"check_time"`
550 550
 	FirstCheckTime             int64  `gorm:"column:first_check_time" json:"first_check_time"`
551 551
 	EmployeeNumber             string `gorm:"column:employee_number" json:"employee_number" form:"employee_number"`
552
+	DialyzerBatchNumber        string `gorm:"column:dialyzer_batch_number" json:"dialyzer_batch_number" form:"dialyzer_batch_number"`
553
+	NeedleBatchNumber          string `gorm:"column:needle_batch_number" json:"needle_batch_number" form:"needle_batch_number"`
552 554
 }
553 555
 
554 556
 func (DoubleCheck) TableName() string {

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

@@ -100,6 +100,18 @@ func (BaseDrugLibSeven) TableName() string {
100 100
 	return "xt_base_drug"
101 101
 }
102 102
 
103
+type BaseDrugLibTen struct {
104
+	ID                  int64 `gorm:"column:id" json:"id" form:"id"`
105
+	OrgId               int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
106
+	TotalCount          int64 `gorm:"column:total_count" json:"total_count" form:"total_count"`
107
+	DrugStockLimitCount int64 `gorm:"column:drug_stock_limit_count" json:"drug_stock_limit_count" form:"drug_stock_limit_count"`
108
+	Status              int64 `gorm:"column:status" json:"status" form:"status"`
109
+}
110
+
111
+func (BaseDrugLibTen) TableName() string {
112
+	return "xt_base_drug"
113
+}
114
+
103 115
 type DrugUnitSafeguard struct {
104 116
 	ID               int64  `gorm:"column:id" json:"id" form:"id"`
105 117
 	Unit             string `gorm:"column:unit" json:"unit" form:"unit"`

+ 13 - 0
models/drug_stock.go Wyświetl plik

@@ -94,6 +94,19 @@ func (DrugWarehouseInfo) TableName() string {
94 94
 	return "xt_drug_warehouse_info"
95 95
 }
96 96
 
97
+type DrugWarehouseInfoTen struct {
98
+	StockMaxNumber int64 `gorm:"column:stock_max_number" json:"stock_max_number" form:"stock_max_number"`
99
+	StockMinNumber int64 `gorm:"column:stock_min_number" json:"stock_min_number" form:"stock_min_number"`
100
+	StorehouseId   int64 `gorm:"column:storehouse_id" json:"storehouse_id" form:"storehouse_id"`
101
+	IsCheck        int64 `gorm:"column:is_check" json:"is_check" form:"is_check"`
102
+	Status         int64 `gorm:"column:status" json:"status" form:"status"`
103
+	OrgId          int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
104
+}
105
+
106
+func (DrugWarehouseInfoTen) TableName() string {
107
+	return "xt_drug_warehouse_info"
108
+}
109
+
97 110
 type DrugWarehouseInfoSeven struct {
98 111
 	StockMaxNumber int64 `gorm:"column:stock_max_number" json:"stock_max_number" form:"stock_max_number"`
99 112
 	StockMinNumber int64 `gorm:"column:stock_min_number" json:"stock_min_number" form:"stock_min_number"`

+ 23 - 0
models/good_models.go Wyświetl plik

@@ -22,6 +22,18 @@ func (GoodsType) TableName() string {
22 22
 	return "xt_goods_type"
23 23
 }
24 24
 
25
+type NewGoodsType struct {
26
+	ID       int64  `gorm:"column:id" json:"id"`
27
+	TypeName string `gorm:"column:type_name" json:"type_name"`
28
+	Remark   string `gorm:"column:remark" json:"remark"`
29
+	OrgId    int64  `gorm:"column:org_id" json:"org_id"`
30
+	Status   int64  `gorm:"column:status" json:"status"`
31
+}
32
+
33
+func (NewGoodsType) TableName() string {
34
+	return "xt_goods_type"
35
+}
36
+
25 37
 type GoodInfo struct {
26 38
 	ID                     int64   `gorm:"column:id" json:"id" form:"id"`
27 39
 	GoodCode               string  `gorm:"column:good_code" json:"good_code" form:"good_code"`
@@ -146,6 +158,17 @@ func (GoodInfoSeven) TableName() string {
146 158
 	return "xt_good_information"
147 159
 }
148 160
 
161
+type GoodInfoTen struct {
162
+	ID         int64 `gorm:"column:id" json:"id" form:"id"`
163
+	OrgId      int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
164
+	Status     int64 `gorm:"column:status" json:"status" form:"status"`
165
+	TotalCount int64 `gorm:"column:total_count" json:"total_count" form:"total_count"`
166
+}
167
+
168
+func (GoodInfoTen) TableName() string {
169
+	return "xt_good_information"
170
+}
171
+
149 172
 type GoodsTypeOne struct {
150 173
 	ID             int64                    `gorm:"column:id" json:"id"`
151 174
 	TypeCode       string                   `gorm:"column:type_code" json:"type_code"`

+ 32 - 0
models/his_models.go Wyświetl plik

@@ -132,6 +132,7 @@ type HisPatient struct {
132 132
 	SickType               int64   `gorm:"column:sick_type" json:"sick_type" form:"sick_type"`
133 133
 	PatientInfo            string  `gorm:"column:patient_info" json:"patient_info" form:"patient_info"`
134 134
 	InsuplcAdmdvs          string  `gorm:"column:insuplc_admdvs" json:"insuplc_admdvs" form:"insuplc_admdvs"`
135
+	Insutype               string  `gorm:"column:insutype" json:"insutype" form:"insutype"`
135 136
 }
136 137
 
137 138
 func (HisPatient) TableName() string {
@@ -2522,3 +2523,34 @@ type GoodHisPrescriptionProject struct {
2522 2523
 func (GoodHisPrescriptionProject) TableName() string {
2523 2524
 	return "his_prescription_project"
2524 2525
 }
2526
+
2527
+type ExportHisPrescription struct {
2528
+	ID                     int64                     `gorm:"column:id" json:"id" form:"id"`
2529
+	UserOrgId              int64                     `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
2530
+	RecordDate             int64                     `gorm:"column:record_date" json:"record_date" form:"record_date"`
2531
+	PatientId              int64                     `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
2532
+	HisPatientId           int64                     `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
2533
+	Status                 int64                     `gorm:"column:status" json:"status" form:"status"`
2534
+	Ctime                  int64                     `gorm:"column:ctime" json:"ctime" form:"ctime"`
2535
+	Mtime                  int64                     `gorm:"column:mtime" json:"mtime" form:"mtime"`
2536
+	Number                 string                    `gorm:"column:number" json:"number" form:"number"`
2537
+	Type                   int64                     `gorm:"column:type" json:"type" form:"type"`
2538
+	Doctor                 string                    `gorm:"column:doctor" json:"doctor" form:"doctor"`
2539
+	Creator                int64                     `gorm:"column:creator" json:"creator" form:"creator"`
2540
+	Modifier               int64                     `gorm:"column:modifier" json:"modifier" form:"modifier"`
2541
+	OrderStatus            int64                     `gorm:"column:order_status" json:"order_status" form:"order_status"`
2542
+	PreTime                int64                     `gorm:"column:pre_time" json:"pre_time" form:"pre_time"`
2543
+	BatchNumber            string                    `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
2544
+	PrescriptionNumber     string                    `gorm:"column:prescription_number" json:"prescription_number" form:"prescription_number"`
2545
+	Patients               Patients                  `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
2546
+	HisDoctorAdviceInfo    []*HisDoctorAdviceInfo    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
2547
+	HisPrescriptionProject []*HisPrescriptionProject `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
2548
+	Total                  string                    `gorm:"-" json:"total" form:"total"`
2549
+	PType                  int64                     `gorm:"column:p_type" json:"p_type" form:"p_type"`
2550
+	MedType                string                    `gorm:"column:med_type" json:"med_type" form:"med_type"`
2551
+	IsMedicine             int64                     `gorm:"column:is_medicine" json:"is_medicine" form:"is_medicine"`
2552
+}
2553
+
2554
+func (ExportHisPrescription) TableName() string {
2555
+	return "his_prescription"
2556
+}

+ 69 - 17
models/new_stock_models.go Wyświetl plik

@@ -144,6 +144,37 @@ func (NewBaseDrug) TableName() string {
144 144
 	return "xt_base_drug"
145 145
 }
146 146
 
147
+type NewBaseDrugOne struct {
148
+	ID                  int64                  `gorm:"column:id" json:"id" form:"id"`
149
+	DrugName            string                 `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
150
+	DrugSpec            string                 `gorm:"column:drug_spec" json:"drug_spec" form:"drug_spec"`
151
+	DrugStockLimit      string                 `gorm:"column:drug_stock_limit" json:"drug_stock_limit" form:"drug_stock_limit"`
152
+	MaxUnit             string                 `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
153
+	MinNumber           int64                  `gorm:"column:min_number" json:"min_number" form:"min_number"`
154
+	MinUnit             string                 `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
155
+	Dose                string                 `gorm:"column:dose" json:"dose" form:"dose"`
156
+	DoseUnit            string                 `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
157
+	RetailPrice         float64                `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
158
+	MinPrice            float64                `gorm:"column:min_price" json:"min_price" form:"min_price"`
159
+	LastPrice           float64                `gorm:"column:last_price" json:"last_price" form:"last_price"`
160
+	Number              string                 `gorm:"column:number" json:"number" form:"number"`
161
+	OrgId               int64                  `gorm:"column:org_id" json:"org_id" form:"org_id"`
162
+	DrugWarehouseInfo   []*VsDrugWarehouseInfo `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_warehouse_info"`
163
+	XtDrugStockCount    []*XtDrugStockCount    `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_stock_count"`
164
+	DrugStockCount      []*XtDrugStockCount    `gorm:"ForeignKey:DrugId;AssociationForeignKey:ID" json:"drug_stock_info"`
165
+	TotalCount          int64                  `gorm:"column:total_count" json:"total_count" form:"total_count"`
166
+	IsUser              int64                  `gorm:"column:is_user" json:"is_user" form:"is_user"`
167
+	BatchRetaiPrice     float64                `gorm:"column:batch_retai_price" json:"batch_retai_price" form:"batch_retai_price"`
168
+	DrugStockLimitCount int64                  `gorm:"column:drug_stock_limit_count" json:"drug_stock_limit_count" form:"drug_stock_limit_count"`
169
+	SumCount            int64                  `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
170
+	SumInCount          int64                  `gorm:"column:sum_in_count" json:"sum_in_count" form:"sum_in_count"`
171
+	IsPharmacy          int64                  `gorm:"column:is_pharmacy" json:"is_pharmacy" form:"is_pharmacy"`
172
+}
173
+
174
+func (NewBaseDrugOne) TableName() string {
175
+	return "xt_base_drug"
176
+}
177
+
147 178
 type XtDialysisSetting struct {
148 179
 	ID                         int64 `gorm:"column:id" json:"id" form:"id"`
149 180
 	UserOrgId                  int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
@@ -184,28 +215,50 @@ func (XtDialysisSetting) TableName() string {
184 215
 }
185 216
 
186 217
 type VmStockFlowTwenty struct {
187
-	ID                  int64           `gorm:"column:id" json:"id" form:"id"`
188
-	WarehousingId       int64           `gorm:"column:warehousing_id" json:"warehousing_id" form:"warehousing_id"`
189
-	GoodId              int64           `gorm:"column:good_id" json:"good_id" form:"good_id"`
190
-	Count               int64           `gorm:"column:count" json:"count" form:"count"`
191
-	UserOrgId           int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
192
-	PatientId           int64           `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
193
-	SystemTime          int64           `gorm:"column:system_time" json:"system_time" form:"system_time"`
194
-	ConsumableType      int64           `gorm:"column:consumable_type" json:"consumable_type" form:"consumable_type"`
195
-	IsSys               int64           `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
196
-	Price               float64         `gorm:"column:price" json:"price" form:"price"`
197
-	WarehousingDetailId int64           `gorm:"column:warehousing_detail_id" json:"warehousing_detail_id" form:"warehousing_detail_id"`
198
-	BuyPrice            float64         `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
199
-	IsRead              int64           `gorm:"column:is_read" json:"is_read" form:"is_read"`
200
-	OverCount           int64           `gorm:"column:over_count" json:"over_count" form:"over_count"`
201
-	Ctime               int64           `gorm:"column:ctime" json:"ctime" form:"ctime"`
202
-	WarehousingInfo     WarehousingInfo `gorm:"ForeignKey:ID;AssociationForeignKey:WarehousingId" json:"xt_warehouse_info"`
218
+	ID                  int64              `gorm:"column:id" json:"id" form:"id"`
219
+	WarehousingId       int64              `gorm:"column:warehousing_id" json:"warehousing_id" form:"warehousing_id"`
220
+	GoodId              int64              `gorm:"column:good_id" json:"good_id" form:"good_id"`
221
+	Count               int64              `gorm:"column:count" json:"count" form:"count"`
222
+	UserOrgId           int64              `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
223
+	PatientId           int64              `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
224
+	SystemTime          int64              `gorm:"column:system_time" json:"system_time" form:"system_time"`
225
+	ConsumableType      int64              `gorm:"column:consumable_type" json:"consumable_type" form:"consumable_type"`
226
+	IsSys               int64              `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
227
+	Price               float64            `gorm:"column:price" json:"price" form:"price"`
228
+	WarehousingDetailId int64              `gorm:"column:warehousing_detail_id" json:"warehousing_detail_id" form:"warehousing_detail_id"`
229
+	BuyPrice            float64            `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
230
+	IsRead              int64              `gorm:"column:is_read" json:"is_read" form:"is_read"`
231
+	OverCount           int64              `gorm:"column:over_count" json:"over_count" form:"over_count"`
232
+	Ctime               int64              `gorm:"column:ctime" json:"ctime" form:"ctime"`
233
+	WarehousingInfo     NewWarehousingInfo `gorm:"ForeignKey:ID;AssociationForeignKey:WarehousingId" json:"xt_warehouse_info"`
203 234
 }
204 235
 
205 236
 func (VmStockFlowTwenty) TableName() string {
206 237
 	return "xt_stock_flow"
207 238
 }
208 239
 
240
+type VmNewStockFlowTwenty struct {
241
+	ID                  int64   `gorm:"column:id" json:"id" form:"id"`
242
+	WarehousingId       int64   `gorm:"column:warehousing_id" json:"warehousing_id" form:"warehousing_id"`
243
+	GoodId              int64   `gorm:"column:good_id" json:"good_id" form:"good_id"`
244
+	Count               int64   `gorm:"column:count" json:"count" form:"count"`
245
+	UserOrgId           int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
246
+	PatientId           int64   `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
247
+	SystemTime          int64   `gorm:"column:system_time" json:"system_time" form:"system_time"`
248
+	ConsumableType      int64   `gorm:"column:consumable_type" json:"consumable_type" form:"consumable_type"`
249
+	IsSys               int64   `gorm:"column:is_sys" json:"is_sys" form:"is_sys"`
250
+	Price               float64 `gorm:"column:price" json:"price" form:"price"`
251
+	WarehousingDetailId int64   `gorm:"column:warehousing_detail_id" json:"warehousing_detail_id" form:"warehousing_detail_id"`
252
+	BuyPrice            float64 `gorm:"column:buy_price" json:"buy_price" form:"buy_price"`
253
+	IsRead              int64   `gorm:"column:is_read" json:"is_read" form:"is_read"`
254
+	OverCount           int64   `gorm:"column:over_count" json:"over_count" form:"over_count"`
255
+	Ctime               int64   `gorm:"column:ctime" json:"ctime" form:"ctime"`
256
+}
257
+
258
+func (VmNewStockFlowTwenty) TableName() string {
259
+	return "xt_stock_flow"
260
+}
261
+
209 262
 type GoodInfoTwenty struct {
210 263
 	ID                     int64                   `gorm:"column:id" json:"id" form:"id"`
211 264
 	SpecificationName      string                  `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
@@ -216,7 +269,6 @@ type GoodInfoTwenty struct {
216 269
 	OrgId                  int64                   `gorm:"column:org_id" json:"org_id" form:"org_id"`
217 270
 	GoodName               string                  `gorm:"column:good_name" json:"good_name" form:"good_name"`
218 271
 	RetailPrice            float64                 `gorm:"column:retail_price" json:"retail_price" form:"retail_price"`
219
-	Ctime                  int64                   `gorm:"column:ctime" json:"ctime" form:"ctime"`
220 272
 	PackingUnit            string                  `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
221 273
 	PackingPrice           float64                 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
222 274
 	StWarehousingInfo      []*StWarehousingInfo    `gorm:"ForeignKey:GoodId;AssociationForeignKey:ID" json:"xt_warehouse_info"`

+ 24 - 0
models/schedule_models.go Wyświetl plik

@@ -59,6 +59,30 @@ func (Schedule) TableName() string {
59 59
 	return "xt_schedule"
60 60
 }
61 61
 
62
+type ScheduleTwo struct {
63
+	ID           int64 `gorm:"column:id" json:"id" form:"id"`
64
+	UserOrgId    int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
65
+	PartitionId  int64 `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
66
+	BedId        int64 `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
67
+	PatientId    int64 `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
68
+	ScheduleDate int64 `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
69
+	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
70
+	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
71
+	ModeId       int64 `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
72
+	Status       int64 `gorm:"column:status" json:"status" form:"status"`
73
+	CreatedTime  int64 `gorm:"column:created_time" json:"created_time" form:"created_time"`
74
+	UpdatedTime  int64 `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
75
+	IsExport     int64 `gorm:"column:is_export" json:"is_export" form:"is_export"`
76
+
77
+	Patient                   string               `gorm:"-" json:"patient" form:"patient"`
78
+	PatientInfectiousDiseases []InfectiousDiseases `json:"patient_contagions" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
79
+	DialysisMachineName       string               `gorm:"column:dialysis_machine_name" json:"dialysis_machine_name" form:"dialysis_machine_name"`
80
+}
81
+
82
+func (ScheduleTwo) TableName() string {
83
+	return "xt_schedule"
84
+}
85
+
62 86
 type SchedulePatients struct {
63 87
 	ID           int64              `gorm:"column:id" json:"id" form:"id"`
64 88
 	UserOrgId    int64              `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`

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

@@ -1614,3 +1614,44 @@ type GoodWarehousingInfo struct {
1614 1614
 func (GoodWarehousingInfo) TableName() string {
1615 1615
 	return "xt_warehouse_info"
1616 1616
 }
1617
+
1618
+type BloodManufacturer struct {
1619
+	ID               int64  `gorm:"column:id" json:"id"`
1620
+	ManufacturerName string `gorm:"column:manufacturer_name" json:"manufacturer_name"`
1621
+	OrgId            int64  `gorm:"column:org_id" json:"org_id"`
1622
+	Status           int64  `gorm:"column:status" json:"status"`
1623
+}
1624
+
1625
+func (BloodManufacturer) TableName() string {
1626
+	return "xt_manufacturer"
1627
+}
1628
+
1629
+type GoodQueryNewWarehousingInfo struct {
1630
+	ID      int64 `gorm:"column:id" json:"id"`
1631
+	GoodId  int64 `gorm:"column:good_id" json:"good_id"`
1632
+	Status  int64 `gorm:"column:status" json:"status"`
1633
+	OrgId   int64 `gorm:"column:org_id" json:"org_id"`
1634
+	IsCheck int64 `gorm:"column:is_check" json:"is_check" form:"is_check"`
1635
+}
1636
+
1637
+func (GoodQueryNewWarehousingInfo) TableName() string {
1638
+	return "xt_warehouse_info"
1639
+}
1640
+
1641
+type NewWarehousingInfo struct {
1642
+	ID               int64   `gorm:"column:id" json:"id"`
1643
+	WarehousingId    int64   `gorm:"column:warehousing_id" json:"warehousing_id"`
1644
+	GoodId           int64   `gorm:"column:good_id" json:"good_id"`
1645
+	Price            float64 `gorm:"column:price" json:"price"`
1646
+	Status           int64   `gorm:"column:status" json:"status"`
1647
+	OrgId            int64   `gorm:"column:org_id" json:"org_id"`
1648
+	WarehouseInfoId  int64   `gorm:"column:warehouse_info_id" json:"warehouse_info_id" form:"warehouse_info_id"`
1649
+	PackingPrice     float64 `gorm:"column:packing_price" json:"packing_price" form:"packing_price"`
1650
+	IsCheck          int64   `gorm:"column:is_check" json:"is_check" form:"is_check"`
1651
+	WarehousingCount int64   `gorm:"column:warehousing_count" json:"warehousing_count"`
1652
+	StockCount       int64   `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
1653
+}
1654
+
1655
+func (NewWarehousingInfo) TableName() string {
1656
+	return "xt_warehouse_info"
1657
+}

+ 1 - 2
routers/router.go Wyświetl plik

@@ -19,8 +19,7 @@ func init() {
19 19
 		AllowCredentials: true,
20 20
 	}))
21 21
 
22
-	// beego.Router("/", &controllers.MainController{})
23
-
22
+	beego.Router("/", &controllers.MainController{})
24 23
 	controllers.VerifyUserLoginControllerRegistRouters()
25 24
 	controllers.RoleAPIControllerRegistRouters()
26 25
 	controllers.PatientApiRegistRouters()

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

@@ -1480,7 +1480,7 @@ func GetDialysisBeforePrepare(goodTypeId int64, goodId int64, orgid int64, patie
1480 1480
 
1481 1481
 func CreateDialysisBeforePrepareOne(prepare *models.DialysisBeforePrepare) error {
1482 1482
 
1483
-	err := XTReadDB().Create(&prepare).Error
1483
+	err := XTWriteDB().Create(&prepare).Error
1484 1484
 	return err
1485 1485
 }
1486 1486
 
@@ -1593,7 +1593,7 @@ func GetAllPcAdvicestByList(orgID int64, scheduleDate int64) (advices []*VMDocto
1593 1593
 	advice_list_str, _ := redis.Get(key).Result()
1594 1594
 
1595 1595
 	if len(advice_list_str) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
1596
-		err = readDb.Where("status = 1 AND user_org_id = ? AND advice_type = 2 AND advice_date = ? and id desc ", orgID, scheduleDate).Find(&advices).Error
1596
+		err = readDb.Where("status = 1 AND user_org_id = ? AND advice_type = 2 AND advice_date = ?", orgID, scheduleDate).Find(&advices).Error
1597 1597
 		if err != nil {
1598 1598
 			if err == gorm.ErrRecordNotFound {
1599 1599
 				if len(advices) <= 0 {

+ 1 - 1
service/dialysis_solution_service.go Wyświetl plik

@@ -203,7 +203,7 @@ func GetDialysisGoodTotalCount(orgID int64, schedule_type int64, partition_id []
203 203
 	//if partition_id > 0 {
204 204
 	//	db = db.Where("partition_id = ?", partition_id)
205 205
 	//}
206
-	fmt.Println("len-------------", len(partition_id))
206
+
207 207
 	if len(partition_id) > 0 {
208 208
 		db = db.Where("partition_id in(?)", partition_id)
209 209
 	}

+ 4 - 4
service/doctor_schedule_service.go Wyświetl plik

@@ -58,7 +58,7 @@ func GetClassNameIsExsit(classname string, orgid int64, id int64) (schedule mode
58 58
 
59 59
 func UpdateScheduleList(id int64, schedules *models.DoctorSchedules) error {
60 60
 
61
-	err := XTReadDB().Model(&schedules).Where("id=?", id).Updates(map[string]interface{}{"class_name": schedules.ClassName, "class_attributes": schedules.ClassAttributes, "timeone_start": schedules.TimeoneStart, "timeone_type": schedules.TimeoneType, "timeone_end": schedules.TimeoneEnd, "timetwo_start": schedules.TimetwoStart, "timetwo_type": schedules.TimetwoType, "timetwo_end": schedules.TimetwoEnd, "work_time": schedules.WorkTime, "remarks": schedules.Remarks, "minute": schedules.Minute, "mtime": time.Now().Unix()}).Error
61
+	err := XTWriteDB().Model(&schedules).Where("id=?", id).Updates(map[string]interface{}{"class_name": schedules.ClassName, "class_attributes": schedules.ClassAttributes, "timeone_start": schedules.TimeoneStart, "timeone_type": schedules.TimeoneType, "timeone_end": schedules.TimeoneEnd, "timetwo_start": schedules.TimetwoStart, "timetwo_type": schedules.TimetwoType, "timetwo_end": schedules.TimetwoEnd, "work_time": schedules.WorkTime, "remarks": schedules.Remarks, "minute": schedules.Minute, "mtime": time.Now().Unix()}).Error
62 62
 	return err
63 63
 }
64 64
 
@@ -129,7 +129,7 @@ func AddSchedule(schedule *models.StaffSchedule) error {
129 129
 }
130 130
 
131 131
 func UpdateStaffList(schedule *models.StaffSchedule, id int64) error {
132
-	err := XTReadDB().Model(&schedule).Where("id=?", id).Updates(map[string]interface{}{"doctor_id": schedule.DoctorId, "doctor_type": schedule.DoctorType, "schedule_type": schedule.ScheduleType, "schedule_week": schedule.ScheduleWeek, "schedule_date": schedule.ScheduleDate, "mtime": time.Now().Unix()}).Error
132
+	err := XTWriteDB().Model(&schedule).Where("id=?", id).Updates(map[string]interface{}{"doctor_id": schedule.DoctorId, "doctor_type": schedule.DoctorType, "schedule_type": schedule.ScheduleType, "schedule_week": schedule.ScheduleWeek, "schedule_date": schedule.ScheduleDate, "mtime": time.Now().Unix()}).Error
133 133
 	return err
134 134
 }
135 135
 
@@ -768,14 +768,14 @@ func GetPatientScheduleIsExist(startime int64, schedule_type int64, bed_id int64
768 768
 
769 769
 func CreateDialysisPrescription(prescription *models.DialysisPrescription) error {
770 770
 
771
-	err := XTReadDB().Create(&prescription).Error
771
+	err := XTWriteDB().Create(&prescription).Error
772 772
 
773 773
 	return err
774 774
 }
775 775
 
776 776
 func CreateDialysisSolution(solution models.DialysisSolution) error {
777 777
 
778
-	err := XTReadDB().Create(&solution).Error
778
+	err := XTWriteDB().Create(&solution).Error
779 779
 	return err
780 780
 }
781 781
 

+ 14 - 0
service/his_hospital_service.go Wyświetl plik

@@ -565,3 +565,17 @@ func GetHisPrescriptionProjectByIDTwo(id int64) (projects models.HisPrescription
565 565
 	err = readDb.Model(&models.HisPrescriptionProject{}).Preload("HisProject", "status = 1").Preload("GoodInfo", "status = 1").Where("id = ? AND status = 1", id).First(&projects).Error
566 566
 	return
567 567
 }
568
+
569
+func GetUnChargeHisHospitalPrescription(org_id int64, start_time int64, end_time int64) (prescription []*models.ExportHisPrescription, err error) {
570
+	err = readDb.Model(&models.ExportHisPrescription{}).
571
+		Preload("Patients", "status = 1").
572
+		Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
573
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("Drug", "status=1")
574
+		}).
575
+		Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
576
+			return db.Where("status = 1 AND user_org_id = ?", org_id).Preload("HisOrderInfo", "status = 1").Preload("HisProject").Preload("GoodInfo", "status=1").Preload("XtHisProjectTeam", "status = 1")
577
+		}).
578
+		Where("user_org_id = ? AND status = 1 AND  record_date <= ? AND record_date >= ?  AND  order_status =  4 AND p_type = 1", org_id, end_time, start_time).
579
+		Find(&prescription).Error
580
+	return
581
+}

+ 92 - 2
service/his_print_service.go Wyświetl plik

@@ -18,18 +18,108 @@ func GetBatchDrugHisPrescription(ids []string, record_time int64, user_org_id in
18 18
 	return
19 19
 }
20 20
 
21
+type HisPrintPrescriptionProject struct {
22
+	ID                 int64      `gorm:"column:id" json:"id" form:"id"`
23
+	ProjectId          int64      `gorm:"column:project_id" json:"project_id" form:"project_id"`
24
+	Price              float64    `gorm:"column:price" json:"price" form:"price"`
25
+	UserOrgId          int64      `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
26
+	Status             int64      `gorm:"column:status" json:"status" form:"status"`
27
+	Ctime              int64      `gorm:"column:ctime" json:"ctime" form:"ctime"`
28
+	Mtime              int64      `gorm:"column:mtime" json:"mtime" form:"mtime"`
29
+	PatientId          int64      `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
30
+	HisPatientId       int64      `gorm:"column:his_patient_id" json:"his_patient_id" form:"his_patient_id"`
31
+	RecordDate         int64      `gorm:"column:record_date" json:"record_date" form:"record_date"`
32
+	PrescriptionId     int64      `gorm:"column:prescription_id" json:"prescription_id" form:"prescription_id"`
33
+	Count              string     `gorm:"column:count" json:"count" form:"count"`
34
+	FeedetlSn          string     `gorm:"column:feedetl_sn" json:"feedetl_sn" form:"feedetl_sn"`
35
+	MedListCodg        string     `gorm:"column:med_list_codg" json:"med_list_codg" form:"med_list_codg"`
36
+	SingleDose         string     `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
37
+	DeliveryWay        string     `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
38
+	ExecutionFrequency string     `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
39
+	Day                string     `gorm:"column:day" json:"day" form:"day"`
40
+	HisProject         HisProject `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"project"`
41
+	GoodInfo           GoodInfo   `gorm:"ForeignKey:ProjectId;AssociationForeignKey:ID" json:"good_info"`
42
+	Remark             string     `gorm:"column:remark" json:"remark" form:"remark"`
43
+	Unit               string     `gorm:"column:unit" json:"unit" form:"unit"`
44
+	Type               int64      `gorm:"column:type" json:"type" form:"type"`
45
+	Doctor             int64      `gorm:"column:doctor" json:"doctor" form:"doctor"`
46
+	ExecutionTime      int64      `gborm:"column:execution_time" json:"execution_time" form:"execution_time"`
47
+	ExecutionStaff     int64      `gorm:"column:execution_staff" json:"execution_staff" form:"execution_staff"`
48
+	ExecutionState     int64      `gorm:"column:execution_state" json:"execution_state" form:"execution_state"`
49
+	CheckTime          int64      `gorm:"column:check_time" json:"check_time" form:"check_time"`
50
+	CheckState         int64      `gorm:"column:check_state" json:"check_state" form:"check_state"`
51
+	Checker            int64      `gorm:"column:checker" json:"checker" form:"checker"`
52
+	StartTime          int64      `gorm:"column:start_time" json:"start_time" form:"start_time"`
53
+	TeamId             int64      `gorm:"column:team_id" json:"team_id" form:"team_id"`
54
+
55
+	FrequencyType        int64  `gorm:"column:frequency_type" json:"frequency_type" form:"frequency_type"`
56
+	DayCount             int64  `gorm:"column:day_count" json:"day_count" form:"day_count"`
57
+	WeekDay              string `gorm:"column:week_day" json:"week_day" form:"week_day"`
58
+	IsCheckTeam          int64  `gorm:"-" json:"is_check_team" form:"is_check_team"`
59
+	ExecutionFrequencyId int64  `gorm:"column:execution_frequency_id" json:"execution_frequency_id" form:"execution_frequency_id"`
60
+}
61
+
62
+type HisProject struct {
63
+	ID                          int64   `gorm:"column:id" json:"id" form:"id"`
64
+	ProjectName                 string  `gorm:"column:project_name" json:"project_name" form:"project_name"`
65
+	Pinyin                      string  `gorm:"column:pinyin" json:"pinyin" form:"pinyin"`
66
+	Wubi                        string  `gorm:"column:wubi" json:"wubi" form:"wubi"`
67
+	Price                       float64 `gorm:"column:price" json:"price" form:"price"`
68
+	Unit                        string  `gorm:"column:unit" json:"unit" form:"unit"`
69
+	CostClassify                int64   `gorm:"column:cost_classify" json:"cost_classify" form:"cost_classify"`
70
+	ExecutiveSection            int64   `gorm:"column:executive_section" json:"executive_section" form:"executive_section"`
71
+	MedicalCoverage             int64   `gorm:"column:medical_coverage" json:"medical_coverage" form:"medical_coverage"`
72
+	StatisticalClassification   int64   `gorm:"column:statistical_classification" json:"statistical_classification" form:"statistical_classification"`
73
+	DiseaseDirectory            int64   `gorm:"column:disease_directory" json:"disease_directory" form:"disease_directory"`
74
+	IsRecord                    int64   `gorm:"column:is_record" json:"is_record" form:"is_record"`
75
+	MedicalCode                 string  `gorm:"column:medical_code" json:"medical_code" form:"medical_code"`
76
+	TubeColor                   int64   `gorm:"column:tube_color" json:"tube_color" form:"tube_color"`
77
+	MedicalStatus               int64   `gorm:"column:medical_status" json:"medical_status" form:"medical_status"`
78
+	Remark                      string  `gorm:"column:remark" json:"remark" form:"remark"`
79
+	Sign                        int64   `gorm:"column:sign" json:"sign" form:"sign"`
80
+	DefaultNumber               string  `gorm:"column:default_number" json:"default_number" form:"default_number"`
81
+	IsDefault                   int64   `gorm:"column:is_default" json:"is_default" form:"is_default"`
82
+	IsCharge                    int64   `gorm:"column:is_charge" json:"is_charge" form:"is_charge"`
83
+	IsEstimate                  int64   `gorm:"column:is_estimate" json:"is_estimate" form:"is_estimate"`
84
+	IsWorkload                  int64   `gorm:"column:is_workload" json:"is_workload" form:"is_workload"`
85
+	Sort                        string  `gorm:"column:sort" json:"sort" form:"sort"`
86
+	DoctorAdvice                int64   `gorm:"column:doctor_advice" json:"doctor_advice" form:"doctor_advice"`
87
+	UserOrgId                   int64   `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
88
+	Status                      int64   `gorm:"column:status" json:"status" form:"status"`
89
+	CreatedTime                 int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
90
+	UpdatedTime                 int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
91
+	DeliveryWay                 string  `gorm:"column:delivery_way" json:"delivery_way" form:"delivery_way"`
92
+	NumberDays                  string  `gorm:"column:number_days" json:"number_days" form:"number_days"`
93
+	Total                       string  `gorm:"column:total" json:"total" form:"total"`
94
+	Category                    int64   `gorm:"column:category" json:"category" form:"category"`
95
+	IsMark                      int64   `gorm:"column:is_mark" json:"is_mark" form:"is_mark"`
96
+	SpecailProject              int64   `gorm:"column:specail_project" json:"specail_project" form:"specail_project"`
97
+	SocialSecurityDirectoryCode string  `gorm:"column:social_security_directory_code" json:"social_security_directory_code" form:"social_security_directory_code"`
98
+	RecordDate                  int64   `gorm:"column:record_date" json:"record_date" form:"record_date"`
99
+	SingleDose                  string  `gorm:"column:single_dose" json:"single_dose" form:"single_dose"`
100
+	ExecutionFrequency          string  `gorm:"column:execution_frequency" json:"execution_frequency" form:"execution_frequency"`
101
+}
102
+
103
+func (HisProject) TableName() string {
104
+	return "xt_his_project"
105
+}
106
+
107
+func (HisPrintPrescriptionProject) TableName() string {
108
+	return "his_prescription_project"
109
+}
110
+
21 111
 func GetBatchProjectHisPrescription(ids []string, record_time int64, user_org_id int64) (patients []*models.PrintPatient, err error) {
22 112
 	readDb.Model(&models.PrintPatient{}).Preload("HisPrintPatient", "status = 1 AND record_date = ?", record_time).
23 113
 		Preload("HisPrintPrescription", func(db *gorm.DB) *gorm.DB {
24 114
 			return db.Where("status = 1 AND user_org_id = ? AND record_date = ? AND type <> 1 AND p_type = 2", user_org_id, record_time).
25 115
 				Preload("HisPrescriptionProject", func(db *gorm.DB) *gorm.DB {
26
-					return db.Joins("Join xt_his_project p On p.id = his_prescription_project.project_id  AND p.cost_classify != 3").Where("his_prescription_project.status = 1 AND his_prescription_project.user_org_id = ?", user_org_id).Where("his_prescription_project.status = 1 ").Preload("HisProject", "status = 1").Preload("GoodInfo", "status=1")
116
+					return db.Joins("").Joins("Join xt_his_project p On p.id = his_prescription_project.project_id ").Where("his_prescription_project.status = 1 AND his_prescription_project.user_org_id = ?", user_org_id).Where("his_prescription_project.status = 1 ").Preload("HisProject", "status = 1").Preload("GoodInfo", "status=1")
27 117
 				})
28 118
 		}).
29 119
 		Preload("HisPrescriptionInfoTwo", "status = 1 AND record_date = ?", record_time).
30 120
 		Where("id in (?) AND user_org_id = ?  ", ids, user_org_id).Find(&patients)
31
-	return
32 121
 
122
+	return
33 123
 }
34 124
 
35 125
 func GetBatchInspectionProjectHisPrescription(ids []string, record_time int64, user_org_id int64) (patients []*models.PrintPatient, err error) {

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

@@ -149,7 +149,7 @@ func UpdatedDepartment(id int64, department *models.XtHisDepartment) error {
149 149
 
150 150
 func DeleteDepartment(id int64) error {
151 151
 	department := models.XtHisDepartment{}
152
-	err := XTReadDB().Model(&department).Where("id=? and status = 1", id).Updates(map[string]interface{}{"status": 0}).Error
152
+	err := XTWriteDB().Model(&department).Where("id=? and status = 1", id).Updates(map[string]interface{}{"status": 0}).Error
153 153
 	return err
154 154
 }
155 155
 
@@ -258,7 +258,7 @@ func GetAllDepartMent(orgid int64) (department []*models.XtHisDepartment, err er
258 258
 
259 259
 func CreateHisPatient(patient *models.XtHisPatient) error {
260 260
 
261
-	err := XTReadDB().Model(&patient).Create(&patient).Error
261
+	err := XTWriteDB().Model(&patient).Create(&patient).Error
262 262
 	return err
263 263
 }
264 264
 

+ 7 - 1
service/mobile_dialysis_service.go Wyświetl plik

@@ -4357,8 +4357,14 @@ func GetPCHisPrescriptionProject(orgID int64, scheduleDate int64, deliverWay str
4357 4357
 func UpdateStockGoods(good_id int64, record_time int64, patient_id int64, count int64) error {
4358 4358
 
4359 4359
 	prepare := models.DialysisBeforePrepare{}
4360
+	var err error
4361
+	if count > 0 {
4362
+		err = XTWriteDB().Model(&prepare).Where("good_id= ? and record_date = ? and patient_id = ? and count  <> 0 and status = 1", good_id, record_time, patient_id).Updates(map[string]interface{}{"count": count}).Error
4363
+	}
4364
+	if count <= 0 {
4365
+		err = XTWriteDB().Model(&prepare).Where("good_id= ? and record_date = ? and patient_id = ? and count  <> 0 and status = 1", good_id, record_time, patient_id).Updates(map[string]interface{}{"count": count, "status": 0}).Error
4366
+	}
4360 4367
 
4361
-	err := XTWriteDB().Model(&prepare).Where("good_id= ? and record_date = ? and patient_id = ? and count  <> 0 and status = 1", good_id, record_time, patient_id).Updates(map[string]interface{}{"count": count}).Error
4362 4368
 	return err
4363 4369
 }
4364 4370
 

+ 7 - 4
service/new_warehouse_service.go Wyświetl plik

@@ -1497,11 +1497,14 @@ func BloodHisDrugDeliverInfo(orgID int64, prescribingNumber float64, warehouseou
1497 1497
 			cancel_count += item.Count
1498 1498
 		}
1499 1499
 
1500
-		fmt.Println("deliver_number", deliver_number)
1501
-		fmt.Println("out_count", out_count)
1502
-		fmt.Println("cancel_count", cancel_count)
1500
+		//fmt.Println("deliver_number", deliver_number)
1501
+		//fmt.Println("out_count", out_count)
1502
+		//fmt.Println("cancel_count", cancel_count)
1503
+		//
1504
+		//fmt.Println("出库数据", deliver_number)
1505
+		//fmt.Println("出库流水---------------------", out_count, cancel_count)
1503 1506
 		//如果本次出库数据大于历史出库数据 新增1条流水
1504
-		if deliver_number > (out_count - cancel_count) {
1507
+		if deliver_number >= (out_count - cancel_count) {
1505 1508
 			drugflow := models.DrugFlow{
1506 1509
 				WarehouseOutOrderNumber: warehouseout.WarehouseOutOrderNumber,
1507 1510
 				WarehouseOutId:          warehouseout.ID,

+ 1 - 1
service/patientmanage_service.go Wyświetl plik

@@ -1839,7 +1839,7 @@ func DeleteSummary(ids []string) error {
1839 1839
 
1840 1840
 func CreateHisSummary(summary *models.XtHospitalSummary) error {
1841 1841
 
1842
-	err := XTReadDB().Create(&summary).Error
1842
+	err := XTWriteDB().Create(&summary).Error
1843 1843
 	return err
1844 1844
 }
1845 1845
 

+ 25 - 20
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go Wyświetl plik

@@ -85,26 +85,31 @@ func (PatientVM) TableName() string {
85 85
 }
86 86
 
87 87
 type DialysisOrderVM struct {
88
-	ID             int64           `gorm:"column:id" json:"id"`
89
-	DialysisDate   int64           `gorm:"column:dialysis_date" json:"dialysis_date"`
90
-	PatientID      int64           `gorm:"column:patient_id" json:"patient_id"`
91
-	Stage          int64           `gorm:"column:stage" json:"stage"`
92
-	BedID          int64           `gorm:"column:bed_id" json:"bed_id"`
93
-	StartNurse     int64           `gorm:"column:start_nurse" json:"start_nurse"`
94
-	FinishNurse    int64           `gorm:"column:finish_nurse" json:"finish_nurse"`
95
-	StartTime      int64           `gorm:"column:start_time" json:"start_time"`
96
-	EndTime        int64           `gorm:"column:end_time" json:"end_time"`
97
-	PunctureNurse  int64           `gorm:"column:puncture_nurse" json:"puncture_nurse"`
98
-	DeviceNumber   *DeviceNumberVM `gorm:"ForeignKey:BedID" json:"device_number"`
99
-	Creator        int64           `gorm:"column:creator" json:"creator"`
100
-	Modifier       int64           `gorm:"column:modifier" json:"modifier"`
101
-	FinishCreator  int64           `gorm:"column:finish_creator" json:"finish_creator"`
102
-	FinishModifier int64           `gorm:"column:finish_modifier" json:"finish_modifier"`
103
-	SchedualType   int64           `gorm:"column:schedual_type" json:"schedual_type"`
104
-	WashpipeNurse  int64           `gorm:"column:washpipe_nurse" json:"washpipe_nurse" form:"washpipe_nurse"`
105
-	UserOrgId      int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
106
-	QualityNurseId int64           `gorm:"column:quality_nurse_id" json:"quality_nurse_id" form:"quality_nurse_id"`
107
-	Url            string          `gorm:"column:url" json:"url" form:"url"`
88
+	ID                 int64           `gorm:"column:id" json:"id"`
89
+	DialysisDate       int64           `gorm:"column:dialysis_date" json:"dialysis_date"`
90
+	PatientID          int64           `gorm:"column:patient_id" json:"patient_id"`
91
+	Stage              int64           `gorm:"column:stage" json:"stage"`
92
+	BedID              int64           `gorm:"column:bed_id" json:"bed_id"`
93
+	StartNurse         int64           `gorm:"column:start_nurse" json:"start_nurse"`
94
+	FinishNurse        int64           `gorm:"column:finish_nurse" json:"finish_nurse"`
95
+	StartTime          int64           `gorm:"column:start_time" json:"start_time"`
96
+	EndTime            int64           `gorm:"column:end_time" json:"end_time"`
97
+	PunctureNurse      int64           `gorm:"column:puncture_nurse" json:"puncture_nurse"`
98
+	DeviceNumber       *DeviceNumberVM `gorm:"ForeignKey:BedID" json:"device_number"`
99
+	Creator            int64           `gorm:"column:creator" json:"creator"`
100
+	Modifier           int64           `gorm:"column:modifier" json:"modifier"`
101
+	FinishCreator      int64           `gorm:"column:finish_creator" json:"finish_creator"`
102
+	FinishModifier     int64           `gorm:"column:finish_modifier" json:"finish_modifier"`
103
+	SchedualType       int64           `gorm:"column:schedual_type" json:"schedual_type"`
104
+	WashpipeNurse      int64           `gorm:"column:washpipe_nurse" json:"washpipe_nurse" form:"washpipe_nurse"`
105
+	UserOrgId          int64           `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
106
+	QualityNurseId     int64           `gorm:"column:quality_nurse_id" json:"quality_nurse_id" form:"quality_nurse_id"`
107
+	Url                string          `gorm:"column:url" json:"url" form:"url"`
108
+	BloodAccessId      int64           `gorm:"column:blood_access_id" json:"blood_access_id" form:"blood_access_id"`
109
+	DialysisIrrigation string          `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
110
+	DialysisDialyszers string          `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
111
+	PunctureWay        string          `gorm:"column:puncture_way" json:"puncture_way" form:"puncture_way"`
112
+	PunctureNeedle     string          `gorm:"column:puncture_needle" json:"puncture_needle" form:"puncture_needle"`
108 113
 }
109 114
 
110 115
 func (DialysisOrderVM) TableName() string {

+ 49 - 6
service/schedule_service.go Wyświetl plik

@@ -111,7 +111,7 @@ func GetWeekScheduleOne(orgID int64, start, end int64, partionid int64, schedule
111 111
 	return
112 112
 }
113 113
 
114
-func GetWeekScheduleTwo(orgID int64, start, end int64, schIds []string, scheduletype int64) (schedules []*models.Schedule, err error) {
114
+func GetWeekScheduleTwo(orgID int64, start, end int64, schIds []string, scheduletype int64) (schedules []*models.ScheduleTwo, err error) {
115 115
 
116 116
 	db := readDb.Table("xt_schedule as s")
117 117
 	if len(schIds) > 0 {
@@ -154,7 +154,7 @@ func GetScheduleTotalCount(orgID int64, start, end int64, schIds []string, sched
154 154
 
155 155
 }
156 156
 
157
-func GetWeekScheduleThree(orgID int64, start, end int64, schIds []string, scheduletype int64, WeekDayIds []string) (schedules []*models.Schedule, err error) {
157
+func GetWeekScheduleThree(orgID int64, start, end int64, schIds []string, scheduletype int64, WeekDayIds []string) (schedules []*models.ScheduleTwo, err error) {
158 158
 
159 159
 	db := readDb.Table("xt_schedule as s")
160 160
 
@@ -496,14 +496,57 @@ type WeekSchedulePrintVM struct {
496 496
 	Mode         *models.TreatmentMode `gorm:"ForeignKey:ModeID" json:"mode"`
497 497
 }
498 498
 
499
+type WeekSchedulePrintPatients struct {
500
+	ID        int64  `gorm:"column:id" json:"id" form:"id"`
501
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
502
+	Name      string `gorm:"column:name" json:"name" form:"name"`
503
+	Status    int64  `gorm:"column:status" json:"status" form:"status"`
504
+}
505
+
506
+func (WeekSchedulePrintPatients) TableName() string {
507
+	return "xt_patients"
508
+}
509
+
510
+type WeekSchedulePrintDeviceNumber struct {
511
+	ID         int64  `gorm:"column:id" json:"id"`
512
+	OrgID      int64  `gorm:"column:org_id" json:"-"`
513
+	Number     string `gorm:"column:number" json:"number"`
514
+	GroupID    int64  `gorm:"column:group_id" json:"group_id"`
515
+	ZoneID     int64  `gorm:"column:zone_id" json:"zone_id"`
516
+	Status     int64  `gorm:"column:status" json:"status" form:"status"`
517
+	CreateTime int64  `gorm:"column:ctime" json:"-"`
518
+	ModifyTime int64  `gorm:"column:mtime" json:"-"`
519
+	Sort       int64  `gorm:"column:sort" json:"sort" form:"sort"`
520
+}
521
+
522
+func (WeekSchedulePrintDeviceNumber) TableName() string {
523
+	return "xt_device_number"
524
+}
525
+
526
+type WeekSchedulePrintVMTwo struct {
527
+	ID             int64 `gorm:"column:id" json:"id"`
528
+	ZoneID         int64 `gorm:"column:partition_id" json:"zone_id"`
529
+	DeviceNumberID int64 `gorm:"column:bed_id" json:"device_number_id"`
530
+	PatientID      int64 `gorm:"column:patient_id" json:"patient_id"`
531
+	ScheduleDate   int64 `gorm:"column:schedule_date" json:"schedule_date"`
532
+	ScheduleType   int64 `gorm:"column:schedule_type" json:"schedule_type"`
533
+	ScheduleWeek   int64 `gorm:"column:schedule_week" json:"schedule_week"`
534
+	ModeID         int64 `gorm:"column:mode_id" json:"mode_id"`
535
+
536
+	Patient      *WeekSchedulePrintPatients     `gorm:"ForeignKey:PatientID" json:"patient"`
537
+	DeviceNumber *WeekSchedulePrintDeviceNumber `gorm:"ForeignKey:DeviceNumberID" json:"device_number"`
538
+	Zone         *models.DeviceZone             `gorm:"ForeignKey:ZoneID" json:"zone"`
539
+	Mode         *models.TreatmentMode          `gorm:"ForeignKey:ModeID" json:"mode"`
540
+}
541
+
499 542
 type PrintCount struct {
500 543
 	ScheduleType int64 `gorm:"column:schedule_type" json:"schedule_type"`
501 544
 	ScheduleWeek int64 `gorm:"column:schedule_week" json:"schedule_week"`
502 545
 	Count        int64
503 546
 }
504 547
 
505
-func GetPrinitWeekSchedules(orgID int64, start, end int64) ([]*WeekSchedulePrintVM, error) {
506
-	var schedules []*WeekSchedulePrintVM
548
+func GetPrinitWeekSchedules(orgID int64, start, end int64) ([]*WeekSchedulePrintVMTwo, error) {
549
+	var schedules []*WeekSchedulePrintVMTwo
507 550
 	err := readDb.Table("xt_schedule as s").
508 551
 		Preload("Patient", "status = 1 and user_org_id = ?", orgID).
509 552
 		Preload("DeviceNumber", "status = 1 and org_id = ?", orgID).
@@ -878,7 +921,7 @@ func GetWeekDayScheduleByIdThee(orgid int64, scheduleDate int64, scheduleType in
878 921
 		db = db.Where("x.partition_id in (?)", zone)
879 922
 	}
880 923
 
881
-	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1 and dialysis_date = ?", scheduleDate).Preload("XtAssessmentBeforeDislysis", "status = 1 and assessment_date =?", scheduleDate).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
924
+	err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("SchedulesPatientsVM", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1 and dialysis_date = ?", scheduleDate).Preload("XtAssessmentBeforeDislysis", "status = 1 and assessment_date =?", scheduleDate).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
882 925
 		return db.Where("status =1 and parent_id = 0 and advice_date = ?", scheduleDate).Preload("ChildDoctorAdvice", "status = 1")
883 926
 	}).Preload("HisDoctorAdviceInfo", "status = 1 and advice_date = ? and user_org_id = ? ", scheduleDate, orgid).Preload("DialysisPrescription", "status = 1 and record_date =? and user_org_id = ?", scheduleDate, orgid).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
884 927
 		return db.Where("status =1").Order("id asc")
@@ -1186,7 +1229,7 @@ func GetSettingById(id int64) (*models.XtRemindPrintSetting, error) {
1186 1229
 
1187 1230
 func CreateSetting(setting *models.XtRemindPrintSetting) error {
1188 1231
 
1189
-	err := XTReadDB().Create(&setting).Error
1232
+	err := XTWriteDB().Create(&setting).Error
1190 1233
 	return err
1191 1234
 }
1192 1235
 

+ 6 - 6
service/self_drug_service.go Wyświetl plik

@@ -1196,7 +1196,7 @@ func GetInventoryModeList(orgid int64) (info []*models.PatientDrugWarehouseInfo,
1196 1196
 	return info, err
1197 1197
 }
1198 1198
 
1199
-func GetManufacturerListByKeyword(orgid int64, keyword string) (list []*models.Manufacturer, err error) {
1199
+func GetManufacturerListByKeyword(orgid int64, keyword string) (list []*models.BloodManufacturer, err error) {
1200 1200
 
1201 1201
 	likeKey := "%" + keyword + "%"
1202 1202
 	db := XTReadDB().Model(&list).Where("status = 1")
@@ -1249,7 +1249,7 @@ func GetGoodWarehouseInfoByOrgId(orgid int64, storehouse_id int64) (info []*mode
1249 1249
 	return info, err
1250 1250
 }
1251 1251
 
1252
-func GetGoodWarehouseInfoByOrgIdTwo(orgid int64) (info []*models.WarehousingInfo, err error) {
1252
+func GetGoodWarehouseInfoByOrgIdTwo(orgid int64) (info []*models.GoodQueryNewWarehousingInfo, err error) {
1253 1253
 	db := XTReadDB().Model(&info).Where("is_check =1 and status =1")
1254 1254
 	if orgid > 0 {
1255 1255
 		db = db.Where("org_id = ?", orgid)
@@ -1805,7 +1805,7 @@ func GetDrugNewQuery(orgId int64, storehouse_id int64, good_type int64, keyword
1805 1805
 	return drug, total, err
1806 1806
 }
1807 1807
 
1808
-func GetDrugStockCountList(orgId int64, storehouse_id int64, good_type int64, keyword string, page int64, limit int64, ids []int64, goodIds []int64, startime int64, endtime int64) (drug []*models.NewBaseDrug, total int64, err error) {
1808
+func GetDrugStockCountList(orgId int64, storehouse_id int64, good_type int64, keyword string, page int64, limit int64, ids []int64, goodIds []int64, startime int64, endtime int64) (drug []*models.NewBaseDrugOne, total int64, err error) {
1809 1809
 
1810 1810
 	offset := (page - 1) * limit
1811 1811
 	likeKey := "%" + keyword + "%"
@@ -1894,7 +1894,7 @@ func GetGoodInformationWarehouseInfo(good_id int64, orgid int64) (info []*models
1894 1894
 
1895 1895
 func UpdateGoodInformation(id int64, orgid int64, total_count int64) error {
1896 1896
 
1897
-	err := XTWriteDB().Model(&models.GoodInfo{}).Where("id = ? and org_id = ? and status = 1", id, orgid).Update(map[string]interface{}{"total_count": total_count}).Error
1897
+	err := XTWriteDB().Model(&models.GoodInfoTen{}).Where("id = ? and org_id = ? and status = 1", id, orgid).Update(map[string]interface{}{"total_count": total_count}).Error
1898 1898
 	return err
1899 1899
 }
1900 1900
 
@@ -1904,7 +1904,7 @@ func GetBaseDrugName(orgid int64) (drug []*models.BaseDrugLibTwenty, err error)
1904 1904
 	return drug, err
1905 1905
 }
1906 1906
 
1907
-func GetDrugWarehouseInfoName(drugid int64, orgid int64) (info []*models.DrugWarehouseInfo, err error) {
1907
+func GetDrugWarehouseInfoName(drugid int64, orgid int64) (info []*models.DrugWarehouseInfoTen, err error) {
1908 1908
 
1909 1909
 	err = XTReadDB().Where("drug_id = ? and org_id = ? and is_check = 1 and (stock_max_number >0 or stock_min_number > 0) and status = 1", drugid, orgid).Find(&info).Error
1910 1910
 	return info, err
@@ -1912,7 +1912,7 @@ func GetDrugWarehouseInfoName(drugid int64, orgid int64) (info []*models.DrugWar
1912 1912
 
1913 1913
 func UpdateDrugById(id int64, orgid int64, limit_count int64, total_count int64) error {
1914 1914
 
1915
-	err := XTWriteDB().Model(&models.BaseDrugLib{}).Where("id = ? and org_id = ? and status = 1", id, orgid).Update(map[string]interface{}{"drug_stock_limit_count": limit_count, "total_count": total_count}).Error
1915
+	err := XTWriteDB().Model(&models.BaseDrugLibTen{}).Where("id = ? and org_id = ? and status = 1", id, orgid).Update(map[string]interface{}{"drug_stock_limit_count": limit_count, "total_count": total_count}).Error
1916 1916
 	return err
1917 1917
 }
1918 1918
 

+ 12 - 7
service/stock_service.go Wyświetl plik

@@ -3594,11 +3594,10 @@ func GetAllManufacturerList(orgid int64) (list []*models.Manufacturer, err error
3594 3594
 	return list, err
3595 3595
 }
3596 3596
 
3597
-//func GetAllManufacturerListTX(orgid int64,tx *gorm.DB) (list []*models.Manufacturer, err error) {
3598
-//
3599
-//	err = tx.Where("org_id = ? and status = 1", orgid).Find(&list).Error
3600
-//	return list, err
3601
-//}
3597
+func GetNewAllManufacturerList(orgid int64) (list []*models.BloodManufacturer, err error) {
3598
+	err = XTReadDB().Where("org_id = ? and status = 1", orgid).Find(&list).Error
3599
+	return list, err
3600
+}
3602 3601
 
3603 3602
 func GetAllDealerList(orgid int64) (list []*models.Dealer, err error) {
3604 3603
 
@@ -3706,6 +3705,12 @@ func GetAllGoodType(orgid int64) (goodsType []*models.GoodsType, err error) {
3706 3705
 	return goodsType, err
3707 3706
 }
3708 3707
 
3708
+func GetAllNewGoodType(orgid int64) (goodsType []*models.NewGoodsType, err error) {
3709
+
3710
+	err = XTReadDB().Model(&goodsType).Where("org_id = ? and status = 1", orgid).Find(&goodsType).Error
3711
+	return goodsType, err
3712
+}
3713
+
3709 3714
 func GetDepartMentByName(name string, orgid int64) (*models.XtHisDepartment, error) {
3710 3715
 
3711 3716
 	var department models.XtHisDepartment
@@ -5642,7 +5647,7 @@ func GetLastGoodWarehouseOut(orgid int64) (models.WarehouseOut, error) {
5642 5647
 
5643 5648
 func CreateWarehouseInfo(info models.WarehousingInfo) error {
5644 5649
 
5645
-	err := XTReadDB().Create(&info).Error
5650
+	err := XTWriteDB().Create(&info).Error
5646 5651
 	return err
5647 5652
 }
5648 5653
 
@@ -8225,7 +8230,7 @@ func GetSettleOpenConfig(user_org_id int64) (*models.HisSettleStockConfig, error
8225 8230
 
8226 8231
 func CreateSettleOpenConfig(config models.HisSettleStockConfig) error {
8227 8232
 
8228
-	err := XTReadDB().Create(&config).Error
8233
+	err := XTWriteDB().Create(&config).Error
8229 8234
 	return err
8230 8235
 }
8231 8236