From 42b089d79d2347a114bfccb5cc8eb07f93bed96a Mon Sep 17 00:00:00 2001 From: zhangheng <3226558941@qq.com> Date: Thu, 11 Apr 2024 15:00:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/enums/NodeExecuteStatusEnum.java | 25 ++++--- .../SignPatientManageRouteServiceImpl.java | 72 ++++++++++++------- 2 files changed, 62 insertions(+), 35 deletions(-) diff --git a/postdischarge-common/src/main/java/com/xinelu/common/enums/NodeExecuteStatusEnum.java b/postdischarge-common/src/main/java/com/xinelu/common/enums/NodeExecuteStatusEnum.java index ff851f30..40682678 100644 --- a/postdischarge-common/src/main/java/com/xinelu/common/enums/NodeExecuteStatusEnum.java +++ b/postdischarge-common/src/main/java/com/xinelu/common/enums/NodeExecuteStatusEnum.java @@ -1,18 +1,27 @@ package com.xinelu.common.enums; +import lombok.Getter; + /** * 节点执行状态枚举类 * * @author haown * @date 2024-04-01 */ +@Getter public enum NodeExecuteStatusEnum { - /** - * 已执行 - */ - EXECUTED, - /** - * 未执行 - */ - UNEXECUTED + /** + * 已执行 + */ + EXECUTED("EXECUTED"), + /** + * 未执行 + */ + UNEXECUTED("UNEXECUTED"), + ; + final private String info; + + NodeExecuteStatusEnum(String info) { + this.info = info; + } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java index a6a8c607..af8cfa44 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroute/impl/SignPatientManageRouteServiceImpl.java @@ -32,6 +32,7 @@ import com.xinelu.manage.vo.manualfollowup.ManualFollowUpVO; import com.xinelu.manage.vo.signpatientmanageroute.SignPatientManageRouteVO; import com.xinelu.manage.vo.signroutetriggercondition.SignRouteTriggerConditionVO; import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -95,38 +96,18 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout */ @Override public AjaxResult insertSignPatientManageRoute(SignPatientManageRouteVO signPatientManageRoute) { + //新增主表 signPatientManageRoute.setCreateBy(SecurityUtils.getUsername()); signPatientManageRoute.setCreateTime(LocalDateTime.now()); int insertRoute = signPatientManageRouteMapper.insertSignPatientManageRoute(signPatientManageRoute); if (insertRoute < 0) { return AjaxResult.error("新增签约患者管理任务路径失败!请联系管理员!"); } + //新增节点表 List signPatientManageRouteNodes = new ArrayList<>(); SignPatientManageRouteNode signPatientManageRouteNode = new SignPatientManageRouteNode(); for (SignPatientManageRouteNode routeNode : signPatientManageRoute.getRouteNodeList()) { - if (Objects.nonNull(routeNode) && TaskContentEnum.PHONE_OUTBOUND.getInfo().equals(routeNode.getTaskType())) { - signPatientManageRouteNode.setPhonePushSign(routeNode.getPhonePushSign()); - signPatientManageRouteNode.setPhoneId(routeNode.getPhoneId()); - signPatientManageRouteNode.setPhoneTemplateId(routeNode.getPhoneTemplateId()); - signPatientManageRouteNode.setPhoneTemplateName(routeNode.getPhoneTemplateName()); - signPatientManageRouteNode.setPhoneNodeContent(routeNode.getPhoneNodeContent()); - signPatientManageRouteNode.setPhoneRedialTimes(routeNode.getPhoneRedialTimes()); - signPatientManageRouteNode.setPhoneTimeInterval(routeNode.getPhoneTimeInterval()); - } - if (Objects.nonNull(routeNode) && TaskContentEnum.QUESTIONNAIRE_SCALE.getInfo().equals(routeNode.getTaskType())) { - signPatientManageRouteNode.setQuestionInfoId(routeNode.getQuestionInfoId()); - signPatientManageRouteNode.setQuestionnaireName(routeNode.getQuestionnaireName()); - signPatientManageRouteNode.setQuestionnaireContent(routeNode.getQuestionnaireContent()); - signPatientManageRouteNode.setQuestionExpirationDate(routeNode.getQuestionExpirationDate()); - } - if (Objects.nonNull(routeNode) && TaskContentEnum.PROPAGANDA_ARTICLE.getInfo().equals(routeNode.getTaskType())) { - - } - signPatientManageRouteNode.setManageRouteId(signPatientManageRoute.getId()); - signPatientManageRouteNode.setManageRouteName(signPatientManageRoute.getRouteName()); - signPatientManageRouteNode.setCreateTime(LocalDateTime.now()); - signPatientManageRouteNode.setCreateBy(SecurityUtils.getUsername()); - signPatientManageRouteNodes.add(signPatientManageRouteNode); + extracted(signPatientManageRoute, signPatientManageRouteNodes, signPatientManageRouteNode, routeNode); } int insertBatchCount = signPatientManageRouteNodeMapper.insertBatch(signPatientManageRouteNodes); if (insertBatchCount < 0) { @@ -148,6 +129,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout return AjaxResult.success(); } + /** * 修改签约患者管理任务路径 * @@ -303,10 +285,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout PatientQuestionOptionResult saveQuestionOption = new PatientQuestionOptionResult(); BeanUtils.copyBeanProp(saveQuestionOption, patientQuestionOptionResult); // 从已保存的患者问卷题目结果列表中查找当前选项所对应的题目结果 - PatientQuestionSubjectResult patientQuestionSubjectResult = patientQuestionSubjectResults.stream(). - filter(Objects::nonNull). - filter(item -> Objects.nonNull(item.getQuestionNumber()) && patientQuestionOptionResult.getQuestionNumber(). - compareTo(item.getQuestionNumber()) == 0).findFirst().orElse(new PatientQuestionSubjectResult()); + PatientQuestionSubjectResult patientQuestionSubjectResult = patientQuestionSubjectResults.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getQuestionNumber()) && patientQuestionOptionResult.getQuestionNumber().compareTo(item.getQuestionNumber()) == 0).findFirst().orElse(new PatientQuestionSubjectResult()); saveQuestionOption.setQuestionSubjectResultId(patientQuestionSubjectResult.getId()); saveQuestionOption.setCreateTime(time); saveQuestionOption.setCreateBy(routeHandlePerson); @@ -356,4 +335,43 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout } } + /** + * 塞值 + */ + private static void extracted(SignPatientManageRouteVO signPatientManageRoute, List signPatientManageRouteNodes, SignPatientManageRouteNode signPatientManageRouteNode, SignPatientManageRouteNode routeNode) { + if (Objects.nonNull(routeNode) && TaskContentEnum.PHONE_OUTBOUND.getInfo().equals(routeNode.getTaskType())) { + signPatientManageRouteNode.setPhonePushSign(Objects.isNull(routeNode.getPhonePushSign()) ? null : routeNode.getPhonePushSign()); + signPatientManageRouteNode.setPhoneId(Objects.isNull(routeNode.getPhoneId()) ? null : routeNode.getPhoneId()); + signPatientManageRouteNode.setPhoneTemplateId(Objects.isNull(routeNode.getPhoneTemplateId()) ? null : routeNode.getPhoneTemplateId()); + signPatientManageRouteNode.setPhoneTemplateName(StringUtils.isBlank(routeNode.getPhoneTemplateName()) ? null : routeNode.getPhoneTemplateName()); + signPatientManageRouteNode.setPhoneNodeContent(StringUtils.isBlank(routeNode.getPhoneNodeContent()) ? null : routeNode.getPhoneNodeContent()); + signPatientManageRouteNode.setPhoneRedialTimes(StringUtils.isBlank(routeNode.getPhoneRedialTimes()) ? null : routeNode.getPhoneRedialTimes()); + signPatientManageRouteNode.setPhoneTimeInterval(Objects.isNull(routeNode.getPhoneTimeInterval()) ? null : routeNode.getPhoneTimeInterval()); + } + if (Objects.nonNull(routeNode) && TaskContentEnum.QUESTIONNAIRE_SCALE.getInfo().equals(routeNode.getTaskType())) { + signPatientManageRouteNode.setQuestionInfoId(Objects.isNull(routeNode.getQuestionInfoId()) ? null : routeNode.getQuestionInfoId()); + signPatientManageRouteNode.setQuestionnaireName(StringUtils.isBlank(routeNode.getQuestionnaireName()) ? null : routeNode.getQuestionnaireName()); + signPatientManageRouteNode.setQuestionnaireContent(StringUtils.isBlank(routeNode.getQuestionnaireContent()) ? null : routeNode.getQuestionnaireContent()); + signPatientManageRouteNode.setQuestionExpirationDate(Objects.isNull(routeNode.getQuestionExpirationDate()) ? null : routeNode.getQuestionExpirationDate()); + } + if (Objects.nonNull(routeNode) && TaskContentEnum.PROPAGANDA_ARTICLE.getInfo().equals(routeNode.getTaskType())) { + signPatientManageRouteNode.setPropagandaInfoId(Objects.isNull(routeNode.getPropagandaInfoId()) ? null : routeNode.getPropagandaInfoId()); + signPatientManageRouteNode.setPropagandaTitle(StringUtils.isBlank(routeNode.getPropagandaTitle()) ? null : routeNode.getPropagandaTitle()); + signPatientManageRouteNode.setPropagandaContent(StringUtils.isBlank(routeNode.getPropagandaContent()) ? null : routeNode.getPropagandaContent()); + } + if (Objects.nonNull(routeNode) && TaskContentEnum.TEXT_REMIND.getInfo().equals(routeNode.getTaskType())) { + signPatientManageRouteNode.setTextRemindContent(StringUtils.isBlank(routeNode.getTextRemindContent()) ? null : routeNode.getTextRemindContent()); + } + if (Objects.nonNull(routeNode) && TaskContentEnum.ARTIFICIAL_FOLLOW_UP.getInfo().equals(routeNode.getTaskType())) { + signPatientManageRouteNode.setFollowTemplateId(Objects.isNull(routeNode.getFollowTemplateId()) ? null : routeNode.getFollowTemplateId()); + signPatientManageRouteNode.setFollowContent(StringUtils.isBlank(routeNode.getFollowContent()) ? null : routeNode.getFollowContent()); + signPatientManageRouteNode.setFollowTemplateName(StringUtils.isBlank(routeNode.getFollowTemplateName()) ? null : routeNode.getFollowTemplateName()); + } + signPatientManageRouteNode.setManageRouteId(signPatientManageRoute.getId()); + signPatientManageRouteNode.setManageRouteName(signPatientManageRoute.getRouteName()); + signPatientManageRouteNode.setNodeExecuteStatus(NodeExecuteStatusEnum.UNEXECUTED.getInfo()); + signPatientManageRouteNode.setCreateTime(LocalDateTime.now()); + signPatientManageRouteNode.setCreateBy(SecurityUtils.getUsername()); + signPatientManageRouteNodes.add(signPatientManageRouteNode); + } }