浏览代码

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

XMLWAN 4 年前
父节点
当前提交
7461812c21
共有 1 个文件被更改,包括 56 次插入69 次删除
  1. 56 69
      service/statistics_service/index_evaluation_service.go

+ 56 - 69
service/statistics_service/index_evaluation_service.go 查看文件

@@ -183,123 +183,123 @@ func GetDialysisWatchChartData(user_org_id int64, patient_id int64, start_time i
183 183
 	switch statistics_type {
184 184
 	case 1:
185 185
 		if patient_id == 0 {
186
-			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
186
+			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
187 187
 
188 188
 		} else {
189
-			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
189
+			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
190 190
 		}
191 191
 		break
192 192
 	case 2:
193 193
 
194 194
 		if patient_id == 0 {
195 195
 
196
-			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
196
+			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
197 197
 
198 198
 		} else {
199 199
 
200
-			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
200
+			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
201 201
 
202 202
 		}
203 203
 
204 204
 		break
205 205
 	case 3:
206 206
 		if patient_id == 0 {
207
-			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
207
+			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
208 208
 
209 209
 		} else {
210 210
 
211
-			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
211
+			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
212 212
 
213 213
 		}
214 214
 		break
215 215
 	case 4:
216 216
 		if patient_id == 0 {
217
-			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
217
+			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
218 218
 
219 219
 		} else {
220 220
 
221
-			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
221
+			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
222 222
 
223 223
 		}
224 224
 		break
225 225
 	case 5:
226 226
 		if patient_id == 0 {
227 227
 
228
-			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
228
+			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
229 229
 
230 230
 		} else {
231
-			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
231
+			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
232 232
 
233 233
 		}
234 234
 		break
235 235
 	case 6:
236 236
 		if patient_id == 0 {
237
-			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
237
+			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
238 238
 
239 239
 		} else {
240
-			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
240
+			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
241 241
 
242 242
 		}
243 243
 		break
244 244
 	case 7:
245 245
 		if patient_id == 0 {
246 246
 
247
-			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
247
+			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
248 248
 
249 249
 		} else {
250 250
 
251
-			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
251
+			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
252 252
 
253 253
 		}
254 254
 		break
255 255
 	case 8:
256 256
 		if patient_id == 0 {
257
-			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
257
+			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
258 258
 
259 259
 		} else {
260
-			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
260
+			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
261 261
 		}
262 262
 		break
263 263
 	case 9:
264 264
 		if patient_id == 0 {
265
-			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
265
+			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
266 266
 
267 267
 		} else {
268 268
 
269
-			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
269
+			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
270 270
 
271 271
 		}
272 272
 
273 273
 		break
274 274
 	case 10:
275 275
 		if patient_id == 0 {
276
-			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
276
+			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
277 277
 
278 278
 		} else {
279 279
 
280
-			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
280
+			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
281 281
 
282 282
 		}
283 283
 
284 284
 		break
285 285
 	case 11:
286 286
 		if patient_id == 0 {
287
-			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
287
+			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
288 288
 
289 289
 		} else {
290 290
 
291
-			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
291
+			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
292 292
 
293 293
 		}
294 294
 
295 295
 		break
296 296
 	case 12:
297 297
 		if patient_id == 0 {
298
-			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
298
+			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
299 299
 
300 300
 		} else {
301 301
 
302
-			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
302
+			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
303 303
 
304 304
 		}
305 305
 
@@ -1121,10 +1121,10 @@ func GetBloodPressureTableData(orgID, patientID int64, page, limit, start, end i
1121 1121
 	db = db.Preload("VMPredialysisEvaluation", "status = 1 AND user_org_id = ?", orgID).
1122 1122
 		Preload("VMAssessmentAfterDislysis", "status = 1 AND user_org_id = ?", orgID).
1123 1123
 		Preload("VMMinMonitoringRecord", func(db *gorm.DB) *gorm.DB {
1124
-			return db.Where("status = 1 AND user_org_id = ?", orgID).Order("diastolic_blood_pressure DESC")
1124
+			return db.Where("status = 1 AND user_org_id = ?", orgID).Order("diastolic_blood_pressure ASC")
1125 1125
 		}).
1126 1126
 		Preload("VMMaxMonitoringRecord", func(db *gorm.DB) *gorm.DB {
1127
-			return db.Where("status = 1 AND user_org_id = ?", orgID).Order("systolic_blood_pressure ASC")
1127
+			return db.Where("status = 1 AND user_org_id = ?", orgID).Order("systolic_blood_pressure DESC")
1128 1128
 		}).
1129 1129
 		Preload("VMPatients", "status = 1 AND user_org_id = ?", orgID)
1130 1130
 	err = db.Count(&total).Offset(offset).Limit(limit).Order("sch.schedule_date desc").Select(" sch.schedule_date,sch.patient_id,sch.user_org_id").Find(&orders).Error
@@ -1185,11 +1185,11 @@ func GetDoctorWorkloadChartData(user_org_id int64, start_time int64, end_time in
1185 1185
 		break
1186 1186
 	case 2:
1187 1187
 		var Total int64
1188
-		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)
1188
+		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)
1189 1189
 
1190 1190
 		for _, item := range datas {
1191 1191
 			var total int64
1192
-			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)
1192
+			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)
1193 1193
 			item.CourseCount = total
1194 1194
 
1195 1195
 			if math.IsNaN(float64(item.CourseCount) / float64(Total)) {
@@ -1205,11 +1205,11 @@ func GetDoctorWorkloadChartData(user_org_id int64, start_time int64, end_time in
1205 1205
 	case 3:
1206 1206
 		var Total int64
1207 1207
 
1208
-		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)
1208
+		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)
1209 1209
 
1210 1210
 		for _, item := range datas {
1211 1211
 			var total int64
1212
-			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)
1212
+			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)
1213 1213
 			item.RescueCount = total
1214 1214
 
1215 1215
 			if math.IsNaN(float64(item.RescueCount) / float64(Total)) {
@@ -1243,8 +1243,8 @@ func GetDoctorWorkloadTableData(user_org_id int64, start_time int64, end_time in
1243 1243
 		var TotalOne int64
1244 1244
 		var TotalTwo int64
1245 1245
 		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)
1246
-		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)
1247
-		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)
1246
+		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)
1247
+		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)
1248 1248
 		item.PCount = Total
1249 1249
 		item.CourseCount = TotalOne
1250 1250
 		item.RescueCount = TotalTwo
@@ -1261,25 +1261,25 @@ func GetNurseWorkloadChartData(user_org_id int64, start_time int64, end_time int
1261 1261
 	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)
1262 1262
 
1263 1263
 	var NewTotalOne int64
1264
-	var NewTotalTwo int64
1265 1264
 	var NewTotalThree int64
1266 1265
 	var NewTotalFour int64
1267 1266
 
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)
1267
+	//var tempConfig models.Dataconfig
1268
+	//db.Model(&models.Dataconfig{}).Where("name = '血管通路' AND module = 'hemodialysis' AND field_name = 'vascular_access_desc' AND parent_id = 0").First(&tempConfig)
1269
+
1270
+	//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)
1271
+	//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)
1270 1272
 
1271
-	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)
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)
1273
+	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)
1273 1274
 	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)
1274
-	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)
1275
+	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)
1275 1276
 
1276 1277
 	switch statistics_type {
1277
-	case 1:
1278
+	case 2:
1278 1279
 		for _, item := range datas {
1279 1280
 			var Total int64
1280
-			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)
1281
+			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)
1281 1282
 			item.PunctureCount = Total
1282
-
1283 1283
 			if math.IsNaN(float64(item.PunctureCount) / float64(NewTotalOne)) {
1284 1284
 				item.PunctureRatio = "0.0"
1285 1285
 			} else {
@@ -1289,26 +1289,11 @@ func GetNurseWorkloadChartData(user_org_id int64, start_time int64, end_time int
1289 1289
 
1290 1290
 		}
1291 1291
 		break
1292
-	case 2:
1292
+	case 1:
1293 1293
 		for _, item := range datas {
1294 1294
 			var Total int64
1295
-			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)
1296
-			item.ChangemedicineCount = Total
1297
-
1298
-			if math.IsNaN(float64(item.ChangemedicineCount) / float64(NewTotalTwo)) {
1299
-				item.ChangemedicineRatio = "0.0"
1300
-			} else {
1301
-				float_value, _ := strconv.ParseFloat(fmt.Sprintf("%.1f", (float64(item.ChangemedicineCount)/float64(NewTotalTwo))*100), 64)
1302
-				item.ChangemedicineRatio = strconv.FormatFloat(float_value, 'f', 1, 32)
1303
-			}
1304
-		}
1305
-
1306
-		break
1307
-	case 3:
1308
-		for _, item := range datas {
1309
-			var total int64
1310
-			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)
1311
-			item.CureCount = total
1295
+			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)
1296
+			item.CureCount = Total
1312 1297
 			if math.IsNaN(float64(item.CureCount) / float64(NewTotalThree)) {
1313 1298
 				item.CureRatio = "0.0"
1314 1299
 			} else {
@@ -1319,10 +1304,10 @@ func GetNurseWorkloadChartData(user_org_id int64, start_time int64, end_time int
1319 1304
 		}
1320 1305
 		break
1321 1306
 
1322
-	case 4:
1307
+	case 3:
1323 1308
 		for _, item := range datas {
1324 1309
 			var Total int64
1325
-			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)
1310
+			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)
1326 1311
 			item.MissionCount = Total
1327 1312
 			if math.IsNaN(float64(item.MissionCount) / float64(NewTotalFour)) {
1328 1313
 				item.MissionRatio = "0.0"
@@ -1332,6 +1317,7 @@ func GetNurseWorkloadChartData(user_org_id int64, start_time int64, end_time int
1332 1317
 			}
1333 1318
 		}
1334 1319
 		break
1320
+
1335 1321
 	}
1336 1322
 
1337 1323
 	if err != nil {
@@ -1343,10 +1329,10 @@ func GetNurseWorkloadChartData(user_org_id int64, start_time int64, end_time int
1343 1329
 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) {
1344 1330
 	userDb := service.UserReadDB()
1345 1331
 	db := service.XTReadDB()
1346
-	var tempConfig models.Dataconfig
1332
+	//var tempConfig models.Dataconfig
1347 1333
 	offset := (page - 1) * limit
1348 1334
 
1349
-	db.Model(&models.Dataconfig{}).Where("name = '血管通路' AND module = 'hemodialysis' AND field_name = 'vascular_access_desc' AND parent_id = 0").First(&tempConfig)
1335
+	//db.Model(&models.Dataconfig{}).Where("name = '血管通路' AND module = 'hemodialysis' AND field_name = 'vascular_access_desc' AND parent_id = 0").First(&tempConfig)
1350 1336
 
1351 1337
 	if admin_user_id == 0 {
1352 1338
 		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)
@@ -1356,18 +1342,16 @@ func GetNurseWorkloadTableData(user_org_id int64, start_time int64, end_time int
1356 1342
 
1357 1343
 	for _, item := range datas {
1358 1344
 		var Total int64
1359
-		var TotalOne int64
1360 1345
 		var TotalTwo int64
1361 1346
 		var TotalThree int64
1362
-		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)
1363
-		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)
1347
+		//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)
1348
+		//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)
1364 1349
 		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)
1365
-		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)
1350
+		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)
1351
+		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)
1366 1352
 		item.PunctureCount = Total
1367
-		item.ChangemedicineCount = TotalOne
1368 1353
 		item.CureCount = TotalTwo
1369 1354
 		item.MissionCount = TotalThree
1370
-
1371 1355
 	}
1372 1356
 
1373 1357
 	if err != nil {
@@ -1680,12 +1664,15 @@ func GetPatientInspectionBarChartData(user_org_id int64, start_time int64, end_t
1680 1664
 		var isHasConditionThree bool = false
1681 1665
 
1682 1666
 		for _, item := range items {
1667
+
1683 1668
 			if item.Name == "大于"+range_value_arr[1] {
1684 1669
 				isHasConditionOne = true
1685 1670
 			}
1671
+
1686 1672
 			if item.Name == "小于"+range_value_arr[0] {
1687 1673
 				isHasConditionTwo = true
1688 1674
 			}
1675
+
1689 1676
 			if item.Name == range_value_arr[0]+"~"+range_value_arr[1] {
1690 1677
 				isHasConditionThree = true
1691 1678
 			}