I have a custom model class factory which returns 2.6 version for any
version as input.

 So my ORU_R01 is 2.6 version.

Here is the code snippet for extracting values from ORU_R01 for OBX.

    public Message processMessage(Message theMessage, Map theMetadata)
throws ReceivingApplicationException, HL7Exception {

      // TODO Auto-generated method stub

      

      logger.info(this.getClass().getName() + "\tprocessing the recived
message");

      

 

      Terser localTerser = new Terser(theMessage);

      

      ORU_R01 ORU_R01Message = (ORU_R01) theMessage;

      for (int PATIENT_RESULTRep = 1; PATIENT_RESULTRep <
ORU_R01Message.getPATIENT_RESULTReps(); PATIENT_RESULTRep++) {

          String pid3 = localTerser.get("/PATIENT_RESULT(" +
PATIENT_RESULTRep + ")/PATIENT/PID-3-1");

          String pid18 = localTerser.get("/PATIENT_RESULT(" +
PATIENT_RESULTRep + ")/PATIENT/PID-18-1");

          String pv119 = localTerser.get("/PATIENT_RESULT(" +
PATIENT_RESULTRep + ")/PATIENT/VISIT/PV1-19-1");

//Rest of the stuff is my application specific

          for (int ORDER_OBSERVATIONRep = 0; ORDER_OBSERVATIONRep <
ORU_R01Message.getPATIENT_RESULT(PATIENT_RESULTRep).getORDER_OBSERVATION
Reps(); ORDER_OBSERVATIONRep++) {

            

            String obr2 = localTerser.get("/PATIENT_RESULT(" +
PATIENT_RESULTRep + ")/ORDER_OBSERVATION(" + ORDER_OBSERVATIONRep +
")/OBR-2-1");

            String obr3 = localTerser.get("/PATIENT_RESULT(" +
PATIENT_RESULTRep + ")/ORDER_OBSERVATION(" + ORDER_OBSERVATIONRep +
")/OBR-3-1");

            String obr4 = localTerser.get("/PATIENT_RESULT(" +
PATIENT_RESULTRep + ")/ORDER_OBSERVATION(" + ORDER_OBSERVATIONRep +
")/OBR-4-1");

            //Rest of the stuff is my application specific

 

            for (int OBSERVATIONRep = 0; OBSERVATIONRep <
ORU_R01Message.getPATIENT_RESULT(PATIENT_RESULTRep).getORDER_OBSERVATION
(ORDER_OBSERVATIONRep).getOBSERVATIONReps(); OBSERVATIONRep++) {

                String obx3 = localTerser.get("/PATIENT_RESULT(" +
PATIENT_RESULTRep + ")/ORDER_OBSERVATION(" + ORDER_OBSERVATIONRep +
")/OBSERVATION(" + OBSERVATIONRep + ")/OBX-3-1");

//Rest of the stuff is my application specific

 

            }

          }

      }

      

      // Now we need to generate a message to return. This will
generally be

      // an ACK message.

      Message retVal;

      try {

          // This method takes in the MSH segment of an incoming
message, and

          // generates an

          // appropriate ACK

          ret Val = DefaultApplication.makeACK((Segment)
theMessage.get("MSH"));

          

      } catch (IOException e) {

          throw new HL7Exception(e);

      }

      

      return retVal;

      

    }

 

From: James Agnew [mailto:[email protected]] 
Sent: Thursday, August 06, 2009 4:08 PM
Cc: [email protected]
Subject: Re: [HAPI-devel] HELP-OBX

 

That's odd.

The following code works for me:

        ORU_R01 oru = new ORU_R01();
        oru.getMSH().getEncodingCharacters().setValue("^~\\&");
        oru.getMSH().getFieldSeparator().setValue("|");
        oru.getMSH().getMessageType().getMessageCode().setValue("ORU");
        oru.getMSH().getMessageType().getTriggerEvent().setValue("R01");
        oru.getMSH().getVersionID().getVersionID().setValue("2.5");
        
        terser = new Terser(oru);
        for (int i = 0; i < 5; i++) {
            terser.set("/PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION("
+ i + ")/OBX-1", "" + (i + 1));
            terser.set("/PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION("
+ i + ")/OBX-3", "ST");
            terser.set("/PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION("
+ i + ")/OBX-5", "This is the value for rep " + i);
        }

Which message version are you each using?

Cheers,
James



On Mon, Aug 3, 2009 at 12:01 PM, nksharma0624
<[email protected]> wrote:


I am having the similar problem...

I have tried all and nothing works...

I have tried the code segment like below:

       Terser t = new Terser(theMessage);
       String str=
t.get("/PATIENT_RESULT/ORDER_OBSERVATION/OBSERVATION/OBX-3-1");

//      ORU_R01 ORU_R01Message = (ORU_R01)theMessage;
//      for(int i=0 ; i<=ORU_R01Message.getPATIENT_RESULTReps(); i++) {
//          for(int j=0 ;
j<=ORU_R01Message.getPATIENT_RESULT(i).getORDER_OBSERVATIONReps(); j++)
{
//              for(int k=0 ;
k<=ORU_R01Message.getPATIENT_RESULT(i).getORDER_OBSERVATION(j).getOBSERV
ATIONReps();
k++) {
//
//                  OBX o =
ORU_R01Message.getPATIENT_RESULT(i).getORDER_OBSERVATION(j).getOBSERVATI
ON(k).getOBX();
//                  logger.debug("k=" + k);
//              }
//          }
//      }


All failed to get me access to OBX segments.

Thanks.

Regards
-Niranjan.



Kumud Patel wrote:
>
> Hi ,
>
>
>
> I am new in HL7 and want to create ORU message,
>
> In that we need to create multiple OBX segment for pass text data in
> OBX-5.
>
>
>
>
>
> Ex. Like this...
>
>
>
>
MSH|^~\&|MTS001||DMCRES||19951013155723||ORU^R01|MTS0011995101315572338|
> P|2.2||||NE
>
> PID|||N98765 ||PYLE^KENNETH|5631||M
>
> OBR|||J3AOJ012NA^MTS001|OPR^Operative
> Report^L|||19951011000000||||||||||||||||||P|||||||277605&
>
> OBX||TX|REP^Report^L| 1| PYLE, KENNETH
>
> OBX||TX|REP^Report^L| 2| Duke University Medical Center
>
> OBX||TX|REP^Report^L| 3| MRN: N98765
>
> OBX||TX|REP^Report^L| 4| Operative Report
>
> OBX||TX|REP^Report^L| 5| ATT: STEVEN VASLEF, M.D.
>
> OBX||TX|REP^Report^L| 6|
>
> OBX||TX|REP^Report^L| 7|Procedure: 10/11/95 DICT: CHRISTINA A.
> HADJIKOUTI, M.D.
>
> OBX||TX|REP^Report^L| 8|
>
> OBX||TX|REP^Report^L| 9|
>
> OBX||TX|REP^Report^L| 10|INDICATION FOR PROCEDURE: This is a
71-year-old
> white male who was
>
> OBX||TX|REP^Report^L| 11|caught in a farming machine and ended up
having
> a traumatic left arm
>
> OBX||TX|REP^Report^L| 17|PREOPERATIVE DIAGNOSIS: Feeding access and
> airway access.
>
> OBX||TX|REP^Report^L| 18|
>
> OBX||TX|REP^Report^L| 19|POSTOPERATIVE DIAGNOSIS: Feeding access and
> airway access.
>
> OBX||TX|REP^Report^L| 20|
>
> OBX||TX|REP^Report^L| 21|OPERATION PERFORMED: Tracheotomy and PEG.
>
> OBX||TX|REP^Report^L| 22|
>
> OBX||TX|REP^Report^L| 31|DESCRIPTION OF PROCEDURE: The patient was
taken
> to the operating
>
> OBX||TX|REP^Report^L| 32|room and intubated. He was placed in the
supine
> position. His neck
>
> OBX||TX|REP^Report^L| 33|and abdomen were prepped and draped in the
> usual sterile way. The
>
> OBX||TX|REP^Report^L| 34|tracheotomy procedure was performed first. A
> transverse incision
>
> OBX||TX|REP^Report^L| 35|was made 2 cm above the sternal notch. An
> incision was through the Lines of text One line per OBX
>
>
>
>
>
> So please provide us  if you have any code to generate multiple OBX
> segment for the text data.
>
>
>
> Thanks,
>
>

>
------------------------------------------------------------------------
------
> Stay on top of everything new and different, both inside and
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> _______________________________________________
> Hl7api-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
>

--
View this message in context:
http://www.nabble.com/HELP-OBX-tp23198417p24793335.html
Sent from the hl7api-devel mailing list archive at Nabble.com.


------------------------------------------------------------------------
------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008
30-Day
trial. Simplify your report design, integration and deployment - and
focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

 

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to