|
@@ -23,7 +23,7 @@ func GetNewDialysiTotal(startime int64, endtime int64, orgid int64, origin int64
|
23
|
23
|
var err error
|
24
|
24
|
if origin == 1 { //透析记录,上机为准
|
25
|
25
|
db := XTReadDB().Table("xt_dialysis_order as x").Joins("join xt_dialysis_prescription p on p.patient_id = x.patient_id and p.record_date = x.dialysis_date")
|
26
|
|
- err = db.Select("count(x.id) as count").Where("x.dialysis_date >= ? and x.dialysis_date<=? and x.user_org_id = ? AND x.status = 1", startime, endtime, orgid).Scan(&counts).Error
|
|
26
|
+ err = db.Select("count(x.id) as count").Where("x.dialysis_date >= ? and x.dialysis_date<=? and x.user_org_id = ? AND x.status = 1 and x.stage = 2", startime, endtime, orgid).Scan(&counts).Error
|
27
|
27
|
return counts.Count, err
|
28
|
28
|
|
29
|
29
|
} else {
|
|
@@ -493,6 +493,7 @@ func GetNewDialysisCountModeTwo(starttime int64, endtime int64, orgid int64, ori
|
493
|
493
|
if orgid > 0 {
|
494
|
494
|
db = db.Where("o.user_org_id = ?", orgid)
|
495
|
495
|
}
|
|
496
|
+ db = db.Where("o.stage = 2")
|
496
|
497
|
|
497
|
498
|
err = db.Select("s.mode_id,count(s.mode_id) as count").Joins("join xt_dialysis_prescription as s on s.patient_id = o.patient_id and s.record_date = o.dialysis_date and s.status= 1 AND DATE_FORMAT(FROM_UNIXTIME(s.record_date), '%Y-%m-%d %H:%i:%s') >= ? AND DATE_FORMAT(FROM_UNIXTIME(s.record_date), '%Y-%m-%d %H:%i:%s') <= ? AND s.mode_id = ? ", startDate, endDate, mode_id).Group("s.mode_id").Scan(&counts).Error
|
498
|
499
|
return counts, err
|