XMLWAN преди 2 години
родител
ревизия
415fce02de

+ 1 - 1
conf/app.conf Целия файл

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

+ 2 - 2
controllers/dialysis_api_controller.go Целия файл

@@ -3804,7 +3804,7 @@ func (this *DialysisApiController) GetTodayMonitor() {
3804 3804
 				record.UltrafiltrationRate = ultrafiltration_rate
3805 3805
 			}
3806 3806
 
3807
-			if adminInfo.CurrentOrgId == 10395 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10340 {
3807
+			if adminInfo.CurrentOrgId == 10395 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10340 || adminInfo.CurrentOrgId == 10432 {
3808 3808
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / 1000 / float64(totalMin) * 1000)
3809 3809
 
3810 3810
 				record.UltrafiltrationRate = ultrafiltration_rate
@@ -3832,7 +3832,7 @@ func (this *DialysisApiController) GetTodayMonitor() {
3832 3832
 
3833 3833
 	}
3834 3834
 
3835
-	if adminInfo.CurrentOrgId == 10395 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10340 {
3835
+	if adminInfo.CurrentOrgId == 10395 || adminInfo.CurrentOrgId == 10138 || adminInfo.CurrentOrgId == 10278 || adminInfo.CurrentOrgId == 10340 || adminInfo.CurrentOrgId == 10432 {
3836 3836
 
3837 3837
 		if ultrafiltration_rate > 0 {
3838 3838
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)

+ 11 - 2
controllers/dialysis_record_api_controller.go Целия файл

@@ -1135,6 +1135,15 @@ func (this *DialysisRecordAPIController) StartDialysis() {
1135 1135
 				record.TransmembranePressure = 60
1136 1136
 			}
1137 1137
 
1138
+			//针对兰溪人民医院的需求
1139
+			if adminUserInfo.CurrentOrgId == 10432 {
1140
+				befor, _ := service.GetAssessmentBefor(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
1141
+				record.SystolicBloodPressure = befor.SystolicBloodPressure
1142
+				record.DiastolicBloodPressure = befor.DiastolicBloodPressure
1143
+				record.Temperature = befor.Temperature
1144
+				record.PulseFrequency = befor.PulseFrequency
1145
+			}
1146
+
1138 1147
 			err := service.CreateMonitor(&record)
1139 1148
 			key := strconv.FormatInt(adminUserInfo.CurrentOrgId, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":monitor_records"
1140 1149
 
@@ -1398,8 +1407,8 @@ func (this *DialysisRecordAPIController) FinishDialysis() {
1398 1407
 
1399 1408
 	err := service.UpdateAssessmentAfterDislysisRecord(&tempassessmentAfterDislysis)
1400 1409
 
1401
-	if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10340 || adminUserInfo.CurrentOrgId == 10414 {
1402
-		fmt.Println("进来2332233333333333333333333333333333333我的")
1410
+	if adminUserInfo.CurrentOrgId == 9671 || adminUserInfo.CurrentOrgId == 9675 || adminUserInfo.CurrentOrgId == 10164 || adminUserInfo.CurrentOrgId == 10340 || adminUserInfo.CurrentOrgId == 10414 || adminUserInfo.CurrentOrgId == 10432 {
1411
+
1403 1412
 		evaluation, _ := service.MobileGetPredialysisEvaluationTwo(adminUserInfo.CurrentOrgId, patientID, recordDate.Unix())
1404 1413
 		if evaluation.SystolicBloodPressure == 0 {
1405 1414
 			pre := models.PredialysisEvaluation{

+ 52 - 97
controllers/doctors_api_controller.go Целия файл

@@ -88,112 +88,67 @@ func (c *DoctorsApiController) ScheduleAdvices() {
88 88
 	adminUserInfo := c.GetAdminUserInfo()
89 89
 	orgID := adminUserInfo.CurrentOrgId
90 90
 
91
-	scheduals, err := service.MobileGetScheduleDoctorAdvicesOne(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way)
92
-	hisAdvices, _ := service.GetHisDoctorAdvicesOne(orgID, date.Unix(), delivery_way, schedule_type, partition_type, patient_id, excution_way)
93
-
94
-	project, _ := service.GetPCHisPrescriptionProject(orgID, date.Unix(), delivery_way, patientType, partition_type, patient_id, excution_way)
95
-	//project, _ := service.GetPCHisPrescriptionProject(orgID, date.Unix(), delivery_way, patientType, partition_type, patient_id)
96
-	for _, item := range project {
97
-		index := 0
98
-		for _, subItem := range item.HisPrescriptionTeamProject {
99
-
100
-			if subItem.HisProject.CostClassify != 3 {
101
-				subItem.IsCheckTeam = 2
102
-				item.HisPrescriptionProject = append(item.HisPrescriptionProject, subItem)
103
-			}
91
+	config, _ := service.GetHisDoctorConfig(orgID)
92
+	project_config, _ := service.GetHisProjectConfig(orgID)
104 93
 
105
-			if subItem.HisProject.CostClassify == 3 {
106
-				subItem.IsCheckTeam = 1
107
-				index = index + 1
108
-				if index == 1 {
109
-					item.HisPrescriptionProject = append(item.HisPrescriptionProject, subItem)
94
+	if config.IsOpen == 0 || config.IsOpen == 2 {
95
+		scheduals, err := service.MobileGetScheduleDoctorAdvicesOne(orgID, date.Unix(), adviceType, patientType, adminUserInfo.AdminUser.Id, delivery_way, schedule_type, partition_type, patient_id, excution_way)
96
+		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
97
+		if err != nil {
98
+			c.ErrorLog("获取排班信息失败:%v", err)
99
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
100
+		} else {
101
+			filtedScheduals := []*service.MScheduleDoctorAdviceVM{}
102
+			for _, schedual := range scheduals {
103
+				if len(schedual.DoctorAdvices) > 0 {
104
+					filtedScheduals = append(filtedScheduals, schedual)
110 105
 				}
111 106
 			}
107
+			c.ServeSuccessJSON(map[string]interface{}{
108
+				"scheduals":      filtedScheduals,
109
+				"adminUser":      adminUser,
110
+				"config":         config,
111
+				"project_config": project_config,
112
+			})
112 113
 		}
113 114
 	}
114
-	//for _, item := range project {
115
-	//	index := 0
116
-	//	for _, subItem := range item.HisPrescriptionTeamProject {
117
-	//
118
-	//		//获取所有的患者
119
-	//		patients, _ := service.GetAllPatientListByListTwo(orgID)
120
-	//
121
-	//		//获取所有床位
122
-	//		numberList, _ := service.GetAllDeviceNumberByListOne(orgID)
123
-	//
124
-	//		//获取透析处方
125
-	//		prescriptions, _ := service.GetAllPrescriptionByListOne(orgID, date.Unix())
126
-	//
127
-	//		//获取上机
128
-	//		dialysisOrders, _ := service.GetAllDialysisOrdersByListTwo(orgID, date.Unix())
129
-	//		for key, item := range project {
130
-	//			for _, patient := range patients {
131
-	//				if item.PatientId == patient.ID {
132
-	//					project[key].SchedualPatient = patient
133
-	//					break
134
-	//				}
135
-	//			}
136
-	//			// 获取床位信息
137
-	//			for _, it := range numberList {
138
-	//				if item.BedId == it.ID {
139
-	//					project[key].DeviceNumber = it
140
-	//					break
141
-	//				}
142
-	//			}
143
-	//
144
-	//			// 获取处方
145
-	//			for _, it := range prescriptions {
146
-	//				if item.PatientId == it.PatientId {
147
-	//					project[key].Prescription = it
148
-	//					break
149
-	//				}
150
-	//			}
151
-	//
152
-	//			//获取上机
153
-	//			for _, it := range dialysisOrders {
154
-	//				if item.PatientId == it.PatientId {
155
-	//					project[key].DialysisOrder = it
156
-	//					break
157
-	//				}
158
-	//			}
159
-	//		}
160
-	//		if subItem.HisProject.CostClassify != 3 {
161
-	//			subItem.IsCheckTeam = 2
162
-	//			item.HisPrescriptionProject = append(item.HisPrescriptionProject, subItem)
163
-	//		}
164
-	//
165
-	//		if subItem.HisProject.CostClassify == 3 {
166
-	//			subItem.IsCheckTeam = 1
167
-	//			index = index + 1
168
-	//			if index == 1 {
169
-	//				item.HisPrescriptionProject = append(item.HisPrescriptionProject, subItem)
170
-	//			}
171
-	//		}
172
-	//	}
173
-	//}
174
-	config, _ := service.GetHisDoctorConfig(orgID)
175
-	project_config, _ := service.GetHisProjectConfig(orgID)
115
+	if config.IsOpen == 1 {
116
+		hisAdvices, err := service.GetHisDoctorAdvicesOne(orgID, date.Unix(), delivery_way, schedule_type, partition_type, patient_id, excution_way)
117
+		adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
118
+		project, _ := service.GetPCHisPrescriptionProject(orgID, date.Unix(), delivery_way, patientType, partition_type, patient_id, excution_way)
119
+		for _, item := range project {
120
+			index := 0
121
+			for _, subItem := range item.HisPrescriptionTeamProject {
122
+
123
+				if subItem.HisProject.CostClassify != 3 {
124
+					subItem.IsCheckTeam = 2
125
+					item.HisPrescriptionProject = append(item.HisPrescriptionProject, subItem)
126
+				}
176 127
 
177
-	adminUser, _ := service.GetAllAdminUsers(orgID, adminUserInfo.CurrentAppId)
178
-	if err != nil {
179
-		c.ErrorLog("获取排班信息失败:%v", err)
180
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
181
-	} else {
182
-		filtedScheduals := []*service.MScheduleDoctorAdviceVM{}
183
-		for _, schedual := range scheduals {
184
-			if len(schedual.DoctorAdvices) > 0 {
185
-				filtedScheduals = append(filtedScheduals, schedual)
128
+				if subItem.HisProject.CostClassify == 3 {
129
+					subItem.IsCheckTeam = 1
130
+					index = index + 1
131
+					if index == 1 {
132
+						item.HisPrescriptionProject = append(item.HisPrescriptionProject, subItem)
133
+					}
134
+				}
186 135
 			}
187 136
 		}
188
-		c.ServeSuccessJSON(map[string]interface{}{
189
-			"scheduals":      filtedScheduals,
190
-			"adminUser":      adminUser,
191
-			"hisAdvices":     hisAdvices,
192
-			"config":         config,
193
-			"project_config": project_config,
194
-			"project":        project,
195
-		})
137
+
138
+		if err != nil {
139
+			c.ErrorLog("获取排班信息失败:%v", err)
140
+			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
141
+		} else {
142
+			c.ServeSuccessJSON(map[string]interface{}{
143
+				"adminUser":      adminUser,
144
+				"hisAdvices":     hisAdvices,
145
+				"config":         config,
146
+				"project_config": project_config,
147
+				"project":        project,
148
+			})
149
+		}
196 150
 	}
151
+
197 152
 }
198 153
 
199 154
 func (c *DoctorsApiController) GetAllDoctorAndNurse() {

+ 22 - 11
controllers/mobile_api_controllers/dialysis_api_controller.go Целия файл

@@ -1825,7 +1825,7 @@ func (c *DialysisAPIController) Finish() {
1825 1825
 
1826 1826
 	}
1827 1827
 
1828
-	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 {
1828
+	if adminUserInfo.Org.Id == 10101 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 9675 || adminUserInfo.Org.Id == 10215 || adminUserInfo.Org.Id == 10233 || adminUserInfo.Org.Id == 10223 || adminUserInfo.Org.Id == 10243 || adminUserInfo.Org.Id == 10340 || adminUserInfo.Org.Id == 10414 || adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 10432 {
1829 1829
 		evaluation, _ := service.MobileGetPredialysisEvaluationOne(adminUserInfo.Org.Id, id, recordDate.Unix())
1830 1830
 		if evaluation.SystolicBloodPressure == 0 {
1831 1831
 			evaluation.SystolicBloodPressure = fmonitorRecords.SystolicBloodPressure
@@ -2377,7 +2377,7 @@ func (this *DialysisAPIController) StartDialysis() {
2377 2377
 
2378 2378
 			//针对肇庆三鹤血液透析中心
2379 2379
 
2380
-			if template.TemplateId == 43 {
2380
+			if template.TemplateId == 43 || adminUserInfo.Org.Id == 10432 {
2381 2381
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / float64(totalMin))
2382 2382
 			}
2383 2383
 
@@ -2410,9 +2410,10 @@ func (this *DialysisAPIController) StartDialysis() {
2410 2410
 	}
2411 2411
 
2412 2412
 	//只针对广慈医院
2413
-	if template.TemplateId == 26 || template.TemplateId == 25 || template.TemplateId == 28 || adminUserInfo.Org.Id == 9987 || adminUserInfo.Org.Id == 9526 || template.TemplateId == 32 || adminUserInfo.Org.Id == 9918 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 4 {
2413
+	if template.TemplateId == 26 || template.TemplateId == 25 || template.TemplateId == 28 || adminUserInfo.Org.Id == 9987 || adminUserInfo.Org.Id == 9526 || template.TemplateId == 32 || adminUserInfo.Org.Id == 9918 || adminUserInfo.Org.Id == 9671 || adminUserInfo.Org.Id == 3877 || adminUserInfo.Org.Id == 4 || adminUserInfo.Org.Id == 10432 {
2414 2414
 		// 查询病人是否有透前评估数据
2415 2415
 		befor, errcode := service.GetAssessmentBefor(adminUserInfo.Org.Id, patientID, recordDate.Unix())
2416
+
2416 2417
 		//如果有数据就插入
2417 2418
 		if errcode == nil {
2418 2419
 			record.SystolicBloodPressure = befor.SystolicBloodPressure
@@ -2435,7 +2436,17 @@ func (this *DialysisAPIController) StartDialysis() {
2435 2436
 			record.VenousPressure = 80
2436 2437
 			record.TransmembranePressure = 60
2437 2438
 		}
2439
+		//针对兰溪人民医院的需求
2440
+		if adminUserInfo.Org.Id == 10430 || adminUserInfo.Org.Id == 9671 {
2441
+			befor, _ := service.GetAssessmentBefor(adminUserInfo.Org.Id, patientID, recordDate.Unix())
2442
+			record.SystolicBloodPressure = befor.SystolicBloodPressure
2443
+			record.DiastolicBloodPressure = befor.DiastolicBloodPressure
2444
+			record.Temperature = befor.Temperature
2445
+			record.PulseFrequency = befor.PulseFrequency
2446
+			record.BreathingRate = befor.BreathingRate
2447
+		}
2438 2448
 		err := service.CreateMonitor(&record)
2449
+
2439 2450
 		key := strconv.FormatInt(adminUserInfo.Org.Id, 10) + ":" + strconv.FormatInt(patientID, 10) + ":" + strconv.FormatInt(recordDate.Unix(), 10) + ":monitor_records"
2440 2451
 
2441 2452
 		redis := service.RedisClient()
@@ -3034,9 +3045,8 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
3034 3045
 				record.UltrafiltrationRate = ultrafiltration_rate
3035 3046
 			}
3036 3047
 
3037
-			if adminInfo.Org.Id == 10395 || adminInfo.Org.Id == 10138 || adminInfo.Org.Id == 10278 || adminInfo.Org.Id == 10340 {
3048
+			if adminInfo.Org.Id == 10395 || adminInfo.Org.Id == 10138 || adminInfo.Org.Id == 10278 || adminInfo.Org.Id == 10340 || adminInfo.Org.Id == 10432 {
3038 3049
 				ultrafiltration_rate = math.Floor(prescription.TargetUltrafiltration * 60 / 1000 / float64(totalMin) * 1000)
3039
-				fmt.Println("ultrafiltration_rate2332323223322332q", ultrafiltration_rate)
3040 3050
 				record.UltrafiltrationRate = ultrafiltration_rate
3041 3051
 			}
3042 3052
 			//if template.TemplateId == 47 {
@@ -3064,7 +3074,7 @@ func (this *DialysisAPIController) GetLastMonitorRecordTody() {
3064 3074
 		}
3065 3075
 	}
3066 3076
 
3067
-	if adminInfo.Org.Id == 10395 || adminInfo.Org.Id == 10138 || adminInfo.Org.Id == 10278 || adminInfo.Org.Id == 10340 {
3077
+	if adminInfo.Org.Id == 10395 || adminInfo.Org.Id == 10138 || adminInfo.Org.Id == 10278 || adminInfo.Org.Id == 10340 || adminInfo.Org.Id == 10432 {
3068 3078
 
3069 3079
 		if ultrafiltration_rate > 0 {
3070 3080
 			ultrafiltration_volume := math.Floor(float64(record.OperateTime+3600-fristrecord.OperateTime) / 3600 * ultrafiltration_rate)
@@ -4090,15 +4100,16 @@ func (c *DialysisAPIController) GetSolution() {
4090 4100
 	solution, err := service.MobileGetDialysisSolutionByModeIdSeven(adminUserInfo.Org.Id, patient_id, mode_id)
4091 4101
 	prescription, err := service.MobileGetLastDialysisPrescribeByModeIdSeven(adminUserInfo.Org.Id, patient_id, mode_id)
4092 4102
 	system_prescription, err := service.MobileGetSystemDialysisPrescribeByModeIdSeven(adminUserInfo.Org.Id, mode_id)
4093
-
4103
+	dialysisPrescription, _ := service.MobileGetLastDialysisPrescription(patient_id, adminUserInfo.Org.Id)
4094 4104
 	if err != nil {
4095 4105
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
4096 4106
 		return
4097 4107
 	}
4098 4108
 	c.ServeSuccessJSON(map[string]interface{}{
4099
-		"solution":            solution,
4100
-		"prescription":        prescription,
4101
-		"system_prescription": system_prescription,
4109
+		"solution":             solution,
4110
+		"prescription":         prescription,
4111
+		"system_prescription":  system_prescription,
4112
+		"dialysisPrescription": dialysisPrescription,
4102 4113
 	})
4103 4114
 
4104 4115
 }
@@ -7002,7 +7013,7 @@ func (this *DialysisAPIController) GetScheduleTypeByIdList() {
7002 7013
 		}
7003 7014
 		startdateunix = theTime.Unix()
7004 7015
 	}
7005
-	fmt.Println("startdateunix", startdateunix)
7016
+
7006 7017
 	list, _ := service.GetScheduleTypeById(org_id, startdateunix, schedule_type)
7007 7018
 	scheduals, _ := service.MobileGetDialysisScheduals(org_id, startdateunix, schedule_type)
7008 7019
 	devices, _ := service.GetAllDevicetByListSix(org_id)

+ 74 - 30
controllers/print_data_api_controller.go Целия файл

@@ -36,43 +36,87 @@ func (this *PrintDataAPIController) ScheduleDialysisRecordPrintData() {
36 36
 
37 37
 	idStrs := strings.Split(schIDStr, ",")
38 38
 	adminUserInfo := this.GetAdminUserInfo()
39
-	schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
40
-	for _, item := range schedules {
41
-		list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
42
-		if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 {
43
-			item.Count = list.Count
39
+
40
+	if this.GetAdminUserInfo().CurrentOrgId == 10016 {
41
+		schedules, getScheduleErr := service.GetSchedulesSix(adminUserInfo.CurrentOrgId, idStrs)
42
+		for _, item := range schedules {
43
+			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
44
+			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 {
45
+				item.Count = list.Count
46
+			}
47
+			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 {
48
+				listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
49
+
50
+				item.Patient.TotalDialysis = listOne.Count
51
+				item.Count = listOne.Count
52
+			}
53
+		}
54
+		if getScheduleErr != nil {
55
+			this.ErrorLog("获取打印透析记录失败:%v", getScheduleErr)
56
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
57
+			return
44 58
 		}
45
-		if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 {
46
-			listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
47 59
 
48
-			item.Patient.TotalDialysis = listOne.Count
49
-			item.Count = listOne.Count
60
+		medicalStaffs, getMedicalStaffErr := service.GetMedicalStaffs(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
61
+		if getMedicalStaffErr != nil {
62
+			this.ErrorLog("获取医护人员失败:%v", getMedicalStaffErr)
63
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
64
+			return
50 65
 		}
51
-	}
52
-	if getScheduleErr != nil {
53
-		this.ErrorLog("获取打印透析记录失败:%v", getScheduleErr)
54
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
55
-		return
56
-	}
57 66
 
58
-	medicalStaffs, getMedicalStaffErr := service.GetMedicalStaffs(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
59
-	if getMedicalStaffErr != nil {
60
-		this.ErrorLog("获取医护人员失败:%v", getMedicalStaffErr)
61
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
62
-		return
67
+		adminUser, _ := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
68
+		name, getScheduleErr := service.GetAllName(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
69
+		templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
70
+
71
+		this.ServeSuccessJSON(map[string]interface{}{
72
+			"schedules":      schedules,
73
+			"medical_staffs": medicalStaffs,
74
+			"users":          adminUser,
75
+			"templateInfo":   templateInfo,
76
+			"name":           name,
77
+		})
63 78
 	}
64 79
 
65
-	adminUser, _ := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
66
-	name, getScheduleErr := service.GetAllName(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
67
-	templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
80
+	if this.GetAdminUserInfo().CurrentOrgId != 10016 {
81
+		schedules, getScheduleErr := service.GetSchedules(adminUserInfo.CurrentOrgId, idStrs)
82
+		for _, item := range schedules {
83
+			list, _ := service.GetDialysisOrderCountSeven(item.PatientID, item.ScheduleDate)
84
+			if this.GetAdminUserInfo().CurrentOrgId != 10101 && this.GetAdminUserInfo().CurrentOrgId != 9671 {
85
+				item.Count = list.Count
86
+			}
87
+			if this.GetAdminUserInfo().CurrentOrgId == 10101 || this.GetAdminUserInfo().CurrentOrgId == 9671 {
88
+				listOne, _ := service.GetDialysisOrderCountEight(adminUserInfo.CurrentOrgId, item.PatientID, item.ScheduleDate)
89
+
90
+				item.Patient.TotalDialysis = listOne.Count
91
+				item.Count = listOne.Count
92
+			}
93
+		}
94
+		if getScheduleErr != nil {
95
+			this.ErrorLog("获取打印透析记录失败:%v", getScheduleErr)
96
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
97
+			return
98
+		}
99
+
100
+		medicalStaffs, getMedicalStaffErr := service.GetMedicalStaffs(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
101
+		if getMedicalStaffErr != nil {
102
+			this.ErrorLog("获取医护人员失败:%v", getMedicalStaffErr)
103
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
104
+			return
105
+		}
106
+
107
+		adminUser, _ := service.GetAllAdminUsers(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
108
+		name, getScheduleErr := service.GetAllName(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId)
109
+		templateInfo, _ := service.GetOrgInfoTemplate(adminUserInfo.CurrentOrgId)
110
+
111
+		this.ServeSuccessJSON(map[string]interface{}{
112
+			"schedules":      schedules,
113
+			"medical_staffs": medicalStaffs,
114
+			"users":          adminUser,
115
+			"templateInfo":   templateInfo,
116
+			"name":           name,
117
+		})
118
+	}
68 119
 
69
-	this.ServeSuccessJSON(map[string]interface{}{
70
-		"schedules":      schedules,
71
-		"medical_staffs": medicalStaffs,
72
-		"users":          adminUser,
73
-		"templateInfo":   templateInfo,
74
-		"name":           name,
75
-	})
76 120
 }
77 121
 
78 122
 func (this *PrintDataAPIController) StockRecordPrintData() {

+ 19 - 0
models/dialysis.go Целия файл

@@ -1233,3 +1233,22 @@ type DialysisScheduleSeven struct {
1233 1233
 func (DialysisScheduleSeven) TableName() string {
1234 1234
 	return "xt_schedule"
1235 1235
 }
1236
+
1237
+type DialysisOrderTwenty struct {
1238
+	ID           int64        `gorm:"column:id" json:"id"`
1239
+	DialysisDate int64        `gorm:"column:dialysis_date" json:"dialysis_date"`
1240
+	UserOrgId    int64        `gorm:"column:user_org_id" json:"user_org_id"`
1241
+	PatientId    int64        `gorm:"column:patient_id" json:"patient_id"`
1242
+	Stage        int64        `gorm:"column:stage" json:"stage"`
1243
+	Remark       string       `gorm:"column:remark" json:"remark"`
1244
+	BedID        int64        `gorm:"column:bed_id" json:"bed_id"`
1245
+	Status       int64        `gorm:"column:status" json:"status"`
1246
+	DeviceNumber DeviceNumber `gorm:"ForeignKey:BedID"`
1247
+	StartTime    int64        `gorm:"column:start_time" json:"start_time"`
1248
+	SchedualType int64        `gorm:"column:schedual_type" json:"schedual_type"`
1249
+	ZoneId       int64        `gorm:"column:zone_id" json:"zone_id" form:"zone_id"`
1250
+}
1251
+
1252
+func (DialysisOrderTwenty) TableName() string {
1253
+	return "xt_dialysis_order"
1254
+}

+ 27 - 0
models/patient_models.go Целия файл

@@ -1607,3 +1607,30 @@ type XtScheduleList struct {
1607 1607
 func (XtScheduleList) TableName() string {
1608 1608
 	return "xt_schedule"
1609 1609
 }
1610
+
1611
+type DialysisPrescriptionTwenty struct {
1612
+	ID                         int64  `gorm:"column:id" json:"id"`
1613
+	UserOrgId                  int64  `gorm:"column:user_org_id" json:"user_org_id"`
1614
+	PatientId                  int64  `gorm:"column:patient_id" json:"patient_id"`
1615
+	ModeId                     int64  `gorm:"column:mode_id" json:"mode_id"`
1616
+	Anticoagulant              int64  `gorm:"column:anticoagulant" json:"anticoagulant"`
1617
+	DialysateFormulation       int64  `gorm:"column:dialysate_formulation" json:"dialysate_formulation"`
1618
+	DialyzerPerfusionApparatus string `gorm:"column:dialyzer_perfusion_apparatus" json:"dialyzer_perfusion_apparatus"`
1619
+	DialysisDialyszers         string `gorm:"column:dialysis_dialyszers" json:"dialysis_dialyszers" form:"dialysis_dialyszers"`
1620
+	DialysisIrrigation         string `gorm:"column:dialysis_irrigation" json:"dialysis_irrigation" form:"dialysis_irrigation"`
1621
+}
1622
+
1623
+func (DialysisPrescriptionTwenty) TableName() string {
1624
+	return "xt_dialysis_prescription"
1625
+}
1626
+
1627
+type DialysisPrescriptionThrity struct {
1628
+	ID        int64  `gorm:"column:id" json:"id"`
1629
+	UserOrgId int64  `gorm:"column:user_org_id" json:"user_org_id"`
1630
+	PatientId int64  `gorm:"column:patient_id" json:"patient_id"`
1631
+	Remark    string `gorm:"column:remark" json:"remark" form:"remark"`
1632
+}
1633
+
1634
+func (DialysisPrescriptionThrity) TableName() string {
1635
+	return "xt_dialysis_prescription"
1636
+}

+ 25 - 0
models/schedule_models.go Целия файл

@@ -477,3 +477,28 @@ type GoodInfoNight struct {
477 477
 func (GoodInfoNight) TableName() string {
478 478
 	return "xt_good_information"
479 479
 }
480
+
481
+type ScheduleTwenty struct {
482
+	ID                  int64               `gorm:"column:id" json:"id" form:"id"`
483
+	UserOrgId           int64               `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
484
+	PartitionId         int64               `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
485
+	BedId               int64               `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
486
+	PatientId           int64               `gorm:"column:patient_id" json:"patient_id" form:"patient_id"`
487
+	ScheduleDate        int64               `gorm:"column:schedule_date" json:"schedule_date" form:"schedule_date"`
488
+	ScheduleType        int64               `gorm:"column:schedule_type" json:"schedule_type" form:"schedule_type"`
489
+	ScheduleWeek        int64               `gorm:"column:schedule_week" json:"schedule_week" form:"schedule_week"`
490
+	ModeId              int64               `gorm:"column:mode_id" json:"mode_id" form:"mode_id"`
491
+	Status              int64               `gorm:"column:status" json:"status" form:"status"`
492
+	CreatedTime         int64               `gorm:"column:created_time" json:"created_time" form:"created_time"`
493
+	UpdatedTime         int64               `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
494
+	IsExport            int64               `gorm:"column:is_export" json:"is_export" form:"is_export"`
495
+	Patient             string              `gorm:"-" json:"patient" form:"patient"`
496
+	DeviceZone          DeviceZone          `json:"zone" gorm:"foreignkey:ID;AssociationForeignKey:PartitionId;"`
497
+	DeviceNumber        DeviceNumber        `json:"number" gorm:"foreignkey:ID;AssociationForeignKey:BedId;"`
498
+	TreatmentMode       TreatmentMode       `json:"mode" gorm:"foreignkey:ModeId"`
499
+	DialysisOrderTwenty DialysisOrderTwenty `json:"order" gorm:"foreignkey:DialysisDate,PatientId;AssociationForeignKey:ScheduleDate,PatientId;"`
500
+}
501
+
502
+func (ScheduleTwenty) TableName() string {
503
+	return "ScheduleTwenty"
504
+}

+ 2 - 2
service/doctor_schedule_service.go Целия файл

@@ -588,7 +588,7 @@ func GetAllMobileZone(orgid int64) (zone []*models.DeviceZone, err error) {
588 588
 	return zone, err
589 589
 }
590 590
 
591
-func GetPatientSchedule(startime int64, zoneid int64, classtype int64, orgid int64) (schedule []*models.Schedule, err error) {
591
+func GetPatientSchedule(startime int64, zoneid int64, classtype int64, orgid int64) (schedule []*models.ScheduleTwenty, err error) {
592 592
 
593 593
 	db := XTReadDB().Table("xt_schedule as s")
594 594
 	if zoneid > 0 {
@@ -599,7 +599,7 @@ func GetPatientSchedule(startime int64, zoneid int64, classtype int64, orgid int
599 599
 	}
600 600
 	err = db.Preload("DeviceZone", " status= 1").Preload("DeviceNumber", func(db *gorm.DB) *gorm.DB {
601 601
 		return XTReadDB().Model(&models.DeviceNumber{}).Where("status = 1 AND org_id = ?", orgid).Order("sort asc")
602
-	}).Preload("DialysisOrder", "status =1").Joins("JOIN xt_patients as p ON p.id = s.patient_id and p.lapseto = 1 and p.user_org_id =?", orgid).Where("s.user_org_id = ? and s.schedule_date = ? and s.status =1", orgid, startime).
602
+	}).Preload("DialysisOrderTwenty", "status =1").Joins("JOIN xt_patients as p ON p.id = s.patient_id and p.lapseto = 1 and p.user_org_id =?", orgid).Where("s.user_org_id = ? and s.schedule_date = ? and s.status =1", orgid, startime).
603 603
 		Select("s.id, s.user_org_id, s.partition_id, s.bed_id, s.patient_id, s.schedule_date, s.schedule_type, s.schedule_week, s.mode_id,p.name as patient").Find(&schedule).Error
604 604
 	return schedule, err
605 605
 }

+ 58 - 44
service/mobile_dialysis_service.go Целия файл

@@ -1270,21 +1270,21 @@ func GetMonitor(orgID int64, patientID int64, id int64) (*models.MonitoringRecor
1270 1270
 }
1271 1271
 
1272 1272
 type MScheduleDoctorAdviceVM struct {
1273
-	ID                     int64                            `gorm:"column:id" json:"id"`
1274
-	UserOrgId              int64                            `gorm:"column:user_org_id" json:"user_org_id"`
1275
-	PartitionId            int64                            `gorm:"column:partition_id" json:"partition_id"`
1276
-	BedId                  int64                            `gorm:"column:bed_id" json:"bed_id"`
1277
-	PatientId              int64                            `gorm:"column:patient_id" json:"patient_id"`
1278
-	ScheduleDate           int64                            `gorm:"column:schedule_date" json:"schedule_date"`
1279
-	ScheduleType           int64                            `gorm:"column:schedule_type" json:"schedule_type"`
1280
-	ModeId                 int64                            `gorm:"column:mode_id" json:"mode_id"`
1281
-	Status                 int64                            `gorm:"column:status" json:"status"`
1282
-	DialysisOrder          *MDialysisOrderVM                `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysis_order"`
1283
-	SchedualPatient        *MSchedualPatientVM              `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
1284
-	DeviceNumber           *MDeviceNumberVM                 `gorm:"ForeignKey:BedId" json:"device_number"`
1285
-	DoctorAdvices          []*MDoctorAdviceVM               `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"doctor_advice"`
1286
-	Prescription           *models.DialysisPrescriptionList `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
1287
-	DialysisAssesmentBefor *models.DialysisAssesmentBefor   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysisassesmentbefor"`
1273
+	ID                     int64                              `gorm:"column:id" json:"id"`
1274
+	UserOrgId              int64                              `gorm:"column:user_org_id" json:"user_org_id"`
1275
+	PartitionId            int64                              `gorm:"column:partition_id" json:"partition_id"`
1276
+	BedId                  int64                              `gorm:"column:bed_id" json:"bed_id"`
1277
+	PatientId              int64                              `gorm:"column:patient_id" json:"patient_id"`
1278
+	ScheduleDate           int64                              `gorm:"column:schedule_date" json:"schedule_date"`
1279
+	ScheduleType           int64                              `gorm:"column:schedule_type" json:"schedule_type"`
1280
+	ModeId                 int64                              `gorm:"column:mode_id" json:"mode_id"`
1281
+	Status                 int64                              `gorm:"column:status" json:"status"`
1282
+	DialysisOrder          *MDialysisOrderVM                  `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysis_order"`
1283
+	SchedualPatient        *MSchedualPatientVM                `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
1284
+	DeviceNumber           *MDeviceNumberVM                   `gorm:"ForeignKey:BedId" json:"device_number"`
1285
+	DoctorAdvices          []*MDoctorAdviceVM                 `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"doctor_advice"`
1286
+	Prescription           *models.DialysisPrescriptionTwenty `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
1287
+	DialysisAssesmentBefor *models.DialysisAssesmentBefor     `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysisassesmentbefor"`
1288 1288
 }
1289 1289
 
1290 1290
 func (MScheduleDoctorAdviceVM) TableName() string {
@@ -1292,20 +1292,20 @@ func (MScheduleDoctorAdviceVM) TableName() string {
1292 1292
 }
1293 1293
 
1294 1294
 type MScheduleDoctorAdviceVMOne struct {
1295
-	ID              int64                            `gorm:"column:id" json:"id"`
1296
-	UserOrgId       int64                            `gorm:"column:user_org_id" json:"user_org_id"`
1297
-	PartitionId     int64                            `gorm:"column:partition_id" json:"partition_id"`
1298
-	BedId           int64                            `gorm:"column:bed_id" json:"bed_id"`
1299
-	PatientId       int64                            `gorm:"column:patient_id" json:"patient_id"`
1300
-	ScheduleDate    int64                            `gorm:"column:schedule_date" json:"schedule_date"`
1301
-	ScheduleType    int64                            `gorm:"column:schedule_type" json:"schedule_type"`
1302
-	ModeId          int64                            `gorm:"column:mode_id" json:"mode_id"`
1303
-	Status          int64                            `gorm:"column:status" json:"status"`
1304
-	DialysisOrder   *MDialysisOrderVM                `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysis_order"`
1305
-	SchedualPatient *MSchedualPatientVM              `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
1306
-	DeviceNumber    *MDeviceNumberVM                 `gorm:"ForeignKey:BedId" json:"device_number"`
1307
-	DoctorAdvices   []*MDoctorAdviceVM               `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"doctor_advice"`
1308
-	Prescription    *models.DialysisPrescriptionList `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
1295
+	ID              int64                              `gorm:"column:id" json:"id"`
1296
+	UserOrgId       int64                              `gorm:"column:user_org_id" json:"user_org_id"`
1297
+	PartitionId     int64                              `gorm:"column:partition_id" json:"partition_id"`
1298
+	BedId           int64                              `gorm:"column:bed_id" json:"bed_id"`
1299
+	PatientId       int64                              `gorm:"column:patient_id" json:"patient_id"`
1300
+	ScheduleDate    int64                              `gorm:"column:schedule_date" json:"schedule_date"`
1301
+	ScheduleType    int64                              `gorm:"column:schedule_type" json:"schedule_type"`
1302
+	ModeId          int64                              `gorm:"column:mode_id" json:"mode_id"`
1303
+	Status          int64                              `gorm:"column:status" json:"status"`
1304
+	DialysisOrder   *MDialysisOrderVM                  `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysis_order"`
1305
+	SchedualPatient *MSchedualPatientVM                `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
1306
+	DeviceNumber    *MDeviceNumberVM                   `gorm:"ForeignKey:BedId" json:"device_number"`
1307
+	DoctorAdvices   []*MDoctorAdviceVM                 `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"doctor_advice"`
1308
+	Prescription    *models.DialysisPrescriptionTwenty `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
1309 1309
 	//DialysisAssesmentBefor *models.DialysisAssesmentBefor   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysisassesmentbefor"`
1310 1310
 }
1311 1311
 
@@ -3029,21 +3029,21 @@ func (HisMScheduleDoctorAdviceVMOne) TableName() string {
3029 3029
 }
3030 3030
 
3031 3031
 type HisMScheduleProjectVM struct {
3032
-	ID                         int64                            `gorm:"column:id" json:"id"`
3033
-	UserOrgId                  int64                            `gorm:"column:user_org_id" json:"user_org_id"`
3034
-	PartitionId                int64                            `gorm:"column:partition_id" json:"partition_id"`
3035
-	BedId                      int64                            `gorm:"column:bed_id" json:"bed_id"`
3036
-	PatientId                  int64                            `gorm:"column:patient_id" json:"patient_id"`
3037
-	ScheduleDate               int64                            `gorm:"column:schedule_date" json:"schedule_date"`
3038
-	ScheduleType               int64                            `gorm:"column:schedule_type" json:"schedule_type"`
3039
-	ModeId                     int64                            `gorm:"column:mode_id" json:"mode_id"`
3040
-	Status                     int64                            `gorm:"column:status" json:"status"`
3041
-	DialysisOrder              *MDialysisOrderVM                `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysis_order"`
3042
-	SchedualPatient            *MSchedualPatientVM              `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
3043
-	DeviceNumber               *MDeviceNumberVM                 `gorm:"ForeignKey:BedId" json:"device_number"`
3044
-	Prescription               *models.DialysisPrescriptionList `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
3045
-	HisPrescriptionProject     []*models.HisPrescriptionProject `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"project"`
3046
-	HisPrescriptionTeamProject []*models.HisPrescriptionProject `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"team_project"`
3032
+	ID                         int64                              `gorm:"column:id" json:"id"`
3033
+	UserOrgId                  int64                              `gorm:"column:user_org_id" json:"user_org_id"`
3034
+	PartitionId                int64                              `gorm:"column:partition_id" json:"partition_id"`
3035
+	BedId                      int64                              `gorm:"column:bed_id" json:"bed_id"`
3036
+	PatientId                  int64                              `gorm:"column:patient_id" json:"patient_id"`
3037
+	ScheduleDate               int64                              `gorm:"column:schedule_date" json:"schedule_date"`
3038
+	ScheduleType               int64                              `gorm:"column:schedule_type" json:"schedule_type"`
3039
+	ModeId                     int64                              `gorm:"column:mode_id" json:"mode_id"`
3040
+	Status                     int64                              `gorm:"column:status" json:"status"`
3041
+	DialysisOrder              *MDialysisOrderVM                  `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"dialysis_order"`
3042
+	SchedualPatient            *MSchedualPatientVM                `gorm:"ForeignKey:PatientId;AssociationForeignKey:ID" json:"patient"`
3043
+	DeviceNumber               *MDeviceNumberVM                   `gorm:"ForeignKey:BedId" json:"device_number"`
3044
+	Prescription               *models.DialysisPrescriptionTwenty `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"prescription"`
3045
+	HisPrescriptionProject     []*models.HisPrescriptionProject   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"project"`
3046
+	HisPrescriptionTeamProject []*models.HisPrescriptionProject   `gorm:"ForeignKey:PatientId;AssociationForeignKey:PatientId" json:"team_project"`
3047 3047
 }
3048 3048
 
3049 3049
 func (HisMScheduleProjectVM) TableName() string {
@@ -4062,6 +4062,13 @@ func MobileGetLastDialysisPrescribeByModeIdSeven(orgID int64, patientID int64, m
4062 4062
 	return &record, nil
4063 4063
 }
4064 4064
 
4065
+func MobileGetLastDialysisPrescription(patientID int64, orgID int64) (models.DialysisPrescriptionThrity, error) {
4066
+
4067
+	prescription := models.DialysisPrescriptionThrity{}
4068
+	err := readDb.Model(&prescription).Where("patient_id = ? and user_org_id = ? and status = 1 and remark<>''", patientID, orgID).Last(&prescription).Error
4069
+	return prescription, err
4070
+}
4071
+
4065 4072
 func MobileGetSystemDialysisPrescribeByModeIdSeven(orgID int64, mode_id int64) (*models.SystemPrescription, error) {
4066 4073
 	var record models.SystemPrescription
4067 4074
 	err := readDb.Model(&models.SystemPrescription{}).Where("user_org_id = ? and status = 1  AND mode_id = ?", orgID, mode_id).First(&record).Error
@@ -4128,3 +4135,10 @@ func GetLastDilysisOrder(orgid int64, patient_id int64, dialysis_date int64) (mo
4128 4135
 
4129 4136
 	return order, err
4130 4137
 }
4138
+
4139
+func GetFistMonitor(orgid int64, patient_id int64, dialysis_date int64) (models.MonitoringRecord, error) {
4140
+
4141
+	record := models.MonitoringRecord{}
4142
+	err := XTReadDB().Where("org_id = ? and patient_id = ? and monitoring_date = ? and status = 1", orgid, patient_id, dialysis_date).Find(&record).Error
4143
+	return record, err
4144
+}

+ 8 - 2
service/patient_service.go Целия файл

@@ -2619,7 +2619,7 @@ func GetAllDeviceNumberByListOne(orgID int64) (number []*MDeviceNumberVM, err er
2619 2619
 	}
2620 2620
 }
2621 2621
 
2622
-func GetAllPrescriptionByListOne(orgID int64, scheduleDate int64) (prescriptions []*models.DialysisPrescriptionList, err error) {
2622
+func GetAllPrescriptionByListOne(orgID int64, scheduleDate int64) (prescriptions []*models.DialysisPrescriptionTwenty, err error) {
2623 2623
 
2624 2624
 	redis := RedisClient()
2625 2625
 	defer redis.Close()
@@ -2628,7 +2628,7 @@ func GetAllPrescriptionByListOne(orgID int64, scheduleDate int64) (prescriptions
2628 2628
 	prescriptions_list_all, _ := redis.Get(key).Result()
2629 2629
 
2630 2630
 	if len(prescriptions_list_all) == 0 { //没有到缓存数据,从数据库中获取数据,进行缓存到redis
2631
-		err = readDb.Model(&models.DialysisPrescriptionList{}).Where("status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).Find(&prescriptions).Error
2631
+		err = readDb.Model(&models.DialysisPrescriptionTwenty{}).Where("status = 1 AND user_org_id = ? AND record_date = ?", orgID, scheduleDate).Find(&prescriptions).Error
2632 2632
 		if err != nil {
2633 2633
 			if err == gorm.ErrRecordNotFound {
2634 2634
 				return nil, nil
@@ -2699,3 +2699,9 @@ func GetDialysisSolutionDetailList(orgid int64, patient_id int64, mode_id int64,
2699 2699
 	err = db.Count(&total).Offset(offset).Limit(limit).Find(&solution).Order("created_time desc").Error
2700 2700
 	return solution, total, err
2701 2701
 }
2702
+
2703
+func UpdateDialysisBefor(dislysis models.XtAssessmentBeforeDislysis, id int64) error {
2704
+
2705
+	err := XTWriteDB().Model(&models.XtAssessmentBeforeDislysis{}).Where("id = ? and status= 1", id).Update(map[string]interface{}{"systolic_blood_pressure": dislysis.SystolicBloodPressure, "diastolic_blood_pressure": dislysis.DiastolicBloodPressure}).Error
2706
+	return err
2707
+}

+ 137 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_models.go Целия файл

@@ -757,3 +757,140 @@ type SummerVM struct {
757 757
 func (SummerVM) TableName() string {
758 758
 	return "xt_treatment_summary"
759 759
 }
760
+
761
+type PatientVMOne struct {
762
+	ID                        int64  `gorm:"column:id" json:"id" form:"id"`
763
+	UserOrgId                 int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
764
+	UserId                    int64  `gorm:"column:user_id" json:"user_id" form:"user_id"`
765
+	Avatar                    string `gorm:"column:avatar" json:"avatar" form:"avatar"`
766
+	PatientType               int64  `gorm:"column:patient_type" json:"patient_type" form:"patient_type"`
767
+	DialysisNo                string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
768
+	AdmissionNumber           string `gorm:"column:admission_number" json:"admission_number" form:"admission_number"`
769
+	Source                    int64  `gorm:"column:source" json:"source" form:"source"`
770
+	Lapseto                   int64  `gorm:"column:lapseto" json:"lapseto" form:"lapseto"`
771
+	PartitionId               int64  `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
772
+	BedId                     int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
773
+	Name                      string `gorm:"column:name" json:"name" form:"name"`
774
+	Alias                     string `gorm:"column:alias" json:"alias" form:"alias"`
775
+	Gender                    int64  `gorm:"column:gender" json:"gender" form:"gender"`
776
+	Nation                    string `gorm:"column:nation" json:"nation" form:"nation"`
777
+	NativePlace               string `gorm:"column:native_place" json:"native_place" form:"native_place"`
778
+	IdCardNo                  string `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
779
+	Birthday                  int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
780
+	Height                    int64  `gorm:"column:height" json:"height" form:"height"`
781
+	Rh                        int64  `gorm:"column:rh" json:"rh" form:"rh"`
782
+	HealthCareDueAlertDate    int64  `gorm:"column:health_care_due_alert_date" json:"health_care_due_alert_date" form:"health_care_due_alert_date"`
783
+	Phone                     string `gorm:"column:phone" json:"phone" form:"phone"`
784
+	HomeTelephone             string `gorm:"column:home_telephone" json:"home_telephone" form:"home_telephone"`
785
+	RelativePhone             string `gorm:"column:relative_phone" json:"relative_phone" form:"relative_phone"`
786
+	RelativeRelations         string `gorm:"column:relative_relations" json:"relative_relations" form:"relative_relations"`
787
+	HomeAddress               string `gorm:"column:home_address" json:"home_address" form:"home_address"`
788
+	WorkUnit                  string `gorm:"column:work_unit" json:"work_unit" form:"work_unit"`
789
+	UnitAddress               string `gorm:"column:unit_address" json:"unit_address" form:"unit_address"`
790
+	ReceivingDate             int64  `gorm:"column:receiving_date" json:"receiving_date" form:"receiving_date"`
791
+	IsHospitalFirstDialysis   int64  `gorm:"column:is_hospital_first_dialysis" json:"is_hospital_first_dialysis" form:"is_hospital_first_dialysis"`
792
+	FirstDialysisDate         int64  `gorm:"column:first_dialysis_date" json:"first_dialysis_date" form:"first_dialysis_date"`
793
+	FirstDialysisHospital     string `gorm:"column:first_dialysis_hospital" json:"first_dialysis_hospital" form:"first_dialysis_hospital"`
794
+	PredialysisCondition      string `gorm:"column:predialysis_condition" json:"predialysis_condition" form:"predialysis_condition"`
795
+	HospitalFirstDialysisDate int64  `gorm:"column:hospital_first_dialysis_date" json:"hospital_first_dialysis_date" form:"hospital_first_dialysis_date"`
796
+	TotalDialysis             int64  `gorm:"column:total_dialysis" json:"total_dialysis" form:"total_dialysis"`
797
+	Diagnose                  string `gorm:"column:diagnose" json:"diagnose" form:"diagnose"`
798
+	Remark                    string `gorm:"column:remark" json:"remark" form:"remark"`
799
+	PatientComplains          string `gorm:"column:patient_complains" json:"patient_complains"` // 主诉
800
+	PresentHistory            string `gorm:"column:present_history" json:"present_history"`     // 现病史
801
+	PastHistory               string `gorm:"column:past_history" json:"past_history"`           // 既往史
802
+	Status                    int64  `gorm:"column:status" json:"status" form:"status"`
803
+	Age                       int64  `gorm:"column:age" json:"age"`
804
+	DialysisAge               int64  `gorm:"column:dialysis_age" json:"dialysis_age" form:"dialysis_age"`
805
+	TellPhone                 string `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
806
+	FirstTreatmentDate        int64  `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
807
+	UserSysBeforeCount        int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
808
+}
809
+
810
+func (PatientVMOne) TableName() string {
811
+	return "xt_patients"
812
+}
813
+
814
+type ScheduleVMSix struct {
815
+	ID                       int64                       `gorm:"column:id" json:"id"`
816
+	PatientID                int64                       `gorm:"column:patient_id" json:"patient_id"`
817
+	ScheduleDate             int64                       `gorm:"column:schedule_date" json:"schedule_date"`
818
+	BedID                    int64                       `gorm:"column:bed_id" json:"bed_id"`
819
+	PartitionId              int64                       `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
820
+	Patient                  *PatientVMSix               `gorm:"ForeignKey:PatientID" json:"patient"`
821
+	DialysisOrder            DialysisOrderVM             `gorm:"ForeignKey:DialysisDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"dialysis_order"`
822
+	Prescription             PrescriptionVM              `gorm:"ForeignKey:RecordDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"prescription"`
823
+	ReceiveAssessment        ReceiveAssessmentVM         `gorm:"ForeignKey:RecordDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"receive_assessment"`
824
+	XtReceiveTreatmentAsses  *XtReceiveTreatmentAsses    `gorm:"ForeignKey:RecordDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"xt_receive_assessment"`
825
+	AssessmentBeforeDislysis AssessmentBeforeDislysisVM  `gorm:"ForeignKey:AssessmentDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"assessment_before_dislysis"`
826
+	AssessmentAfterDislysis  AssessmentAfterDislysisVM   `gorm:"ForeignKey:AssessmentDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"assessment_after_dislysis"`
827
+	MonitoringRecords        []*MonitoringRecordVM       `gorm:"ForeignKey:MonitoringDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"monitor_records"`
828
+	DeviceNumber             *DeviceNumberVM             `gorm:"ForeignKey:BedID" json:"device_number"`
829
+	DeviceZone               *DeviceZoneVM               `gorm:"ForeignKey:PartitionId" json:"device_zone"`
830
+	Advices                  []*DoctorAdviceVM           `gorm:"ForeignKey:RecordDate,PatientID;AssociationForeignKey:ScheduleDate,PatientId" json:"advices"`
831
+	DoubleCheck              *DoubleCheckVM              `gorm:"ForeignKey:CheckDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"check"`
832
+	Summer                   *SummerVM                   `gorm:"ForeignKey:AssessmentDate,PatientID;AssociationForeignKey:ScheduleDate,PatientID" json:"summer"`
833
+	LastAfterWeight          XtAssessmentAfterDislysisVM `gorm:"ForeignKey:PatientID;AssociationForeignKey:PatientID" json:"lastafterweight"`
834
+	Count                    int64
835
+}
836
+
837
+func (ScheduleVMSix) TableName() string {
838
+	return "xt_schedule"
839
+}
840
+
841
+type PatientVMSix struct {
842
+	ID                        int64  `gorm:"column:id" json:"id" form:"id"`
843
+	UserOrgId                 int64  `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
844
+	UserId                    int64  `gorm:"column:user_id" json:"user_id" form:"user_id"`
845
+	Avatar                    string `gorm:"column:avatar" json:"avatar" form:"avatar"`
846
+	PatientType               int64  `gorm:"column:patient_type" json:"patient_type" form:"patient_type"`
847
+	DialysisNo                string `gorm:"column:dialysis_no" json:"dialysis_no" form:"dialysis_no"`
848
+	AdmissionNumber           string `gorm:"column:admission_number" json:"admission_number" form:"admission_number"`
849
+	Source                    int64  `gorm:"column:source" json:"source" form:"source"`
850
+	Lapseto                   int64  `gorm:"column:lapseto" json:"lapseto" form:"lapseto"`
851
+	PartitionId               int64  `gorm:"column:partition_id" json:"partition_id" form:"partition_id"`
852
+	BedId                     int64  `gorm:"column:bed_id" json:"bed_id" form:"bed_id"`
853
+	Name                      string `gorm:"column:name" json:"name" form:"name"`
854
+	Alias                     string `gorm:"column:alias" json:"alias" form:"alias"`
855
+	Gender                    int64  `gorm:"column:gender" json:"gender" form:"gender"`
856
+	Nation                    string `gorm:"column:nation" json:"nation" form:"nation"`
857
+	IdCardNo                  string `gorm:"column:id_card_no" json:"id_card_no" form:"id_card_no"`
858
+	Birthday                  int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
859
+	Height                    int64  `gorm:"column:height" json:"height" form:"height"`
860
+	EducationLevel            int64  `gorm:"column:education_level" json:"education_level" form:"education_level"`
861
+	Profession                int64  `gorm:"column:profession" json:"profession" form:"profession"`
862
+	Phone                     string `gorm:"column:phone" json:"phone" form:"phone"`
863
+	HomeTelephone             string `gorm:"column:home_telephone" json:"home_telephone" form:"home_telephone"`
864
+	RelativePhone             string `gorm:"column:relative_phone" json:"relative_phone" form:"relative_phone"`
865
+	RelativeRelations         string `gorm:"column:relative_relations" json:"relative_relations" form:"relative_relations"`
866
+	HomeAddress               string `gorm:"column:home_address" json:"home_address" form:"home_address"`
867
+	WorkUnit                  string `gorm:"column:work_unit" json:"work_unit" form:"work_unit"`
868
+	UnitAddress               string `gorm:"column:unit_address" json:"unit_address" form:"unit_address"`
869
+	Children                  int64  `gorm:"column:children" json:"children" form:"children"`
870
+	IsHospitalFirstDialysis   int64  `gorm:"column:is_hospital_first_dialysis" json:"is_hospital_first_dialysis" form:"is_hospital_first_dialysis"`
871
+	FirstDialysisDate         int64  `gorm:"column:first_dialysis_date" json:"first_dialysis_date" form:"first_dialysis_date"`
872
+	FirstDialysisHospital     string `gorm:"column:first_dialysis_hospital" json:"first_dialysis_hospital" form:"first_dialysis_hospital"`
873
+	PredialysisCondition      string `gorm:"column:predialysis_condition" json:"predialysis_condition" form:"predialysis_condition"`
874
+	HospitalFirstDialysisDate int64  `gorm:"column:hospital_first_dialysis_date" json:"hospital_first_dialysis_date" form:"hospital_first_dialysis_date"`
875
+	TotalDialysis             int64  `gorm:"column:total_dialysis" json:"total_dialysis" form:"total_dialysis"`
876
+	Evaluate                  string `gorm:"column:evaluate" json:"evaluate" form:"evaluate"`
877
+	Diagnose                  string `gorm:"column:diagnose" json:"diagnose" form:"diagnose"`
878
+	Remark                    string `gorm:"column:remark" json:"remark" form:"remark"`
879
+	RegistrarsId              int64  `gorm:"column:registrars_id" json:"registrars_id" form:"registrars_id"`
880
+	Registrars                string `gorm:"column:registrars" json:"registrars" form:"registrars"`
881
+	PatientComplains          string `gorm:"column:patient_complains" json:"patient_complains"` // 主诉
882
+	PresentHistory            string `gorm:"column:present_history" json:"present_history"`     // 现病史
883
+	PastHistory               string `gorm:"column:past_history" json:"past_history"`           // 既往史
884
+	Status                    int64  `gorm:"column:status" json:"status" form:"status"`
885
+	CreatedTime               int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
886
+	UpdatedTime               int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
887
+	Age                       int64  `gorm:"column:age" json:"age"`
888
+	DialysisAge               int64  `gorm:"column:dialysis_age" json:"dialysis_age" form:"dialysis_age"`
889
+	TellPhone                 string `gorm:"column:tell_phone" json:"tell_phone" form:"tell_phone"`
890
+	FirstTreatmentDate        int64  `gorm:"column:first_treatment_date" json:"first_treatment_date" form:"first_treatment_date"`
891
+	UserSysBeforeCount        int64  `gorm:"column:user_sys_before_count" json:"user_sys_before_count" form:"user_sys_before_count"`
892
+}
893
+
894
+func (PatientVMSix) TableName() string {
895
+	return "xt_patients"
896
+}

+ 44 - 0
service/print_data_service/schedule_dialysis/print_schedule_dialysis_service.go Целия файл

@@ -321,3 +321,47 @@ func GetWarehouseCancelPrintList(orgid int64, startime int64, endtime int64) (ca
321 321
 	err = db.Select("x.ctime,x.good_id,sum(x.count) as count,t.good_name,t.specification_name,t.packing_unit,t.retail_price,t.packing_price").Joins("left join xt_good_information as t on t.id = x.good_id").Group("x.good_id").Scan(&cancel).Error
322 322
 	return cancel, err
323 323
 }
324
+
325
+func GetSchedulesSix(orgID int64, schIDs []string) ([]*ScheduleVMSix, error) {
326
+	recordDateStr := time.Now().Format("2006-01-02")
327
+	recordDate, _ := utils.ParseTimeStringToTime("2006-01-02", recordDateStr)
328
+	var schedules []*ScheduleVMSix
329
+	db := p_service.XTReadDB()
330
+	err := db.Model(&ScheduleVMSix{}).
331
+		Preload("Patient", "user_org_id = ? AND status = 1", orgID).
332
+		Preload("DialysisOrder", func(db *gorm.DB) *gorm.DB {
333
+			return db.Where("user_org_id = ? AND status = 1", orgID).Preload("DeviceNumber", "org_id = ? AND status = 1", orgID)
334
+		}).
335
+		Preload("Prescription", "user_org_id = ? AND status = 1", orgID).
336
+		Preload("ReceiveAssessment", "user_org_id = ? AND status = 1", orgID).
337
+		Preload("XtReceiveTreatmentAsses", "user_org_id = ? AND status = 1", orgID).
338
+		Preload("AssessmentBeforeDislysis", func(db *gorm.DB) *gorm.DB {
339
+			return db.Where("user_org_id = ? AND status = 1", orgID)
340
+		}).
341
+		Preload("AssessmentAfterDislysis", "user_org_id = ? AND status = 1", orgID).
342
+		Preload("LastAfterWeight", func(db *gorm.DB) *gorm.DB {
343
+			return db.Where("user_org_id = ? and status = 1 and assessment_date < ?", orgID, recordDate.Unix())
344
+		}).Preload("MonitoringRecords", func(db *gorm.DB) *gorm.DB {
345
+		return db.Where("user_org_id = ? AND status = 1", orgID).
346
+			Order("operate_time asc")
347
+	}).
348
+		Preload("DeviceNumber", "org_id = ?", orgID).
349
+		Preload("DeviceZone", "org_id = ?", orgID).
350
+		Preload("DoubleCheck", "user_org_id = ? AND status = 1", orgID).
351
+		Preload("Summer", "user_org_id = ? AND status = 1", orgID).
352
+		Preload("Advices", func(db *gorm.DB) *gorm.DB {
353
+			return db.Select("id, user_org_id, patient_id, advice_type, advice_date, record_date, start_time, drug_spec_unit,advice_name,advice_desc, reminder_date, drug_spec, drug_spec_unit, single_dose, single_dose_unit, prescribing_number, prescribing_number_unit, delivery_way, execution_frequency, advice_doctor, status, created_time,updated_time, advice_affirm, remark, stop_time, stop_reason, stop_doctor, stop_state, parent_id, execution_time, execution_staff, execution_state, checker, check_state, check_time, groupno, IF(parent_id > 0, parent_id, id) as advice_order").
354
+				Where("user_org_id = ? AND advice_type = 2 AND status = 1", orgID).
355
+				Order("start_time asc, groupno desc, advice_order desc, id asc")
356
+		}).Where("user_org_id = ? AND status = 1 AND id in (?)", orgID, schIDs).Order("schedule_date asc").
357
+		Find(&schedules).
358
+		Error
359
+	if err != nil {
360
+		return nil, err
361
+	}
362
+	for _, item := range schedules {
363
+		dialysis_count, _ := GetDialysisOrderCount(orgID, item.PatientID, item.ScheduleDate)
364
+		item.Patient.TotalDialysis = dialysis_count
365
+	}
366
+	return schedules, nil
367
+}