1

I'm using nHapi to create & read HL7 REF_I12 messages in HL7 V2.3 and V2.4.

The standard nHapi REF_I12 Message is missing several segments I need - PRD, OBR, PV1, PV2, ORC and OBX.

How do I add these segments to the standard nHapi REF_I12 Message ?

Should I try and add them as custom Z segments ?

Chris C.
  • 908
  • 1
  • 10
  • 19

1 Answers1

2

How do I add these segments to the standard nHapi REF_I12 Message ?

You do not need to add those; those are there. You need to load them.

Just populating the message does not load the segment like PID in case of REF^I12. Please refer to the hierarchy here:

Hierarchy

You need to load Provider_Contact before loading PRD segment.

You can do it something like below:

msgREF_I12.GetPROVIDER_CONTACT(0).PRD......

You need to repeat the same for all the segments those are not loading. I think ORC is not the part of message; so this will not work with it.

Please refer to the source code on GitHub:

///<summary>
/// Returns  first repetition of REF_I12_PROVIDER_CONTACT (a Group object) - creates it if necessary
///</summary>
public REF_I12_PROVIDER_CONTACT GetPROVIDER_CONTACT()
{
    REF_I12_PROVIDER_CONTACT ret = null;
    try
    {
        ret = (REF_I12_PROVIDER_CONTACT)this.GetStructure("PROVIDER_CONTACT");
    }
    catch(HL7Exception e)
    {
        HapiLogFactory.GetHapiLog(GetType()).Error("Unexpected error accessing data - this is probably a bug in the source code generator.", e);
        throw new System.Exception("An unexpected error ocurred", e);
    }
    return ret;
}

Should I try and add them as custom Z segments ?

If you add Z segment, it will be a Z segment. It will not be the segment you are expecting.

Amit Joshi
  • 15,448
  • 21
  • 77
  • 141