|
@@ -313,7 +313,7 @@ func GetDialysisList(startime int64, endtime int64, page int64, limit int64, org
|
313
|
313
|
db = db.Where("o.dialysis_date<=?", endtime)
|
314
|
314
|
}
|
315
|
315
|
offset := (page - 1) * limit
|
316
|
|
- err = db.Group("s.patient_id,s.mode_id").Select("s.mode_id,o.patient_id,p.name,p.id_card_no,p.dialysis_no,p.total_dialysis,p.user_sys_before_count").Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Joins("left join xt_patients as p on p.id = o.patient_id").Where("s.schedule_date = o.dialysis_date ").Count(&total).Offset(offset).Limit(limit).Scan(&order).Error
|
|
316
|
+ err = db.Group("s.patient_id,s.mode_id").Select("s.mode_id,o.patient_id,p.name,p.id_card_no,p.dialysis_no,p.total_dialysis,p.user_sys_before_count").Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Joins("left join xt_patients as p on p.id = o.patient_id").Where("s.schedule_date = o.dialysis_date and s.status = 1").Count(&total).Offset(offset).Limit(limit).Scan(&order).Error
|
317
|
317
|
return order, total, err
|
318
|
318
|
|
319
|
319
|
}
|
|
@@ -334,7 +334,7 @@ func GetAllDialysisList(startime int64, endtime int64, orgid int64) (order []*mo
|
334
|
334
|
if endtime > 0 {
|
335
|
335
|
db = db.Where("o.dialysis_date<=?", endtime)
|
336
|
336
|
}
|
337
|
|
- err = db.Group("s.patient_id,s.mode_id").Select("s.mode_id,s.patient_id,p.name,p.id_card_no,p.dialysis_no,p.total_dialysis,p.user_sys_before_count").Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Joins("left join xt_patients as p on p.id = o.patient_id").Where("s.schedule_date = o.dialysis_date ").Scan(&order).Error
|
|
337
|
+ err = db.Group("s.patient_id,s.mode_id").Select("s.mode_id,s.patient_id,p.name,p.id_card_no,p.dialysis_no,p.total_dialysis,p.user_sys_before_count").Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Joins("left join xt_patients as p on p.id = o.patient_id").Where("s.schedule_date = o.dialysis_date and s.status = 1 ").Scan(&order).Error
|
338
|
338
|
return order, err
|
339
|
339
|
}
|
340
|
340
|
|
|
@@ -355,7 +355,7 @@ func GetDialysisPatientList(startime int64, endtime int64, page int64, limit int
|
355
|
355
|
db = db.Where("o.dialysis_date<=?", endtime)
|
356
|
356
|
}
|
357
|
357
|
offset := (page - 1) * limit
|
358
|
|
- err = db.Group("s.patient_id").Select("s.mode_id,o.patient_id,p.name,p.id_card_no,p.dialysis_no,p.total_dialysis,p.user_sys_before_count").Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Joins("left join xt_patients as p on p.id = o.patient_id").Where("s.schedule_date = o.dialysis_date ").Count(&total).Offset(offset).Limit(limit).Scan(&order).Error
|
|
358
|
+ err = db.Group("s.patient_id").Select("s.mode_id,o.patient_id,p.name,p.id_card_no,p.dialysis_no,p.total_dialysis,p.user_sys_before_count").Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Joins("left join xt_patients as p on p.id = o.patient_id").Where("s.schedule_date = o.dialysis_date and s.status =1 ").Count(&total).Offset(offset).Limit(limit).Scan(&order).Error
|
359
|
359
|
return order, total, err
|
360
|
360
|
}
|
361
|
361
|
|
|
@@ -445,7 +445,7 @@ func GetTreateInfo(orgID int64, startime int64, endtime int64, lapseto int64, li
|
445
|
445
|
db = db.Where("p.lapseto = ?", lapseto)
|
446
|
446
|
}
|
447
|
447
|
offset := (page - 1) * limit
|
448
|
|
- err = db.Group("o.dialysis_date").Select(sql).Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Joins("left join xt_patients as p on p.id = o.patient_id").Where("s.schedule_date = o.dialysis_date").Count(&total).Offset(offset).Limit(limit).Scan(&blood).Error
|
|
448
|
+ err = db.Group("o.dialysis_date").Select(sql).Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Joins("left join xt_patients as p on p.id = o.patient_id").Where("s.schedule_date = o.dialysis_date and s.status =1").Count(&total).Offset(offset).Limit(limit).Scan(&blood).Error
|
449
|
449
|
return blood, total, err
|
450
|
450
|
|
451
|
451
|
}
|
|
@@ -470,7 +470,7 @@ func GetTreatList(orgid int64, startime int64, endtime int64, lapseto int64) (tt
|
470
|
470
|
if lapseto > 0 {
|
471
|
471
|
db = db.Where("p.lapseto = ?", lapseto)
|
472
|
472
|
}
|
473
|
|
- err = db.Select("s.mode_id, count(s.mode_id) as number").Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Joins("left join xt_patients as p on p.id = o.patient_id").Where("s.schedule_date = o.dialysis_date").Group("s.mode_id").Order("s.mode_id asc").Find(&ttd).Error
|
|
473
|
+ err = db.Select("s.mode_id, count(s.mode_id) as number").Joins("left join xt_schedule as s on s.patient_id = o.patient_id").Joins("left join xt_patients as p on p.id = o.patient_id").Where("s.schedule_date = o.dialysis_date and s.status = 1").Group("s.mode_id").Order("s.mode_id asc").Find(&ttd).Error
|
474
|
474
|
return ttd, err
|
475
|
475
|
}
|
476
|
476
|
|
|
@@ -479,7 +479,7 @@ func GetStatistics(orgID int64, startime int64, endtime int64, modeID int64) (dt
|
479
|
479
|
sql := "s.mode_id,from_unixtime(o.dialysis_date, '%Y%m%d') as date, count(o.dialysis_date) as number"
|
480
|
480
|
datesql := " o.dialysis_date as date"
|
481
|
481
|
group := "from_unixtime(o.dialysis_date, '%Y%m%d')"
|
482
|
|
- db = db.Table(" xt_dialysis_order AS o").Joins("left join xt_schedule as s on o.patient_id = s.patient_id").Where("s.schedule_date = o.dialysis_date")
|
|
482
|
+ db = db.Table(" xt_dialysis_order AS o").Joins("left join xt_schedule as s on o.patient_id = s.patient_id").Where("s.schedule_date = o.dialysis_date and s.status =1")
|
483
|
483
|
if orgID > 0 {
|
484
|
484
|
db = db.Where("o.user_org_id = ?", orgID)
|
485
|
485
|
}
|