72 lines
3.5 KiB
Java
72 lines
3.5 KiB
Java
|
|
package com.xinelu.quartz.task;
|
||
|
|
|
||
|
|
import com.xinelu.common.enums.NodeExecuteStatusEnum;
|
||
|
|
import com.xinelu.common.enums.PhoneDialMethodEnum;
|
||
|
|
import com.xinelu.common.enums.TaskNodeTypeEnum;
|
||
|
|
import com.xinelu.manage.domain.patientvisitrecord.PatientVisitRecord;
|
||
|
|
import com.xinelu.manage.domain.signpatientmanageroute.SignPatientManageRoute;
|
||
|
|
import com.xinelu.manage.domain.signpatientmanageroutenode.SignPatientManageRouteNode;
|
||
|
|
import com.xinelu.manage.domain.signpatientrecord.SignPatientRecord;
|
||
|
|
import com.xinelu.manage.dto.signpatientmanageroutenode.SignPatientManageRouteNodeDto;
|
||
|
|
import com.xinelu.manage.mapper.patientvisitrecord.PatientVisitRecordMapper;
|
||
|
|
import com.xinelu.manage.mapper.signpatientmanageroute.SignPatientManageRouteMapper;
|
||
|
|
import com.xinelu.manage.mapper.signpatientmanageroutenode.SignPatientManageRouteNodeMapper;
|
||
|
|
import com.xinelu.manage.mapper.signpatientrecord.SignPatientRecordMapper;
|
||
|
|
import com.xinelu.manage.service.signpatientmanageroutenode.IRobotPublishService;
|
||
|
|
import com.xinelu.manage.service.signpatientmanageroutenode.ISignPatientManageRouteNodeService;
|
||
|
|
import java.time.LocalDate;
|
||
|
|
import java.time.LocalDateTime;
|
||
|
|
import java.util.ArrayList;
|
||
|
|
import java.util.List;
|
||
|
|
import javax.annotation.Resource;
|
||
|
|
import lombok.extern.slf4j.Slf4j;
|
||
|
|
import org.apache.commons.collections4.CollectionUtils;
|
||
|
|
import org.springframework.stereotype.Component;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @description: 爱医声上传任务定时任务
|
||
|
|
* @author: haown
|
||
|
|
* @create: 2024-08-19 13:58
|
||
|
|
**/
|
||
|
|
@Slf4j
|
||
|
|
@Component("UploadRobotPublishTask")
|
||
|
|
public class UploadRobotPublishTask {
|
||
|
|
|
||
|
|
@Resource
|
||
|
|
private SignPatientManageRouteNodeMapper signPatientManageRouteNodeMapper;
|
||
|
|
@Resource
|
||
|
|
private ISignPatientManageRouteNodeService signPatientManageRouteNodeService;
|
||
|
|
@Resource
|
||
|
|
private SignPatientManageRouteMapper signPatientManageRouteMapper;
|
||
|
|
@Resource
|
||
|
|
private SignPatientRecordMapper signPatientRecordMapper;
|
||
|
|
@Resource
|
||
|
|
private PatientVisitRecordMapper patientVisitRecordMapper;
|
||
|
|
@Resource
|
||
|
|
private IRobotPublishService robotPublishService;
|
||
|
|
|
||
|
|
public void uploadRobotPublishTask() {
|
||
|
|
log.info("开始执行爱医声上传任务定时任务......");
|
||
|
|
// 查找需要当天执行的AI打电话任务
|
||
|
|
SignPatientManageRouteNodeDto signPatientManageRouteNodeDto = new SignPatientManageRouteNodeDto();
|
||
|
|
signPatientManageRouteNodeDto.setTaskNodeType(TaskNodeTypeEnum.PHONE_OUTBOUND.getInfo());
|
||
|
|
signPatientManageRouteNodeDto.setNodeExecuteStatus(NodeExecuteStatusEnum.UNEXECUTED.getInfo());
|
||
|
|
signPatientManageRouteNodeDto.setPhoneDialMethod(PhoneDialMethodEnum.AI.getInfo());
|
||
|
|
List<SignPatientManageRouteNode> nodeList = signPatientManageRouteNodeMapper.selectSignPatientManageRouteNodeList(signPatientManageRouteNodeDto);
|
||
|
|
|
||
|
|
List<SignPatientManageRouteNode> executeNodeList = new ArrayList<>();
|
||
|
|
nodeList.forEach(node -> {
|
||
|
|
SignPatientManageRoute signPatientManageRoute = signPatientManageRouteMapper.selectSignPatientManageRouteById(node.getManageRouteId());
|
||
|
|
SignPatientRecord signPatientRecord = signPatientRecordMapper.selectByPrimaryKey(signPatientManageRoute.getSignPatientRecordId());
|
||
|
|
PatientVisitRecord patientVisitRecord = patientVisitRecordMapper.selectPatientVisitRecordById(signPatientRecord.getPatientVisitRecordId());
|
||
|
|
LocalDateTime executeTime = signPatientManageRouteNodeService.getExecuteTime(node.getExecuteTime(), node.getRouteNodeName(), node.getRouteNodeDay(), patientVisitRecord);
|
||
|
|
if (executeTime.toLocalDate().isBefore(LocalDate.now())) {
|
||
|
|
executeNodeList.add(node);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
if (CollectionUtils.isNotEmpty(executeNodeList)) {
|
||
|
|
//robotPublishService.uploadRobotPublishTask(executeNodeList);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|