|
@@ -987,13 +987,10 @@ func GetQuarterTotalCount(orgid int64, startime int64, endtime int64, lapseto in
|
987
|
987
|
db = db.Where("x.inspect_date <=?", endtime)
|
988
|
988
|
}
|
989
|
989
|
if lapseto > 0 {
|
990
|
|
- fmt.Println("11111")
|
991
|
|
- db = db.Joins("join xt_patients as p On p.id = x.patient_id AND p.lapseto = ?", lapseto)
|
|
990
|
+ db = db.Joins("inner join xt_patients as p On p.id = x.patient_id AND p.lapseto = ?", lapseto)
|
992
|
991
|
}
|
993
|
992
|
if origin > 0 {
|
994
|
|
- fmt.Println("22222")
|
995
|
|
-
|
996
|
|
- db = db.Joins("join xt_patients as p On p.id = x.patient_id AND p.source = ?", origin)
|
|
993
|
+ db = db.Joins("inner join xt_patients as p On p.id = x.patient_id AND p.source = ?", origin)
|
997
|
994
|
}
|
998
|
995
|
err = db.Group("x.item_id").Select("sum(case when x.inspect_date >=? and x.inspect_date<=? then 1 else 0 end) as total,sum(case when x.inspect_value+0>=q.min_range+0 and x.inspect_value +0 <= q.large_range+0 and x.inspect_date >=? and x.inspect_date <=? then 1 else 0 end) as count,x.item_id,q.sort", startime, endtime, startime, endtime).Joins("left join xt_inspection_reference as r on ( r.item_id = x.item_id AND r.org_id > 0) OR ( x.item_id = r.id AND r.org_id = 0 ) ").Joins("left join xt_quality_control_standard as q on q.inspection_minor = x.item_id").Scan(&inspection).Error
|
999
|
996
|
return inspection, err
|
|
@@ -1014,17 +1011,11 @@ func GetQuarterTotalCountTwo(orgid int64, startime int64, endtime int64, lapseto
|
1014
|
1011
|
}
|
1015
|
1012
|
|
1016
|
1013
|
if lapseto > 0 {
|
1017
|
|
- db = db.Joins("join xt_patients as p On p.id = x.patient_id AND p.lapseto = ?", lapseto)
|
|
1014
|
+ db = db.Joins("inner join xt_patients as p On p.id = x.patient_id AND p.lapseto = ?", lapseto)
|
1018
|
1015
|
}
|
1019
|
1016
|
if origin > 0 {
|
1020
|
|
- db = db.Joins("join xt_patients as p On p.id = x.patient_id AND p.source = ?", origin)
|
|
1017
|
+ db = db.Joins("inner join xt_patients as p On p.id = x.patient_id AND p.source = ?", origin)
|
1021
|
1018
|
}
|
1022
|
|
- //if lapseto == 0 {
|
1023
|
|
- // db = db.Where("s.lapseto = 1 or s.lapseto = 2")
|
1024
|
|
- //}
|
1025
|
|
- //if lapseto > 0 {
|
1026
|
|
- // db = db.Where("s.lapseto = ?", lapseto)
|
1027
|
|
- //}
|
1028
|
1019
|
err = db.Group("x.item_id").Select("sum(case when x.inspect_date >=? and x.inspect_date<=? then 1 else 0 end) as total,sum(case when q.range_value = x.inspect_value and x.inspect_date >=? and x.inspect_date <=? then 1 else 0 end) as count,x.item_id,q.sort", startime, endtime, startime, endtime).Joins("left join xt_inspection_reference as r on ( r.item_id = x.item_id AND r.org_id > 0) OR ( x.item_id = r.id AND r.org_id = 0 ) ").Joins("left join xt_quality_control_standard as q on q.inspection_minor = x.item_id").Scan(&inspection).Error
|
1029
|
1020
|
return inspection, err
|
1030
|
1021
|
}
|
|
@@ -2852,10 +2843,10 @@ func GetSystolicBloodPressureTwo(orgid int64, startime int64, endtime int64, lap
|
2852
|
2843
|
|
2853
|
2844
|
db := XTReadDB().Table("xt_monitoring_record as x")
|
2854
|
2845
|
if lapseto > 0 {
|
2855
|
|
- db = db.Joins("join xt_patients as p on p.id = x.patient_id AND p.lapseto = ?", lapseto)
|
|
2846
|
+ db = db.Joins("inner join xt_patients as p on p.id = x.patient_id AND p.lapseto = ?", lapseto)
|
2856
|
2847
|
}
|
2857
|
2848
|
if origin > 0 {
|
2858
|
|
- db = db.Joins("join xt_patients as p on p.id = x.patient_id AND p.source = ?", origin)
|
|
2849
|
+ db = db.Joins("inner join xt_patients as p on p.id = x.patient_id AND p.source = ?", origin)
|
2859
|
2850
|
}
|
2860
|
2851
|
err = db.Select("x.id,x.systolic_blood_pressure").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and x.systolic_blood_pressure <> 0", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Count(&total).Scan(&record).Error
|
2861
|
2852
|
return record, total, err
|
|
@@ -2878,10 +2869,10 @@ func GetDiastolicBloodPressure(orgid int64, startime int64, endtime int64) (reco
|
2878
|
2869
|
func GetDiastolicBloodPressureTwo(orgid int64, startime int64, endtime int64, lapseto int64, origin int64) (record []*models.VmMonitoringRecord, total int64, err error) {
|
2879
|
2870
|
db := XTReadDB().Table("xt_monitoring_record as x")
|
2880
|
2871
|
if lapseto > 0 {
|
2881
|
|
- db = db.Joins("join xt_patients as p on p.id = x.patient_id AND p.lapseto = ?", lapseto)
|
|
2872
|
+ db = db.Joins("inner join xt_patients as p on p.id = x.patient_id AND p.lapseto = ?", lapseto)
|
2882
|
2873
|
}
|
2883
|
2874
|
if origin > 0 {
|
2884
|
|
- db = db.Joins("join xt_patients as p on p.id = x.patient_id AND p.source = ?", origin)
|
|
2875
|
+ db = db.Joins("inner join xt_patients as p on p.id = x.patient_id AND p.source = ?", origin)
|
2885
|
2876
|
}
|
2886
|
2877
|
err = db.Select("x.id,x.diastolic_blood_pressure").Where("x.user_org_id = ? and x.monitoring_date >=? and x.monitoring_date<=? and x.status = 1 and x.diastolic_blood_pressure <> 0", orgid, startime, endtime).Group("x.monitoring_date,x.patient_id").Count(&total).Scan(&record).Error
|
2887
|
2878
|
return record, total, err
|