|
@@ -1336,6 +1336,19 @@ func GetDialysisSolution(orgID int64, patientID int64, mode_id int64) (*models.D
|
1336
|
1336
|
return &record, nil
|
1337
|
1337
|
}
|
1338
|
1338
|
|
|
1339
|
+func GetDialysisSolutionOne(orgID int64, mode_id int64) (*models.DialysisSolution, error) {
|
|
1340
|
+ var record models.DialysisSolution
|
|
1341
|
+ err := readDb.Model(&models.DialysisSolution{}).Where("user_org_id = ? and status = 1 AND mode_id = ?", orgID, mode_id).Last(&record).Error
|
|
1342
|
+ if err != nil {
|
|
1343
|
+ if err == gorm.ErrRecordNotFound {
|
|
1344
|
+ return nil, nil
|
|
1345
|
+ } else {
|
|
1346
|
+ return nil, err
|
|
1347
|
+ }
|
|
1348
|
+ }
|
|
1349
|
+ return &record, nil
|
|
1350
|
+}
|
|
1351
|
+
|
1339
|
1352
|
func GetLastDialysisPrescribeByModeId(orgID int64, patientID int64, mode_id int64) (*models.DialysisPrescription, error) {
|
1340
|
1353
|
var record models.DialysisPrescription
|
1341
|
1354
|
err := readDb.Model(&models.DialysisPrescription{}).Where("patient_id = ? and user_org_id = ? and status = 1 AND mode_id = ?", patientID, orgID, mode_id).Last(&record).Error
|
|
@@ -1950,9 +1963,25 @@ func BatchDeleteMonitor(ids []string) (err error) {
|
1950
|
1963
|
return
|
1951
|
1964
|
}
|
1952
|
1965
|
|
1953
|
|
-func GetPatientDialysisRecordList(patientid int64, startime int64, endtime int64) (order []*models.XtDialysisOrder, err error) {
|
|
1966
|
+func GetPatientDialysisRecordList(patientid int64, startime int64, endtime int64) (order []*models.XtDialysisOrders, err error) {
|
|
1967
|
+
|
|
1968
|
+ //err = XTReadDB().Where("patient_id = ? and dialysis_date>=? and dialysis_date<=? and status = 1", patientid, startime, endtime).Find(&order).Error
|
|
1969
|
+ //return order, err
|
|
1970
|
+
|
|
1971
|
+ db := XTReadDB().Table("xt_dialysis_order as x").Where("x.status = 1")
|
|
1972
|
+ table := XTReadDB().Table("xt_schedule as s")
|
|
1973
|
+ fmt.Println(table)
|
|
1974
|
+ if patientid > 0 {
|
|
1975
|
+ db = db.Where("x.patient_id")
|
|
1976
|
+ }
|
|
1977
|
+ if startime > 0 {
|
|
1978
|
+ db = db.Where("x.dialysis_date>=?", startime)
|
|
1979
|
+ }
|
|
1980
|
+ if endtime > 0 {
|
|
1981
|
+ db = db.Where("x.dialysis_date <= ?", endtime)
|
|
1982
|
+ }
|
1954
|
1983
|
|
1955
|
|
- err = XTReadDB().Where("patient_id = ? and dialysis_date>=? and dialysis_date<=? and status = 1", patientid, startime, endtime).Find(&order).Error
|
|
1984
|
+ err = db.Select("x.id,x.dialysis_date,x.schedual_type,s.mode_id").Joins("left join x.patient_id = s.patient_id and x.dialysis_date = s.schedule_date ").Scan(&order).Error
|
1956
|
1985
|
return order, err
|
1957
|
1986
|
}
|
1958
|
1987
|
|