add===>:增加医生排班班次接口。
This commit is contained in:
parent
71b5741d57
commit
7b072d2a51
@ -0,0 +1,16 @@
|
||||
package com.xinelu.applet.controller.appletSchedulePlan;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @description: 小程序医生排班计划控制器
|
||||
* @author: haown
|
||||
* @create: 2023-09-22 10:28
|
||||
**/
|
||||
@Api(tags = "小程序医生排班计划控制器")
|
||||
@RestController
|
||||
@RequestMapping("/nurseApplet/schedule/plan")
|
||||
public class AppletSchedulePlanController {
|
||||
}
|
||||
@ -1,6 +1,19 @@
|
||||
package com.xinelu.manage.controller.schedule;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.R;
|
||||
import com.xinelu.common.core.page.TableDataInfo;
|
||||
import com.xinelu.manage.domain.schedule.Schedule;
|
||||
import com.xinelu.manage.service.schedule.IScheduleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@ -9,10 +22,42 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @author: haown
|
||||
* @create: 2023-09-21 17:25
|
||||
**/
|
||||
@ApiModel(value = "排班班次控制器")
|
||||
@Api(tags = "排班班次控制器")
|
||||
@RestController
|
||||
@RequestMapping("/system/schedule")
|
||||
public class ScheduleController {
|
||||
public class ScheduleController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private IScheduleService scheduleService;
|
||||
|
||||
/**
|
||||
* 查询班次列表
|
||||
*/
|
||||
@ApiOperation("查询班次列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Schedule schedule) {
|
||||
startPage();
|
||||
List<Schedule> list = scheduleService.getList(schedule);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("新增班次")
|
||||
@PostMapping("add")
|
||||
public R<String> add(@RequestBody Schedule schedule) {
|
||||
return scheduleService.save(schedule) > 0 ? R.ok() : R.fail("保存失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改班次")
|
||||
@PostMapping("update")
|
||||
public R<?> update(@RequestBody Schedule schedule) {
|
||||
return scheduleService.update(schedule) < 0 ? R.fail("修改失败") : R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("逻辑删除班次")
|
||||
@PostMapping("delete/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "班次主键", required = true, dataTypeClass = String.class)
|
||||
public R<?> delete(@PathVariable Long id) {
|
||||
scheduleService.delete(id);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package com.xinelu.manage.controller.scheduleplan;
|
||||
|
||||
import com.xinelu.manage.service.scheduleplan.ISchedulePlanService;
|
||||
import io.swagger.annotations.Api;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @description: 医生排班计划控制器
|
||||
* @author: haown
|
||||
* @create: 2023-09-22 10:14
|
||||
**/
|
||||
@Api(tags = "医生排班计划控制器")
|
||||
@RestController
|
||||
@RequestMapping("/system/schedule/plan")
|
||||
public class SchedulePlanController {
|
||||
|
||||
@Resource
|
||||
private ISchedulePlanService schedulePlanService;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,9 +1,8 @@
|
||||
package com.xinelu.manage.domain.schedule;
|
||||
|
||||
import com.xinelu.common.core.domain.BaseDomain;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xinelu.common.core.domain.BaseEntity;
|
||||
import java.time.LocalTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -11,8 +10,7 @@ import lombok.Data;
|
||||
* @TableName schedule
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "排班表对象", description = "schedule")
|
||||
public class Schedule extends BaseDomain implements Serializable {
|
||||
public class Schedule extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ -36,22 +34,37 @@ public class Schedule extends BaseDomain implements Serializable {
|
||||
/**
|
||||
* 班次上午开始时间
|
||||
*/
|
||||
private Date forenoonStartTime;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "HH:mm")
|
||||
private LocalTime forenoonStartTime;
|
||||
|
||||
/**
|
||||
* 班次上午结束时间
|
||||
*/
|
||||
private Date forenoonEndTime;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "HH:mm")
|
||||
private LocalTime forenoonEndTime;
|
||||
|
||||
/**
|
||||
* 班次下午开始时间
|
||||
*/
|
||||
private Date afternoonStartTime;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "HH:mm")
|
||||
private LocalTime afternoonStartTime;
|
||||
|
||||
/**
|
||||
* 班次下午结束时间
|
||||
*/
|
||||
private Date afternoonEndTime;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "HH:mm")
|
||||
private LocalTime afternoonEndTime;
|
||||
|
||||
/**
|
||||
* 启用状态(0正常 1停用)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 1代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
package com.xinelu.manage.domain.scheduleplan;
|
||||
|
||||
import com.xinelu.common.core.domain.BaseEntity;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -58,12 +58,12 @@ public class SchedulePlan extends BaseEntity {
|
||||
/**
|
||||
* 排班开始日期
|
||||
*/
|
||||
private Date scheduleStartDate;
|
||||
private LocalDate scheduleStartDate;
|
||||
|
||||
/**
|
||||
* 排班结束日期
|
||||
*/
|
||||
private Date scheduleEndDate;
|
||||
private LocalDate scheduleEndDate;
|
||||
|
||||
/**
|
||||
* 每人可预约分钟数
|
||||
@ -80,6 +80,16 @@ public class SchedulePlan extends BaseEntity {
|
||||
*/
|
||||
private String scheduleAddress;
|
||||
|
||||
/**
|
||||
* 启用状态(0正常 1停用)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 1代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@ -1,7 +1,8 @@
|
||||
package com.xinelu.manage.domain.scheduleplandetail;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -33,17 +34,17 @@ public class SchedulePlanDetail implements Serializable {
|
||||
/**
|
||||
* 排班日期
|
||||
*/
|
||||
private Date scheduleDate;
|
||||
private LocalDate scheduleDate;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private Date scheduleStartTime;
|
||||
private LocalTime scheduleStartTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private Date scheduleEndTime;
|
||||
private LocalTime scheduleEndTime;
|
||||
|
||||
/**
|
||||
* 预约状态(0:未预约,1:已预约)
|
||||
|
||||
@ -26,13 +26,13 @@ public class ScreeningRecord implements Serializable {
|
||||
* 居民业务主键
|
||||
*/
|
||||
@ApiModelProperty("居民业务主键")
|
||||
private String registerId;
|
||||
private String patientId;
|
||||
|
||||
/**
|
||||
* 居民姓名
|
||||
*/
|
||||
@ApiModelProperty("居民姓名")
|
||||
private String residentName;
|
||||
private String patientName;
|
||||
|
||||
/**
|
||||
* 状态(1:已预约 2:取消预约 3:已登记 4:已完成)
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
package com.xinelu.manage.dto.scheduleplan;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
/**
|
||||
* @description: 医生排班计划保存传输对象
|
||||
* @author: haown
|
||||
* @create: 2023-09-22 10:32
|
||||
**/
|
||||
@ApiModel("医生排班计划保存传输对象")
|
||||
public class SchedulePlanSaveDTO {
|
||||
|
||||
}
|
||||
@ -1,11 +1,12 @@
|
||||
package com.xinelu.manage.mapper.schedule;
|
||||
|
||||
import com.xinelu.manage.domain.schedule.Schedule;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @author haown
|
||||
* @description 针对表【schedule(排班班次表)】的数据库操作Mapper
|
||||
* @createDate 2023-09-21 10:16:44
|
||||
* @createDate 2023-09-22 09:43:30
|
||||
* @Entity com.xinelu.manage.domain.schedule.Schedule
|
||||
*/
|
||||
public interface ScheduleMapper {
|
||||
@ -22,4 +23,6 @@ public interface ScheduleMapper {
|
||||
|
||||
int updateByPrimaryKey(Schedule record);
|
||||
|
||||
List<Schedule> getList(Schedule schedule);
|
||||
|
||||
}
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
package com.xinelu.manage.mapper.scheduleplan;
|
||||
|
||||
import com.xinelu.manage.domain.scheduleplan.SchedulePlan;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author haown
|
||||
* @author Administrator
|
||||
* @description 针对表【schedule_plan(医生排班计划表)】的数据库操作Mapper
|
||||
* @createDate 2023-09-21 17:17:23
|
||||
* @createDate 2023-09-22 09:45:24
|
||||
* @Entity com.xinelu.manage.domain.scheduleplan.SchedulePlan
|
||||
*/
|
||||
public interface SchedulePlanMapper {
|
||||
@ -22,4 +23,5 @@ public interface SchedulePlanMapper {
|
||||
|
||||
int updateByPrimaryKey(SchedulePlan record);
|
||||
|
||||
List<SchedulePlan> getList(SchedulePlan record);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xinelu.manage.mapper.scheduleplandetail;
|
||||
|
||||
import com.xinelu.manage.domain.scheduleplandetail.SchedulePlanDetail;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author haown
|
||||
@ -22,4 +23,6 @@ public interface SchedulePlanDetailMapper {
|
||||
|
||||
int updateByPrimaryKey(SchedulePlanDetail record);
|
||||
|
||||
int batchInsert(List<SchedulePlanDetail> record);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
package com.xinelu.manage.service.schedule;
|
||||
|
||||
import com.xinelu.manage.domain.schedule.Schedule;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author haown
|
||||
* @description 针对表【schedule(排班班次表)】的数据库操作Service
|
||||
* @createDate 2023-09-21 10:12:22
|
||||
*/
|
||||
public interface IScheduleService {
|
||||
|
||||
int save(Schedule schedule);
|
||||
|
||||
int update(Schedule schedule);
|
||||
|
||||
int delete(long id);
|
||||
|
||||
List<Schedule> getList(Schedule schedule);
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
package com.xinelu.manage.service.schedule;
|
||||
|
||||
/**
|
||||
* @author haown
|
||||
* @description 针对表【schedule(排班班次表)】的数据库操作Service
|
||||
* @createDate 2023-09-21 10:12:22
|
||||
*/
|
||||
public interface ScheduleService {
|
||||
|
||||
}
|
||||
@ -1,16 +1,49 @@
|
||||
package com.xinelu.manage.service.schedule.impl;
|
||||
|
||||
import com.xinelu.manage.service.schedule.ScheduleService;
|
||||
import com.xinelu.common.utils.SecurityUtils;
|
||||
import com.xinelu.manage.domain.schedule.Schedule;
|
||||
import com.xinelu.manage.mapper.schedule.ScheduleMapper;
|
||||
import com.xinelu.manage.service.schedule.IScheduleService;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @author haown
|
||||
* @description 针对表【schedule(排班班次表)】的数据库操作Service实现
|
||||
* @createDate 2023-09-21 10:12:22
|
||||
*/
|
||||
@Service
|
||||
public class ScheduleServiceImpl implements ScheduleService {
|
||||
public class ScheduleServiceImpl implements IScheduleService {
|
||||
|
||||
@Resource
|
||||
private ScheduleMapper scheduleMapper;
|
||||
|
||||
@Override public int save(Schedule schedule) {
|
||||
schedule.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
||||
schedule.setCreateTime(new Date());
|
||||
return scheduleMapper.insertSelective(schedule);
|
||||
}
|
||||
|
||||
@Override public int update(Schedule schedule) {
|
||||
schedule.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
||||
schedule.setUpdateTime(new Date());
|
||||
return scheduleMapper.updateByPrimaryKeySelective(schedule);
|
||||
}
|
||||
|
||||
@Override public int delete(long id) {
|
||||
Schedule schedule = new Schedule();
|
||||
schedule.setId(id);
|
||||
schedule.setDelFlag("1");
|
||||
schedule.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
||||
schedule.setUpdateTime(new Date());
|
||||
return scheduleMapper.updateByPrimaryKeySelective(schedule);
|
||||
}
|
||||
|
||||
@Override public List<Schedule> getList(Schedule schedule) {
|
||||
return scheduleMapper.getList(schedule);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package com.xinelu.manage.service.scheduleplan;
|
||||
|
||||
import com.xinelu.manage.domain.scheduleplan.SchedulePlan;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author haown
|
||||
* @description 针对表【schedule_plan(医生排班计划表)】的数据库操作Service
|
||||
* @createDate 2023-09-21 17:16:40
|
||||
*/
|
||||
public interface ISchedulePlanService {
|
||||
|
||||
List<SchedulePlan> getList(SchedulePlan schedulePlan);
|
||||
|
||||
int save(SchedulePlan schedulePlan) throws Exception;
|
||||
|
||||
|
||||
}
|
||||
@ -1,10 +0,0 @@
|
||||
package com.xinelu.manage.service.scheduleplan;
|
||||
|
||||
/**
|
||||
* @author haown
|
||||
* @description 针对表【schedule_plan(医生排班计划表)】的数据库操作Service
|
||||
* @createDate 2023-09-21 17:16:40
|
||||
*/
|
||||
public interface SchedulePlanService {
|
||||
|
||||
}
|
||||
@ -1,7 +1,21 @@
|
||||
package com.xinelu.manage.service.scheduleplan.impl;
|
||||
|
||||
import com.xinelu.manage.service.scheduleplan.SchedulePlanService;
|
||||
import com.xinelu.common.utils.StringUtils;
|
||||
import com.xinelu.common.utils.bean.BeanUtils;
|
||||
import com.xinelu.manage.domain.schedule.Schedule;
|
||||
import com.xinelu.manage.domain.scheduleplan.SchedulePlan;
|
||||
import com.xinelu.manage.domain.scheduleplandetail.SchedulePlanDetail;
|
||||
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.LocalTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @author haown
|
||||
@ -9,8 +23,94 @@ import org.springframework.stereotype.Service;
|
||||
* @createDate 2023-09-21 17:16:40
|
||||
*/
|
||||
@Service
|
||||
public class SchedulePlanServiceImpl implements SchedulePlanService{
|
||||
public class SchedulePlanServiceImpl implements ISchedulePlanService {
|
||||
|
||||
@Resource
|
||||
private SchedulePlanMapper schedulePlanMapper;
|
||||
|
||||
@Resource
|
||||
private ScheduleMapper scheduleMapper;
|
||||
|
||||
@Resource
|
||||
private SchedulePlanDetailMapper planDetailMapper;
|
||||
|
||||
@Override public List<SchedulePlan> getList(SchedulePlan schedulePlan) {
|
||||
return schedulePlanMapper.getList(schedulePlan);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int save(SchedulePlan schedulePlan) throws Exception {
|
||||
// 保存排班计划
|
||||
schedulePlan.setDelFlag("0");
|
||||
if (StringUtils.isBlank(schedulePlan.getStatus())) {
|
||||
schedulePlan.setStatus("1");
|
||||
}
|
||||
int flag = schedulePlanMapper.insert(schedulePlan);
|
||||
|
||||
Schedule schedule = scheduleMapper.selectByPrimaryKey(schedulePlan.getScheduleId());
|
||||
if (flag > 0) {
|
||||
// 计算排班天数
|
||||
long days = ChronoUnit.DAYS.between(schedulePlan.getScheduleStartDate(), schedulePlan.getScheduleEndDate());
|
||||
for (int i = 0; i <= days; i++) {
|
||||
int patientsPerDay = 0;
|
||||
// 排班计划明细
|
||||
List<SchedulePlanDetail> detailList = new ArrayList<>();
|
||||
SchedulePlanDetail schedulePlanDetail = new SchedulePlanDetail();
|
||||
schedulePlanDetail.setSchedulePlanId(schedulePlan.getId());
|
||||
schedulePlanDetail.setScheduleDate(schedulePlan.getScheduleStartDate().plusDays(i));
|
||||
// 生成上午计划
|
||||
if (schedule.getForenoonStartTime() != null && schedule.getForenoonEndTime() != null) {
|
||||
// 根据时间间隔计算时间段
|
||||
long forenoonMinutes = ChronoUnit.MINUTES.between(schedule.getForenoonStartTime(), schedule.getForenoonEndTime());
|
||||
if (forenoonMinutes % schedulePlan.getMinutesPerPatient() == 0) {
|
||||
int number = (int) (forenoonMinutes / schedulePlan.getMinutesPerPatient());
|
||||
patientsPerDay += forenoonMinutes / schedulePlan.getMinutesPerPatient();
|
||||
detailList.addAll(genPlanDetail(schedulePlanDetail, number, schedule.getForenoonStartTime(), schedulePlan.getMinutesPerPatient()));
|
||||
} else {
|
||||
throw new Exception("上午上班时间不是每人可预约分钟数的倍数。");
|
||||
}
|
||||
}
|
||||
// 生成下午计划
|
||||
if (schedule.getAfternoonStartTime() != null && schedule.getAfternoonEndTime() != null) {
|
||||
// 根据时间间隔计算时间段
|
||||
long afternoonMinutes = ChronoUnit.MINUTES.between(schedule.getAfternoonStartTime(), schedule.getAfternoonEndTime());
|
||||
if (afternoonMinutes % schedulePlan.getMinutesPerPatient() == 0) {
|
||||
int number = (int) (afternoonMinutes / schedulePlan.getMinutesPerPatient());
|
||||
patientsPerDay += afternoonMinutes / schedulePlan.getMinutesPerPatient();
|
||||
detailList.addAll(genPlanDetail(schedulePlanDetail, number, schedule.getAfternoonStartTime(), schedulePlan.getMinutesPerPatient()));
|
||||
} else {
|
||||
throw new Exception("上午上班时间不是每人可预约分钟数的倍数。");
|
||||
}
|
||||
}
|
||||
|
||||
// 保存计划明细
|
||||
planDetailMapper.batchInsert(detailList);
|
||||
schedulePlan.setPatientsPerDay(patientsPerDay);
|
||||
schedulePlanMapper.updateByPrimaryKey(schedulePlan);
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成计划明细
|
||||
* @param number:人数
|
||||
* @param startTime:开始时间
|
||||
* @return
|
||||
*/
|
||||
private List<SchedulePlanDetail> genPlanDetail(SchedulePlanDetail schedulePlanDetail, int number, LocalTime startTime, int minutesPerPatient) {
|
||||
List<SchedulePlanDetail> planDetails = new ArrayList<>();
|
||||
for (int i = 0; i < number; i++) {
|
||||
SchedulePlanDetail planDetail = new SchedulePlanDetail();
|
||||
BeanUtils.copyBeanProp(planDetail, schedulePlanDetail);
|
||||
planDetail.setScheduleStartTime(startTime.plusMinutes((long) minutesPerPatient * i));
|
||||
planDetail.setScheduleEndTime(startTime.plusMinutes((long) minutesPerPatient * (i + 1)));
|
||||
planDetail.setApplyState("0");
|
||||
planDetails.add(planDetail);
|
||||
}
|
||||
return planDetails;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
package com.xinelu.manage.service.scheduleplandetail;
|
||||
|
||||
import com.xinelu.manage.domain.scheduleplandetail.SchedulePlanDetail;
|
||||
|
||||
/**
|
||||
* @author haown
|
||||
* @description 针对表【schedule_plan_detail(医生排班计划明细表)】的数据库操作Service
|
||||
* @createDate 2023-09-21 17:21:38
|
||||
*/
|
||||
public interface SchedulePlanDetailService {
|
||||
public interface ISchedulePlanDetailService {
|
||||
|
||||
int save(SchedulePlanDetail planDetail);
|
||||
|
||||
}
|
||||
@ -1,6 +1,9 @@
|
||||
package com.xinelu.manage.service.scheduleplandetail.impl;
|
||||
|
||||
import com.xinelu.manage.service.scheduleplandetail.SchedulePlanDetailService;
|
||||
import com.xinelu.manage.domain.scheduleplandetail.SchedulePlanDetail;
|
||||
import com.xinelu.manage.mapper.scheduleplandetail.SchedulePlanDetailMapper;
|
||||
import com.xinelu.manage.service.scheduleplandetail.ISchedulePlanDetailService;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@ -9,8 +12,14 @@ import org.springframework.stereotype.Service;
|
||||
* @createDate 2023-09-21 17:21:38
|
||||
*/
|
||||
@Service
|
||||
public class SchedulePlanDetailServiceImpl implements SchedulePlanDetailService{
|
||||
public class SchedulePlanDetailServiceImpl implements ISchedulePlanDetailService {
|
||||
|
||||
@Resource
|
||||
private SchedulePlanDetailMapper planDetailMapper;
|
||||
|
||||
@Override public int save(SchedulePlanDetail planDetail) {
|
||||
return planDetailMapper.insert(planDetail);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -13,6 +13,8 @@
|
||||
<result property="forenoonEndTime" column="forenoon_end_time" jdbcType="TIME"/>
|
||||
<result property="afternoonStartTime" column="afternoon_start_time" jdbcType="TIME"/>
|
||||
<result property="afternoonEndTime" column="afternoon_end_time" jdbcType="TIME"/>
|
||||
<result property="status" column="status" jdbcType="CHAR"/>
|
||||
<result property="delFlag" column="del_flag" jdbcType="CHAR"/>
|
||||
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||
@ -22,8 +24,9 @@
|
||||
<sql id="Base_Column_List">
|
||||
id,hospital_id,hospital_name,
|
||||
schedule_name,forenoon_start_time,forenoon_end_time,
|
||||
afternoon_start_time,afternoon_end_time,create_by,
|
||||
create_time,update_by,update_time
|
||||
afternoon_start_time,afternoon_end_time,status,
|
||||
del_flag,create_by,create_time,
|
||||
update_by,update_time
|
||||
</sql>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
@ -41,14 +44,14 @@
|
||||
insert into schedule
|
||||
( id,hospital_id,hospital_name
|
||||
,schedule_name,forenoon_start_time,forenoon_end_time
|
||||
,afternoon_start_time,afternoon_end_time,create_by
|
||||
,create_time,update_by,update_time
|
||||
)
|
||||
,afternoon_start_time,afternoon_end_time,status
|
||||
,del_flag,create_by,create_time
|
||||
,update_by,update_time)
|
||||
values (#{id,jdbcType=BIGINT},#{hospitalId,jdbcType=BIGINT},#{hospitalName,jdbcType=VARCHAR}
|
||||
,#{scheduleName,jdbcType=VARCHAR},#{forenoonStartTime,jdbcType=TIME},#{forenoonEndTime,jdbcType=TIME}
|
||||
,#{afternoonStartTime,jdbcType=TIME},#{afternoonEndTime,jdbcType=TIME},#{createBy,jdbcType=VARCHAR}
|
||||
,#{createTime,jdbcType=TIMESTAMP},#{updateBy,jdbcType=VARCHAR},#{updateTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
,#{afternoonStartTime,jdbcType=TIME},#{afternoonEndTime,jdbcType=TIME},#{status,jdbcType=CHAR}
|
||||
,#{delFlag,jdbcType=CHAR},#{createBy,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP}
|
||||
,#{updateBy,jdbcType=VARCHAR},#{updateTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.xinelu.manage.domain.schedule.Schedule" useGeneratedKeys="true">
|
||||
insert into schedule
|
||||
@ -61,6 +64,8 @@
|
||||
<if test="forenoonEndTime != null">forenoon_end_time,</if>
|
||||
<if test="afternoonStartTime != null">afternoon_start_time,</if>
|
||||
<if test="afternoonEndTime != null">afternoon_end_time,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
@ -75,6 +80,8 @@
|
||||
<if test="forenoonEndTime != null">#{forenoonEndTime,jdbcType=TIME},</if>
|
||||
<if test="afternoonStartTime != null">#{afternoonStartTime,jdbcType=TIME},</if>
|
||||
<if test="afternoonEndTime != null">#{afternoonEndTime,jdbcType=TIME},</if>
|
||||
<if test="status != null">#{status,jdbcType=CHAR},</if>
|
||||
<if test="delFlag != null">#{delFlag,jdbcType=CHAR},</if>
|
||||
<if test="createBy != null">#{createBy,jdbcType=VARCHAR},</if>
|
||||
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="updateBy != null">#{updateBy,jdbcType=VARCHAR},</if>
|
||||
@ -105,6 +112,12 @@
|
||||
<if test="afternoonEndTime != null">
|
||||
afternoon_end_time = #{afternoonEndTime,jdbcType=TIME},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=CHAR},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag = #{delFlag,jdbcType=CHAR},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@ -130,10 +143,30 @@
|
||||
forenoon_end_time = #{forenoonEndTime,jdbcType=TIME},
|
||||
afternoon_start_time = #{afternoonStartTime,jdbcType=TIME},
|
||||
afternoon_end_time = #{afternoonEndTime,jdbcType=TIME},
|
||||
status = #{status,jdbcType=CHAR},
|
||||
del_flag = #{delFlag,jdbcType=CHAR},
|
||||
create_by = #{createBy,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
|
||||
<select id="getList" parameterType="com.xinelu.manage.domain.schedule.Schedule" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from schedule
|
||||
<where>
|
||||
del_flag = '0'
|
||||
<if test="hospitalId != null">
|
||||
and hospital_id = #{hospitalId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="hospitalName != null">
|
||||
and hospital_name like concat('%', #{hospitalName}, '%')
|
||||
</if>
|
||||
<if test="scheduleName != null">
|
||||
and schedule_name like concat('%', #{scheduleName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
<result property="minutesPerPatient" column="minutes_per_patient" jdbcType="INTEGER"/>
|
||||
<result property="patientsPerDay" column="patients_per_day" jdbcType="INTEGER"/>
|
||||
<result property="scheduleAddress" column="schedule_address" jdbcType="VARCHAR"/>
|
||||
<result property="status" column="status" jdbcType="CHAR"/>
|
||||
<result property="delFlag" column="del_flag" jdbcType="CHAR"/>
|
||||
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
|
||||
@ -30,8 +32,9 @@
|
||||
department_id,department_name,schedule_id,
|
||||
schedule_name,doctor_id,doctor_name,
|
||||
schedule_start_date,schedule_end_date,minutes_per_patient,
|
||||
patients_per_day,schedule_address,create_by,
|
||||
create_time,update_by,update_time
|
||||
patients_per_day,schedule_address,status,
|
||||
del_flag,create_by,create_time,
|
||||
update_by,update_time
|
||||
</sql>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||||
@ -51,16 +54,16 @@
|
||||
,department_id,department_name,schedule_id
|
||||
,schedule_name,doctor_id,doctor_name
|
||||
,schedule_start_date,schedule_end_date,minutes_per_patient
|
||||
,patients_per_day,schedule_address,create_by
|
||||
,create_time,update_by,update_time
|
||||
)
|
||||
,patients_per_day,schedule_address,status
|
||||
,del_flag,create_by,create_time
|
||||
,update_by,update_time)
|
||||
values (#{id,jdbcType=BIGINT},#{hospitalId,jdbcType=BIGINT},#{hospitalName,jdbcType=VARCHAR}
|
||||
,#{departmentId,jdbcType=BIGINT},#{departmentName,jdbcType=VARCHAR},#{scheduleId,jdbcType=BIGINT}
|
||||
,#{scheduleName,jdbcType=VARCHAR},#{doctorId,jdbcType=BIGINT},#{doctorName,jdbcType=VARCHAR}
|
||||
,#{scheduleStartDate,jdbcType=DATE},#{scheduleEndDate,jdbcType=DATE},#{minutesPerPatient,jdbcType=INTEGER}
|
||||
,#{patientsPerDay,jdbcType=INTEGER},#{scheduleAddress,jdbcType=VARCHAR},#{createBy,jdbcType=VARCHAR}
|
||||
,#{createTime,jdbcType=TIMESTAMP},#{updateBy,jdbcType=VARCHAR},#{updateTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
,#{patientsPerDay,jdbcType=INTEGER},#{scheduleAddress,jdbcType=VARCHAR},#{status,jdbcType=CHAR}
|
||||
,#{delFlag,jdbcType=CHAR},#{createBy,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP}
|
||||
,#{updateBy,jdbcType=VARCHAR},#{updateTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.xinelu.manage.domain.scheduleplan.SchedulePlan" useGeneratedKeys="true">
|
||||
insert into schedule_plan
|
||||
@ -79,6 +82,8 @@
|
||||
<if test="minutesPerPatient != null">minutes_per_patient,</if>
|
||||
<if test="patientsPerDay != null">patients_per_day,</if>
|
||||
<if test="scheduleAddress != null">schedule_address,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
@ -99,6 +104,8 @@
|
||||
<if test="minutesPerPatient != null">#{minutesPerPatient,jdbcType=INTEGER},</if>
|
||||
<if test="patientsPerDay != null">#{patientsPerDay,jdbcType=INTEGER},</if>
|
||||
<if test="scheduleAddress != null">#{scheduleAddress,jdbcType=VARCHAR},</if>
|
||||
<if test="status != null">#{status,jdbcType=CHAR},</if>
|
||||
<if test="delFlag != null">#{delFlag,jdbcType=CHAR},</if>
|
||||
<if test="createBy != null">#{createBy,jdbcType=VARCHAR},</if>
|
||||
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="updateBy != null">#{updateBy,jdbcType=VARCHAR},</if>
|
||||
@ -147,6 +154,12 @@
|
||||
<if test="scheduleAddress != null">
|
||||
schedule_address = #{scheduleAddress,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=CHAR},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag = #{delFlag,jdbcType=CHAR},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@ -178,10 +191,32 @@
|
||||
minutes_per_patient = #{minutesPerPatient,jdbcType=INTEGER},
|
||||
patients_per_day = #{patientsPerDay,jdbcType=INTEGER},
|
||||
schedule_address = #{scheduleAddress,jdbcType=VARCHAR},
|
||||
status = #{status,jdbcType=CHAR},
|
||||
del_flag = #{delFlag,jdbcType=CHAR},
|
||||
create_by = #{createBy,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<select id="getList" parameterType="com.xinelu.manage.domain.scheduleplan.SchedulePlan" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from schedule_plan
|
||||
<where>
|
||||
del_flag = '0'
|
||||
<if test="hospitalId != null">
|
||||
and hospital_id = #{hospitalId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="departmentId != null">
|
||||
and department_id = #{departmentId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="scheduleId != null">
|
||||
and schedule_id = #{scheduleId,jdbcType=BIGINT}
|
||||
</if>
|
||||
<if test="doctorId != null">
|
||||
and doctor_id = #{doctorId,jdbcType=BIGINT}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -103,4 +103,16 @@
|
||||
apply_state = #{applyState,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="com.xinelu.manage.domain.scheduleplandetail.SchedulePlanDetail" useGeneratedKeys="true">
|
||||
insert into schedule_plan_detail
|
||||
(schedule_plan_id,doctor_id
|
||||
,doctor_name,schedule_date,schedule_start_time
|
||||
,schedule_end_time,apply_state) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{schedulePlanId,jdbcType=BIGINT},#{doctorId,jdbcType=BIGINT}
|
||||
,#{doctorName,jdbcType=VARCHAR},#{scheduleDate,jdbcType=DATE},#{scheduleStartTime,jdbcType=TIME}
|
||||
,#{scheduleEndTime,jdbcType=TIME},#{applyState,jdbcType=VARCHAR})
|
||||
</foreach>
|
||||
|
||||
</insert>
|
||||
</mapper>
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<resultMap id="BaseResultMap" type="com.xinelu.manage.domain.screeningrecord.ScreeningRecord">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="screeningId" column="screening_id" jdbcType="VARCHAR"/>
|
||||
<result property="registerId" column="register_id" jdbcType="VARCHAR"/>
|
||||
<result property="patientId" column="patient_id" jdbcType="VARCHAR"/>
|
||||
<result property="screeningStatus" column="screening_status" jdbcType="VARCHAR"/>
|
||||
<result property="disease" column="disease" jdbcType="VARCHAR"/>
|
||||
<result property="deptId" column="dept_id" jdbcType="VARCHAR"/>
|
||||
@ -35,7 +35,7 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,screening_id,register_id,screening_status,
|
||||
id,screening_id,patient_id,screening_status,
|
||||
disease,dept_id,IFNULL(dept_name, '') as dept_name,
|
||||
project_id, project_name,
|
||||
apply_start_time,apply_end_time, screening_date,
|
||||
@ -45,7 +45,7 @@
|
||||
</sql>
|
||||
|
||||
<sql id="Insert_Column">
|
||||
screening_id,register_id,screening_status,
|
||||
screening_id,patient_id,screening_status,
|
||||
disease,dept_id,dept_name,
|
||||
project_id, project_name,
|
||||
apply_start_time, apply_end_time, screening_date,
|
||||
@ -56,7 +56,7 @@
|
||||
<!-- 新增 -->
|
||||
<insert id="insert">
|
||||
insert into sd_screening_record (<include refid="Insert_Column"></include>)
|
||||
values (#{screeningId}, #{registerId}, #{screeningStatus},
|
||||
values (#{screeningId}, #{patientId}, #{screeningStatus},
|
||||
#{disease}, #{deptId}, #{deptName},
|
||||
#{projectId},#{projectName},
|
||||
#{applyStartTime}, #{applyEndTime},#{screeningDate},
|
||||
@ -156,9 +156,9 @@
|
||||
</select>
|
||||
|
||||
<!-- 获取当前居民预约信息 -->
|
||||
<select id="getScreeningByRegisterId" resultType="com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo">
|
||||
<select id="getScreeningBypatientId" resultType="com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo">
|
||||
select <include refid="Base_Column_List"></include> from sd_screening_record
|
||||
where register_id = #{registerId} and screening_status in ('1', '3')
|
||||
where patient_id = #{patientId} and screening_status in ('1', '3')
|
||||
and screening_type = '1'
|
||||
limit 1
|
||||
</select>
|
||||
@ -167,8 +167,8 @@
|
||||
<if test="screeningStatus != null and screeningStatus != ''">
|
||||
and screening_status = #{screeningStatus}
|
||||
</if>
|
||||
<if test="registerId != null and registerId != ''">
|
||||
and register_id = #{registerId}
|
||||
<if test="patientId != null and patientId != ''">
|
||||
and patient_id = #{patientId}
|
||||
</if>
|
||||
<if test="residentName != null and residentName != ''">
|
||||
and resident_name like concat(#{residentName}, '%')
|
||||
@ -215,7 +215,7 @@
|
||||
</sql>
|
||||
<select id="screeningList" resultType="com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo">
|
||||
select r.resident_name,r.gender,r.birthday,r.phone,r.`identity`
|
||||
,r.manage_status,r.manage_time,d.screening_id,d.register_id,d.project_id,d.project_name
|
||||
,r.manage_status,r.manage_time,d.screening_id,d.patient_id,d.project_id,d.project_name
|
||||
,d.dept_id,d.dept_name,d.apply_start_time,d.apply_end_time,
|
||||
d.diagnostic_result,d.attachment,d.attachment_two,
|
||||
d.registration_date,d.registration_code, d.registration_barcode,d.screening_type,d.push_date,
|
||||
@ -225,7 +225,7 @@
|
||||
else '0' end as hasResult,
|
||||
case when diagnostic_result is not null then '1'
|
||||
else '0' end as hasDiagnose
|
||||
from sd_screening_record d left join sd_register r on d.register_id = r.register_id
|
||||
from sd_screening_record d left join sd_register r on d.patient_id = r.patient_id
|
||||
<where>
|
||||
d.screening_status != '2' and r.del_flag = '0' and r.status = '0'
|
||||
<if test="screeningStatus != null and screeningStatus != ''">
|
||||
@ -317,7 +317,7 @@
|
||||
|
||||
<!-- 获取筛查结果记录 -->
|
||||
<select id="record" resultType="com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo">
|
||||
select ssr.id,ssr.screening_id,ssr.register_id,ssr.screening_status,
|
||||
select ssr.id,ssr.screening_id,ssr.patient_id,ssr.screening_status,
|
||||
ssr.disease,ssr.dept_id,IFNULL(ssr.dept_name, '') as dept_name,ssr.project_id, ssr.project_name,
|
||||
ssr.apply_start_time,ssr.apply_end_time, ssr.screening_date,ssr.content,ssr.diagnostic_result,ssr.attachment,ssr.attachment_two,
|
||||
ssr.doctor_id,IFNULL(ssr.doctor_name,'') as doctor_name,ssr.apply_barcode,ssr.registration_date,ssr.screening_type,ssr.push_date,ssr.assess_record_id,
|
||||
@ -332,7 +332,7 @@
|
||||
<!-- 获取最新一次筛查结果 -->
|
||||
<select id="getScreeningOfLast" resultType="com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo">
|
||||
select <include refid="Base_Column_List"></include> from sd_screening_record
|
||||
where register_id = #{registerId}
|
||||
where patient_id = #{patientId}
|
||||
<if test="screeningType != null">
|
||||
and screening_type = #{screeningType}
|
||||
</if>
|
||||
@ -359,7 +359,7 @@
|
||||
screening_id as id, date_format(apply_start_time,'%Y-%m-%d') as createTime
|
||||
from sd_screening_record
|
||||
where
|
||||
register_id = #{registerId} and screening_status in('1','3','4') and screening_type = '1'
|
||||
patient_id = #{patientId} and screening_status in('1','3','4') and screening_type = '1'
|
||||
order by apply_start_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user