专病路径修改完成后修改任务表。
This commit is contained in:
parent
639fec1d99
commit
07878f4bac
@ -68,4 +68,10 @@ public class SignPatientManageRouteNodeDto {
|
||||
*/
|
||||
@ApiModelProperty(value = "AI:自动 或 COMMON:手动")
|
||||
private String phoneDialMethod;
|
||||
|
||||
/**
|
||||
* 专病路径节点id列表
|
||||
*/
|
||||
@ApiModelProperty(value = "专病路径节点id列表")
|
||||
private List<Long> routeNodeIds;
|
||||
}
|
||||
|
||||
@ -1111,18 +1111,4 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 专病路径修改时修改任务,已经执行的任务不修改,未执行的任务进行删除或修改
|
||||
* @Param routeId 专病路径主键
|
||||
* @return null
|
||||
* @Author haown
|
||||
* @Date 2024-11-15 10:52
|
||||
*/
|
||||
private void updateBySpecialDiseaseRoute(Long routeId) {
|
||||
// 查询签约专病路径的sign_patientmanage_route
|
||||
SignPatientManageRoute manageRouteQuery = new SignPatientManageRoute();
|
||||
manageRouteQuery.setRouteId(routeId);
|
||||
List<SignPatientManageRoute> manageRouteList = signPatientManageRouteMapper.selectSignPatientManageRouteList(manageRouteQuery);
|
||||
// 查询未执行任务
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageNodeAudi
|
||||
import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageRouteNodeVo;
|
||||
import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientTaskVo;
|
||||
import com.xinelu.manage.vo.specialdiseasenode.PatientSpecialDiseaseNodeVo;
|
||||
import com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeVO;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
@ -220,4 +221,6 @@ public interface ISignPatientManageRouteNodeService {
|
||||
* 测试生成患者档案列表数据用
|
||||
*/
|
||||
void generateStatistic();
|
||||
|
||||
void updateBySpecialDiseaseRoute(List<Long> delDiseaseNodeIds, List<SpecialDiseaseNodeVO> updateList, List<SpecialDiseaseNodeVO> addDiseaseNodeList);
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.xinelu.common.annotation.DataScope;
|
||||
import com.xinelu.common.constant.ApplyRangeContant;
|
||||
import com.xinelu.common.constant.RouteNodeNameConstants;
|
||||
import com.xinelu.common.constant.SignRecordServiceStatusConstants;
|
||||
import com.xinelu.common.constant.TaskCreateTypeConstant;
|
||||
import com.xinelu.common.constant.TaskNodeTypeConstants;
|
||||
import com.xinelu.common.constant.TaskStatusConstant;
|
||||
@ -1189,6 +1190,209 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 专病路径修改时修改任务,已经执行的任务不修改,未执行的任务进行删除或修改
|
||||
* @Param routeId 专病路径主键
|
||||
* @return null
|
||||
* @Author haown
|
||||
* @Date 2024-11-15 10:52
|
||||
*/
|
||||
@Override
|
||||
public void updateBySpecialDiseaseRoute(List<Long> delDiseaseNodeIds, List<SpecialDiseaseNodeVO> updateList, List<SpecialDiseaseNodeVO> addDiseaseNodeList) {
|
||||
// 删除的路径节点,未执行的任务删除
|
||||
if (CollectionUtils.isNotEmpty(delDiseaseNodeIds)) {
|
||||
SignPatientManageRouteNodeDto signPatientManageRouteNodeDto = new SignPatientManageRouteNodeDto();
|
||||
signPatientManageRouteNodeDto.setRouteNodeIds(delDiseaseNodeIds);
|
||||
signPatientManageRouteNodeDto.setNodeExecuteStatus(NodeExecuteStatusEnum.UNEXECUTED.getInfo());
|
||||
List<SignPatientManageRouteNode> delNodeList = signPatientManageRouteNodeMapper.selectSignPatientManageRouteNodeList(signPatientManageRouteNodeDto);
|
||||
// 删除任务
|
||||
if (CollectionUtils.isNotEmpty(delNodeList)) {
|
||||
signPatientManageRouteNodeMapper.deleteSignPatientManageRouteNodeByIds(delNodeList.stream().map(SignPatientManageRouteNode::getId).collect(Collectors.toList()).toArray(new Long[0]));
|
||||
}
|
||||
}
|
||||
// 修改的路径节点,对未执行的任务进行修改
|
||||
if (CollectionUtils.isNotEmpty(updateList)) {
|
||||
updateList.forEach(diseaseNode -> {
|
||||
SignPatientManageRouteNodeDto signPatientManageRouteNodeDto = new SignPatientManageRouteNodeDto();
|
||||
signPatientManageRouteNodeDto.setRouteNodeId(diseaseNode.getId());
|
||||
signPatientManageRouteNodeDto.setNodeExecuteStatus(NodeExecuteStatusEnum.UNEXECUTED.getInfo());
|
||||
List<SignPatientManageRouteNode> updNodeList = signPatientManageRouteNodeMapper.selectSignPatientManageRouteNodeList(signPatientManageRouteNodeDto);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(updNodeList)) {
|
||||
updNodeList.forEach(manageRouteNode -> {
|
||||
SignPatientManageRoute signPatientManageRoute = signRouteMapper.selectSignPatientManageRouteById(manageRouteNode.getManageRouteId());
|
||||
// 查询患者画像信息
|
||||
List<LabelFieldInfoContentVo> labelFieldContentList = labelFieldContentMapper.selectByPatientId(signPatientManageRoute.getPatientId());
|
||||
if (CollectionUtils.isEmpty(labelFieldContentList)) {
|
||||
throw new ServiceException("请先维护画像信息");
|
||||
}
|
||||
Long id = manageRouteNode.getId();
|
||||
BeanUtils.copyBeanProp(manageRouteNode, diseaseNode);
|
||||
manageRouteNode.setManageRouteId(signPatientManageRoute.getId());
|
||||
manageRouteNode.setManageRouteName(signPatientManageRoute.getRouteName());
|
||||
manageRouteNode.setId(null);
|
||||
manageRouteNode.setRouteNodeId(diseaseNode.getId());
|
||||
manageRouteNode.setDelFlag(0);
|
||||
|
||||
// 根据模板类型,存放模板字段
|
||||
if(StringUtils.isNotBlank(diseaseNode.getTaskNodeType())) {
|
||||
switch(diseaseNode.getTaskNodeType()) {
|
||||
// 宣教
|
||||
case TaskNodeTypeConstants.PROPAGANDA_ARTICLE:
|
||||
manageRouteNode.setPropagandaInfoId(diseaseNode.getTemplateId());
|
||||
manageRouteNode.setPropagandaTitle(diseaseNode.getTemplateName());
|
||||
break;
|
||||
// 问卷
|
||||
case TaskNodeTypeConstants.QUESTIONNAIRE_SCALE:
|
||||
QuestionInfo questionInfo = questionInfoService.selectQuestionInfoById(diseaseNode.getTemplateId());
|
||||
manageRouteNode.setQuestionInfoId(diseaseNode.getTemplateId());
|
||||
manageRouteNode.setQuestionnaireName(diseaseNode.getTemplateName());
|
||||
if (ObjectUtils.isNotEmpty(questionInfo)) {
|
||||
manageRouteNode.setScriptInfoId(questionInfo.getScriptInfoId());
|
||||
manageRouteNode.setRobotPublishId(questionInfo.getRobotPublishId());
|
||||
// 节点是否是AI电话
|
||||
if (StringUtils.equals(PhoneDialMethodEnum.AI.getInfo(), manageRouteNode.getPhoneDialMethod()) && StringUtils.isBlank(questionInfo.getRobotPublishId())) {
|
||||
throw new ServiceException("第三方机器人id为空");
|
||||
}
|
||||
}
|
||||
break;
|
||||
// 话术
|
||||
case TaskNodeTypeConstants.PHONE_OUTBOUND:
|
||||
manageRouteNode.setScriptInfoId(diseaseNode.getScriptInfoId());
|
||||
// 查询话术
|
||||
ScriptInfo scriptInfo = scriptInfoMapper.selectScriptInfoById(diseaseNode.getScriptInfoId());
|
||||
if (ObjectUtils.isNotEmpty(scriptInfo)) {
|
||||
// 话术库json内容替换
|
||||
manageRouteNode.setPhoneNodeContent(getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList));
|
||||
manageRouteNode.setRobotPublishId(scriptInfo.getRobotPublishId());
|
||||
// 节点是否是AI电话
|
||||
if (StringUtils.equals(PhoneDialMethodEnum.AI.getInfo(), manageRouteNode.getPhoneDialMethod()) && StringUtils.isBlank(scriptInfo.getRobotPublishId())) {
|
||||
throw new ServiceException("第三方机器人id为空");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 替换短信、公众号、小程序内容
|
||||
replaceTemplateInfo(manageRouteNode, diseaseNode, labelFieldContentList);
|
||||
// 替换nodeContent
|
||||
List<SignPatientManageRouteNode> manageNodeList = new ArrayList<>();
|
||||
if (StringUtils.contains(diseaseNode.getNodeContent(), "data-w-e-type")) {
|
||||
SignPatientManageNodeAuditVo signPatientManageNodeAuditVo = new SignPatientManageNodeAuditVo();
|
||||
BeanUtils.copyBeanProp(signPatientManageNodeAuditVo, manageRouteNode);
|
||||
List<SignPatientManageNodeAuditVo> manageNodeAuditVoList = replaceNodeContent(signPatientManageNodeAuditVo, diseaseNode.getTaskPartitionDictId(), labelFieldContentList);
|
||||
manageNodeAuditVoList.forEach(manageNodeAuditVo -> {
|
||||
SignPatientManageRouteNode signNode = new SignPatientManageRouteNode();
|
||||
BeanUtils.copyBeanProp(signNode, manageNodeAuditVo);
|
||||
signPatientManageRouteNodeMapper.updateSignPatientManageRouteNode(signNode);
|
||||
});
|
||||
|
||||
} else {
|
||||
signPatientManageRouteNodeMapper.updateSignPatientManageRouteNode(manageRouteNode);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
// 新增的路径节点,新增未执行任务
|
||||
if (CollectionUtils.isNotEmpty(addDiseaseNodeList)) {
|
||||
//
|
||||
List<SignPatientManageRouteNode> nodeSaveList = new ArrayList();
|
||||
addDiseaseNodeList.forEach(diseaseNode -> {
|
||||
// 查询签约专病路径的sign_patient_manage_route
|
||||
SignPatientManageRoute signPatientManageRoute = new SignPatientManageRoute();
|
||||
signPatientManageRoute.setRouteId(diseaseNode.getRouteId());
|
||||
List<SignPatientManageRoute> manageRouteList = signRouteMapper.selectSignPatientManageRouteList(signPatientManageRoute);
|
||||
// 查询已审核通过的签约记录
|
||||
manageRouteList.forEach(manageRoute -> {
|
||||
SignPatientRecord signPatientRecord = signPatientRecordMapper.selectByPrimaryKey(manageRoute.getSignPatientRecordId());
|
||||
// 审核通过并且在服务期限内的签约记录
|
||||
if (StringUtils.equals(SignRecordServiceStatusConstants.SERVICE_CENTER, signPatientRecord.getServiceStatus()) && StringUtils.equals(RouteCheckStatusEnum.AGREE.getInfo(), signPatientRecord.getPortaitCheckStatus()) && StringUtils.equals(RouteCheckStatusEnum.AGREE.getInfo(), signPatientRecord.getRouteCheckStatus())) {
|
||||
// 查询患者画像信息
|
||||
List<LabelFieldInfoContentVo> labelFieldContentList = labelFieldContentMapper.selectByPatientId(signPatientManageRoute.getPatientId());
|
||||
if (CollectionUtils.isEmpty(labelFieldContentList)) {
|
||||
throw new ServiceException("请先维护画像信息");
|
||||
}
|
||||
// 生成任务
|
||||
SignPatientManageRouteNode manageRouteNode = new SignPatientManageRouteNode();
|
||||
BeanUtils.copyBeanProp(manageRouteNode, diseaseNode);
|
||||
manageRouteNode.setManageRouteId(signPatientManageRoute.getId());
|
||||
manageRouteNode.setManageRouteName(signPatientManageRoute.getRouteName());
|
||||
manageRouteNode.setId(null);
|
||||
manageRouteNode.setRouteNodeId(diseaseNode.getId());
|
||||
manageRouteNode.setExecuteTime(diseaseNode.getExecutionTime());
|
||||
manageRouteNode.setDelFlag(0);
|
||||
manageRouteNode.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo());
|
||||
manageRouteNode.setNodeExecuteStatus(NodeExecuteStatusEnum.UNEXECUTED.getInfo());
|
||||
|
||||
// 根据模板类型,存放模板字段
|
||||
if(StringUtils.isNotBlank(diseaseNode.getTaskNodeType())) {
|
||||
switch(diseaseNode.getTaskNodeType()) {
|
||||
// 宣教
|
||||
case TaskNodeTypeConstants.PROPAGANDA_ARTICLE:
|
||||
manageRouteNode.setPropagandaInfoId(diseaseNode.getTemplateId());
|
||||
manageRouteNode.setPropagandaTitle(diseaseNode.getTemplateName());
|
||||
break;
|
||||
// 问卷
|
||||
case TaskNodeTypeConstants.QUESTIONNAIRE_SCALE:
|
||||
QuestionInfo questionInfo = questionInfoService.selectQuestionInfoById(diseaseNode.getTemplateId());
|
||||
manageRouteNode.setQuestionInfoId(diseaseNode.getTemplateId());
|
||||
manageRouteNode.setQuestionnaireName(diseaseNode.getTemplateName());
|
||||
if (ObjectUtils.isNotEmpty(questionInfo)) {
|
||||
manageRouteNode.setScriptInfoId(questionInfo.getScriptInfoId());
|
||||
manageRouteNode.setRobotPublishId(questionInfo.getRobotPublishId());
|
||||
// 节点是否是AI电话
|
||||
if (StringUtils.equals(PhoneDialMethodEnum.AI.getInfo(), manageRouteNode.getPhoneDialMethod()) && StringUtils.isBlank(questionInfo.getRobotPublishId())) {
|
||||
throw new ServiceException("第三方机器人id为空");
|
||||
}
|
||||
}
|
||||
break;
|
||||
// 话术
|
||||
case TaskNodeTypeConstants.PHONE_OUTBOUND:
|
||||
manageRouteNode.setScriptInfoId(diseaseNode.getScriptInfoId());
|
||||
// 查询话术
|
||||
ScriptInfo scriptInfo = scriptInfoMapper.selectScriptInfoById(diseaseNode.getScriptInfoId());
|
||||
if (ObjectUtils.isNotEmpty(scriptInfo)) {
|
||||
// 话术库json内容替换
|
||||
manageRouteNode.setPhoneNodeContent(getFlowScheme(scriptInfo.getFlowScheme(), labelFieldContentList));
|
||||
manageRouteNode.setRobotPublishId(scriptInfo.getRobotPublishId());
|
||||
// 节点是否是AI电话
|
||||
if (StringUtils.equals(PhoneDialMethodEnum.AI.getInfo(), manageRouteNode.getPhoneDialMethod()) && StringUtils.isBlank(scriptInfo.getRobotPublishId())) {
|
||||
throw new ServiceException("第三方机器人id为空");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 替换短信、公众号、小程序内容
|
||||
replaceTemplateInfo(manageRouteNode, diseaseNode, labelFieldContentList);
|
||||
// 替换nodeContent
|
||||
List<SignPatientManageRouteNode> manageNodeList = new ArrayList<>();
|
||||
if (StringUtils.contains(diseaseNode.getNodeContent(), "data-w-e-type")) {
|
||||
SignPatientManageNodeAuditVo signPatientManageNodeAuditVo = new SignPatientManageNodeAuditVo();
|
||||
BeanUtils.copyBeanProp(signPatientManageNodeAuditVo, manageRouteNode);
|
||||
List<SignPatientManageNodeAuditVo> manageNodeAuditVoList = replaceNodeContent(signPatientManageNodeAuditVo, diseaseNode.getTaskPartitionDictId(), labelFieldContentList);
|
||||
manageNodeAuditVoList.forEach(manageNodeAuditVo -> {
|
||||
SignPatientManageRouteNode signNode = new SignPatientManageRouteNode();
|
||||
BeanUtils.copyBeanProp(signNode, manageNodeAuditVo);
|
||||
manageNodeList.add(signNode);
|
||||
});
|
||||
|
||||
} else {
|
||||
manageNodeList.add(manageRouteNode);
|
||||
}
|
||||
nodeSaveList.addAll(manageNodeList);
|
||||
}
|
||||
});
|
||||
});
|
||||
// 保存
|
||||
if(CollectionUtils.isNotEmpty(nodeSaveList)) {
|
||||
signPatientManageRouteNodeMapper.insertBatch(nodeSaveList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据管理路径生成任务
|
||||
* @param signPatientManageRoute 签约管理路径
|
||||
@ -1408,4 +1612,5 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
|
||||
}
|
||||
return retBoolean;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@ package com.xinelu.manage.service.specialdiseasenode.impl;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.enums.PatientSexEnum;
|
||||
import com.xinelu.common.enums.ReleaseStatusEnum;
|
||||
import com.xinelu.common.exception.ServiceException;
|
||||
import com.xinelu.common.utils.BaseUtil;
|
||||
import com.xinelu.common.utils.SecurityUtils;
|
||||
@ -17,6 +16,7 @@ import com.xinelu.manage.mapper.patientnodeparamslcurrent.PatientNodeParamsCurre
|
||||
import com.xinelu.manage.mapper.specialdiseasenode.SpecialDiseaseNodeMapper;
|
||||
import com.xinelu.manage.mapper.specialdiseaseroute.SpecialDiseaseRouteMapper;
|
||||
import com.xinelu.manage.service.patientinfo.IPatientAllInfoViewService;
|
||||
import com.xinelu.manage.service.signpatientmanageroutenode.ISignPatientManageRouteNodeService;
|
||||
import com.xinelu.manage.service.specialdiseasenode.ISpecialDiseaseNodeService;
|
||||
import com.xinelu.manage.vo.specialdiseasenode.RouteTaskAuditVo;
|
||||
import com.xinelu.manage.vo.specialdiseasenode.SpecialDiseaseNodeVO;
|
||||
@ -60,6 +60,8 @@ public class SpecialDiseaseNodeServiceImpl implements ISpecialDiseaseNodeService
|
||||
private PatientInfoMapper patientInfoMapper;
|
||||
@Resource
|
||||
private IPatientAllInfoViewService patientAllInfoViewService;
|
||||
@Resource
|
||||
private ISignPatientManageRouteNodeService signPatientManageRouteNodeService;
|
||||
|
||||
|
||||
/**
|
||||
@ -123,21 +125,21 @@ public class SpecialDiseaseNodeServiceImpl implements ISpecialDiseaseNodeService
|
||||
@Override
|
||||
public AjaxResult updateSpecialDiseaseNode(SpecialDiseaseRouteVO specialDiseaseNode) {
|
||||
|
||||
if (Objects.nonNull(specialDiseaseNode) && Objects.nonNull(specialDiseaseNode.getSpecialDiseaseRouteId())) {
|
||||
SpecialDiseaseRoute specialDiseaseRoute = specialDiseaseRouteMapper.selectSpecialDiseaseRouteById(specialDiseaseNode.getSpecialDiseaseRouteId());
|
||||
if (specialDiseaseRoute.getParentRouteId() == null || specialDiseaseRoute.getParentRouteId() == 0) {
|
||||
if (Objects.nonNull(specialDiseaseRoute) && StringUtils.isNotBlank(specialDiseaseRoute.getReleaseStatus()) && !ReleaseStatusEnum.UNPUBLISHED.getInfo().equals(specialDiseaseRoute.getReleaseStatus())) {
|
||||
return AjaxResult.error("已发布过的专病路径不能修改!");
|
||||
}
|
||||
} else {
|
||||
// 判断主路径的发布状态
|
||||
SpecialDiseaseRoute parentRoute = specialDiseaseRouteMapper.selectSpecialDiseaseRouteById(specialDiseaseRoute.getParentRouteId());
|
||||
if (Objects.nonNull(parentRoute) && StringUtils.isNotBlank(parentRoute.getReleaseStatus()) && !StringUtils.equals(ReleaseStatusEnum.UNPUBLISHED.getInfo(), specialDiseaseRoute.getReleaseStatus())) {
|
||||
return AjaxResult.error("已发布过的专病路径不能修改!");
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Long> longs = specialDiseaseNodeMapper.selectSpecialDiseaseRouteIds(specialDiseaseNode.getSpecialDiseaseRouteId());
|
||||
//if (Objects.nonNull(specialDiseaseNode) && Objects.nonNull(specialDiseaseNode.getSpecialDiseaseRouteId())) {
|
||||
// SpecialDiseaseRoute specialDiseaseRoute = specialDiseaseRouteMapper.selectSpecialDiseaseRouteById(specialDiseaseNode.getSpecialDiseaseRouteId());
|
||||
// if (specialDiseaseRoute.getParentRouteId() == null || specialDiseaseRoute.getParentRouteId() == 0) {
|
||||
// if (Objects.nonNull(specialDiseaseRoute) && StringUtils.isNotBlank(specialDiseaseRoute.getReleaseStatus()) && !ReleaseStatusEnum.UNPUBLISHED.getInfo().equals(specialDiseaseRoute.getReleaseStatus())) {
|
||||
// return AjaxResult.error("已发布过的专病路径不能修改!");
|
||||
// }
|
||||
// } else {
|
||||
// // 判断主路径的发布状态
|
||||
// SpecialDiseaseRoute parentRoute = specialDiseaseRouteMapper.selectSpecialDiseaseRouteById(specialDiseaseRoute.getParentRouteId());
|
||||
// if (Objects.nonNull(parentRoute) && StringUtils.isNotBlank(parentRoute.getReleaseStatus()) && !StringUtils.equals(ReleaseStatusEnum.UNPUBLISHED.getInfo(), specialDiseaseRoute.getReleaseStatus())) {
|
||||
// return AjaxResult.error("已发布过的专病路径不能修改!");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
List<Long> oldIds = specialDiseaseNodeMapper.selectSpecialDiseaseRouteIds(specialDiseaseNode.getSpecialDiseaseRouteId());
|
||||
SpecialDiseaseRoute specialDiseaseRoute = new SpecialDiseaseRoute();
|
||||
BeanUtils.copyBeanProp(specialDiseaseRoute, specialDiseaseNode);
|
||||
specialDiseaseRoute.setUpdateTime(LocalDateTime.now());
|
||||
@ -148,41 +150,76 @@ public class SpecialDiseaseNodeServiceImpl implements ISpecialDiseaseNodeService
|
||||
log.info("修改专病路径失败");
|
||||
throw new ServiceException("修改专病路径管理节点信息失败");
|
||||
}
|
||||
int deleteCount = specialDiseaseNodeMapper.deleteSpecialDiseaseNodeByRouteId(specialDiseaseRoute.getId());
|
||||
if (deleteCount < 0) {
|
||||
log.info("删除管理节点信息失败");
|
||||
throw new ServiceException("修改专病路径管理节点信息失败");
|
||||
}
|
||||
if (CollectionUtils.isEmpty(specialDiseaseNode.getSpecialDiseaseNodeList())) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
List<SpecialDiseaseNodeVO> specialDiseaseNodeVOS = new ArrayList<>();
|
||||
int i = 0;
|
||||
for (SpecialDiseaseNodeVO diseaseNode : specialDiseaseNode.getSpecialDiseaseNodeList()) {
|
||||
if (StringUtils.isBlank(diseaseNode.getRouteNodeName())) {
|
||||
throw new ServiceException("请输入节点名称");
|
||||
}
|
||||
if (diseaseNode.getRouteNodeDay() == null) {
|
||||
throw new ServiceException("请输入节点时间");
|
||||
}
|
||||
if (StringUtils.isBlank(diseaseNode.getTaskType()) || StringUtils.isBlank(diseaseNode.getTaskSubdivision())) {
|
||||
throw new ServiceException("任务类型、任务细分不能为空");
|
||||
}
|
||||
diseaseNode.setRouteId(specialDiseaseRoute.getId());
|
||||
diseaseNode.setRouteName(specialDiseaseNode.getRouteName());
|
||||
diseaseNode.setUpdateTime(LocalDateTime.now());
|
||||
diseaseNode.setUpdateBy(SecurityUtils.getUsername());
|
||||
if (CollectionUtils.isNotEmpty(longs) && (i < longs.size()) && Objects.nonNull(longs.get(i))) {
|
||||
diseaseNode.setId(longs.get(i));
|
||||
i++;
|
||||
}
|
||||
specialDiseaseNodeVOS.add(diseaseNode);
|
||||
}
|
||||
int insertNodeCount = specialDiseaseNodeMapper.insertSpecialDiseaseNodeList(specialDiseaseNodeVOS);
|
||||
if (insertNodeCount < 0) {
|
||||
log.info("新增管理节点信息失败");
|
||||
throw new ServiceException("修改专病路径管理节点信息失败");
|
||||
}
|
||||
|
||||
List<SpecialDiseaseNodeVO> diseaseNodeList = specialDiseaseNode.getSpecialDiseaseNodeList();
|
||||
if (CollectionUtils.isEmpty(diseaseNodeList)) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
// 循环节点查找新增、删除、修改的节点
|
||||
List<SpecialDiseaseNodeVO> insertList = new ArrayList<>();
|
||||
List<SpecialDiseaseNodeVO> updateList = new ArrayList<>();
|
||||
diseaseNodeList.forEach(diseaseNode -> {
|
||||
if (StringUtils.isBlank(diseaseNode.getRouteNodeName())) {
|
||||
throw new ServiceException("请输入节点名称");
|
||||
}
|
||||
if (diseaseNode.getRouteNodeDay() == null) {
|
||||
throw new ServiceException("请输入节点时间");
|
||||
}
|
||||
if (StringUtils.isBlank(diseaseNode.getTaskType()) || StringUtils.isBlank(diseaseNode.getTaskSubdivision())) {
|
||||
throw new ServiceException("任务类型、任务细分不能为空");
|
||||
}
|
||||
if (diseaseNode.getSpecialDiseaseNodeId() == null) {
|
||||
// 新增的节点
|
||||
insertList.add(diseaseNode);
|
||||
} else {
|
||||
// 修改的节点
|
||||
updateList.add(diseaseNode);
|
||||
}
|
||||
});
|
||||
List<Long> ids = diseaseNodeList.stream().map(SpecialDiseaseNodeVO::getSpecialDiseaseNodeId).collect(Collectors.toList());
|
||||
// ids与oldIds对比,oldIds中包含ids中不包含的为删除的节点,其余为修改的节点
|
||||
List<Long> deleteList = oldIds.stream().filter(item -> !ids.contains(item)).collect(Collectors.toList());
|
||||
// 删除节点
|
||||
if (CollectionUtils.isNotEmpty(deleteList)) {
|
||||
int deleteCount = specialDiseaseNodeMapper.deleteSpecialDiseaseNodeByIds(deleteList.toArray(new Long[0]));
|
||||
if (deleteCount < 0) {
|
||||
log.info("删除管理节点信息失败");
|
||||
throw new ServiceException("修改专病路径管理节点信息失败");
|
||||
}
|
||||
}
|
||||
// 新增节点
|
||||
if (CollectionUtils.isNotEmpty(insertList)) {
|
||||
List<SpecialDiseaseNodeVO> specialDiseaseNodeVOS = new ArrayList<>();
|
||||
insertList.forEach(diseaseNode -> {
|
||||
diseaseNode.setRouteId(specialDiseaseRoute.getId());
|
||||
diseaseNode.setRouteName(specialDiseaseNode.getRouteName());
|
||||
diseaseNode.setCreateTime(LocalDateTime.now());
|
||||
diseaseNode.setCreateBy(SecurityUtils.getUsername());
|
||||
specialDiseaseNodeVOS.add(diseaseNode);
|
||||
});
|
||||
int insertNodeCount = specialDiseaseNodeMapper.insertSpecialDiseaseNodeList(specialDiseaseNodeVOS);
|
||||
if (insertNodeCount < 0) {
|
||||
log.info("新增管理节点信息失败");
|
||||
throw new ServiceException("修改专病路径管理节点信息失败");
|
||||
}
|
||||
}
|
||||
// 修改节点
|
||||
if (CollectionUtils.isNotEmpty(updateList)) {
|
||||
updateList.forEach(diseaseNode -> {
|
||||
diseaseNode.setRouteId(specialDiseaseRoute.getId());
|
||||
diseaseNode.setRouteName(specialDiseaseNode.getRouteName());
|
||||
diseaseNode.setUpdateTime(LocalDateTime.now());
|
||||
diseaseNode.setUpdateBy(SecurityUtils.getUsername());
|
||||
diseaseNode.setId(diseaseNode.getSpecialDiseaseNodeId());
|
||||
int flag = specialDiseaseNodeMapper.updateSpecialDiseaseNode(diseaseNode);
|
||||
if (flag < 0) {
|
||||
log.info("修改管理节点信息失败");
|
||||
throw new ServiceException("修改专病路径管理节点信息失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
// 修改任务表
|
||||
signPatientManageRouteNodeService.updateBySpecialDiseaseRoute(deleteList, updateList, insertList);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@ -129,6 +129,12 @@
|
||||
<if test="phoneDialMethod != null and phoneDialMethod != ''">
|
||||
and phone_dial_method = #{phoneDialMethod}
|
||||
</if>
|
||||
<if test="routeNodeIds != null and routeNodeIds.size > 0">
|
||||
and
|
||||
<foreach collection="routeNodeIds" item="routeNodeId" index="index" open="(" close=")" separator="or">
|
||||
route_node_id = #{routeNodeId}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user