任务记录

This commit is contained in:
zhangheng 2024-04-11 15:00:54 +08:00
parent c1d3c5e330
commit 42b089d79d
2 changed files with 62 additions and 35 deletions

View File

@ -1,18 +1,27 @@
package com.xinelu.common.enums; package com.xinelu.common.enums;
import lombok.Getter;
/** /**
* 节点执行状态枚举类 * 节点执行状态枚举类
* *
* @author haown * @author haown
* @date 2024-04-01 * @date 2024-04-01
*/ */
@Getter
public enum NodeExecuteStatusEnum { public enum NodeExecuteStatusEnum {
/** /**
* 已执行 * 已执行
*/ */
EXECUTED, EXECUTED("EXECUTED"),
/** /**
* 未执行 * 未执行
*/ */
UNEXECUTED UNEXECUTED("UNEXECUTED"),
;
final private String info;
NodeExecuteStatusEnum(String info) {
this.info = info;
}
} }

View File

@ -32,6 +32,7 @@ import com.xinelu.manage.vo.manualfollowup.ManualFollowUpVO;
import com.xinelu.manage.vo.signpatientmanageroute.SignPatientManageRouteVO; import com.xinelu.manage.vo.signpatientmanageroute.SignPatientManageRouteVO;
import com.xinelu.manage.vo.signroutetriggercondition.SignRouteTriggerConditionVO; import com.xinelu.manage.vo.signroutetriggercondition.SignRouteTriggerConditionVO;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -95,38 +96,18 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
*/ */
@Override @Override
public AjaxResult insertSignPatientManageRoute(SignPatientManageRouteVO signPatientManageRoute) { public AjaxResult insertSignPatientManageRoute(SignPatientManageRouteVO signPatientManageRoute) {
//新增主表
signPatientManageRoute.setCreateBy(SecurityUtils.getUsername()); signPatientManageRoute.setCreateBy(SecurityUtils.getUsername());
signPatientManageRoute.setCreateTime(LocalDateTime.now()); signPatientManageRoute.setCreateTime(LocalDateTime.now());
int insertRoute = signPatientManageRouteMapper.insertSignPatientManageRoute(signPatientManageRoute); int insertRoute = signPatientManageRouteMapper.insertSignPatientManageRoute(signPatientManageRoute);
if (insertRoute < 0) { if (insertRoute < 0) {
return AjaxResult.error("新增签约患者管理任务路径失败!请联系管理员!"); return AjaxResult.error("新增签约患者管理任务路径失败!请联系管理员!");
} }
//新增节点表
List<SignPatientManageRouteNode> signPatientManageRouteNodes = new ArrayList<>(); List<SignPatientManageRouteNode> signPatientManageRouteNodes = new ArrayList<>();
SignPatientManageRouteNode signPatientManageRouteNode = new SignPatientManageRouteNode(); SignPatientManageRouteNode signPatientManageRouteNode = new SignPatientManageRouteNode();
for (SignPatientManageRouteNode routeNode : signPatientManageRoute.getRouteNodeList()) { for (SignPatientManageRouteNode routeNode : signPatientManageRoute.getRouteNodeList()) {
if (Objects.nonNull(routeNode) && TaskContentEnum.PHONE_OUTBOUND.getInfo().equals(routeNode.getTaskType())) { extracted(signPatientManageRoute, signPatientManageRouteNodes, signPatientManageRouteNode, routeNode);
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);
} }
int insertBatchCount = signPatientManageRouteNodeMapper.insertBatch(signPatientManageRouteNodes); int insertBatchCount = signPatientManageRouteNodeMapper.insertBatch(signPatientManageRouteNodes);
if (insertBatchCount < 0) { if (insertBatchCount < 0) {
@ -148,6 +129,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
return AjaxResult.success(); return AjaxResult.success();
} }
/** /**
* 修改签约患者管理任务路径 * 修改签约患者管理任务路径
* *
@ -303,10 +285,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
PatientQuestionOptionResult saveQuestionOption = new PatientQuestionOptionResult(); PatientQuestionOptionResult saveQuestionOption = new PatientQuestionOptionResult();
BeanUtils.copyBeanProp(saveQuestionOption, patientQuestionOptionResult); BeanUtils.copyBeanProp(saveQuestionOption, patientQuestionOptionResult);
// 从已保存的患者问卷题目结果列表中查找当前选项所对应的题目结果 // 从已保存的患者问卷题目结果列表中查找当前选项所对应的题目结果
PatientQuestionSubjectResult patientQuestionSubjectResult = patientQuestionSubjectResults.stream(). PatientQuestionSubjectResult patientQuestionSubjectResult = patientQuestionSubjectResults.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getQuestionNumber()) && patientQuestionOptionResult.getQuestionNumber().compareTo(item.getQuestionNumber()) == 0).findFirst().orElse(new PatientQuestionSubjectResult());
filter(Objects::nonNull).
filter(item -> Objects.nonNull(item.getQuestionNumber()) && patientQuestionOptionResult.getQuestionNumber().
compareTo(item.getQuestionNumber()) == 0).findFirst().orElse(new PatientQuestionSubjectResult());
saveQuestionOption.setQuestionSubjectResultId(patientQuestionSubjectResult.getId()); saveQuestionOption.setQuestionSubjectResultId(patientQuestionSubjectResult.getId());
saveQuestionOption.setCreateTime(time); saveQuestionOption.setCreateTime(time);
saveQuestionOption.setCreateBy(routeHandlePerson); saveQuestionOption.setCreateBy(routeHandlePerson);
@ -356,4 +335,43 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
} }
} }
/**
* 塞值
*/
private static void extracted(SignPatientManageRouteVO signPatientManageRoute, List<SignPatientManageRouteNode> 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);
}
} }