Hi Chris,

In AbstractSegment class

/**
     * Returns a specific repetition of field at the specified index.  If there 
exist 
     * fewer repetitions than are required, the number of repetitions can be 
increased 
     * by specifying the lowest repetition that does not yet exist.  For 
example 
     * if there are two repetitions but three are needed, the third can be 
created
     * and accessed using the following code: <br>
     * <code>Type t = getField(x, 3);</code>
     * @param number the field number 
     * @param rep the repetition number (starting at 0)
     * @throws HL7Exception if field index is out of range, if the specified 
     *    repetition is greater than the maximum allowed, or if the specified 
     *    repetition is more than 1 greater than the existing # of repetitions. 
 
     */
    public Type getField(int number, int rep) throws HL7Exception {

Note: @param rep the repetition number (starting at 0) ... It is starting from 
0 and we were sending 1, hence it was throwing an Exception. 

I figured out that 

XCN pathologist = obr.getOrderingProvider(obr.getOrderingProvider().length + 1);

should be changed to

XCN pathologist = obr.getOrderingProvider(obr.getOrderingProvider().length);

I also added another pathologist and it seems to work great.

Thanks and Regards,
Sai Kumar Munikuntla.


----- Original Message ----
From: Sai Kumar Munikuntla <[email protected]>
To: Chris Selwyn <[email protected]>
Cc: [email protected]
Sent: Tue, December 8, 2009 10:24:32 AM
Subject: Re: [HAPI-devel] How can I add a XCN (Pathologist) data to OBR in 
OML_O21?

Hi Chris,

That doesn't seem to work. I got an exception. As I said earlier, it has an 
empty array XCN[].

ca.uhn.hl7v2.HL7Exception: Can't get repetition 1 from field 16 - there are 
currently only 0 reps.
at ca.uhn.hl7v2.model.AbstractSegment.getField(AbstractSegment.java:122)
at ca.uhn.hl7v2.model.v24.segment.OBR.getOrderingProvider(OBR.java:426)
at 
com.biogen.coreinformatics.lims.ventana.MessageBuilder.buildOBR(MessageBuilder.java:142)
at 
com.biogen.coreinformatics.lims.ventana.MessageBuilder.createOML_O21Message(MessageBuilder.java:34)
at 
com.biogen.coreinformatics.lims.ventana.MessageSender.sendAndReceive(MessageSender.java:28)
at 
com.biogen.coreinformatics.lims.ventana.MessageSender.main(MessageSender.java:63)

In AbstractSegment it is checking for Out of Range

//check if out of range ... 
        if (rep > arr.length)
            throw new HL7Exception(
                "Can't get repetition "
                    + rep
                    + " from field "
                    + number
                    + " - there are currently only "
                    + arr.length
                    + " reps.",
                HL7Exception.APPLICATION_INTERNAL_ERROR);


Thanks & Regards,
Sai Kumar Munikuntla.



----- Original Message ----
From: Chris Selwyn <[email protected]>
To: Sai Kumar Munikuntla <[email protected]>
Cc: [email protected]
Sent: Mon, December 7, 2009 7:53:56 PM
Subject: Re: [HAPI-devel] How can I add a XCN (Pathologist) data to OBR in 
OML_O21?

Try this...

           OML_O21 oml = new OML_O21();
           OML_O21_ORDER order = oml.getORDER_GENERAL().getORDER();
           OML_O21_OBSERVATION_REQUEST obsreq = order.getOBSERVATION_REQUEST();
           OBR obr = obsreq.getOBR();
           XCN pathologist = 
obr.getOrderingProvider(obr.getOrderingProvider().length + 1);
           pathologist.getIDNumber().setValue("12345");
           pathologist.getFamilyName().getSurname().setValue("Munikuntla");
           pathologist.getGivenName().setValue("Sai Kumar");

Chris

Sai Kumar Munikuntla wrote:
> Hi All,
> 
> How can I add a XCN (Pathologist) data to OBR?
> 
> I tried the following.
> 
> OML_O21 oml = new OML_O21();
> OML_O21_ORDER order = oml.getORDER_GENERAL().getORDER();
> OML_O21_OBSERVATION_REQUEST obr = order.getOBSERVATION_REQUEST();
> 
> XCN[] pathologistArr = obrSegment.getOrderingProvider();
> 
> if (null == pathologistArr
> || (null != pathologistArr && pathologistArr.length == 0)) {
> pathologistArr = new XCN[1];
> // if I don't do this it is throwing a IndexOutOfBoundsException as the XCN 
> array returned earlier is a null or an empty array
> }
> XCN pathologist = new XCN(null);
> pathologist.getIDNumber().setValue("12345");
> pathologist.getFamilyName().getSurname().setValue("Munikuntla");
> pathologist.getGivenName().setValue("Sai Kumar");
> pathologistArr[0] = pathologist;
> // this doesn't add the pathologist data to the OBR
> 
> 
> Thanks & Regards,
> Sai Kumar Munikuntla.
> 
> 
>      
> ------------------------------------------------------------------------------
> Join us December 9, 2009 for the Red Hat Virtual Experience,
> a free event focused on virtualization and cloud computing. Attend in-depth 
> sessions from your desk. Your couch. Anywhere.
> http://p.sf.net/sfu/redhat-sfdev2dev
> _______________________________________________
> Hl7api-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>  


      

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel



      

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to