diff --git a/postdischarge-common/src/main/java/com/xinelu/common/utils/BaseUtil.java b/postdischarge-common/src/main/java/com/xinelu/common/utils/BaseUtil.java new file mode 100644 index 00000000..5f56b466 --- /dev/null +++ b/postdischarge-common/src/main/java/com/xinelu/common/utils/BaseUtil.java @@ -0,0 +1,291 @@ +package com.xinelu.common.utils; + +import java.time.LocalDate; +import java.util.Calendar; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.apache.commons.lang3.StringUtils; + +/** + * @description: 基本工具类 + * @author: mengkuiliang + * @createDate: 2021-12-03 10:50 + */ +public class BaseUtil { + + /** + * @return java.lang.String + * @Author mengkuiliang + * @Description 根据身份证号计算年龄(周岁) + * @Date 2021-12-03 11:03 + * @Param [identity] + **/ + public static String calculateAgeByIdentity(String identity) { + + if (StringUtils.isBlank(identity)) { + return ""; + } + String age; + Calendar cal = Calendar.getInstance(); + int yearNow = cal.get(Calendar.YEAR); + int monthNow = cal.get(Calendar.MONTH) + 1; + int dayNow = cal.get(Calendar.DATE); + int year = 0; + int month = 0; + int day = 0; + if(identity.length() == 15) { + year = 1900 + Integer.parseInt(identity.substring(6, 8)); + month = Integer.parseInt(identity.substring(8, 10)); + day = Integer.parseInt(identity.substring(10, 12)); + } else if(identity.length() == 18) { + year = Integer.parseInt(identity.substring(6, 10)); + month = Integer.parseInt(identity.substring(10, 12)); + day = Integer.parseInt(identity.substring(12, 14)); + } + + + if ((month < monthNow) || (month == monthNow && day <= dayNow)) { + age = String.valueOf(yearNow - year); + } else { + age = String.valueOf(yearNow - year - 1); + } + return age; + } + + /** + * @return java.lang.String + * @Author mengkuiliang + * @Description 根据出生日期计算年龄(周岁) + * @Date 2022-04-29 8:50 + * @Param [birthday] + **/ + public static String calculateAgeByBirthdy(LocalDate birthday) { + + if (birthday == null) { + return ""; + } + String age; + Calendar cal = Calendar.getInstance(); + int yearNow = cal.get(Calendar.YEAR); + int monthNow = cal.get(Calendar.MONTH) + 1; + int dayNow = cal.get(Calendar.DATE); + + int year = birthday.getYear(); + int month = birthday.getMonthValue(); + int day = birthday.getDayOfMonth(); + + if ((month < monthNow) || (month == monthNow && day <= dayNow)) { + age = String.valueOf(yearNow - year); + } else { + age = String.valueOf(yearNow - year - 1); + } + return age; + } + + /** + * @return java.lang.String + * @Author mengkuiliang + * @Description 根据身份证号获取出生日期 + * @Date 2021-12-15 14:50 + * @Param [identity] + **/ + public static LocalDate getBirthday(String identity) { + if (StringUtils.isBlank(identity)) { + return null; + } + String year = ""; + String month = ""; + String day = ""; + if(identity.length() == 15) { + year = "19" + identity.substring(6, 8); + month = identity.substring(8, 10); + day = identity.substring(10, 12); + } else if(identity.length() == 18) { + year = identity.substring(6, 10); + month = identity.substring(10, 12); + day = identity.substring(12, 14); + } + return LocalDate.of(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day)); + } + + /** + * @return [1: 男 2:女] + * @Author mengkuiliang + * @Description 根据身份证号获取性别 + * @Date 2021-12-14 17:13 + * @Param + **/ + public static String getGender(String identity) { + if (StringUtils.isBlank(identity)) { + return null; + } + Integer type = null; + if(identity.length() == 15) { + type = Integer.parseInt(identity.substring(14)); + } else if(identity.length() == 18) { + type = Integer.parseInt(identity.substring(16, 17)); + } + if(type == null) { + return null; + } + if (type % 2 == 0) { + return "FEMALE"; + } else { + return "MALE"; + } + } + + /** + * @return boolean + * @Author mengkuiliang + * @Description 是否包含汉字 + * @Date 2022-02-11 13:31 + * @Param [str] + **/ + public static boolean bChineseCharacters(String str) { + if (StringUtils.isBlank(str)) { + return false; + } + Pattern p = Pattern.compile("[\u4e00-\u9fa5]"); + Matcher m = p.matcher(str); + if (m.find()) { + return true; + } + return false; + } + + /** + * @return int + * @Author mengkuiliang + * @Description 获取指定字符串 在源字符串中 出现的次数 + * @Date 2022-03-09 15:56 + * @Param [source:源字符串, find:要查找的字符串] + **/ + public static int appearNumber(String source, String find) { + int count = 0; + Pattern p = Pattern.compile(find); + Matcher m = p.matcher(source); + while (m.find()) { + count++; + } + return count; + } + + /** + * @return int + * @Author mengkuiliang + * @Description 获取指定字符串 在源字符串中 第几次出现的位置 + * @Date 2022-03-09 15:56 + * @Param [source:源字符串, find:要查找的字符串, number:第几次] + **/ + public static int appearNumberIndex(String source, String find, Integer number) { + Matcher slashMatcher = Pattern.compile(find).matcher(source); + int mIdx = 0; + while (slashMatcher.find()) { + mIdx++; + if (mIdx == number) { + break; + } + } + return slashMatcher.start(); + } + + /** + * @return java.lang.Boolean + * @Author mengkuiliang + * @Description 校验新版本是否大于最新版本 + * @Date 2022-03-10 8:39 + * @Param [lastVersion, newVersion] + **/ + public static Boolean compareVersion(String lastVersion, String newVersion) { + if (StringUtils.isBlank(lastVersion)) { + return true; + } + if (StringUtils.isBlank(newVersion)) { + return false; + } + String[] lastArray = lastVersion.split("\\."); + String[] newArray = newVersion.split("\\."); + // 获取最大长度 + int length = Math.max(lastArray.length, newArray.length); + for (int i = 0; i < length; i++) { + // 获取每个版本节点,挨个判断大小 + int lastV = i < lastArray.length ? Integer.parseInt(lastArray[i]) : 0; + int newV = i < newArray.length ? Integer.parseInt(newArray[i]) : 0; + if (lastV < newV) { + return true; + } + if (lastV > newV) { + return false; + } + } + return false; + } + + /** + * 加密身份证号 + * + * @param idNo 身份证号码 + *
  • (1)把原字符串按字符循环获取 asc 码,并格式化为 3 位整数;
  • + *
  • (2)把数字字符串进行奇偶交换(第 1 位和第 2 位交换,第 3 位和第 4 位交换, + * 依次类推,如果总长是奇数位,则最后一位不变),重新组合数字字符串
  • + *
  • 例如:原字符串是“ab2”,第一步获取asc码转换为“097098050”,第二步转 + * 换就变成900789500
  • + * @return {@link String} + * @author gaoyu + * @date 2022-05-18 14:28 + */ + public static String encryptIdNo(String idNo) { + if (StringUtils.isEmpty(idNo)) { + return ""; + } + StringBuilder chars = new StringBuilder(); + for (int i = 0; i < idNo.length(); i++) { + int asc_i = idNo.charAt(i); + if (asc_i < 10) { + chars.append("00").append(asc_i); + } else if (asc_i < 100) { + chars.append("0").append(asc_i); + } else { + chars.append(asc_i); + } + } + String tempStr; + String lastChar = ""; + if (chars.length() % 2 == 0) { + tempStr = chars.toString(); + } else { + tempStr = chars.substring(0, chars.length() - 1); + lastChar = String.valueOf(chars.charAt(chars.length() - 1)); + } + StringBuilder resultStr = new StringBuilder(); + for (int i = 0; i < tempStr.length(); i++) { + if (i % 2 == 0) { + resultStr.append(tempStr.charAt(i)); + } else { + resultStr.insert(resultStr.length() - 1, tempStr.charAt(i)); + } + } + return resultStr.append(lastChar).toString(); + } + + /** + * @Author mengkuiliang + * @Description 判断是否为小数 + * @Date 2023-03-13 15:20 + * @Param [str] + * @return boolean + **/ + public static boolean isDecimal(String str){ + if(str != null) { + Pattern pattern = Pattern.compile("[0-9]*\\.?[0-9]+"); + Matcher isNum = pattern.matcher(str); + if (!isNum.matches()) { + return false; + } + return true; + } + return false; + } + +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/signpatientmanageroutenode/MobilePatientTaskDto.java b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/signpatientmanageroutenode/MobilePatientTaskDto.java index 257cae38..02296feb 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/signpatientmanageroutenode/MobilePatientTaskDto.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/signpatientmanageroutenode/MobilePatientTaskDto.java @@ -2,7 +2,6 @@ package com.xinelu.manage.dto.signpatientmanageroutenode; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import java.util.List; import javax.validation.constraints.NotNull; import lombok.Data; @@ -23,10 +22,10 @@ public class MobilePatientTaskDto { private Long residentId; /** - * 任务类型列表 + * 任务类型列表,多个类型用,拼接 */ - @ApiModelProperty("任务类型列表") + @ApiModelProperty("任务类型列表,多个类型用,拼接") @NotNull(message = "数据传输有误") - private List taskTypeList; + private String taskTypeList; } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientprehospitalization/impl/PatientPreHospitalizationServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientprehospitalization/impl/PatientPreHospitalizationServiceImpl.java index c61f8d93..92bd8a53 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientprehospitalization/impl/PatientPreHospitalizationServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientprehospitalization/impl/PatientPreHospitalizationServiceImpl.java @@ -4,6 +4,7 @@ import com.xinelu.common.constant.NodeTypeConstants; import com.xinelu.common.constant.PatientTypeConstants; import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.exception.ServiceException; +import com.xinelu.common.utils.BaseUtil; import com.xinelu.common.utils.SecurityUtils; import com.xinelu.common.utils.StringUtils; import com.xinelu.common.utils.bean.BeanUtils; @@ -64,6 +65,16 @@ public class PatientPreHospitalizationServiceImpl implements IPatientPreHospital @Override public int insert(PatientPreHospitalization preHospitalization) { + // 根据身份证号设置出生日期、性别 + if (StringUtils.isBlank(preHospitalization.getCardNo())) { + throw new ServiceException("请填写正确的身份证号!"); + } + if (preHospitalization.getBirthDate() == null) { + preHospitalization.setBirthDate(BaseUtil.getBirthday(preHospitalization.getCardNo())); + } + if (StringUtils.isBlank(preHospitalization.getSex())) { + preHospitalization.setSex(BaseUtil.getGender(preHospitalization.getCardNo())); + } // 根据身份证号+医院id查询是否有患者信息 PatientInfoDto patientInfoDto = new PatientInfoDto(); patientInfoDto.setCardNo(preHospitalization.getCardNo()); @@ -80,8 +91,10 @@ public class PatientPreHospitalizationServiceImpl implements IPatientPreHospital } else { // 修改患者信息 patientInfo = patientList.get(0); + Long patientId = patientInfo.getId(); BeanUtils.copyBeanProp(patientInfo, preHospitalization); patientInfo.setPatientType(PatientTypeConstants.PRE_HOSPITALIZED_PATIENT); + patientInfo.setId(patientId); patientInfoService.updatePatientInfo(patientInfo); preHospitalization.setPatientId(patientInfo.getId()); preHospitalization.setResidentId(patientInfo.getResidentId()); diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientvisitrecord/impl/PatientVisitRecordServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientvisitrecord/impl/PatientVisitRecordServiceImpl.java index bd74a814..6dafdc9c 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientvisitrecord/impl/PatientVisitRecordServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/patientvisitrecord/impl/PatientVisitRecordServiceImpl.java @@ -7,6 +7,7 @@ import com.xinelu.common.constant.VisitMethodConstants; import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.enums.PatientSourceEnum; import com.xinelu.common.exception.ServiceException; +import com.xinelu.common.utils.BaseUtil; import com.xinelu.common.utils.SecurityUtils; import com.xinelu.common.utils.StringUtils; import com.xinelu.common.utils.bean.BeanUtils; @@ -96,6 +97,15 @@ public class PatientVisitRecordServiceImpl implements IPatientVisitRecordService @Override @Transactional(rollbackFor = Exception.class) public void insertPatientVisitRecord(PatientVisitRecordSaveDto saveDto) { + if (StringUtils.isBlank(saveDto.getCardNo())) { + throw new ServiceException("请填写正确的身份证号!"); + } + if (saveDto.getBirthDate() == null) { + saveDto.setBirthDate(BaseUtil.getBirthday(saveDto.getCardNo())); + } + if (StringUtils.isBlank(saveDto.getSex())) { + saveDto.setSex(BaseUtil.getGender(saveDto.getCardNo())); + } // 根据机构id、患者身份证号判断门诊/住院号是否重复 PatientVisitRecordDto patientVisitRecordDto = new PatientVisitRecordDto(); patientVisitRecordDto.setHospitalAgencyId(saveDto.getHospitalAgencyId()); @@ -116,7 +126,6 @@ public class PatientVisitRecordServiceImpl implements IPatientVisitRecordService // 患者档案信息新增/修改 PatientInfo patientInfo = new PatientInfo(); if(CollectionUtils.isEmpty(patientInfoList)) { - // 新增档案 BeanUtils.copyBeanProp(patientInfo, saveDto); patientInfo.setPatientSource(PatientSourceEnum.MANAGE_END.name()); patientInfo.setDelFlag(0); @@ -166,6 +175,15 @@ public class PatientVisitRecordServiceImpl implements IPatientVisitRecordService @Override @Transactional(rollbackFor = Exception.class) public int updatePatientVisitRecord(PatientVisitRecord patientVisitRecord) { + if (StringUtils.isBlank(patientVisitRecord.getCardNo())) { + throw new ServiceException("请填写正确的身份证号!"); + } + if (patientVisitRecord.getBirthDate() == null) { + patientVisitRecord.setBirthDate(BaseUtil.getBirthday(patientVisitRecord.getCardNo())); + } + if (StringUtils.isBlank(patientVisitRecord.getSex())) { + patientVisitRecord.setSex(BaseUtil.getGender(patientVisitRecord.getCardNo())); + } // 根据机构id、患者身份证号判断门诊/住院号是否重复 PatientVisitRecordDto patientVisitRecordDto = new PatientVisitRecordDto(); patientVisitRecordDto.setHospitalAgencyId(patientVisitRecord.getHospitalAgencyId()); diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java index dd0971f9..1700557d 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientmanageroutenode/impl/SignPatientManageRouteNodeServiceImpl.java @@ -37,7 +37,9 @@ import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageRouteNod import com.xinelu.manage.vo.signpatientmanageroutenode.SignPatientManageRouteNodeVo; import com.xinelu.manage.vo.specialdiseaseroute.SpecialDiseaseRouteVO; import java.time.LocalDateTime; +import java.time.LocalTime; import java.util.ArrayList; +import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.Map; @@ -280,29 +282,37 @@ public class SignPatientManageRouteNodeServiceImpl implements ISignPatientManage SignPatientManageRoute signRoute = signRouteList.get(0); SignPatientManageRouteNodeDto nodeQuery = new SignPatientManageRouteNodeDto(); nodeQuery.setManageRouteId(signRoute.getId()); + nodeQuery.setTaskTypeList(Arrays.asList(mobilePatientTaskDto.getTaskTypeList().split(","))); List signNodeList = signPatientManageRouteNodeMapper.selectSignPatientManageRouteNodeList(nodeQuery); for (SignPatientManageRouteNode node : signNodeList) { LocalDateTime executeTime = null; + + LocalTime et = LocalTime.of(8,0,0); + if (node.getExecuteTime() != null) { + et = node.getExecuteTime(); + } switch(node.getRouteNodeName()) { case RouteNodeNameConstants.AFTER_DISCHARGE: // 出院后 - executeTime = LocalDateTime.of(patientVisitRecord.getDischargeTime().minusDays(node.getRouteNodeDay()).toLocalDate(), node.getExecuteTime()); - break; - case RouteNodeNameConstants.AFTER_ADMISSION: // 入院后 - executeTime = LocalDateTime.of(patientVisitRecord.getAdmissionTime().minusDays(node.getRouteNodeDay()).toLocalDate(), node.getExecuteTime()); - break; - case RouteNodeNameConstants.AFTER_CONSULTATION: // 就诊后 - executeTime = LocalDateTime.of(patientVisitRecord.getVisitDate().minusDays(node.getRouteNodeDay()).toLocalDate(), node.getExecuteTime()); - break; case RouteNodeNameConstants.AFTER_VISIT_DISCHARGE: // 就诊/出院后 // 判断是门诊/住院 if (StringUtils.equals(VisitMethodConstants.BE_IN_HOSPITAL, patientVisitRecord.getVisitMethod())) { - executeTime = LocalDateTime.of(patientVisitRecord.getDischargeTime().minusDays(node.getRouteNodeDay()).toLocalDate(), node.getExecuteTime()); + executeTime = LocalDateTime.of(patientVisitRecord.getDischargeTime().plusDays(node.getRouteNodeDay()).toLocalDate(), et); } else { - executeTime = LocalDateTime.of(patientVisitRecord.getVisitDate().minusDays(node.getRouteNodeDay()).toLocalDate(), node.getExecuteTime()); + executeTime = LocalDateTime.of(patientVisitRecord.getVisitDate().plusDays(node.getRouteNodeDay()).toLocalDate(), et); } break; + case RouteNodeNameConstants.AFTER_ADMISSION: // 入院后 + if (StringUtils.equals(VisitMethodConstants.BE_IN_HOSPITAL, patientVisitRecord.getVisitMethod())) { + executeTime = LocalDateTime.of(patientVisitRecord.getAdmissionTime().plusDays(node.getRouteNodeDay()).toLocalDate(), et); + } else { + executeTime = LocalDateTime.of(patientVisitRecord.getVisitDate().plusDays(node.getRouteNodeDay()).toLocalDate(), et); + } + break; + case RouteNodeNameConstants.AFTER_CONSULTATION: // 就诊后 + executeTime = LocalDateTime.of(patientVisitRecord.getVisitDate().plusDays(node.getRouteNodeDay()).toLocalDate(), et); + break; default: - executeTime = LocalDateTime.of(patientVisitRecord.getVisitDate().minusDays(node.getRouteNodeDay()).toLocalDate(), node.getExecuteTime()); + executeTime = LocalDateTime.of(patientVisitRecord.getVisitDate().plusDays(node.getRouteNodeDay()).toLocalDate(), et); break; } retList.add(MobileRouteNodeListVo.builder() diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java index cc136c17..2036f69b 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/signpatientrecord/impl/SignPatientRecordServiceImpl.java @@ -164,48 +164,50 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService { signPatientPackage.setCreateTime(LocalDateTime.now()); signPatientPackage.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName()); signPatientPackageMapper.insertSignPatientPackage(signPatientPackage); - + if (ObjectUtils.isEmpty(body.getRoute()) || body.getRoute().getRouteId() == null) { + throw new ServiceException("请选择管理路径"); + } // 保存管理路径 - if (body.getRoute() != null) { - SignPatientManageRoute signPatientManageRoute = body.getRoute(); - 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.setCreateTime(LocalDateTime.now()); - signPatientManageRoute.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName()); - signPatientManageRouteMapper.insertSignPatientManageRoute(signPatientManageRoute); - // 保存管理节点 - SpecialDiseaseNode specialDiseaseNode = new SpecialDiseaseNode(); - specialDiseaseNode.setRouteId(signPatientManageRoute.getRouteId()); - specialDiseaseNode.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo()); - List nodeList = specialDiseaseNodeMapper.selectSpecialDiseaseNodeList(specialDiseaseNode); - if (CollectionUtils.isEmpty(nodeList)) { - throw new ServiceException("该管理任务没有任务节点"); - } - List manageNodeList = nodeList.stream().map(node -> { - SignPatientManageRouteNode manageRouteNode = new SignPatientManageRouteNode(); - BeanUtils.copyBeanProp(manageRouteNode, node); - manageRouteNode.setManageRouteId(signPatientManageRoute.getId()); - manageRouteNode.setManageRouteName(signPatientManageRoute.getRouteName()); - manageRouteNode.setId(null); - manageRouteNode.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo()); - manageRouteNode.setRouteCheckDate(LocalDateTime.now()); - manageRouteNode.setRouteCheckRemark("签约自动审核通过"); - manageRouteNode.setNodeExecuteStatus(NodeExecuteStatusEnum.UNEXECUTED.getInfo()); - manageRouteNode.setCreateTime(LocalDateTime.now()); - manageRouteNode.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName()); - return manageRouteNode; - }).collect(Collectors.toList()); - // 批量保存 - manageRouteNodeMapper.insertBatch(manageNodeList); - // 保存触发条件 - SpecialDiseaseTriggerCondition triggerConditionQuery = new SpecialDiseaseTriggerCondition(); - triggerConditionQuery.setRouteId(signPatientManageRoute.getRouteId()); - List triggerConditions = triggerConditionMapper.selectSpecialDiseaseTriggerConditionList(triggerConditionQuery); + SignPatientManageRoute signPatientManageRoute = body.getRoute(); + 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.setCreateTime(LocalDateTime.now()); + signPatientManageRoute.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName()); + signPatientManageRouteMapper.insertSignPatientManageRoute(signPatientManageRoute); + // 保存管理节点 + SpecialDiseaseNode specialDiseaseNode = new SpecialDiseaseNode(); + specialDiseaseNode.setRouteId(signPatientManageRoute.getRouteId()); + specialDiseaseNode.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo()); + List nodeList = specialDiseaseNodeMapper.selectSpecialDiseaseNodeList(specialDiseaseNode); + if (CollectionUtils.isEmpty(nodeList)) { + throw new ServiceException("该管理任务没有任务节点"); + } + List manageNodeList = nodeList.stream().map(node -> { + SignPatientManageRouteNode manageRouteNode = new SignPatientManageRouteNode(); + BeanUtils.copyBeanProp(manageRouteNode, node); + manageRouteNode.setManageRouteId(signPatientManageRoute.getId()); + manageRouteNode.setManageRouteName(signPatientManageRoute.getRouteName()); + manageRouteNode.setId(null); + manageRouteNode.setRouteCheckStatus(RouteCheckStatusEnum.AGREE.getInfo()); + manageRouteNode.setRouteCheckDate(LocalDateTime.now()); + manageRouteNode.setRouteCheckRemark("签约自动审核通过"); + manageRouteNode.setNodeExecuteStatus(NodeExecuteStatusEnum.UNEXECUTED.getInfo()); + manageRouteNode.setCreateTime(LocalDateTime.now()); + manageRouteNode.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName()); + return manageRouteNode; + }).collect(Collectors.toList()); + // 批量保存 + manageRouteNodeMapper.insertBatch(manageNodeList); + // 保存触发条件 + SpecialDiseaseTriggerCondition triggerConditionQuery = new SpecialDiseaseTriggerCondition(); + triggerConditionQuery.setRouteId(signPatientManageRoute.getRouteId()); + List triggerConditions = triggerConditionMapper.selectSpecialDiseaseTriggerConditionList(triggerConditionQuery); + if (!CollectionUtils.isEmpty(triggerConditions)) { List routeTriggerConditionList = triggerConditions.stream().map(item->{ SignRouteTriggerCondition signRouteTriggerCondition = new SignRouteTriggerCondition(); BeanUtils.copyBeanProp(signRouteTriggerCondition, item); @@ -271,6 +273,10 @@ public class SignPatientRecordServiceImpl implements ISignPatientRecordService { if (ObjectUtils.isEmpty(patientInfo)) { throw new ServiceException("未找到该居民"); } + // 查询当前居民签约状态是否已意向签约 + if (StringUtils.equals(SignRecordServiceStatusConstants.INTENTIONAL_SIGNING, patientInfo.getServiceStatus())) { + throw new ServiceException("该居民已意向签约!"); + } // 查询当前居民签约状态是否已签约 if (StringUtils.equals(SignRecordServiceStatusConstants.SERVICE_CENTER, patientInfo.getServiceStatus())) { throw new ServiceException("该居民已签约!"); diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/signpatientmanageroutenode/MobileRouteNodeListVo.java b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/signpatientmanageroutenode/MobileRouteNodeListVo.java index 5d828b2a..bf170e65 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/vo/signpatientmanageroutenode/MobileRouteNodeListVo.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/vo/signpatientmanageroutenode/MobileRouteNodeListVo.java @@ -1,5 +1,6 @@ package com.xinelu.manage.vo.signpatientmanageroutenode; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.time.LocalDateTime; @@ -51,5 +52,6 @@ public class MobileRouteNodeListVo { * 执行时间 */ @ApiModelProperty(value = "执行时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime executeTime; } diff --git a/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml index 909a7d57..ed9920c5 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/patientinfo/PatientInfoMapper.xml @@ -62,7 +62,7 @@ sex, address, patient_type, - sign_status,sign_patient_record_id, + sign_status,sign_patient_record_id,service_status, sign_time, visit_method, attending_physician_id, attending_physician_name, main_diagnosis, hospital_agency_id, hospital_agency_name, campus_agency_id, campus_agency_name, department_id, department_name, ward_id, ward_name, diff --git a/postdischarge-manage/src/main/resources/mapper/manage/patientprehospitalization/PatientPreHospitalizationMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/patientprehospitalization/PatientPreHospitalizationMapper.xml index ed71fde1..a5b8161c 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/patientprehospitalization/PatientPreHospitalizationMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/patientprehospitalization/PatientPreHospitalizationMapper.xml @@ -288,9 +288,9 @@ - where del_flag = 0 + del_flag = 0 AND patient_id = #{patientId,jdbcType=BIGINT} diff --git a/postdischarge-manage/src/main/resources/mapper/manage/propagandainfo/PropagandaInfoMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/propagandainfo/PropagandaInfoMapper.xml index 816e7deb..19420e51 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/propagandainfo/PropagandaInfoMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/propagandainfo/PropagandaInfoMapper.xml @@ -59,12 +59,13 @@ and create_by = #{createBy} - and date_format(create_time, '%y%m%d') >= date_format(createTimeStart, '%y%m%d') + and date_format(create_time, '%y%m%d') >= date_format(#{createTimeStart}, '%y%m%d') and date_format(create_time, '%y%m%d') <= date_format(#{createTimeEnd}, '%y%m%d') + order by create_time desc