1、优化患者数据导入逻辑;
2、患者导入时,同步写入问诊ID; 3、修改部分bug
This commit is contained in:
parent
51ccd0d692
commit
929370c09d
@ -393,8 +393,11 @@ public class LabelFieldContentServiceImpl implements ILabelFieldContentService {
|
||||
}
|
||||
PatientAllInfoViewUppercase patientAllInfoView = patientAllInfoViews.get(0);
|
||||
retObj = JSONObject.parseObject(JSONObject.toJSONString(patientAllInfoView));
|
||||
// 性别转换成中文、计算年龄
|
||||
retObj.fluentPut("SEX", PatientSexEnum.getInfoByCode(patientAllInfoView.getSEX()).getInfo()).fluentPut("AGE", BaseUtil.getAge(patientAllInfoView.getBIRTHDATE()));
|
||||
try {
|
||||
// 性别转换成中文、计算年龄
|
||||
retObj.fluentPut("SEX", PatientSexEnum.getInfoByCode(patientAllInfoView.getSEX()).getInfo()).fluentPut("AGE", BaseUtil.getAge(patientAllInfoView.getBIRTHDATE()));
|
||||
}
|
||||
catch(Exception ex) {}
|
||||
return retObj;
|
||||
}
|
||||
}
|
||||
|
||||
@ -534,6 +534,19 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
|
||||
log.info("就诊记录表新增失败!");
|
||||
return AjaxResult.error("就诊记录新增失败");
|
||||
}
|
||||
// 更新 患者信息表中 的 最近一次问诊记录id
|
||||
for (PatientInfoImport patientInfoImport : patientInfoImportList) {
|
||||
//获取患者的最近一次就诊ID
|
||||
PatientVisitRecordDto patientVisitRecordDto = new PatientVisitRecordDto();
|
||||
patientVisitRecordDto.setPatientId(patientInfoImport.getPatientInfoId());
|
||||
PatientVisitRecord patientVisitRecord = patientVisitRecordMapper.getLastRecord(patientVisitRecordDto);
|
||||
PatientInfo patientInfo = new PatientInfo();
|
||||
patientInfo.setId(patientInfoImport.getPatientInfoId());
|
||||
// 修改患者最近一次就诊记录id
|
||||
patientInfo.setPatientVisitRecordId(patientVisitRecord.getId());
|
||||
patientInfoMapper.updatePatientInfoSelective(patientInfo);
|
||||
}
|
||||
|
||||
//endregion
|
||||
}
|
||||
String msg = "已完成数据导入!导入成功" + patientInfoImportList.size() + "条记录,失败0条记录";
|
||||
|
||||
@ -32,10 +32,12 @@ import com.xinelu.manage.domain.signpatientrecord.SignPatientRecord;
|
||||
import com.xinelu.manage.domain.signroutetriggercondition.SignRouteTriggerCondition;
|
||||
import com.xinelu.manage.dto.aiob.ActualTimeTaskDto;
|
||||
import com.xinelu.manage.dto.manualfollowup.ManualFollowUpDTO;
|
||||
import com.xinelu.manage.dto.patientinfo.PatientInfoDto;
|
||||
import com.xinelu.manage.dto.patientquestionoptionresult.PatientQuestionOptionResultDTO;
|
||||
import com.xinelu.manage.dto.patientquestionsubjectresult.PatientQuestionSubjectResultDTO;
|
||||
import com.xinelu.manage.dto.patientquestionsubmitresult.PatientQuestionSubmitResultDTO;
|
||||
import com.xinelu.manage.dto.signpatientmanageroutenode.CreateAiobActualTimeTaskDto;
|
||||
import com.xinelu.manage.dto.signpatientmanageroutenode.PatientTaskDto;
|
||||
import com.xinelu.manage.dto.smssend.SmsInfoDTO;
|
||||
import com.xinelu.manage.mapper.labelfieldcontent.LabelFieldContentMapper;
|
||||
import com.xinelu.manage.mapper.patientinfo.PatientInfoMapper;
|
||||
@ -62,6 +64,7 @@ import com.xinelu.manage.service.specialdiseaseroute.ISpecialDiseaseRouteService
|
||||
import com.xinelu.manage.vo.labelfieldcontent.LabelFieldInfoContentVo;
|
||||
import com.xinelu.manage.vo.manualfollowup.ManualFollowPatientVO;
|
||||
import com.xinelu.manage.vo.manualfollowup.ManualFollowUpVO;
|
||||
import com.xinelu.manage.vo.patientinfo.PatientInfoVo;
|
||||
import com.xinelu.manage.vo.propagandainfo.PropagandaMaterialsVo;
|
||||
import com.xinelu.manage.vo.questionInfo.QuestionVO;
|
||||
import com.xinelu.manage.vo.signpatientmanageroute.PhonePush;
|
||||
@ -182,6 +185,36 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public AjaxResult insertSignPatientManageRoute(SignPatientManageRouteVO signPatientManageRoute) {
|
||||
//如果是批量 创建
|
||||
if(StringUtils.isNotBlank(signPatientManageRoute.getSn()))
|
||||
{
|
||||
//获取患者信息
|
||||
List<PatientInfoVo> listPatient = new ArrayList<>();
|
||||
PatientInfoDto patientInfo = new PatientInfoDto();
|
||||
patientInfo.setSn(signPatientManageRoute.getSn());
|
||||
listPatient = patientInfoMapper.getPatientList(patientInfo);
|
||||
for(PatientInfoVo patientInfoVo : listPatient)
|
||||
{
|
||||
signPatientManageRoute.setPatientId(patientInfoVo.getId());
|
||||
signPatientManageRoute.setPatientName(patientInfoVo.getPatientName());
|
||||
signPatientManageRoute.setDepartmentId(patientInfoVo.getDepartmentId());
|
||||
signPatientManageRoute.setDepartmentName(patientInfoVo.getDepartmentName());
|
||||
AjaxResult ar = insertSignPatientManageRouteForPatient(signPatientManageRoute);
|
||||
//如果有错误码,直接返回;
|
||||
if(ar.containsValue(901))
|
||||
return ar;
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
else
|
||||
{
|
||||
return insertSignPatientManageRouteForPatient(signPatientManageRoute);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public AjaxResult insertSignPatientManageRouteForPatient(SignPatientManageRouteVO signPatientManageRoute)
|
||||
{
|
||||
// 新增主表
|
||||
signPatientManageRoute.setTaskCreateType(TaskCreateTypeEnum.MANUAL_CREATE.getInfo());
|
||||
signPatientManageRoute.setCreateBy(SecurityUtils.getUsername());
|
||||
@ -190,37 +223,54 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
if(StringUtils.isNotBlank(signPatientManageRoute.getImportMainId()))
|
||||
{ signPatientManageRoute.setTaskExcuteType(TaskExcuteTypeEnum.BATCH_TASK.getInfo());}
|
||||
|
||||
//任务路由主表 新增
|
||||
int insertRoute = signPatientManageRouteMapper.insertSignPatientManageRoute(signPatientManageRoute);
|
||||
if (insertRoute < 0) {
|
||||
return AjaxResult.error("新增签约患者管理任务路径失败!请联系管理员!");
|
||||
return AjaxResult.error(901,"新增签约患者管理任务路径失败!请联系管理员!");
|
||||
}
|
||||
// 新增节点表
|
||||
List<SignPatientManageRouteNode> signPatientManageRouteNodes = new ArrayList<>();
|
||||
for (SignPatientManageRouteNode routeNode : signPatientManageRoute.getRouteNodeList()) {
|
||||
if (Objects.isNull(routeNode) || StringUtils.isBlank(routeNode.getTaskNodeType()) || (" ").equals(routeNode.getTaskNodeType()) || StringUtils.isBlank(routeNode.getRouteNodeName()) || Objects.isNull(routeNode.getRouteNodeDay())) {
|
||||
if (Objects.isNull(routeNode) || StringUtils.isBlank(routeNode.getTaskNodeType()) || (" ").equals(routeNode.getTaskNodeType())
|
||||
|| (Objects.isNull(routeNode.getNodePlanTime()) && (StringUtils.isBlank(routeNode.getRouteNodeName()) || !Objects.isNull(routeNode.getRouteNodeDay()))) ||
|
||||
(Objects.isNull(routeNode.getRouteNodeDay()) && Objects.isNull(routeNode.getNodePlanTime()))) {
|
||||
continue;
|
||||
}
|
||||
//任务执行类型,批量执行
|
||||
if(StringUtils.isNotBlank(signPatientManageRoute.getImportMainId()))
|
||||
{ routeNode.setTaskExcuteType(TaskExcuteTypeEnum.BATCH_TASK.getInfo());}
|
||||
if(Objects.isNull(signPatientManageRoute.getSignPatientRecordId())) {
|
||||
//更新 审核状态为 已审核,适用场景:手动创建任务 zyk 20241204
|
||||
routeNode.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo());
|
||||
}
|
||||
extracted(signPatientManageRoute, signPatientManageRouteNodes, routeNode);
|
||||
}
|
||||
if (CollectionUtils.isEmpty(signPatientManageRouteNodes)) {
|
||||
return AjaxResult.error("创建任务中至少有一个管理任务节点!");
|
||||
return AjaxResult.error(901,"创建任务中至少有一个管理任务节点!");
|
||||
}
|
||||
//批量插入任务
|
||||
int insertBatchCount = signPatientManageRouteNodeMapper.insertBatch(signPatientManageRouteNodes);
|
||||
if (insertBatchCount < 0) {
|
||||
return AjaxResult.error("新增签约患者管理任务路径失败!请联系管理员!");
|
||||
return AjaxResult.error(901,"新增签约患者管理任务路径失败!请联系管理员!");
|
||||
}
|
||||
//更新 签约记录的 审核状态为 未审核,适用场景:手动创建任务 zyk 20241204
|
||||
|
||||
|
||||
SignPatientRecord signPatientRecord = new SignPatientRecord();
|
||||
signPatientRecord.setRouteCheckStatus(RouteCheckStatusEnum.UNAUDITED.getInfo());
|
||||
|
||||
if(Objects.isNull(signPatientManageRoute.getSignPatientRecordId())) {
|
||||
//更新 签约记录的 审核状态为 已审核,适用场景:手动创建任务 zyk 20241204
|
||||
signPatientRecord.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo());
|
||||
}
|
||||
else
|
||||
{
|
||||
//×××××更新 签约记录的 审核状态为 未审核,适用场景:手动创建任务 zyk 20241204
|
||||
signPatientRecord.setRouteCheckStatus(RouteCheckStatusEnum.UNAUDITED.getInfo());
|
||||
}
|
||||
|
||||
signPatientRecord.setId(signPatientManageRoute.getSignPatientRecordId());
|
||||
int updateRecord = signPatientRecordMapper.updateByPrimaryKeySelective(signPatientRecord);
|
||||
if (updateRecord < 0) {
|
||||
return AjaxResult.error("修改签约患者管理任务路径失败!请联系管理员!");
|
||||
return AjaxResult.error(901,"修改签约患者管理任务路径失败!请联系管理员!");
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
@ -301,7 +351,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询人工随访代办列表
|
||||
* 查询人工随访待办列表
|
||||
*
|
||||
* @param manualFollowUpDTO 人工随访查询DTO
|
||||
* @return ManualFollowUpVO 人工随访代办VO
|
||||
@ -312,35 +362,50 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
if (manualFollowUpDTO.getNodeExecuteStatus().equals(NodeExecuteStatusEnum.UNEXECUTED.getInfo())) {
|
||||
manualFollowUpDTO.setPhoneNodeExecuteResultStatus(null);
|
||||
}
|
||||
//1、查询
|
||||
List<ManualFollowUpVO> manualFollowUpVOS = signPatientManageRouteMapper.selectManualFollowUpList(manualFollowUpDTO);
|
||||
//2、1如果是查询已执行的任务,直接返回查询结果
|
||||
if (manualFollowUpDTO.getNodeExecuteStatus().equals(NodeExecuteStatusEnum.EXECUTED.getInfo())) {
|
||||
return manualFollowUpVOS;
|
||||
}
|
||||
//2.2如果是查询“所有”、"未执行“任务,则这届返回查询结果
|
||||
if (StringUtils.isNotBlank(manualFollowUpDTO.getTimeSign()) && manualFollowUpDTO.getTimeSign().equals("WHOLE")) {
|
||||
return manualFollowUpVOS;
|
||||
}
|
||||
//2.3如果是查询未执行(截止到当前时间)的任务,
|
||||
ArrayList<ManualFollowUpVO> manualFollowUps = new ArrayList<>();
|
||||
for (ManualFollowUpVO manualFollowUpVO : manualFollowUpVOS) {
|
||||
//判断路径节点,组装数据
|
||||
//3.1判断路径节点,组装数据
|
||||
//任务执行时间,
|
||||
LocalDate localDate = null;
|
||||
if (Objects.nonNull(manualFollowUpVO.getDischargeTime())) {
|
||||
localDate = manualFollowUpVO.getDischargeTime().plusDays(manualFollowUpVO.getRouteNodeDay()).toLocalDate();
|
||||
if(Objects.nonNull( manualFollowUpVO.getNodePlanTime()) && StringUtils.isNotBlank( manualFollowUpVO.getNodePlanTime().toString())) {
|
||||
localDate = manualFollowUpVO.getNodePlanTime().toLocalDate();
|
||||
}
|
||||
if (Objects.isNull(manualFollowUpVO.getDischargeTime()) && Objects.nonNull(manualFollowUpVO.getVisitTime())) {
|
||||
localDate = manualFollowUpVO.getVisitTime().plusDays(manualFollowUpVO.getRouteNodeDay()).toLocalDate();
|
||||
}
|
||||
if (Objects.isNull(localDate)) {
|
||||
continue;
|
||||
else {
|
||||
//3.2根据出院时间 和 第几天 计算
|
||||
if (Objects.nonNull(manualFollowUpVO.getDischargeTime())) {
|
||||
localDate = manualFollowUpVO.getDischargeTime().plusDays(manualFollowUpVO.getRouteNodeDay()).toLocalDate();
|
||||
}
|
||||
//3.3根据就诊时间 和 第几天 计算
|
||||
if (Objects.isNull(manualFollowUpVO.getDischargeTime()) && Objects.nonNull(manualFollowUpVO.getVisitTime())) {
|
||||
localDate = manualFollowUpVO.getVisitTime().plusDays(manualFollowUpVO.getRouteNodeDay()).toLocalDate();
|
||||
}
|
||||
//3.4如果为空,不予处理
|
||||
if (Objects.isNull(localDate)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//3.5如果截止到当前时间,已到期,则放入返回集合
|
||||
boolean before = localDate.isBefore(LocalDate.now()) || localDate.isEqual(LocalDate.now());
|
||||
if (before) {
|
||||
//转换成中文……
|
||||
manualFollowUpVO.setRouteNodeName(RouteNodeNameEnum.getNameByInfo(manualFollowUpVO.getRouteNodeName()).getName());
|
||||
manualFollowUpVO.setPlanTime(localDate);
|
||||
// 3.6 放入集合
|
||||
manualFollowUps.add(manualFollowUpVO);
|
||||
}
|
||||
}
|
||||
//返回所有未执行任务
|
||||
if (StringUtils.isNotBlank(manualFollowUpDTO.getTimeSign()) && manualFollowUpDTO.getTimeSign().equals("WHOLE")) {
|
||||
return manualFollowUpVOS;
|
||||
}
|
||||
|
||||
//返回今天之前任务
|
||||
return manualFollowUps;
|
||||
}
|
||||
@ -1009,6 +1074,8 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
signPatientManageRouteNode.setTaskExcuteType(TaskExcuteTypeEnum.BATCH_TASK.getInfo());
|
||||
else
|
||||
signPatientManageRouteNode.setTaskExcuteType(TaskExcuteTypeEnum.ACTUAL_TIME_TASK.getInfo());
|
||||
signPatientManageRouteNode.setNodePlanTime(routeNode.getNodePlanTime());
|
||||
|
||||
//电话外呼
|
||||
if (Objects.nonNull(routeNode) && TaskNodeTypeEnum.PHONE_OUTBOUND.getInfo().equals(routeNode.getTaskNodeType())) {
|
||||
signPatientManageRouteNode.setPhonePushSign(Objects.isNull(routeNode.getPhonePushSign()) ? null : routeNode.getPhonePushSign());
|
||||
@ -1065,6 +1132,7 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
|
||||
signPatientManageRouteNode.setRouteNodeDay(routeNode.getRouteNodeDay());
|
||||
signPatientManageRouteNode.setCreateTime(LocalDateTime.now());
|
||||
signPatientManageRouteNode.setCreateBy(SecurityUtils.getUsername());
|
||||
signPatientManageRouteNode.setRouteCheckStatus(routeNode.getRouteCheckStatus());
|
||||
signPatientManageRouteNodes.add(signPatientManageRouteNode);
|
||||
}
|
||||
|
||||
|
||||
@ -24,6 +24,10 @@ public class SignPatientManageRouteVO extends SignPatientManageRoute {
|
||||
@ApiModelProperty(value = "批量导入表ID")
|
||||
private String importMainId;
|
||||
|
||||
/** 批量导入表(patient_info_import_main表)流水号 */
|
||||
@ApiModelProperty(value = "批量导入表流水号")
|
||||
private String sn;
|
||||
|
||||
/**
|
||||
* 患者管理任务路径id
|
||||
*/
|
||||
|
||||
@ -500,6 +500,7 @@
|
||||
and card_no != #{cardNo,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</where>
|
||||
order by id desc limit 1
|
||||
</select>
|
||||
<select id="getVisitPatientList" resultType="com.xinelu.manage.vo.patientvisitrecord.PatientVisitRecordStatisticVo">
|
||||
select patient_id, hospital_agency_id, hospital_agency_name, campus_agency_id, campus_agency_name,
|
||||
@ -564,4 +565,4 @@
|
||||
#{item.updateTime,jdbcType=TIMESTAMP})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@ -338,8 +338,8 @@
|
||||
spmrn.route_node_name AS 'routeNodeName',
|
||||
spmrn.route_node_day,
|
||||
spmrn.task_node_type,
|
||||
spmrn.task_excute_type,
|
||||
spmrn.node_plan_time,
|
||||
spmrn.task_excute_type as 'taskExcuteType',
|
||||
spmrn.node_plan_time as 'nodePlanTime',
|
||||
CASE
|
||||
WHEN spmrn.task_node_type = 'PHONE_OUTBOUND' THEN spmrn.phone_template_name
|
||||
WHEN spmrn.task_node_type = 'QUESTIONNAIRE_SCALE' THEN spmrn.questionnaire_name
|
||||
@ -352,7 +352,9 @@
|
||||
spmrn.follow_template_id,
|
||||
spmrn.node_execute_status,
|
||||
spmrn.route_handle_remark,
|
||||
spmrn.phone_dial_method
|
||||
spmrn.phone_dial_method,
|
||||
spmrn.task_excute_type,
|
||||
spmrn.node_plan_time
|
||||
FROM
|
||||
sign_patient_manage_route spmr
|
||||
LEFT JOIN sign_patient_manage_route_node spmrn ON spmr.id = spmrn.manage_route_id
|
||||
@ -416,11 +418,11 @@
|
||||
AND spmrn.phone_dial_method = #{phoneDialMethod}
|
||||
</if>
|
||||
-- 如果是单个执行类型,应考虑默认为空时,按单个任务处理
|
||||
<if test="taskExcuteType != null and taskExcuteType = 'ACTUAL_TIME_TASK'">
|
||||
<if test="taskExcuteType != null and taskExcuteType!='' and taskExcuteType == 'ACTUAL_TIME_TASK'">
|
||||
and (spmrn.task_excute_type = #{taskExcuteType} or spmrn.task_excute_type is null or spmrn.task_excute_type='')
|
||||
</if>
|
||||
-- 批量任务处理时,直接按条件查询
|
||||
<if test="taskExcuteType != null and taskExcuteType = 'BATCH_TASK'">
|
||||
<if test="taskExcuteType != null and taskExcuteType!='' and taskExcuteType == 'BATCH_TASK'">
|
||||
and spmrn.task_excute_type = #{taskExcuteType}
|
||||
</if>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user