nHapi 向 REFI12 消息添加非标准段

nHapi Add Non-Standard Segments to REFI12 Message

我正在使用 nHapi 在 HL7 V2.3 和 V2.4 中创建和读取 HL7 REF_I12 消息。

标准 nHapi REF_I12 消息缺少我需要的几个片段 - PRD、OBR、PV1、PV2、ORC 和 OBX。

如何将这些段添加到标准 nHapi REF_I12 消息中?

我应该尝试将它们添加为自定义 Z 段吗?

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

你不需要添加那些;那些在那里。您需要加载它们。

REF^I12 的情况下,仅填充消息不会像 PID 那样加载段。请参考层级 here:

您需要在加载 PRD 段之前加载 Provider_Contact

你可以像下面那样做:

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

您需要对所有未加载的片段重复相同的操作。我认为 ORC 不是消息的一部分;所以这对它不起作用。

请参考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 ?

如果添加 Z 段,它 将是 Z 段。它不会是您期望的片段。