生成子路径任务定时任务。
This commit is contained in:
parent
e322b48110
commit
bbea24ebe9
@ -39,7 +39,7 @@ public interface SignPatientManageRouteMapper {
|
||||
* @param signPatientManageRoute 签约患者管理任务路径
|
||||
* @return 签约患者管理任务路径集合
|
||||
*/
|
||||
public List<SignPatientManageRoute> selectSignPatientManageRouteList(SignPatientManageRoute signPatientManageRoute);
|
||||
List<SignPatientManageRoute> selectSignPatientManageRouteList(SignPatientManageRoute signPatientManageRoute);
|
||||
|
||||
/**
|
||||
* 新增签约患者管理任务路径
|
||||
|
||||
@ -590,8 +590,8 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
// 人工随访
|
||||
case TaskContentConstants.ARTIFICIAL_FOLLOW_UP:
|
||||
// 查询问卷详情
|
||||
if (StringUtils.isNotBlank(manageNode.getPhoneTemplateId())) {
|
||||
QuestionVO questionVO1 = questionInfoService.selectQuestionInfoById(Long.valueOf(manageNode.getPhoneTemplateId()));
|
||||
if (manageNode.getFollowTemplateId() != null) {
|
||||
QuestionVO questionVO1 = questionInfoService.selectQuestionInfoById(manageNode.getFollowTemplateId());
|
||||
if (ObjectUtils.isNotEmpty(questionVO1)) {
|
||||
templateDetail = JSONObject.parseObject(JSONObject.toJSONString(questionVO1));
|
||||
manageNode.setTemplateType(TemplateTypeConstants.QUESTIONNAIRE);
|
||||
|
||||
@ -188,20 +188,19 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService {
|
||||
if (ObjectUtils.isEmpty(body.getRoute()) || body.getRoute().getRouteId() == null) {
|
||||
throw new ServiceException("请选择管理路径");
|
||||
}
|
||||
// 保存管理路径主路径
|
||||
// 保存管理路径
|
||||
SignPatientManageRoute signPatientManageRoute = body.getRoute();
|
||||
List<SpecialDiseaseRoute> specialDiseaseRouteList = specialDiseaseRouteMapper.selectRouteAndChildren(signPatientManageRoute.getRouteId());
|
||||
specialDiseaseRouteList.forEach(specialDiseaseRoute -> {
|
||||
BeanUtils.copyBeanProp(signPatientManageRoute, specialDiseaseRoute);
|
||||
signPatientManageRoute.setSignPatientRecordId(signPatientRecord.getId());
|
||||
signPatientManageRoute.setPatientId(patient.getId());
|
||||
signPatientManageRoute.setId(null);
|
||||
signPatientManageRoute.setRouteId(specialDiseaseRoute.getId());
|
||||
signPatientManageRoute.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE);
|
||||
signPatientManageRoute.setCreateTime(LocalDateTime.now());
|
||||
signPatientManageRoute.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
||||
signPatientManageRouteMapper.insertSignPatientManageRoute(signPatientManageRoute);
|
||||
});
|
||||
SpecialDiseaseRoute specialDiseaseRoute = specialDiseaseRouteMapper.selectSpecialDiseaseRouteById(signPatientManageRoute.getRouteId());
|
||||
BeanUtils.copyBeanProp(signPatientManageRoute, specialDiseaseRoute);
|
||||
signPatientManageRoute.setSignPatientRecordId(signPatientRecord.getId());
|
||||
signPatientManageRoute.setPatientId(patient.getId());
|
||||
signPatientManageRoute.setId(null);
|
||||
signPatientManageRoute.setRouteId(specialDiseaseRoute.getId());
|
||||
signPatientManageRoute.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE);
|
||||
signPatientManageRoute.setParentRouteId(0L);
|
||||
signPatientManageRoute.setCreateTime(LocalDateTime.now());
|
||||
signPatientManageRoute.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
||||
signPatientManageRouteMapper.insertSignPatientManageRoute(signPatientManageRoute);
|
||||
|
||||
// 保存硬件
|
||||
if (!CollectionUtils.isEmpty(body.getDevices())) {
|
||||
|
||||
@ -245,7 +245,7 @@ public class SpecialDiseaseTriggerConditionServiceImpl implements ISpecialDiseas
|
||||
routeName.append("|"+ triggerCondition.getDictLabel() + DictUtils.getDictLabel("trigger_condition_operator", item.getTriggerConditionOperator()) + triggerConditionValue);
|
||||
}
|
||||
if (i == 2) {
|
||||
routeName.append("(" + triggerCondition.getDictLabel() + ")" + DictUtils.getDictLabel("trigger_condition_name", item.getTriggerConditionCode()) + DictUtils.getDictLabel("trigger_condition_operator", item.getTriggerConditionOperator()) + triggerConditionValue);
|
||||
routeName.append("(" + DictUtils.getDictLabel("trigger_logic", item.getTriggerLogic()) + ")" + DictUtils.getDictLabel("trigger_condition_name", item.getTriggerConditionCode()) + DictUtils.getDictLabel("trigger_condition_operator", item.getTriggerConditionOperator()) + triggerConditionValue);
|
||||
}
|
||||
}
|
||||
return routeName.toString();
|
||||
|
||||
@ -162,7 +162,7 @@
|
||||
and disease_type_name like concat('%', #{diseaseTypeName}, '%')
|
||||
</if>
|
||||
<if test="parentRouteId == null">
|
||||
and parent_route_id = 0
|
||||
and (parent_route_id = 0 or parent_route_id is null)
|
||||
</if>
|
||||
<if test="parentRouteId != null ">
|
||||
and parent_route_id = #{parentRouteId}
|
||||
|
||||
@ -1,8 +1,20 @@
|
||||
package com.xinelu.quartz.task;
|
||||
|
||||
import com.xinelu.common.constant.SignRecordServiceStatusConstants;
|
||||
import com.xinelu.common.constant.TaskCreateTypeConstant;
|
||||
import com.xinelu.common.enums.RouteCheckStatusEnum;
|
||||
import com.xinelu.manage.domain.signpatientmanageroute.SignPatientManageRoute;
|
||||
import com.xinelu.manage.domain.specialdiseaseroute.SpecialDiseaseRoute;
|
||||
import com.xinelu.manage.dto.signpatientrecord.SignPatientListDto;
|
||||
import com.xinelu.manage.mapper.signpatientmanageroute.SignPatientManageRouteMapper;
|
||||
import com.xinelu.manage.mapper.signpatientrecord.SignPatientRecordMapper;
|
||||
import com.xinelu.manage.service.signpatientrecord.ISignPatientRecordService;
|
||||
import com.xinelu.manage.mapper.specialdiseaseroute.SpecialDiseaseRouteMapper;
|
||||
import com.xinelu.manage.service.signpatientmanageroutenode.ISignPatientManageRouteNodeService;
|
||||
import com.xinelu.manage.vo.signpatientrecord.SignPatientListVo;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@ -10,20 +22,53 @@ import org.springframework.stereotype.Component;
|
||||
* @author: haown
|
||||
* @create: 2024-06-28 14:27
|
||||
**/
|
||||
@Slf4j
|
||||
@Component("GenerateChildRouteTask")
|
||||
public class GenerateChildRouteTask {
|
||||
|
||||
@Resource
|
||||
private ISignPatientRecordService signPatientRecordService;
|
||||
|
||||
@Resource
|
||||
private SignPatientRecordMapper signPatientRecordMapper;
|
||||
@Resource
|
||||
private SignPatientManageRouteMapper signPatientManageRouteMapper;
|
||||
@Resource
|
||||
private SpecialDiseaseRouteMapper specialDiseaseRouteMapper;
|
||||
@Resource
|
||||
private ISignPatientManageRouteNodeService signPatientManageRouteNodeService;
|
||||
|
||||
public void GenerateChildRouteTask() {
|
||||
// 查询在签患者
|
||||
log.info("开始执行生成子路径任务定时任务......");
|
||||
// 查询画像和路径都审核通过的在签患者
|
||||
SignPatientListDto signPatientRecord = new SignPatientListDto();
|
||||
signPatientRecord.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo());
|
||||
signPatientRecord.setServiceStatus(SignRecordServiceStatusConstants.IN_SIGN);
|
||||
List<SignPatientListVo> signPatientList = signPatientRecordMapper.selectList(signPatientRecord);
|
||||
// 查询患者签约专病路径包含的子路径id
|
||||
// 查询签约路径表已生成的子路径id
|
||||
// 取差集
|
||||
// 生成子路径任务
|
||||
signPatientList.forEach(signPatient -> {
|
||||
// 查询签约路径
|
||||
SignPatientManageRoute manageRouteQuery = new SignPatientManageRoute();
|
||||
manageRouteQuery.setSignPatientRecordId(signPatient.getId());
|
||||
manageRouteQuery.setTaskCreateType(TaskCreateTypeConstant.MANUAL_MATCHE);
|
||||
List<SignPatientManageRoute> manageRouteList = signPatientManageRouteMapper.selectSignPatientManageRouteList(manageRouteQuery);
|
||||
if (CollectionUtils.isNotEmpty(manageRouteList)) {
|
||||
SignPatientManageRoute signPatientManageRoute = manageRouteList.get(0);
|
||||
SpecialDiseaseRoute specialDiseaseRouteQuery = new SpecialDiseaseRoute();
|
||||
specialDiseaseRouteQuery.setParentRouteId(signPatientManageRoute.getRouteId());
|
||||
List<SpecialDiseaseRoute> childSpecialRoutes = specialDiseaseRouteMapper.selectSpecialDiseaseRouteList(specialDiseaseRouteQuery);
|
||||
if (CollectionUtils.isNotEmpty(childSpecialRoutes)) {
|
||||
childSpecialRoutes.forEach(specialDiseaseRoute -> {
|
||||
// 查询路径是否生成过任务
|
||||
manageRouteQuery.setTaskCreateType(TaskCreateTypeConstant.MANUAL_CREATE);
|
||||
manageRouteQuery.setRouteId(specialDiseaseRoute.getId());
|
||||
manageRouteQuery.setParentRouteId(signPatientManageRoute.getId());
|
||||
List<SignPatientManageRoute> createManageRouteList = signPatientManageRouteMapper.selectSignPatientManageRouteList(manageRouteQuery);
|
||||
if (CollectionUtils.isEmpty(createManageRouteList)) {
|
||||
log.info("开始生成" + signPatient.getPatientName() + "子路径任务定时任务......");
|
||||
signPatientManageRouteNodeService.generateChildRouteTask(signPatient.getPatientId(), signPatient.getId(), specialDiseaseRoute.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
log.info("完成生成子路径任务定时任务......");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user