Browse Source

Merge branch 'xt_statistics_branch'

csx 4 years ago
parent
commit
ec0fb852dd
1 changed files with 54 additions and 67 deletions
  1. 54 67
      service/statistics_service/index_evaluation_service.go

+ 54 - 67
service/statistics_service/index_evaluation_service.go View File

@@ -184,123 +184,123 @@ func GetDialysisWatchChartData(user_org_id int64, patient_id int64, start_time i
184 184
 	switch statistics_type {
185 185
 	case 1:
186 186
 		if patient_id == 0 {
187
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.systolic_blood_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? AND systolic_blood_pressure <> 0 Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
187
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.systolic_blood_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? AND systolic_blood_pressure <> 0 Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
188 188
 
189 189
 		} else {
190
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.systolic_blood_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND  operate_time <= ? AND  operate_time >= ? AND systolic_blood_pressure <> 0 Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
190
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.systolic_blood_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND  operate_time <= ? AND  operate_time >= ? AND systolic_blood_pressure <> 0 Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
191 191
 		}
192 192
 		break
193 193
 	case 2:
194 194
 
195 195
 		if patient_id == 0 {
196 196
 
197
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.diastolic_blood_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? AND diastolic_blood_pressure <> 0 Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
197
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.diastolic_blood_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? AND diastolic_blood_pressure <> 0 Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
198 198
 
199 199
 		} else {
200 200
 
201
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.diastolic_blood_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND  operate_time <= ? AND  operate_time >= ? AND diastolic_blood_pressure <> 0 Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
201
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.diastolic_blood_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND  operate_time <= ? AND  operate_time >= ? AND diastolic_blood_pressure <> 0 Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
202 202
 
203 203
 		}
204 204
 
205 205
 		break
206 206
 	case 3:
207 207
 		if patient_id == 0 {
208
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.pulse_frequency as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
208
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.pulse_frequency as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
209 209
 
210 210
 		} else {
211 211
 
212
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.pulse_frequency as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
212
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.pulse_frequency as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
213 213
 
214 214
 		}
215 215
 		break
216 216
 	case 4:
217 217
 		if patient_id == 0 {
218
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.breathing_rate as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
218
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.breathing_rate as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
219 219
 
220 220
 		} else {
221 221
 
222
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.breathing_rate as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
222
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.breathing_rate as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
223 223
 
224 224
 		}
225 225
 		break
226 226
 	case 5:
227 227
 		if patient_id == 0 {
228 228
 
229
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.temperature as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
229
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.temperature as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
230 230
 
231 231
 		} else {
232
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.temperature as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND operate_time <= ? AND  operate_time >= ?Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
232
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.temperature as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND operate_time <= ? AND  operate_time >= ?Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
233 233
 
234 234
 		}
235 235
 		break
236 236
 	case 6:
237 237
 		if patient_id == 0 {
238
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.blood_flow_volume as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND    operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
238
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.blood_flow_volume as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND    operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
239 239
 
240 240
 		} else {
241
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.blood_flow_volume as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
241
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.blood_flow_volume as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
242 242
 
243 243
 		}
244 244
 		break
245 245
 	case 7:
246 246
 		if patient_id == 0 {
247 247
 
248
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.venous_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
248
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.venous_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
249 249
 
250 250
 		} else {
251 251
 
252
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.venous_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
252
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.venous_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
253 253
 
254 254
 		}
255 255
 		break
256 256
 	case 8:
257 257
 		if patient_id == 0 {
258
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.arterial_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ?  AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
258
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.arterial_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ?  AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
259 259
 
260 260
 		} else {
261
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.arterial_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
261
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.arterial_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
262 262
 		}
263 263
 		break
264 264
 	case 9:
265 265
 		if patient_id == 0 {
266
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.transmembrane_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
266
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.transmembrane_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
267 267
 
268 268
 		} else {
269 269
 
270
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.transmembrane_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ?  AND operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
270
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.transmembrane_pressure as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ?  AND operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
271 271
 
272 272
 		}
273 273
 
274 274
 		break
275 275
 	case 10:
276 276
 		if patient_id == 0 {
277
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.dialysate_temperature as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by  operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
277
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.dialysate_temperature as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by  operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
278 278
 
279 279
 		} else {
280 280
 
281
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.dialysate_temperature as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ?  AND operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
281
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.dialysate_temperature as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ?  AND operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
282 282
 
283 283
 		}
284 284
 
285 285
 		break
286 286
 	case 11:
287 287
 		if patient_id == 0 {
288
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.ultrafiltration_rate as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
288
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.ultrafiltration_rate as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
289 289
 
290 290
 		} else {
291 291
 
292
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.ultrafiltration_rate as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ?  AND operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
292
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.ultrafiltration_rate as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ?  AND operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
293 293
 
294 294
 		}
295 295
 
296 296
 		break
297 297
 	case 12:
298 298
 		if patient_id == 0 {
299
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.ultrafiltration_volume as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
299
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.ultrafiltration_volume as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND  operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, end_time, start_time).Scan(&datas).Error
300 300
 
301 301
 		} else {
302 302
 
303
-			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d %H:%i') as date, monitor.ultrafiltration_volume as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ?  AND operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
303
+			err = db.Raw("select from_unixtime(monitor.operate_time,'%Y-%m-%d') as date, monitor.ultrafiltration_volume as value from xt_monitoring_record as monitor Where status = 1 AND user_org_id = ? AND patient_id = ?  AND operate_time <= ? AND  operate_time >= ? Order by operate_time asc", user_org_id, patient_id, end_time, start_time).Scan(&datas).Error
304 304
 
305 305
 		}
306 306
 
@@ -1186,11 +1186,11 @@ func GetDoctorWorkloadChartData(user_org_id int64, start_time int64, end_time in
1186 1186
 		break
1187 1187
 	case 2:
1188 1188
 		var Total int64
1189
-		db.Table("xt_patient_course_of_disease as course").Where("org_id = ? AND status = 1 AND ctime >= ? AND ctime <= ?", user_org_id, start_time, end_time).Count(&Total)
1189
+		db.Table("xt_patient_course_of_disease as course").Where("org_id = ? AND status = 1 AND record_time >= ? AND record_time <= ?", user_org_id, start_time, end_time).Count(&Total)
1190 1190
 
1191 1191
 		for _, item := range datas {
1192 1192
 			var total int64
1193
-			db.Table("xt_patient_course_of_disease as course").Where("org_id = ? AND status = 1 AND recorder = ? AND ctime >= ? AND ctime <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&total)
1193
+			db.Table("xt_patient_course_of_disease as course").Where("org_id = ? AND status = 1 AND recorder = ? AND record_time >= ? AND record_time <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&total)
1194 1194
 			item.CourseCount = total
1195 1195
 
1196 1196
 			if math.IsNaN(float64(item.CourseCount) / float64(Total)) {
@@ -1206,11 +1206,11 @@ func GetDoctorWorkloadChartData(user_org_id int64, start_time int64, end_time in
1206 1206
 	case 3:
1207 1207
 		var Total int64
1208 1208
 
1209
-		db.Table("xt_patient_rescue_record as rescue").Where("org_id = ? AND status = 1  AND ctime >= ? AND ctime <= ?", user_org_id, start_time, end_time).Count(&Total)
1209
+		db.Table("xt_patient_rescue_record as rescue").Where("org_id = ? AND status = 1  AND record_time >= ? AND record_time <= ?", user_org_id, start_time, end_time).Count(&Total)
1210 1210
 
1211 1211
 		for _, item := range datas {
1212 1212
 			var total int64
1213
-			db.Table("xt_patient_rescue_record as rescue").Where("org_id = ? AND status = 1 AND recorder = ?  AND ctime >= ? AND ctime <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&total)
1213
+			db.Table("xt_patient_rescue_record as rescue").Where("org_id = ? AND status = 1 AND recorder = ?  AND record_time >= ? AND record_time <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&total)
1214 1214
 			item.RescueCount = total
1215 1215
 
1216 1216
 			if math.IsNaN(float64(item.RescueCount) / float64(Total)) {
@@ -1244,8 +1244,8 @@ func GetDoctorWorkloadTableData(user_org_id int64, start_time int64, end_time in
1244 1244
 		var TotalOne int64
1245 1245
 		var TotalTwo int64
1246 1246
 		db.Table("xt_dialysis_prescription as p").Where("user_org_id = ? AND status = 1 AND prescription_doctor = ?  AND record_date >= ? AND  record_date <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
1247
-		db.Table("xt_patient_course_of_disease as course").Where("org_id = ? AND status = 1 AND recorder = ? AND ctime >= ? AND ctime <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalOne)
1248
-		db.Table("xt_patient_rescue_record as rescue").Where("org_id = ? AND status = 1 AND recorder = ? AND ctime >= ? AND ctime <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalTwo)
1247
+		db.Table("xt_patient_course_of_disease as course").Where("org_id = ? AND status = 1 AND recorder = ? AND record_time >= ? AND record_time <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalOne)
1248
+		db.Table("xt_patient_rescue_record as rescue").Where("org_id = ? AND status = 1 AND recorder = ? AND record_time >= ? AND record_time <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalTwo)
1249 1249
 		item.PCount = Total
1250 1250
 		item.CourseCount = TotalOne
1251 1251
 		item.RescueCount = TotalTwo
@@ -1262,25 +1262,25 @@ func GetNurseWorkloadChartData(user_org_id int64, start_time int64, end_time int
1262 1262
 	userDb.Raw("select admin_user_id, user_name,org_id  from sgj_user_admin_role  Where status = 1 AND org_id = ?  AND user_type = 3 ", user_org_id).Scan(&datas)
1263 1263
 
1264 1264
 	var NewTotalOne int64
1265
-	var NewTotalTwo int64
1266 1265
 	var NewTotalThree int64
1267 1266
 	var NewTotalFour int64
1268 1267
 
1269
-	var tempConfig models.Dataconfig
1270
-	db.Model(&models.Dataconfig{}).Where("name = '血管通路' AND module = 'hemodialysis' AND field_name = 'vascular_access_desc' AND parent_id = 0").First(&tempConfig)
1268
+	//var tempConfig models.Dataconfig
1269
+	//db.Model(&models.Dataconfig{}).Where("name = '血管通路' AND module = 'hemodialysis' AND field_name = 'vascular_access_desc' AND parent_id = 0").First(&tempConfig)
1270
+
1271
+	//db.Raw("select count(*) as total from xt_dialysis_order where status = 1 AND dialysis_date >= ? AND dialysis_date <= ? AND user_org_id = ?",start_time,end_time,user_org_id).Count(&NewTotalOne)
1272
+	//db.Raw("select count(*) as total_one from  (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from  xt_assessment_before_dislysis as d  JOIN `xt_data_config` config on  d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('导管',config.name) > 0  Where d.user_org_id = ? AND d.assessment_date >=? AND d.assessment_date <= ?  Group by d.id)  b JOIN `xt_dialysis_order`  on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1  AND xt_dialysis_order.dialysis_date >= ? AND xt_dialysis_order.dialysis_date <= ? ", user_org_id, tempConfig.ID, user_org_id, start_time, end_time, user_org_id, start_time, end_time).Count(&NewTotalTwo)
1271 1273
 
1272
-	db.Raw("select count(*) as total from  (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from  xt_assessment_before_dislysis as d  JOIN `xt_data_config` config on  d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('内瘘',config.name) > 0 Where d.user_org_id = ? AND d.assessment_date >=? AND d.assessment_date <= ?  Group by d.id)  b JOIN `xt_dialysis_order`  on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1   AND xt_dialysis_order.dialysis_date >= ? AND xt_dialysis_order.dialysis_date <= ? ", user_org_id, tempConfig.ID, user_org_id, start_time, end_time, user_org_id, start_time, end_time).Count(&NewTotalOne)
1273
-	db.Raw("select count(*) as total_one from  (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from  xt_assessment_before_dislysis as d  JOIN `xt_data_config` config on  d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('导管',config.name) > 0  Where d.user_org_id = ? AND d.assessment_date >=? AND d.assessment_date <= ?  Group by d.id)  b JOIN `xt_dialysis_order`  on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1  AND xt_dialysis_order.dialysis_date >= ? AND xt_dialysis_order.dialysis_date <= ? ", user_org_id, tempConfig.ID, user_org_id, start_time, end_time, user_org_id, start_time, end_time).Count(&NewTotalTwo)
1274
+	db.Table("xt_dialysis_order ").Where("user_org_id = ? AND status = 1  AND dialysis_date >= ? AND dialysis_date <= ?", user_org_id, start_time, end_time).Count(&NewTotalOne)
1274 1275
 	db.Table("xt_monitoring_record ").Where("user_org_id = ? AND status = 1  AND operate_time >= ? AND operate_time <= ?", user_org_id, start_time, end_time).Count(&NewTotalThree)
1275
-	db.Table("xt_treatment_summary").Where("user_org_id = ? AND status = 1  AND created_time >= ? AND created_time <= ?", user_org_id, start_time, end_time).Count(&NewTotalFour)
1276
+	db.Table("xt_treatment_summary").Where("user_org_id = ? AND status = 1  AND assessment_date >= ? AND assessment_date <= ?", user_org_id, start_time, end_time).Count(&NewTotalFour)
1276 1277
 
1277 1278
 	switch statistics_type {
1278
-	case 1:
1279
+	case 2:
1279 1280
 		for _, item := range datas {
1280 1281
 			var Total int64
1281
-			db.Raw("select count(*) as total from  (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from  xt_assessment_before_dislysis as d  JOIN `xt_data_config` config on  d.`blood_access_part_opera_id` = config.value AND (config.org_id = ? OR config.org_id = 0)  AND config.parent_id = ? AND  FIND_IN_SET('内瘘',config.name) > 0 Where d.user_org_id = ? AND d.assessment_date >=? AND d.assessment_date <= ?   Group by d.id)  b JOIN `xt_dialysis_order`  on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1  AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.dialysis_date >= ? AND xt_dialysis_order.dialysis_date <= ? ", user_org_id, tempConfig.ID, user_org_id, start_time, end_time, user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
1282
+			db.Table("xt_dialysis_order ").Where("user_org_id = ? AND status = 1  AND dialysis_date >= ? AND dialysis_date <= ? AND puncture_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&Total)
1282 1283
 			item.PunctureCount = Total
1283
-
1284 1284
 			if math.IsNaN(float64(item.PunctureCount) / float64(NewTotalOne)) {
1285 1285
 				item.PunctureRatio = "0.0"
1286 1286
 			} else {
@@ -1290,26 +1290,11 @@ func GetNurseWorkloadChartData(user_org_id int64, start_time int64, end_time int
1290 1290
 
1291 1291
 		}
1292 1292
 		break
1293
-	case 2:
1293
+	case 1:
1294 1294
 		for _, item := range datas {
1295 1295
 			var Total int64
1296
-			db.Raw("select count(*) as total from  (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from  xt_assessment_before_dislysis as d  JOIN `xt_data_config` config on  d.`blood_access_part_opera_id` = config.value AND  (config.org_id = ? OR config.org_id = 0) AND config.parent_id = ? AND FIND_IN_SET('导管',config.name) > 0 Where d.user_org_id = ?  AND d.assessment_date >=? AND d.assessment_date <= ? Group by d.id)  b JOIN `xt_dialysis_order`  on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1  AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.dialysis_date >= ? AND xt_dialysis_order.dialysis_date <= ? ", user_org_id, tempConfig.ID, user_org_id, start_time, end_time, user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
1297
-			item.ChangemedicineCount = Total
1298
-
1299
-			if math.IsNaN(float64(item.ChangemedicineCount) / float64(NewTotalTwo)) {
1300
-				item.ChangemedicineRatio = "0.0"
1301
-			} else {
1302
-				float_value, _ := strconv.ParseFloat(fmt.Sprintf("%.1f", (float64(item.ChangemedicineCount)/float64(NewTotalTwo))*100), 64)
1303
-				item.ChangemedicineRatio = strconv.FormatFloat(float_value, 'f', 1, 32)
1304
-			}
1305
-		}
1306
-
1307
-		break
1308
-	case 3:
1309
-		for _, item := range datas {
1310
-			var total int64
1311
-			db.Table("xt_monitoring_record").Where("user_org_id = ? AND status = 1 AND monitoring_nurse = ?  AND operate_time >= ? AND operate_time <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&total)
1312
-			item.CureCount = total
1296
+			db.Table("xt_monitoring_record").Where("user_org_id = ? AND status = 1 AND monitoring_nurse = ?  AND operate_time >= ? AND operate_time <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
1297
+			item.CureCount = Total
1313 1298
 			if math.IsNaN(float64(item.CureCount) / float64(NewTotalThree)) {
1314 1299
 				item.CureRatio = "0.0"
1315 1300
 			} else {
@@ -1320,10 +1305,10 @@ func GetNurseWorkloadChartData(user_org_id int64, start_time int64, end_time int
1320 1305
 		}
1321 1306
 		break
1322 1307
 
1323
-	case 4:
1308
+	case 3:
1324 1309
 		for _, item := range datas {
1325 1310
 			var Total int64
1326
-			db.Table("xt_treatment_summary ").Where("user_org_id = ? AND status = 1 AND creater = ?  AND created_time >= ? AND created_time <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
1311
+			db.Table("xt_treatment_summary ").Where("user_org_id = ? AND status = 1 AND creater = ?  AND assessment_date >= ? AND assessment_date <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
1327 1312
 			item.MissionCount = Total
1328 1313
 			if math.IsNaN(float64(item.MissionCount) / float64(NewTotalFour)) {
1329 1314
 				item.MissionRatio = "0.0"
@@ -1333,6 +1318,7 @@ func GetNurseWorkloadChartData(user_org_id int64, start_time int64, end_time int
1333 1318
 			}
1334 1319
 		}
1335 1320
 		break
1321
+
1336 1322
 	}
1337 1323
 
1338 1324
 	if err != nil {
@@ -1344,10 +1330,10 @@ func GetNurseWorkloadChartData(user_org_id int64, start_time int64, end_time int
1344 1330
 func GetNurseWorkloadTableData(user_org_id int64, start_time int64, end_time int64, admin_user_id int64, page int64, limit int64) (datas []*VMUserAdminRole, AdminTotal int64, err error) {
1345 1331
 	userDb := service.UserReadDB()
1346 1332
 	db := service.XTReadDB()
1347
-	var tempConfig models.Dataconfig
1333
+	//var tempConfig models.Dataconfig
1348 1334
 	offset := (page - 1) * limit
1349 1335
 
1350
-	db.Model(&models.Dataconfig{}).Where("name = '血管通路' AND module = 'hemodialysis' AND field_name = 'vascular_access_desc' AND parent_id = 0").First(&tempConfig)
1336
+	//db.Model(&models.Dataconfig{}).Where("name = '血管通路' AND module = 'hemodialysis' AND field_name = 'vascular_access_desc' AND parent_id = 0").First(&tempConfig)
1351 1337
 
1352 1338
 	if admin_user_id == 0 {
1353 1339
 		userDb.Raw("select admin_user_id, user_name,org_id  from sgj_user_admin_role  Where status = 1 AND org_id = ?  AND user_type = 3 ", user_org_id).Offset(offset).Limit(limit).Scan(&datas)
@@ -1357,18 +1343,16 @@ func GetNurseWorkloadTableData(user_org_id int64, start_time int64, end_time int
1357 1343
 
1358 1344
 	for _, item := range datas {
1359 1345
 		var Total int64
1360
-		var TotalOne int64
1361 1346
 		var TotalTwo int64
1362 1347
 		var TotalThree int64
1363
-		db.Raw("select count(*) as total from  (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from  xt_assessment_before_dislysis as d  JOIN `xt_data_config` config on  d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('内瘘',config.name) > 0 Where d.user_org_id = ? AND d.assessment_date >=? AND d.assessment_date <= ?  Group by d.id)  b JOIN `xt_dialysis_order`  on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1  AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.dialysis_date >= ? AND xt_dialysis_order.dialysis_date <= ? ", user_org_id, tempConfig.ID, user_org_id, start_time, end_time, user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
1364
-		db.Raw("select count(*) as total_one from  (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from  xt_assessment_before_dislysis as d  JOIN `xt_data_config` config on  d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('导管',config.name) > 0 Where  d.user_org_id = ?  AND d.assessment_date >=? AND d.assessment_date <= ?  Group by d.id)  b JOIN `xt_dialysis_order`  on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1  AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.dialysis_date >= ? AND xt_dialysis_order.dialysis_date <= ? ", user_org_id, tempConfig.ID, user_org_id, start_time, end_time, user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalOne)
1348
+		//db.Raw("select count(*) as total from  (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from  xt_assessment_before_dislysis as d  JOIN `xt_data_config` config on  d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('内瘘',config.name) > 0 Where d.user_org_id = ? AND d.assessment_date >=? AND d.assessment_date <= ?  Group by d.id)  b JOIN `xt_dialysis_order`  on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1  AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.dialysis_date >= ? AND xt_dialysis_order.dialysis_date <= ? ", user_org_id, tempConfig.ID, user_org_id, start_time, end_time, user_org_id, item.AdminUserId, start_time, end_time).Count(&Total)
1349
+		//db.Raw("select count(*) as total_one from  (select d.patient_id as patient, d.id, d.`assessment_date` as date,config.name as name from  xt_assessment_before_dislysis as d  JOIN `xt_data_config` config on  d.`blood_access_part_opera_id` = config.value AND config.org_id = ? AND config.parent_id = ? AND FIND_IN_SET('导管',config.name) > 0 Where  d.user_org_id = ?  AND d.assessment_date >=? AND d.assessment_date <= ?  Group by d.id)  b JOIN `xt_dialysis_order`  on xt_dialysis_order.`dialysis_date` = b.date AND xt_dialysis_order.user_org_id = ? AND xt_dialysis_order.status = 1  AND xt_dialysis_order.start_nurse = ? AND xt_dialysis_order.dialysis_date >= ? AND xt_dialysis_order.dialysis_date <= ? ", user_org_id, tempConfig.ID, user_org_id, start_time, end_time, user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalOne)
1365 1350
 		db.Table("xt_monitoring_record ").Where("user_org_id = ? AND status = 1 AND monitoring_nurse = ? AND operate_time >= ? AND operate_time <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalTwo)
1366
-		db.Table("xt_treatment_summary").Where("user_org_id = ? AND status = 1 AND creater = ? AND created_time >= ? AND created_time <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalThree)
1351
+		db.Table("xt_dialysis_order ").Where("user_org_id = ? AND status = 1  AND dialysis_date >= ? AND dialysis_date <= ? AND puncture_nurse = ?", user_org_id, start_time, end_time, item.AdminUserId).Count(&Total)
1352
+		db.Table("xt_treatment_summary").Where("user_org_id = ? AND status = 1 AND creater = ? AND assessment_date >= ? AND assessment_date <= ?", user_org_id, item.AdminUserId, start_time, end_time).Count(&TotalThree)
1367 1353
 		item.PunctureCount = Total
1368
-		item.ChangemedicineCount = TotalOne
1369 1354
 		item.CureCount = TotalTwo
1370 1355
 		item.MissionCount = TotalThree
1371
-
1372 1356
 	}
1373 1357
 
1374 1358
 	if err != nil {
@@ -1681,12 +1665,15 @@ func GetPatientInspectionBarChartData(user_org_id int64, start_time int64, end_t
1681 1665
 		var isHasConditionThree bool = false
1682 1666
 
1683 1667
 		for _, item := range items {
1668
+
1684 1669
 			if item.Name == "大于"+range_value_arr[1] {
1685 1670
 				isHasConditionOne = true
1686 1671
 			}
1672
+
1687 1673
 			if item.Name == "小于"+range_value_arr[0] {
1688 1674
 				isHasConditionTwo = true
1689 1675
 			}
1676
+
1690 1677
 			if item.Name == range_value_arr[0]+"~"+range_value_arr[1] {
1691 1678
 				isHasConditionThree = true
1692 1679
 			}