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:

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.