Bläddra i källkod

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

陈少旭 7 månader sedan
förälder
incheckning
1738990d52

Binär
XT_New.exe Visa fil


+ 6 - 6
controllers/base_api_controller.go Visa fil

@@ -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 = 10697 //机构id
86
+		subscibe.OrgId = 10567 //机构id
87 87
 		subscibe.PeriodStart = 1547447814
88 88
 		subscibe.PeriodEnd = 1550039814
89 89
 		subscibe.State = 1
@@ -93,8 +93,8 @@ 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 = 10697 //机构id小英9675或4
97
-		adminUserInfo.CurrentAppId = 17260 //4
96
+		adminUserInfo.CurrentOrgId = 10567 //机构id小英9675或4
97
+		adminUserInfo.CurrentAppId = 10697 //4
98 98
 		adminUserInfo.AdminUser = &userAdmin
99 99
 		adminUserInfo.Subscibes = subscibes
100 100
 		this.SetSession("admin_user_info", &adminUserInfo)
@@ -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 = 10697 //机构id小英9675或4
332
+		subscibe.OrgId = 10567 //机构id小英9675或4
333 333
 		subscibe.PeriodStart = 1538035409
334 334
 		subscibe.PeriodEnd = 1569571409
335 335
 		subscibe.State = 1
@@ -339,8 +339,8 @@ 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 = 10697 //机构id小英9675或4
343
-		adminUserInfo.CurrentAppId = 17260 //4
342
+		adminUserInfo.CurrentOrgId = 10567 //机构id小英9675或4
343
+		adminUserInfo.CurrentAppId = 16787 //4
344 344
 		adminUserInfo.AdminUser = &userAdmin
345 345
 		adminUserInfo.Subscibes = subscibes
346 346
 		this.SetSession("admin_user_info", &adminUserInfo)

+ 20 - 15
controllers/device_api_controller.go Visa fil

@@ -778,6 +778,7 @@ func (this *DeviceAPIController) CreateNumber() {
778 778
 	zoneID, _ := this.GetInt64("zone")
779 779
 	groupID, _ := this.GetInt64("group")
780 780
 	sort, _ := this.GetInt64("sort")
781
+	number_type := this.GetString("number_type")
781 782
 	if len(num) == 0 || zoneID <= 0 || groupID <= 0 {
782 783
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
783 784
 		return
@@ -806,20 +807,21 @@ func (this *DeviceAPIController) CreateNumber() {
806 807
 
807 808
 	_, errcode := service.GetCreateDeviceNumber(num, adminInfo.CurrentOrgId)
808 809
 	if errcode == gorm.ErrRecordNotFound {
809
-		number, createErr := service.CreateDeviceNumber(adminInfo.CurrentOrgId, num, zoneID, groupID, sort)
810
+		number, createErr := service.CreateDeviceNumber(adminInfo.CurrentOrgId, num, zoneID, groupID, sort, number_type)
810 811
 		if createErr != nil {
811 812
 			this.ErrorLog("创建机号失败:%v", createErr)
812 813
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
813 814
 			return
814 815
 		}
815 816
 		numberJson := map[string]interface{}{
816
-			"id":         number.ID,
817
-			"number":     number.Number,
818
-			"zone_id":    number.ZoneID,
819
-			"group_id":   number.GroupID,
820
-			"zone_name":  zone.Name,
821
-			"group_name": group.Name,
822
-			"sort":       number.Sort,
817
+			"id":          number.ID,
818
+			"number":      number.Number,
819
+			"zone_id":     number.ZoneID,
820
+			"group_id":    number.GroupID,
821
+			"zone_name":   zone.Name,
822
+			"group_name":  group.Name,
823
+			"sort":        number.Sort,
824
+			"number_type": number.NumberType,
823 825
 		}
824 826
 		this.ServeSuccessJSON(map[string]interface{}{
825 827
 			"number": numberJson,
@@ -842,6 +844,7 @@ func (this *DeviceAPIController) ModifyNumber() {
842 844
 	zoneID, _ := this.GetInt64("zone")
843 845
 	groupID, _ := this.GetInt64("group")
844 846
 	sort, _ := this.GetInt64("sort")
847
+	number_type := this.GetString("number_type")
845 848
 	if id <= 0 || len(num) == 0 || zoneID <= 0 || groupID <= 0 {
846 849
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
847 850
 		return
@@ -882,6 +885,7 @@ func (this *DeviceAPIController) ModifyNumber() {
882 885
 	number.ZoneID = zoneID
883 886
 	number.GroupID = groupID
884 887
 	number.Sort = sort
888
+	number.NumberType = number_type
885 889
 	byName, _ := service.GetDeviceNumberByName(num, zoneID, adminInfo.CurrentOrgId)
886 890
 	if byName.ID > 0 && byName.ID != id {
887 891
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -906,13 +910,14 @@ func (this *DeviceAPIController) ModifyNumber() {
906 910
 	}
907 911
 
908 912
 	numberJson := map[string]interface{}{
909
-		"id":         number.ID,
910
-		"number":     number.Number,
911
-		"zone_id":    number.ZoneID,
912
-		"group_id":   number.GroupID,
913
-		"zone_name":  zone.Name,
914
-		"group_name": group.Name,
915
-		"sort":       number.Sort,
913
+		"id":          number.ID,
914
+		"number":      number.Number,
915
+		"zone_id":     number.ZoneID,
916
+		"group_id":    number.GroupID,
917
+		"zone_name":   zone.Name,
918
+		"group_name":  group.Name,
919
+		"sort":        number.Sort,
920
+		"number_type": number.NumberType,
916 921
 	}
917 922
 	this.ServeSuccessJSON(map[string]interface{}{
918 923
 		"number": numberJson,

+ 4 - 0
controllers/dialysis_api_controller.go Visa fil

@@ -4577,6 +4577,8 @@ func (c *DialysisApiController) GetDialysisOrder() {
4577 4577
 	patientDiagnose, _ := service.FindPatientDianose(adminUserInfo.CurrentOrgId)
4578 4578
 
4579 4579
 	lastSchedule, _ := service.FindLastSchedule(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4580
+
4581
+	numberList, _ := service.GetAllBedNumberList(adminUserInfo.CurrentOrgId)
4580 4582
 	//if config.IsOpen == 1 && project_config.IsOpen == 1 && len(projects) > 0 {
4581 4583
 	//	for _, item := range projects {
4582 4584
 	//		var advice *models.HisDoctorAdviceInfo
@@ -4635,6 +4637,7 @@ func (c *DialysisApiController) GetDialysisOrder() {
4635 4637
 			"prescriptionInfo":          prescriptionInfo,
4636 4638
 			"patientDiagnose":           patientDiagnose,
4637 4639
 			"lastSchedule":              lastSchedule,
4640
+			"numberList":                numberList,
4638 4641
 		})
4639 4642
 
4640 4643
 	}
@@ -4675,6 +4678,7 @@ func (c *DialysisApiController) GetDialysisOrder() {
4675 4678
 			"prescriptionInfo":          prescriptionInfo,
4676 4679
 			"patientDiagnose":           patientDiagnose,
4677 4680
 			"lastSchedule":              lastSchedule,
4681
+			"numberList":                numberList,
4678 4682
 		})
4679 4683
 	}
4680 4684
 

+ 38 - 12
controllers/his_api_controller.go Visa fil

@@ -3816,6 +3816,9 @@ func (c *HisApiController) CreateHisPrescription() {
3816 3816
 
3817 3817
 											nowCount, _ := strconv.ParseInt(p.Count, 10, 64)
3818 3818
 
3819
+											//fmt.Println("p----------------------------------------------------", p.ProjectId)
3820
+											//fmt.Println("p----------------------------------------------------", nowCount)
3821
+											//fmt.Println("p----------------------------------------------------", historyCount)
3819 3822
 											//如果当前处方数量大于历史数据,则需要出库
3820 3823
 											if nowCount > historyCount {
3821 3824
 
@@ -3965,18 +3968,41 @@ func (c *HisApiController) CreateHisPrescription() {
3965 3968
 												}
3966 3969
 											}
3967 3970
 
3968
-											//lastHisProject, _ := service.GetLastHisProject(p.PatientId, p.UserOrgId, p.RecordDate, tx, p.ProjectId)
3969
-											////查询历史出库数据
3970
-											//flowGood, _ := service.GetStockFlowIsBatchNumberSeventy(p.PatientId, p.RecordDate, p.ProjectId, lastHisProject.ID)
3971
-											//
3972
-											//var out_count_five int64
3973
-											//for _, item := range flowGood {
3974
-											//	out_count_five += item.Count
3975
-											//}
3976
-											//parseIntCount, _ := strconv.ParseInt(p.Count, 10, 64)
3977
-											//
3978
-											////如果当前处方的出库数量和已经出库的数量不一致,需要进行退库或者出库
3979
-											//if out_count_five != parseIntCount {
3971
+											lastHisProject, _ := service.GetLastHisProject(p.PatientId, p.UserOrgId, p.RecordDate, tx, p.ProjectId)
3972
+											//查询历史出库数据
3973
+											flowGood, _ := service.GetStockFlowIsBatchNumberSeventy(p.PatientId, p.RecordDate, p.ProjectId, lastHisProject.ID)
3974
+
3975
+											var out_count_five int64
3976
+											for _, item := range flowGood {
3977
+												out_count_five += item.Count
3978
+											}
3979
+											parseIntCount, _ := strconv.ParseInt(p.Count, 10, 64)
3980
+
3981
+											//fmt.Println("p.ProjectId-----------------", p.ProjectId)
3982
+											//fmt.Println("out_count_five===============", out_count_five)
3983
+											//fmt.Println("parseIntCount===============", parseIntCount)
3984
+											//如果当前处方的出库数量和已经出库的数量不一致,需要进行退库或者出库
3985
+											if out_count_five != parseIntCount {
3986
+												service.UpdateNewAutomaticReduce(p.PatientId, p.RecordDate, p.ProjectId, lastHisProject.ID, tx)
3987
+												detail := models.AutomaticReduceDetail{
3988
+													WarehouseOutId:          0,
3989
+													WarehouseOutOrderNumber: "",
3990
+													PatientId:               p.PatientId,
3991
+													Ctime:                   time.Now().Unix(),
3992
+													Mtime:                   0,
3993
+													Status:                  1,
3994
+													RecordTime:              p.RecordDate,
3995
+													OrgId:                   p.UserOrgId,
3996
+													GoodId:                  p.ProjectId,
3997
+													GoodTypeId:              0,
3998
+													Count:                   parseIntCount,
3999
+													Type:                    0,
4000
+													ProjectId:               lastHisProject.ID,
4001
+													StorehouseId:            0,
4002
+												}
4003
+
4004
+												service.CreateNewAutoDetail(detail, tx)
4005
+											}
3980 4006
 											//	//查询耗材最后一次出库记录
3981 4007
 											//	wareOut, _ := service.GetLastGoodWarehouseOutInfoByProjectId(p.ProjectId, patient_id, recordDateTime, lastHisProject.ID)
3982 4008
 											//	//查询默认出库仓库库存

Filskillnaden har hållits tillbaka eftersom den är för stor
+ 1353 - 966
controllers/mobile_api_controllers/dialysis_api_controller.go


+ 7 - 1
controllers/mobile_api_controllers/patient_api_controller.go Visa fil

@@ -300,7 +300,10 @@ func (c *PatientApiController) EditDoctorAdvice() {
300 300
 	advice.UpdatedTime = time.Now().Unix()
301 301
 	advice.UserOrgId = adminUserInfo.Org.Id
302 302
 	advice.Modifier = adminUserInfo.AdminUser.Id
303
-	advice.AdviceDoctor = adminUserInfo.AdminUser.Id
303
+	if adminUserInfo.Org.Id == 10580 {
304
+		advice.AdviceDoctor = adminUserInfo.AdminUser.Id
305
+	}
306
+
304 307
 	//处理修改医嘱开始时间逻辑(不包括子医嘱)
305 308
 	//1.一组医嘱内只有一条医嘱(不包括子医嘱)的情况下,只需要直接修改医嘱开始时间,不需要重新分配组号
306 309
 	//2.一组医嘱内有多条医嘱(不包括子医嘱)的情况下,需要为修改的那条医嘱重新分配组号,并修改医嘱开始时间
@@ -5685,6 +5688,7 @@ func (c *PatientApiController) GetPrintDialysisOrder() {
5685 5688
 
5686 5689
 	dialysiscount, err := service.GetDialysisCountByPatientId(firstMonthDate, xttime, patientInfo.ID, adminUserInfo.Org.Id)
5687 5690
 	lastWeight, _ := service.MobileGetLast(adminUserInfo.Org.Id, patientInfo.ID, xttime)
5691
+	numberList, _ := service.GetAllBedNumberList(adminUserInfo.Org.Id)
5688 5692
 	if config.IsOpen == 1 {
5689 5693
 		c.ServeSuccessJSON(map[string]interface{}{
5690 5694
 			"users":                   adminUser,
@@ -5708,6 +5712,7 @@ func (c *PatientApiController) GetPrintDialysisOrder() {
5708 5712
 			"lastSchedule":            lastSchedule,
5709 5713
 			"DoctorAdvice":            DoctorAdvice,
5710 5714
 			"hisAdvice":               hisAdvice,
5715
+			"numberList":              numberList,
5711 5716
 		})
5712 5717
 	}
5713 5718
 
@@ -5734,6 +5739,7 @@ func (c *PatientApiController) GetPrintDialysisOrder() {
5734 5739
 			"lastSchedule":            lastSchedule,
5735 5740
 			"DoctorAdvice":            DoctorAdvice,
5736 5741
 			"hisAdvice":               hisAdvice,
5742
+			"numberList":              numberList,
5737 5743
 		})
5738 5744
 	}
5739 5745
 

+ 49 - 49
controllers/patient_dataconfig_api_controller.go Visa fil

@@ -158,15 +158,15 @@ func (this *PatientDataConfigAPIController) GetSickHistorys() {
158 158
 	}
159 159
 
160 160
 	adminUserInfo := this.GetAdminUserInfo()
161
-	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
162
-	if getPatientErr != nil {
163
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
164
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
165
-		return
166
-	} else if patient == nil {
167
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
168
-		return
169
-	}
161
+	//patient, _ := service.GetPatientByIDOne(adminUserInfo.CurrentOrgId, patientID)
162
+	//if getPatientErr != nil {
163
+	//	this.ErrorLog("获取患者信息失败:%v", getPatientErr)
164
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
165
+	//	return
166
+	//} else if patient == nil {
167
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
168
+	//	return
169
+	//}
170 170
 
171 171
 	records, getRecordsErr := service.GetPatientSickHistory(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
172 172
 	if getRecordsErr != nil {
@@ -198,10 +198,10 @@ func (this *PatientDataConfigAPIController) CreateSickHistory() {
198 198
 	guominyaowu_desc := this.GetString("guominyaowu_desc")
199 199
 	doctor_id, _ := this.GetInt64("doctor_id")
200 200
 
201
-	if patientID <= 0 || len(content) == 0 {
202
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
203
-		return
204
-	}
201
+	//if patientID <= 0 || len(content) == 0 {
202
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
203
+	//	return
204
+	//}
205 205
 
206 206
 	if len(record_time_str) == 0 {
207 207
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
@@ -213,15 +213,15 @@ func (this *PatientDataConfigAPIController) CreateSickHistory() {
213 213
 	checkDate_two, _ := utils.ParseTimeStringToTime("2006-01-02", record_date[0])
214 214
 
215 215
 	adminUserInfo := this.GetAdminUserInfo()
216
-	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
217
-	if getPatientErr != nil {
218
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
219
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
220
-		return
221
-	} else if patient == nil {
222
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
223
-		return
224
-	}
216
+	//patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
217
+	//if getPatientErr != nil {
218
+	//	this.ErrorLog("获取患者信息失败:%v", getPatientErr)
219
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
220
+	//	return
221
+	//} else if patient == nil {
222
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
223
+	//	return
224
+	//}
225 225
 
226 226
 	now := time.Now().Unix()
227 227
 	record := models.XtPatientSickHistory{
@@ -371,15 +371,15 @@ func (this *PatientDataConfigAPIController) GetPhysiqueChecks() {
371 371
 	}
372 372
 
373 373
 	adminUserInfo := this.GetAdminUserInfo()
374
-	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
375
-	if getPatientErr != nil {
376
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
377
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
378
-		return
379
-	} else if patient == nil {
380
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
381
-		return
382
-	}
374
+	//patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
375
+	//if getPatientErr != nil {
376
+	//	this.ErrorLog("获取患者信息失败:%v", getPatientErr)
377
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
378
+	//	return
379
+	//} else if patient == nil {
380
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
381
+	//	return
382
+	//}
383 383
 
384 384
 	records, getRecordsErr := service.GetPatientPhysiqueCheck(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
385 385
 	if getRecordsErr != nil {
@@ -479,15 +479,15 @@ func (this *PatientDataConfigAPIController) CreatePhysiqueCheck() {
479 479
 	checkDate_two, _ := utils.ParseTimeStringToTime("2006-01-02", record_date[0])
480 480
 
481 481
 	adminUserInfo := this.GetAdminUserInfo()
482
-	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
483
-	if getPatientErr != nil {
484
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
485
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
486
-		return
487
-	} else if patient == nil {
488
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
489
-		return
490
-	}
482
+	//patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
483
+	//if getPatientErr != nil {
484
+	//	this.ErrorLog("获取患者信息失败:%v", getPatientErr)
485
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
486
+	//	return
487
+	//} else if patient == nil {
488
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
489
+	//	return
490
+	//}
491 491
 
492 492
 	now := time.Now().Unix()
493 493
 	record := models.XtPatientPhysiqueCheck{
@@ -673,15 +673,15 @@ func (this *PatientDataConfigAPIController) ModifyPhysiqueCheck() {
673 673
 
674 674
 	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
675 675
 	adminUserInfo := this.GetAdminUserInfo()
676
-	patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
677
-	if getPatientErr != nil {
678
-		this.ErrorLog("获取患者信息失败:%v", getPatientErr)
679
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
680
-		return
681
-	} else if patient == nil {
682
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
683
-		return
684
-	}
676
+	//patient, getPatientErr := service.GetPatientByID(adminUserInfo.CurrentOrgId, patientID)
677
+	//if getPatientErr != nil {
678
+	//	this.ErrorLog("获取患者信息失败:%v", getPatientErr)
679
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
680
+	//	return
681
+	//} else if patient == nil {
682
+	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodePatientNoExist)
683
+	//	return
684
+	//}
685 685
 	now := time.Now().Unix()
686 686
 
687 687
 	record := models.XtPatientPhysiqueCheck{

+ 0 - 1
controllers/pharmacy_controller.go Visa fil

@@ -466,7 +466,6 @@ func (this *PharmacyController) DispensingMedicine() {
466 466
 	if orgid == 10480 || orgid == 10188 || orgid == 10217 || orgid == 10164 || orgid == 10666 {
467 467
 		//发药逻辑
468 468
 
469
-		fmt.Println("hhhhhhhhhhhhhhhhhhhhhhhhhhh尽力")
470 469
 		service.DispensingMedicineOne(orgid, patient_id, stime, etime, creater)
471 470
 
472 471
 		//针对桑植盛康

+ 6 - 3
controllers/print_data_api_controller.go Visa fil

@@ -38,7 +38,7 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
38 38
 	idStrs := strings.Split(schIDStr, ",")
39 39
 	adminUserInfo := this.GetAdminUserInfo()
40 40
 
41
-	if this.GetAdminUserInfo().CurrentOrgId == 10016 || this.GetAdminUserInfo().CurrentOrgId == 9882 || this.GetAdminUserInfo().CurrentOrgId == 10138 || this.GetAdminUserInfo().CurrentOrgId == 10278 || this.GetAdminUserInfo().CurrentOrgId == 9841 || this.GetAdminUserInfo().CurrentOrgId == 9845 || this.GetAdminUserInfo().CurrentOrgId == 10081 || this.GetAdminUserInfo().CurrentOrgId == 10215 || this.GetAdminUserInfo().CurrentOrgId == 10121 || this.GetAdminUserInfo().CurrentOrgId == 10234 || this.GetAdminUserInfo().CurrentOrgId == 10188 || this.GetAdminUserInfo().CurrentOrgId == 10217 || this.GetAdminUserInfo().CurrentOrgId == 10340 || this.GetAdminUserInfo().CurrentOrgId == 9905 || this.GetAdminUserInfo().CurrentOrgId == 10346 || this.GetAdminUserInfo().CurrentOrgId == 10441 || this.GetAdminUserInfo().CurrentOrgId == 9970 || this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 10495 || this.GetAdminUserInfo().CurrentOrgId == 10013 || this.GetAdminUserInfo().CurrentOrgId == 10014 {
41
+	if this.GetAdminUserInfo().CurrentOrgId == 10016 || this.GetAdminUserInfo().CurrentOrgId == 9882 || this.GetAdminUserInfo().CurrentOrgId == 10138 || this.GetAdminUserInfo().CurrentOrgId == 10278 || this.GetAdminUserInfo().CurrentOrgId == 9841 || this.GetAdminUserInfo().CurrentOrgId == 9845 || this.GetAdminUserInfo().CurrentOrgId == 10081 || this.GetAdminUserInfo().CurrentOrgId == 10215 || this.GetAdminUserInfo().CurrentOrgId == 10121 || this.GetAdminUserInfo().CurrentOrgId == 10234 || this.GetAdminUserInfo().CurrentOrgId == 10188 || this.GetAdminUserInfo().CurrentOrgId == 10217 || this.GetAdminUserInfo().CurrentOrgId == 10340 || this.GetAdminUserInfo().CurrentOrgId == 9905 || this.GetAdminUserInfo().CurrentOrgId == 10346 || this.GetAdminUserInfo().CurrentOrgId == 10441 || this.GetAdminUserInfo().CurrentOrgId == 9970 || this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 10495 || this.GetAdminUserInfo().CurrentOrgId == 10013 || this.GetAdminUserInfo().CurrentOrgId == 10014 || this.GetAdminUserInfo().CurrentOrgId == 10307 {
42 42
 		schedules, getScheduleErr := service.GetSchedulesSeven(adminUserInfo.CurrentOrgId, idStrs)
43 43
 		for _, item := range schedules {
44 44
 
@@ -135,16 +135,18 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
135 135
 		name, getScheduleErr := service.GetAllName(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
136 136
 		templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
137 137
 
138
+		numberList, _ := service.GetAllBedNumberList(adminUserInfo.CurrentOrgId)
138 139
 		this.ServeSuccessJSON(map[string]interface{}{
139 140
 			"schedules":      schedules,
140 141
 			"medical_staffs": medicalStaffs,
141 142
 			"users":          adminUser,
142 143
 			"templateInfo":   templateInfo,
143 144
 			"name":           name,
145
+			"numberList":     numberList,
144 146
 		})
145 147
 	}
146 148
 
147
-	if this.GetAdminUserInfo().CurrentOrgId != 10016 && this.GetAdminUserInfo().CurrentOrgId != 9882 && this.GetAdminUserInfo().CurrentOrgId != 10138 && this.GetAdminUserInfo().CurrentOrgId != 10278 && this.GetAdminUserInfo().CurrentOrgId != 9841 && this.GetAdminUserInfo().CurrentOrgId != 9845 && this.GetAdminUserInfo().CurrentOrgId != 10081 && this.GetAdminUserInfo().CurrentOrgId != 10215 && this.GetAdminUserInfo().CurrentOrgId != 10121 && this.GetAdminUserInfo().CurrentOrgId != 10234 && this.GetAdminUserInfo().CurrentOrgId != 10188 && this.GetAdminUserInfo().CurrentOrgId != 10217 && this.GetAdminUserInfo().CurrentOrgId != 10340 && this.GetAdminUserInfo().CurrentOrgId != 9905 && this.GetAdminUserInfo().CurrentOrgId != 10346 && this.GetAdminUserInfo().CurrentOrgId != 10441 && this.GetAdminUserInfo().CurrentOrgId != 9970 && this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 10495 && this.GetAdminUserInfo().CurrentOrgId != 10013 && this.GetAdminUserInfo().CurrentOrgId != 10014 {
149
+	if this.GetAdminUserInfo().CurrentOrgId != 10016 && this.GetAdminUserInfo().CurrentOrgId != 9882 && this.GetAdminUserInfo().CurrentOrgId != 10138 && this.GetAdminUserInfo().CurrentOrgId != 10278 && this.GetAdminUserInfo().CurrentOrgId != 9841 && this.GetAdminUserInfo().CurrentOrgId != 9845 && this.GetAdminUserInfo().CurrentOrgId != 10081 && this.GetAdminUserInfo().CurrentOrgId != 10215 && this.GetAdminUserInfo().CurrentOrgId != 10121 && this.GetAdminUserInfo().CurrentOrgId != 10234 && this.GetAdminUserInfo().CurrentOrgId != 10188 && this.GetAdminUserInfo().CurrentOrgId != 10217 && this.GetAdminUserInfo().CurrentOrgId != 10340 && this.GetAdminUserInfo().CurrentOrgId != 9905 && this.GetAdminUserInfo().CurrentOrgId != 10346 && this.GetAdminUserInfo().CurrentOrgId != 10441 && this.GetAdminUserInfo().CurrentOrgId != 9970 && this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 10495 && this.GetAdminUserInfo().CurrentOrgId != 10013 && this.GetAdminUserInfo().CurrentOrgId != 10014 && this.GetAdminUserInfo().CurrentOrgId != 10307 {
148 150
 
149 151
 		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
150 152
 		for _, item := range schedules {
@@ -217,13 +219,14 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
217 219
 		adminUser, _ := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
218 220
 		name, getScheduleErr := service.GetAllName(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
219 221
 		templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
220
-
222
+		numberList, _ := service.GetAllBedNumberList(adminUserInfo.CurrentOrgId)
221 223
 		this.ServeSuccessJSON(map[string]interface{}{
222 224
 			"schedules":      schedules,
223 225
 			"medical_staffs": medicalStaffs,
224 226
 			"users":          adminUser,
225 227
 			"templateInfo":   templateInfo,
226 228
 			"name":           name,
229
+			"numberList":     numberList,
227 230
 		})
228 231
 	}
229 232
 

+ 8 - 0
controllers/schedule_api_controller.go Visa fil

@@ -4548,6 +4548,10 @@ func (this *ScheduleApiController) GetBloodScheduleList() {
4548 4548
 			assessmentBeforFourty, _ := service.GetAssessmentBeforFourty(orgId, item.PatientId, item.ScheduleDate)
4549 4549
 			item.XtAssessmentBeforeDislysis = assessmentBeforFourty
4550 4550
 
4551
+			templateList, _ := service.GetHisPrescriptionTemplateList(orgId, item.PatientId, item.ModeId)
4552
+
4553
+			item.HisPrescriptionTemplate = templateList
4554
+
4551 4555
 		}
4552 4556
 		if err != nil {
4553 4557
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
@@ -4583,6 +4587,10 @@ func (this *ScheduleApiController) GetBloodScheduleList() {
4583 4587
 			assessmentBeforFourty, _ := service.GetAssessmentBeforFourty(orgId, item.PatientId, item.ScheduleDate)
4584 4588
 			item.XtAssessmentBeforeDislysis = assessmentBeforFourty
4585 4589
 
4590
+			templateList, _ := service.GetHisPrescriptionTemplateList(orgId, item.PatientId, item.ModeId)
4591
+
4592
+			item.HisPrescriptionTemplate = templateList
4593
+
4586 4594
 		}
4587 4595
 		if err != nil {
4588 4596
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)

+ 19 - 5
controllers/self_drug_api_congtroller.go Visa fil

@@ -6433,12 +6433,26 @@ func (c *SelfDrugApiController) GetDrugInventoryModePrintList() {
6433 6433
 	//查询本月出库
6434 6434
 	outList, _ := service.GetDrugWarhouseHouseOutInfo(orgId, startTime, endTime)
6435 6435
 
6436
+	//查询本月退库
6437
+	cancelOutInfo, _ := service.GetDrugWarehouseCancelOutInfo(orgId, startTime, endTime)
6438
+
6436 6439
 	drugList, _ := service.GetAllDrugList(orgId)
6440
+
6441
+	warehouseInfoFlow, _ := service.GetDrugMonthWarehouseInfo(orgId, startTime)
6442
+
6443
+	warehouseOutFlow, _ := service.GetDrugMonthWarehouseOutInfo(orgId, startTime)
6444
+
6445
+	cancelFlow, _ := service.GetDrugMonthCancelOutInfo(orgId, startTime)
6446
+
6437 6447
 	c.ServeSuccessJSON(map[string]interface{}{
6438
-		"list":             list,
6439
-		"manufacturerList": manufacturerList,
6440
-		"outList":          outList,
6441
-		"infoList":         infoList,
6442
-		"drugList":         drugList,
6448
+		"list":              list,
6449
+		"manufacturerList":  manufacturerList,
6450
+		"outList":           outList,
6451
+		"infoList":          infoList,
6452
+		"drugList":          drugList,
6453
+		"warehouseInfoFlow": warehouseInfoFlow,
6454
+		"warehouseOutFlow":  warehouseOutFlow,
6455
+		"cancelFlow":        cancelFlow,
6456
+		"cancelOutInfo":     cancelOutInfo,
6443 6457
 	})
6444 6458
 }

+ 9 - 1
controllers/stock_in_api_controller.go Visa fil

@@ -5060,10 +5060,14 @@ func (this *StockManagerApiController) GetCancelStockOrderPrint() {
5060 5060
 func (this *StockManagerApiController) GetStockBatchNumber() {
5061 5061
 
5062 5062
 	id, _ := this.GetInt64("id")
5063
+	storehouse_id, _ := this.GetInt64("storehouse_id")
5063 5064
 	orgId := this.GetAdminUserInfo().CurrentOrgId
5064 5065
 	list, _ := service.GetStockBatchNumber(id, orgId)
5066
+	lastWarehouseInfoTwo, _ := service.GetLastWarehouseInfoTwo(id, storehouse_id, orgId)
5067
+
5065 5068
 	this.ServeSuccessJSON(map[string]interface{}{
5066
-		"list": list,
5069
+		"list":                 list,
5070
+		"lastWarehouseInfoTwo": lastWarehouseInfoTwo,
5067 5071
 	})
5068 5072
 }
5069 5073
 
@@ -8420,6 +8424,9 @@ func (this *StockManagerApiController) GetStockInventoryModePrintList() {
8420 8424
 	//获取盘亏的数据
8421 8425
 	flowNoProList, _ := service.GetGoodStockFlowNoProList(startTime, endTime, orgId)
8422 8426
 
8427
+	//获取盘点退库
8428
+	CancelFlowList, _ := service.GetCancelStockFlowList(startTime, endTime, orgId)
8429
+
8423 8430
 	manufacturerList, _ := service.GetAllManufacturerList(orgId)
8424 8431
 
8425 8432
 	//获取期初结余数量
@@ -8441,6 +8448,7 @@ func (this *StockManagerApiController) GetStockInventoryModePrintList() {
8441 8448
 		"warehouseinfo":    warehouseinfo,
8442 8449
 		"warehouseOutInfo": warehouseOutInfo,
8443 8450
 		"cancelInfo":       cancelInfo,
8451
+		"CancelFlowList":   CancelFlowList,
8444 8452
 	})
8445 8453
 
8446 8454
 }

+ 1 - 0
models/device_models.go Visa fil

@@ -245,6 +245,7 @@ type DeviceNumber struct {
245 245
 	CreateTime int64      `gorm:"column:ctime" json:"-"`
246 246
 	ModifyTime int64      `gorm:"column:mtime" json:"-"`
247 247
 	Sort       int64      `gorm:"column:sort" json:"sort" form:"sort"`
248
+	NumberType string     `gorm:"column:number_type" json:"number_type" form:"number_type"`
248 249
 	DeviceZone DeviceZone `json:"zone" gorm:"foreignkey:ID;AssociationForeignKey:ZoneID;"`
249 250
 }
250 251
 

+ 2 - 0
models/schedule_models.go Visa fil

@@ -296,6 +296,7 @@ type VmSchedulesRemind struct {
296 296
 	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
297 297
 	LastAfterWeight            AssessmentAfterDislysis    `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
298 298
 	XtDialysisOrderSix         XtDialysisOrderSix         `json:"dialysis_order" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
299
+	HisPrescriptionTemplate    HisPrescriptionTemplateSix `json:"his_prescription_template" gorm:"foreignkey:PatientId,ModeId;AssociationForeignKey:PatientId,ModeId;"`
299 300
 }
300 301
 
301 302
 func (VmSchedulesRemind) TableName() string {
@@ -579,6 +580,7 @@ type GoodInfoNight struct {
579 580
 	GoodName          string `gorm:"column:good_name" json:"good_name" form:"good_name"`
580 581
 	SpecificationName string `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
581 582
 	GoodTypeId        int64  `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
583
+	PackingUnit       string `gorm:"column:packing_unit" json:"packing_unit" form:"packing_unit"`
582 584
 }
583 585
 
584 586
 func (GoodInfoNight) TableName() string {

+ 17 - 16
models/self_drug_models.go Visa fil

@@ -986,22 +986,23 @@ func (SgjDrugWarehouseOutInfo) TableName() string {
986 986
 }
987 987
 
988 988
 type PatientDrugWarehouseInfo struct {
989
-	DrugId         int64  `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
990
-	Number         string `gorm:"column:number" json:"number" form:"number"`
991
-	ProductDate    int64  `gorm:"column:product_date" json:"product_date" form:"product_date"`
992
-	ExpiryDate     int64  `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
993
-	StockMaxNumber int64  `gorm:"column:stock_max_number" json:"stock_max_number" form:"stock_max_number"`
994
-	StockMinNumber int64  `gorm:"column:stock_min_number" json:"stock_min_number" form:"stock_min_number"`
995
-	BatchNumber    string `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
996
-	DrugName       string `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
997
-	MaxUnit        string `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
998
-	MinUnit        string `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
999
-	MinNumber      int64  `gorm:"column:min_number" json:"min_number" form:"min_number"`
1000
-	Dose           string `gorm:"column:dose" json:"dose" form:"dose"`
1001
-	DoseUnit       string `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
1002
-	Manufacturer   int64  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
1003
-	Dealer         int64  `gorm:"column:dealer" json:"dealer" form:"dealer"`
1004
-	SumCount       int64  `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
989
+	DrugId           int64  `gorm:"column:drug_id" json:"drug_id" form:"drug_id"`
990
+	Number           string `gorm:"column:number" json:"number" form:"number"`
991
+	ProductDate      int64  `gorm:"column:product_date" json:"product_date" form:"product_date"`
992
+	ExpiryDate       int64  `gorm:"column:expiry_date" json:"expiry_date" form:"expiry_date"`
993
+	StockMaxNumber   int64  `gorm:"column:stock_max_number" json:"stock_max_number" form:"stock_max_number"`
994
+	StockMinNumber   int64  `gorm:"column:stock_min_number" json:"stock_min_number" form:"stock_min_number"`
995
+	BatchNumber      string `gorm:"column:batch_number" json:"batch_number" form:"batch_number"`
996
+	DrugName         string `gorm:"column:drug_name" json:"drug_name" form:"drug_name"`
997
+	MaxUnit          string `gorm:"column:max_unit" json:"max_unit" form:"max_unit"`
998
+	MinUnit          string `gorm:"column:min_unit" json:"min_unit" form:"min_unit"`
999
+	MinNumber        int64  `gorm:"column:min_number" json:"min_number" form:"min_number"`
1000
+	Dose             string `gorm:"column:dose" json:"dose" form:"dose"`
1001
+	DoseUnit         string `gorm:"column:dose_unit" json:"dose_unit" form:"dose_unit"`
1002
+	Manufacturer     int64  `gorm:"column:manufacturer" json:"manufacturer" form:"manufacturer"`
1003
+	Dealer           int64  `gorm:"column:dealer" json:"dealer" form:"dealer"`
1004
+	SumCount         int64  `gorm:"column:sum_count" json:"sum_count" form:"sum_count"`
1005
+	WarehousingCount int64  `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
1005 1006
 }
1006 1007
 
1007 1008
 type NewGoodInformation struct {

+ 1 - 0
models/stock_models.go Visa fil

@@ -1344,6 +1344,7 @@ type PatientWarehouseInfo struct {
1344 1344
 	Remark            string `gorm:"column:remark" json:"remark" form:"remark"`
1345 1345
 	OrgId             int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
1346 1346
 	StockCount        int64  `gorm:"column:stock_count" json:"stock_count" form:"stock_count"`
1347
+	WarehousingCount  int64  `gorm:"column:warehousing_count" json:"warehousing_count" form:"warehousing_count"`
1347 1348
 }
1348 1349
 
1349 1350
 func (PatientWarehouseInfo) TableName() string {

+ 10 - 8
service/device_service.go Visa fil

@@ -393,13 +393,14 @@ func UpdateDeviceGroup(group *models.DeviceGroup) error {
393 393
 //////// 机号 Number
394 394
 
395 395
 type DeviceNumberVM struct {
396
-	ID      int64  `gorm:"column:id" json:"id"`
397
-	OrgID   int64  `gorm:"column:org_id" json:"-"`
398
-	Number  string `gorm:"column:number" json:"number"`
399
-	ZoneID  int64  `gorm:"column:zone_id" json:"zone_id"`
400
-	Status  int64  `gorm:"column:status" json:"status" form:"status"`
401
-	Sort    int64  `gorm:"column:sort" json:"sort" form:"sort"`
402
-	GroupId int64  `gorm:"column:group_id" json:"group_id" form:"group_id"`
396
+	ID         int64  `gorm:"column:id" json:"id"`
397
+	OrgID      int64  `gorm:"column:org_id" json:"-"`
398
+	Number     string `gorm:"column:number" json:"number"`
399
+	ZoneID     int64  `gorm:"column:zone_id" json:"zone_id"`
400
+	Status     int64  `gorm:"column:status" json:"status" form:"status"`
401
+	Sort       int64  `gorm:"column:sort" json:"sort" form:"sort"`
402
+	GroupId    int64  `gorm:"column:group_id" json:"group_id" form:"group_id"`
403
+	NumberType string `gorm:"column:number_type" json:"number_type" form:"number_type"`
403 404
 }
404 405
 
405 406
 func (DeviceNumberVM) TableName() string {
@@ -487,7 +488,7 @@ func GetCreateDeviceNumber(num string, orgid int64) (*models.DeviceNumber, error
487 488
 	return &number, nil
488 489
 }
489 490
 
490
-func CreateDeviceNumber(orgID int64, number string, zoneID int64, groupID int64, sort int64) (*models.DeviceNumber, error) {
491
+func CreateDeviceNumber(orgID int64, number string, zoneID int64, groupID int64, sort int64, number_type string) (*models.DeviceNumber, error) {
491 492
 	now := time.Now().Unix()
492 493
 	numberModel := models.DeviceNumber{
493 494
 		OrgID:      orgID,
@@ -498,6 +499,7 @@ func CreateDeviceNumber(orgID int64, number string, zoneID int64, groupID int64,
498 499
 		CreateTime: now,
499 500
 		ModifyTime: now,
500 501
 		Sort:       sort,
502
+		NumberType: number_type,
501 503
 	}
502 504
 	err := writeDb.Model(&models.DeviceNumber{}).Create(&numberModel).Error
503 505
 	if err != nil {

+ 8 - 2
service/dialysis_solution_service.go Visa fil

@@ -103,11 +103,17 @@ func GetDialysisAdviceTemplateList(keywords string, limit int64, page int64, par
103 103
 		db = db.Joins("JOIN xt_patients AS patient ON patient.id=xt_schedule.patient_id AND patient.status = 1 AND patient.user_org_id = ? AND patient.name Like ?", orgID, keywords)
104 104
 		err = db.Count(&total).Offset(offset).Limit(limit).Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
105 105
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
106
-			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Preload("HisDoctorAdvice", "status=1 and user_org_id =? and advice_date =?", orgID, scheduleDate).Find(&schedule).Error
106
+			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
107
+			Preload("DialysisSolution", "status=1 and solution_status =1 and user_org_id=?", orgID).
108
+			Preload("DialysisPrescription", "status=1 and record_date = ?  and user_org_id=?", scheduleDate, orgID).
109
+			Preload("HisDoctorAdvice", "status=1 and user_org_id =? and advice_date =?", orgID, scheduleDate).Find(&schedule).Error
107 110
 	} else {
108 111
 		err = db.Count(&total).Offset(offset).Limit(limit).Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
109 112
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
110
-			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).Preload("HisDoctorAdvice", "status=1 and user_org_id =? and advice_date =?", orgID, scheduleDate).Find(&schedule).Error
113
+			Preload("DeviceNumber.Zone", "status = 1 AND org_id = ?", orgID).
114
+			Preload("DialysisSolution", "status=1 and solution_status =1 and user_org_id=?", orgID).
115
+			Preload("DialysisPrescription", "status=1 and record_date = ?  and user_org_id=?", scheduleDate, orgID).
116
+			Preload("HisDoctorAdvice", "status=1 and user_org_id =? and advice_date =?", orgID, scheduleDate).Find(&schedule).Error
111 117
 	}
112 118
 
113 119
 	return schedule, total, err

+ 12 - 0
service/mobile_dialysis_service.go Visa fil

@@ -3261,6 +3261,18 @@ func GetAssessmentBeforFourty(orgid int64, patientid int64, recorddate int64) (m
3261 3261
 	return evaluation, err
3262 3262
 }
3263 3263
 
3264
+func GetHisPrescriptionTemplateList(user_org_id int64, patient_id int64, mode_id int64) (models.HisPrescriptionTemplateSix, error) {
3265
+
3266
+	templateSix := models.HisPrescriptionTemplateSix{}
3267
+	err := XTReadDB().Where("user_org_id = ? and patient_id = ? and mode = ? and status =1", user_org_id, patient_id, mode_id).Preload("HisPrescriptionInfoTemplateSix", func(db *gorm.DB) *gorm.DB {
3268
+		return db.Where("status = 1 AND user_org_id = ? and type =2", user_org_id).Preload("HisPrescriptionProjectTemplateSeven", func(db *gorm.DB) *gorm.DB {
3269
+			return db.Where("status = 1 AND user_org_id = ? and type =3", user_org_id).Preload("GoodInfo", "org_id = ? and status=1 ", user_org_id)
3270
+		})
3271
+	}).Find(&templateSix).Error
3272
+
3273
+	return templateSix, err
3274
+}
3275
+
3264 3276
 func GetAllHisDoctorAdvice(orgid int64, patientid int64, recorddate int64) (his []*models.HisDoctorAdviceInfo, err error) {
3265 3277
 	redis := RedisClient()
3266 3278
 	defer redis.Close()

+ 12 - 8
service/pharmacy_service.go Visa fil

@@ -563,6 +563,8 @@ func GetManyDrugs(orgid int64, keyword string) (map[int64]models.PharmacyBaseDru
563 563
 // 查询(
564 564
 func GetTodayMedicine(stime, etime, orgid, is_medicine int64, keyword string) (finlly []*models.ListOfDrugs, err error) {
565 565
 	InitDrugidIsNil(orgid, stime, etime)
566
+
567
+	fmt.Println("startime==========================", stime)
566 568
 	var tmp []*models.TmpLLL
567 569
 	if is_medicine == 0 {
568 570
 		if keyword != "" {
@@ -879,13 +881,15 @@ func DispensingMedicineOne(orgid, patient_id, stime, etime, creater int64) (err
879 881
 	if len(adviceList) > 0 {
880 882
 		for _, item := range adviceList {
881 883
 
882
-			pharmacyConfig := IsPharmacyConfig(orgid)
883
-			if pharmacyConfig == true {
884
-				//扣减库存
885
-				err = HisFaDrugsDelivery(orgid, creater, item)
886
-				if err != nil {
887
-					err = fmt.Errorf("!:%v", err)
888
-					return
884
+			if orgid != 10480 {
885
+				pharmacyConfig := IsPharmacyConfig(orgid)
886
+				if pharmacyConfig == true {
887
+					//扣减库存
888
+					err = HisFaDrugsDelivery(orgid, creater, item)
889
+					if err != nil {
890
+						err = fmt.Errorf("!:%v", err)
891
+						return
892
+					}
889 893
 				}
890 894
 			}
891 895
 
@@ -1050,7 +1054,7 @@ func DrugWithdrawal(orgid, patient_id, stime, etime, creater int64) (err error)
1050 1054
 	}
1051 1055
 
1052 1056
 	//针对阜阳经沃
1053
-	if orgid != 104801 {
1057
+	if orgid != 10480 {
1054 1058
 		for _, v := range advice_info {
1055 1059
 
1056 1060
 			//扣减库存

+ 9 - 2
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go Visa fil

@@ -1,11 +1,12 @@
1 1
 package schedule_dialysis
2 2
 
3 3
 import (
4
+	"fmt"
5
+	"time"
6
+
4 7
 	"XT_New/models"
5 8
 	p_service "XT_New/service"
6 9
 	"XT_New/utils"
7
-	"fmt"
8
-	"time"
9 10
 
10 11
 	"github.com/jinzhu/gorm"
11 12
 )
@@ -111,6 +112,12 @@ func GetAllAdminUsers(orgId int64, appid int64) (list []*AdminUserList, err erro
111 112
 	return
112 113
 }
113 114
 
115
+func GetAllBedNumberList(orgid int64) (number []*models.DeviceNumber, err error) {
116
+	db := p_service.XTReadDB()
117
+	err = db.Where("org_id =? and status =1", orgid).Find(&number).Error
118
+	return number, err
119
+}
120
+
114 121
 func GetAllName(orgId int64, appid int64) (list []AdminUserListTwo, err error) {
115 122
 	db := p_service.UserReadDB()
116 123
 	err = db.Table("sgj_user_admin_role as uar").Joins("left join sgj_user_admin as ua on ua.id = uar.admin_user_id").Joins("left join sgj_user_admin_electronic_signature  as e on e.creator = uar.admin_user_id").Where("uar.org_id=? and uar.app_id =? and ua.status=1 and e.status = 1 and e.org_id = ? and e.app_id = ?", orgId, appid, orgId, appid).Select("ua.id, uar.user_name as name, uar.user_type,e.url").Scan(&list).Error

+ 73 - 1
service/self_drug_service.go Visa fil

@@ -1244,7 +1244,7 @@ func GetDamageByDrugId(drugid int64, warhousingorder string, drugtype int64) (dr
1244 1244
 
1245 1245
 func GetInventoryModeList(orgid int64) (info []*models.PatientDrugWarehouseInfo, err error) {
1246 1246
 
1247
-	db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status = 1 and (x.stock_max_number>0 or x.stock_min_number>0)")
1247
+	db := XTReadDB().Table("xt_drug_warehouse_info as x").Where("x.status = 1 and (x.warehousing_count>0)")
1248 1248
 	table := XTReadDB().Table("xt_base_drug as t").Where("t.status = 1")
1249 1249
 	fmt.Println(table)
1250 1250
 	if orgid > 0 {
@@ -5292,3 +5292,75 @@ func GetDrugWarhouseHouseOutInfo(org_id int64, start_time int64, end_time int64)
5292 5292
 	return flow, err
5293 5293
 
5294 5294
 }
5295
+
5296
+func GetDrugWarehouseCancelOutInfo(org_id int64, start_time int64, end_time int64) (flow []*models.XtDrugFlowList, err error) {
5297
+
5298
+	db := XTReadDB().Model(&flow).Where("status=1 and (consumable_type= 7)")
5299
+
5300
+	if org_id > 0 {
5301
+		db = db.Where("user_org_id = ?", org_id)
5302
+	}
5303
+
5304
+	if start_time > 0 {
5305
+		db = db.Where("ctime >= ?", start_time)
5306
+	}
5307
+
5308
+	if end_time > 0 {
5309
+		db = db.Where("ctime<=?", end_time)
5310
+	}
5311
+
5312
+	err = db.Find(&flow).Error
5313
+
5314
+	return flow, err
5315
+}
5316
+
5317
+func GetDrugMonthWarehouseInfo(org_id int64, start_time int64) (flow []*models.XtDrugFlowList, err error) {
5318
+
5319
+	db := XTReadDB().Model(&flow).Where("status=1 and (consumable_type=1 or consumable_type=10)")
5320
+
5321
+	if org_id > 0 {
5322
+		db = db.Where("user_org_id = ?", org_id)
5323
+	}
5324
+
5325
+	if start_time > 0 {
5326
+		db = db.Where("ctime < ?", start_time)
5327
+	}
5328
+
5329
+	err = db.Find(&flow).Error
5330
+
5331
+	return flow, err
5332
+}
5333
+
5334
+func GetDrugMonthWarehouseOutInfo(org_id int64, start_time int64) (flow []*models.XtDrugFlowList, err error) {
5335
+
5336
+	db := XTReadDB().Model(&flow).Where("status=1 and (consumable_type=2 or consumable_type=3 or consumable_type=11)")
5337
+
5338
+	if org_id > 0 {
5339
+		db = db.Where("user_org_id = ?", org_id)
5340
+	}
5341
+
5342
+	if start_time > 0 {
5343
+		db = db.Where("ctime < ?", start_time)
5344
+	}
5345
+
5346
+	err = db.Find(&flow).Error
5347
+
5348
+	return flow, err
5349
+}
5350
+
5351
+func GetDrugMonthCancelOutInfo(org_id int64, start_time int64) (flow []*models.XtDrugFlowList, err error) {
5352
+
5353
+	db := XTReadDB().Model(&flow).Where("status=1 and (consumable_type=7)")
5354
+
5355
+	if org_id > 0 {
5356
+		db = db.Where("user_org_id = ?", org_id)
5357
+	}
5358
+
5359
+	if start_time > 0 {
5360
+		db = db.Where("ctime < ?", start_time)
5361
+	}
5362
+
5363
+	err = db.Find(&flow).Error
5364
+
5365
+	return flow, err
5366
+}

+ 27 - 2
service/stock_service.go Visa fil

@@ -6208,6 +6208,13 @@ func GetLastWarehouseInfo(goodid int64) (models.WarehousingInfo, error) {
6208 6208
 	return info, err
6209 6209
 }
6210 6210
 
6211
+func GetLastWarehouseInfoTwo(goodid int64, storehouse_id int64, user_org_id int64) (models.WarehousingInfo, error) {
6212
+
6213
+	info := models.WarehousingInfo{}
6214
+	err := XTReadDB().Model(&info).Where("good_id = ? and status = 1 and storehouse_id=? and org_id = ?  and stock_count > 0", goodid, storehouse_id, user_org_id).Order("ctime").First(&info).Error
6215
+	return info, err
6216
+}
6217
+
6211 6218
 func GetFirstWarehouseInfo(goodid int64) (models.WarehousingInfo, error) {
6212 6219
 	info := models.WarehousingInfo{}
6213 6220
 	err := XTReadDB().Model(&info).Where("good_id = ? and status = 1", goodid).First(&info).Error
@@ -6932,7 +6939,7 @@ func UpdatedGoodInfo(info models.GoodInfo, goodid int64) error {
6932 6939
 
6933 6940
 func GetInventoryExportList(orgid int64) (info []*models.PatientWarehouseInfo, err error) {
6934 6941
 
6935
-	db := XTReadDB().Table("xt_warehouse_info as x").Where("x.status = 1 and x.stock_count>0")
6942
+	db := XTReadDB().Table("xt_warehouse_info as x").Where("x.status = 1 and x.warehousing_count>0")
6936 6943
 	table := XTReadDB().Table("xt_good_information as t").Where("t.status = 1")
6937 6944
 	fmt.Println(table)
6938 6945
 	if orgid > 0 {
@@ -8203,7 +8210,7 @@ func AddDrugReturnWarehouseStockMinNumber(count int64, id int64) error {
8203 8210
 
8204 8211
 func UpdateDrugWarehouseInfoTwenty(id int64, info *models.DrugWarehouseInfo) error {
8205 8212
 
8206
-	err := XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"drug_id": info.DrugId, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "warehousing_count": info.WarehousingCount, "price": info.Price, "total_price": info.TotalPrice, "dealer": info.Dealer, "manufacturer": info.Manufacturer, "remark": info.Remark, "retail_price": info.RetailPrice, "max_unit": info.MaxUnit, "min_unit": info.MinUnit, "drug_code": info.DrugCode}).Error
8213
+	err := XTWriteDB().Model(&models.DrugWarehouseInfo{}).Where("id = ? and status = 1", id).Update(map[string]interface{}{"drug_id": info.DrugId, "number": info.Number, "product_date": info.ProductDate, "expiry_date": info.ExpiryDate, "warehousing_count": info.WarehousingCount, "price": info.Price, "total_price": info.TotalPrice, "dealer": info.Dealer, "manufacturer": info.Manufacturer, "remark": info.Remark, "retail_price": info.RetailPrice, "max_unit": info.MaxUnit, "min_unit": info.MinUnit, "drug_code": info.DrugCode, "batch_number": info.BatchNumber}).Error
8207 8214
 	return err
8208 8215
 }
8209 8216
 
@@ -9673,6 +9680,24 @@ func GetGoodStockFlowNoProList(startTime int64, endTime int64, orgId int64) (flo
9673 9680
 	return flow, err
9674 9681
 }
9675 9682
 
9683
+func GetCancelStockFlowList(startTime int64, endTime int64, orgId int64) (flow []*models.VmStockFlow, err error) {
9684
+
9685
+	db := XTReadDB().Model(&flow).Where("status=1 and consumable_type = 7")
9686
+
9687
+	if startTime > 0 {
9688
+		db = db.Where("ctime>=?", startTime)
9689
+	}
9690
+	if endTime > 0 {
9691
+		db = db.Where("ctime<=?", endTime)
9692
+	}
9693
+	if orgId > 0 {
9694
+		db = db.Where("user_org_id = ?", orgId)
9695
+	}
9696
+	err = db.Find(&flow).Error
9697
+
9698
+	return flow, err
9699
+}
9700
+
9676 9701
 func GetLastMonthCount(startTime int64, orgId int64) (flow []*models.VmStockFlow, err error) {
9677 9702
 
9678 9703
 	db := XTReadDB().Model(&flow).Where("status=1 and (consumable_type = 1 or consumable_type = 10)")