直接外呼

This commit is contained in:
zhangheng 2025-03-21 09:41:06 +08:00
parent 540b4f89a3
commit 82055adb98
13 changed files with 289 additions and 17 deletions

View File

@ -0,0 +1,36 @@
package com.xinelu.common.enums;
import lombok.Getter;
/**
* 适用范围在院IN_THE_HOSPITAL出院DISCHARGE门诊OUTPATIENT_SERVICE门诊+出院OUTPATIENT_SERVICE_DISCHARGE',`route_sort` int DEFAULT NULL COMMENT '排序'
*/
@Getter
public enum SuitRangeEnum {
/**
* 在院
*/
IN_THE_HOSPITAL("IN_THE_HOSPITAL"),
/**
* 出院
*/
DISCHARGE("DISCHARGE"),
/**
* 门诊
*/
OUTPATIENT_SERVICE("DISCHARGE"),
/**
* 门诊+出院
*/
OUTPATIENT_SERVICE_DISCHARGE("OUTPATIENT_SERVICE_DISCHARGE"),
;
final private String info;
SuitRangeEnum(String info) {
this.info = info;
}
}

View File

@ -10,6 +10,7 @@ import com.xinelu.common.custominterface.Insert;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.signpatientmanageroute.SignPatientManageRoute;
import com.xinelu.manage.domain.signpatientmanageroutenode.SignPatientManageRouteNode;
import com.xinelu.manage.dto.manualfollowup.ManualFollowUpDTO;
import com.xinelu.manage.dto.patientquestionsubmitresult.PatientQuestionSubmitResultDTO;
import com.xinelu.manage.dto.signpatientmanageroutenode.CreateAiobActualTimeTaskDto;
@ -21,19 +22,13 @@ import com.xinelu.manage.vo.signpatientrecord.SignPatientRecordSelectVo;
import com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteAuditVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 签约患者管理任务路径控制器
@ -197,4 +192,16 @@ public class SignPatientManageRouteController extends BaseController {
public AjaxResult batchDeleteTask(@RequestBody Long[] ids) {
return signPatientManageRouteService.batchDeleteTask(ids);
}
@ApiOperation("外呼确认")
@GetMapping("/outboundConfirmation")
public AjaxResult outboundConfirmation() {
return signPatientManageRouteService.outboundConfirmation();
}
@ApiOperation("直接外呼")
@PostMapping("/directOutbound")
public AjaxResult directOutbound(@RequestBody SignPatientManageRouteNode signPatientManageRouteNode) {
return signPatientManageRouteService.directOutbound(signPatientManageRouteNode);
}
}

View File

@ -91,4 +91,5 @@ public class SignPatientManageRouteNodeDto {
private LocalDateTime nodePlanTime;
private String createBy;
}

View File

@ -30,6 +30,12 @@ public interface LabelFieldContentMapper {
*/
public List<LabelFieldContent> selectLabelFieldContentByPatientId(Long patientId);
/**
*
* @param patientId
* @return
*/
List<LabelFieldContent> selectLabelFieldContentByPatientIds(List<Long> patientId);
/**
* 查询标签字段内容信息列表

View File

@ -148,4 +148,12 @@ public interface SignPatientManageRouteMapper {
* @return SignPatientManageRoute
*/
List<Long> selectParentRouteIdByRouteId(List<Long> ids);
/**
* 批量添加节点表
*
* @param signPatientManageRoutes 节点信息
* @return int
*/
int insertBatch(List<SignPatientManageRoute> signPatientManageRoutes);
}

View File

@ -33,7 +33,7 @@ public interface SignPatientManageRouteNodeMapper {
SignPatientManageRouteNode selectSignPatientManageRouteNodeById(Long id);
/**
* 查询患者管理路径节点
* 查询患者任务管理路径节点
*
* @param patientTaskDto 任务查询传输对象
* @return 患者管理任务路径节点
@ -94,6 +94,7 @@ public interface SignPatientManageRouteNodeMapper {
/**
* 根据ManageRouteId 修改 拔打状态
*
* @param signPatientManageRouteNode
* @return
*/
@ -247,4 +248,12 @@ public interface SignPatientManageRouteNodeMapper {
* @return Long
*/
List<Long> selectManageRouteIdByIds(Long[] ids);
/**
* 查询节点信息
*
* @param signPatientManageRouteNode 节点信息
* @return SignPatientManageRouteNode
*/
SignPatientManageRouteNode selectSignPatientManageRouteNode(SignPatientManageRouteNode signPatientManageRouteNode);
}

View File

@ -29,6 +29,14 @@ public interface ILabelFieldContentService {
*/
List<LabelFieldContent> selectLabelFieldContentByPatientId(Long patientId);
/**
* 批量查询标签字段内容信息对象
*
* @param patientId 患者信息
* @return LabelFieldContent
*/
List<LabelFieldContent> selectLabelFieldContentByPatientIds(List<Long> patientId);
/**
* 查询标签字段内容信息列表
*

View File

@ -78,6 +78,17 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
return labelFieldContentMapper.selectLabelFieldContentByPatientId(patientId);
}
/**
* 批量查询标签字段内容信息对象
*
* @param patientId 患者信息
* @return LabelFieldContent
*/
@Override
public List<LabelFieldContent> selectLabelFieldContentByPatientIds(List<Long> patientId) {
return labelFieldContentMapper.selectLabelFieldContentByPatientIds(patientId);
}
/**
* 查询标签字段内容信息列表
*
@ -221,7 +232,6 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
patientTaskDto.setPatientId(patientId);
//根据患者id查询节点富文本所需标签
List<SignPatientManageRouteNode> nodeList = signPatientManageRouteNodeMapper.getNodeList(patientTaskDto);
//同上一句代码 好像有重复zyk 20241211
List<SignPatientManageRouteNode> routeNodeContentList = signPatientManageRouteNodeMapper.getRouteNodeContentList(patientId);
if (CollectionUtils.isNotEmpty(routeNodeContentList)) {
nodeList.addAll(routeNodeContentList);

View File

@ -4,6 +4,7 @@ import com.aliyuncs.exceptions.ClientException;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.manage.domain.signpatientmanageroute.SignPatientManageRoute;
import com.xinelu.manage.domain.signpatientmanageroutenode.SignPatientManageRouteNode;
import com.xinelu.manage.dto.manualfollowup.ManualFollowUpDTO;
import com.xinelu.manage.dto.patientquestionsubmitresult.PatientQuestionSubmitResultDTO;
import com.xinelu.manage.dto.signpatientmanageroutenode.CreateAiobActualTimeTaskDto;
@ -149,4 +150,18 @@ public interface ISignPatientManageRouteService {
* @return AjaxResult
*/
AjaxResult batchDeleteTask(Long[] ids);
/**
* 外呼确认
*
* @return AjaxResult
*/
AjaxResult outboundConfirmation();
/**
* 直接外呼
*
* @return AjaxResult
*/
AjaxResult directOutbound(SignPatientManageRouteNode signPatientManageRouteNode);
}

View File

@ -18,6 +18,7 @@ import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.AgeUtil;
import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.manage.domain.labelfieldcontent.LabelFieldContent;
import com.xinelu.manage.domain.patientinfo.PatientInfo;
import com.xinelu.manage.domain.patientquestionoptionresult.PatientQuestionOptionResult;
import com.xinelu.manage.domain.patientquestionsubjectresult.PatientQuestionSubjectResult;
@ -208,7 +209,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
patientInfo.setSn(signPatientManageRoute.getSn());
listPatient = patientInfoMapper.getPatientList(patientInfo);
if (CollectionUtils.isNotEmpty(listPatient) && listPatient.size() > 100) {
return AjaxResult.error("创建任务数量超出当日上限,请减少创建任务数量!");
return AjaxResult.error("创建任务数量超出当日上限,请减少创建任务数量!");
}
if (CollectionUtils.isNotEmpty(listPatient) && CollectionUtils.isNotEmpty(signPatientManageRouteNodes) && (listPatient.size() + signPatientManageRouteNodes.size()) > 100) {
return AjaxResult.error("创建任务数量超出当日上限,请减少创建任务数量!");
@ -293,7 +294,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
}
}
//适用场景对未签约患者 手动创建任务 或已签约但尚未审核画像的
if(labelFieldContentService.selectLabelFieldContentByPatientId(signPatientManageRoute.getPatientId()).size()==0) {
if (labelFieldContentService.selectLabelFieldContentByPatientId(signPatientManageRoute.getPatientId()).size() == 0) {
//获取画像信息
List<LabelFieldAndPartitionDict> labelFieldAndPartitionDictList = labelFieldContentService.groupingValue(0L, signPatientManageRoute.getPatientId());
// 画像信息保存
@ -405,11 +406,11 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
List<SysDictData> sysDictDataList = sysDictDataMapper.selectDictDataByTypeList(strings);
for (ManualFollowUpVO manualFollowUpVO : manualFollowUpVOS) {
SysDictData taskNodeType = sysDictDataList.stream().filter(Objects::nonNull).filter(item -> item.getDictValue().equals(manualFollowUpVO.getTaskNodeType())).findFirst().orElse(new SysDictData());
if (StringUtils.isNotBlank(taskNodeType.getDictLabel())){
if (StringUtils.isNotBlank(taskNodeType.getDictLabel())) {
manualFollowUpVO.setTaskNodeTypeName(taskNodeType.getDictLabel());
}
SysDictData routeNodeName = sysDictDataList.stream().filter(Objects::nonNull).filter(item -> item.getDictValue().equals(manualFollowUpVO.getRouteNodeName())).findFirst().orElse(new SysDictData());
if (StringUtils.isNotBlank(routeNodeName.getDictLabel())){
if (StringUtils.isNotBlank(routeNodeName.getDictLabel())) {
manualFollowUpVO.setRouteNode(routeNodeName.getDictLabel());
}
}
@ -867,6 +868,122 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
return AjaxResult.success();
}
@Override
public AjaxResult outboundConfirmation() {
SignPatientManageRouteNode signPatientManageRouteNode = new SignPatientManageRouteNode();
signPatientManageRouteNode.setCreateBy(SecurityUtils.getUsername());
SignPatientManageRouteNode databaseNode = signPatientManageRouteNodeMapper.selectSignPatientManageRouteNode(signPatientManageRouteNode);
if (Objects.isNull(databaseNode)){
return AjaxResult.success(null,null);
}
return AjaxResult.success(databaseNode);
}
/**
* 直接外呼
*
* @return AjaxResult
*/
@Override
public AjaxResult directOutbound(SignPatientManageRouteNode introducedNode) {
//如果是批量 创建
SignPatientManageRouteNodeDto signPatientManageRouteNode = new SignPatientManageRouteNodeDto();
signPatientManageRouteNode.setNodePlanTime(LocalDateTime.now());
List<SignPatientManageRouteNode> signPatientManageRouteNodes = signPatientManageRouteNodeMapper.selectSignPatientManageRouteNodeList(signPatientManageRouteNode);
if (CollectionUtils.isNotEmpty(signPatientManageRouteNodes) && signPatientManageRouteNodes.size() >= 100) {
return AjaxResult.error("今日创建任务已达上线,请改日创建任务!");
}
//获取患者信息
List<PatientInfoVo> listPatient = new ArrayList<>();
PatientInfoDto patientInfo = new PatientInfoDto();
patientInfo.setSn(introducedNode.getSn());
listPatient = patientInfoMapper.getPatientList(patientInfo);
if (CollectionUtils.isNotEmpty(listPatient) && listPatient.size() > 100) {
return AjaxResult.error("创建任务数量超出当日上限,请减少创建任务数量!");
}
if (CollectionUtils.isNotEmpty(listPatient) && CollectionUtils.isNotEmpty(signPatientManageRouteNodes) && (listPatient.size() + signPatientManageRouteNodes.size()) > 100) {
return AjaxResult.error("创建任务数量超出当日上限,请减少创建任务数量!");
}
List<SignPatientManageRoute> signPatientManageRoutes = new ArrayList<>();
ArrayList<SignPatientManageRouteNode> saveNodes = new ArrayList<>();
for (PatientInfoVo patientInfoVo : listPatient) {
SignPatientManageRoute signPatientManageRoute = new SignPatientManageRoute();
signPatientManageRoute.setPatientId(patientInfoVo.getId());
signPatientManageRoute.setPatientName(patientInfoVo.getPatientName());
signPatientManageRoute.setDepartmentId(patientInfoVo.getDepartmentId());
signPatientManageRoute.setDepartmentName(patientInfoVo.getDepartmentName());
signPatientManageRoute.setRouteName(introducedNode.getManageRouteName());
signPatientManageRoute.setTaskCreateType(TaskCreateTypeEnum.MANUAL_CREATE.getInfo());
signPatientManageRoute.setSuitRange(SuitRangeEnum.OUTPATIENT_SERVICE_DISCHARGE.getInfo());
signPatientManageRoute.setTaskExcuteType(TaskExcuteTypeEnum.BATCH_TASK.getInfo());
signPatientManageRoute.setCreateBy(SecurityUtils.getUsername());
signPatientManageRoute.setCreateTime(LocalDateTime.now());
signPatientManageRoutes.add(signPatientManageRoute);
}
if (CollectionUtils.isNotEmpty(signPatientManageRoutes)) {
int i = signPatientManageRouteMapper.insertBatch(signPatientManageRoutes);
if (i < 0) {
return AjaxResult.error("创建任务失败,请联系管理员!");
}
for (SignPatientManageRoute signPatientManageRoute : signPatientManageRoutes) {
SignPatientManageRouteNode saveNode = new SignPatientManageRouteNode();
saveNode.setManageRouteId(signPatientManageRoute.getId());
saveNode.setManageRouteName(signPatientManageRoute.getRouteName());
saveNode.setSn(introducedNode.getSn());
saveNode.setDialStatus(DialStatusEnum.NODIALED.getInfo());
saveNode.setTaskExcuteType(TaskExcuteTypeEnum.BATCH_TASK.getInfo());
saveNode.setNodePlanTime(LocalDateTime.now());
saveNode.setTaskNodeType(introducedNode.getTaskNodeType());
saveNode.setPhonePushSign(introducedNode.getPhonePushSign());
saveNode.setScriptInfoId(introducedNode.getScriptInfoId());
saveNode.setRobotPublishId(introducedNode.getRobotPublishId());
saveNode.setPhoneDialMethod(introducedNode.getPhoneDialMethod());
saveNode.setPhoneRedialTimes(introducedNode.getPhoneRedialTimes());
saveNode.setPhoneTimeInterval(introducedNode.getPhoneTimeInterval());
saveNode.setQuestionInfoId(introducedNode.getQuestionInfoId());
saveNode.setQuestionnaireName(introducedNode.getQuestionnaireName());
saveNode.setMessagePushSign(introducedNode.getMessagePushSign());
saveNode.setOfficialPushSign(introducedNode.getOfficialPushSign());
saveNode.setAppletPushSign(introducedNode.getAppletPushSign());
saveNode.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo());
saveNode.setRouteCheckDate(LocalDateTime.now());
saveNode.setNodeExecuteStatus(NodeExecuteStatusEnum.UNEXECUTED.getInfo());
saveNode.setCreateBy(SecurityUtils.getUsername());
saveNode.setCreateTime(LocalDateTime.now());
saveNodes.add(saveNode);
}
int i1 = signPatientManageRouteNodeMapper.insertBatch(saveNodes);
if (i1 < 0) {
return AjaxResult.error("创建任务失败,请联系管理员!");
}
List<Long> patientIds = listPatient.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getId())).map(PatientInfoVo::getId).collect(Collectors.toList());
List<LabelFieldContent> labelFieldContents = labelFieldContentService.selectLabelFieldContentByPatientIds(patientIds);
List<Long> manualCreateTaskPatientIds = new ArrayList<>();
if (CollectionUtils.isNotEmpty(labelFieldContents)) {
for (Long patientId : patientIds) {
LabelFieldContent labelFieldContent = labelFieldContents.stream().filter(Objects::nonNull).filter(item -> patientId.equals(item.getPatientId())).findFirst().orElse(new LabelFieldContent());
if (Objects.isNull(labelFieldContent.getPatientId())) {
manualCreateTaskPatientIds.add(patientId);
}
}
} else {
manualCreateTaskPatientIds.addAll(patientIds);
}
if (CollectionUtils.isEmpty(manualCreateTaskPatientIds)) {
for (Long manualCreateTaskPatientId : manualCreateTaskPatientIds) {
List<LabelFieldAndPartitionDict> labelFieldAndPartitionDictList = labelFieldContentService.groupingValue(0L, manualCreateTaskPatientId);
// 画像信息保存
LabelField labelField = new LabelField();
labelField.setLabelFieldAndPartitionDictList(labelFieldAndPartitionDictList);
labelFieldContentService.insertLabelField(labelField);
// 替换手动生成的任务中的标签
signPatientManageRouteNodeService.manualCreateTaskLabelReplaceByPatientId(manualCreateTaskPatientId);
}
}
}
return AjaxResult.success();
}
/**
* 电话记录

View File

@ -457,4 +457,13 @@
</if>
</where>
</select>
<select id="selectLabelFieldContentByPatientIds"
resultType="com.xinelu.manage.domain.labelfieldcontent.LabelFieldContent">
<include refid="selectLabelFieldContentVo"/>
where patient_id IN
<foreach item="patientId" collection="list" open="(" separator="," close=")">
#{patientId}
</foreach>
</select>
</mapper>

View File

@ -574,6 +574,36 @@
</trim>
</insert>
<insert id="insertBatch" useGeneratedKeys="true" keyProperty="id">
insert into sign_patient_manage_route
(
patient_id,
patient_name,
department_id,
department_name,
route_name,
task_create_type,
suit_range,
task_excute_type,
create_by,
create_time
) values
<foreach item="SignPatientManageRoute" index="index" collection="list" separator=",">
(
#{SignPatientManageRoute.patientId},
#{SignPatientManageRoute.patientName},
#{SignPatientManageRoute.departmentId},
#{SignPatientManageRoute.departmentName},
#{SignPatientManageRoute.routeName},
#{SignPatientManageRoute.taskCreateType},
#{SignPatientManageRoute.suitRange},
#{SignPatientManageRoute.taskExcuteType},
#{SignPatientManageRoute.createBy},
#{SignPatientManageRoute.createTime}
)
</foreach>
</insert>
<update id="updateSignPatientManageRoute" parameterType="com.xinelu.manage.domain.signpatientmanageroute.SignPatientManageRoute">
update sign_patient_manage_route
<trim prefix="SET" suffixOverrides=",">

View File

@ -1415,4 +1415,20 @@
#{id}
</foreach>
</select>
<select id="selectSignPatientManageRouteNode"
resultType="com.xinelu.manage.domain.signpatientmanageroutenode.SignPatientManageRouteNode">
select task_node_type,
phone_push_sign,
script_info_id,
robot_publish_id,
phone_dial_method,
phone_redial_times,
phone_time_interval,
question_info_id,
questionnaire_name
from sign_patient_manage_route_node
where create_by = #{createBy}
order by create_time desc limit 1
</select>
</mapper>