|
@@ -605,12 +605,10 @@ func GetWeekDayScheduleByIdThee(orgid int64, scheduleDate int64, scheduleType in
|
605
|
605
|
db = db.Where("x.partition_id in (?)", zone)
|
606
|
606
|
}
|
607
|
607
|
|
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
|
|
- return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
|
610
|
|
- }).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
|
|
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 and dialysis_date = ?", scheduleDate).Preload("XtAssessmentBeforeDislysis", "status = 1 and assessment_date =?", scheduleDate).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
|
|
609
|
+ return db.Where("status =1 and parent_id = 0 and advice_date = ?", scheduleDate).Preload("ChildDoctorAdvice", "status = 1")
|
|
610
|
+ }).Preload("HisDoctorAdviceInfo", "status = 1 and advice_date = ?", scheduleDate).Preload("DialysisPrescription", "status = 1 and record_date =?", scheduleDate).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
|
611
|
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 asc")
|
614
|
612
|
}).Find(&list).Error
|
615
|
613
|
|
616
|
614
|
return list, err
|
|
@@ -632,12 +630,10 @@ func GetWeekDayScheduleByIdTwo(orgid int64, scheduleDate int64, scheduleType int
|
632
|
630
|
db = db.Where("x.partition_id in (?)", zone)
|
633
|
631
|
}
|
634
|
632
|
|
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 {
|
636
|
|
- return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
|
637
|
|
- }).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
|
|
633
|
+ 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 and dialysis_date =?", scheduleDate).Preload("XtAssessmentBeforeDislysis", "status = 1 and assessment_date =?", scheduleDate).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
|
|
634
|
+ return db.Where("status =1 and parent_id = 0 and advice_date = ?", scheduleDate).Preload("ChildDoctorAdvice", "status = 1")
|
|
635
|
+ }).Preload("HisDoctorAdviceInfo", "status = 1 and advice_date = ?", scheduleDate).Preload("DialysisPrescription", "status = 1 and record_date = ?", scheduleDate).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
|
638
|
636
|
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")
|
641
|
637
|
}).Find(&list).Error
|
642
|
638
|
|
643
|
639
|
return list, err
|
|
@@ -824,8 +820,6 @@ func GetNextWeekDaySchedule(weektype int64, weektime int64, startime int64, endt
|
824
|
820
|
return db.Where("status = 1").Order("id asc")
|
825
|
821
|
}).Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
|
826
|
822
|
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 asc")
|
829
|
823
|
}).Preload("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
|
830
|
824
|
return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
|
831
|
825
|
}).Preload("HisDoctorAdviceInfo", "status = 1").Joins("JOIN xt_patients as p ON p.id = s.patient_id").
|