我已经使用NHapi为hl7 2.5.1找出了大部分(我认为)PID和RAX的值。
我遇到的困难是那些(我假设)使用rxa.AdministeredCode.Components [5]等组件。
如何设置该值?
我对rxa.GetSubstanceManufacturerName(0).Components假设相同的事情?和 rxa.GetAdministrationNotes(0)。
吉娜
答案 0 :(得分:0)
试试这个
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
}
}
}