0

I have figured out most (I think) of the values for PID and RAX using NHapi for hl7 2.5.1.

What I am having difficulties on are the ones that (I am assuming) use components such as rxa.AdministeredCode.Components[5].

How do I set that value?

I assume same thing for rxa.GetSubstanceManufacturerName(0).Components? and rxa.GetAdministrationNotes(0).

Gina

Gina Marano
  • 1,773
  • 4
  • 22
  • 42

1 Answers1

0

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
        }
    }
}
Oliamster
  • 486
  • 5
  • 10