Commit 6a3fb304 authored by zhangch's avatar zhangch

服务计划新增修改接口调试

parent f8fdc546
...@@ -5,10 +5,12 @@ import com.hungraim.ltc.governance.service.SrvTaskService; ...@@ -5,10 +5,12 @@ import com.hungraim.ltc.governance.service.SrvTaskService;
import com.hungraim.ltc.pojo.vo.governance.*; import com.hungraim.ltc.pojo.vo.governance.*;
import com.hungraim.ltc.util.DateUtils; import com.hungraim.ltc.util.DateUtils;
import com.hungraim.ltc.util.Result; import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -36,18 +38,18 @@ public class SrvTaskController { ...@@ -36,18 +38,18 @@ public class SrvTaskController {
* @param pageNum 页码 * @param pageNum 页码
* @param pageSize 每页大小 * @param pageSize 每页大小
* @param srvOrganId 护理服务机构id * @param srvOrganId 护理服务机构id
* @param name 护理人员姓名 * @param empName 护理人员姓名
* @param certiType 护理人员证件类型 * @param certifType 护理人员证件类型
* @param certifNum 护理人员证件号码 * @param certifNum 护理人员证件号码
*/ */
@RequestMapping("/getSrvOrganEmpList") @RequestMapping("/getSrvOrganEmpList")
public Result<Page<OrganEmpVO>> getSrvOrganEmpList(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize, public Result<Page<OrganEmpVO>> getSrvOrganEmpList(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize,
String srvOrganId, String name, String certiType, String certifNum) { String srvOrganId, String empName, String certifType, String certifNum) {
if (StringUtils.isBlank(srvOrganId)) { if (StringUtils.isBlank(srvOrganId)) {
return Result.failed("参数异常!"); return Result.failed("参数异常!");
} }
Page<OrganEmpVO> page = new Page<>(pageNum, pageSize); Page<OrganEmpVO> page = new Page<>(pageNum, pageSize);
page = srvTaskService.getSrvOrganEmpList(page, srvOrganId, name, certiType, certifNum); page = srvTaskService.getSrvOrganEmpList(page, srvOrganId, empName, certifType, certifNum);
return Result.success(page); return Result.success(page);
} }
...@@ -83,7 +85,7 @@ public class SrvTaskController { ...@@ -83,7 +85,7 @@ public class SrvTaskController {
@RequestMapping("/getSrvTaskDetailList") @RequestMapping("/getSrvTaskDetailList")
public Result<Page<SrvTaskDetailVO>> getSrvTaskDetailList(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize, public Result<Page<SrvTaskDetailVO>> getSrvTaskDetailList(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize,
Integer srvOrganId, String disableName, String disableTel, Integer srvOrganId, String disableName, String disableTel,
String empName, String certifNum, @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,@DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime, String empName, String certifNum, @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime, @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime,
String status, String modeId) { String status, String modeId) {
Page<SrvTaskDetailVO> page = new Page<>(pageNum, pageSize); Page<SrvTaskDetailVO> page = new Page<>(pageNum, pageSize);
page = srvTaskService.getSrvTaskDetailList(page, srvOrganId, disableName, disableTel, empName, certifNum, startTime, endTime, status, modeId); page = srvTaskService.getSrvTaskDetailList(page, srvOrganId, disableName, disableTel, empName, certifNum, startTime, endTime, status, modeId);
...@@ -101,7 +103,6 @@ public class SrvTaskController { ...@@ -101,7 +103,6 @@ public class SrvTaskController {
return Result.failed("参数异常!"); return Result.failed("参数异常!");
} }
List<SrvTaskInfoVO> taskInfos = srvTaskService.getSrvTaskInfoList(programId); List<SrvTaskInfoVO> taskInfos = srvTaskService.getSrvTaskInfoList(programId);
List<SrvTaskInfoListVO> listVOS = new ArrayList<>();
SrvTaskInfoListVO taskInfoListVO = new SrvTaskInfoListVO(); SrvTaskInfoListVO taskInfoListVO = new SrvTaskInfoListVO();
if (taskInfos != null && taskInfos.size() > 0) { if (taskInfos != null && taskInfos.size() > 0) {
taskInfoListVO.setProgramId(taskInfos.get(0).getProgramId()); taskInfoListVO.setProgramId(taskInfos.get(0).getProgramId());
...@@ -112,38 +113,35 @@ public class SrvTaskController { ...@@ -112,38 +113,35 @@ public class SrvTaskController {
} }
/** /**
* 新增服务计划 * 新增或者修改服务计划
*/ */
@RequestMapping("/addSrvTask") @PostMapping("/addOrUpdateSrvTask")
public Result<List<SrvTaskInfoVO>> addSrvTask(SrvTaskInfoListVO param) { public Result<List<SrvTaskInfoVO>> addSrvTask(SrvTaskInfoListVO param) {
String programId = param.getProgramId(); String programId = param.getProgramId();
List<SrvTaskInfoVO> taskList = param.getTaskList(); List<SrvTaskInfoVO> taskList = param.getTaskList();
if (StringUtils.isBlank(programId) || taskList == null || taskList.size() <= 0) { if (StringUtils.isBlank(programId) || taskList == null || taskList.size() <= 0) {
return Result.failed("参数错误!"); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
try { try {
for (int i = 0; i < taskList.size(); i++) { for (int i = 0; i < taskList.size(); i++) {
SrvTaskInfoVO srvTaskInfoVO = taskList.get(i); SrvTaskInfoVO srvTaskInfoVO = taskList.get(i);
if (srvTaskInfoVO.getSrvEmpId() == null) { if (srvTaskInfoVO.getSrvEmpId() == null) {
return Result.failed("护理人员id不能为空!"); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
if (srvTaskInfoVO.getTaskDetails() == null || srvTaskInfoVO.getTaskDetails().size() <= 0) { if (srvTaskInfoVO.getTaskDetails() == null || srvTaskInfoVO.getTaskDetails().size() <= 0) {
return Result.failed("具体护理日期不能为空!"); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
List<Date> dates = new ArrayList<>(); List<Date> dates = new ArrayList<>();
for (String detail : srvTaskInfoVO.getTaskDetails()) { for (String detail : srvTaskInfoVO.getTaskDetails()) {
Date date = DateUtils.strToDate(detail); Date date = DateUtils.strToDate(detail);
dates.add(date); dates.add(date);
} }
srvTaskService.addSrvTask(Long.parseLong(programId), Long.parseLong(srvTaskInfoVO.getSrvEmpId()), dates);
} }
srvTaskService.addOrUpdateSrvTask(param);
} catch (RuntimeException e) { } catch (RuntimeException e) {
//添加失败
return Result.failed(e.getMessage()); return Result.failed(e.getMessage());
} }
//添加成功 return Result.success();
List<SrvTaskInfoVO> taskInfos = srvTaskService.getSrvTaskInfoList(programId);
return Result.success(taskInfos);
} }
/** /**
......
package com.hungraim.ltc.governance.service; package com.hungraim.ltc.governance.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.pojo.vo.governance.OrganEmpVO; import com.hungraim.ltc.pojo.vo.governance.*;
import com.hungraim.ltc.pojo.vo.governance.SrvTaskDetailVO;
import com.hungraim.ltc.pojo.vo.governance.SrvTaskInfoVO;
import com.hungraim.ltc.pojo.vo.governance.SrvTaskVO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
...@@ -29,4 +26,8 @@ public interface SrvTaskService { ...@@ -29,4 +26,8 @@ public interface SrvTaskService {
Page<SrvTaskDetailVO> getSrvTaskDetailList(Page<SrvTaskDetailVO> page, Integer organId, String disableName, String disableTel, String empName, String certifNum, Date startTime, Date endTime, String status, String modeId); Page<SrvTaskDetailVO> getSrvTaskDetailList(Page<SrvTaskDetailVO> page, Integer organId, String disableName, String disableTel, String empName, String certifNum, Date startTime, Date endTime, String status, String modeId);
/**
* 新增或者修改服务计划
*/
void addOrUpdateSrvTask(SrvTaskInfoListVO param);
} }
package com.hungraim.ltc.governance.service.impl; package com.hungraim.ltc.governance.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.governance.dao.ChSrvTaskDetailMapper; import com.hungraim.ltc.governance.dao.ChSrvTaskDetailMapper;
...@@ -7,10 +8,7 @@ import com.hungraim.ltc.governance.dao.SrvTaskMapper; ...@@ -7,10 +8,7 @@ import com.hungraim.ltc.governance.dao.SrvTaskMapper;
import com.hungraim.ltc.governance.service.SrvTaskService; import com.hungraim.ltc.governance.service.SrvTaskService;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTask; import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTask;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail; import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.vo.governance.OrganEmpVO; import com.hungraim.ltc.pojo.vo.governance.*;
import com.hungraim.ltc.pojo.vo.governance.SrvTaskDetailVO;
import com.hungraim.ltc.pojo.vo.governance.SrvTaskInfoVO;
import com.hungraim.ltc.pojo.vo.governance.SrvTaskVO;
import com.hungraim.ltc.util.DateUtils; import com.hungraim.ltc.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -45,6 +43,7 @@ public class SrvTaskServiceImpl implements SrvTaskService { ...@@ -45,6 +43,7 @@ public class SrvTaskServiceImpl implements SrvTaskService {
/** /**
* 服务计划查询列表 * 服务计划查询列表
*
* @param organId 护理机构id * @param organId 护理机构id
* @param disableName 失能人员姓名 * @param disableName 失能人员姓名
* @param disableTel 失能人员手机号码 * @param disableTel 失能人员手机号码
...@@ -84,6 +83,53 @@ public class SrvTaskServiceImpl implements SrvTaskService { ...@@ -84,6 +83,53 @@ public class SrvTaskServiceImpl implements SrvTaskService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public void addOrUpdateSrvTask(SrvTaskInfoListVO param) {
String programId = param.getProgramId();
String disabInfoId = param.getDisabInfoId();
List<SrvTaskInfoVO> taskList = param.getTaskList();
for (SrvTaskInfoVO srvTaskInfoVO : taskList) {
String srvTaskId = srvTaskInfoVO.getSrvTaskId();
List<String> taskDetails = srvTaskInfoVO.getTaskDetails();
if (StrUtil.isBlank(srvTaskId)) {
// 添加服务计划
ChSrvTask chSrvTask = new ChSrvTask();
chSrvTask.setEffTime(new Date());//创建时间
chSrvTask.setProgramId(Long.parseLong(programId));//服务方案id
chSrvTask.setDisabInfoId(Long.parseLong(disabInfoId)); // 失能人员id
chSrvTask.setSrvEmpId(Long.parseLong(srvTaskInfoVO.getSrvEmpId()));//服务人员id
chSrvTask.setStatus((short) 1);//状态 未分配:0;已分配:1;已终止2
srvTaskMapper.insert(chSrvTask);
Long newSrvTaskId = chSrvTask.getSrvTaskId();
insertTaskDetail(newSrvTaskId, taskDetails);
} else {
// 修改服务计划
ChSrvTask chSrvTask = new ChSrvTask();
chSrvTask.setSrvTaskId(Long.parseLong(srvTaskId));
chSrvTask.setStatus(Short.parseShort(srvTaskInfoVO.getTaskStatus()));
srvTaskMapper.updateById(chSrvTask);
chSrvTaskDetailMapper.delete(new QueryWrapper<ChSrvTaskDetail>().eq("srv_task_id", Long.parseLong(srvTaskId)));//删除原来的计划详情
insertTaskDetail(Long.parseLong(srvTaskId), taskDetails);
}
}
}
/**
* 插入服务计划详情数据
* @param srvTaskId 服务计划id
* @param taskDetails 服务时间集合,时间格式yyyy-MM-dd
*/
private void insertTaskDetail(Long srvTaskId, List<String> taskDetails) {
for (String taskDetail : taskDetails) {
ChSrvTaskDetail chSrvTaskDetail = new ChSrvTaskDetail();
chSrvTaskDetail.setSrvTaskId(srvTaskId);//taskId
chSrvTaskDetail.setSrvDate(DateUtils.strToDate(taskDetail));//服务开始时间
chSrvTaskDetail.setStatus((short) 0);//状态 未执行:0;执行中:1;已执行:2;已失效:3已完成4
chSrvTaskDetailMapper.insert(chSrvTaskDetail);
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void addSrvTask(Long programId, Long srvEmpId, List<Date> dates) { public void addSrvTask(Long programId, Long srvEmpId, List<Date> dates) {
try { try {
//添加服务计划 //添加服务计划
......
...@@ -187,18 +187,19 @@ ...@@ -187,18 +187,19 @@
--护理人员证件号码 --护理人员证件号码
emp.certif_num certifNum, emp.certif_num certifNum,
--护理人员资质 --护理人员资质
emptype.emp_type_name empTypeName, emptype.TYPE_NAME empTypeName,
--状态 有效:0,失效:1 --状态 有效:0,失效:1
emp.is_lock isLock emp.is_lock isLock
from ch_srv_organ_emp emp--护理人员信息 from ch_srv_organ_emp emp--护理人员信息
left join ch_srv_organ organ on emp.srv_organ_id = organ.srv_organ_id--护理机构 left join ch_srv_organ organ on emp.srv_organ_id = organ.srv_organ_id--护理机构
left join ch_emp_type emptype on emp.emp_type_id = emptype.emp_type--护理人员资质 left join CH_CFG_SRV_EMP_TYPE emptype on emp.emp_type_id = emptype.EMP_TYPE_ID--护理人员资质
<where> <where>
emp.is_lock = 0
<if test="organId != null and organId != ''"> <if test="organId != null and organId != ''">
and emp.SRV_ORGAN_ID = #{organId} and emp.SRV_ORGAN_ID = #{organId}
</if> </if>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and emp.emp_name = #{name} and emp.emp_name LIKE CONCAT('%',CONCAT(#{name},'%'))
</if> </if>
<if test="certiType != null and certiType != ''"> <if test="certiType != null and certiType != ''">
and emp.certif_type = #{certiType} and emp.certif_type = #{certiType}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment