|
@@ -48,7 +48,7 @@ func GetSmartSchPatientByPatientID(orgID int64, id int64) (sch []*models.SmartSc
|
48
|
48
|
|
49
|
49
|
for _, item := range sch {
|
50
|
50
|
var order models.SmSchDialysisOrder
|
51
|
|
- readDb.Model(&models.SmSchDialysisOrder{}).Where("user_org_id = ? AND status = 1 AND patient_id = ? AND dialysis_date = ? AND bed_id = ?", orgID, item.PatientId, item.ScheduleDate, item.BedId).First(&order)
|
|
51
|
+ readDb.Model(&models.SmSchDialysisOrder{}).Where("user_org_id = ? AND status = 1 AND patient_id = ? AND dialysis_date = ? ", orgID, item.PatientId, item.ScheduleDate).First(&order)
|
52
|
52
|
item.SmSchDialysisOrder = order
|
53
|
53
|
}
|
54
|
54
|
|
|
@@ -98,13 +98,14 @@ func GetSmartSchPatientByID(orgID int64, patient_id int64) (schs []*models.Smart
|
98
|
98
|
offset = -6
|
99
|
99
|
}
|
100
|
100
|
weekStart := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).AddDate(0, 0, offset)
|
|
101
|
+
|
101
|
102
|
err = readDb.Model(&models.SmartSchedule{}).Where("user_org_id = ? AND status = 1 AND patient_id = ? AND schedule_date >= ?", orgID, patient_id, weekStart.Unix()).
|
102
|
103
|
Preload("DeviceZone", "status = 1").
|
103
|
104
|
Preload("DeviceNumber", "status = 1").Find(&schs).Error
|
104
|
105
|
|
105
|
106
|
for _, item := range schs {
|
106
|
107
|
var order models.SmSchDialysisOrder
|
107
|
|
- readDb.Model(&models.SmSchDialysisOrder{}).Where("user_org_id = ? AND status = 1 AND patient_id = ? AND dialysis_date = ? AND bed_id = ?", orgID, item.PatientId, item.ScheduleDate, item.BedId).First(&order)
|
|
108
|
+ readDb.Model(&models.SmSchDialysisOrder{}).Where("user_org_id = ? AND status = 1 AND patient_id = ? AND dialysis_date = ? ", orgID, item.PatientId, item.ScheduleDate).First(&order)
|
108
|
109
|
item.SmSchDialysisOrder = order
|
109
|
110
|
}
|
110
|
111
|
return
|