string input =
@"MSH|^~\&|||||20171218104936.3464||ADT^A01^ADT_A01|56ca00f2-a99a-4593-b6cb-1c141c0ae0cb||2.3.1
EVN||20171218104936.3464
PID|||15197||Test^Dummy^HK||19770628000000.0000|O
PV1||0";
In the string above, the name field (Test^Dummy^HK
) is a repeating field. How can I get that in C# using the nHapi DLL?
It is quite simple, but before any attempt to retrieve a field, the message needs to be parsed:
next, the field you are looking for is an XPN datatype, namely an Extended Patient Name. The following table lists the first 3 components of the Patient Name.
These components can be accessed through thier properties so:
Since there is no tilde character, the parser assumes that the value provided in the PID-5 corresponds to the first repetition, this is why I have GetPatientName(0) to specify the first repetition. Any attempt to retrieve other repetitions will fail, or yield to null value.
Notice that the Family Name is a composite datatype of type FN, here is the FN's component table:
An alternative is:
I have found this useful documentation check it out. hope that it could help you.