|
@@ -351,27 +351,6 @@ func ModeFyScheduleById(schedule_date int64, bedid int64, scheduletype int64, or
|
351
|
351
|
return err
|
352
|
352
|
}
|
353
|
353
|
|
354
|
|
-func ModeScheduleByTime(startime int64, endtime int64, orgid int64) error {
|
355
|
|
-
|
356
|
|
- schedule := models.XtSchedule{}
|
357
|
|
-
|
358
|
|
- err := XTWriteDB().Model(&schedule).Where("schedule_date >? and schedule_date<=? and status = 1 and user_org_id = ?", startime, endtime, orgid).Updates(map[string]interface{}{"status": 0}).Error
|
359
|
|
- return err
|
360
|
|
-}
|
361
|
|
-
|
362
|
|
-func ModeScheduleByTimeOne(startime int64, endtime int64, orgid int64) error {
|
363
|
|
-
|
364
|
|
- schedule := models.XtSchedule{}
|
365
|
|
-
|
366
|
|
- err := XTWriteDB().Model(&schedule).Where("schedule_date >=? and schedule_date<=? and status = 1 and user_org_id = ?", startime, endtime, orgid).Updates(map[string]interface{}{"status": 0}).Error
|
367
|
|
- return err
|
368
|
|
-}
|
369
|
|
-
|
370
|
|
-func UpdateScheduleByOrgId(patientid int64, scheduledate int64, orgid int64, mode_id int64, schedule_type int64, sch *models.XtSchedule) error {
|
371
|
|
- err := XTWriteDB().Model(&sch).Where("patient_id = ? and schedule_date= ? and user_org_id = ? and status = 1 and mode_id = ? and schedule_type = ?", patientid, scheduledate, orgid, mode_id, schedule_type).Updates(map[string]interface{}{"partition_id": sch.PartitionId, "bed_id": sch.BedId, "schedule_type": sch.ScheduleType, "schedule_week": sch.ScheduleWeek, "mode_id": sch.ModeId, "updated_time": time.Now().Unix()}).Error
|
372
|
|
- return err
|
373
|
|
-}
|
374
|
|
-
|
375
|
354
|
func UpdateScheduleByOrgIdOne(patientid int64, scheduledate int64, orgid int64, sch *models.XtSchedule) error {
|
376
|
355
|
err := XTWriteDB().Model(&sch).Where("patient_id = ? and schedule_date= ? and user_org_id = ? and status = 1", patientid, scheduledate, orgid).Updates(map[string]interface{}{"partition_id": sch.PartitionId, "bed_id": sch.BedId, "schedule_type": sch.ScheduleType, "schedule_week": sch.ScheduleWeek, "mode_id": sch.ModeId, "updated_time": time.Now().Unix(), "dialysis_machine_name": sch.DialysisMachineName}).Error
|
377
|
356
|
return err
|
|
@@ -1918,7 +1897,7 @@ func UpdateRepeatSchStatus(user_org_id int64, schedule_date int64) {
|
1918
|
1897
|
|
1919
|
1898
|
for _, schedule := range schedules {
|
1920
|
1899
|
// Update records with status = 0 where id is less than max_id
|
1921
|
|
- XTReadDB().Model(&models.XtSchedule{}).Where("patient_id = ? AND schedule_date = ? AND id < ?", schedule.PatientId, schedule.ScheduleDate, schedule.MaxId).Update("status", 0)
|
|
1900
|
+ XTReadDB().Model(&models.XtSchedule{}).Where("patient_id = ? AND schedule_date = ? AND id < ?", schedule.PatientId, schedule.ScheduleDate, schedule.MaxId).Update("status", 0, "remark", "去除重复排班")
|
1922
|
1901
|
|
1923
|
1902
|
}
|
1924
|
1903
|
|