28169 před 6 měsíci
rodič
revize
1b75f7b169

binární
XT_New.exe Zobrazit soubor


+ 4 - 4
controllers/base_api_controller.go Zobrazit soubor

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

+ 20 - 15
controllers/device_api_controller.go Zobrazit soubor

778
 	zoneID, _ := this.GetInt64("zone")
778
 	zoneID, _ := this.GetInt64("zone")
779
 	groupID, _ := this.GetInt64("group")
779
 	groupID, _ := this.GetInt64("group")
780
 	sort, _ := this.GetInt64("sort")
780
 	sort, _ := this.GetInt64("sort")
781
+	number_type := this.GetString("number_type")
781
 	if len(num) == 0 || zoneID <= 0 || groupID <= 0 {
782
 	if len(num) == 0 || zoneID <= 0 || groupID <= 0 {
782
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
783
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
783
 		return
784
 		return
806
 
807
 
807
 	_, errcode := service.GetCreateDeviceNumber(num, adminInfo.CurrentOrgId)
808
 	_, errcode := service.GetCreateDeviceNumber(num, adminInfo.CurrentOrgId)
808
 	if errcode == gorm.ErrRecordNotFound {
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
 		if createErr != nil {
811
 		if createErr != nil {
811
 			this.ErrorLog("创建机号失败:%v", createErr)
812
 			this.ErrorLog("创建机号失败:%v", createErr)
812
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
813
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)
813
 			return
814
 			return
814
 		}
815
 		}
815
 		numberJson := map[string]interface{}{
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
 		this.ServeSuccessJSON(map[string]interface{}{
826
 		this.ServeSuccessJSON(map[string]interface{}{
825
 			"number": numberJson,
827
 			"number": numberJson,
842
 	zoneID, _ := this.GetInt64("zone")
844
 	zoneID, _ := this.GetInt64("zone")
843
 	groupID, _ := this.GetInt64("group")
845
 	groupID, _ := this.GetInt64("group")
844
 	sort, _ := this.GetInt64("sort")
846
 	sort, _ := this.GetInt64("sort")
847
+	number_type := this.GetString("number_type")
845
 	if id <= 0 || len(num) == 0 || zoneID <= 0 || groupID <= 0 {
848
 	if id <= 0 || len(num) == 0 || zoneID <= 0 || groupID <= 0 {
846
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
849
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
847
 		return
850
 		return
882
 	number.ZoneID = zoneID
885
 	number.ZoneID = zoneID
883
 	number.GroupID = groupID
886
 	number.GroupID = groupID
884
 	number.Sort = sort
887
 	number.Sort = sort
888
+	number.NumberType = number_type
885
 	byName, _ := service.GetDeviceNumberByName(num, zoneID, adminInfo.CurrentOrgId)
889
 	byName, _ := service.GetDeviceNumberByName(num, zoneID, adminInfo.CurrentOrgId)
886
 	if byName.ID > 0 && byName.ID != id {
890
 	if byName.ID > 0 && byName.ID != id {
887
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
891
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
906
 	}
910
 	}
907
 
911
 
908
 	numberJson := map[string]interface{}{
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
 	this.ServeSuccessJSON(map[string]interface{}{
922
 	this.ServeSuccessJSON(map[string]interface{}{
918
 		"number": numberJson,
923
 		"number": numberJson,

+ 4 - 0
controllers/dialysis_api_controller.go Zobrazit soubor

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

+ 38 - 12
controllers/his_api_controller.go Zobrazit soubor

3816
 
3816
 
3817
 											nowCount, _ := strconv.ParseInt(p.Count, 10, 64)
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
 											if nowCount > historyCount {
3823
 											if nowCount > historyCount {
3821
 
3824
 
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
 											//	wareOut, _ := service.GetLastGoodWarehouseOutInfoByProjectId(p.ProjectId, patient_id, recordDateTime, lastHisProject.ID)
4007
 											//	wareOut, _ := service.GetLastGoodWarehouseOutInfoByProjectId(p.ProjectId, patient_id, recordDateTime, lastHisProject.ID)
3982
 											//	//查询默认出库仓库库存
4008
 											//	//查询默认出库仓库库存

+ 7 - 1
controllers/mobile_api_controllers/patient_api_controller.go Zobrazit soubor

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

+ 49 - 49
controllers/patient_dataconfig_api_controller.go Zobrazit soubor

158
 	}
158
 	}
159
 
159
 
160
 	adminUserInfo := this.GetAdminUserInfo()
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
 	records, getRecordsErr := service.GetPatientSickHistory(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
171
 	records, getRecordsErr := service.GetPatientSickHistory(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
172
 	if getRecordsErr != nil {
172
 	if getRecordsErr != nil {
198
 	guominyaowu_desc := this.GetString("guominyaowu_desc")
198
 	guominyaowu_desc := this.GetString("guominyaowu_desc")
199
 	doctor_id, _ := this.GetInt64("doctor_id")
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
 	if len(record_time_str) == 0 {
206
 	if len(record_time_str) == 0 {
207
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
207
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
213
 	checkDate_two, _ := utils.ParseTimeStringToTime("2006-01-02", record_date[0])
213
 	checkDate_two, _ := utils.ParseTimeStringToTime("2006-01-02", record_date[0])
214
 
214
 
215
 	adminUserInfo := this.GetAdminUserInfo()
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
 	now := time.Now().Unix()
226
 	now := time.Now().Unix()
227
 	record := models.XtPatientSickHistory{
227
 	record := models.XtPatientSickHistory{
371
 	}
371
 	}
372
 
372
 
373
 	adminUserInfo := this.GetAdminUserInfo()
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
 	records, getRecordsErr := service.GetPatientPhysiqueCheck(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
384
 	records, getRecordsErr := service.GetPatientPhysiqueCheck(adminUserInfo.CurrentOrgId, patientID, startTime.Unix(), endTime.Unix())
385
 	if getRecordsErr != nil {
385
 	if getRecordsErr != nil {
479
 	checkDate_two, _ := utils.ParseTimeStringToTime("2006-01-02", record_date[0])
479
 	checkDate_two, _ := utils.ParseTimeStringToTime("2006-01-02", record_date[0])
480
 
480
 
481
 	adminUserInfo := this.GetAdminUserInfo()
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
 	now := time.Now().Unix()
492
 	now := time.Now().Unix()
493
 	record := models.XtPatientPhysiqueCheck{
493
 	record := models.XtPatientPhysiqueCheck{
673
 
673
 
674
 	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
674
 	checkDate, _ := utils.ParseTimeStringToTime("2006-01-02 15:04:05", record_time_str)
675
 	adminUserInfo := this.GetAdminUserInfo()
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
 	now := time.Now().Unix()
685
 	now := time.Now().Unix()
686
 
686
 
687
 	record := models.XtPatientPhysiqueCheck{
687
 	record := models.XtPatientPhysiqueCheck{

+ 4 - 1
controllers/print_data_api_controller.go Zobrazit soubor

135
 		name, getScheduleErr := service.GetAllName(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
135
 		name, getScheduleErr := service.GetAllName(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
136
 		templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
136
 		templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
137
 
137
 
138
+		numberList, _ := service.GetAllBedNumberList(adminUserInfo.CurrentOrgId)
138
 		this.ServeSuccessJSON(map[string]interface{}{
139
 		this.ServeSuccessJSON(map[string]interface{}{
139
 			"schedules":      schedules,
140
 			"schedules":      schedules,
140
 			"medical_staffs": medicalStaffs,
141
 			"medical_staffs": medicalStaffs,
141
 			"users":          adminUser,
142
 			"users":          adminUser,
142
 			"templateInfo":   templateInfo,
143
 			"templateInfo":   templateInfo,
143
 			"name":           name,
144
 			"name":           name,
145
+			"numberList":     numberList,
144
 		})
146
 		})
145
 	}
147
 	}
146
 
148
 
217
 		adminUser, _ := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
219
 		adminUser, _ := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
218
 		name, getScheduleErr := service.GetAllName(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
220
 		name, getScheduleErr := service.GetAllName(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
219
 		templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
221
 		templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
220
-
222
+		numberList, _ := service.GetAllBedNumberList(adminUserInfo.CurrentOrgId)
221
 		this.ServeSuccessJSON(map[string]interface{}{
223
 		this.ServeSuccessJSON(map[string]interface{}{
222
 			"schedules":      schedules,
224
 			"schedules":      schedules,
223
 			"medical_staffs": medicalStaffs,
225
 			"medical_staffs": medicalStaffs,
224
 			"users":          adminUser,
226
 			"users":          adminUser,
225
 			"templateInfo":   templateInfo,
227
 			"templateInfo":   templateInfo,
226
 			"name":           name,
228
 			"name":           name,
229
+			"numberList":     numberList,
227
 		})
230
 		})
228
 	}
231
 	}
229
 
232
 

+ 8 - 0
controllers/schedule_api_controller.go Zobrazit soubor

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

+ 5 - 1
controllers/stock_in_api_controller.go Zobrazit soubor

5060
 func (this *StockManagerApiController) GetStockBatchNumber() {
5060
 func (this *StockManagerApiController) GetStockBatchNumber() {
5061
 
5061
 
5062
 	id, _ := this.GetInt64("id")
5062
 	id, _ := this.GetInt64("id")
5063
+	storehouse_id, _ := this.GetInt64("storehouse_id")
5063
 	orgId := this.GetAdminUserInfo().CurrentOrgId
5064
 	orgId := this.GetAdminUserInfo().CurrentOrgId
5064
 	list, _ := service.GetStockBatchNumber(id, orgId)
5065
 	list, _ := service.GetStockBatchNumber(id, orgId)
5066
+	lastWarehouseInfoTwo, _ := service.GetLastWarehouseInfoTwo(id, storehouse_id, orgId)
5067
+
5065
 	this.ServeSuccessJSON(map[string]interface{}{
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 Zobrazit soubor

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

+ 2 - 0
models/schedule_models.go Zobrazit soubor

296
 	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
296
 	XtAssessmentBeforeDislysis XtAssessmentBeforeDislysis `json:"assessmentbefor" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
297
 	LastAfterWeight            AssessmentAfterDislysis    `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
297
 	LastAfterWeight            AssessmentAfterDislysis    `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
298
 	XtDialysisOrderSix         XtDialysisOrderSix         `json:"dialysis_order" gorm:"foreignkey:PatientId;AssociationForeignKey:PatientId;"`
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
 func (VmSchedulesRemind) TableName() string {
302
 func (VmSchedulesRemind) TableName() string {
579
 	GoodName          string `gorm:"column:good_name" json:"good_name" form:"good_name"`
580
 	GoodName          string `gorm:"column:good_name" json:"good_name" form:"good_name"`
580
 	SpecificationName string `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
581
 	SpecificationName string `gorm:"column:specification_name" json:"specification_name" form:"specification_name"`
581
 	GoodTypeId        int64  `gorm:"column:good_type_id" json:"good_type_id" form:"good_type_id"`
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
 func (GoodInfoNight) TableName() string {
586
 func (GoodInfoNight) TableName() string {

+ 10 - 8
service/device_service.go Zobrazit soubor

393
 //////// 机号 Number
393
 //////// 机号 Number
394
 
394
 
395
 type DeviceNumberVM struct {
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
 func (DeviceNumberVM) TableName() string {
406
 func (DeviceNumberVM) TableName() string {
487
 	return &number, nil
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
 	now := time.Now().Unix()
492
 	now := time.Now().Unix()
492
 	numberModel := models.DeviceNumber{
493
 	numberModel := models.DeviceNumber{
493
 		OrgID:      orgID,
494
 		OrgID:      orgID,
498
 		CreateTime: now,
499
 		CreateTime: now,
499
 		ModifyTime: now,
500
 		ModifyTime: now,
500
 		Sort:       sort,
501
 		Sort:       sort,
502
+		NumberType: number_type,
501
 	}
503
 	}
502
 	err := writeDb.Model(&models.DeviceNumber{}).Create(&numberModel).Error
504
 	err := writeDb.Model(&models.DeviceNumber{}).Create(&numberModel).Error
503
 	if err != nil {
505
 	if err != nil {

+ 8 - 2
service/dialysis_solution_service.go Zobrazit soubor

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)
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
 		err = db.Count(&total).Offset(offset).Limit(limit).Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
104
 		err = db.Count(&total).Offset(offset).Limit(limit).Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
105
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
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
 	} else {
110
 	} else {
108
 		err = db.Count(&total).Offset(offset).Limit(limit).Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
111
 		err = db.Count(&total).Offset(offset).Limit(limit).Preload("SchedualPatient", "status = 1 AND user_org_id = ?", orgID).
109
 			Preload("DeviceNumber", "status = 1 AND org_id = ?", orgID).
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
 	return schedule, total, err
119
 	return schedule, total, err

+ 12 - 0
service/mobile_dialysis_service.go Zobrazit soubor

3261
 	return evaluation, err
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
 func GetAllHisDoctorAdvice(orgid int64, patientid int64, recorddate int64) (his []*models.HisDoctorAdviceInfo, err error) {
3276
 func GetAllHisDoctorAdvice(orgid int64, patientid int64, recorddate int64) (his []*models.HisDoctorAdviceInfo, err error) {
3265
 	redis := RedisClient()
3277
 	redis := RedisClient()
3266
 	defer redis.Close()
3278
 	defer redis.Close()

+ 9 - 2
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go Zobrazit soubor

1
 package schedule_dialysis
1
 package schedule_dialysis
2
 
2
 
3
 import (
3
 import (
4
+	"fmt"
5
+	"time"
6
+
4
 	"XT_New/models"
7
 	"XT_New/models"
5
 	p_service "XT_New/service"
8
 	p_service "XT_New/service"
6
 	"XT_New/utils"
9
 	"XT_New/utils"
7
-	"fmt"
8
-	"time"
9
 
10
 
10
 	"github.com/jinzhu/gorm"
11
 	"github.com/jinzhu/gorm"
11
 )
12
 )
111
 	return
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
 func GetAllName(orgId int64, appid int64) (list []AdminUserListTwo, err error) {
121
 func GetAllName(orgId int64, appid int64) (list []AdminUserListTwo, err error) {
115
 	db := p_service.UserReadDB()
122
 	db := p_service.UserReadDB()
116
 	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
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 Zobrazit soubor

6208
 	return info, err
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
 func GetFirstWarehouseInfo(goodid int64) (models.WarehousingInfo, error) {
6218
 func GetFirstWarehouseInfo(goodid int64) (models.WarehousingInfo, error) {
6212
 	info := models.WarehousingInfo{}
6219
 	info := models.WarehousingInfo{}
6213
 	err := XTReadDB().Model(&info).Where("good_id = ? and status = 1", goodid).First(&info).Error
6220
 	err := XTReadDB().Model(&info).Where("good_id = ? and status = 1", goodid).First(&info).Error
8203
 
8210
 
8204
 func UpdateDrugWarehouseInfoTwenty(id int64, info *models.DrugWarehouseInfo) error {
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
 	return err
8214
 	return err
8208
 }
8215
 }
8209
 
8216