1

如何解析以 FHS 开头的 HL7 消息为 XML:

FHS|^~\&|Medical-Objects|Eli MOA Test Cap
BHS|^~\&|Medical-Objects|Eli MOA Test Cap
MSH|^~\&|MODemoSoftware|Eli MOA Test Cap^51675B57-9C95-4278-B52E-3FE5EEB6B3EE^GUID|||20121127180300|Eli MOA Test Cap (Capricorn)|ORU^R01|201211271803520050|P|2.3.1|||||||en
PID|1|HB117056|ABC123^^^MODemo^MC~401114835T^^^^PEN~401114835T||TEST^Patient||20010101|F||4^Non-indigenous|10/102 Wises Road^^Maroochydore^^4558||0754566000
PV1|1||AE\R\HBH^^^HBH&Medical Objects Demo Hospital&MODemoSoftware|||||0000000Y^REFERRING^Provider^^^DR^^^AUSHICPR^L^^^UPIN|UP3123000QW^CONSULTING^Provider^^^DR^^^AUSHICPR^L^^^UPIN
ORC|RE|589113676^MODemoSoftware|589113676^Eli MOA Test Cap^51675B57-9C95-4278-B52E-3FE5EEB6B3EE^GUID||IP||^^^20121127^^URGENT|||||0000000Y^REFERRING^Provider^^^DR^^^AUSHICPR^L^^^UPIN
4

1 回答 1

1

首先,您的消息必须以起始段(FHS 和 MSH)开头 - 因此它可以被识别为两条消息。

不幸的是,对于基本的 HAPI 库,这是不可能的,因为 HAPI 不知道 FHS 段。当您使用HAPI TestPanel时,您会非常清楚地看到结果:

在此处输入图像描述

当您切换到 XML 视图时 - HAPI 能够转换 ORU 消息(从 MSH 开始),但第一行 (FHS) 仍然存在。

解决方案 A:(如果您无法修改源 HL7)您自己将“FHS”解析为您想要的 XML 格式。然后您可以使用 HAPI 为您转换其余部分。

解决方案 B:更改 HL7 文件并在末尾添加您的段。然后 HAPI 对其进行转换。HL7 示例:

MSH|^~\&|MODemoSoftware|Eli MOA Test Cap^51675B57-9C95-4278-B52E-3FE5EEB6B3EE^GUID|||20121127180300|Eli MOA Test Cap (Capricorn)|ORU^R01|201211271803520050|P|2.3.1|||||||en
PID|1|HB117056|ABC123^^^MODemo^MC~401114835T^^^^PEN~401114835T||TEST^Patient||20010101|F||4^Non-indigenous|10/102 Wises Road^^Maroochydore^^4558||0754566000
PV1|1||AE\R\HBH^^^HBH&Medical Objects Demo Hospital&MODemoSoftware|||||0000000Y^REFERRING^Provider^^^DR^^^AUSHICPR^L^^^UPIN|UP3123000QW^CONSULTING^Provider^^^DR^^^AUSHICPR^L^^^UPIN
ORC|RE|589113676^MODemoSoftware|589113676^Eli MOA Test Cap^51675B57-9C95-4278-B52E-3FE5EEB6B3EE^GUID||IP||^^^20121127^^URGENT|||||0000000Y^REFERRING^Provider^^^DR^^^AUSHICPR^L^^^UPIN
FHS|Medical-Objects|Eli MOA Test Cap
BHS|Medical-Objects|Eli MOA Test Cap

XML 结果:

<?xml version="1.0" encoding="UTF-8"?>
<ORU_R01 xmlns="urn:hl7-org:v2xml">
    <MSH>
        <MSH.1>|</MSH.1>
        <MSH.2>^~\&amp;</MSH.2>
        <MSH.3>
            <HD.1>MODemoSoftware</HD.1>
        </MSH.3>
        <MSH.4>
            <HD.1>Eli MOA Test Cap</HD.1>
            <HD.2>51675B57-9C95-4278-B52E-3FE5EEB6B3EE</HD.2>
            <HD.3>GUID</HD.3>
        </MSH.4>
        <MSH.7>
            <TS.1>20121127180300</TS.1>
        </MSH.7>
        <MSH.8>Eli MOA Test Cap (Capricorn)</MSH.8>
        <MSH.9>
            <MSG.1>ORU</MSG.1>
            <MSG.2>R01</MSG.2>
        </MSH.9>
        <MSH.10>201211271803520050</MSH.10>
        <MSH.11>
            <PT.1>P</PT.1>
        </MSH.11>
        <MSH.12>
            <VID.1>2.3.1</VID.1>
        </MSH.12>
        <MSH.19>
            <CE.1>en</CE.1>
        </MSH.19>
    </MSH>
    <ORU_R01.PIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI>
        <ORU_R01.PIDPD1NK1NTEPV1PV2>
            <PID>
                <PID.1>1</PID.1>
                <PID.2>
                    <CX.1>HB117056</CX.1>
                </PID.2>
                <PID.3>
                    <CX.1>ABC123</CX.1>
                    <CX.4>
                        <HD.1>MODemo</HD.1>
                    </CX.4>
                    <CX.5>MC</CX.5>
                </PID.3>
                <PID.3>
                    <CX.1>401114835T</CX.1>
                    <CX.5>PEN</CX.5>
                </PID.3>
                <PID.3>
                    <CX.1>401114835T</CX.1>
                </PID.3>
                <PID.5>
                    <XPN.1>
                        <FN.1>TEST</FN.1>
                    </XPN.1>
                    <XPN.2>Patient</XPN.2>
                </PID.5>
                <PID.7>
                    <TS.1>20010101</TS.1>
                </PID.7>
                <PID.8>F</PID.8>
                <PID.10>
                    <CE.1>4</CE.1>
                    <CE.2>Non-indigenous</CE.2>
                </PID.10>
                <PID.11>
                    <XAD.1>10/102 Wises Road</XAD.1>
                    <XAD.3>Maroochydore</XAD.3>
                    <XAD.5>4558</XAD.5>
                </PID.11>
                <PID.13>
                    <XTN.1>0754566000</XTN.1>
                </PID.13>
            </PID>
            <ORU_R01.PV1PV2>
                <PV1>
                    <PV1.1>1</PV1.1>
                    <PV1.3>
                        <PL.1>AE~HBH</PL.1>
                        <PL.4>
                            <HD.1>HBH</HD.1>
                            <HD.2>Medical Objects Demo Hospital</HD.2>
                            <HD.3>MODemoSoftware</HD.3>
                        </PL.4>
                    </PV1.3>
                    <PV1.8>
                        <XCN.1>0000000Y</XCN.1>
                        <XCN.2>
                            <FN.1>REFERRING</FN.1>
                        </XCN.2>
                        <XCN.3>Provider</XCN.3>
                        <XCN.6>DR</XCN.6>
                        <XCN.9>
                            <HD.1>AUSHICPR</HD.1>
                        </XCN.9>
                        <XCN.10>L</XCN.10>
                        <XCN.13>UPIN</XCN.13>
                    </PV1.8>
                    <PV1.9>
                        <XCN.1>UP3123000QW</XCN.1>
                        <XCN.2>
                            <FN.1>CONSULTING</FN.1>
                        </XCN.2>
                        <XCN.3>Provider</XCN.3>
                        <XCN.6>DR</XCN.6>
                        <XCN.9>
                            <HD.1>AUSHICPR</HD.1>
                        </XCN.9>
                        <XCN.10>L</XCN.10>
                        <XCN.13>UPIN</XCN.13>
                    </PV1.9>
                </PV1>
            </ORU_R01.PV1PV2>
        </ORU_R01.PIDPD1NK1NTEPV1PV2>
        <ORU_R01.ORCOBRNTEOBXNTECTI>
            <ORC>
                <ORC.1>RE</ORC.1>
                <ORC.2>
                    <EI.1>589113676</EI.1>
                    <EI.2>MODemoSoftware</EI.2>
                </ORC.2>
                <ORC.3>
                    <EI.1>589113676</EI.1>
                    <EI.2>Eli MOA Test Cap</EI.2>
                    <EI.3>51675B57-9C95-4278-B52E-3FE5EEB6B3EE</EI.3>
                    <EI.4>GUID</EI.4>
                </ORC.3>
                <ORC.5>IP</ORC.5>
                <ORC.7>
                    <TQ.4>
                        <TS.1>20121127</TS.1>
                    </TQ.4>
                    <TQ.6>URGENT</TQ.6>
                </ORC.7>
                <ORC.12>
                    <XCN.1>0000000Y</XCN.1>
                    <XCN.2>
                        <FN.1>REFERRING</FN.1>
                    </XCN.2>
                    <XCN.3>Provider</XCN.3>
                    <XCN.6>DR</XCN.6>
                    <XCN.9>
                        <HD.1>AUSHICPR</HD.1>
                    </XCN.9>
                    <XCN.10>L</XCN.10>
                    <XCN.13>UPIN</XCN.13>
                </ORC.12>
            </ORC>
            <FHS>
                <FHS.1>|</FHS.1>
                <FHS.2>Medical-Objects</FHS.2>
                <FHS.3>Eli MOA Test Cap</FHS.3>
            </FHS>
            <BHS>
                <BHS.1>|</BHS.1>
                <BHS.2>Medical-Objects</BHS.2>
                <BHS.3>Eli MOA Test Cap</BHS.3>
            </BHS>
        </ORU_R01.ORCOBRNTEOBXNTECTI>
    </ORU_R01.PIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI>
</ORU_R01>
于 2013-01-10T13:12:32.867 回答