取消签约时,删除参数日志表和未执行的任务。

This commit is contained in:
haown 2024-05-24 09:26:54 +08:00
parent e9c4a8619f
commit 17fdd5c280
9 changed files with 165 additions and 108 deletions

View File

@ -9,6 +9,7 @@ import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil; import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.patientnodeparamscurrent.PatientNodeParamsCurrent; import com.xinelu.manage.domain.patientnodeparamscurrent.PatientNodeParamsCurrent;
import com.xinelu.manage.service.patientnodeparamscurrent.IPatientNodeParamsCurrentService; import com.xinelu.manage.service.patientnodeparamscurrent.IPatientNodeParamsCurrentService;
import io.swagger.annotations.Api;
import java.util.List; import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.RestController;
* @author haown * @author haown
* @date 2024-05-20 * @date 2024-05-20
*/ */
@Api(tags = "患者节点参数控制器")
@RestController @RestController
@RequestMapping("/manage/nodeParamsCurrent") @RequestMapping("/manage/nodeParamsCurrent")
public class PatientNodeParamsCurrentController extends BaseController { public class PatientNodeParamsCurrentController extends BaseController {

View File

@ -323,4 +323,8 @@ public class SignPatientManageRouteNode extends BaseEntity {
@ApiModelProperty(value = "节点内容") @ApiModelProperty(value = "节点内容")
@Excel(name = "节点内容") @Excel(name = "节点内容")
private String nodeContent; private String nodeContent;
/** 删除标识0未删除1已删除 */
@ApiModelProperty(value = "删除标识0未删除1已删除")
private Integer delFlag;
} }

View File

@ -42,15 +42,13 @@ public class SignPatientManageRouteNodeDto {
@ApiModelProperty(value = "任务类型列表") @ApiModelProperty(value = "任务类型列表")
private List<String> taskTypeList; private List<String> taskTypeList;
/**
* 患者表主键
*/
@ApiModelProperty(value = "患者表主键")
private Long patientId;
/** /**
* 专病路径节点id * 专病路径节点id
*/ */
@ApiModelProperty(value = "专病路径节点id") @ApiModelProperty(value = "专病路径节点id")
private String routeNodeId; private Long routeNodeId;
/** 节点任务执行状态已执行EXECUTED未执行UNEXECUTED */
@ApiModelProperty(value = "节点任务执行状态已执行EXECUTED未执行UNEXECUTED")
private String nodeExecuteStatus;
} }

View File

@ -1,5 +1,6 @@
package com.xinelu.manage.service.patientnodeparamscurrent.impl; package com.xinelu.manage.service.patientnodeparamscurrent.impl;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.SecurityUtils; import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.bean.BeanUtils; import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.manage.domain.patientnodeparamscurrent.PatientNodeParamsCurrent; import com.xinelu.manage.domain.patientnodeparamscurrent.PatientNodeParamsCurrent;
@ -11,7 +12,7 @@ import com.xinelu.manage.service.signpatientmanageroutenode.ISignPatientManageRo
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -101,16 +102,24 @@ public class PatientNodeParamsCurrentServiceImpl implements IPatientNodeParamsCu
} }
@Override @Override
@Transactional @Transactional(rollbackFor = Exception.class)
public void insertList(List<List<PatientNodeParamsCurrent>> paramsList) { public void insertList(List<List<PatientNodeParamsCurrent>> paramsList) {
if (CollectionUtils.isEmpty(paramsList)) {
throw new ServiceException("传输数据错误");
}
Long patientId = paramsList.get(0).get(0).getPatientId();
if (patientId == null) {
throw new ServiceException("患者信息传输错误");
}
Long routeNodeId = paramsList.get(0).get(0).getRouteNodeId();
if (routeNodeId == null) {
throw new ServiceException("路径节点传输错误");
}
// 多个list组合成一个参数list // 多个list组合成一个参数list
List<PatientNodeParamsCurrent> allList = new ArrayList<>(); List<PatientNodeParamsCurrent> logList = new ArrayList<>();
List<PatientNodeParamsCurrent> saveList = new ArrayList<>(); List<PatientNodeParamsCurrent> saveList = new ArrayList<>();
List<PatientNodeParamsCurrent> updList = new ArrayList<>(); List<PatientNodeParamsCurrent> updList = new ArrayList<>();
List<List<PatientNodeParamsCurrent>> generateTaskList = new ArrayList<>();
List<List<PatientNodeParamsCurrent>> updateTaskList = new ArrayList<>();
for (List<PatientNodeParamsCurrent> paramList : paramsList) { for (List<PatientNodeParamsCurrent> paramList : paramsList) {
AtomicBoolean generateTask = new AtomicBoolean(true);
paramList.forEach(param-> { paramList.forEach(param-> {
if (param.getId() == null) { if (param.getId() == null) {
param.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName()); param.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
@ -120,31 +129,35 @@ public class PatientNodeParamsCurrentServiceImpl implements IPatientNodeParamsCu
param.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName()); param.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName());
param.setUpdateTime(LocalDateTime.now()); param.setUpdateTime(LocalDateTime.now());
updList.add(param); updList.add(param);
generateTask.set(false);
} }
allList.add(param); logList.add(param);
}); });
if (generateTask.get()) {
// 生成任务
generateTaskList.add(paramList);
} else {
// 修改任务
updateTaskList.add(paramList);
}
} }
PatientNodeParamsCurrent paramsCurrentQuery = new PatientNodeParamsCurrent();
paramsCurrentQuery.setPatientId(patientId);
paramsCurrentQuery.setRouteNodeId(routeNodeId);
List<PatientNodeParamsCurrent> paramsOldList = patientNodeParamsCurrentMapper.selectPatientNodeParamsCurrentList(paramsCurrentQuery);
List<Long> deleteIds = paramsOldList.stream().map(PatientNodeParamsCurrent::getId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(updList)) {
// 查询是否有删除的参数
updList.forEach(updParam -> {
patientNodeParamsCurrentMapper.updatePatientNodeParamsCurrent(updParam);
deleteIds.remove(updParam.getId());
});
}
// 删除参数
if (CollectionUtils.isNotEmpty(deleteIds)) {
patientNodeParamsCurrentMapper.deletePatientNodeParamsCurrentByIds(deleteIds.stream().toArray(Long[]::new));
}
// 新增的参数保存
if (CollectionUtils.isNotEmpty(saveList)) { if (CollectionUtils.isNotEmpty(saveList)) {
patientNodeParamsCurrentMapper.insertList(saveList); patientNodeParamsCurrentMapper.insertList(saveList);
} }
if (CollectionUtils.isNotEmpty(updList)) {
updList.forEach(updParam -> {
patientNodeParamsCurrentMapper.updatePatientNodeParamsCurrent(updParam);
});
}
// 保存参数日志表 // 保存参数日志表
List<PatientNodeParamsLog> paramsLogList = new ArrayList<>(); List<PatientNodeParamsLog> paramsLogList = new ArrayList<>();
allList.forEach(paramCurrent -> { logList.forEach(paramCurrent -> {
PatientNodeParamsLog paramsLog = new PatientNodeParamsLog(); PatientNodeParamsLog paramsLog = new PatientNodeParamsLog();
BeanUtils.copyBeanProp(paramsLog, paramCurrent); BeanUtils.copyBeanProp(paramsLog, paramCurrent);
paramsLog.setId(null); paramsLog.setId(null);
@ -154,13 +167,8 @@ public class PatientNodeParamsCurrentServiceImpl implements IPatientNodeParamsCu
}); });
patientNodeParamsLogMapper.insertList(paramsLogList); patientNodeParamsLogMapper.insertList(paramsLogList);
// 生成任务 // 生成任务
if (CollectionUtils.isNotEmpty(generateTaskList)) { manageRouteNodeService.updateTask(paramsList);
manageRouteNodeService.generateTask(generateTaskList);
}
// 修改任务
if (CollectionUtils.isNotEmpty(updateTaskList)) {
manageRouteNodeService.updateTask(updateTaskList);
}
} }
} }

View File

@ -106,12 +106,6 @@ public interface ISignPatientManageRouteNodeService {
List<PatientSpecialDiseaseNodeVo> getSpecialDiseaseNode(PatientTaskDto patientTaskDto); List<PatientSpecialDiseaseNodeVo> getSpecialDiseaseNode(PatientTaskDto patientTaskDto);
/**
* 根据参数列表生成任务
* @param paramsCurrentLists 参数列表
*/
void generateTask(List<List<PatientNodeParamsCurrent>> paramsCurrentLists);
/** /**
* 根据参数列表修改任务 * 根据参数列表修改任务
* @param paramsCurrentLists 参数列表 * @param paramsCurrentLists 参数列表

View File

@ -210,6 +210,8 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
@Override @Override
public int insertSignPatientManageRouteNode(SignPatientManageRouteNode signPatientManageRouteNode) { public int insertSignPatientManageRouteNode(SignPatientManageRouteNode signPatientManageRouteNode) {
signPatientManageRouteNode.setCreateTime(LocalDateTime.now()); signPatientManageRouteNode.setCreateTime(LocalDateTime.now());
signPatientManageRouteNode.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
signPatientManageRouteNode.setDelFlag(0);
return signPatientManageRouteNodeMapper.insertSignPatientManageRouteNode(signPatientManageRouteNode); return signPatientManageRouteNodeMapper.insertSignPatientManageRouteNode(signPatientManageRouteNode);
} }
@ -222,6 +224,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
@Override @Override
public int updateSignPatientManageRouteNode(SignPatientManageRouteNode signPatientManageRouteNode) { public int updateSignPatientManageRouteNode(SignPatientManageRouteNode signPatientManageRouteNode) {
signPatientManageRouteNode.setUpdateTime(LocalDateTime.now()); signPatientManageRouteNode.setUpdateTime(LocalDateTime.now());
signPatientManageRouteNode.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName());
return signPatientManageRouteNodeMapper.updateSignPatientManageRouteNode(signPatientManageRouteNode); return signPatientManageRouteNodeMapper.updateSignPatientManageRouteNode(signPatientManageRouteNode);
} }
@ -380,31 +383,19 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
return specialDiseaseNodeMapper.selectRouteNodeByRouteId(manageRouteList.get(0).getRouteId()); return specialDiseaseNodeMapper.selectRouteNodeByRouteId(manageRouteList.get(0).getRouteId());
} }
@Override private void generateTask(Long routeNodeId, Long manageRouteId, String manageRouteName, List<List<PatientNodeParamsCurrent>> paramsCurrentLists) {
@Transactional(rollbackFor = Exception.class)
public void generateTask(List<List<PatientNodeParamsCurrent>> paramsCurrentLists) {
// 查询患者
PatientInfo patientInfo = patientInfoMapper.selectPatientInfoById(paramsCurrentLists.get(0).get(0).getPatientId());
SignPatientManageRoute routeQuery = new SignPatientManageRoute();
routeQuery.setSignPatientRecordId(patientInfo.getSignPatientRecordId());
routeQuery.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE);
List<SignPatientManageRoute> manageRouteList = signRouteMapper.selectSignPatientManageRouteList(routeQuery);
if (CollectionUtils.isEmpty(manageRouteList)) {
throw new ServiceException("未找到签约管理路径");
}
// 查询专病路径节点 // 查询专病路径节点
SpecialDiseaseNode specialDiseaseNode = specialDiseaseNodeMapper.selectSpecialDiseaseNodeById(paramsCurrentLists.get(0).get(0).getRouteNodeId()); SpecialDiseaseNode specialDiseaseNode = specialDiseaseNodeMapper.selectSpecialDiseaseNodeById(routeNodeId);
if (ObjectUtils.isEmpty(specialDiseaseNode)) { if (ObjectUtils.isEmpty(specialDiseaseNode)) {
throw new ServiceException("数据错误,请联系管理员"); throw new ServiceException("数据错误,请联系管理员");
} }
List<SignPatientManageRouteNode> manageNodeList = new ArrayList<>(); List<SignPatientManageRouteNode> manageNodeList = new ArrayList<>();
for (List<PatientNodeParamsCurrent> paramsCurrentList : paramsCurrentLists) { for (List<PatientNodeParamsCurrent> paramsCurrentList : paramsCurrentLists) {
List<SignPatientManageRouteNode> nodeList = paramsCurrentList.stream().map(params -> {
SignPatientManageRouteNode manageRouteNode = new SignPatientManageRouteNode(); SignPatientManageRouteNode manageRouteNode = new SignPatientManageRouteNode();
BeanUtils.copyBeanProp(manageRouteNode, specialDiseaseNode); BeanUtils.copyBeanProp(manageRouteNode, specialDiseaseNode);
manageRouteNode.setManageRouteId(manageRouteList.get(0).getId()); manageRouteNode.setManageRouteId(manageRouteId);
manageRouteNode.setManageRouteName(manageRouteList.get(0).getRouteName()); manageRouteNode.setManageRouteName(manageRouteName);
manageRouteNode.setId(null); manageRouteNode.setId(null);
manageRouteNode.setRouteNodeId(specialDiseaseNode.getId()); manageRouteNode.setRouteNodeId(specialDiseaseNode.getId());
manageRouteNode.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo()); manageRouteNode.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo());
@ -415,9 +406,8 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
manageRouteNode.setNodeContent(replaceNodeContent(specialDiseaseNode.getNodeContent(), paramsCurrentList)); manageRouteNode.setNodeContent(replaceNodeContent(specialDiseaseNode.getNodeContent(), paramsCurrentList));
manageRouteNode.setCreateTime(LocalDateTime.now()); manageRouteNode.setCreateTime(LocalDateTime.now());
manageRouteNode.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName()); manageRouteNode.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
return manageRouteNode;
}).collect(Collectors.toList()); manageNodeList.add(manageRouteNode);
manageNodeList.addAll(nodeList);
} }
// 批量保存 // 批量保存
@ -428,7 +418,12 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void updateTask(List<List<PatientNodeParamsCurrent>> paramsCurrentLists) { public void updateTask(List<List<PatientNodeParamsCurrent>> paramsCurrentLists) {
// 查询患者 // 查询患者
PatientInfo patientInfo = patientInfoMapper.selectPatientInfoById(paramsCurrentLists.get(0).get(0).getPatientId()); Long patientId = paramsCurrentLists.get(0).get(0).getPatientId();
if (patientId == null) {
throw new ServiceException("未找到该患者");
}
// 查询患者
PatientInfo patientInfo = patientInfoMapper.selectPatientInfoById(patientId);
SignPatientManageRoute routeQuery = new SignPatientManageRoute(); SignPatientManageRoute routeQuery = new SignPatientManageRoute();
routeQuery.setSignPatientRecordId(patientInfo.getSignPatientRecordId()); routeQuery.setSignPatientRecordId(patientInfo.getSignPatientRecordId());
routeQuery.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE); routeQuery.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE);
@ -438,22 +433,21 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
} }
SignPatientManageRouteNodeDto signPatientManageRouteNodeDto = new SignPatientManageRouteNodeDto(); SignPatientManageRouteNodeDto signPatientManageRouteNodeDto = new SignPatientManageRouteNodeDto();
signPatientManageRouteNodeDto.setPatientId(paramsCurrentLists.get(0).get(0).getPatientId());
signPatientManageRouteNodeDto.setManageRouteId(manageRouteList.get(0).getId()); signPatientManageRouteNodeDto.setManageRouteId(manageRouteList.get(0).getId());
signPatientManageRouteNodeDto.setRouteNodeId(paramsCurrentLists.get(0).get(0).getRouteNodeId());
List<SignPatientManageRouteNode> manageNodeList = signPatientManageRouteNodeMapper.selectSignPatientManageRouteNodeList(signPatientManageRouteNodeDto); List<SignPatientManageRouteNode> manageNodeList = signPatientManageRouteNodeMapper.selectSignPatientManageRouteNodeList(signPatientManageRouteNodeDto);
if (CollectionUtils.isEmpty(manageRouteList)) { if (CollectionUtils.isEmpty(manageNodeList)) {
// 生成任务 // 生成任务
generateTask(paramsCurrentLists); generateTask(paramsCurrentLists.get(0).get(0).getRouteNodeId(), manageRouteList.get(0).getId(),manageRouteList.get(0).getRouteName(), paramsCurrentLists);
} else { } else {
if (StringUtils.equals(NodeExecuteStatusEnum.EXECUTED.getInfo(), manageNodeList.get(0).getNodeExecuteStatus())) { if (StringUtils.equals(NodeExecuteStatusEnum.EXECUTED.getInfo(), manageNodeList.get(0).getNodeExecuteStatus())) {
// 任务已执行不修改 // 任务已执行不修改
throw new ServiceException("任务已执行,修改失败");
} else { } else {
// 逐条修改任务nodeContent // 删除任务重新生成
for (int i = 0; i < manageNodeList.size(); i++) { Long[] nodeIds = manageNodeList.stream().map(SignPatientManageRouteNode::getId).toArray(Long[]::new);
SignPatientManageRouteNode node = manageNodeList.get(i); signPatientManageRouteNodeMapper.deleteSignPatientManageRouteNodeByIds(nodeIds);
node.setNodeContent(replaceNodeContent(node.getNodeContent(), paramsCurrentLists.get(i))); generateTask(paramsCurrentLists.get(0).get(0).getRouteNodeId(),manageRouteList.get(0).getId(),manageRouteList.get(0).getRouteName(), paramsCurrentLists);
signPatientManageRouteNodeMapper.updateSignPatientManageRouteNode(node);
}
} }
} }
} }
@ -464,16 +458,9 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
// 需要提取的span // 需要提取的span
Elements spanlist = document.select("span[data-w-e-type]"); Elements spanlist = document.select("span[data-w-e-type]");
for (Element span : spanlist) { for (Element span : spanlist) {
PatientNodeParamsCurrent nodeParam = new PatientNodeParamsCurrent();
String paramKey = span.attr("data-fieldMark"); String paramKey = span.attr("data-fieldMark");
span.text(map.getOrDefault(paramKey, "")) span.text(map.getOrDefault(paramKey, ""));
.removeAttr("data-w-e-type") span.unwrap();
.removeAttr("data-fieldMark")
.removeAttr("data-link")
.removeAttr("data-w-e-is-void")
.removeAttr("data-w-e-is-inline")
.removeAttr("data-filespan")
.removeAttr("data-filename");
} }
return document.body().html(); return document.body().html();
} }
@ -559,20 +546,24 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
String paramKey = span.attr("data-fieldMark"); String paramKey = span.attr("data-fieldMark");
String text = json.getOrDefault(paramKey, "").toString(); String text = json.getOrDefault(paramKey, "").toString();
//span.replaceWith(new TextNode("<p>" + text +"</p")); //span.replaceWith(new TextNode("<p>" + text +"</p"));
span.text(text) span.text(text);
.removeAttr("id") // .removeAttr("id")
.removeAttr("class") // .removeAttr("class")
.removeAttr("data-w-e-type") // .removeAttr("data-w-e-type")
.removeAttr("data-link") // .removeAttr("data-link")
.removeAttr("data-w-e-is-void") // .removeAttr("data-w-e-is-void")
.removeAttr("data-w-e-is-inline") // .removeAttr("data-w-e-is-inline")
.removeAttr("data-fieldmark") // .removeAttr("data-fieldmark")
.removeAttr("data-filespan") // .removeAttr("data-filespan")
.removeAttr("data-filename"); // .removeAttr("data-filename");
span.unwrap();
//Element newSpan = new Element(Tag.valueOf("c"), "");
//newSpan.text(text);
//span.replaceWith(newSpan);
} }
//Elements element = document.getElementsByTag("p"); //Elements element = document.getElementsByTag("p");
//System.out.println("---------------------\n"+element.get(0).html()); //System.out.println("---------------------\n"+element.get(0).html());
System.out.println(document.body().html()); //System.out.println(document.body().html());
} }

View File

@ -9,6 +9,7 @@ import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.StringUtils; import com.xinelu.common.utils.StringUtils;
import com.xinelu.common.utils.bean.BeanUtils; import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.manage.domain.patientinfo.PatientInfo; import com.xinelu.manage.domain.patientinfo.PatientInfo;
import com.xinelu.manage.domain.patientnodeparamslog.PatientNodeParamsLog;
import com.xinelu.manage.domain.signpatientinformed.SignPatientInformed; import com.xinelu.manage.domain.signpatientinformed.SignPatientInformed;
import com.xinelu.manage.domain.signpatientmanageroute.SignPatientManageRoute; import com.xinelu.manage.domain.signpatientmanageroute.SignPatientManageRoute;
import com.xinelu.manage.domain.signpatientmanageroutenode.SignPatientManageRouteNode; import com.xinelu.manage.domain.signpatientmanageroutenode.SignPatientManageRouteNode;
@ -19,12 +20,14 @@ import com.xinelu.manage.domain.signroutetriggercondition.SignRouteTriggerCondit
import com.xinelu.manage.domain.specialdiseasenode.SpecialDiseaseNode; import com.xinelu.manage.domain.specialdiseasenode.SpecialDiseaseNode;
import com.xinelu.manage.domain.specialdiseaseroute.SpecialDiseaseRoute; import com.xinelu.manage.domain.specialdiseaseroute.SpecialDiseaseRoute;
import com.xinelu.manage.domain.specialdiseasetriggercondition.SpecialDiseaseTriggerCondition; import com.xinelu.manage.domain.specialdiseasetriggercondition.SpecialDiseaseTriggerCondition;
import com.xinelu.manage.dto.signpatientmanageroutenode.SignPatientManageRouteNodeDto;
import com.xinelu.manage.dto.signpatientpackage.SignPatientPackageSaveDto; import com.xinelu.manage.dto.signpatientpackage.SignPatientPackageSaveDto;
import com.xinelu.manage.dto.signpatientrecord.IntentionalSignDto; import com.xinelu.manage.dto.signpatientrecord.IntentionalSignDto;
import com.xinelu.manage.dto.signpatientrecord.SignPatientAddDto; import com.xinelu.manage.dto.signpatientrecord.SignPatientAddDto;
import com.xinelu.manage.dto.signpatientrecord.SignPatientListDto; import com.xinelu.manage.dto.signpatientrecord.SignPatientListDto;
import com.xinelu.manage.dto.signpatientrecord.SignPatientStatusDto; import com.xinelu.manage.dto.signpatientrecord.SignPatientStatusDto;
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper; import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
import com.xinelu.manage.mapper.patientnodeparamslog.PatientNodeParamsLogMapper;
import com.xinelu.manage.mapper.signpatientinformed.SignPatientInformedMapper; import com.xinelu.manage.mapper.signpatientinformed.SignPatientInformedMapper;
import com.xinelu.manage.mapper.signpatientmanageroute.SignPatientManageRouteMapper; import com.xinelu.manage.mapper.signpatientmanageroute.SignPatientManageRouteMapper;
import com.xinelu.manage.mapper.signpatientmanageroutenode.SignPatientManageRouteNodeMapper; import com.xinelu.manage.mapper.signpatientmanageroutenode.SignPatientManageRouteNodeMapper;
@ -40,6 +43,7 @@ import com.xinelu.manage.vo.signpatientrecord.SignPatientInfoVo;
import com.xinelu.manage.vo.signpatientrecord.SignPatientListVo; import com.xinelu.manage.vo.signpatientrecord.SignPatientListVo;
import com.xinelu.manage.vo.signpatientrecord.SignPatientRecordVo; import com.xinelu.manage.vo.signpatientrecord.SignPatientRecordVo;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -58,7 +62,6 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService {
@Resource @Resource
private SignPatientRecordMapper signPatientRecordMapper; private SignPatientRecordMapper signPatientRecordMapper;
@Resource @Resource
private SignPatientPackageMapper signPatientPackageMapper; private SignPatientPackageMapper signPatientPackageMapper;
@Resource @Resource
@ -83,6 +86,8 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService {
private SpecialDiseaseTriggerConditionMapper triggerConditionMapper; private SpecialDiseaseTriggerConditionMapper triggerConditionMapper;
@Resource @Resource
private SignRouteTriggerConditionMapper signRouteTriggerConditionMapper; private SignRouteTriggerConditionMapper signRouteTriggerConditionMapper;
@Resource
private PatientNodeParamsLogMapper patientNodeParamsLogMapper;
@Override public List<SignPatientListVo> selectList(SignPatientListDto signPatientRecord) { @Override public List<SignPatientListVo> selectList(SignPatientListDto signPatientRecord) {
return signPatientRecordMapper.selectList(signPatientRecord); return signPatientRecordMapper.selectList(signPatientRecord);
@ -201,6 +206,7 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService {
manageRouteNode.setRouteCheckRemark("签约自动审核通过"); manageRouteNode.setRouteCheckRemark("签约自动审核通过");
manageRouteNode.setNodeExecuteStatus(NodeExecuteStatusEnum.UNEXECUTED.getInfo()); manageRouteNode.setNodeExecuteStatus(NodeExecuteStatusEnum.UNEXECUTED.getInfo());
manageRouteNode.setRouteNodeId(node.getId()); manageRouteNode.setRouteNodeId(node.getId());
manageRouteNode.setDelFlag(0);
manageRouteNode.setCreateTime(LocalDateTime.now()); manageRouteNode.setCreateTime(LocalDateTime.now());
manageRouteNode.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName()); manageRouteNode.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
return manageRouteNode; return manageRouteNode;
@ -268,6 +274,37 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService {
patient.setSignStatus(patientCancelSignDto.getSignStatus()); patient.setSignStatus(patientCancelSignDto.getSignStatus());
patient.setServiceStatus(patientCancelSignDto.getServiceStatus()); patient.setServiceStatus(patientCancelSignDto.getServiceStatus());
patientInfoMapper.updatePatientInfoSelective(patient); patientInfoMapper.updatePatientInfoSelective(patient);
// 删除patient_node_params_currentpatient_node_params_log
// 查询signPatientManageRoute
SignPatientManageRoute manageRouteQuery = new SignPatientManageRoute();
manageRouteQuery.setSignPatientRecordId(patientCancelSignDto.getId());
List<SignPatientManageRoute> manageRouteList = signPatientManageRouteMapper.selectSignPatientManageRouteList(manageRouteQuery);
List<Long> logDelIds = new ArrayList<>();
List<Long> nodeDelIds = new ArrayList<>();
for (SignPatientManageRoute manageRoute : manageRouteList) {
// 删除patient_node_params_log
PatientNodeParamsLog paramsLogQuery = new PatientNodeParamsLog();
paramsLogQuery.setRouteId(manageRoute.getRouteId());
List<PatientNodeParamsLog> paramsLogList = patientNodeParamsLogMapper.selectPatientNodeParamsLogList(paramsLogQuery);
List<Long> logIds = paramsLogList.stream().map(PatientNodeParamsLog::getId).collect(Collectors.toList());
logDelIds.addAll(logIds);
// 未执行的任务删除
SignPatientManageRouteNodeDto manageRouteNodeDto = new SignPatientManageRouteNodeDto();
manageRouteNodeDto.setManageRouteId(manageRoute.getId());
manageRouteNodeDto.setNodeExecuteStatus(NodeExecuteStatusEnum.UNEXECUTED.getInfo());
List<SignPatientManageRouteNode> manageNodeList = manageRouteNodeMapper.selectSignPatientManageRouteNodeList(manageRouteNodeDto);
List<Long> nodeIds = manageNodeList.stream().map(SignPatientManageRouteNode::getId).collect(Collectors.toList());
nodeDelIds.addAll(nodeIds);
}
if (!CollectionUtils.isEmpty(logDelIds)) {
patientNodeParamsLogMapper.deletePatientNodeParamsLogByIds(logDelIds.stream().toArray(Long[]::new));
}
if (!CollectionUtils.isEmpty(nodeDelIds)) {
manageRouteNodeMapper.deleteSignPatientManageRouteNodeByIds(nodeDelIds.stream().toArray(Long[]::new));
}
} }
return signPatientRecordMapper.updateByPrimaryKeySelective(signRecord); return signPatientRecordMapper.updateByPrimaryKeySelective(signRecord);
} }

View File

@ -8,6 +8,7 @@
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="manageRouteId" column="manage_route_id"/> <result property="manageRouteId" column="manage_route_id"/>
<result property="manageRouteName" column="manage_route_name"/> <result property="manageRouteName" column="manage_route_name"/>
<result property="routeNodeId" column="route_node_id"/>
<result property="routeNodeName" column="route_node_name"/> <result property="routeNodeName" column="route_node_name"/>
<result property="routeNodeDay" column="route_node_day"/> <result property="routeNodeDay" column="route_node_day"/>
<result property="taskType" column="task_type"/> <result property="taskType" column="task_type"/>
@ -63,6 +64,7 @@
<result property="routeLink" column="route_link"/> <result property="routeLink" column="route_link"/>
<result property="textRemindContent" column="text_remind_content"/> <result property="textRemindContent" column="text_remind_content"/>
<result property="nodeContent" column="node_content"/> <result property="nodeContent" column="node_content"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/> <result property="updateBy" column="update_by"/>
@ -70,18 +72,22 @@
</resultMap> </resultMap>
<sql id="selectSignPatientManageRouteNodeVo"> <sql id="selectSignPatientManageRouteNodeVo">
select id, manage_route_id, manage_route_name, route_node_name, route_node_day, task_type, task_status, task_subdivision, second_classify_describe, execute_time, phone_push_sign, phone_id, phone_template_id, phone_template_name, phone_node_content, phone_redial_times, phone_time_interval, phone_message_remind, phone_message_template_id, phone_message_template_name, question_info_id, questionnaire_name, questionnaire_content, question_expiration_date, propaganda_info_id, propaganda_title, propaganda_content, message_push_sign, message_template_id, message_template_name, message_preview, message_node_content, official_push_sign, official_template_id, official_template_name, official_remind_content, official_node_content, applet_push_sign, applet_template_id, applet_template_name, applet_remind_content, applet_prompt_description, applet_node_content, follow_template_id, follow_template_name, follow_content, route_check_status, route_check_person, route_check_date, route_check_remark, route_node_remark, node_execute_status, route_handle_remark, route_handle_id, route_handle_person, route_link,text_remind_content, node_content, create_by, create_time, update_by, update_time from sign_patient_manage_route_node select id, manage_route_id, manage_route_name, route_node_id, route_node_name, route_node_day, task_type, task_status, task_subdivision, second_classify_describe, execute_time, phone_push_sign, phone_id, phone_template_id, phone_template_name, phone_node_content, phone_redial_times, phone_time_interval, phone_message_remind, phone_message_template_id, phone_message_template_name, question_info_id, questionnaire_name, questionnaire_content, question_expiration_date, propaganda_info_id, propaganda_title, propaganda_content, message_push_sign, message_template_id, message_template_name, message_preview, message_node_content, official_push_sign, official_template_id, official_template_name, official_remind_content, official_node_content, applet_push_sign, applet_template_id, applet_template_name, applet_remind_content, applet_prompt_description, applet_node_content, follow_template_id, follow_template_name, follow_content, route_check_status, route_check_person, route_check_date, route_check_remark, route_node_remark, node_execute_status, route_handle_remark, route_handle_id, route_handle_person, route_link,text_remind_content, node_content, del_flag, create_by, create_time, update_by, update_time from sign_patient_manage_route_node
</sql> </sql>
<select id="selectSignPatientManageRouteNodeList" parameterType="com.xinelu.manage.dto.signpatientmanageroutenode.SignPatientManageRouteNodeDto" resultMap="SignPatientManageRouteNodeResult"> <select id="selectSignPatientManageRouteNodeList" parameterType="com.xinelu.manage.dto.signpatientmanageroutenode.SignPatientManageRouteNodeDto" resultMap="SignPatientManageRouteNodeResult">
<include refid="selectSignPatientManageRouteNodeVo"/> <include refid="selectSignPatientManageRouteNodeVo"/>
<where> <where>
del_flag = 0
<if test="manageRouteId != null "> <if test="manageRouteId != null ">
and manage_route_id = #{manageRouteId} and manage_route_id = #{manageRouteId}
</if> </if>
<if test="manageRouteName != null and manageRouteName != ''"> <if test="manageRouteName != null and manageRouteName != ''">
and manage_route_name like concat('%', #{manageRouteName}, '%') and manage_route_name like concat('%', #{manageRouteName}, '%')
</if> </if>
<if test="routeNodeId != null">
and route_node_id = #{routeNodeId}
</if>
<if test="routeNodeName != null and routeNodeName != ''"> <if test="routeNodeName != null and routeNodeName != ''">
and route_node_name like concat('%', #{routeNodeName}, '%') and route_node_name like concat('%', #{routeNodeName}, '%')
</if> </if>
@ -100,6 +106,9 @@
task_type = #{item} task_type = #{item}
</foreach> </foreach>
</if> </if>
<if test="nodeExecuteStatus != null and nodeExecuteStatus != ''">
and node_execute_status = #{nodeExecuteStatus}
</if>
</where> </where>
</select> </select>
@ -110,7 +119,7 @@
<select id="getNodeList" parameterType="com.xinelu.manage.dto.signpatientmanageroutenode.PatientTaskDto" <select id="getNodeList" parameterType="com.xinelu.manage.dto.signpatientmanageroutenode.PatientTaskDto"
resultMap="SignPatientManageRouteNodeResult"> resultMap="SignPatientManageRouteNodeResult">
select node.id, node.manage_route_id, node.manage_route_name, node.route_node_name, node.route_node_day, node.task_type, select node.id, node.manage_route_id, node.manage_route_name, node.route_node_id, node.route_node_name, node.route_node_day, node.task_type,
node.task_status, node.task_subdivision,node.second_classify_describe, node.execute_time, node.phone_push_sign, node.phone_id, node.task_status, node.task_subdivision,node.second_classify_describe, node.execute_time, node.phone_push_sign, node.phone_id,
node.phone_template_id, node.phone_template_name, node.phone_node_content, node.phone_redial_times, node.phone_time_interval, node.phone_template_id, node.phone_template_name, node.phone_node_content, node.phone_redial_times, node.phone_time_interval,
node.phone_message_remind, node.phone_message_template_id, node.phone_message_template_name, node.phone_message_remind, node.phone_message_template_id, node.phone_message_template_name,
@ -125,6 +134,7 @@
from sign_patient_manage_route_node node from sign_patient_manage_route_node node
left join sign_patient_manage_route route on node.manage_route_id = route.id left join sign_patient_manage_route route on node.manage_route_id = route.id
<where> <where>
node.del_flag = 0
<if test="patientId != null"> <if test="patientId != null">
and route.patient_id = #{patientId} and route.patient_id = #{patientId}
</if> </if>
@ -159,6 +169,8 @@
</if> </if>
<if test="manageRouteName != null">manage_route_name, <if test="manageRouteName != null">manage_route_name,
</if> </if>
<if test="routeNodeId != null">route_node_id,
</if>
<if test="routeNodeName != null">route_node_name, <if test="routeNodeName != null">route_node_name,
</if> </if>
<if test="routeNodeDay != null">route_node_day, <if test="routeNodeDay != null">route_node_day,
@ -269,6 +281,8 @@
</if> </if>
<if test="nodeContent != null">node_content, <if test="nodeContent != null">node_content,
</if> </if>
<if test="delFlag != null">del_flag,
</if>
<if test="createBy != null">create_by, <if test="createBy != null">create_by,
</if> </if>
<if test="createTime != null">create_time, <if test="createTime != null">create_time,
@ -283,6 +297,8 @@
</if> </if>
<if test="manageRouteName != null">#{manageRouteName}, <if test="manageRouteName != null">#{manageRouteName},
</if> </if>
<if test="routeNodeId != null">#{routeNodeId},
</if>
<if test="routeNodeName != null">#{routeNodeName}, <if test="routeNodeName != null">#{routeNodeName},
</if> </if>
<if test="routeNodeDay != null">#{routeNodeDay}, <if test="routeNodeDay != null">#{routeNodeDay},
@ -393,6 +409,8 @@
</if> </if>
<if test="nodeContent != null">#{nodeContent}, <if test="nodeContent != null">#{nodeContent},
</if> </if>
<if test="delFlag != null">#{delFlag},
</if>
<if test="createBy != null">#{createBy}, <if test="createBy != null">#{createBy},
</if> </if>
<if test="createTime != null">#{createTime}, <if test="createTime != null">#{createTime},
@ -404,22 +422,22 @@
</trim> </trim>
</insert> </insert>
<insert id="insertBatch"> <insert id="insertBatch">
insert into sign_patient_manage_route_node(manage_route_id, manage_route_name, route_node_name, route_node_day, task_type, task_status, task_subdivision, second_classify_describe, insert into sign_patient_manage_route_node(manage_route_id, manage_route_name, route_node_id, route_node_name, route_node_day, task_type, task_status, task_subdivision, second_classify_describe,
execute_time, phone_push_sign, phone_id, phone_template_id, phone_template_name, phone_node_content, phone_redial_times, phone_time_interval, phone_message_remind, phone_message_template_id, execute_time, phone_push_sign, phone_id, phone_template_id, phone_template_name, phone_node_content, phone_redial_times, phone_time_interval, phone_message_remind, phone_message_template_id,
phone_message_template_name, question_info_id, questionnaire_name, questionnaire_content, question_expiration_date, propaganda_info_id, propaganda_title, propaganda_content, message_push_sign, phone_message_template_name, question_info_id, questionnaire_name, questionnaire_content, question_expiration_date, propaganda_info_id, propaganda_title, propaganda_content, message_push_sign,
message_template_id, message_template_name, message_preview, message_node_content, official_push_sign, official_template_id, official_template_name, official_remind_content, message_template_id, message_template_name, message_preview, message_node_content, official_push_sign, official_template_id, official_template_name, official_remind_content,
official_node_content, applet_push_sign, applet_template_id, applet_template_name, applet_remind_content, applet_prompt_description, applet_node_content, follow_template_id, official_node_content, applet_push_sign, applet_template_id, applet_template_name, applet_remind_content, applet_prompt_description, applet_node_content, follow_template_id,
follow_template_name, follow_content, route_check_status, route_check_person, route_check_date, route_check_remark, route_node_remark, node_execute_status, route_handle_remark, follow_template_name, follow_content, route_check_status, route_check_person, route_check_date, route_check_remark, route_node_remark, node_execute_status, route_handle_remark,
route_handle_id, route_handle_person, route_link, text_remind_content,node_content, create_by, create_time, update_by, update_time) route_handle_id, route_handle_person, route_link, text_remind_content,node_content, del_flag, create_by, create_time, update_by, update_time)
values values
<foreach collection="nodeList" item="item" separator=","> <foreach collection="nodeList" item="item" separator=",">
(#{item.manageRouteId},#{item.manageRouteName},#{item.routeNodeName},#{item.routeNodeDay},#{item.taskType},#{item.taskStatus},#{item.taskSubdivision},#{item.secondClassifyDescribe}, (#{item.manageRouteId},#{item.manageRouteName},#{item.routeNodeId},#{item.routeNodeName},#{item.routeNodeDay},#{item.taskType},#{item.taskStatus},#{item.taskSubdivision},#{item.secondClassifyDescribe},
#{item.executeTime},#{item.phonePushSign},#{item.phoneId},#{item.phoneTemplateId},#{item.phoneTemplateName},#{item.phoneNodeContent},#{item.phoneRedialTimes},#{item.phoneTimeInterval},#{item.phoneMessageRemind},#{item.phoneMessageTemplateId},#{item.phoneMessageTemplateName}, #{item.executeTime},#{item.phonePushSign},#{item.phoneId},#{item.phoneTemplateId},#{item.phoneTemplateName},#{item.phoneNodeContent},#{item.phoneRedialTimes},#{item.phoneTimeInterval},#{item.phoneMessageRemind},#{item.phoneMessageTemplateId},#{item.phoneMessageTemplateName},
#{item.questionInfoId},#{item.questionnaireName},#{item.questionnaireContent},#{item.questionExpirationDate},#{item.propagandaInfoId},#{item.propagandaTitle},#{item.propagandaContent},#{item.messagePushSign},#{item.messageTemplateId}, #{item.questionInfoId},#{item.questionnaireName},#{item.questionnaireContent},#{item.questionExpirationDate},#{item.propagandaInfoId},#{item.propagandaTitle},#{item.propagandaContent},#{item.messagePushSign},#{item.messageTemplateId},
#{item.messageTemplateName},#{item.messagePreview},#{item.messageNodeContent},#{item.officialPushSign},#{item.officialTemplateId},#{item.officialTemplateName},#{item.officialRemindContent},#{item.officialNodeContent}, #{item.messageTemplateName},#{item.messagePreview},#{item.messageNodeContent},#{item.officialPushSign},#{item.officialTemplateId},#{item.officialTemplateName},#{item.officialRemindContent},#{item.officialNodeContent},
#{item.appletPushSign},#{item.appletTemplateId},#{item.appletTemplateName},#{item.appletRemindContent},#{item.appletPromptDescription},#{item.appletNodeContent},#{item.followTemplateId}, #{item.appletPushSign},#{item.appletTemplateId},#{item.appletTemplateName},#{item.appletRemindContent},#{item.appletPromptDescription},#{item.appletNodeContent},#{item.followTemplateId},
#{item.followTemplateName},#{item.followContent},#{item.routeCheckStatus},#{item.routeCheckPerson},#{item.routeCheckDate},#{item.routeCheckRemark},#{item.routeNodeRemark},#{item.nodeExecuteStatus},#{item.routeHandleRemark}, #{item.followTemplateName},#{item.followContent},#{item.routeCheckStatus},#{item.routeCheckPerson},#{item.routeCheckDate},#{item.routeCheckRemark},#{item.routeNodeRemark},#{item.nodeExecuteStatus},#{item.routeHandleRemark},
#{item.routeHandleId},#{item.routeHandlePerson},#{item.routeLink},#{item.textRemindContent},#{item.nodeContent},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime}) #{item.routeHandleId},#{item.routeHandlePerson},#{item.routeLink},#{item.textRemindContent},#{item.nodeContent},0,#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime})
</foreach> </foreach>
</insert> </insert>
<update id="updateSignPatientManageRouteNode" parameterType="SignPatientManageRouteNode"> <update id="updateSignPatientManageRouteNode" parameterType="SignPatientManageRouteNode">
@ -431,6 +449,9 @@
<if test="manageRouteName != null">manage_route_name = <if test="manageRouteName != null">manage_route_name =
#{manageRouteName}, #{manageRouteName},
</if> </if>
<if test="routeNodeId != null">route_node_id =
#{routeNodeId},
</if>
<if test="routeNodeName != null">route_node_name = <if test="routeNodeName != null">route_node_name =
#{routeNodeName}, #{routeNodeName},
</if> </if>
@ -596,7 +617,9 @@
<if test="nodeContent != null">node_content = <if test="nodeContent != null">node_content =
#{nodeContent}, #{nodeContent},
</if> </if>
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
<if test="createBy != null">create_by = <if test="createBy != null">create_by =
#{createBy}, #{createBy},
</if> </if>
@ -617,18 +640,17 @@
delete from sign_patient_manage_route_node where id = #{id} delete from sign_patient_manage_route_node where id = #{id}
</delete> </delete>
<delete id="deleteSignPatientManageRouteNodeByIds" parameterType="String"> <update id="deleteSignPatientManageRouteNodeByIds" parameterType="String">
delete from sign_patient_manage_route_node where id in update sign_patient_manage_route_node set del_flag = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </update>
<delete id="deleteRouteNodeByManageRouteId"> <update id="deleteRouteNodeByManageRouteId">
delete update sign_patient_manage_route_node set del_flag = 1
from sign_patient_manage_route_node
where manage_route_id = #{manageRouteId} where manage_route_id = #{manageRouteId}
</delete> </update>
<select id="selectPatientTaskList" parameterType="com.xinelu.manage.dto.signpatientmanageroutenode.PatientTaskDto" resultType="com.xinelu.manage.vo.signpatientmanageroutenode.PatientTaskVo"> <select id="selectPatientTaskList" parameterType="com.xinelu.manage.dto.signpatientmanageroutenode.PatientTaskDto" resultType="com.xinelu.manage.vo.signpatientmanageroutenode.PatientTaskVo">
select patient.id as patientId, patient.patient_name, select patient.id as patientId, patient.patient_name,
@ -646,6 +668,7 @@
left join sign_patient_manage_route route on node.manage_route_id = route.id left join sign_patient_manage_route route on node.manage_route_id = route.id
left join patient_info patient on route.patient_id = patient.id left join patient_info patient on route.patient_id = patient.id
<where> <where>
node.del_flag = 0
<if test="patientName != null and patientName != ''"> <if test="patientName != null and patientName != ''">
and patient.patient_name = #{patientName} and patient.patient_name = #{patientName}
</if> </if>

View File

@ -430,7 +430,7 @@
from sign_patient_record sign from sign_patient_record sign
left join sign_patient_package p on p.sign_patient_record_id = sign.id left join sign_patient_package p on p.sign_patient_record_id = sign.id
<where> <where>
sign.del_flag = 0 and sign.patient_id = #{patientId} sign.del_flag = 0 and sign.patient_id = #{patientId} and sign.sign_status != 'SEPARATE_SIGN'
</where> </where>
order by sign.sign_time desc order by sign.sign_time desc
</select> </select>