Question:
I would like to book some of you and or your teams time to develop or enhance HL7spy custom codes or product for my team. We would like the custom code to do the following:
- Take HL7 transactions (loaded in the Query Results tab)
- Append “-” + OBR-2.1 … to OBR-3.1 + “-” + some variable, ‘date yyyymmdd’
- Append “-” + some variable like “TEST” to OBR-3.2
- Delete the contents of OBR-2
Answer:
No need to hire us. This is pretty easy to do. There are two ways of accomplishing this: using type safe classes, and using field position specifications. Type safe classes provide the benefit of automatically documenting the code.
public override void Run() { // Get an HL7 Message in parsed format HL7Message message = GetParsedMessage(); string today=DateTime.Today.ToString("yyyyMMdd"); // loop through all the OBR segments in the message foreach(OBR obr in message.GetSegments<OBR>()) { //(2) Append "-" + OBR-2.1 ... to OBR-3.1 + "-" + some variable, 'date yyyymmdd' obr.FillerOrderNumber_03.EntityIdentifier_01.Value = obr.PlacerOrderNumber_02.EntityIdentifier_01.Value + "-V" + today; //(3) Append "-" + some variable like "TEST" to OBR-3.2 obr.FillerOrderNumber_03.NamespaceID_02.Value = obr.FillerOrderNumber_03.NamespaceID_02.Value + "-TEST"; //(4) Delete the contents of OBR-2 obr.PlacerOrderNumber_02.Value = ""; // save the message out to a new tab SaveMessage(message, "Modified Messages"); } }
public override void Run() { // Get an HL7 Message in parsed format HL7Message message = GetParsedMessage(); string today=DateTime.Today.ToString("yyyyMMdd"); foreach(OBR obr in message.GetSegments<OBR>()) { //(2) Append "-" + OBR-2.1 ... to OBR-3.1 + "-" + some variable, 'date yyyymmdd' obr[3,1,1] = obr[2,1,1] + "-V" + today; //(3) Append "-" + some variable like "TEST" to OBR-3.2 obr[3,1,2] = obr[3,1,2] + "-TEST"; //(4) Delete the contents of OBR-2 obr[2] = ""; // save the message out to a new tab SaveMessage(message, "Modified Messages"); } }