|
@@ -608,7 +608,9 @@ func GetWeekDayScheduleByIdThee(orgid int64, scheduleDate int64, scheduleType in
|
608
|
608
|
err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("XtAssessmentBeforeDislysis", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
|
609
|
609
|
return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
|
610
|
610
|
}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
|
611
|
|
- return db.Where("status =1").Group("mode_id").Order("id asc")
|
|
611
|
+ return db.Where("status =1").Order("id asc")
|
|
612
|
+ }).Preload("Solution", func(db *gorm.DB) *gorm.DB {
|
|
613
|
+ return db.Where("status =1").Group("patient_id,mode_id").Order("id desc")
|
612
|
614
|
}).Find(&list).Error
|
613
|
615
|
|
614
|
616
|
return list, err
|
|
@@ -633,7 +635,9 @@ func GetWeekDayScheduleByIdTwo(orgid int64, scheduleDate int64, scheduleType int
|
633
|
635
|
err = db.Select("x.id,x.user_org_id,x.partition_id,x.bed_id,x.patient_id,x.schedule_date,x.schedule_type,x.schedule_week,x.mode_id,x.is_export").Preload("XtPatients", "status = 1").Preload("DeviceZone", "status = 1").Preload("DeviceNumber", "status = 1").Preload("DialysisOrder", "status = 1").Preload("XtAssessmentBeforeDislysis", "status = 1").Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
|
634
|
636
|
return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
|
635
|
637
|
}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
|
636
|
|
- return db.Where("status =1").Group("mode_id").Order("id asc")
|
|
638
|
+ return db.Where("status =1").Order("id asc")
|
|
639
|
+ }).Preload("Solution", func(db *gorm.DB) *gorm.DB {
|
|
640
|
+ return db.Where("status =1").Group("patient_id,mode_id").Order("id desc")
|
637
|
641
|
}).Find(&list).Error
|
638
|
642
|
|
639
|
643
|
return list, err
|
|
@@ -820,6 +824,8 @@ func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endt
|
820
|
824
|
return db.Where("status = 1").Order("id asc")
|
821
|
825
|
}).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
|
822
|
826
|
return db.Where("status = 1").Order("id asc")
|
|
827
|
+ }).Preload("Solution", func(db *gorm.DB) *gorm.DB {
|
|
828
|
+ return db.Where("status = 1").Group("patient_id,mode_id").Order("id desc")
|
823
|
829
|
}).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
|
824
|
830
|
return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
|
825
|
831
|
}).Preload("HisDoctorAdviceInfo", "status = 1").Joins("JOIN xt_patients as p ON p.id = s.patient_id").
|