update===>:修改医生排班。

This commit is contained in:
haown 2023-09-26 17:40:57 +08:00
parent 84badbe996
commit ec25900681
2 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,6 @@
package com.xinelu.manage.domain.scheduleplandetail;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalTime;
@ -34,16 +35,19 @@ public class SchedulePlanDetail implements Serializable {
/**
* 排班日期
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
private LocalDate scheduleDate;
/**
* 开始时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "HH:mm")
private LocalTime scheduleStartTime;
/**
* 结束时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "HH:mm")
private LocalTime scheduleEndTime;
/**

View File

@ -9,6 +9,7 @@ import com.xinelu.manage.mapper.schedule.ScheduleMapper;
import com.xinelu.manage.mapper.scheduleplan.SchedulePlanMapper;
import com.xinelu.manage.mapper.scheduleplandetail.SchedulePlanDetailMapper;
import com.xinelu.manage.service.scheduleplan.ISchedulePlanService;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
@ -41,6 +42,9 @@ public class SchedulePlanServiceImpl implements ISchedulePlanService {
@Override
@Transactional(rollbackFor = Exception.class)
public int save(SchedulePlan schedulePlan) throws Exception {
if (schedulePlan.getScheduleStartDate().isBefore(LocalDate.now())) {
throw new Exception("排班开始时间应在当前日期之后!");
}
// 保存排班计划
schedulePlan.setDelFlag("0");
if (StringUtils.isBlank(schedulePlan.getStatus())) {
@ -53,7 +57,7 @@ public class SchedulePlanServiceImpl implements ISchedulePlanService {
// 计算排班天数
long days = ChronoUnit.DAYS.between(schedulePlan.getScheduleStartDate(), schedulePlan.getScheduleEndDate());
if (days < 0) {
throw new Exception("排班结束时间应在排班开始时间之后");
throw new Exception("排班结束时间应在排班开始时间之后");
}
for (int i = 0; i <= days; i++) {
int patientsPerDay = 0;