2015-08-20 1 views
1

J'ai suivi HL7-Message pour analyser.Comment lire plusieurs segments ORC et OBR à partir du message HL7 en utilisant HAPI

MSH|^~\&|LIS|LAB1|APP2|LAB2|20140706163250||OML^O21|20140706163252282|P|2.4 
PID|1||7015||LISTESTPATIENT12^LISTESTPATIENT12||19730901000000|F 
PV1|1||||||LISPHYCDE1^LISPHY001^LISCARE TEST 
ORC|NW|LISCASEID15|||||||||||||||NJ||||TCL^TCL 
OBR|1|LISCASEID15||28259^Her2^STAIN|||20140706162713|||||||20140706162713|Breast|patho^pathl^pathf|||image1^image1^image1|blk1^blk1^blk1|SPEC14^SPEC14^SPEC14 
ORC|XO|LISCASEID15|||||||||||||||NJ||||TCL^TCL 
OBR|2|LISCASEID15||28260^Her2^STAIN|||20140706162713|||||||20140706162713|Breast|patho^pathl^pathf|||image2^image2^image|blk2^blk2^blk2|SPEC14^SPEC14^SPEC14 

Je suis en train de chercher les valeurs des deux méthode OBR & segments ORC à l'aide HAPI Terser.get() comme suit.

Terser t = new Terser(h7msg); 
t.get("/.ORDER_OBSERVATION(0)/ORC-1-1"); // Should return NW 
t.get("/.ORDER_OBSERVATION(1)/ORC-1-1"); // Should return XO 
t.get("/.ORDER_OBSERVATION(0)/OBR-4-1"); // Should return 28259 
t.get("/.ORDER_OBSERVATION(1)/OBR-4-1"); // Should return 28260 

Mais toutes les déclarations ci-dessus donne erreur suivant « Fin du message atteint sans boucle tout en réitérant »

Je ne sais pas, ce mal que je fais ici. Les gars s'il vous plaît aidez-moi avec une entrée correcte à la méthode Teaser.get(), pour obtenir ci-dessus les valeurs.

Répondre

1

Le problème ici est que le message OML^O21 ne contient pas plusieurs ORDER_OBSERVATION. Cela signifie que vous ne pouvez pas accéder à l'élément ORDER_OBSERVATION(1), car il n'existe pas.

Voici une représentation au sein 7Edit: enter image description here

Lorsque vous analysez votre message OML avec XML, vous pouvez voir la structure réelle du HL7:

<?xml version="1.0" encoding="UTF-8"?><OML_O21 xmlns="urn:hl7-org:v2xml"> 
    <MSH> 
     <MSH.1>|</MSH.1> 
     <MSH.2>^~\&amp;</MSH.2> 
     <MSH.3> 
     <HD.1>LIS</HD.1> 
     </MSH.3> 
     <MSH.4> 
     <HD.1>LAB1</HD.1> 
     </MSH.4> 
     <MSH.5> 
     <HD.1>APP2</HD.1> 
     </MSH.5> 
     <MSH.6> 
     <HD.1>LAB2</HD.1> 
     </MSH.6> 
     <MSH.7> 
     <TS.1>20140706163250</TS.1> 
     </MSH.7> 
     <MSH.9> 
     <MSG.1>OML</MSG.1> 
     <MSG.2>O21</MSG.2> 
     </MSH.9> 
     <MSH.10>20140706163252282</MSH.10> 
     <MSH.11> 
     <PT.1>P</PT.1> 
     </MSH.11> 
     <MSH.12> 
     <VID.1>2.4</VID.1> 
     </MSH.12> 
    </MSH> 
    <OML_O21.PATIENT> 
     <PID> 
     <PID.1>1</PID.1> 
     <PID.3> 
      <CX.1>7015</CX.1> 
     </PID.3> 
     <PID.5> 
      <XPN.1> 
       <FN.1>LISTESTPATIENT12</FN.1> 
      </XPN.1> 
      <XPN.2>LISTESTPATIENT12</XPN.2> 
     </PID.5> 
     <PID.7> 
      <TS.1>19730901000000</TS.1> 
     </PID.7> 
     <PID.8>F</PID.8> 
     </PID> 
     <OML_O21.PATIENT_VISIT> 
     <PV1> 
      <PV1.1>1</PV1.1> 
      <PV1.7> 
       <XCN.1>LISPHYCDE1</XCN.1> 
       <XCN.2> 
        <FN.1>LISPHY001</FN.1> 
       </XCN.2> 
       <XCN.3>LISCARE TEST</XCN.3> 
      </PV1.7> 
     </PV1> 
     </OML_O21.PATIENT_VISIT> 
    </OML_O21.PATIENT> 
    <OML_O21.ORDER_GENERAL> 
     <OML_O21.ORDER> 
     <ORC> 
      <ORC.1>NW</ORC.1> 
      <ORC.2> 
       <EI.1>LISCASEID15</EI.1> 
      </ORC.2> 
      <ORC.17> 
       <CE.1>NJ</CE.1> 
      </ORC.17> 
      <ORC.21> 
       <XON.1>TCL</XON.1> 
       <XON.2>TCL</XON.2> 
      </ORC.21> 
     </ORC> 
     </OML_O21.ORDER> 
     <OML_O21.ORDER> 
     <ORC> 
      <ORC.1>XO</ORC.1> 
      <ORC.2> 
       <EI.1>LISCASEID15</EI.1> 
      </ORC.2> 
      <ORC.17> 
       <CE.1>NJ</CE.1> 
      </ORC.17> 
      <ORC.21> 
       <XON.1>TCL</XON.1> 
       <XON.2>TCL</XON.2> 
      </ORC.21> 
     </ORC> 
     <OML_O21.OBSERVATION_REQUEST> 
      <OBR> 
       <OBR.1>1</OBR.1> 
       <OBR.2> 
        <EI.1>LISCASEID15</EI.1> 
       </OBR.2> 
       <OBR.4> 
        <CE.1>28259</CE.1> 
        <CE.2>Her2</CE.2> 
        <CE.3>STAIN</CE.3> 
       </OBR.4> 
       <OBR.7> 
        <TS.1>20140706162713</TS.1> 
       </OBR.7> 
       <OBR.14> 
        <TS.1>20140706162713</TS.1> 
       </OBR.14> 
       <OBR.15> 
        <SPS.1> 
        <CE.1>Breast</CE.1> 
        </SPS.1> 
       </OBR.15> 
       <OBR.16> 
        <XCN.1>patho</XCN.1> 
        <XCN.2> 
        <FN.1>pathl</FN.1> 
        </XCN.2> 
        <XCN.3>pathf</XCN.3> 
       </OBR.16> 
       <OBR.19>image1</OBR.19> 
       <OBR.20>blk1</OBR.20> 
       <OBR.21>SPEC14</OBR.21> 
      </OBR> 
      <OML_O21.PRIOR_RESULT> 
       <OML_O21.ORDER_PRIOR> 
        <OBR> 
        <OBR.1>2</OBR.1> 
        <OBR.2> 
         <EI.1>LISCASEID15</EI.1> 
        </OBR.2> 
        <OBR.4> 
         <CE.1>28260</CE.1> 
         <CE.2>Her2</CE.2> 
         <CE.3>STAIN</CE.3> 
        </OBR.4> 
        <OBR.7> 
         <TS.1>20140706162713</TS.1> 
        </OBR.7> 
        <OBR.14> 
         <TS.1>20140706162713</TS.1> 
        </OBR.14> 
        <OBR.15> 
         <SPS.1> 
          <CE.1>Breast</CE.1> 
         </SPS.1> 
        </OBR.15> 
        <OBR.16> 
         <XCN.1>patho</XCN.1> 
         <XCN.2> 
          <FN.1>pathl</FN.1> 
         </XCN.2> 
         <XCN.3>pathf</XCN.3> 
        </OBR.16> 
        <OBR.19>image2</OBR.19> 
        <OBR.20>blk2</OBR.20> 
        <OBR.21>SPEC14</OBR.21> 
        </OBR> 
       </OML_O21.ORDER_PRIOR> 
      </OML_O21.PRIOR_RESULT> 
     </OML_O21.OBSERVATION_REQUEST> 
     </OML_O21.ORDER> 
    </OML_O21.ORDER_GENERAL> 
</OML_O21> 

C'est malheureusement un problème avec beaucoup Parsers comme HAPI, ils vérifient la structure de n'importe quel message, en fonction du type (OML_O21) et aussi de la version. Parce que si vous passez de 2.4 à 2.5, vous obtiendrez une structure complètement différente. Si vous ne vous souciez pas de cette structure, vous pouvez utiliser un analyseur HL7 différent comme HL7X qui transforme le hl7 en XML comme un fichier délimité - indépendamment du type ou de la version du message hl7.

Vous trouverez ici un problème similaire sur stackoverflow:

How to parse the Multiple OBR Segment in HL7 using HAPI TERSER

+0

oui vous avez raison. – user1905874

+1

Maintenant, j'utilise la suite de logique sale; Pour la première fois, j'utilise /.ORC-1-1 et /.OBR-4-1 pour accéder au premier ensemble d'ORC et d'OBR. Et après cela, pour chaque répétition, j'utilise /.ORDER_PRIOR(0)/ORC-1-1 et /.ORDER_PRIOR(0)/OBR-4-1. Et s'il y a plus de segments ORC et OBR, utilisez /.ORDER_PRIOR(1)/ORC-1-1 et /.ORDER_PRIOR(1)/OBR-4-1. Ça fonctionne bien pour moi. Je ne peux pas utiliser HL7X, car il ne supporte pas l'intégration avec Apache-Camel, mais HAPI doit s'en tenir à HAPI. – user1905874