Commit 10ec04ee authored by zhangch's avatar zhangch
parents 0edb0716 aaa6ce18
package com.hungraim.ltc.pojo.vo.governance;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hungraim.ltc.pojo.entity.PageInfo;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 服务计划详情VO
*/
@Data
public class SrvTaskInfoVO extends PageInfo implements Serializable {
/**
* 服务计划id
*/
private String srvTaskId;
/**
* 服务计划明细id
*/
private String taskDetailId;
/**
* 服务人员姓名
*/
private String empName;
/**
* 服务方案起始日
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date srvStartTime;
/**
* 服务方案终止日
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date srvEndTime;
}
...@@ -17,6 +17,10 @@ public class SrvTaskVO extends PageInfo implements Serializable { ...@@ -17,6 +17,10 @@ public class SrvTaskVO extends PageInfo implements Serializable {
*/ */
private Integer srvTaskId; private Integer srvTaskId;
/** /**
* 服务方案id
*/
private Integer programId;
/**
* 失能人员id * 失能人员id
*/ */
private Integer disabInfoId; private Integer disabInfoId;
...@@ -96,10 +100,10 @@ public class SrvTaskVO extends PageInfo implements Serializable { ...@@ -96,10 +100,10 @@ public class SrvTaskVO extends PageInfo implements Serializable {
* 服务方案起始日 * 服务方案起始日
*/ */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date programEffTime; private Date srvStartTime;
/** /**
* 服务方案终止日 * 服务方案终止日
*/ */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date programEndTime; private Date srvEndTime;
} }
...@@ -3,12 +3,14 @@ package com.hungraim.ltc; ...@@ -3,12 +3,14 @@ package com.hungraim.ltc;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/** /**
* @author jiaguokai * @author jiaguokai
*/ */
@SpringBootApplication @SpringBootApplication
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableTransactionManagement
public class GovernanceApplication { public class GovernanceApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(GovernanceApplication.class, args); SpringApplication.run(GovernanceApplication.class, args);
......
package com.hungraim.ltc.governance.controller; package com.hungraim.ltc.governance.controller;
import com.hungraim.ltc.governance.service.SrvTaskService; import com.hungraim.ltc.governance.service.SrvTaskService;
import com.hungraim.ltc.pojo.vo.governance.SrvTaskInfoVO;
import com.hungraim.ltc.pojo.vo.governance.SrvTaskVO; import com.hungraim.ltc.pojo.vo.governance.SrvTaskVO;
import com.hungraim.ltc.util.DateUtils;
import com.hungraim.ltc.util.Result; import com.hungraim.ltc.util.Result;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -43,4 +46,82 @@ public class SrvTaskController { ...@@ -43,4 +46,82 @@ public class SrvTaskController {
List<SrvTaskVO> tasks = srvTaskService.getSrvTaskList(organId, disableName, disableTel, empName, certifNum, startTime, endTime, status, modeId); List<SrvTaskVO> tasks = srvTaskService.getSrvTaskList(organId, disableName, disableTel, empName, certifNum, startTime, endTime, status, modeId);
return Result.success(tasks); return Result.success(tasks);
} }
/**
* 查询服务计划制定详情
*
* @param taskId 服务计划id
*/
@RequestMapping("/getSrvTaskInfo")
public Result<SrvTaskInfoVO> getSrvTaskInfo(String taskId) {
if (StringUtils.isBlank(taskId)) {
return Result.failed("taskId不能为空!");
}
SrvTaskInfoVO taskInfo = srvTaskService.getSrvTaskInfo(taskId);
return Result.success(taskInfo);
}
/**
* 新增服务计划
*
* @param programId 服务方案id
* @param srvEmpId 护理人员id
* @param startTime 服务计划开始时间 yyyy-MM-dd
* @param endTime 服务计划结束时间 yyyy-MM-dd
*/
@RequestMapping("/addSrvTask")
public Result<Object> addSrvTask(Long programId, Long srvEmpId, String startTime, String endTime) {
if (programId == null) {
return Result.failed("服务方案id不能为空!");
}
if (srvEmpId == null) {
return Result.failed("护理人员id不能为空!");
}
if (StringUtils.isBlank(startTime)) {
return Result.failed("服务计划开始时间不能为空!");
}
if (StringUtils.isBlank(endTime)) {
return Result.failed("服务计划结束时间不能为空!");
}
try {
srvTaskService.addSrvTask(programId, srvEmpId, DateUtils.strToDate(startTime), DateUtils.strToDate(endTime));
} catch (RuntimeException e) {
//添加失败
return Result.failed(e.getMessage());
}
//添加成功
return Result.success();
}
/**
* 修改服务计划
*
* @param taskId 服务计划id
* @param srvEmpId 护理人员id
* @param startTime 服务计划开始时间 yyyy-MM-dd
* @param endTime 服务计划结束时间 yyyy-MM-dd
*/
@RequestMapping("/updateSrvTask")
public Result<Object> updateSrvTask(String taskId, Long srvEmpId, String startTime, String endTime) {
if (taskId == null) {
return Result.failed("taskId不能为空!");
}
if (srvEmpId == null) {
return Result.failed("护理人员id不能为空!");
}
if (StringUtils.isBlank(startTime)) {
return Result.failed("服务计划开始时间不能为空!");
}
if (StringUtils.isBlank(endTime)) {
return Result.failed("服务计划结束时间不能为空!");
}
try {
srvTaskService.updateSrvTask(taskId, srvEmpId, DateUtils.strToDate(startTime), DateUtils.strToDate(endTime));
} catch (RuntimeException e) {
//修改失败
return Result.failed(e.getMessage());
}
//修改成功
return Result.success();
}
} }
...@@ -2,6 +2,7 @@ package com.hungraim.ltc.governance.dao; ...@@ -2,6 +2,7 @@ package com.hungraim.ltc.governance.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTask; import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTask;
import com.hungraim.ltc.pojo.vo.governance.SrvTaskInfoVO;
import com.hungraim.ltc.pojo.vo.governance.SrvTaskVO; import com.hungraim.ltc.pojo.vo.governance.SrvTaskVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -16,4 +17,5 @@ public interface SrvTaskMapper extends BaseMapper<ChSrvTask> { ...@@ -16,4 +17,5 @@ public interface SrvTaskMapper extends BaseMapper<ChSrvTask> {
String empName, String certifNum, String startTime, String endTime, String empName, String certifNum, String startTime, String endTime,
String status, String modeId); String status, String modeId);
SrvTaskInfoVO getSrvTaskInfo(String taskId);
} }
package com.hungraim.ltc.governance.service; package com.hungraim.ltc.governance.service;
import com.hungraim.ltc.pojo.vo.governance.SrvTaskInfoVO;
import com.hungraim.ltc.pojo.vo.governance.SrvTaskVO; 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.List; import java.util.List;
/** /**
...@@ -15,4 +17,10 @@ public interface SrvTaskService { ...@@ -15,4 +17,10 @@ public interface SrvTaskService {
List<SrvTaskVO> getSrvTaskList(Integer organId, String disableName, String disableTel, List<SrvTaskVO> getSrvTaskList(Integer organId, String disableName, String disableTel,
String empName, String certifNum, String startTime, String endTime, String empName, String certifNum, String startTime, String endTime,
String status, String modeId); String status, String modeId);
SrvTaskInfoVO getSrvTaskInfo(String taskId);
void addSrvTask(Long programId, Long srvEmpId, Date startTime, Date endTime);
void updateSrvTask(String taskId, Long srvEmpId, Date startTime, Date endTime);
} }
package com.hungraim.ltc.governance.service.impl; package com.hungraim.ltc.governance.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hungraim.ltc.governance.dao.ChSrvTaskDetailMapper;
import com.hungraim.ltc.governance.dao.SrvTaskMapper; 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.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.vo.governance.SrvTaskInfoVO;
import com.hungraim.ltc.pojo.vo.governance.SrvTaskVO; import com.hungraim.ltc.pojo.vo.governance.SrvTaskVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -15,6 +22,8 @@ import java.util.List; ...@@ -15,6 +22,8 @@ import java.util.List;
public class SrvTaskServiceImpl implements SrvTaskService { public class SrvTaskServiceImpl implements SrvTaskService {
@Autowired @Autowired
private SrvTaskMapper srvTaskMapper; private SrvTaskMapper srvTaskMapper;
@Autowired
private ChSrvTaskDetailMapper chSrvTaskDetailMapper;
/** /**
* 服务计划列表 * 服务计划列表
...@@ -35,4 +44,66 @@ public class SrvTaskServiceImpl implements SrvTaskService { ...@@ -35,4 +44,66 @@ public class SrvTaskServiceImpl implements SrvTaskService {
String status, String modeId) { String status, String modeId) {
return srvTaskMapper.getSrvTaskList(organId, disableName, disableTel, empName, certifNum, startTime, endTime, status, modeId); return srvTaskMapper.getSrvTaskList(organId, disableName, disableTel, empName, certifNum, startTime, endTime, status, modeId);
} }
/**
* 查询服务计划制定详情
*
* @param taskId 服务计划id
*/
@Override
public SrvTaskInfoVO getSrvTaskInfo(String taskId) {
return srvTaskMapper.getSrvTaskInfo(taskId);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void addSrvTask(Long programId, Long srvEmpId, Date startTime, Date endTime) {
try {
//添加服务计划
ChSrvTask chSrvTask = new ChSrvTask();
chSrvTask.setEffTime(new Date());//创建时间
chSrvTask.setProgramId(programId);//服务方案id
chSrvTask.setSrvEmpId(srvEmpId);//服务人员id
chSrvTask.setStatus((short) 0);//状态 未分配:0;已分配:1
int insert = srvTaskMapper.insert(chSrvTask);
if (insert <= 0) {
throw new RuntimeException("添加服务计划失败!");
}
//添加服务计划详情
ChSrvTaskDetail chSrvTaskDetail = new ChSrvTaskDetail();
chSrvTaskDetail.setSrvTaskId(chSrvTask.getSrvTaskId());
chSrvTaskDetail.setSrvStartTime(startTime);//服务开始时间
chSrvTaskDetail.setEndTime(endTime);//服务结束时间
chSrvTaskDetail.setStatus((short) 0);//状态 未执行:0;执行中:1;已执行:2;已失效:3已完成4
int insert1 = chSrvTaskDetailMapper.insert(chSrvTaskDetail);
if (insert1 <= 0) {
throw new RuntimeException("添加服务计划详情失败!");
}
} catch (Exception e) {
throw new RuntimeException("系统繁忙,请稍后再试!");
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void updateSrvTask(String taskId, Long srvEmpId, Date startTime, Date endTime) {
//修改服务计划服务人员
ChSrvTask chSrvTask = srvTaskMapper.selectById(taskId);
if (chSrvTask == null) {
throw new RuntimeException("修改失败,不存在的服务计划!");
}
chSrvTask.setSrvEmpId(srvEmpId);
int i = srvTaskMapper.updateById(chSrvTask);
if (i <= 0) {
throw new RuntimeException("修改服务计划服务人员失败!");
}
//修改服务计划详情计划起止日期
ChSrvTaskDetail chSrvTaskDetail = chSrvTaskDetailMapper.selectOne(new QueryWrapper<ChSrvTaskDetail>().eq("srv_task_id", chSrvTask.getSrvTaskId()));
chSrvTaskDetail.setSrvStartTime(startTime);
chSrvTaskDetail.setEndTime(endTime);
int i1 = chSrvTaskDetailMapper.updateById(chSrvTaskDetail);
if (i1 <= 0) {
throw new RuntimeException("修改服务计划详情计划起止日期失败!");
}
}
} }
...@@ -5,7 +5,11 @@ ...@@ -5,7 +5,11 @@
<!--查询服务分配信息列表--> <!--查询服务分配信息列表-->
<select id="getSrvTaskList" resultType="com.hungraim.ltc.pojo.vo.governance.SrvTaskVO"> <select id="getSrvTaskList" resultType="com.hungraim.ltc.pojo.vo.governance.SrvTaskVO">
select select
--服务计划id
task.srv_task_id srvTaskId, task.srv_task_id srvTaskId,
--服务方案id
task.program_id programId,
--失能人员id
disable.disab_info_id disabInfoId, disable.disab_info_id disabInfoId,
--所在省市 --所在省市
(select DISTRICT_NAME from CH_FND_DISTRICT dis where disable.district_provincial = dis.DISTRICT_CODE) districtProvincial, (select DISTRICT_NAME from CH_FND_DISTRICT dis where disable.district_provincial = dis.DISTRICT_CODE) districtProvincial,
...@@ -45,9 +49,9 @@ ...@@ -45,9 +49,9 @@
--服务方案状态 --服务方案状态
program.prog_status progStatus, program.prog_status progStatus,
--服务方案起始日 --服务方案起始日
program.EFF_TIME programEffTime, detail.srv_start_time srvStartTime,
--服务方案终止日 --服务方案终止日
program.END_TIME programEndTime detail.srv_end_time srvEndTime
from ch_srv_task task--服务计划 from ch_srv_task task--服务计划
left join ch_disable_info disable on task.disab_info_id = disable.disab_info_id--失能人员 left join ch_disable_info disable on task.disab_info_id = disable.disab_info_id--失能人员
left join ch_apr_task aprtask on disable.last_task_id = aprtask.task_id--评定任务 left join ch_apr_task aprtask on disable.last_task_id = aprtask.task_id--评定任务
...@@ -57,6 +61,7 @@ ...@@ -57,6 +61,7 @@
left join ch_fnd_srv_mode mode1 on program.srv_mode_id = mode1.srv_mode_id--服务方式 left join ch_fnd_srv_mode mode1 on program.srv_mode_id = mode1.srv_mode_id--服务方式
left join ch_srv_organ_emp emp on task.srv_emp_id = emp.emp_id--护理人员 left join ch_srv_organ_emp emp on task.srv_emp_id = emp.emp_id--护理人员
left join ch_cfg_srv_disable_level level1 on report.disable_level_id = level1.disable_level_id--失能等级 left join ch_cfg_srv_disable_level level1 on report.disable_level_id = level1.disable_level_id--失能等级
left join ch_srv_task_detail detail on task.SRV_TASK_ID = detail.TASK_DETAIL_ID--服务任务明细
<where> <where>
<if test="organId != null"> <if test="organId != null">
and organ.SRV_ORGAN_ID = #{organId} and organ.SRV_ORGAN_ID = #{organId}
...@@ -74,10 +79,10 @@ ...@@ -74,10 +79,10 @@
and emp.certif_num = #{certifNum} and emp.certif_num = #{certifNum}
</if> </if>
<if test="startTime != null and startTime != ''"> <if test="startTime != null and startTime != ''">
and task.eff_time &gt;= #{startTime} and detail.srv_start_time &lt;= #{startTime}
</if> </if>
<if test="endTime != null and endTime != ''"> <if test="endTime != null and endTime != ''">
and task.eff_time &lt;= #{endTime} and detail.srv_end_time &gt;= #{endTime}
</if> </if>
<if test="status != null and status != ''"> <if test="status != null and status != ''">
and task.status = #{status} and task.status = #{status}
...@@ -88,4 +93,23 @@ ...@@ -88,4 +93,23 @@
</where> </where>
</select> </select>
<!--查询服务计划信息-->
<select id="getSrvTaskInfo" resultType="com.hungraim.ltc.pojo.vo.governance.SrvTaskInfoVO">
select task.srv_task_id srvTaskId,
detail.task_detail_id taskDetailId,
--服务人员姓名
emp.EMP_NAME empName,
--服务人员资质
empType.emp_type_name empTypeName,
--服务方案起始日
detail.srv_start_time srvStartTime,
--服务方案终止日
detail.srv_end_time srvEndTime
from ch_srv_task task--服务计划
left join ch_srv_organ_emp emp on task.srv_emp_id = emp.emp_id--护理人员
left join CH_EMP_TYPE empType on emp.EMP_TYPE_ID = empType.EMP_TYPE--护理人员资质
left join ch_srv_task_detail detail on task.srv_task_id = detail.task_detail_id--服务任务明细
where task.SRV_TASK_ID = #{taskId}
</select>
</mapper> </mapper>
\ No newline at end of file
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