28169 6 mēnešus atpakaļ
vecāks
revīzija
1b75f7b169

Binārs
XT_New.exe Parādīt failu


+ 4 - 4
controllers/base_api_controller.go Parādīt failu

@@ -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 = 10587 //机构id
86
+		subscibe.OrgId = 10567 //机构id
87 87
 		subscibe.PeriodStart = 1547447814
88 88
 		subscibe.PeriodEnd = 1550039814
89 89
 		subscibe.State = 1
@@ -93,7 +93,7 @@ func (this *BaseAuthAPIController) Prepare() {
93 93
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
94 94
 		subscibes[4] = &subscibe
95 95
 		var adminUserInfo service.AdminUserInfo
96
-		adminUserInfo.CurrentOrgId = 10587 //机构id小英9675或4
96
+		adminUserInfo.CurrentOrgId = 10567 //机构id小英9675或4
97 97
 		adminUserInfo.CurrentAppId = 10697 //4
98 98
 		adminUserInfo.AdminUser = &userAdmin
99 99
 		adminUserInfo.Subscibes = subscibes
@@ -329,7 +329,7 @@ func (this *BaseServeAPIController) Prepare() {
329 329
 		userAdmin.ModifyTime = 1530786071
330 330
 		var subscibe models.ServeSubscibe
331 331
 		subscibe.ID = 11
332
-		subscibe.OrgId = 10587 //机构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,7 +339,7 @@ func (this *BaseServeAPIController) Prepare() {
339 339
 		subscibes := make(map[int64]*models.ServeSubscibe, 0)
340 340
 		subscibes[4] = &subscibe
341 341
 		var adminUserInfo service.AdminUserInfo
342
-		adminUserInfo.CurrentOrgId = 10587 //机构id小英9675或4
342
+		adminUserInfo.CurrentOrgId = 10567 //机构id小英9675或4
343 343
 		adminUserInfo.CurrentAppId = 16787 //4
344 344
 		adminUserInfo.AdminUser = &userAdmin
345 345
 		adminUserInfo.Subscibes = subscibes

+ 20 - 15
controllers/device_api_controller.go Parādīt failu

@@ -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 Parādīt failu

@@ -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 Parādīt failu

@@ -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
 											//	//查询默认出库仓库库存

+ 7 - 1
controllers/mobile_api_controllers/patient_api_controller.go Parādīt failu

@@ -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 Parādīt failu

@@ -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{

+ 4 - 1
controllers/print_data_api_controller.go Parādīt failu

@@ -135,12 +135,14 @@ 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
 
@@ -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 Parādīt failu

@@ -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)

+ 5 - 1
controllers/stock_in_api_controller.go Parādīt failu

@@ -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
 

+ 1 - 0
models/device_models.go Parādīt failu

@@ -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 Parādīt failu

@@ -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 {

+ 10 - 8
service/device_service.go Parādīt failu

@@ -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 Parādīt failu

@@ -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 Parādīt failu

@@ -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()

+ 9 - 2
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go Parādīt failu

@@ -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

+ 8 - 1
service/stock_service.go Parādīt failu

@@ -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
@@ -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