简体   繁体   English

NHAPI 2.5.1 xx。(0)。组件值,如何使用

[英]NHAPI 2.5.1 xx.(0).Components values, how to use

I have figured out most (I think) of the values for PID and RAX using NHapi for hl7 2.5.1. 我已经为hl7 2.5.1使用NHapi找出了大部分(我认为)PID和RAX的值。

What I am having difficulties on are the ones that (I am assuming) use components such as rxa.AdministeredCode.Components[5]. 我遇到的困难是(假设)使用rxa.AdministeredCode.Components [5]之类的组件。

How do I set that value? 如何设置该值?

I assume same thing for rxa.GetSubstanceManufacturerName(0).Components? 我为rxa.GetSubstanceManufacturerName(0).Components假定相同的东西吗? and rxa.GetAdministrationNotes(0). 和rxa.GetAdministrationNotes(0)。

Gina 吉娜

Try this 尝试这个

class Program
{
    static void Main(string[] args)
    {
        EncodingCharacters enchars = new EncodingCharacters('|', "^~\\&");
        IModelClassFactory theFactory = new DefaultModelClassFactory();

        NHapi.Model.V251.Segment.RXA rxa = new NHapi.Model.V251.Segment.RXA(new VXU_V04(theFactory), theFactory);
        IType[] t = rxa.GetSubstanceManufacturerName(0).Components;
        SetRXA(t);
        Debug.Print(PipeParser.Encode(rxa, enchars));
        Console.Read();
    }


    public static void SetRXA(IType[] components)
    {
        for (int i = 0; i < components.Length; i++)
        {
            if (components[i] is IPrimitive)
            {
                IPrimitive prim = (IPrimitive)components[i];
                prim.Value = "Component"+i;
            }
            else if (components[i] is IComposite)
                SetRXA(((IComposite)components[i]).Components);
            //if Varies do something else
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM