取消签约时,删除参数日志表和未执行的任务。
This commit is contained in:
parent
e9c4a8619f
commit
17fdd5c280
@ -9,6 +9,7 @@ import com.xinelu.common.enums.BusinessType;
|
||||
import com.xinelu.common.utils.poi.ExcelUtil;
|
||||
import com.xinelu.manage.domain.patientnodeparamscurrent.PatientNodeParamsCurrent;
|
||||
import com.xinelu.manage.service.patientnodeparamscurrent.IPatientNodeParamsCurrentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @author haown
|
||||
* @date 2024-05-20
|
||||
*/
|
||||
@Api(tags = "患者节点参数控制器")
|
||||
@RestController
|
||||
@RequestMapping("/manage/nodeParamsCurrent")
|
||||
public class PatientNodeParamsCurrentController extends BaseController {
|
||||
|
||||
@ -323,4 +323,8 @@ public class SignPatientManageRouteNode extends BaseEntity {
|
||||
@ApiModelProperty(value = "节点内容")
|
||||
@Excel(name = "节点内容")
|
||||
private String nodeContent;
|
||||
|
||||
/** 删除标识,0:未删除,1:已删除 */
|
||||
@ApiModelProperty(value = "删除标识,0:未删除,1:已删除")
|
||||
private Integer delFlag;
|
||||
}
|
||||
|
||||
@ -42,15 +42,13 @@ public class SignPatientManageRouteNodeDto {
|
||||
@ApiModelProperty(value = "任务类型列表")
|
||||
private List<String> taskTypeList;
|
||||
|
||||
/**
|
||||
* 患者表主键
|
||||
*/
|
||||
@ApiModelProperty(value = "患者表主键")
|
||||
private Long patientId;
|
||||
|
||||
/**
|
||||
* 专病路径节点id
|
||||
*/
|
||||
@ApiModelProperty(value = "专病路径节点id")
|
||||
private String routeNodeId;
|
||||
private Long routeNodeId;
|
||||
|
||||
/** 节点任务执行状态,已执行:EXECUTED,未执行:UNEXECUTED */
|
||||
@ApiModelProperty(value = "节点任务执行状态,已执行:EXECUTED,未执行:UNEXECUTED")
|
||||
private String nodeExecuteStatus;
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xinelu.manage.service.patientnodeparamscurrent.impl;
|
||||
|
||||
import com.xinelu.common.exception.ServiceException;
|
||||
import com.xinelu.common.utils.SecurityUtils;
|
||||
import com.xinelu.common.utils.bean.BeanUtils;
|
||||
import com.xinelu.manage.domain.patientnodeparamscurrent.PatientNodeParamsCurrent;
|
||||
@ -11,7 +12,7 @@ import com.xinelu.manage.service.signpatientmanageroutenode.ISignPatientManageRo
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -101,16 +102,24 @@ public class PatientNodeParamsCurrentServiceImpl implements IPatientNodeParamsCu
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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<PatientNodeParamsCurrent> allList = new ArrayList<>();
|
||||
List<PatientNodeParamsCurrent> logList = new ArrayList<>();
|
||||
List<PatientNodeParamsCurrent> saveList = new ArrayList<>();
|
||||
List<PatientNodeParamsCurrent> updList = new ArrayList<>();
|
||||
List<List<PatientNodeParamsCurrent>> generateTaskList = new ArrayList<>();
|
||||
List<List<PatientNodeParamsCurrent>> updateTaskList = new ArrayList<>();
|
||||
for (List<PatientNodeParamsCurrent> paramList : paramsList) {
|
||||
AtomicBoolean generateTask = new AtomicBoolean(true);
|
||||
paramList.forEach(param-> {
|
||||
if (param.getId() == null) {
|
||||
param.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
||||
@ -120,31 +129,35 @@ public class PatientNodeParamsCurrentServiceImpl implements IPatientNodeParamsCu
|
||||
param.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
||||
param.setUpdateTime(LocalDateTime.now());
|
||||
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)) {
|
||||
patientNodeParamsCurrentMapper.insertList(saveList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(updList)) {
|
||||
updList.forEach(updParam -> {
|
||||
patientNodeParamsCurrentMapper.updatePatientNodeParamsCurrent(updParam);
|
||||
});
|
||||
}
|
||||
|
||||
// 保存参数日志表
|
||||
List<PatientNodeParamsLog> paramsLogList = new ArrayList<>();
|
||||
allList.forEach(paramCurrent -> {
|
||||
logList.forEach(paramCurrent -> {
|
||||
PatientNodeParamsLog paramsLog = new PatientNodeParamsLog();
|
||||
BeanUtils.copyBeanProp(paramsLog, paramCurrent);
|
||||
paramsLog.setId(null);
|
||||
@ -154,13 +167,8 @@ public class PatientNodeParamsCurrentServiceImpl implements IPatientNodeParamsCu
|
||||
});
|
||||
patientNodeParamsLogMapper.insertList(paramsLogList);
|
||||
|
||||
|
||||
// 生成任务
|
||||
if (CollectionUtils.isNotEmpty(generateTaskList)) {
|
||||
manageRouteNodeService.generateTask(generateTaskList);
|
||||
}
|
||||
// 修改任务
|
||||
if (CollectionUtils.isNotEmpty(updateTaskList)) {
|
||||
manageRouteNodeService.updateTask(updateTaskList);
|
||||
}
|
||||
manageRouteNodeService.updateTask(paramsList);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,12 +106,6 @@ public interface ISignPatientManageRouteNodeService {
|
||||
|
||||
List<PatientSpecialDiseaseNodeVo> getSpecialDiseaseNode(PatientTaskDto patientTaskDto);
|
||||
|
||||
/**
|
||||
* 根据参数列表生成任务
|
||||
* @param paramsCurrentLists 参数列表
|
||||
*/
|
||||
void generateTask(List<List<PatientNodeParamsCurrent>> paramsCurrentLists);
|
||||
|
||||
/**
|
||||
* 根据参数列表修改任务
|
||||
* @param paramsCurrentLists 参数列表
|
||||
|
||||
@ -210,6 +210,8 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
||||
@Override
|
||||
public int insertSignPatientManageRouteNode(SignPatientManageRouteNode signPatientManageRouteNode) {
|
||||
signPatientManageRouteNode.setCreateTime(LocalDateTime.now());
|
||||
signPatientManageRouteNode.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
||||
signPatientManageRouteNode.setDelFlag(0);
|
||||
return signPatientManageRouteNodeMapper.insertSignPatientManageRouteNode(signPatientManageRouteNode);
|
||||
}
|
||||
|
||||
@ -222,6 +224,7 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
||||
@Override
|
||||
public int updateSignPatientManageRouteNode(SignPatientManageRouteNode signPatientManageRouteNode) {
|
||||
signPatientManageRouteNode.setUpdateTime(LocalDateTime.now());
|
||||
signPatientManageRouteNode.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
||||
return signPatientManageRouteNodeMapper.updateSignPatientManageRouteNode(signPatientManageRouteNode);
|
||||
}
|
||||
|
||||
@ -380,31 +383,19 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
||||
return specialDiseaseNodeMapper.selectRouteNodeByRouteId(manageRouteList.get(0).getRouteId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@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("未找到签约管理路径");
|
||||
}
|
||||
private void generateTask(Long routeNodeId, Long manageRouteId, String manageRouteName, List<List<PatientNodeParamsCurrent>> paramsCurrentLists) {
|
||||
// 查询专病路径节点
|
||||
SpecialDiseaseNode specialDiseaseNode = specialDiseaseNodeMapper.selectSpecialDiseaseNodeById(paramsCurrentLists.get(0).get(0).getRouteNodeId());
|
||||
SpecialDiseaseNode specialDiseaseNode = specialDiseaseNodeMapper.selectSpecialDiseaseNodeById(routeNodeId);
|
||||
if (ObjectUtils.isEmpty(specialDiseaseNode)) {
|
||||
throw new ServiceException("数据错误,请联系管理员");
|
||||
}
|
||||
|
||||
List<SignPatientManageRouteNode> manageNodeList = new ArrayList<>();
|
||||
for (List<PatientNodeParamsCurrent> paramsCurrentList : paramsCurrentLists) {
|
||||
List<SignPatientManageRouteNode> nodeList = paramsCurrentList.stream().map(params -> {
|
||||
SignPatientManageRouteNode manageRouteNode = new SignPatientManageRouteNode();
|
||||
BeanUtils.copyBeanProp(manageRouteNode, specialDiseaseNode);
|
||||
manageRouteNode.setManageRouteId(manageRouteList.get(0).getId());
|
||||
manageRouteNode.setManageRouteName(manageRouteList.get(0).getRouteName());
|
||||
manageRouteNode.setManageRouteId(manageRouteId);
|
||||
manageRouteNode.setManageRouteName(manageRouteName);
|
||||
manageRouteNode.setId(null);
|
||||
manageRouteNode.setRouteNodeId(specialDiseaseNode.getId());
|
||||
manageRouteNode.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo());
|
||||
@ -415,9 +406,8 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
||||
manageRouteNode.setNodeContent(replaceNodeContent(specialDiseaseNode.getNodeContent(), paramsCurrentList));
|
||||
manageRouteNode.setCreateTime(LocalDateTime.now());
|
||||
manageRouteNode.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
||||
return manageRouteNode;
|
||||
}).collect(Collectors.toList());
|
||||
manageNodeList.addAll(nodeList);
|
||||
|
||||
manageNodeList.add(manageRouteNode);
|
||||
}
|
||||
|
||||
// 批量保存
|
||||
@ -428,7 +418,12 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
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();
|
||||
routeQuery.setSignPatientRecordId(patientInfo.getSignPatientRecordId());
|
||||
routeQuery.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE);
|
||||
@ -438,22 +433,21 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
||||
}
|
||||
|
||||
SignPatientManageRouteNodeDto signPatientManageRouteNodeDto = new SignPatientManageRouteNodeDto();
|
||||
signPatientManageRouteNodeDto.setPatientId(paramsCurrentLists.get(0).get(0).getPatientId());
|
||||
signPatientManageRouteNodeDto.setManageRouteId(manageRouteList.get(0).getId());
|
||||
signPatientManageRouteNodeDto.setRouteNodeId(paramsCurrentLists.get(0).get(0).getRouteNodeId());
|
||||
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 {
|
||||
if (StringUtils.equals(NodeExecuteStatusEnum.EXECUTED.getInfo(), manageNodeList.get(0).getNodeExecuteStatus())) {
|
||||
// 任务已执行不修改
|
||||
throw new ServiceException("任务已执行,修改失败");
|
||||
} else {
|
||||
// 逐条修改任务nodeContent
|
||||
for (int i = 0; i < manageNodeList.size(); i++) {
|
||||
SignPatientManageRouteNode node = manageNodeList.get(i);
|
||||
node.setNodeContent(replaceNodeContent(node.getNodeContent(), paramsCurrentLists.get(i)));
|
||||
signPatientManageRouteNodeMapper.updateSignPatientManageRouteNode(node);
|
||||
}
|
||||
// 删除任务,重新生成
|
||||
Long[] nodeIds = manageNodeList.stream().map(SignPatientManageRouteNode::getId).toArray(Long[]::new);
|
||||
signPatientManageRouteNodeMapper.deleteSignPatientManageRouteNodeByIds(nodeIds);
|
||||
generateTask(paramsCurrentLists.get(0).get(0).getRouteNodeId(),manageRouteList.get(0).getId(),manageRouteList.get(0).getRouteName(), paramsCurrentLists);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -464,16 +458,9 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
||||
// 需要提取的span
|
||||
Elements spanlist = document.select("span[data-w-e-type]");
|
||||
for (Element span : spanlist) {
|
||||
PatientNodeParamsCurrent nodeParam = new PatientNodeParamsCurrent();
|
||||
String paramKey = span.attr("data-fieldMark");
|
||||
span.text(map.getOrDefault(paramKey, ""))
|
||||
.removeAttr("data-w-e-type")
|
||||
.removeAttr("data-fieldMark")
|
||||
.removeAttr("data-link")
|
||||
.removeAttr("data-w-e-is-void")
|
||||
.removeAttr("data-w-e-is-inline")
|
||||
.removeAttr("data-filespan")
|
||||
.removeAttr("data-filename");
|
||||
span.text(map.getOrDefault(paramKey, ""));
|
||||
span.unwrap();
|
||||
}
|
||||
return document.body().html();
|
||||
}
|
||||
@ -559,20 +546,24 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
||||
String paramKey = span.attr("data-fieldMark");
|
||||
String text = json.getOrDefault(paramKey, "").toString();
|
||||
//span.replaceWith(new TextNode("<p>" + text +"</p"));
|
||||
span.text(text)
|
||||
.removeAttr("id")
|
||||
.removeAttr("class")
|
||||
.removeAttr("data-w-e-type")
|
||||
.removeAttr("data-link")
|
||||
.removeAttr("data-w-e-is-void")
|
||||
.removeAttr("data-w-e-is-inline")
|
||||
.removeAttr("data-fieldmark")
|
||||
.removeAttr("data-filespan")
|
||||
.removeAttr("data-filename");
|
||||
span.text(text);
|
||||
// .removeAttr("id")
|
||||
// .removeAttr("class")
|
||||
// .removeAttr("data-w-e-type")
|
||||
// .removeAttr("data-link")
|
||||
// .removeAttr("data-w-e-is-void")
|
||||
// .removeAttr("data-w-e-is-inline")
|
||||
// .removeAttr("data-fieldmark")
|
||||
// .removeAttr("data-filespan")
|
||||
// .removeAttr("data-filename");
|
||||
span.unwrap();
|
||||
//Element newSpan = new Element(Tag.valueOf("c"), "");
|
||||
//newSpan.text(text);
|
||||
//span.replaceWith(newSpan);
|
||||
}
|
||||
//Elements element = document.getElementsByTag("p");
|
||||
//System.out.println("---------------------\n"+element.get(0).html());
|
||||
System.out.println(document.body().html());
|
||||
//System.out.println(document.body().html());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import com.xinelu.common.utils.SecurityUtils;
|
||||
import com.xinelu.common.utils.StringUtils;
|
||||
import com.xinelu.common.utils.bean.BeanUtils;
|
||||
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.signpatientmanageroute.SignPatientManageRoute;
|
||||
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.specialdiseaseroute.SpecialDiseaseRoute;
|
||||
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.signpatientrecord.IntentionalSignDto;
|
||||
import com.xinelu.manage.dto.signpatientrecord.SignPatientAddDto;
|
||||
import com.xinelu.manage.dto.signpatientrecord.SignPatientListDto;
|
||||
import com.xinelu.manage.dto.signpatientrecord.SignPatientStatusDto;
|
||||
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.signpatientmanageroute.SignPatientManageRouteMapper;
|
||||
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.SignPatientRecordVo;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
@ -58,7 +62,6 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService {
|
||||
|
||||
@Resource
|
||||
private SignPatientRecordMapper signPatientRecordMapper;
|
||||
|
||||
@Resource
|
||||
private SignPatientPackageMapper signPatientPackageMapper;
|
||||
@Resource
|
||||
@ -83,6 +86,8 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService {
|
||||
private SpecialDiseaseTriggerConditionMapper triggerConditionMapper;
|
||||
@Resource
|
||||
private SignRouteTriggerConditionMapper signRouteTriggerConditionMapper;
|
||||
@Resource
|
||||
private PatientNodeParamsLogMapper patientNodeParamsLogMapper;
|
||||
|
||||
@Override public List<SignPatientListVo> selectList(SignPatientListDto signPatientRecord) {
|
||||
return signPatientRecordMapper.selectList(signPatientRecord);
|
||||
@ -201,6 +206,7 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService {
|
||||
manageRouteNode.setRouteCheckRemark("签约自动审核通过");
|
||||
manageRouteNode.setNodeExecuteStatus(NodeExecuteStatusEnum.UNEXECUTED.getInfo());
|
||||
manageRouteNode.setRouteNodeId(node.getId());
|
||||
manageRouteNode.setDelFlag(0);
|
||||
manageRouteNode.setCreateTime(LocalDateTime.now());
|
||||
manageRouteNode.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
||||
return manageRouteNode;
|
||||
@ -268,6 +274,37 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService {
|
||||
patient.setSignStatus(patientCancelSignDto.getSignStatus());
|
||||
patient.setServiceStatus(patientCancelSignDto.getServiceStatus());
|
||||
patientInfoMapper.updatePatientInfoSelective(patient);
|
||||
|
||||
// 删除patient_node_params_current、patient_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);
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
<result property="id" column="id"/>
|
||||
<result property="manageRouteId" column="manage_route_id"/>
|
||||
<result property="manageRouteName" column="manage_route_name"/>
|
||||
<result property="routeNodeId" column="route_node_id"/>
|
||||
<result property="routeNodeName" column="route_node_name"/>
|
||||
<result property="routeNodeDay" column="route_node_day"/>
|
||||
<result property="taskType" column="task_type"/>
|
||||
@ -63,6 +64,7 @@
|
||||
<result property="routeLink" column="route_link"/>
|
||||
<result property="textRemindContent" column="text_remind_content"/>
|
||||
<result property="nodeContent" column="node_content"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
@ -70,18 +72,22 @@
|
||||
</resultMap>
|
||||
|
||||
<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>
|
||||
|
||||
<select id="selectSignPatientManageRouteNodeList" parameterType="com.xinelu.manage.dto.signpatientmanageroutenode.SignPatientManageRouteNodeDto" resultMap="SignPatientManageRouteNodeResult">
|
||||
<include refid="selectSignPatientManageRouteNodeVo"/>
|
||||
<where>
|
||||
del_flag = 0
|
||||
<if test="manageRouteId != null ">
|
||||
and manage_route_id = #{manageRouteId}
|
||||
</if>
|
||||
<if test="manageRouteName != null and manageRouteName != ''">
|
||||
and manage_route_name like concat('%', #{manageRouteName}, '%')
|
||||
</if>
|
||||
<if test="routeNodeId != null">
|
||||
and route_node_id = #{routeNodeId}
|
||||
</if>
|
||||
<if test="routeNodeName != null and routeNodeName != ''">
|
||||
and route_node_name like concat('%', #{routeNodeName}, '%')
|
||||
</if>
|
||||
@ -100,6 +106,9 @@
|
||||
task_type = #{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="nodeExecuteStatus != null and nodeExecuteStatus != ''">
|
||||
and node_execute_status = #{nodeExecuteStatus}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -110,7 +119,7 @@
|
||||
|
||||
<select id="getNodeList" parameterType="com.xinelu.manage.dto.signpatientmanageroutenode.PatientTaskDto"
|
||||
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.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,
|
||||
@ -125,6 +134,7 @@
|
||||
from sign_patient_manage_route_node node
|
||||
left join sign_patient_manage_route route on node.manage_route_id = route.id
|
||||
<where>
|
||||
node.del_flag = 0
|
||||
<if test="patientId != null">
|
||||
and route.patient_id = #{patientId}
|
||||
</if>
|
||||
@ -159,6 +169,8 @@
|
||||
</if>
|
||||
<if test="manageRouteName != null">manage_route_name,
|
||||
</if>
|
||||
<if test="routeNodeId != null">route_node_id,
|
||||
</if>
|
||||
<if test="routeNodeName != null">route_node_name,
|
||||
</if>
|
||||
<if test="routeNodeDay != null">route_node_day,
|
||||
@ -269,6 +281,8 @@
|
||||
</if>
|
||||
<if test="nodeContent != null">node_content,
|
||||
</if>
|
||||
<if test="delFlag != null">del_flag,
|
||||
</if>
|
||||
<if test="createBy != null">create_by,
|
||||
</if>
|
||||
<if test="createTime != null">create_time,
|
||||
@ -283,6 +297,8 @@
|
||||
</if>
|
||||
<if test="manageRouteName != null">#{manageRouteName},
|
||||
</if>
|
||||
<if test="routeNodeId != null">#{routeNodeId},
|
||||
</if>
|
||||
<if test="routeNodeName != null">#{routeNodeName},
|
||||
</if>
|
||||
<if test="routeNodeDay != null">#{routeNodeDay},
|
||||
@ -393,6 +409,8 @@
|
||||
</if>
|
||||
<if test="nodeContent != null">#{nodeContent},
|
||||
</if>
|
||||
<if test="delFlag != null">#{delFlag},
|
||||
</if>
|
||||
<if test="createBy != null">#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">#{createTime},
|
||||
@ -404,22 +422,22 @@
|
||||
</trim>
|
||||
</insert>
|
||||
<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,
|
||||
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)
|
||||
route_handle_id, route_handle_person, route_link, text_remind_content,node_content, del_flag, create_by, create_time, update_by, update_time)
|
||||
values
|
||||
<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.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.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.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>
|
||||
</insert>
|
||||
<update id="updateSignPatientManageRouteNode" parameterType="SignPatientManageRouteNode">
|
||||
@ -431,6 +449,9 @@
|
||||
<if test="manageRouteName != null">manage_route_name =
|
||||
#{manageRouteName},
|
||||
</if>
|
||||
<if test="routeNodeId != null">route_node_id =
|
||||
#{routeNodeId},
|
||||
</if>
|
||||
<if test="routeNodeName != null">route_node_name =
|
||||
#{routeNodeName},
|
||||
</if>
|
||||
@ -596,7 +617,9 @@
|
||||
<if test="nodeContent != null">node_content =
|
||||
#{nodeContent},
|
||||
</if>
|
||||
|
||||
<if test="delFlag != null">del_flag =
|
||||
#{delFlag},
|
||||
</if>
|
||||
<if test="createBy != null">create_by =
|
||||
#{createBy},
|
||||
</if>
|
||||
@ -617,18 +640,17 @@
|
||||
delete from sign_patient_manage_route_node where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSignPatientManageRouteNodeByIds" parameterType="String">
|
||||
delete from sign_patient_manage_route_node where id in
|
||||
<update id="deleteSignPatientManageRouteNodeByIds" parameterType="String">
|
||||
update sign_patient_manage_route_node set del_flag = 1 where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</update>
|
||||
|
||||
<delete id="deleteRouteNodeByManageRouteId">
|
||||
delete
|
||||
from sign_patient_manage_route_node
|
||||
<update id="deleteRouteNodeByManageRouteId">
|
||||
update sign_patient_manage_route_node set del_flag = 1
|
||||
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 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 patient_info patient on route.patient_id = patient.id
|
||||
<where>
|
||||
node.del_flag = 0
|
||||
<if test="patientName != null and patientName != ''">
|
||||
and patient.patient_name = #{patientName}
|
||||
</if>
|
||||
|
||||
@ -430,7 +430,7 @@
|
||||
from sign_patient_record sign
|
||||
left join sign_patient_package p on p.sign_patient_record_id = sign.id
|
||||
<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>
|
||||
order by sign.sign_time desc
|
||||
</select>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user