Commit 608078e9 authored by zhangwanglin's avatar zhangwanglin

补卡修改

parent 44e1e30a
......@@ -742,7 +742,15 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
@Override
public SrvTaskCardRespDTO getSrvTaskCardInfo(String taskDetailId){
List<SrvTaskRespVO> records = taskDetailMapper.getSrvTaskCardInfo(taskDetailId);
List<ItemRespVO> itemRespVOS = new ArrayList<>();
for (SrvTaskRespVO record : records) {
ItemRespVO itemRespVO = new ItemRespVO();
itemRespVO.setItemId(record.getItemId());
itemRespVO.setItemName(record.getItemName());
itemRespVOS.add(itemRespVO);
}
SrvTaskCardRespDTO srvTaskCardRespDTO = new SrvTaskCardRespDTO();
srvTaskCardRespDTO.setItemsList(itemRespVOS);
List<String> collect = records.stream().map(SrvTaskRespVO::getItemName).collect(Collectors.toList());
String join = StringUtils.join(collect, ",");
srvTaskCardRespDTO.setItemName(join);
......@@ -754,7 +762,13 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
srvTaskCardRespDTO.setAuditor(records.get(0).getAuditor());
srvTaskCardRespDTO.setStatus(records.get(0).getStatus());
srvTaskCardRespDTO.setReason(records.get(0).getReason());
srvTaskCardRespDTO.setSrvOrganId(records.get(0).getSrvOrganId());
srvTaskCardRespDTO.setModeId(records.get(0).getModeId());
srvTaskCardRespDTO.setEmpId(records.get(0).getEmpId());
srvTaskCardRespDTO.setAuditRemark(records.get(0).getAuditRemark());
srvTaskCardRespDTO.setTaskDetailId(records.get(0).getTaskDetailId());
srvTaskCardRespDTO.setDisabInfoId(records.get(0).getDisabInfoId());
srvTaskCardRespDTO.setSrvTaskId(Long.parseLong(records.get(0).getSrvTaskId()));
Result<List<ChFndAttach>> listResult = attachFeignService.selectAttachs(Long.valueOf(taskDetailId), AttachType.DISABLE.getUploadType());
if (listResult.getCode().equals(ResultCode.SUCCESS.getCode())) {
srvTaskCardRespDTO.setFileDataList(listResult.getData());
......
......@@ -98,6 +98,9 @@
detail.check_status status,
detail.clock_reason reason,
detail.auditor,
detail.srv_task_id srvTaskId,
detail.task_detail_id taskDetailId,
info.srv_mode_id modeId,
detail.audit_remark auditRemark
from ch_srv_plan plan
left join ch_disable_info info on plan.DISAB_INFO_ID = info.DISAB_INFO_ID
......
package com.hungraim.ltc.pojo.vo.account;
import lombok.Data;
/**
* @author zwl
* @ClassName ItemRespVO
* @description
* @date 2023/9/21 20:57
**/
@Data
public class ItemRespVO {
// 任务名称
private String itemName;
// 任务名称
private Long itemId;
}
......@@ -23,12 +23,23 @@ public class SrvTaskCardRespDTO {
// 护理人员
private String empName;
private String empId;
private String modeId;
private String disabInfoId;
private String srvOrganId;
private Long srvTaskId;
// 任务时间
private String srvDate;
// 任务名称
private String itemName;
private List<ItemRespVO> itemsList;
private Long status;
// 服务方式
......@@ -40,5 +51,8 @@ public class SrvTaskCardRespDTO {
private String auditRemark;
private Long taskDetailId;
private List<ChFndAttach> fileDataList;
}
......@@ -18,6 +18,13 @@ public class SrvTaskRespVO {
// 护理机构
private String srvOrganName;
private String modeId;
private String srvTaskId;
// 护理人员
private String empName;
......
......@@ -2,6 +2,7 @@ package com.hungraim.ltc.governance.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.governance.service.SrvTaskService;
import com.hungraim.ltc.pojo.entity.SysConfig.ChFndAttach;
import com.hungraim.ltc.pojo.vo.governance.*;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
......@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 服务计划Controller
......@@ -166,11 +168,42 @@ public class SrvTaskController {
if (srvPlanInputVO.getDisabInfoId() == null) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
List<ChFndAttach> fileDataList = srvPlanInputVO.getFileDataList();
if(fileDataList.size() < 2 ){
return Result.failed("护理记录单复印件、医疗养老上门补单申请表至少各一张");
}
List<String> collect1 = fileDataList.stream().map(ChFndAttach::getFileName)
.distinct().collect(Collectors.toList());
boolean ss = (collect1.size()!=fileDataList.size())? true: false;
if(ss){
return Result.failed("上传的附件不可重复");
}
Integer userId = TokenParsingUtil.TokenParsing(token, "userId");
srvPlanInputVO.setAdmin(String.valueOf(userId));
return srvTaskService.saveApplyCard(srvPlanInputVO);
}
@PostMapping("/updateApplyCard")
public Result updateApplyCard(@RequestHeader("Authorization") String token,SrvPlanInputVO srvPlanInputVO){
if (srvPlanInputVO.getDisabInfoId() == null) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
List<ChFndAttach> fileDataList = srvPlanInputVO.getFileDataList();
if(fileDataList.size() < 2 ){
return Result.failed("护理记录单复印件、医疗养老上门补单申请表至少各一张");
}
List<String> collect1 = fileDataList.stream().map(ChFndAttach::getFileName)
.distinct().collect(Collectors.toList());
boolean ss = (collect1.size()!=fileDataList.size())? true: false;
if(ss){
return Result.failed("上传的附件不可重复");
}
Integer userId = TokenParsingUtil.TokenParsing(token, "userId");
srvPlanInputVO.setAdmin(String.valueOf(userId));
return srvTaskService.updateApplyCard(srvPlanInputVO);
}
@PostMapping("/auditingCard")
public Result auditingCard(AuditingCardVO auditingCardVO){
return srvTaskService.auditingCard(auditingCardVO);
......
......@@ -41,6 +41,8 @@ public interface SrvTaskService {
// 补卡
Result saveApplyCard(SrvPlanInputVO srvPlanInputVO);
Result updateApplyCard(SrvPlanInputVO srvPlanInputVO);
Result auditingCard(AuditingCardVO auditingCardVO);
Result queryItemBySrvOrganId(Long srvOrganId);
......
......@@ -47,7 +47,7 @@ public class SrvTaskServiceImpl implements SrvTaskService {
private final AccountFeignService accountFeignService;
private final ChSrvProgramMapper chSrvProgramMapper;
private final ChSrvSendMapper chSrvSendMapper;
private final SrvSendService sendService;
private final SrvSendService sendService;
/**
* 服务计划制定列表
......@@ -77,7 +77,7 @@ public class SrvTaskServiceImpl implements SrvTaskService {
*/
@Override
public Page<SrvTaskDetailVO> getSrvTaskDetailList(Page<SrvTaskDetailVO> page, Integer organId, String disableName, String disableTel, String empName, String certifNum, String srvDate, Date startTime, Date endTime, String status, String modeId) {
return srvTaskMapper.getSrvTaskDetailList(page, organId, disableName, disableTel, empName, certifNum, srvDate,startTime, endTime, status, modeId);
return srvTaskMapper.getSrvTaskDetailList(page, organId, disableName, disableTel, empName, certifNum, srvDate, startTime, endTime, status, modeId);
}
/**
......@@ -161,30 +161,30 @@ public class SrvTaskServiceImpl implements SrvTaskService {
//添加服务计划详情
Long newSrvTaskId = chSrvTask.getSrvTaskId();
this.insertTaskDetail(newSrvTaskId, taskDetails);
saveSrvPlan(programId,null);
saveSrvPlan(programId, null);
//添加附件
// this.updateAttachs(srvTaskInfoVO.getListAttach(), chSrvTask.getSrvTaskId());
} else {
// 修改服务计划
// chSrvTaskDetailMapper.delete(new QueryWrapper<ChSrvTaskDetail>().eq("srv_task_id", Long.parseLong(srvTaskId)));//删除原来的计划详情
// chSrvTaskDetailMapper.delete(new QueryWrapper<ChSrvTaskDetail>().eq("srv_task_id", Long.parseLong(srvTaskId)));//删除原来的计划详情
/* if("2".equals(srvTaskInfoVO.getTaskStatus())){
UpdateWrapper updateWrapper1 = new UpdateWrapper();
updateWrapper1.eq("SRV_TASK_ID",srvTaskId);
updateWrapper1.set("STATUS",3);
chSrvTaskDetailMapper.update(null,updateWrapper1);
}*/
// this.insertTaskDetail(Long.parseLong(srvTaskId), taskDetails);
// this.insertTaskDetail(Long.parseLong(srvTaskId), taskDetails);
//修改服务计划
ChSrvTask chSrvTask = new ChSrvTask();
UpdateWrapper updateWrapper = new UpdateWrapper();
updateWrapper.eq("SRV_TASK_ID",srvTaskId);
updateWrapper.eq("SRV_TASK_ID", srvTaskId);
//状态 未分配:0;已分配:1;已终止2
updateWrapper.set("STATUS",srvTaskInfoVO.getTaskStatus());
updateWrapper.set("LCD",new Date());
updateWrapper.set("LCU",param.getUserId());
updateWrapper.set("END_REASON",srvTaskInfoVO.getEndReason());
updateWrapper.set("STATUS", srvTaskInfoVO.getTaskStatus());
updateWrapper.set("LCD", new Date());
updateWrapper.set("LCU", param.getUserId());
updateWrapper.set("END_REASON", srvTaskInfoVO.getEndReason());
srvTaskMapper.update(null,updateWrapper);
srvTaskMapper.update(null, updateWrapper);
//修改附件
// this.updateAttachs(srvTaskInfoVO.getListAttach(), Long.parseLong(srvTaskId));
}
......@@ -192,8 +192,8 @@ public class SrvTaskServiceImpl implements SrvTaskService {
}
public void saveSrvPlan(String programId,String srvPlanTime){
List<ChSrvPlan> chSrvPlans = chSrvPlanMapper.queryPlan(programId,srvPlanTime);
public void saveSrvPlan(String programId, String srvPlanTime) {
List<ChSrvPlan> chSrvPlans = chSrvPlanMapper.queryPlan(programId, srvPlanTime);
for (ChSrvPlan chSrvPlan : chSrvPlans) {
chSrvPlan.setCreationTime(new Date());
chSrvPlanMapper.insert(chSrvPlan);
......@@ -202,7 +202,7 @@ public class SrvTaskServiceImpl implements SrvTaskService {
// mode_id 4
@Override
public void otherPlaceHandler(String programId){
public void otherPlaceHandler(String programId) {
accountFeignService.getOtherPlace(programId);
}
......@@ -242,8 +242,8 @@ public class SrvTaskServiceImpl implements SrvTaskService {
Date programEdnDate = chSrvProgram.getProgramEdnDate();
String programEdnDateStr = DateUtils.dateToStr(programEdnDate);
int i = chSrvSendMapper.updateSrvSendInfo(disabInfoId, programEdnDateStr);
if(i >0 ){
log.info("服务分配{}终止成功",disabInfoId);
if (i > 0) {
log.info("服务分配{}终止成功", disabInfoId);
}
}
}
......@@ -252,13 +252,13 @@ public class SrvTaskServiceImpl implements SrvTaskService {
// 生成计划任务 CH_SRV_TASK_DETAIL
for (AllocationSrvTaskVO chSrvTask : chSrvTasks) {
Long srvTaskId = chSrvTask.getSrvTaskId();
Long srvTaskId = chSrvTask.getSrvTaskId();
// 根据任务id和服务时间查询是否已经生成过计划,已经生成了就不需要再生成了,已退出
int chSrvTaskDetailCount = chSrvTaskDetailMapper
.getSrvTaskDetail(String.valueOf(srvTaskId), dateStr);
if (chSrvTaskDetailCount > 0) {
log.info("{},已经有计划任务了",srvTaskId);
log.info("{},已经有计划任务了", srvTaskId);
continue;
}
ChSrvTaskDetail chSrvTaskDetail = new ChSrvTaskDetail();
......@@ -269,7 +269,7 @@ public class SrvTaskServiceImpl implements SrvTaskService {
chSrvTaskDetailMapper.insert(chSrvTaskDetail);
// ch_srv_plan
String programId = chSrvTask.getProgramId();
saveSrvPlan(programId,dateStr);
saveSrvPlan(programId, dateStr);
}
}
......@@ -277,8 +277,8 @@ public class SrvTaskServiceImpl implements SrvTaskService {
// 补卡
@Transactional(rollbackFor = Exception.class)
@Override
public Result saveApplyCard(SrvPlanInputVO srvPlanInputVO){
log.info("SrvTaskServiceImpl=======saveApplyCard:{}",JSON.toJSONString(srvPlanInputVO));
public Result saveApplyCard(SrvPlanInputVO srvPlanInputVO) {
log.info("SrvTaskServiceImpl=======saveApplyCard:{}", JSON.toJSONString(srvPlanInputVO));
Long taskDetailId = null;
// 先查询是否有计划,有计划了不再生成计划
List<ChSrvTaskDetail> chSrvTaskDetailList = chSrvTaskDetailMapper.selectList(new LambdaQueryWrapper<ChSrvTaskDetail>()
......@@ -288,9 +288,9 @@ public class SrvTaskServiceImpl implements SrvTaskService {
if (CollectionUtil.isNotEmpty(chSrvTaskDetailList)) {
ChSrvTaskDetail chSrvTaskDetail = chSrvTaskDetailList.get(0);
taskDetailId = chSrvTaskDetail.getTaskDetailId();
if(modeId == 3){
int status = chSrvTaskDetailList.stream().map(ChSrvTaskDetail::getStatus).findFirst().orElse((short)0);
if(status == 1 || status == 4) {
if (modeId == 3) {
int status = chSrvTaskDetailList.stream().map(ChSrvTaskDetail::getStatus).findFirst().orElse((short) 0);
if (status == 1 || status == 4) {
return Result.failed("手机app已有任务,不可重复生成");
}
ChSrvTaskDetail chSrvTaskDetailDTO = new ChSrvTaskDetail();
......@@ -306,10 +306,10 @@ public class SrvTaskServiceImpl implements SrvTaskService {
.eq(ChSrvPlan::getDisabInfoId, srvPlanInputVO.getDisabInfoId())
.eq(ChSrvPlan::getSrvPlanTime, srvPlanInputVO.getSrvPlanTime())
.eq(ChSrvPlan::getModeId, srvPlanInputVO.getModeId()));
if(CollectionUtil.isNotEmpty(srvPlanList)){
if (CollectionUtil.isNotEmpty(srvPlanList)) {
return Result.failed("任务列表已有计划,不可重复生成");
}
}else {
} else {
// 插入计划表
ChSrvTaskDetail chSrvTaskDetail = new ChSrvTaskDetail();
......@@ -326,19 +326,19 @@ public class SrvTaskServiceImpl implements SrvTaskService {
chSrvTaskDetail.setClockOperator(srvPlanInputVO.getAdmin());
chSrvTaskDetail.setFcd(new Date());
int insert = chSrvTaskDetailMapper.insert(chSrvTaskDetail);
if(insert == 0){
if (insert == 0) {
return Result.failed("补卡失败,请重新提交");
}
taskDetailId = chSrvTaskDetail.getTaskDetailId();
}
try {
log.info("=======SrvTaskServiceImpl.saveApplyCard.taskDetailId:{}",taskDetailId);
log.info("=======SrvTaskServiceImpl.saveApplyCard.taskDetailId:{}", taskDetailId);
String[] itemIds = srvPlanInputVO.getItemIds();
List<ItemDTO> itemDTOS = chSrvPlanMapper.queryItem(srvPlanInputVO.getSrvOrganId());
for (String r : itemIds) {
ChSrvPlan chSrvPlan = new ChSrvPlan();
ChSrvPlan chSrvPlan = new ChSrvPlan();
chSrvPlan.setItemId(Long.valueOf(r));
if (CollectionUtil.isNotEmpty(itemDTOS)) {
String itemName = itemDTOS.stream().filter(s -> s.getItemId().equals(r)).map(ItemDTO::getItemName).findFirst().orElse(null);
......@@ -352,20 +352,64 @@ public class SrvTaskServiceImpl implements SrvTaskService {
chSrvPlan.setSrvPlanTime(srvPlanInputVO.getSrvPlanTime());
chSrvPlan.setTaskDetailId(taskDetailId);
int insert1 = chSrvPlanMapper.insert(chSrvPlan);
if(insert1==0){
if (insert1 == 0) {
return Result.failed("补卡失败,请重新提交");
}
}
srvPlanInputVO.setTaskDetailId(taskDetailId);
this.updateAttachs(srvPlanInputVO);
} catch (Exception e) {
log.error("=======SrvTaskServiceImpl error {}",e);
log.error("=======SrvTaskServiceImpl===saveApplyCard===error {}", e);
return Result.failed("补卡失败");
}
return Result.success();
}
@Transactional(rollbackFor = Exception.class)
@Override
public Result updateApplyCard(SrvPlanInputVO srvPlanInputVO) {
Long taskDetailId = srvPlanInputVO.getTaskDetailId();
ChSrvTaskDetail chSrvTaskDetailDTO = new ChSrvTaskDetail();
chSrvTaskDetailDTO.setTaskDetailId(taskDetailId);
// 补卡标识
chSrvTaskDetailDTO.setIsClock((short) 1);
chSrvTaskDetailDTO.setCheckStatus((short) 1);
chSrvTaskDetailDTO.setClockReason(srvPlanInputVO.getClockReason());
chSrvTaskDetailDTO.setClockOperator(srvPlanInputVO.getAdmin());
chSrvTaskDetailDTO.setLcd(new Date());
try {
chSrvTaskDetailMapper.updateById(chSrvTaskDetailDTO);
chSrvPlanMapper.delete(new QueryWrapper<ChSrvPlan>().eq("task_detail_id", taskDetailId));
String[] itemIds = srvPlanInputVO.getItemIds();
List<ItemDTO> itemDTOS = chSrvPlanMapper.queryItem(srvPlanInputVO.getSrvOrganId());
for (String r : itemIds) {
ChSrvPlan chSrvPlan = new ChSrvPlan();
chSrvPlan.setItemId(Long.valueOf(r));
if (CollectionUtil.isNotEmpty(itemDTOS)) {
String itemName = itemDTOS.stream().filter(s -> s.getItemId().equals(r)).map(ItemDTO::getItemName).findFirst().orElse(null);
chSrvPlan.setItemName(itemName);
}
chSrvPlan.setSrvOrganId(srvPlanInputVO.getSrvOrganId());
chSrvPlan.setModeId(srvPlanInputVO.getModeId());
chSrvPlan.setCreationTime(new Date());
chSrvPlan.setDisabInfoId(srvPlanInputVO.getDisabInfoId());
chSrvPlan.setEmpId(srvPlanInputVO.getEmpId());
chSrvPlan.setSrvPlanTime(srvPlanInputVO.getSrvPlanTime());
chSrvPlan.setTaskDetailId(taskDetailId);
int insert1 = chSrvPlanMapper.insert(chSrvPlan);
}
this.updateAttachs(srvPlanInputVO);
} catch (Exception e) {
log.error("=======SrvTaskServiceImpl===updateApplyCard===error {}", e);
return Result.failed("补卡修改失败");
}
return Result.success();
}
@Override
public Result auditingCard(AuditingCardVO auditingCardVO){
......
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