|
@@ -564,7 +564,7 @@ func GetWeekDaySchedule(orgID int64, scheduleDate int64, scheduleDates *time.Tim
|
564
|
564
|
return
|
565
|
565
|
}
|
566
|
566
|
|
567
|
|
-func GetWeekDayScheduleById(orgid int64, scheduleDate int64, scheduleType int64) (list []*models.VmSchedulesRemind, err error) {
|
|
567
|
+func GetWeekDayScheduleById(orgid int64, scheduleDate int64, scheduleType int64, zone int64) (list []*models.VmSchedulesRemind, err error) {
|
568
|
568
|
|
569
|
569
|
db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
|
570
|
570
|
if orgid > 0 {
|
|
@@ -576,17 +576,20 @@ func GetWeekDayScheduleById(orgid int64, scheduleDate int64, scheduleType int64)
|
576
|
576
|
if scheduleType > 0 {
|
577
|
577
|
db = db.Where("x.schedule_type = ?", scheduleType)
|
578
|
578
|
}
|
|
579
|
+ if zone > 0 {
|
|
580
|
+ db = db.Where("x.partition_id = ?", zone)
|
|
581
|
+ }
|
579
|
582
|
|
580
|
583
|
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("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
|
581
|
584
|
return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
|
582
|
585
|
}).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
|
583
|
|
- return db.Where("status =1").Order("id asc")
|
|
586
|
+ return db.Where("status =1").Order("id desc")
|
584
|
587
|
}).Find(&list).Error
|
585
|
588
|
|
586
|
589
|
return list, err
|
587
|
590
|
}
|
588
|
591
|
|
589
|
|
-func GetWeekDayScheduleByIdTwo(orgid int64, scheduleDate int64, scheduleType int64, startDate int64, zone int64) (list []*models.VmSchedules, err error) {
|
|
592
|
+func GetWeekDayScheduleByIdTwo(orgid int64, scheduleDate int64, scheduleType int64, startDate int64, zone int64) (list []*models.VmSchedulesRemind, err error) {
|
590
|
593
|
|
591
|
594
|
db := XTReadDB().Table("xt_schedule as x").Where("x.status = 1")
|
592
|
595
|
if orgid > 0 {
|
|
@@ -599,12 +602,14 @@ func GetWeekDayScheduleByIdTwo(orgid int64, scheduleDate int64, scheduleType int
|
599
|
602
|
db = db.Where("x.schedule_type = ?", scheduleType)
|
600
|
603
|
}
|
601
|
604
|
if zone > 0 {
|
602
|
|
- db = db.Where("s.partition_id = ?", zone)
|
|
605
|
+ db = db.Where("x.partition_id = ?", zone)
|
603
|
606
|
}
|
604
|
607
|
|
605
|
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("DoctorAdvice", func(db *gorm.DB) *gorm.DB {
|
606
|
609
|
return db.Where("status =1 and parent_id = 0").Preload("ChildDoctorAdvice", "status = 1")
|
607
|
|
- }).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", "user_org_id =? and status = 1", orgid).Find(&list).Error
|
|
610
|
+ }).Preload("HisDoctorAdviceInfo", "status = 1").Preload("DialysisPrescription", "status = 1").Preload("DialysisSolution", func(db *gorm.DB) *gorm.DB {
|
|
611
|
+ return db.Where("status =1").Order("id desc")
|
|
612
|
+ }).Find(&list).Error
|
608
|
613
|
|
609
|
614
|
return list, err
|
610
|
615
|
}
|