From 235e9b69f84126901095b5f49a60ed104172df43 Mon Sep 17 00:00:00 2001 From: wyb <1977763549@qq.com> Date: Mon, 30 Oct 2023 17:11:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=B5=E5=AD=90=E7=97=85=E5=8E=86=E5=92=8C?= =?UTF-8?q?=E6=8A=A4=E7=90=86=E6=8E=A8=E9=80=81=EF=BC=8C=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E6=98=AF=E4=BA=A7=E7=A7=91=E6=82=A3=E8=80=85=EF=BC=8C=E5=88=99?= =?UTF-8?q?=E7=94=9F=E6=88=90=E5=A9=B4=E5=84=BF=E7=9A=84=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data-config/collect-task-config.json | 8 +- .../impl/SdBusinessServiceImpl.java | 56 ++++++- .../message/config/CollectTaskConfig.java | 2 + .../entity/MaternalInfantRelationship.java | 44 +++++ .../docus/server/message/entity/TBasic.java | 158 ++++++++++++++++++ .../server/message/mapper/TBasicMapper.java | 39 +++++ src/main/resources/mapper/TBasicMapper.xml | 44 +++++ 7 files changed, 340 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/docus/server/message/entity/MaternalInfantRelationship.java create mode 100644 src/main/java/com/docus/server/message/entity/TBasic.java diff --git a/data-config/collect-task-config.json b/data-config/collect-task-config.json index 5bcc7f8..3fbcf71 100644 --- a/data-config/collect-task-config.json +++ b/data-config/collect-task-config.json @@ -1,10 +1,14 @@ [ { "method": "WS_RECORD_SUBMIT", - "collectorIds": ["1","2"] + "collectorIds": ["1","2"], + "babyCollectorIds": ["1","2"], + "haveBabyQuery": "" }, { "method": "WS_NURS_SUBMIT", - "collectorIds": ["3"] + "collectorIds": ["3"], + "babyCollectorIds": ["1","2"], + "haveBabyQuery": "" } ] \ No newline at end of file diff --git a/src/main/java/com/docus/server/message/busservice/impl/SdBusinessServiceImpl.java b/src/main/java/com/docus/server/message/busservice/impl/SdBusinessServiceImpl.java index 1cb993e..23e756f 100644 --- a/src/main/java/com/docus/server/message/busservice/impl/SdBusinessServiceImpl.java +++ b/src/main/java/com/docus/server/message/busservice/impl/SdBusinessServiceImpl.java @@ -14,6 +14,8 @@ import com.docus.server.message.controller.vo.SdRyBloodReportVO; import com.docus.server.message.converters.WsNurseSubmitMessageConvert; import com.docus.server.message.converters.WsRecordSubmitMessageConvert; import com.docus.server.message.dto.*; +import com.docus.server.message.entity.MaternalInfantRelationship; +import com.docus.server.message.entity.TBasic; import com.docus.server.message.feign.dto.CompensateTasRequest; import com.docus.server.message.feign.dto.HospitalSubmitNodeLogAddDTO; import com.docus.server.message.feign.enums.HospitalSubmitNodeEnum; @@ -36,10 +38,7 @@ import org.springframework.stereotype.Service; import java.io.ByteArrayInputStream; import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; +import java.util.*; @Slf4j @Service @@ -90,6 +89,7 @@ public class SdBusinessServiceImpl implements SdBusinessService { } tBasicMapper.insertOrUpdateDoctorSubmitTime(patientIds.get(0), recordSubmitDto.getSubmitTime()); log.info("补偿电子病历任务 patientIds:{} collectId:{}", patientIds, taskConfig.getCollectorIds()); + verifyHasBabyAndCompensateTask(patientIds.get(0), taskConfig.getBabyCollectorIds(), taskConfig.getHaveBabyQuery()); compensateTask(patientIds, taskConfig.getCollectorIds()); tBasicMapper.updateEmrSubmitState(patientIds.get(0), 1); return new MessageResponse(ResultCode.SUCCESS.getCode(), success()); @@ -148,6 +148,7 @@ public class SdBusinessServiceImpl implements SdBusinessService { tBasicMapper.insertOrUpdateNurseFileCount(patientIds.get(0), nurseSubmitDTO.getFilesCount()); tBasicMapper.insertOrUpdateNurse(patientIds.get(0), nurseSubmitDTO.getQcNurse(), nurseSubmitDTO.getDutyNurse()); log.info("补偿护理任务 patientIds:{} collectId:{}", patientIds, taskConfig.getCollectorIds()); + verifyHasBabyAndCompensateTask(patientIds.get(0), taskConfig.getBabyCollectorIds(), taskConfig.getHaveBabyQuery()); compensateTask(patientIds, taskConfig.getCollectorIds()); return new MessageResponse(ResultCode.SUCCESS.getCode(), success()); } catch (BaseException baseException) { @@ -165,6 +166,43 @@ public class SdBusinessServiceImpl implements SdBusinessService { } } + private void verifyHasBabyAndCompensateTask(String parentPatientId, List babyCollectorIds, String haveBabyQuery) { + try { + // 是否是产科患者 + if (isHaveBaby(parentPatientId, haveBabyQuery)) { + // 病案主键查患者基础信息 + TBasic tBasic = tBasicMapper.getTBasicInfo(parentPatientId); + // 查医院患者索引 + String parentIndex = tBasicMapper.getSdRyIndex(parentPatientId); + // 查母婴关联关系 + MaternalInfantRelationship maternalInfantRelationship = tBasicMapper.getMiRelationByPatientIndexAndAdmissTimes(parentIndex, tBasic.getAdmissTimes().toString()); + // 根据宝宝的患者索引查病案主键,进行补偿 + String babyPatientId = tBasicMapper.getPatientIdBySdRyIndex(maternalInfantRelationship.getBabyId()); + List patientIds = Collections.singletonList(babyPatientId); + log.info("补偿婴儿任务 patientIds:{} collectId:{}", patientIds, babyCollectorIds); + compensateTask(patientIds, babyCollectorIds); + } + } catch (Exception ex) { + log.error("判断是否产科与生成婴儿任务错误了,patientId:" + parentPatientId, ex); + } + + } + + /** + * 是否是产科的患者 + * @param patientId 病案主键 + * @param haveBabyQuery 产科患者的查询条件,如果为空,直接判定不是产科 + * @return 根据产科患者查询条件,判定是否是产科的患者 + */ + private boolean isHaveBaby(String patientId, String haveBabyQuery) { + if (Func.isBlank(haveBabyQuery)) { + return false; + } + // 条件带进去如果能查到,就是产科 + return tBasicMapper.isHaveBaby(patientId, haveBabyQuery) > 0; + } + + /** * 根据病案,查找是否有icu来源,未作废的文件数量>0 * @@ -209,7 +247,7 @@ public class SdBusinessServiceImpl implements SdBusinessService { } String where = getBloodViewWhere(); // 视图数据 - List bloodReportDtoList = sdRyBloodMapper.getByInpatientNoAndAdmissions(inpatientNo, admissTimes,where); + List bloodReportDtoList = sdRyBloodMapper.getByInpatientNoAndAdmissions(inpatientNo, admissTimes, where); if (Func.isEmpty(bloodReportDtoList)) { return new ArrayList<>(); } @@ -308,8 +346,8 @@ public class SdBusinessServiceImpl implements SdBusinessService { List zyCyYzDtos = response.getData(); HisZyCyYzDTO dto = zyCyYzDtos.get(0); - if(ObjectUtil.isNotEmpty(dto)){ - updateDisDeptAndWardCode(patientId,dto); + if (ObjectUtil.isNotEmpty(dto)) { + updateDisDeptAndWardCode(patientId, dto); } // 3 5 状态可更新时间 @@ -331,12 +369,12 @@ public class SdBusinessServiceImpl implements SdBusinessService { return count2 > 0; } - private void updateDisDeptAndWardCode(String patientId,HisZyCyYzDTO dto){ + private void updateDisDeptAndWardCode(String patientId, HisZyCyYzDTO dto) { String deptCode = dto.getDept_code(); String deptCodeName = dto.getDept_code_name(); String wardCode = dto.getWard_code(); String wardCodeName = dto.getWard_code_name(); - tBasicMapper.updateDisDeptAndWardCode(patientId,deptCode,deptCodeName,wardCode,wardCodeName); + tBasicMapper.updateDisDeptAndWardCode(patientId, deptCode, deptCodeName, wardCode, wardCodeName); } /** diff --git a/src/main/java/com/docus/server/message/config/CollectTaskConfig.java b/src/main/java/com/docus/server/message/config/CollectTaskConfig.java index 25f5e02..ac2d64f 100644 --- a/src/main/java/com/docus/server/message/config/CollectTaskConfig.java +++ b/src/main/java/com/docus/server/message/config/CollectTaskConfig.java @@ -37,5 +37,7 @@ public class CollectTaskConfig { public static class TaskConfig { private String method; private List collectorIds; + private List babyCollectorIds; + private String haveBabyQuery; } } diff --git a/src/main/java/com/docus/server/message/entity/MaternalInfantRelationship.java b/src/main/java/com/docus/server/message/entity/MaternalInfantRelationship.java new file mode 100644 index 0000000..4582cec --- /dev/null +++ b/src/main/java/com/docus/server/message/entity/MaternalInfantRelationship.java @@ -0,0 +1,44 @@ +package com.docus.server.message.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.Date; + +/** + * 母婴关系 + * @author wyb + */ +@Data +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "MaternalInfantRelationship对象", description = "母婴关系") +public class MaternalInfantRelationship implements Serializable { + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "新生儿住院ID") + private String babyId; + + @ApiModelProperty(value = "新生儿住院ID_住院次数") + private String babyHisId; + + @ApiModelProperty(value = "母亲住院ID") + private String momId; + + @ApiModelProperty(value = "母亲住院次数") + private String parentTimes; + + @ApiModelProperty(value = "母亲住院ID_住院次数") + private String parentHisId; + + @ApiModelProperty(value = "医院代码") + private String hospCode; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + private Date updateTime; +} diff --git a/src/main/java/com/docus/server/message/entity/TBasic.java b/src/main/java/com/docus/server/message/entity/TBasic.java new file mode 100644 index 0000000..abdbf98 --- /dev/null +++ b/src/main/java/com/docus/server/message/entity/TBasic.java @@ -0,0 +1,158 @@ +package com.docus.server.message.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 病案基本信息 + *

+ * + * @author jiashi + * @since 2021-04-14 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@ApiModel(value = "TBasic对象", description = "病案基本信息") +public class TBasic implements Serializable { + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "病案主键") + @TableId(value = "patient_id", type = IdType.ASSIGN_ID) + private String patientId; + + @ApiModelProperty(value = "住院次数") + private Integer admissTimes; + + @ApiModelProperty(value = "病案号") + private String inpatientNo; + + @ApiModelProperty(value = "住院ID号") + private String admissId; + + @ApiModelProperty(value = "患者姓名") + private String name; + + @ApiModelProperty(value = "盘号") + private String ph; + + @ApiModelProperty(value = "性别") + private String sex; + + @ApiModelProperty(value = "年龄_岁") + private Integer age; + + @ApiModelProperty(value = "年龄_月") + private Integer ageMonth; + + @ApiModelProperty(value = "年龄_天") + private Integer ageDay; + + @ApiModelProperty(value = "身份证") + private String idCard; + + @ApiModelProperty(value = "手机号码") + private String telphone; + + @ApiModelProperty(value = "住院日期") + private Date admissDate; + + @ApiModelProperty(value = "住院科室") + private String admissDept; + + @ApiModelProperty(value = "住院科室名称") + private String admissDeptName; + + @ApiModelProperty(value = "出院日期") + private Date disDate; + + @ApiModelProperty(value = "出院科室") + private String disDept; + + @ApiModelProperty(value = "出院科室名称") + private String disDeptName; + + @ApiModelProperty(value = "实际住院天数") + private Integer admissDays; + + @ApiModelProperty(value = "主管医生") + private String attending; + + @ApiModelProperty(value = "主管医生名称") + private String attendingName; + + @ApiModelProperty(value = "主要诊断编码") + private String mainDiagCode; + + @ApiModelProperty(value = "主要诊断名称") + private String mainDiagName; + + @ApiModelProperty(value = "主要手术编码") + private String mainOperateCode; + + @ApiModelProperty(value = "主要手术名称") + private String mainOperateName; + + @ApiModelProperty(value = "是否死亡") + private Integer isDead; + + @ApiModelProperty(value = "是否作废(0:否,1:是)") + private Integer isCancel; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "修改时间") + private Date updateTime; + + @ApiModelProperty(value = "是否归档 1:已归档,0:未归档") + private Integer isArchive; + + @ApiModelProperty(value = "归档时间") + private Date archiveTime; + + @ApiModelProperty(value = "文件来源 1:af_archive_detail,2:t_scan_assort") + private Integer fileSource; + + @ApiModelProperty(value = "完整性描述") + private String integrityDesc; + + private String bColumn1; + + private String bColumn2; + + private String bColumn3; + + private String bColumn4; + + private String bColumn5; + + private Integer bColumn6; + + private Integer bColumn7; + + private Integer bColumn8; + + private Integer bColumn9; + + private Integer bColumn10; + + @ApiModelProperty(value = "姓名缩写(内部构成)") + private String nameSpell; + + @ApiModelProperty(value = "性别名称") + private String sexName; + + @ApiModelProperty(value = "记账号") + private String jzh; + + +} diff --git a/src/main/java/com/docus/server/message/mapper/TBasicMapper.java b/src/main/java/com/docus/server/message/mapper/TBasicMapper.java index bfd06f8..1f8ff8d 100644 --- a/src/main/java/com/docus/server/message/mapper/TBasicMapper.java +++ b/src/main/java/com/docus/server/message/mapper/TBasicMapper.java @@ -1,6 +1,8 @@ package com.docus.server.message.mapper; +import com.docus.server.message.entity.MaternalInfantRelationship; +import com.docus.server.message.entity.TBasic; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -108,4 +110,41 @@ public interface TBasicMapper { * @return 出院日期 yyyyMMdd */ String getDischargeDateByInpatientNoAndTimes(@Param("inpatientNo") String inpatientNo,@Param("admissTimes") Integer admissTimes); + + /** + * 根据条件查,是否是产科的患者,查询数量 + * @param patientId 病案主键 + * @param haveBabyQuery 产科患者的查询条件,不能为空 + * @return 数量 + */ + int isHaveBaby(@Param("patientId")String patientId, @Param("haveBabyQuery") String haveBabyQuery); + + /** + * 根据主键查患者信息 + * @param patientId 患者主键 + * @return 患者信息 + */ + TBasic getTBasicInfo(@Param("patientId")String patientId); + + /** + * 根据病案主键查询患者索引 + * @param patientId 病案主键 + * @return 患者索引 + */ + String getSdRyIndex(@Param("patientId") String patientId); + + /** + * 根据母亲的id和住院次数,查询母婴关联关系 + * @param parentIndex 母亲的id + * @param parentTimes 母亲住院次数 + * @return 母婴关联关系 + */ + MaternalInfantRelationship getMiRelationByPatientIndexAndAdmissTimes(@Param("parentIndex")String parentIndex, @Param("parentTimes") String parentTimes); + + /** + * 根据医院患者索引查询病案主键 + * @param sdRyIndex 患者索引 + * @return 病案主键 + */ + String getPatientIdBySdRyIndex(@Param("sdRyIndex")String sdRyIndex); } diff --git a/src/main/resources/mapper/TBasicMapper.xml b/src/main/resources/mapper/TBasicMapper.xml index 74ae6cc..5565b5d 100644 --- a/src/main/resources/mapper/TBasicMapper.xml +++ b/src/main/resources/mapper/TBasicMapper.xml @@ -71,4 +71,48 @@ and tb.admiss_times=#{admissTimes} LIMIT 1 + + + + +