批量任务

This commit is contained in:
zhangheng 2026-05-11 14:43:17 +08:00
parent 4562d9f2fc
commit 78bf6fba43
6 changed files with 110 additions and 31 deletions

View File

@ -13,18 +13,29 @@ public enum BillSourceEnum {
/** /**
* 电话 * 电话
*/ */
TELEPHONE("telephone"), TELEPHONE("telephone","电话"),
/** /**
* 短信 * 短信
*/ */
MESSAGE("message"), MESSAGE("message","短信"),
; ;
final private String info; final private String info;
private final String code;
BillSourceEnum(String info) {
BillSourceEnum(String info, String code) {
this.info = info; this.info = info;
this.code = code;
}
public String getCode() {
return code;
}
public String getInfo() {
return info;
} }
} }

View File

@ -13,20 +13,30 @@ public enum NodeExecuteStatusEnum {
/** /**
* 已执行 * 已执行
*/ */
EXECUTED("EXECUTED"), EXECUTED("EXECUTED", "已执行"),
/** /**
* 未执行 * 未执行
*/ */
UNEXECUTED("UNEXECUTED"), UNEXECUTED("UNEXECUTED", "未执行"),
/** /**
* 执行中 * 执行中
*/ */
EXECUTING("EXECUTING"), EXECUTING("EXECUTING", "执行中"),
; ;
final private String info; final private String info;
private final String code;
NodeExecuteStatusEnum(String info) { NodeExecuteStatusEnum(String info, String code) {
this.info = info; this.info = info;
this.code = code;
}
public String getCode() {
return code;
}
public String getInfo() {
return info;
} }
} }

View File

@ -310,6 +310,7 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
batchSendTaskRecordInfo.setBatchTaskSource(batchSendTaskRecordDto.getBatchTaskSource()); batchSendTaskRecordInfo.setBatchTaskSource(batchSendTaskRecordDto.getBatchTaskSource());
batchSendTaskRecordInfo.setCreateTime(LocalDateTime.now()); batchSendTaskRecordInfo.setCreateTime(LocalDateTime.now());
batchSendTaskRecordInfo.setPhysicalExaminationLabel(batchSendTaskRecordDto.getPhysicalExaminationLabel()); batchSendTaskRecordInfo.setPhysicalExaminationLabel(batchSendTaskRecordDto.getPhysicalExaminationLabel());
batchSendTaskRecordInfo.setDelFlag(0);
int insertBatchSendTaskRecord = batchSendTaskRecordInfoMapper.insertBatchSendTaskRecordInfo(batchSendTaskRecordInfo); int insertBatchSendTaskRecord = batchSendTaskRecordInfoMapper.insertBatchSendTaskRecordInfo(batchSendTaskRecordInfo);
if (insertBatchSendTaskRecord <= 0) { if (insertBatchSendTaskRecord <= 0) {
log.info("新增批量推送任务记录失败"); log.info("新增批量推送任务记录失败");
@ -355,8 +356,8 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
signPatientManageRouteNode.setDialStatus(DialStatusEnum.NODIALED.getInfo()); signPatientManageRouteNode.setDialStatus(DialStatusEnum.NODIALED.getInfo());
signPatientManageRouteNode.setTaskExcuteType(TaskExcuteTypeEnum.BATCH_TASK.getInfo()); signPatientManageRouteNode.setTaskExcuteType(TaskExcuteTypeEnum.BATCH_TASK.getInfo());
signPatientManageRouteNode.setNodePlanTime(batchSendTaskRecordDto.getNodePlanTime()); signPatientManageRouteNode.setNodePlanTime(batchSendTaskRecordDto.getNodePlanTime());
signPatientManageRouteNode.setTaskNodeType(TaskNodeTypeEnum.PHONE_OUTBOUND.getInfo());
if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.TELEPHONE.getInfo())) { if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.TELEPHONE.getInfo())) {
signPatientManageRouteNode.setTaskNodeType(TaskNodeTypeEnum.PHONE_OUTBOUND.getInfo());
signPatientManageRouteNode.setPhonePushSign(1); signPatientManageRouteNode.setPhonePushSign(1);
signPatientManageRouteNode.setScriptInfoId(Objects.isNull(batchSendTaskRecordDto.getScriptInfoId()) ? null : batchSendTaskRecordDto.getScriptInfoId()); signPatientManageRouteNode.setScriptInfoId(Objects.isNull(batchSendTaskRecordDto.getScriptInfoId()) ? null : batchSendTaskRecordDto.getScriptInfoId());
signPatientManageRouteNode.setRobotPublishId(batchSendTaskRecordDto.getRobotPublishId()); signPatientManageRouteNode.setRobotPublishId(batchSendTaskRecordDto.getRobotPublishId());
@ -371,6 +372,7 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
signPatientManageRouteNode.setPhoneDialMethod(PhoneDialMethodEnum.AI.getInfo()); signPatientManageRouteNode.setPhoneDialMethod(PhoneDialMethodEnum.AI.getInfo());
} }
if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.MESSAGE.getInfo())) { if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.MESSAGE.getInfo())) {
signPatientManageRouteNode.setTaskNodeType(TaskNodeTypeEnum.TEXT_REMIND.getInfo());
signPatientManageRouteNode.setMessagePushSign(1); signPatientManageRouteNode.setMessagePushSign(1);
signPatientManageRouteNode.setMessageTemplateId(Objects.isNull(batchSendTaskRecordDto.getMessageTemplateId()) ? null : batchSendTaskRecordDto.getMessageTemplateId()); signPatientManageRouteNode.setMessageTemplateId(Objects.isNull(batchSendTaskRecordDto.getMessageTemplateId()) ? null : batchSendTaskRecordDto.getMessageTemplateId());
signPatientManageRouteNode.setMessageTemplateCode(Objects.isNull(batchSendTaskRecordDto.getMessageTemplateCode()) ? null : batchSendTaskRecordDto.getMessageTemplateCode()); signPatientManageRouteNode.setMessageTemplateCode(Objects.isNull(batchSendTaskRecordDto.getMessageTemplateCode()) ? null : batchSendTaskRecordDto.getMessageTemplateCode());

View File

@ -2,6 +2,7 @@ package com.xinelu.manage.service.batchsendtaskrecordinfo.impl;
import com.xinelu.common.annotation.DataScope; import com.xinelu.common.annotation.DataScope;
import com.xinelu.common.enums.BillSourceEnum; import com.xinelu.common.enums.BillSourceEnum;
import com.xinelu.common.enums.NodeExecuteStatusEnum;
import com.xinelu.manage.domain.batchsendtaskrecordinfo.BatchSendTaskRecordInfo; import com.xinelu.manage.domain.batchsendtaskrecordinfo.BatchSendTaskRecordInfo;
import com.xinelu.manage.domain.scriptInfo.ScriptInfo; import com.xinelu.manage.domain.scriptInfo.ScriptInfo;
import com.xinelu.manage.mapper.batchsendtaskrecordinfo.BatchSendTaskRecordInfoMapper; 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.service.batchsendtaskrecordinfo.IBatchSendTaskRecordInfoService;
import com.xinelu.manage.vo.batchsendtaskrecordinfo.BatchSendTaskRecordVo; import com.xinelu.manage.vo.batchsendtaskrecordinfo.BatchSendTaskRecordVo;
import com.xinelu.manage.vo.textmessage.TextMessageVO; import com.xinelu.manage.vo.textmessage.TextMessageVO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -52,7 +54,28 @@ public class BatchSendTaskRecordInfoServiceImpl implements IBatchSendTaskRecordI
*/ */
@Override @Override
public List<BatchSendTaskRecordInfo> selectBatchSendTaskRecordInfoList(BatchSendTaskRecordInfo batchSendTaskRecordInfo) { public List<BatchSendTaskRecordInfo> selectBatchSendTaskRecordInfoList(BatchSendTaskRecordInfo batchSendTaskRecordInfo) {
return batchSendTaskRecordInfoMapper.selectBatchSendTaskRecordInfoList(batchSendTaskRecordInfo); List<BatchSendTaskRecordInfo> 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;
} }
/** /**

View File

@ -13,11 +13,13 @@ import com.xinelu.common.constant.TemplateTypeConstants;
import com.xinelu.common.constant.TriggerConditionOperatorConstants; import com.xinelu.common.constant.TriggerConditionOperatorConstants;
import com.xinelu.common.constant.TriggerLogicConstants; import com.xinelu.common.constant.TriggerLogicConstants;
import com.xinelu.common.constant.VisitMethodConstants; import com.xinelu.common.constant.VisitMethodConstants;
import com.xinelu.common.core.domain.entity.SysUser;
import com.xinelu.common.enums.*; import com.xinelu.common.enums.*;
import com.xinelu.common.exception.ServiceException; import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.SecurityUtils; import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.StringUtils; import com.xinelu.common.utils.StringUtils;
import com.xinelu.common.utils.bean.BeanUtils; 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.PatientAllInfoViewUppercase;
import com.xinelu.manage.domain.patientinfo.PatientInfo; import com.xinelu.manage.domain.patientinfo.PatientInfo;
import com.xinelu.manage.domain.patientnodeparamscurrent.PatientNodeParamsCurrent; 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.domain.wechattemplate.WechatTemplate;
import com.xinelu.manage.dto.patientinfo.PatientInfoDto; import com.xinelu.manage.dto.patientinfo.PatientInfoDto;
import com.xinelu.manage.dto.signpatientmanageroutenode.*; 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.labelfieldcontent.LabelFieldContentMapper;
import com.xinelu.manage.mapper.patientinfo.PatientAllInfoViewMapper; import com.xinelu.manage.mapper.patientinfo.PatientAllInfoViewMapper;
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper; import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
@ -87,6 +90,8 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.annotation.Resource; import javax.annotation.Resource;
import com.xinelu.system.mapper.SysUserMapper;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
@ -148,6 +153,10 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
private PhoneDialRecordMapper phoneDialRecordMapper; private PhoneDialRecordMapper phoneDialRecordMapper;
@Resource @Resource
private IAIOBService aiobService; private IAIOBService aiobService;
@Resource
private SysUserMapper sysUserMapper;
@Resource
private AgencyMapper agencyMapper;
/** /**
* 查询签约患者管理任务路径节点 * 查询签约患者管理任务路径节点
@ -1409,6 +1418,14 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage
if (Objects.nonNull(uploadRobotPublishRecordDto)){ if (Objects.nonNull(uploadRobotPublishRecordDto)){
uploadRobotPublishRecordDto.setQuestionType(QuestionTypeEnum.FEEDBACK_BLANKS_SUBJECT.getInfo()); 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<UploadRobotPublishRecordVo> uploadRobotPublishRecordVos = signPatientManageRouteNodeMapper.selectTaskContented(uploadRobotPublishRecordDto); List<UploadRobotPublishRecordVo> uploadRobotPublishRecordVos = signPatientManageRouteNodeMapper.selectTaskContented(uploadRobotPublishRecordDto);
//总分为0设为null //总分为0设为null
if(CollectionUtils.isNotEmpty(uploadRobotPublishRecordVos)){ if(CollectionUtils.isNotEmpty(uploadRobotPublishRecordVos)){

View File

@ -1161,10 +1161,6 @@
spmrn.sn, spmrn.sn,
spmrn.phone_node_execute_result_status, spmrn.phone_node_execute_result_status,
CASE 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 = 'AI' THEN 'AI'
WHEN spmrn.phone_dial_method = 'COMMON' THEN spmrn.route_handle_person WHEN spmrn.phone_dial_method = 'COMMON' THEN spmrn.route_handle_person
END AS phoneDialMethod, END AS phoneDialMethod,
@ -1178,23 +1174,46 @@
pqsr.remarkable_flag, pqsr.remarkable_flag,
pqsr.id, pqsr.id,
pqsr.total_score, pqsr.total_score,
pi.patient_phone, CASE
pi.patient_name, 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.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, pi.patient_visit_record_id,
pvr.main_diagnosis,
CASE CASE
WHEN spmrn.task_node_type = 'PHONE_OUTBOUND' THEN spmrn.script_info_id WHEN spmrn.task_node_type = 'PHONE_OUTBOUND' THEN spmrn.script_info_id
WHEN spmrn.task_node_type = 'QUESTIONNAIRE_SCALE' THEN qi.script_info_id WHEN spmrn.task_node_type = 'QUESTIONNAIRE_SCALE' THEN qi.script_info_id
END AS scriptTemplateId, END AS scriptTemplateId,
CASE 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 WHEN spmrn.task_node_type = 'QUESTIONNAIRE_SCALE' THEN qi.script_name
END AS scriptTemplateName, END AS scriptTemplateName,
(select fill_blanks_answer from patient_question_subject_result (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 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_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_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 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 WHERE
spmrn.del_flag = 0 spmrn.del_flag = 0 and spmrn.task_node_type in ('PHONE_OUTBOUND', 'QUESTIONNAIRE_SCALE')
<if test="departmentId != null"> <if test="departmentId != null">
and pi.department_id = #{departmentId} and pi.department_id = #{departmentId}
</if> </if>
<if test="hospitalAgencyId != null"> <if test="hospitalAgencyId != null">
and pi.hospital_agency_id = #{hospitalAgencyId} and (pi.hospital_agency_id = #{hospitalAgencyId} or bsti.hospital_agency_id = #{hospitalAgencyId})
</if> </if>
<if test="patientId != null"> <if test="patientId != null">
and pi.id = #{patientId} and pi.id = #{patientId}
@ -1223,9 +1243,6 @@
<if test="patientPhone != null"> <if test="patientPhone != null">
and pi.patient_phone = #{patientPhone} and pi.patient_phone = #{patientPhone}
</if> </if>
<if test="taskNodeType != null and taskNodeType != ''">
and spmrn.task_node_type = #{taskNodeType}
</if>
<if test="questionInfoId != null"> <if test="questionInfoId != null">
AND spmrn.question_info_id = #{questionInfoId} AND spmrn.question_info_id = #{questionInfoId}
</if> </if>
@ -1250,7 +1267,6 @@
<if test="contentedFlag != null and contentedFlag != ''"> <if test="contentedFlag != null and contentedFlag != ''">
and pqsr.contented_flag = #{contentedFlag} and pqsr.contented_flag = #{contentedFlag}
</if> </if>
${params.dataScope}
ORDER BY spmrn.create_time DESC ORDER BY spmrn.create_time DESC
</select> </select>