我已将HL7消息转换为XML,我想将此XML转换为JSON。我正在使用XML到JSON连接器。但不知怎的,它给我一个警告说
无法解析MSH段。默认为US-ASCII ca.uhn.hl7v2.HL7Exception:无法识别消息编码
以下是我的配置xml
<hl7:endpoint host="localhost" port="50609" name="HL7_MLLP" responseTimeout="10000" doc:name="HL7 MLLP"/>
<json:object-to-json-transformer name="Object_to_JSON" doc:name="Object to JSON"/>
<flow name="wsconsumerFlow">
<hl7:inbound-endpoint host="localhost" port="50609" tracking:enable-default-events="true" responseTimeout="10000" doc:name="HL7 MLLP" metadata:id="1c7409bf-e286-4e3d-8e48-3dea6888f554" />
<hl7:hl7-encoding-transformer hl7Encoding="XML" validation="WEAK" metadata:id="1b0e4ffa-cb7c-4a40-a84d-f11208d5e586" doc:name="HL7 Encoding Transformer"/>
<json:xml-to-json-transformer doc:name="XML to JSON"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<hl7:exception-strategy doc:name="HL7 Exception Strategy"/>
</flow>
</mule>
下面是XML
<?xml version="1.0" encoding="UTF-8"?><ADT_A01 xmlns="urn:hl7-org:v2xml">
<MSH>
<MSH.1>|</MSH.1>
<MSH.2>^~\&</MSH.2>
<MSH.7>20161024111855.78-0400</MSH.7>
<MSH.9>
<MSG.1>ADT</MSG.1>
<MSG.2>A01</MSG.2>
<MSG.3>ADT_A01</MSG.3>
</MSH.9>
<MSH.10>201</MSH.10>
<MSH.11>
<PT.1>T</PT.1>
</MSH.11>
<MSH.12>
<VID.1>2.6</VID.1>
</MSH.12>
</MSH>
<EVN>
<EVN.1>A01-</EVN.1>
<EVN.2>198808181123</EVN.2>
</EVN>
<PID>
<PID.3>
<CX.1>PATID1234</CX.1>
<CX.2>5</CX.2>
<CX.3>M11</CX.3>
</PID.3>
<PID.5>
<XPN.1>
<FN.1>JONES</FN.1>
</XPN.1>
<XPN.2>WILLIAM</XPN.2>
<XPN.3>A</XPN.3>
<XPN.4>III</XPN.4>
</PID.5>
<PID.7>19610615</PID.7>
<PID.8>M-</PID.8>
<PID.10>
<CWE.1>2106-3</CWE.1>
</PID.10>
<PID.11>
<XAD.1>
<SAD.1>1200 N ELM STREET</SAD.1>
</XAD.1>
<XAD.3>GREENSBORO</XAD.3>
<XAD.4>NC</XAD.4>
<XAD.5>27401-1020</XAD.5>
</PID.11>
<PID.12>GL</PID.12>
<PID.13>
<XTN.1>(919)379-1212</XTN.1>
</PID.13>
<PID.14>
<XTN.1>(919)271-3434</XTN.1>
</PID.14>
<PID.14>
<XTN.1>(919)277-3114</XTN.1>
</PID.14>
<PID.16>
<CWE.1>S</CWE.1>
</PID.16>
<PID.18>
<CX.1>PATID12345001</CX.1>
<CX.2>2</CX.2>
<CX.3>M10</CX.3>
</PID.18>
<PID.19>123456789</PID.19>
<PID.20>
<DLN.1>9-87654</DLN.1>
<DLN.2>NC</DLN.2>
</PID.20>
</PID>
<NK1>
<NK1.1>1</NK1.1>
<NK1.2>
<XPN.1>
<FN.1>JONES</FN.1>
</XPN.1>
<XPN.2>BARBARA</XPN.2>
<XPN.3>K</XPN.3>
</NK1.2>
<NK1.3>
<CWE.1>SPO</CWE.1>
</NK1.3>
<NK1.8>20011105</NK1.8>
</NK1>
<NK1>
<NK1.1>1</NK1.1>
<NK1.2>
<XPN.1>
<FN.1>JONES</FN.1>
</XPN.1>
<XPN.2>MICHAEL</XPN.2>
<XPN.3>A</XPN.3>
</NK1.2>
<NK1.3>
<CWE.1>FTH</CWE.1>
</NK1.3>
</NK1>
<PV1>
<PV1.1>1</PV1.1>
<PV1.2>I</PV1.2>
<PV1.3>
<PL.1>2000</PL.1>
<PL.2>2012</PL.2>
<PL.3>01</PL.3>
</PV1.3>
<PV1.7>
<XCN.1>004777</XCN.1>
<XCN.2>
<FN.1>LEBAUER</FN.1>
</XCN.2>
<XCN.3>SIDNEY</XCN.3>
<XCN.4>J.</XCN.4>
</PV1.7>
<PV1.10>SUR</PV1.10>
<PV1.12>-</PV1.12>
<PV1.14>1</PV1.14>
<PV1.15>A0-</PV1.15>
</PV1>
<AL1>
<AL1.1>1</AL1.1>
<AL1.3>
<CWE.2>PENICILLIN</CWE.2>
</AL1.3>
<AL1.5>PRODUCES HIVES</AL1.5>
<AL1.5>RASH</AL1.5>
</AL1>
<AL1>
<AL1.1>2</AL1.1>
<AL1.3>
<CWE.2>CAT DANDER</CWE.2>
</AL1.3>
</AL1>
<DG1>
<DG1.1>001</DG1.1>
<DG1.2>I9</DG1.2>
<DG1.3>
<CWE.1>1550</CWE.1>
</DG1.3>
<DG1.4>MAL NEO LIVER, PRIMARY</DG1.4>
<DG1.5>19880501103005</DG1.5>
<DG1.6>F</DG1.6>
</DG1>
<ADT_A01.PROCEDURE>
<PR1>
<PR1.1>2234</PR1.1>
<PR1.2>M11</PR1.2>
<PR1.3>
<CNE.1>111</CNE.1>
<CNE.2>CODE151</CNE.2>
</PR1.3>
<PR1.4>COMMON PROCEDURES</PR1.4>
<PR1.5>198809081123</PR1.5>
</PR1>
<ROL>
<ROL.1>
<EI.1>45</EI.1>
<EI.2>RECORDER</EI.2>
<EI.3>ROLE MASTER LIST</EI.3>
</ROL.1>
<ROL.2>AD</ROL.2>
<ROL.3>
<CWE.1>CP</CWE.1>
</ROL.3>
<ROL.4>
<XCN.1>KATE</XCN.1>
<XCN.2>
<FN.1>SMITH</FN.1>
</XCN.2>
<XCN.3>ELLEN</XCN.3>
</ROL.4>
<ROL.5>199505011201</ROL.5>
</ROL>
</ADT_A01.PROCEDURE>
<GT1>
<GT1.1>1122</GT1.1>
<GT1.2>
<CX.1>1519</CX.1>
</GT1.2>
<GT1.3>
<XPN.1>
<FN.1>BILL</FN.1>
</XPN.1>
<XPN.2>GATES</XPN.2>
<XPN.3>A</XPN.3>
</GT1.3>
</GT1>
<ADT_A01.INSURANCE>
<IN1>
<IN1.1>001</IN1.1>
<IN1.2>
<CWE.1>A357</CWE.1>
</IN1.2>
<IN1.3>
<CX.1>1234</CX.1>
</IN1.3>
<IN1.4>
<XON.1>BCMD</XON.1>
</IN1.4>
<IN1.9>
<XON.1>132987</XON.1>
</IN1.9>
</IN1>
<IN2>
<IN2.1>
<CX.1>ID1551001</CX.1>
</IN2.1>
<IN2.2>SSN12345678</IN2.2>
</IN2>
</ADT_A01.INSURANCE>
</ADT_A01>
答案 0 :(得分:0)
警告&#39;无法识别邮件编码&#39;如果编码不是ER7或XML,则按以下链接抛出:
http://hl7api.sourceforge.net/cobertura/ca.uhn.hl7v2.preparser.PreParser.html
我尝试使用HAPI测试面板发送HL7消息,然后编码是ER7,但仍然收到警告。但是,转换为JSON是成功的。所以,我觉得你可以忽略这个警告。