|
|
|
@ -4,7 +4,7 @@ import com.docus.core.util.DateUtil;
|
|
|
|
|
import com.docus.core.util.Func;
|
|
|
|
|
import com.docus.infrastructure.core.exception.BaseException;
|
|
|
|
|
import com.docus.infrastructure.redis.service.RedisOps;
|
|
|
|
|
import com.docus.server.collection.mapper.TBasicMapper;
|
|
|
|
|
import com.docus.server.collection.service.ITBasicService;
|
|
|
|
|
import com.docus.server.report.api.ShunDePeopleService;
|
|
|
|
|
import com.docus.server.report.api.dto.ReportDto;
|
|
|
|
|
import com.docus.server.report.config.SdRyReportHandledConfig;
|
|
|
|
@ -22,7 +22,6 @@ import org.w3c.dom.Node;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* HIP1008-检查报告新增服务处理
|
|
|
|
@ -41,7 +40,7 @@ public class HIP1008InspectionReportAdditionHandler implements WebserviceReceive
|
|
|
|
|
@Resource
|
|
|
|
|
private RedisOps redisOps;
|
|
|
|
|
@Resource
|
|
|
|
|
private TBasicMapper tBasicMapper;
|
|
|
|
|
private ITBasicService tBasicService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -93,7 +92,14 @@ public class HIP1008InspectionReportAdditionHandler implements WebserviceReceive
|
|
|
|
|
String inpatientNo = inpatientNoNode.getNodeValue();
|
|
|
|
|
|
|
|
|
|
Node admissTimesNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/recordTarget/patientRole/item[@root='1.2.156.112635.1.2.1.7']/@extension");
|
|
|
|
|
Integer admissTimes = Integer.valueOf(admissTimesNode.getNodeValue());
|
|
|
|
|
Integer admissTimes;
|
|
|
|
|
try {
|
|
|
|
|
admissTimes = Integer.valueOf(admissTimesNode.getNodeValue());
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
log.error(ex.getMessage(), ex);
|
|
|
|
|
admissTimes = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 患者本次就诊唯一键:患者id【12位】+就诊次数
|
|
|
|
|
Node visitSnNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/recordTarget/patientRole/id[@root='2.16.156.10011.1.11']/@extension");
|
|
|
|
@ -115,6 +121,10 @@ public class HIP1008InspectionReportAdditionHandler implements WebserviceReceive
|
|
|
|
|
String reportName = fileTitleNode.getTextContent();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (admissTimes == null && isManualDocuments(requestSn)) {
|
|
|
|
|
admissTimes = getAdmissTimes(inpatientNo, inspectionInsertXmlUtil);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReportDto reportDto = new ReportDto();
|
|
|
|
|
reportDto.setAdmisstimes(admissTimes);
|
|
|
|
|
reportDto.setInpatientNo(inpatientNo);
|
|
|
|
@ -149,6 +159,21 @@ public class HIP1008InspectionReportAdditionHandler implements WebserviceReceive
|
|
|
|
|
return reportDto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Integer getAdmissTimes(String inpatientNo, XmlUtil inspectionInsertXmlUtil) {
|
|
|
|
|
try {
|
|
|
|
|
//检查报告日期 yyyyMMddHHmmss
|
|
|
|
|
String pattern = "yyyyMMddHHmmss";
|
|
|
|
|
Node reportTimeNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/author/time/@value");
|
|
|
|
|
String reportTime = reportTimeNode.getNodeValue();
|
|
|
|
|
Date reportDate = Func.parseDate(reportTime, pattern);
|
|
|
|
|
// 出院时间+3天匹配
|
|
|
|
|
int timeRangeAddedHour = 3 * 24;
|
|
|
|
|
return tBasicService.matchingAdmissTimesByInpNoAndReportTime(inpatientNo, reportDate, timeRangeAddedHour);
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
throw new BaseException("解析检查报告时间出错了!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ReportDto getReportDtoByInspectionInsert(XmlUtil inspectionInsertXmlUtil) {
|
|
|
|
|
Node senderNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/sender/device/id/item/@extension");
|
|
|
|
@ -185,23 +210,7 @@ public class HIP1008InspectionReportAdditionHandler implements WebserviceReceive
|
|
|
|
|
// 如果是手工单,住院次数可能为空,则需要根据检查报告时间与出入院区间获取住院次数
|
|
|
|
|
// todo 实施手工单需求确认
|
|
|
|
|
if (admissTimes == null && isManualDocuments(eafNo)) {
|
|
|
|
|
//检查报告日期 yyyyMMddHHmmss
|
|
|
|
|
String pattern = "yyyyMMddHHmmss";
|
|
|
|
|
Node reportTimeNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/author/time/@value");
|
|
|
|
|
String reportTime = reportTimeNode.getNodeValue();
|
|
|
|
|
Date reportDate = Func.parseDate(reportTime, pattern);
|
|
|
|
|
String formatDateTime = Func.formatDateTime(reportDate);
|
|
|
|
|
List<Integer> admissTimesList = tBasicMapper.getAdmissTimesByInpNoAndReportTime(inpatientNo, formatDateTime);
|
|
|
|
|
if (Func.isEmpty(admissTimesList)) {
|
|
|
|
|
log.warn("住院号:{},报告时间:{} 根据住院号与出入院日期匹配患者基础数据失败!", inpatientNo, formatDateTime);
|
|
|
|
|
} else if (admissTimesList.size() > 1) {
|
|
|
|
|
log.warn("住院号:{},报告时间:{} 根据住院号与出入院日期匹配患者基础数据失败,有多条!", inpatientNo, formatDateTime);
|
|
|
|
|
} else {
|
|
|
|
|
admissTimes = admissTimesList.get(0);
|
|
|
|
|
if (admissTimes == null) {
|
|
|
|
|
log.warn("住院号:{},报告时间:{} 根据住院号与出入院日期匹配患者基础数据,住院次数为空!", inpatientNo, formatDateTime);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
getAdmissTimes(inpatientNo, inspectionInsertXmlUtil);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|