From 78bf6fba43348e9264b1617a06a058a3eb87cd13 Mon Sep 17 00:00:00 2001 From: zhangheng <3226558941@qq.com> Date: Mon, 11 May 2026 14:43:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xinelu/common/enums/BillSourceEnum.java | 17 +++++- .../common/enums/NodeExecuteStatusEnum.java | 18 ++++-- .../impl/BatchSendTaskInfoServiceImpl.java | 4 +- .../BatchSendTaskRecordInfoServiceImpl.java | 25 +++++++- ...SignPatientManageRouteNodeServiceImpl.java | 17 ++++++ .../SignPatientManageRouteNodeMapper.xml | 60 ++++++++++++------- 6 files changed, 110 insertions(+), 31 deletions(-) diff --git a/postdischarge-common/src/main/java/com/xinelu/common/enums/BillSourceEnum.java b/postdischarge-common/src/main/java/com/xinelu/common/enums/BillSourceEnum.java index 9d4c2d6e..3f15d4f0 100644 --- a/postdischarge-common/src/main/java/com/xinelu/common/enums/BillSourceEnum.java +++ b/postdischarge-common/src/main/java/com/xinelu/common/enums/BillSourceEnum.java @@ -13,18 +13,29 @@ public enum BillSourceEnum { /** * 电话 */ - TELEPHONE("telephone"), + TELEPHONE("telephone","电话"), /** * 短信 */ - MESSAGE("message"), + MESSAGE("message","短信"), ; final private String info; + private final String code; - BillSourceEnum(String info) { + + BillSourceEnum(String info, String code) { this.info = info; + this.code = code; + } + + public String getCode() { + return code; + } + + public String getInfo() { + return info; } } 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 c0b2946c..b80b0f9e 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 @@ -13,20 +13,30 @@ public enum NodeExecuteStatusEnum { /** * 已执行 */ - EXECUTED("EXECUTED"), + EXECUTED("EXECUTED", "已执行"), /** * 未执行 */ - UNEXECUTED("UNEXECUTED"), + UNEXECUTED("UNEXECUTED", "未执行"), /** * 执行中 */ - EXECUTING("EXECUTING"), + EXECUTING("EXECUTING", "执行中"), ; final private String info; + private final String code; - NodeExecuteStatusEnum(String info) { + NodeExecuteStatusEnum(String info, String code) { this.info = info; + this.code = code; + } + + public String getCode() { + return code; + } + + public String getInfo() { + return info; } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/batchsendtaskinfo/impl/BatchSendTaskInfoServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/batchsendtaskinfo/impl/BatchSendTaskInfoServiceImpl.java index 688230f2..eb9517a4 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/batchsendtaskinfo/impl/BatchSendTaskInfoServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/batchsendtaskinfo/impl/BatchSendTaskInfoServiceImpl.java @@ -310,6 +310,7 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService { batchSendTaskRecordInfo.setBatchTaskSource(batchSendTaskRecordDto.getBatchTaskSource()); batchSendTaskRecordInfo.setCreateTime(LocalDateTime.now()); batchSendTaskRecordInfo.setPhysicalExaminationLabel(batchSendTaskRecordDto.getPhysicalExaminationLabel()); + batchSendTaskRecordInfo.setDelFlag(0); int insertBatchSendTaskRecord = batchSendTaskRecordInfoMapper.insertBatchSendTaskRecordInfo(batchSendTaskRecordInfo); if (insertBatchSendTaskRecord <= 0) { log.info("新增批量推送任务记录失败"); @@ -355,8 +356,8 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService { signPatientManageRouteNode.setDialStatus(DialStatusEnum.NODIALED.getInfo()); signPatientManageRouteNode.setTaskExcuteType(TaskExcuteTypeEnum.BATCH_TASK.getInfo()); signPatientManageRouteNode.setNodePlanTime(batchSendTaskRecordDto.getNodePlanTime()); - signPatientManageRouteNode.setTaskNodeType(TaskNodeTypeEnum.PHONE_OUTBOUND.getInfo()); if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.TELEPHONE.getInfo())) { + signPatientManageRouteNode.setTaskNodeType(TaskNodeTypeEnum.PHONE_OUTBOUND.getInfo()); signPatientManageRouteNode.setPhonePushSign(1); signPatientManageRouteNode.setScriptInfoId(Objects.isNull(batchSendTaskRecordDto.getScriptInfoId()) ? null : batchSendTaskRecordDto.getScriptInfoId()); signPatientManageRouteNode.setRobotPublishId(batchSendTaskRecordDto.getRobotPublishId()); @@ -371,6 +372,7 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService { signPatientManageRouteNode.setPhoneDialMethod(PhoneDialMethodEnum.AI.getInfo()); } if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.MESSAGE.getInfo())) { + signPatientManageRouteNode.setTaskNodeType(TaskNodeTypeEnum.TEXT_REMIND.getInfo()); signPatientManageRouteNode.setMessagePushSign(1); signPatientManageRouteNode.setMessageTemplateId(Objects.isNull(batchSendTaskRecordDto.getMessageTemplateId()) ? null : batchSendTaskRecordDto.getMessageTemplateId()); signPatientManageRouteNode.setMessageTemplateCode(Objects.isNull(batchSendTaskRecordDto.getMessageTemplateCode()) ? null : batchSendTaskRecordDto.getMessageTemplateCode()); diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/batchsendtaskrecordinfo/impl/BatchSendTaskRecordInfoServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/batchsendtaskrecordinfo/impl/BatchSendTaskRecordInfoServiceImpl.java index 34e237c6..88ae34c2 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/batchsendtaskrecordinfo/impl/BatchSendTaskRecordInfoServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/batchsendtaskrecordinfo/impl/BatchSendTaskRecordInfoServiceImpl.java @@ -2,6 +2,7 @@ package com.xinelu.manage.service.batchsendtaskrecordinfo.impl; import com.xinelu.common.annotation.DataScope; import com.xinelu.common.enums.BillSourceEnum; +import com.xinelu.common.enums.NodeExecuteStatusEnum; import com.xinelu.manage.domain.batchsendtaskrecordinfo.BatchSendTaskRecordInfo; import com.xinelu.manage.domain.scriptInfo.ScriptInfo; import com.xinelu.manage.mapper.batchsendtaskrecordinfo.BatchSendTaskRecordInfoMapper; @@ -10,6 +11,7 @@ import com.xinelu.manage.mapper.textmessage.TextMessageMapper; import com.xinelu.manage.service.batchsendtaskrecordinfo.IBatchSendTaskRecordInfoService; import com.xinelu.manage.vo.batchsendtaskrecordinfo.BatchSendTaskRecordVo; import com.xinelu.manage.vo.textmessage.TextMessageVO; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -52,7 +54,28 @@ public class BatchSendTaskRecordInfoServiceImpl implements IBatchSendTaskRecordI */ @Override public List selectBatchSendTaskRecordInfoList(BatchSendTaskRecordInfo batchSendTaskRecordInfo) { - return batchSendTaskRecordInfoMapper.selectBatchSendTaskRecordInfoList(batchSendTaskRecordInfo); + List batchSendTaskRecordInfos = batchSendTaskRecordInfoMapper.selectBatchSendTaskRecordInfoList(batchSendTaskRecordInfo); + if (CollectionUtils.isEmpty(batchSendTaskRecordInfos)) { + return new ArrayList<>(); + } + for (BatchSendTaskRecordInfo sendTaskRecordInfo : batchSendTaskRecordInfos) { + if (StringUtils.isNotBlank(sendTaskRecordInfo.getNodeExecuteStatus()) && sendTaskRecordInfo.getNodeExecuteStatus().equals(NodeExecuteStatusEnum.EXECUTED.getInfo())) { + sendTaskRecordInfo.setNodeExecuteStatus(NodeExecuteStatusEnum.EXECUTED.getCode()); + } + if (StringUtils.isNotBlank(sendTaskRecordInfo.getNodeExecuteStatus()) && sendTaskRecordInfo.getNodeExecuteStatus().equals(NodeExecuteStatusEnum.UNEXECUTED.getInfo())) { + sendTaskRecordInfo.setNodeExecuteStatus(NodeExecuteStatusEnum.UNEXECUTED.getCode()); + } + if (StringUtils.isNotBlank(sendTaskRecordInfo.getNodeExecuteStatus()) && sendTaskRecordInfo.getNodeExecuteStatus().equals(NodeExecuteStatusEnum.EXECUTING.getInfo())) { + sendTaskRecordInfo.setNodeExecuteStatus(NodeExecuteStatusEnum.EXECUTING.getCode()); + } + if (StringUtils.isNotBlank(sendTaskRecordInfo.getBatchTaskSource()) && sendTaskRecordInfo.getBatchTaskSource().equals(BillSourceEnum.TELEPHONE.getInfo())) { + sendTaskRecordInfo.setBatchTaskSource(BillSourceEnum.TELEPHONE.getCode()); + } + if (StringUtils.isNotBlank(sendTaskRecordInfo.getBatchTaskSource()) && sendTaskRecordInfo.getBatchTaskSource().equals(BillSourceEnum.MESSAGE.getInfo())) { + sendTaskRecordInfo.setBatchTaskSource(BillSourceEnum.MESSAGE.getCode()); + } + } + return batchSendTaskRecordInfos; } /** diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java index 2cf26633..9caa4d5f 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java @@ -13,11 +13,13 @@ import com.xinelu.common.constant.TemplateTypeConstants; import com.xinelu.common.constant.TriggerConditionOperatorConstants; import com.xinelu.common.constant.TriggerLogicConstants; import com.xinelu.common.constant.VisitMethodConstants; +import com.xinelu.common.core.domain.entity.SysUser; import com.xinelu.common.enums.*; import com.xinelu.common.exception.ServiceException; import com.xinelu.common.utils.SecurityUtils; import com.xinelu.common.utils.StringUtils; import com.xinelu.common.utils.bean.BeanUtils; +import com.xinelu.manage.domain.agency.Agency; import com.xinelu.manage.domain.patientinfo.PatientAllInfoViewUppercase; import com.xinelu.manage.domain.patientinfo.PatientInfo; import com.xinelu.manage.domain.patientnodeparamscurrent.PatientNodeParamsCurrent; @@ -39,6 +41,7 @@ import com.xinelu.manage.domain.textmessage.TextMessage; import com.xinelu.manage.domain.wechattemplate.WechatTemplate; import com.xinelu.manage.dto.patientinfo.PatientInfoDto; import com.xinelu.manage.dto.signpatientmanageroutenode.*; +import com.xinelu.manage.mapper.agency.AgencyMapper; import com.xinelu.manage.mapper.labelfieldcontent.LabelFieldContentMapper; import com.xinelu.manage.mapper.patientinfo.PatientAllInfoViewMapper; import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper; @@ -87,6 +90,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; import javax.annotation.Resource; + +import com.xinelu.system.mapper.SysUserMapper; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.jsoup.Jsoup; @@ -148,6 +153,10 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage private PhoneDialRecordMapper phoneDialRecordMapper; @Resource private IAIOBService aiobService; + @Resource + private SysUserMapper sysUserMapper; + @Resource + private AgencyMapper agencyMapper; /** * 查询签约患者管理任务路径节点 @@ -1409,6 +1418,14 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage if (Objects.nonNull(uploadRobotPublishRecordDto)){ uploadRobotPublishRecordDto.setQuestionType(QuestionTypeEnum.FEEDBACK_BLANKS_SUBJECT.getInfo()); } + //登录用户科室信息 + SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId()); + if (Objects.nonNull(sysUser) && Objects.nonNull(sysUser.getHospitalAgencyId())){ + Agency agency = agencyMapper.selectAgencyById(sysUser.getHospitalAgencyId()); + if (Objects.nonNull(agency) && Objects.nonNull(agency.getId())){ + uploadRobotPublishRecordDto.setHospitalAgencyId(agency.getId()); + } + } List uploadRobotPublishRecordVos = signPatientManageRouteNodeMapper.selectTaskContented(uploadRobotPublishRecordDto); //总分为0设为null if(CollectionUtils.isNotEmpty(uploadRobotPublishRecordVos)){ diff --git a/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml index 28b90a95..03746256 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/signpatientmanageroutenode/SignPatientManageRouteNodeMapper.xml @@ -1161,10 +1161,6 @@ spmrn.sn, spmrn.phone_node_execute_result_status, CASE - WHEN spmrn.node_execute_status = 'EXECUTED' THEN '已随访' - WHEN spmrn.node_execute_status = 'UNEXECUTED' THEN '未随访' - END AS followUpStatus, - CASE WHEN spmrn.phone_dial_method = 'AI' THEN 'AI' WHEN spmrn.phone_dial_method = 'COMMON' THEN spmrn.route_handle_person END AS phoneDialMethod, @@ -1178,23 +1174,46 @@ pqsr.remarkable_flag, pqsr.id, pqsr.total_score, - pi.patient_phone, - pi.patient_name, + CASE + WHEN spmr.patient_id is null THEN bsti.patient_name + WHEN spmr.patient_id is not null THEN pi.patient_name + END AS patientName, + CASE + WHEN spmr.patient_id is null THEN bsti.patient_phone + WHEN spmr.patient_id is not null THEN pi.patient_phone + END AS patientPhone, + CASE + WHEN spmr.patient_id is null THEN bsti.hospital_agency_id + WHEN spmr.patient_id is not null THEN pi.hospital_agency_id + END AS hospitalAgencyId, + CASE + WHEN spmr.patient_id is null THEN bsti.hospital_agency_name + WHEN spmr.patient_id is not null THEN pi.hospital_agency_name + END AS hospitalAgencyName, + CASE + WHEN spmr.patient_id is null THEN bsti.department_name + WHEN spmr.patient_id is not null THEN pi.department_name + END AS departmentName, + CASE + WHEN spmr.patient_id is null THEN bsti.department_id + WHEN spmr.patient_id is not null THEN pi.department_id + END AS departmentId, + CASE + WHEN spmr.patient_id is null THEN bsti.visit_date + WHEN spmr.patient_id is not null THEN pi.visit_date + END AS visitDate, + CASE + WHEN spmr.patient_id is null THEN bsti.age + WHEN spmr.patient_id is not null THEN pi.age + END AS age, pi.id AS patientId, - pi.department_name, - pi.department_id, - pi.hospital_agency_id, - pi.hospital_agency_name, - pi.visit_date, - pi.age, pi.patient_visit_record_id, - pvr.main_diagnosis, CASE WHEN spmrn.task_node_type = 'PHONE_OUTBOUND' THEN spmrn.script_info_id WHEN spmrn.task_node_type = 'QUESTIONNAIRE_SCALE' THEN qi.script_info_id END AS scriptTemplateId, CASE - WHEN spmrn.task_node_type = 'PHONE_OUTBOUND' THEN si.script_name + WHEN spmrn.task_node_type = 'PHONE_OUTBOUND' THEN spmrn.phone_template_name WHEN spmrn.task_node_type = 'QUESTIONNAIRE_SCALE' THEN qi.script_name END AS scriptTemplateName, (select fill_blanks_answer from patient_question_subject_result @@ -1203,16 +1222,17 @@ LEFT JOIN sign_patient_manage_route spmr ON spmr.id = spmrn.manage_route_id LEFT JOIN patient_question_submit_result pqsr ON pqsr.manage_route_node_id = spmrn.id LEFT JOIN patient_info pi ON spmr.patient_id = pi.id - LEFT JOIN patient_visit_record pvr ON pi.id = pvr.patient_id + -- LEFT JOIN patient_visit_record pvr ON pi.id = pvr.patient_id LEFT JOIN question_info qi on spmrn.question_info_id = qi.id - LEFT JOIN script_info si on si.id = spmrn.script_info_id + -- LEFT JOIN script_info si on si.id = spmrn.script_info_id + LEFT JOIN batch_send_task_info bsti on spmr.batch_send_task_id = bsti.id WHERE - spmrn.del_flag = 0 + spmrn.del_flag = 0 and spmrn.task_node_type in ('PHONE_OUTBOUND', 'QUESTIONNAIRE_SCALE') and pi.department_id = #{departmentId} - and pi.hospital_agency_id = #{hospitalAgencyId} + and (pi.hospital_agency_id = #{hospitalAgencyId} or bsti.hospital_agency_id = #{hospitalAgencyId}) and pi.id = #{patientId} @@ -1223,9 +1243,6 @@ and pi.patient_phone = #{patientPhone} - - and spmrn.task_node_type = #{taskNodeType} - AND spmrn.question_info_id = #{questionInfoId} @@ -1250,7 +1267,6 @@ and pqsr.contented_flag = #{contentedFlag} - ${params.dataScope} ORDER BY spmrn.create_time DESC