Browse Source

提交代码

陈少旭 1 year ago
parent
commit
a3fd5a5c1a
1 changed files with 3 additions and 3 deletions
  1. 3 3
      service/patientmanage_service.go

+ 3 - 3
service/patientmanage_service.go View File

@@ -1967,7 +1967,7 @@ type InspectionCount struct {
1967 1967
 
1968 1968
 func GetNormalInspectionTotalByID(startime int64, endtime int64, orgid int64, projectid int64, item_id int64, max_value float64, min_value float64) (total int64, err error) {
1969 1969
 	var count []*InspectionCount
1970
-	err2 := XTReadDB().Table("xt_inspection as xti ").Select("count(*) as count").Joins("join (SELECT max(inspect_date) as ind, patient_id as pid  FROM xt_inspection as x Join xt_patients pp on pp.id = x.patient_id and pp.lapseto = 1  WHERE (x.status = 1) AND (x.org_id = ? and x.reference_project_id = ? and x.reference_item_id = ?  and x.inspect_date >= ? and x.inspect_date <= ?) group by patient_id) as ta on ta.ind = xti.`inspect_date` and xti.patient_id = ta.pid  WHERE (xti.status = 1) AND (xti.org_id = ? and xti.reference_project_id = ? and xti.reference_item_id = ?  and xti.inspect_date >= ? and xti.inspect_date<= ? and xti.`inspect_value` < ? and xti.inspect_value > ? ) Group by xti.patient_id", orgid, projectid, item_id, startime, endtime, orgid, projectid, item_id, startime, endtime, max_value, min_value).Scan(&count).Error
1970
+	err2 := XTReadDB().Table("xt_inspection as xti ").Select("count(*) as count").Joins("join (SELECT max(inspect_date) as ind, patient_id as pid  FROM xt_inspection as x Join xt_patients pp on pp.id = x.patient_id and pp.lapseto = 1  WHERE (x.status = 1) AND (x.org_id = ? and x.reference_project_id = ? and x.reference_item_id = ?  and x.inspect_date >= ? and x.inspect_date <= ?) group by patient_id) as ta on ta.ind = xti.`inspect_date` and xti.patient_id = ta.pid  WHERE (xti.status = 1) AND (xti.org_id = ? and xti.reference_project_id = ? and xti.reference_item_id = ?  and xti.inspect_date >= ? and xti.inspect_date<= ? and xti.`inspect_value` <= ? and xti.inspect_value >= ? ) Group by xti.patient_id", orgid, projectid, item_id, startime, endtime, orgid, projectid, item_id, startime, endtime, max_value, min_value).Scan(&count).Error
1971 1971
 	for _, items := range count {
1972 1972
 		total = total + items.Count
1973 1973
 	}
@@ -2082,7 +2082,7 @@ func GetNormalInspectionPatientList(startime int64, endtime int64, orgid int64,
2082 2082
 	} else {
2083 2083
 		db = db.Select("xti.patient_id as patient_id,FROM_UNIXTIME(xti.inspect_date,'%Y-%m-%d') as date,xti.inspect_value as inspect_value,pp.name as name, pp.dialysis_no as dialysis_no").Joins("join xt_patients pp On pp.id = xti.patient_id and pp.status = 1 and pp.lapseto = 1")
2084 2084
 	}
2085
-	err2 := db.Joins("join (SELECT max(inspect_date) as ind, patient_id as pid  FROM xt_inspection as x  WHERE (x.status = 1) AND (x.org_id = ? and x.reference_project_id = ? and x.reference_item_id = ?  and x.inspect_date >= ? and x.inspect_date <= ?) group by patient_id) as ta on ta.ind = xti.`inspect_date` and xti.patient_id = ta.pid  WHERE (xti.status = 1) AND (xti.org_id = ? and xti.reference_project_id = ? and xti.reference_item_id = ?  and xti.inspect_date >= ? and xti.inspect_date<= ? and xti.`inspect_value` < ? and xti.inspect_value > ? ) Group by xti.patient_id", orgid, projectid, item_id, startime, endtime, orgid, projectid, item_id, startime, endtime, max_value, min_value).Scan(&xti).Error
2085
+	err2 := db.Joins("join (SELECT max(inspect_date) as ind, patient_id as pid  FROM xt_inspection as x  WHERE (x.status = 1) AND (x.org_id = ? and x.reference_project_id = ? and x.reference_item_id = ?  and x.inspect_date >= ? and x.inspect_date <= ?) group by patient_id) as ta on ta.ind = xti.`inspect_date` and xti.patient_id = ta.pid  WHERE (xti.status = 1) AND (xti.org_id = ? and xti.reference_project_id = ? and xti.reference_item_id = ?  and xti.inspect_date >= ? and xti.inspect_date<= ? and xti.`inspect_value` <= ? and xti.inspect_value >= ? ) Group by xti.patient_id", orgid, projectid, item_id, startime, endtime, orgid, projectid, item_id, startime, endtime, max_value, min_value).Scan(&xti).Error
2086 2086
 	return xti, err2
2087 2087
 }
2088 2088
 func GetUnusualInspectionPatientList(startime int64, endtime int64, orgid int64, projectid int64, item_id int64, max_value float64, min_value float64, keyword string) (xti []*models.Inspection, err error) {
@@ -2136,7 +2136,7 @@ func GetNormalKTVORURRInspectionPatientList(startime int64, endtime int64, orgid
2136 2136
 	} else {
2137 2137
 		db = db.Select("xti.patient_id as patient_id,FROM_UNIXTIME(xti.inspect_date,'%Y-%m-%d') as date,xti.inspect_value as inspect_value,pp.name as name, pp.dialysis_no as dialysis_no").Joins("join xt_patients pp On pp.id = xti.patient_id and pp.status = 1 and pp.lapseto = 1")
2138 2138
 	}
2139
-	err2 := db.Joins("join (SELECT max(inspect_date) as ind, patient_id as pid  FROM xt_inspection as x  WHERE (x.status = 1) AND (x.org_id = ? and x.project_id = ? and x.item_id = ?  and x.inspect_date >= ? and x.inspect_date <= ?) group by patient_id) as ta on ta.ind = xti.`inspect_date` and xti.patient_id = ta.pid  WHERE (xti.status = 1) AND (xti.org_id = ? and xti.project_id = ? and xti.item_id = ?  and xti.inspect_date >= ? and xti.inspect_date<= ? and xti.inspect_value >= ? ) Group by xti.patient_id", orgid, projectid, item_id, startime, endtime, orgid, projectid, item_id, startime, endtime, min_value).Scan(&xti).Error
2139
+	err2 := db.Joins("join (SELECT max(inspect_date) as ind, patient_id as pid  FROM xt_inspection as x  WHERE (x.status = 1) AND (x.org_id = ? and x.project_id = ? and x.item_id = ?  and x.inspect_date >= ? and x.inspect_date <= ?) group by patient_id) as ta on ta.ind = xti.`inspect_date` and xti.patient_id = ta.pid  WHERE (xti.status = 1) AND (xti.org_id = ? and xti.project_id = ? and xti.item_id = ?  and xti.inspect_date >= ? and xti.inspect_date <= ? and xti.inspect_value >= ? ) Group by xti.patient_id", orgid, projectid, item_id, startime, endtime, orgid, projectid, item_id, startime, endtime, min_value).Scan(&xti).Error
2140 2140
 	return xti, err2
2141 2141
 }
2142 2142