Explorar el Código

11月8日库存管理

XMLWAN hace 3 años
padre
commit
7346ca8967

+ 1 - 1
controllers/new_mobile_api_controllers/staff_schedule_api_controller.go Ver fichero

@@ -293,7 +293,7 @@ func (this *StaffScheduleApiController) GetPatientScheduleList() {
293 293
 	}
294 294
 	if is_open == 1 {
295 295
 		//获取空床位的排班数据
296
-		list, err := service.GetPatientScheduleByBed(startTime, zoneid, orgid)
296
+		list, err := service.GetPatientScheduleByBed(startTime, zoneid, orgid, classtype)
297 297
 		stockType, _ := service.GetStockType(orgid)
298 298
 		if err != nil {
299 299
 			this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加设备失败")

+ 10 - 4
service/doctor_schedule_service.go Ver fichero

@@ -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
 }