电子病历和护理推送,如果是产科患者,则生成婴儿的任务

master
wyb 2 years ago
parent 6f3dccfb2b
commit 235e9b69f8

@ -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": ""
}
]

@ -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<String> 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<String> 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<SdRyBloodReportDTO> bloodReportDtoList = sdRyBloodMapper.getByInpatientNoAndAdmissions(inpatientNo, admissTimes,where);
List<SdRyBloodReportDTO> bloodReportDtoList = sdRyBloodMapper.getByInpatientNoAndAdmissions(inpatientNo, admissTimes, where);
if (Func.isEmpty(bloodReportDtoList)) {
return new ArrayList<>();
}
@ -308,8 +346,8 @@ public class SdBusinessServiceImpl implements SdBusinessService {
List<HisZyCyYzDTO> 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);
}
/**

@ -37,5 +37,7 @@ public class CollectTaskConfig {
public static class TaskConfig {
private String method;
private List<String> collectorIds;
private List<String> babyCollectorIds;
private String haveBabyQuery;
}
}

@ -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;
}

@ -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;
/**
* <p>
*
* </p>
*
* @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 = "是否作废(01是)")
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;
}

@ -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);
}

@ -71,4 +71,48 @@
and tb.admiss_times=#{admissTimes}
LIMIT 1
</select>
<select id="isHaveBaby" resultType="java.lang.Integer">
select
count(1)
FROM
`docus_medicalrecord`.t_basic
WHERE
patient_id=#{patientId}
${haveBabyQuery}
</select>
<select id="getTBasicInfo" resultType="com.docus.server.message.entity.TBasic">
select
*
FROM
`docus_medicalrecord`.t_basic
WHERE
patient_id=#{patientId}
</select>
<select id="getSdRyIndex" resultType="java.lang.String">
select
sdry_index
FROM
`docus_medicalrecord`.t_basic_extend
WHERE
patient_id=#{patientId}
</select>
<select id="getMiRelationByPatientIndexAndAdmissTimes"
resultType="com.docus.server.message.entity.MaternalInfantRelationship">
SELECT
*
FROM
`docus_medicalrecord`.`t_maternal_infant_relationship`
where
mom_id=#{parentIndex}
and parent_times=#{parentTimes}
</select>
<select id="getPatientIdBySdRyIndex" resultType="java.lang.String">
select
patient_id
FROM
`docus_medicalrecord`.t_basic_extend
WHERE
sdry_index=#{sdRyIndex}
</select>
</mapper>

Loading…
Cancel
Save