|
|
@ -3,9 +3,11 @@ package com.docus.server.report.webservice.impl;
|
|
|
|
import com.docus.core.util.DateUtil;
|
|
|
|
import com.docus.core.util.DateUtil;
|
|
|
|
import com.docus.core.util.Func;
|
|
|
|
import com.docus.core.util.Func;
|
|
|
|
import com.docus.infrastructure.core.exception.BaseException;
|
|
|
|
import com.docus.infrastructure.core.exception.BaseException;
|
|
|
|
|
|
|
|
import com.docus.server.report.api.ShunDePeopleService;
|
|
|
|
import com.docus.server.report.api.dto.ReportDto;
|
|
|
|
import com.docus.server.report.api.dto.ReportDto;
|
|
|
|
import com.docus.server.report.config.SdRyReportHandledConfig;
|
|
|
|
import com.docus.server.report.config.SdRyReportHandledConfig;
|
|
|
|
import com.docus.server.report.config.ZdAssortConfig;
|
|
|
|
import com.docus.server.report.config.ZdAssortConfig;
|
|
|
|
|
|
|
|
import com.docus.server.report.job.ReportJob;
|
|
|
|
import com.docus.server.report.service.ReportService;
|
|
|
|
import com.docus.server.report.service.ReportService;
|
|
|
|
import com.docus.server.report.util.IdUtil;
|
|
|
|
import com.docus.server.report.util.IdUtil;
|
|
|
|
import com.docus.server.report.util.XmlUtil;
|
|
|
|
import com.docus.server.report.util.XmlUtil;
|
|
|
@ -20,6 +22,7 @@ import java.util.Date;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* HIP1008-检查报告新增服务处理
|
|
|
|
* HIP1008-检查报告新增服务处理
|
|
|
|
|
|
|
|
*
|
|
|
|
* @author jiahsi
|
|
|
|
* @author jiahsi
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Service(WebserviceMessageType.HIP1008)
|
|
|
|
@Service(WebserviceMessageType.HIP1008)
|
|
|
@ -27,6 +30,11 @@ import java.util.Date;
|
|
|
|
public class HIP1008InspectionReportAdditionHandler implements WebserviceReceiveServerHandler {
|
|
|
|
public class HIP1008InspectionReportAdditionHandler implements WebserviceReceiveServerHandler {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private ReportService reportService;
|
|
|
|
private ReportService reportService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private ShunDePeopleService shunDePeopleService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private ReportJob reportJob;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public String handle(String receiveMessage) {
|
|
|
|
public String handle(String receiveMessage) {
|
|
|
@ -46,11 +54,18 @@ public class HIP1008InspectionReportAdditionHandler implements WebserviceReceive
|
|
|
|
if (sdRyReportHandledConfig.isNotHandled(sysFlag)) {
|
|
|
|
if (sdRyReportHandledConfig.isNotHandled(sysFlag)) {
|
|
|
|
return insertSuccess(msgId, sender, receiver);
|
|
|
|
return insertSuccess(msgId, sender, receiver);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(sdRyReportHandledConfig.isBlocking(sysFlag)){
|
|
|
|
if (sdRyReportHandledConfig.isBlocking(sysFlag)) {
|
|
|
|
reportDto.setDownUrl(null);
|
|
|
|
reportDto.setDownUrl(null);
|
|
|
|
reportService.reportBuffer(reportDto);
|
|
|
|
reportService.reportBuffer(reportDto);
|
|
|
|
return insertSuccess(msgId, sender, receiver);
|
|
|
|
return insertSuccess(msgId, sender, receiver);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sdRyReportHandledConfig.isFetchBase64(sender)) {
|
|
|
|
|
|
|
|
// base64的和job的检查报告统一处理逻辑,不然会出现重复
|
|
|
|
|
|
|
|
reportDto = fetchBase64Parse(xmlUtil);
|
|
|
|
|
|
|
|
if (reportDto == null) {
|
|
|
|
|
|
|
|
return insertFailed(msgId, sender, receiver, "未获取到报告PDF文件BASE64信息");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
reportService.report(reportDto);
|
|
|
|
reportService.report(reportDto);
|
|
|
|
return insertSuccess(msgId, sender, receiver);
|
|
|
|
return insertSuccess(msgId, sender, receiver);
|
|
|
|
} catch (BaseException baseException) {
|
|
|
|
} catch (BaseException baseException) {
|
|
|
@ -61,12 +76,72 @@ public class HIP1008InspectionReportAdditionHandler implements WebserviceReceive
|
|
|
|
return insertFailed(msgId, sender, receiver, "系统错误!");
|
|
|
|
return insertFailed(msgId, sender, receiver, "系统错误!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ReportDto fetchBase64Parse(XmlUtil inspectionInsertXmlUtil) {
|
|
|
|
|
|
|
|
Node senderNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/sender/device/id/item/@extension");
|
|
|
|
|
|
|
|
String updateBy = senderNode.getNodeValue();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Node inpatientNoNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/recordTarget/patientRole/id[@root='2.16.156.10011.1.12']/@extension");
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 患者本次就诊唯一键:患者id【12位】+就诊次数
|
|
|
|
|
|
|
|
Node visitSnNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/recordTarget/patientRole/id[@root='2.16.156.10011.1.11']/@extension");
|
|
|
|
|
|
|
|
String visitSn = visitSnNode.getNodeValue();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 患者id
|
|
|
|
|
|
|
|
Node patientSnNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/recordTarget/patientRole/id[@root='2.16.156.10011.0.2.2']/@extension");
|
|
|
|
|
|
|
|
String patientSn = patientSnNode.getNodeValue();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 检查报告单号标识
|
|
|
|
|
|
|
|
Node reportFlagNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/recordTarget/patientRole/id[@root='2.16.156.10011.1.32']/@extension");
|
|
|
|
|
|
|
|
String examReportSn = reportFlagNode.getNodeValue();
|
|
|
|
|
|
|
|
//电子申请单编号
|
|
|
|
|
|
|
|
Node eafNoNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/recordTarget/patientRole/id[@root='2.16.156.10011.1.24']/@extension");
|
|
|
|
|
|
|
|
String requestSn = eafNoNode.getNodeValue();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Node fileTitleNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/component/structuredBody/component[@displayName='检查报告']/section/entry[@displayName='检查报告类型']/observation/code/@displayName");
|
|
|
|
|
|
|
|
String reportName = fileTitleNode.getNodeValue();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ReportDto reportDto = new ReportDto();
|
|
|
|
|
|
|
|
reportDto.setAdmisstimes(admissTimes);
|
|
|
|
|
|
|
|
reportDto.setInpatientNo(inpatientNo);
|
|
|
|
|
|
|
|
// 确定报告唯一 报告单号+申请单号
|
|
|
|
|
|
|
|
reportDto.setSerialnum(examReportSn + requestSn);
|
|
|
|
|
|
|
|
reportDto.setFileTitle(reportName);
|
|
|
|
|
|
|
|
reportDto.setVisitSn(visitSn);
|
|
|
|
|
|
|
|
reportDto.setPatientSn(patientSn);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 检查报告需要从Pacs接口获取base64
|
|
|
|
|
|
|
|
String[] split = examReportSn.split("_");
|
|
|
|
|
|
|
|
String fromPacs = shunDePeopleService.getBase64PdfFromPacs(split[0], split[1]);
|
|
|
|
|
|
|
|
// 从pacs打印出来
|
|
|
|
|
|
|
|
String base64 = reportJob.parsePacsGetBase64(fromPacs);
|
|
|
|
|
|
|
|
if (Func.isBlank(base64)) {
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String url = reportJob.saveBase64(base64);
|
|
|
|
|
|
|
|
reportDto.setDownUrl(url);
|
|
|
|
|
|
|
|
reportDto.setDowntype(5);
|
|
|
|
|
|
|
|
// 根据系统来分类
|
|
|
|
|
|
|
|
reportDto.setAssortId(ZdAssortConfig.getZdAssortId(updateBy));
|
|
|
|
|
|
|
|
reportDto.setSysFlag(updateBy);
|
|
|
|
|
|
|
|
reportDto.setFileSource("1");
|
|
|
|
|
|
|
|
reportDto.setFilestoragetype("1");
|
|
|
|
|
|
|
|
return reportDto;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ReportDto getReportDtoByInspectionInsert(XmlUtil inspectionInsertXmlUtil) {
|
|
|
|
public ReportDto getReportDtoByInspectionInsert(XmlUtil inspectionInsertXmlUtil) {
|
|
|
|
Node senderNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/sender/device/id/item/@extension");
|
|
|
|
Node senderNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/sender/device/id/item/@extension");
|
|
|
|
String sender = senderNode.getNodeValue();
|
|
|
|
String sender = senderNode.getNodeValue();
|
|
|
|
String zdAssortId = ZdAssortConfig.getZdAssortId(sender);
|
|
|
|
String zdAssortId = ZdAssortConfig.getZdAssortId(sender);
|
|
|
|
if(Func.isBlank(zdAssortId)){
|
|
|
|
if (Func.isBlank(zdAssortId)) {
|
|
|
|
zdAssortId=ZdAssortConfig.getOtherAssortId();
|
|
|
|
zdAssortId = ZdAssortConfig.getOtherAssortId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Node inpatientNoNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/recordTarget/patientRole/id[@root='2.16.156.10011.1.12']/@extension");
|
|
|
|
Node inpatientNoNode = inspectionInsertXmlUtil.getNode("/POOR_HIP1008/controlActProcess/subject/recordTarget/patientRole/id[@root='2.16.156.10011.1.12']/@extension");
|
|
|
@ -120,8 +195,8 @@ public class HIP1008InspectionReportAdditionHandler implements WebserviceReceive
|
|
|
|
public String insertSuccess(String msgId, String sender, String receiver) {
|
|
|
|
public String insertSuccess(String msgId, String sender, String receiver) {
|
|
|
|
String createTime = Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
|
|
|
|
String createTime = Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
|
|
|
|
return "<MCCI_IN000002UV01 xmlns=\"urn:hl7-org:v3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ITSVersion=\"XML_1.0\" xsi:schemaLocation=\"urn:hl7-org:v3 file:///E:/hl7/HL7/v3ballot_fullsite_2011MAY/v3ballot/html/processable/multicacheschemas/MCCI _IN000002UV01.xsd\">" +
|
|
|
|
return "<MCCI_IN000002UV01 xmlns=\"urn:hl7-org:v3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ITSVersion=\"XML_1.0\" xsi:schemaLocation=\"urn:hl7-org:v3 file:///E:/hl7/HL7/v3ballot_fullsite_2011MAY/v3ballot/html/processable/multicacheschemas/MCCI _IN000002UV01.xsd\">" +
|
|
|
|
"<id extension=\""+ IdUtil.standardUUID()+"\"/>" +
|
|
|
|
"<id extension=\"" + IdUtil.standardUUID() + "\"/>" +
|
|
|
|
"<creationTime value=\""+createTime+"\"/>" +
|
|
|
|
"<creationTime value=\"" + createTime + "\"/>" +
|
|
|
|
"<interactionId root=\"2.16.840.1.113883.1.6\" extension=\"MCCI_IN000002UV01\"/>" +
|
|
|
|
"<interactionId root=\"2.16.840.1.113883.1.6\" extension=\"MCCI_IN000002UV01\"/>" +
|
|
|
|
"<processingCode code=\"P\"/>" +
|
|
|
|
"<processingCode code=\"P\"/>" +
|
|
|
|
"<processingModeCode/>" +
|
|
|
|
"<processingModeCode/>" +
|
|
|
@ -142,7 +217,7 @@ public class HIP1008InspectionReportAdditionHandler implements WebserviceReceive
|
|
|
|
"</sender>" +
|
|
|
|
"</sender>" +
|
|
|
|
"<acknowledgement typeCode=\"AA\">" +
|
|
|
|
"<acknowledgement typeCode=\"AA\">" +
|
|
|
|
"<targetMessage>" +
|
|
|
|
"<targetMessage>" +
|
|
|
|
"<id extension=\""+msgId+"\"/>" +
|
|
|
|
"<id extension=\"" + msgId + "\"/>" +
|
|
|
|
"</targetMessage>" +
|
|
|
|
"</targetMessage>" +
|
|
|
|
"<acknowledgementDetail>" +
|
|
|
|
"<acknowledgementDetail>" +
|
|
|
|
"<text value=\"成功\"/>" +
|
|
|
|
"<text value=\"成功\"/>" +
|
|
|
@ -193,8 +268,8 @@ public class HIP1008InspectionReportAdditionHandler implements WebserviceReceive
|
|
|
|
|
|
|
|
|
|
|
|
String createTime = Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
|
|
|
|
String createTime = Func.format(new Date(), DateUtil.PATTERN_DATETIME_MINI);
|
|
|
|
return "<MCCI_IN000002UV01 xmlns=\"urn:hl7-org:v3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ITSVersion=\"XML_1.0\" xsi:schemaLocation=\"urn:hl7-org:v3 file:///E:/hl7/HL7/v3ballot_fullsite_2011MAY/v3ballot/html/processable/multicacheschemas/MCCI _IN000002UV01.xsd\">" +
|
|
|
|
return "<MCCI_IN000002UV01 xmlns=\"urn:hl7-org:v3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ITSVersion=\"XML_1.0\" xsi:schemaLocation=\"urn:hl7-org:v3 file:///E:/hl7/HL7/v3ballot_fullsite_2011MAY/v3ballot/html/processable/multicacheschemas/MCCI _IN000002UV01.xsd\">" +
|
|
|
|
"<id extension=\""+IdUtil.standardUUID()+"\"/>" +
|
|
|
|
"<id extension=\"" + IdUtil.standardUUID() + "\"/>" +
|
|
|
|
"<creationTime value=\""+createTime+"\"/>" +
|
|
|
|
"<creationTime value=\"" + createTime + "\"/>" +
|
|
|
|
"<interactionId root=\"2.16.840.1.113883.1.6\" extension=\"MCCI_IN000002UV01\"/>" +
|
|
|
|
"<interactionId root=\"2.16.840.1.113883.1.6\" extension=\"MCCI_IN000002UV01\"/>" +
|
|
|
|
"<processingCode code=\"P\"/>" +
|
|
|
|
"<processingCode code=\"P\"/>" +
|
|
|
|
"<processingModeCode/>" +
|
|
|
|
"<processingModeCode/>" +
|
|
|
@ -215,10 +290,10 @@ public class HIP1008InspectionReportAdditionHandler implements WebserviceReceive
|
|
|
|
"</sender>" +
|
|
|
|
"</sender>" +
|
|
|
|
"<acknowledgement typeCode=\"AE\">" +
|
|
|
|
"<acknowledgement typeCode=\"AE\">" +
|
|
|
|
"<targetMessage>" +
|
|
|
|
"<targetMessage>" +
|
|
|
|
"<id extension=\""+msgId+"\"/>" +
|
|
|
|
"<id extension=\"" + msgId + "\"/>" +
|
|
|
|
"</targetMessage>" +
|
|
|
|
"</targetMessage>" +
|
|
|
|
"<acknowledgementDetail>" +
|
|
|
|
"<acknowledgementDetail>" +
|
|
|
|
"<text value=\""+failedMessage+"\"/>" +
|
|
|
|
"<text value=\"" + failedMessage + "\"/>" +
|
|
|
|
"</acknowledgementDetail>" +
|
|
|
|
"</acknowledgementDetail>" +
|
|
|
|
"</acknowledgement>" +
|
|
|
|
"</acknowledgement>" +
|
|
|
|
"</MCCI_IN000002UV01>";
|
|
|
|
"</MCCI_IN000002UV01>";
|
|
|
|