Daily using/supporting

Get Firefox browser!
Get Thunderbird!
Get Opera browser!
Get The Gimp!
Get Inkscape!
Get LibreOffice!
Get Videolan!
Get Linux!
Get Mandriva!
Get Joomla!
Hacker Emblem

Archives

Which topics would you like us to cover more?

Latest comments

Latest tweets

about 1 day ago Using REDIPS.drag to add drag and drop to your .Net webapplication #li #dib0 http://t.co/n8zY3s7d
about 7 days ago http://t.co/cknQcDbo #Kindle
about 15 days ago Freedom isn't the ability to choose what to do or say, but the ability to choose what not to do or say #freedom
about 29 days ago http://t.co/61KTQknI #Kindle
12 Apr 2012 Force the use of a networking adapter using C# #li #dib0 http://t.co/ZTJOPzOz
9 Apr 2012 Mandriva 2010.2 and USB devices in Virtualbox http://t.co/fwq9gbHB
9 Apr 2012 Execute a http request to you own site with PHP http://t.co/DIvWPrpd
Home Architecture, security and coding Read SIU messages using nHapi
Read SIU messages using nHapi
Written by Division by Zero   
Tuesday, 31 May 2011 08:45

A while ago I implemented SIU (planning) messages. As you might have experienced sometimes it is quite hard with nHapi to get to the data you want. Every HL7 message type has it's own structure. SIU is quite different than ADT. So I want to share a few code snippets with you for interpreting SIU messages.

Here's how to get to the right patient ID. In this example I use the ID of type "PI"

long result = 0;
// Select the right Identifier
CX identifier = null;
// Messsage is in this case an object of type SIU_S12
Listids = message.GetPATIENT().PID.GetPatientIdentifierList().Where(cx => string.Compare(cx.IdentifierTypeCode.Value, "PI") == 0).ToList();
if (ids.Count > 0)
identifier = ids[0];
else
{
foreach (CX pId in message.GetPATIENT().PID.GetPatientIdentifierList())
{
if (pId.IdentifierTypeCode.Value == "PI")
{
identifier = pId;
break;
}
}
 
if (identifier == null)
identifier = message.GetPATIENT().PID.GetPatientIdentifierList().First();
}
 
if (!long.TryParse(identifier.ID.Value, out result))
throw new Exception("Patient ID isn't a number."); return result;

SIU is used for planning appointments. One part of this is the target location of the appointment (where to be at what time). The location is stored in the resources section of the SIU message.

string result = string.Empty;
SIU_S12_RESOURCES resources = message.GetRESOURCES();
 
for (int i = 0; i < resources.LOCATION_RESOURCERepetitionsUsed; i++)
{
SIU_S12_LOCATION_RESOURCE location = resources.GetLOCATION_RESOURCE(i);
if (location.AIL.LocationTypeAIL.Identifier.Value == "D")
{
result = location.AIL.LocationResourceID.Building.Value + ", " + location.AIL.LocationResourceID.PointOfCare.Value; break;
}
}

Some HL7 event types allow you to add one or more comments to the message. This is done by adding a NTE segment. Here's how to read the comments from the NTE segment in a SIU message.

string result = string.Empty;
NTE nte = message.GetNTE();
 
// If the repetition is 0, there are no comments
if (nte.CommentRepetitionsUsed > 0)
{
FT comments = nte.GetComment().First();
result = comments.Value;
}

And of course the date and time of an appointment are really relevant. Here's how to get it as a DateTime.

TQ tq = message.SCH.GetAppointmentTimingQuantity().First();
TS startTime = tq.StartDateTime;
DateTime result = new DateTime(startTime.TimeOfAnEvent.Year, startTime.TimeOfAnEvent.Month, startTime.TimeOfAnEvent.Day, startTime.TimeOfAnEvent.Hour, startTime.TimeOfAnEvent.Minute, startTime.TimeOfAnEvent.Second);
 

Comments  

 
0 # Bhushan 2012-02-27 17:40
Hi,
I am not able to get the resource information in SIU_S12 object for Appointment message. Message contains AIL, AIP segments but still after parsing with nHapi values for location resource and personnel resource are not populated. Please help me out of this.
Reply | Reply with quote | Quote
 
 
0 # Bas 2012-02-27 20:57
Hi Bhushan,

This is not a problem I recognise. Can you post some examples? For example an example message that you use and some of the code where you try to get the values from the AIL and AIP segments?

Bas
Reply | Reply with quote | Quote
 

Add comment


Security code
Refresh

He's the only genius with an IQ of 80. - Unknown


© 2009 - 2012, Division by Zero

Template based on the empire template by joomlashack 

Valid XHTML 1.0 Strict  Valid CSS!  Creative Commons License
This work by Division by Zero is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Netherlands License.