|
@@ -598,7 +598,7 @@ func GetPatientSchedule(startime int64, zoneid int64, classtype int64, orgid int
|
598
|
598
|
return schedule, err
|
599
|
599
|
}
|
600
|
600
|
|
601
|
|
-func GetPatientScheduleByBed(schedule_date int64, zoneid int64, orgid int64) (list []*models.PatientDeviceNumber, err error) {
|
|
601
|
+func GetPatientScheduleByBed(schedule_date int64, zoneid int64, orgid int64, class_type int64) (list []*models.PatientDeviceNumber, err error) {
|
602
|
602
|
|
603
|
603
|
db := XTReadDB().Table("xt_device_number as x").Where("x.status = 1")
|
604
|
604
|
if zoneid > 0 {
|
|
@@ -607,9 +607,15 @@ func GetPatientScheduleByBed(schedule_date int64, zoneid int64, orgid int64) (li
|
607
|
607
|
if orgid > 0 {
|
608
|
608
|
db = db.Where("x.org_id = ?", orgid)
|
609
|
609
|
}
|
610
|
|
- err = db.Select("x.id,x.number,x.sort,x.group_id,x.zone_id,x.sort").Preload("DeviceZone", "status = 1").Preload("Schedule", func(db *gorm.DB) *gorm.DB {
|
611
|
|
- return XTReadDB().Model(&models.BlodSchedule{}).Where("status = 1 AND user_org_id = ? and schedule_date = ?", orgid, schedule_date).Preload("VmBloodPatients", "status = 1 and user_org_id = ?", orgid).Preload("BloodDialysisOrder", "status = 1 and dialysis_date = ?", schedule_date).Preload("BloodDialysisPrescription", "status = 1 and record_date = ?", schedule_date)
|
612
|
|
- }).Find(&list).Error
|
|
610
|
+ if class_type > 0 {
|
|
611
|
+ err = db.Select("x.id,x.number,x.sort,x.group_id,x.zone_id,x.sort").Preload("DeviceZone", "status = 1").Preload("Schedule", func(db *gorm.DB) *gorm.DB {
|
|
612
|
+ return XTReadDB().Model(&models.BlodSchedule{}).Where("status = 1 AND user_org_id = ? and schedule_date = ? and class_type = ?", orgid, schedule_date, class_type).Preload("VmBloodPatients", "status = 1 and user_org_id = ?", orgid).Preload("BloodDialysisOrder", "status = 1 and dialysis_date = ?", schedule_date).Preload("BloodDialysisPrescription", "status = 1 and record_date = ?", schedule_date)
|
|
613
|
+ }).Find(&list).Error
|
|
614
|
+ } else {
|
|
615
|
+ err = db.Select("x.id,x.number,x.sort,x.group_id,x.zone_id,x.sort").Preload("DeviceZone", "status = 1").Preload("Schedule", func(db *gorm.DB) *gorm.DB {
|
|
616
|
+ return XTReadDB().Model(&models.BlodSchedule{}).Where("status = 1 AND user_org_id = ? and schedule_date = ?", orgid, schedule_date).Preload("VmBloodPatients", "status = 1 and user_org_id = ?", orgid).Preload("BloodDialysisOrder", "status = 1 and dialysis_date = ?", schedule_date).Preload("BloodDialysisPrescription", "status = 1 and record_date = ?", schedule_date)
|
|
617
|
+ }).Find(&list).Error
|
|
618
|
+ }
|
613
|
619
|
|
614
|
620
|
return list, err
|
615
|
621
|
}
|