|
|
|
@ -4,6 +4,7 @@ import com.docus.core.util.DateUtil;
|
|
|
|
|
import com.docus.core.util.Func;
|
|
|
|
|
import com.docus.infrastructure.core.exception.BaseException;
|
|
|
|
|
import com.docus.server.collection.mapper.TBasicMapper;
|
|
|
|
|
import com.docus.server.report.config.SdRyReportQueryConfig;
|
|
|
|
|
import com.docus.server.report.service.ReportService;
|
|
|
|
|
import com.docus.server.report.util.IdUtil;
|
|
|
|
|
import com.docus.server.report.util.XmlUtil;
|
|
|
|
@ -34,14 +35,18 @@ public class HIP1112RecallInspectionReportHandler implements WebserviceReceiveSe
|
|
|
|
|
@Resource
|
|
|
|
|
private TBasicMapper tBasicMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private SdRyReportQueryConfig sdRyReportQueryConfig;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
|
|
|
|
"\n" +
|
|
|
|
|
"<POOR_HIP1112 xmlns=\"urn:hl7-org:v3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ITSVersion=\"XML_1.0\" xsi:schemaLocation=\"urn:hl7-org:v3 ../multicacheschemas/POOR_IN200901UV.xsd\"> \n" +
|
|
|
|
|
" <!-- 消息ID --> \n" +
|
|
|
|
|
" <id extension=\"20925035-51e6-49f1-87d1-0d1c60d04133\"/> \n" +
|
|
|
|
|
" <id extension=\"80ABD4579CC14D979BEFF422B58972F3\"/> \n" +
|
|
|
|
|
" <!-- 消息创建时间 --> \n" +
|
|
|
|
|
" <creationTime value=\"20241204081625\"/> \n" +
|
|
|
|
|
" <creationTime value=\"202502181107\"/> \n" +
|
|
|
|
|
" <!-- 交互ID --> \n" +
|
|
|
|
|
" <interactionId extension=\"POOR_IN200901UV23\"/> \n" +
|
|
|
|
|
" <!--消息用途: P(Production); D(Debugging); T(Training) --> \n" +
|
|
|
|
@ -56,7 +61,7 @@ public class HIP1112RecallInspectionReportHandler implements WebserviceReceiveSe
|
|
|
|
|
" <device classCode=\"DEV\" determinerCode=\"INSTANCE\"> \n" +
|
|
|
|
|
" <!-- 接受者ID --> \n" +
|
|
|
|
|
" <id> \n" +
|
|
|
|
|
" <item root=\"2.16.156.10011.0.1.1\" extension=\"Orion-001\"/> \n" +
|
|
|
|
|
" <item root=\"\" extension=\"Orion-001\"/> \n" +
|
|
|
|
|
" </id> \n" +
|
|
|
|
|
" </device> \n" +
|
|
|
|
|
" </receiver> \n" +
|
|
|
|
@ -65,7 +70,7 @@ public class HIP1112RecallInspectionReportHandler implements WebserviceReceiveSe
|
|
|
|
|
" <device classCode=\"DEV\" determinerCode=\"INSTANCE\"> \n" +
|
|
|
|
|
" <!-- 发送者ID --> \n" +
|
|
|
|
|
" <id> \n" +
|
|
|
|
|
" <item root=\"2.16.156.10011.0.1.2\" extension=\"ES-001\"/> \n" +
|
|
|
|
|
" <item root=\"\" extension=\"LIS\"/> \n" +
|
|
|
|
|
" </id> \n" +
|
|
|
|
|
" </device> \n" +
|
|
|
|
|
" </sender> \n" +
|
|
|
|
@ -84,35 +89,35 @@ public class HIP1112RecallInspectionReportHandler implements WebserviceReceiveSe
|
|
|
|
|
" <patient classCode=\"PAT\"> \n" +
|
|
|
|
|
" <id> \n" +
|
|
|
|
|
" <!--域ID --> \n" +
|
|
|
|
|
" <item root=\"1.2.156.10011.1.2.1.2\" extension=\"3\"/> \n" +
|
|
|
|
|
" <item root=\"1.2.156.10011.1.2.1.2\" extension=\"002120608400\"/> \n" +
|
|
|
|
|
" <!-- 患者ID --> \n" +
|
|
|
|
|
" <item root=\"2.16.156.10011.0.2.2\" extension=\"000498133200\"/> \n" +
|
|
|
|
|
" <item root=\"2.16.156.10011.0.2.2\" extension=\"10143462\"/> \n" +
|
|
|
|
|
" <!--住院号标识--> \n" +
|
|
|
|
|
" <item root=\"2.16.156.10011.1.12\" extension=\"10155733\"/> \n" +
|
|
|
|
|
" <item root=\"2.16.156.10011.1.12\" extension=\"\"/> \n" +
|
|
|
|
|
" <!--门急诊号--> \n" +
|
|
|
|
|
" <item root=\"2.16.156.10011.1.11\" extension=\"\"/> \n" +
|
|
|
|
|
" <item root=\"2.16.156.10011.1.11\" extension=\"10143462\"/> \n" +
|
|
|
|
|
" </id> \n" +
|
|
|
|
|
" <providerOrganization classCode=\"ORG\" determinerCode=\"INSTANCE\"> \n" +
|
|
|
|
|
" <!--报告科室编码--> \n" +
|
|
|
|
|
" <id> \n" +
|
|
|
|
|
" <item extension=\"11\" root=\"1.2.156.10011.1.1.1\"/> \n" +
|
|
|
|
|
" <item extension=\"\" root=\"1.2.156.10011.1.1.1\"/> \n" +
|
|
|
|
|
" </id> \n" +
|
|
|
|
|
" <!--报告科室名称 --> \n" +
|
|
|
|
|
" <name xsi:type=\"BAG_EN\"> \n" +
|
|
|
|
|
" <item> \n" +
|
|
|
|
|
" <part value=\"耳鼻咽喉头颈外科\"/> \n" +
|
|
|
|
|
" <part value=\"检验科\"/> \n" +
|
|
|
|
|
" </item> \n" +
|
|
|
|
|
" </name> \n" +
|
|
|
|
|
" <asOrganizationPartOf classCode=\"PART\"> \n" +
|
|
|
|
|
" <wholeOrganization determinerCode=\"INSTANCE\" classCode=\"ORG\"> \n" +
|
|
|
|
|
" <!--医疗机构代码 --> \n" +
|
|
|
|
|
" <id> \n" +
|
|
|
|
|
" <item extension=\"4560886379\"/> \n" +
|
|
|
|
|
" <item extension=\"45608863-7\"/> \n" +
|
|
|
|
|
" </id> \n" +
|
|
|
|
|
" <!--医疗机构名称 --> \n" +
|
|
|
|
|
" <name xsi:type=\"BAG_EN\"> \n" +
|
|
|
|
|
" <item> \n" +
|
|
|
|
|
" <part value=\"南方医科大学顺德医院\"/> \n" +
|
|
|
|
|
" <item>\n" +
|
|
|
|
|
" <part value=\"南方医科大学顺德医院\"/>\n" +
|
|
|
|
|
" </item> \n" +
|
|
|
|
|
" </name> \n" +
|
|
|
|
|
" </wholeOrganization> \n" +
|
|
|
|
@ -123,38 +128,39 @@ public class HIP1112RecallInspectionReportHandler implements WebserviceReceiveSe
|
|
|
|
|
" <!--召回章节 如果多份报告召回,此处可循环--> \n" +
|
|
|
|
|
" <component> \n" +
|
|
|
|
|
" <!--召回报告号 检验/检查报告单号--> \n" +
|
|
|
|
|
" <id root=\"2.16.156.10011.1.32\" extension=\"0004276274_1\"/> \n" +
|
|
|
|
|
" <id root=\"2.16.156.10011.1.32\" extension=\"20250214G0112502141040\"/> \n" +
|
|
|
|
|
" <!--召回关联申请单号--> \n" +
|
|
|
|
|
" <inFulfillmentOf> \n" +
|
|
|
|
|
" <order> \n" +
|
|
|
|
|
" <!-- 关联申请单号(可多个) --> \n" +
|
|
|
|
|
" <id extension=\"253120897\"/> \n" +
|
|
|
|
|
" <id extension=\"1008611\"/> \n" +
|
|
|
|
|
" <id extension=\"1\"/> \n" +
|
|
|
|
|
" <id extension=\"2\"/> \n" +
|
|
|
|
|
" <id extension=\"3\"/> \n" +
|
|
|
|
|
" <!--可多个,当还有需要关联的医嘱号时参照上述格式添加--> \n" +
|
|
|
|
|
" </order> \n" +
|
|
|
|
|
" </inFulfillmentOf> \n" +
|
|
|
|
|
" <!--报告属性 1代表检验报告、2代表检查报告--> \n" +
|
|
|
|
|
" <reportAttribute extension=\"2\" displayName=\"检查报告\"/> \n" +
|
|
|
|
|
" <!--报告属性 1代表检验、2代表PACS、3 内镜、4 静态心电、5 动态心电、6 病理、7 体检、8 Petct 9超声--> \n" +
|
|
|
|
|
" <reportAttribute extension=\"1\" displayName=\"报告属性\"/> \n" +
|
|
|
|
|
" <!--报告类型 013 微生物系统报告 007 检验系统报告--> \n" +
|
|
|
|
|
" <code code=\"001\" codeSystem=\"1.2.156.112672.1.1.27\"> \n" +
|
|
|
|
|
" <displayName value=\"检查系统报告\"/> \n" +
|
|
|
|
|
" <code code=\"007\" codeSystem=\"1.2.156.112672.1.1.27\"> \n" +
|
|
|
|
|
" <displayName value=\"检验系统报告\"/> \n" +
|
|
|
|
|
" </code> \n" +
|
|
|
|
|
" <!-- 报告召回信息 --> \n" +
|
|
|
|
|
" <performer typeCode=\"PRF\"> \n" +
|
|
|
|
|
" <time> \n" +
|
|
|
|
|
" <!-- 报告召回时间 --> \n" +
|
|
|
|
|
" <any value=\"20241204081625\"/> \n" +
|
|
|
|
|
" <any value=\"\"/> \n" +
|
|
|
|
|
" </time> \n" +
|
|
|
|
|
" <assignedEntity classCode=\"ASSIGNED\"> \n" +
|
|
|
|
|
" <!-- 报告召回操作人编码 --> \n" +
|
|
|
|
|
" <id> \n" +
|
|
|
|
|
" <item extension=\"3-621\" root=\"1.2.156.10011.1.1.2\"/> \n" +
|
|
|
|
|
" <item extension=\"\" root=\"1.2.156.10011.1.1.2\"/> \n" +
|
|
|
|
|
" </id> \n" +
|
|
|
|
|
" <assignedPerson determinerCode=\"INSTANCE\" classCode=\"PSN\"> \n" +
|
|
|
|
|
" <!-- 报告召回操作人姓名 必须项已使用 --> \n" +
|
|
|
|
|
" <name xsi:type=\"BAG_EN\"> \n" +
|
|
|
|
|
" <item> \n" +
|
|
|
|
|
" <part value=\"陈泓钰\"/> \n" +
|
|
|
|
|
" <part value=\"\"/> \n" +
|
|
|
|
|
" </item> \n" +
|
|
|
|
|
" </name> \n" +
|
|
|
|
|
" </assignedPerson> \n" +
|
|
|
|
@ -169,12 +175,12 @@ public class HIP1112RecallInspectionReportHandler implements WebserviceReceiveSe
|
|
|
|
|
" <serviceProviderOrganization determinerCode=\"INSTANCE\" classCode=\"ORG\"> \n" +
|
|
|
|
|
" <!--操作科室编码 --> \n" +
|
|
|
|
|
" <id> \n" +
|
|
|
|
|
" <item extension=\"11\" root=\"1.2.156.10011.1.1.1\"/> \n" +
|
|
|
|
|
" <item extension=\"30\" root=\"1.2.156.10011.1.1.1\"/> \n" +
|
|
|
|
|
" </id> \n" +
|
|
|
|
|
" <!--操作科室名称 --> \n" +
|
|
|
|
|
" <name xsi:type=\"BAG_EN\"> \n" +
|
|
|
|
|
" <item> \n" +
|
|
|
|
|
" <part value=\"耳鼻咽喉头颈外科\"/> \n" +
|
|
|
|
|
" <part value=\"检验室\"/> \n" +
|
|
|
|
|
" </item> \n" +
|
|
|
|
|
" </name> \n" +
|
|
|
|
|
" </serviceProviderOrganization> \n" +
|
|
|
|
@ -195,9 +201,9 @@ public class HIP1112RecallInspectionReportHandler implements WebserviceReceiveSe
|
|
|
|
|
" <encounter classCode=\"ENC\" moodCode=\"EVN\"> \n" +
|
|
|
|
|
" <id> \n" +
|
|
|
|
|
" <!-- 就诊次数 必须项已使用 --> \n" +
|
|
|
|
|
" <item extension=\"1\" root=\"1.2.156.10011.1.2.1.7\"/> \n" +
|
|
|
|
|
" <item extension=\"6\" root=\"1.2.156.10011.1.2.1.7\"/> \n" +
|
|
|
|
|
" <!-- 就诊流水号 --> \n" +
|
|
|
|
|
" <item extension=\"401373\" root=\"1.2.156.10011.1.2.1.6\"/> \n" +
|
|
|
|
|
" <item extension=\"10143462\" root=\"1.2.156.10011.1.2.1.6\"/> \n" +
|
|
|
|
|
" </id> \n" +
|
|
|
|
|
" <!--就诊类别编码 1:门诊;2:急诊;3:住院;4:体检;9:其他;--> \n" +
|
|
|
|
|
" <code codeSystem=\"1.2.156.10011.1.1.80\" code=\"3\"> \n" +
|
|
|
|
@ -230,81 +236,178 @@ public class HIP1112RecallInspectionReportHandler implements WebserviceReceiveSe
|
|
|
|
|
msgId = xmlUtil.getNode("/POOR_HIP1112/id/@extension").getNodeValue();
|
|
|
|
|
sender = xmlUtil.getNode("/POOR_HIP1112/sender/device/id/item/@extension").getNodeValue();
|
|
|
|
|
receiver = xmlUtil.getNode("/POOR_HIP1112/receiver/device/id/item/@extension").getNodeValue();
|
|
|
|
|
String inpatientNo;
|
|
|
|
|
int admissTimes;
|
|
|
|
|
String patientId;
|
|
|
|
|
String sysFlag = sender;
|
|
|
|
|
|
|
|
|
|
Node inpatientNoNode = xmlUtil.getNode("/POOR_HIP1112/controlActProcess/subject/placerGroup/subject/patient/id/item[@root='2.16.156.10011.1.12']/@extension");
|
|
|
|
|
if (Objects.isNull(inpatientNoNode)) {
|
|
|
|
|
throw new BaseException("未找到住院号节点!");
|
|
|
|
|
}
|
|
|
|
|
inpatientNo = inpatientNoNode.getNodeValue();
|
|
|
|
|
if (Func.isBlank(inpatientNo)) {
|
|
|
|
|
throw new BaseException("住院号解析为空!");
|
|
|
|
|
}
|
|
|
|
|
Node admissTimesNode = xmlUtil.getNode("/POOR_HIP1112/controlActProcess/subject/placerGroup/componentOf1/encounter/id/item[@root='1.2.156.10011.1.2.1.7']/@extension");
|
|
|
|
|
if (Objects.isNull(admissTimesNode)) {
|
|
|
|
|
throw new BaseException("未找到住院次数节点!");
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
admissTimes = Integer.parseInt(admissTimesNode.getNodeValue());
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
throw new BaseException("无法解析住院次数!");
|
|
|
|
|
}
|
|
|
|
|
if (admissTimes <= 0) {
|
|
|
|
|
throw new BaseException("住院次数解析不正常,应该为大于0的数字!");
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
patientId = tBasicMapper.getPatientIdByInpatientNoAndAdminssTimes(inpatientNo, admissTimes);
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
log.error("检查/检验召回,根据住院号:" + inpatientNo + ",和住院次数:" + admissTimes + ",无法匹配正确的患者!" + ex.getMessage(), ex);
|
|
|
|
|
throw new BaseException("匹配患者失败!");
|
|
|
|
|
}
|
|
|
|
|
if (Func.isBlank(patientId)) {
|
|
|
|
|
throw new BaseException("无法匹配患者!");
|
|
|
|
|
String mzFlag = "1";
|
|
|
|
|
String zyFlag = "3";
|
|
|
|
|
String flag = xmlUtil.getNode("/POOR_HIP1112/controlActProcess/subject/placerGroup/componentOf1/encounter/code/@code").getNodeValue();
|
|
|
|
|
if (zyFlag.equals(flag)) {
|
|
|
|
|
handleZy(xmlUtil, sender);
|
|
|
|
|
} else if (mzFlag.equals(flag)) {
|
|
|
|
|
handleMz(xmlUtil, sender);
|
|
|
|
|
}
|
|
|
|
|
return success(msgId, sender, receiver);
|
|
|
|
|
} catch (BaseException baseException) {
|
|
|
|
|
log.error(baseException.getMessage(), baseException);
|
|
|
|
|
return failed(msgId, sender, receiver, baseException.getMessage());
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
log.error(ex.getMessage(), ex);
|
|
|
|
|
return failed(msgId, sender, receiver, "系统错误!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void handleMz(XmlUtil xmlUtil, String sender) {
|
|
|
|
|
String reportQueryMzInspectCollectorId = sdRyReportQueryConfig.getReportQueryMzInspectCollectorId();
|
|
|
|
|
String reportQueryLisCollectorId = sdRyReportQueryConfig.getReportQueryLisCollectorId();
|
|
|
|
|
// 处理门诊的
|
|
|
|
|
String sdryIndex;
|
|
|
|
|
int admissTimes;
|
|
|
|
|
String patientId;
|
|
|
|
|
|
|
|
|
|
String jy = "1";
|
|
|
|
|
String jc = "2";
|
|
|
|
|
String reportAttribute = xmlUtil.getNode("/POOR_HIP1112/controlActProcess/subject/placerGroup/component/reportAttribute/@extension").getNodeValue();
|
|
|
|
|
Node reportFlagNode = xmlUtil.getNode("/POOR_HIP1112/controlActProcess/subject/placerGroup/component/id[@root='2.16.156.10011.1.32']/@extension");
|
|
|
|
|
String reportFlag = reportFlagNode.getNodeValue();
|
|
|
|
|
if (Func.isBlank(reportFlag)) {
|
|
|
|
|
throw new BaseException("报告单号为空!");
|
|
|
|
|
}
|
|
|
|
|
Node sdryIndexNode = xmlUtil.getNode("/POOR_HIP1112/controlActProcess/subject/placerGroup/subject/patient/id/item[@root='1.2.156.10011.1.2.1.2']/@extension");
|
|
|
|
|
|
|
|
|
|
NodeList requestNoNodes = xmlUtil.getNodeList("/POOR_HIP1112/controlActProcess/subject/placerGroup/component/inFulfillmentOf/order/id/@extension");
|
|
|
|
|
int length = requestNoNodes.getLength();
|
|
|
|
|
if (length > 0) {
|
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
|
Node item = requestNoNodes.item(i);
|
|
|
|
|
String requestNo = item.getNodeValue();
|
|
|
|
|
if (jc.equals(reportAttribute)) {
|
|
|
|
|
String jianChaFileSerialnum = getJcFileSerialnum(reportFlag, requestNo, sender);
|
|
|
|
|
reportService.cancel(patientId, sysFlag, jianChaFileSerialnum);
|
|
|
|
|
}
|
|
|
|
|
if (jy.equals(reportAttribute)) {
|
|
|
|
|
String jianYanFileSerialnum = getJyFileSerialnum(reportFlag, requestNo);
|
|
|
|
|
reportService.cancel(patientId, sysFlag, jianYanFileSerialnum);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (Objects.isNull(sdryIndexNode)) {
|
|
|
|
|
throw new BaseException("未找到域id节点!");
|
|
|
|
|
}
|
|
|
|
|
sdryIndex = sdryIndexNode.getNodeValue();
|
|
|
|
|
if (Func.isBlank(sdryIndex)) {
|
|
|
|
|
throw new BaseException("域ID解析为空!");
|
|
|
|
|
}
|
|
|
|
|
Node admissTimesNode = xmlUtil.getNode("/POOR_HIP1112/controlActProcess/subject/placerGroup/componentOf1/encounter/id/item[@root='1.2.156.10011.1.2.1.7']/@extension");
|
|
|
|
|
if (Objects.isNull(admissTimesNode)) {
|
|
|
|
|
throw new BaseException("未找到就诊次数节点!");
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
admissTimes = Integer.parseInt(admissTimesNode.getNodeValue());
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
throw new BaseException("无法解析就诊次数!");
|
|
|
|
|
}
|
|
|
|
|
if (admissTimes <= 0) {
|
|
|
|
|
throw new BaseException("就诊次数解析不正常,应该为大于0的数字!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// patientId = tBasicMapper.getPatientIdByInpatientNoAndAdminssTimes(inpatientNo, admissTimes);
|
|
|
|
|
patientId = tBasicMapper.getPatientIdBySdRyIndexAndAdmissTimes(sdryIndex, admissTimes + "");
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
// log.error("门诊检查/检验召回,根据门急诊号:" + mzjNo + ",和就诊次数:" + admissTimes + ",无法匹配正确的患者!" + ex.getMessage(), ex);
|
|
|
|
|
log.error("门诊检查/检验召回,根据域id:" + sdryIndex + "无法匹配正确的患者!" + ex.getMessage(), ex);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (Func.isBlank(patientId)) {
|
|
|
|
|
log.error("门诊检查/检验召回,根据域id:" + sdryIndex + "无法匹配正确的患者!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String jy = "1";
|
|
|
|
|
String jc = "2";
|
|
|
|
|
String reportAttribute = xmlUtil.getNode("/POOR_HIP1112/controlActProcess/subject/placerGroup/component/reportAttribute/@extension").getNodeValue();
|
|
|
|
|
Node reportFlagNode = xmlUtil.getNode("/POOR_HIP1112/controlActProcess/subject/placerGroup/component/id[@root='2.16.156.10011.1.32']/@extension");
|
|
|
|
|
String reportFlag = reportFlagNode.getNodeValue();
|
|
|
|
|
if (Func.isBlank(reportFlag)) {
|
|
|
|
|
throw new BaseException("报告单号为空!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NodeList requestNoNodes = xmlUtil.getNodeList("/POOR_HIP1112/controlActProcess/subject/placerGroup/component/inFulfillmentOf/order/id/@extension");
|
|
|
|
|
int length = requestNoNodes.getLength();
|
|
|
|
|
if (length > 0) {
|
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
|
Node item = requestNoNodes.item(i);
|
|
|
|
|
String requestNo = item.getNodeValue();
|
|
|
|
|
if (jc.equals(reportAttribute)) {
|
|
|
|
|
String jianChaFileSerialnum = getJcFileSerialnum(reportFlag, null, sender);
|
|
|
|
|
if (Func.isNotBlank(jianChaFileSerialnum)) {
|
|
|
|
|
reportService.cancel(patientId, sysFlag, jianChaFileSerialnum);
|
|
|
|
|
String jianChaFileSerialnum = getJcFileSerialnum(reportFlag, requestNo, sender);
|
|
|
|
|
reportService.cancel(patientId, reportQueryMzInspectCollectorId, jianChaFileSerialnum);
|
|
|
|
|
}
|
|
|
|
|
if (jy.equals(reportAttribute)) {
|
|
|
|
|
String jianYanFileSerialnum = getMzJyFileSerialnum(reportFlag, requestNo);
|
|
|
|
|
if (Func.isNotBlank(jianYanFileSerialnum)) {
|
|
|
|
|
reportService.cancel(patientId, reportQueryLisCollectorId, jianYanFileSerialnum);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return success(msgId, sender, receiver);
|
|
|
|
|
} catch (BaseException baseException) {
|
|
|
|
|
log.error(baseException.getMessage(), baseException);
|
|
|
|
|
return failed(msgId, sender, receiver, baseException.getMessage());
|
|
|
|
|
} else {
|
|
|
|
|
if (jc.equals(reportAttribute)) {
|
|
|
|
|
String jianChaFileSerialnum = getJcFileSerialnum(reportFlag, null, sender);
|
|
|
|
|
if (Func.isNotBlank(jianChaFileSerialnum)) {
|
|
|
|
|
reportService.cancel(patientId, reportQueryMzInspectCollectorId, jianChaFileSerialnum);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void handleZy(XmlUtil xmlUtil, String sender) {
|
|
|
|
|
// 处理住院
|
|
|
|
|
String sdryIndex;
|
|
|
|
|
int admissTimes;
|
|
|
|
|
String patientId;
|
|
|
|
|
String sysFlag = sender;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Node sdryIndexNode = xmlUtil.getNode("/POOR_HIP1112/controlActProcess/subject/placerGroup/subject/patient/id/item[@root='1.2.156.10011.1.2.1.2']/@extension");
|
|
|
|
|
|
|
|
|
|
if (Objects.isNull(sdryIndexNode)) {
|
|
|
|
|
throw new BaseException("未找到域id节点!");
|
|
|
|
|
}
|
|
|
|
|
sdryIndex = sdryIndexNode.getNodeValue();
|
|
|
|
|
if (Func.isBlank(sdryIndex)) {
|
|
|
|
|
throw new BaseException("域ID解析为空!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Node admissTimesNode = xmlUtil.getNode("/POOR_HIP1112/controlActProcess/subject/placerGroup/componentOf1/encounter/id/item[@root='1.2.156.10011.1.2.1.7']/@extension");
|
|
|
|
|
if (Objects.isNull(admissTimesNode)) {
|
|
|
|
|
throw new BaseException("未找到住院次数节点!");
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
admissTimes = Integer.parseInt(admissTimesNode.getNodeValue());
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
log.error(ex.getMessage(), ex);
|
|
|
|
|
return failed(msgId, sender, receiver, "系统错误!");
|
|
|
|
|
throw new BaseException("无法解析住院次数!");
|
|
|
|
|
}
|
|
|
|
|
if (admissTimes <= 0) {
|
|
|
|
|
throw new BaseException("住院次数解析不正常,应该为大于0的数字!");
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
patientId = tBasicMapper.getPatientIdBySdRyIndexAndAdmissTimes(sdryIndex, admissTimes + "");
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
log.error("住院检查/检验召回,根据域ID:" + sdryIndex + ",和住院次数:" + admissTimes + ",无法匹配正确的患者!" + ex.getMessage(), ex);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (Func.isBlank(patientId)) {
|
|
|
|
|
log.error("住院检查/检验召回,根据域ID:" + sdryIndex + ",和住院次数:" + admissTimes + ",无法匹配正确的患者!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String jy = "1";
|
|
|
|
|
String jc = "2";
|
|
|
|
|
String reportAttribute = xmlUtil.getNode("/POOR_HIP1112/controlActProcess/subject/placerGroup/component/reportAttribute/@extension").getNodeValue();
|
|
|
|
|
Node reportFlagNode = xmlUtil.getNode("/POOR_HIP1112/controlActProcess/subject/placerGroup/component/id[@root='2.16.156.10011.1.32']/@extension");
|
|
|
|
|
String reportFlag = reportFlagNode.getNodeValue();
|
|
|
|
|
if (Func.isBlank(reportFlag)) {
|
|
|
|
|
throw new BaseException("报告单号为空!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NodeList requestNoNodes = xmlUtil.getNodeList("/POOR_HIP1112/controlActProcess/subject/placerGroup/component/inFulfillmentOf/order/id/@extension");
|
|
|
|
|
int length = requestNoNodes.getLength();
|
|
|
|
|
if (length > 0) {
|
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
|
Node item = requestNoNodes.item(i);
|
|
|
|
|
String requestNo = item.getNodeValue();
|
|
|
|
|
if (jc.equals(reportAttribute)) {
|
|
|
|
|
String jianChaFileSerialnum = getJcFileSerialnum(reportFlag, requestNo, sender);
|
|
|
|
|
reportService.cancel(patientId, sysFlag, jianChaFileSerialnum);
|
|
|
|
|
}
|
|
|
|
|
if (jy.equals(reportAttribute)) {
|
|
|
|
|
String jianYanFileSerialnum = getZyJyFileSerialnum(reportFlag, requestNo);
|
|
|
|
|
reportService.cancel(patientId, sysFlag, jianYanFileSerialnum);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (jc.equals(reportAttribute)) {
|
|
|
|
|
String jianChaFileSerialnum = getJcFileSerialnum(reportFlag, null, sender);
|
|
|
|
|
if (Func.isNotBlank(jianChaFileSerialnum)) {
|
|
|
|
|
reportService.cancel(patientId, sysFlag, jianChaFileSerialnum);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -333,13 +436,26 @@ public class HIP1112RecallInspectionReportHandler implements WebserviceReceiveSe
|
|
|
|
|
/**
|
|
|
|
|
* @param reportFlag 报告单号
|
|
|
|
|
* @param requestNo 电子申请单号
|
|
|
|
|
* @return 检验报告的归档唯一id
|
|
|
|
|
* @return 住院检验报告的归档唯一id
|
|
|
|
|
*/
|
|
|
|
|
private String getJyFileSerialnum(String reportFlag, String requestNo) {
|
|
|
|
|
private String getZyJyFileSerialnum(String reportFlag, String requestNo) {
|
|
|
|
|
return reportFlag + "@" + requestNo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param reportFlag 报告单号
|
|
|
|
|
* @param requestNo 电子申请单号
|
|
|
|
|
* @return 门诊检验报告的归档唯一id
|
|
|
|
|
*/
|
|
|
|
|
private String getMzJyFileSerialnum(String reportFlag, String requestNo) {
|
|
|
|
|
if (Objects.isNull(requestNo)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return reportFlag + requestNo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 返回检查报告新增成功消息
|
|
|
|
|
*
|
|
|
|
|