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