public void TestOBR5RepeatingValuesMessage_DataTypesAndRepetitions() { var parser = new PipeParser(); var oru = new ORU_R01(); oru = (ORU_R01)parser.Parse(GetMessage()); int expectedObservationCount = 3; int parsedObservations = oru.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).OBSERVATIONRepetitionsUsed; bool parsedCorrectNumberOfObservations = parsedObservations == expectedObservationCount; Assert.IsTrue(parsedCorrectNumberOfObservations, string.Format("Expected 3 OBX repetitions used for this segment, found {0}", parsedObservations)); foreach (var obs in oru.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).GetOBSERVATION().OBX.GetObservationValue()) { Assert.IsTrue(obs.Data is FT); } }
public void ParseKnownMessageTypeFromFile() { string filePath = @"C:\Users\Duane\Desktop\ParseErrors\20160628_142635469_b94dde77-857a-4881-8915-6814809c5442.HL7"; string fileContents = File.ReadAllText(filePath); PipeParser parser = new PipeParser(); IMessage msg = parser.Parse(fileContents); Assert.IsNotNull(msg, "Message should not be null"); ORU_R01 oruR01 = (ORU_R01)msg; Assert.AreEqual("R01", oruR01.MSH.MessageType.TriggerEvent.Value); Assert.AreEqual(null, oruR01.GetPATIENT_RESULT(0).PATIENT.PID.SetIDPID.Value); var knownDTM = oruR01.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).GetOBSERVATION(0).OBX.ValueType.Value; Assert.AreEqual("DTM", knownDTM); var knownDTMValue = oruR01.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).GetOBSERVATION(0).OBX.GetObservationValue(0).Data as DTM; Assert.AreEqual("20160627041809+0000", knownDTMValue.ToString()); }
public void TestSpecialCharacterEncoding() { PipeParser parser = new PipeParser(); ORU_R01 oru = new ORU_R01(); oru = (ORU_R01)parser.Parse(GetMessage()); FT data = (FT)oru.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).GetOBSERVATION(0).OBX.GetObservationValue(0).Data; Assert.AreEqual(@"This\.br\is\.br\A Test", data.Value); }
public void TestOBR5RepeatingValuesMessage() { var parser = new PipeParser(); var oru = new ORU_R01(); oru = (ORU_R01)parser.Parse(GetMessage()); foreach (var obs in oru.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).GetOBSERVATION().OBX.GetObservationValue()) { Assert.IsTrue(obs.Data is FT); } }
private ED ExtractEncapsulatedPdfDataInBase64Format(ORU_R01 oruMessage) { //start retrieving the OBX segment data to get at the PDF report content LogToDebugConsole("Extracting message data from parsed message.."); var orderObservation = oruMessage.GetPATIENT_RESULT().GetORDER_OBSERVATION(); var observation = orderObservation.GetOBSERVATION(0); var obxSegment = observation.OBX; var encapsulatedPdfDataInBase64Format = obxSegment.GetObservationValue(0).Data as ED; return(encapsulatedPdfDataInBase64Format); }
public void Test_271DataTypesParseCorrectly(string message) { var parser = new PipeParser(); var oru = new ORU_R01(); oru = (ORU_R01)parser.Parse(message); int expectedObservationCount = 3; int parsedObservations = oru.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).OBSERVATIONRepetitionsUsed; bool parsedCorrectNumberOfObservations = parsedObservations == expectedObservationCount; Assert.IsTrue(parsedCorrectNumberOfObservations, string.Format("Expected {1} OBX repetitions used for this segment, found {0}", parsedObservations, expectedObservationCount)); int index = 0; var obs = oru.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).GetOBSERVATION(index).OBX.GetObservationValue().FirstOrDefault(); Assert.IsTrue(obs.Data is DT); index++; obs = oru.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).GetOBSERVATION(index).OBX.GetObservationValue().FirstOrDefault(); Assert.IsTrue(obs.Data is ST); index++; obs = oru.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).GetOBSERVATION(index).OBX.GetObservationValue().FirstOrDefault(); Assert.IsTrue(obs.Data is TM); }
public void SetOrderNotes(ORU_R01 oru, Order order) { var i = 0; foreach (var orderNote in OrderNote.GetNotesForOrder(order, "General", false)) { var nte = oru.GetPATIENT_RESULT().GetORDER_OBSERVATION().GetNTE(i); nte.SetIDNTE.Value = (i + 1).ToString(CultureInfo.InvariantCulture); nte.SourceOfComment.Value = "????"; nte.GetComment(0).Value = orderNote.Body; i++; } }
public void TestORUR01_HasDTMFieldParsed() { string hl7Data = @"MSH|^~\&|Paceart|Medtronic|||20160628142621||ORU^R01^ORU_R01|20160628142621000001|P|2.6|||AL|NE|||||IHE_PCD_ORU_R01^IHE PCD^1.3.6.1.4.1.19376.1.6.1.9.1^ISO PID|||MODEL:A3DR01 Advisa DR MRI/SERIAL:PZK600806S^^^MDT^U~^^^^Patient ID~A10000641^^^^Paceart||Patient^Test||19100000000000+0000 PV1|1|A OBR|1||dfac748c-213c-e611-80c5-000c2996266c|754050^MDC_IDC_ENUM_SESS_TYPE_InClinic^MDC^INCLINIC^INCLINIC^MDT|||20160627041809+0000||||||||||||||||||P OBX|1|DTM|721025^MDC_IDC_SESS_DTM^MDC||20160627041809+0000||||||P"; PipeParser parser = new PipeParser(); IMessage msg = parser.Parse(hl7Data); Assert.IsNotNull(msg, "Message should not be null"); ORU_R01 oruR01 = (ORU_R01)msg; Assert.AreEqual("R01", oruR01.MSH.MessageType.TriggerEvent.Value); Assert.AreEqual(null, oruR01.GetPATIENT_RESULT(0).PATIENT.PID.SetIDPID.Value); var knownDTM = oruR01.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).GetOBSERVATION(0).OBX.ValueType.Value; Assert.AreEqual("DTM", knownDTM); var knownDTMValue = oruR01.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).GetOBSERVATION(0).OBX.GetObservationValue(0).Data as DTM; Assert.AreEqual("20160627041809+0000", knownDTMValue.ToString()); }
public void Test_26DataTypesParseCorrectly() { // OBX|4|ID|||IDValue||||||F //Doesn't work // OBX|5|IS|||ISValue||||||F //Doesn't work var message = @"MSH|^~\&|XPress Arrival||||200610120839||ORU^R01|EBzH1711114101206|P|2.6|||AL|||ASCII PID|1||1711114||Appt^Test||19720501||||||||||||001020006 ORC|||||F OBR|1|||ehipack^eHippa Acknowlegment|||200610120839|||||||||00002^eProvider^Electronic|||||||||F OBX|1|DT|||DTValue||||||F OBX|2|ST|||STValue||||||F OBX|3|TM|||TMValue||||||F".Replace(Environment.NewLine, "\r"); var parser = new PipeParser(); var oru = new ORU_R01(); oru = (ORU_R01)parser.Parse(message); var expectedObservationCount = 3; var parsedObservations = oru.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).OBSERVATIONRepetitionsUsed; var parsedCorrectNumberOfObservations = parsedObservations == expectedObservationCount; Assert.IsTrue( parsedCorrectNumberOfObservations, string.Format("Expected {1} OBX repetitions used for this segment, found {0}", parsedObservations, expectedObservationCount)); var index = 0; var obs = oru.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).GetOBSERVATION(index).OBX.GetObservationValue().FirstOrDefault(); Assert.IsTrue(obs.Data is DT); index++; obs = oru.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).GetOBSERVATION(index).OBX.GetObservationValue().FirstOrDefault(); Assert.IsTrue(obs.Data is ST); index++; obs = oru.GetPATIENT_RESULT(0).GetORDER_OBSERVATION(0).GetOBSERVATION(index).OBX.GetObservationValue().FirstOrDefault(); Assert.IsTrue(obs.Data is TM); }
public void TestRemoveRepetition() { // Arrange var input = "MSH|^~\\&|ULTRA|TML|OLIS|OLIS|200905011130||ORU^R01|20169838|T|2.5\r" + "PID|||7005728^^^TML^MR||TEST^RACHEL^DIAMOND||19310313|F|||200 ANYWHERE ST^^TORONTO^ON^M6G 2T9||(416)888-8888||||||1014071185^KR\r" + "PV1|1||OLIS||||OLIST^BLAKE^DONALD^THOR^^^^^921379^^^^OLIST\r" + "ORC|RE||T09-100442-RET-0^^OLIS_Site_ID^ISO|||||||||OLIST^BLAKE^DONALD^THOR^^^^L^921379\r" + "OBR|0||T09-100442-RET-0^^OLIS_Site_ID^ISO|RET^RETICULOCYTE COUNT^HL79901 literal|||200905011106|||||||200905011106||OLIST^BLAKE^DONALD^THOR^^^^L^921379||7870279|7870279|T09-100442|MOHLTC|200905011130||B7|F||1^^^200905011106^^R\r" + "OBX|1\r" + "OBX|2\r" + "OBX|3\r"; var expected = "MSH|^~\\&|ULTRA|TML|OLIS|OLIS|200905011130||ORU^R01|20169838|T|2.5\r" + "PID|||7005728^^^TML^MR||TEST^RACHEL^DIAMOND||19310313|F|||200 ANYWHERE ST^^TORONTO^ON^M6G 2T9||(416)888-8888||||||1014071185^KR\r" + "PV1|1||OLIS||||OLIST^BLAKE^DONALD^THOR^^^^^921379^^^^OLIST\r" + "ORC|RE||T09-100442-RET-0^^OLIS_Site_ID^ISO|||||||||OLIST^BLAKE^DONALD^THOR^^^^L^921379\r" + "OBR|0||T09-100442-RET-0^^OLIS_Site_ID^ISO|RET^RETICULOCYTE COUNT^HL79901 literal|||200905011106|||||||200905011106||OLIST^BLAKE^DONALD^THOR^^^^L^921379||7870279|7870279|T09-100442|MOHLTC|200905011130||B7|F||1^^^200905011106^^R\r" + "OBX|1\r" + "OBX|3\r"; var oruR01 = new ORU_R01(); var parser = new PipeParser(); parser.Parse(oruR01, input); // Action var obx = oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().GetOBSERVATION(1); oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().RemoveOBSERVATIONAt(1); var result = parser.Encode(oruR01); // Assert Assert.AreEqual("OBX|2", PipeParser.Encode(obx.OBX, EncodingCharacters.FromMessage(oruR01))); Assert.AreEqual(expected, result); }
public void TestORUR01_Enumerators() { string hl7Data = @"MSH|^~\&|Paceart|Medtronic|||20160628142621||ORU^R01^ORU_R01|20160628142621000001|P|2.6|||AL|NE|||||IHE_PCD_ORU_R01^IHE PCD^1.3.6.1.4.1.19376.1.6.1.9.1^ISO PID|||MODEL:A3DR01 Advisa DR MRI/SERIAL:PZK600806S^^^MDT^U~^^^^Patient ID~A10000641^^^^Paceart||Patient^Test||19100000000000+0000 PV1|1|A OBR|1||dfac748c-213c-e611-80c5-000c2996266c|754050^MDC_IDC_ENUM_SESS_TYPE_InClinic^MDC^INCLINIC^INCLINIC^MDT|||20160627041809+0000||||||||||||||||||P OBX|1|ST|||TestString||||||P OBX|2|NM|||9001||||||P OBX|3|DTM|||20160627041809+0000||||||P"; PipeParser parser = new PipeParser(); IMessage msg = parser.Parse(hl7Data); Assert.IsNotNull(msg, "Message should not be null"); ORU_R01 oruR01 = (ORU_R01)msg; Assert.AreEqual("R01", oruR01.MSH.MessageType.TriggerEvent.Value); Assert.AreEqual(null, oruR01.GetPATIENT_RESULT(0).PATIENT.PID.SetIDPID.Value); foreach (var result in oruR01.PATIENT_RESULTs) { foreach (var orderObservation in result.ORDER_OBSERVATIONs) { int index = 1; foreach (var observation in orderObservation.OBSERVATIONs) { if (index == 1) { Assert.IsTrue("ST" == observation.OBX.ValueType.Value); } else if (index == 2) { Assert.IsTrue("NM" == observation.OBX.ValueType.Value); } else if (index == 3) { Assert.IsTrue("DTM" == observation.OBX.ValueType.Value); } index++; } Assert.IsTrue(index == 4); } } }
public void TestORUR01_AddAndRemoveMethods() { string hl7Data = @"MSH|^~\&|Paceart|Medtronic|||20160628142621||ORU^R01^ORU_R01|20160628142621000001|P|2.6|||AL|NE|||||IHE_PCD_ORU_R01^IHE PCD^1.3.6.1.4.1.19376.1.6.1.9.1^ISO PID|||MODEL:A3DR01 Advisa DR MRI/SERIAL:PZK600806S^^^MDT^U~^^^^Patient ID~A10000641^^^^Paceart||Patient^Test||19100000000000+0000 PV1|1|A OBR|1||dfac748c-213c-e611-80c5-000c2996266c|754050^MDC_IDC_ENUM_SESS_TYPE_InClinic^MDC^INCLINIC^INCLINIC^MDT|||20160627041809+0000||||||||||||||||||P OBX|1|ST|||TestString||||||P OBX|2|NM|||9001||||||P OBX|3|DTM|||20160627041809+0000||||||P"; PipeParser parser = new PipeParser(); IMessage msg = parser.Parse(hl7Data); Assert.IsNotNull(msg, "Message should not be null"); ORU_R01 oruR01 = (ORU_R01)msg; Assert.AreEqual("R01", oruR01.MSH.MessageType.TriggerEvent.Value); Assert.AreEqual(null, oruR01.GetPATIENT_RESULT(0).PATIENT.PID.SetIDPID.Value); foreach (var result in oruR01.PATIENT_RESULTs) { foreach (var orderObservation in result.ORDER_OBSERVATIONs) { // Add observation of value type 'NO' and assert that the array reflects the expected state int beforeCount = orderObservation.OBSERVATIONs.Count(); var newObservation = orderObservation.AddOBSERVATION(); newObservation.OBX.ValueType.Value = "NO"; int afterAddCount = orderObservation.OBSERVATIONs.Count(); Assert.IsTrue(afterAddCount > beforeCount); var last = orderObservation.OBSERVATIONs.Last().OBX.ValueType.Value; Assert.IsTrue("NO" == last); // Remove added observation of value type 'NO' using object reference and assert that the array reflects the expected state orderObservation.RemoveOBSERVATION(newObservation); int afterRemoveCount = orderObservation.OBSERVATIONs.Count(); Assert.IsTrue(afterRemoveCount == beforeCount); last = orderObservation.OBSERVATIONs.Last().OBX.ValueType.Value; Assert.IsTrue("DTM" == last); // Added observation of value type 'NO' using object reference and assert that the array reflects the expected state newObservation = orderObservation.AddOBSERVATION(); newObservation.OBX.ValueType.Value = "NO"; afterAddCount = orderObservation.OBSERVATIONs.Count(); Assert.IsTrue(afterAddCount > beforeCount); // Remove added observation of value type 'NO' using index and assert that the array reflects the expected state orderObservation.RemoveOBSERVATIONAt(orderObservation.OBSERVATIONRepetitionsUsed - 1); afterRemoveCount = orderObservation.OBSERVATIONs.Count(); Assert.IsTrue(afterRemoveCount == beforeCount); last = orderObservation.OBSERVATIONs.Last().OBX.ValueType.Value; Assert.IsTrue("DTM" == last); // Assert that the array reflects the expected initial state int index = 1; foreach (var observation in orderObservation.OBSERVATIONs) { if (index == 1) { Assert.IsTrue("ST" == observation.OBX.ValueType.Value); } else if (index == 2) { Assert.IsTrue("NM" == observation.OBX.ValueType.Value); } else if (index == 3) { Assert.IsTrue("DTM" == observation.OBX.ValueType.Value); } index++; } Assert.IsTrue(index == 4); // Remove the middle 'NM' Field and assert that the array reflects the expected state orderObservation.RemoveOBSERVATIONAt(1); index = 1; foreach (var observation in orderObservation.OBSERVATIONs) { if (index == 1) { Assert.IsTrue("ST" == observation.OBX.ValueType.Value); } else if (index == 2) { Assert.IsTrue("DTM" == observation.OBX.ValueType.Value); } index++; } Assert.IsTrue(index == 3); // Remove the first Item by object reference and assert that the remaining item is the 'DTM' field orderObservation.RemoveOBSERVATION(orderObservation.OBSERVATIONs.First()); var lastRemaining = orderObservation.OBSERVATIONs.First(); Assert.IsTrue("DTM" == lastRemaining.OBX.ValueType.Value); Assert.IsTrue(orderObservation.OBSERVATIONRepetitionsUsed == 1); } } }
public static void PLdataReceived(object receivedata, string name)//处理血小板样本测试结果 ORU_RO1 { PLManager.PL12 data = (PLManager.PL12)receivedata; HL7Manager.HL7Struct hl7 = new HL7Manager.HL7Struct(); hl7.Item = new List <string>(); PipeParser Parser = new PipeParser(); ORU_R01 oruR01 = new ORU_R01(); #region 消息段封装 //MSH段,位于消息最前面 oruR01.MSH.FieldSeparator.Value = "|"; oruR01.MSH.EncodingCharacters.Value = @"^~\&"; oruR01.MSH.SendingApplication.NamespaceID.Value = GlobalVariable.Manufacturer; //仪器供应商 oruR01.MSH.SendingFacility.NamespaceID.Value = data.DEVEICE; oruR01.MSH.DateTimeOfMessage.TimeOfAnEvent.SetLongDate(DateTime.Now); //当前时间 oruR01.MSH.MessageType.MessageType.Value = "ORU"; oruR01.MSH.MessageType.TriggerEvent.Value = "R01"; oruR01.MSH.MessageControlID.Value = "1"; oruR01.MSH.ProcessingID.ProcessingID.Value = "P"; oruR01.MSH.VersionID.VersionID.Value = "2.3.1"; oruR01.MSH.ApplicationAcknowledgmentType.Value = "0";//样本测试结果 oruR01.MSH.GetCharacterSet(0).Value = GlobalVariable.SocketCode ? "ASCII" : "UTF8"; //没有病人信息,PID段直接省略 //OBR段,用于传输关于检验报告相关的医嘱信息 oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.SetIDOBR.Value = "1"; oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.PlacerOrderNumber.EntityIdentifier.Value = data.SAMPLE_ID; oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.ObservationDateTime.TimeOfAnEvent.SetLongDate(data.TEST_TIME); //0BX段,用于在报告消息中传递观察的信息 ORU_R01_ORDER_OBSERVATION orderObservation = oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION(); int num = data.Result.Count(); if (num != 0) { OBX[] obx = new OBX[num + 1]; CE[] ce = new CE[num + 1]; Varies value; obx[0] = orderObservation.GetOBSERVATION(0).OBX; obx[0].SetIDOBX.Value = "1"; obx[0].ValueType.Value = "NM"; obx[0].ObservationSubID.Value = "AAP"; obx[0].ObservationIdentifier.Identifier.Value = "诱聚剂项目"; ce[0] = new CE(oruR01); value = obx[0].GetObservationValue(0); value.Data = ce[0]; ce[0].Identifier.Value = data.AAP; for (int i = 1; i <= num; i++) { obx[i] = orderObservation.GetOBSERVATION(i).OBX; obx[i].SetIDOBX.Value = (i + 1).ToString(); obx[i].ValueType.Value = "NM"; obx[i].ObservationSubID.Value = data.Result[i - 1].ITEM; obx[i].ObservationIdentifier.Identifier.Value = data.Result[i - 1].FULL_NAME; ce[i] = new CE(oruR01); value = obx[i].GetObservationValue(0); value.Data = ce[i]; ce[i].Identifier.Value = data.Result[i - 1].RESULT.ToString(); if (data.Result[i - 1].UNIT != string.Empty) { obx[i].Units.Identifier.Value = data.Result[i - 1].UNIT; } if (data.Result[i - 1].NORMAL_HIGH != 0) { obx[i].ReferencesRange.Value = data.Result[i - 1].NORMAL_LOW.ToString() + "---" + data.Result[i - 1].NORMAL_HIGH.ToString(); obx[i].GetAbnormalFlags(0).Value = data.Result[i - 1].INDICATE; } hl7.Item.Add(data.Result[i - 1].ITEM); } } #endregion hl7.HL7Message = Parser.Encode(oruR01); hl7.Sample_ID = data.SAMPLE_ID; hl7.Device = data.DEVEICE; hl7Manager.AddHL7(hl7); }
public static void DSdataReceived(object receivedata, string name)//处理生化仪样本测试结果 ORU_R01 { DI800Manager.DI800 data = (DI800Manager.DI800)receivedata; HL7Manager.HL7Struct hl7 = new HL7Manager.HL7Struct(); hl7.Item = new List <string>(); PipeParser Parser = new PipeParser(); ORU_R01 oruR01 = new ORU_R01(); #region 消息段封装 //MSH段,位于消息最前面 oruR01.MSH.FieldSeparator.Value = "|"; oruR01.MSH.EncodingCharacters.Value = @"^~\&"; oruR01.MSH.SendingApplication.NamespaceID.Value = GlobalVariable.Manufacturer; //仪器供应商 oruR01.MSH.SendingFacility.NamespaceID.Value = data.Device; oruR01.MSH.DateTimeOfMessage.TimeOfAnEvent.SetLongDate(DateTime.Now); //当前时间 oruR01.MSH.MessageType.MessageType.Value = "ORU"; oruR01.MSH.MessageType.TriggerEvent.Value = "R01"; oruR01.MSH.MessageControlID.Value = "1"; oruR01.MSH.ProcessingID.ProcessingID.Value = "P"; oruR01.MSH.VersionID.VersionID.Value = "2.3.1"; oruR01.MSH.ApplicationAcknowledgmentType.Value = "0";//样本测试结果 oruR01.MSH.GetCharacterSet(0).Value = GlobalVariable.SocketCode ? "ASCII" : "UTF8"; //PID段,主要用来构建病人的个人信息 oruR01.GetPATIENT_RESULT().PATIENT.PID.SetIDPID.Value = "1";//这个值还要商榷 oruR01.GetPATIENT_RESULT().PATIENT.PID.GetPatientIdentifierList(0).ID.Value = data.PATIENT_ID; oruR01.GetPATIENT_RESULT().PATIENT.PID.GetAlternatePatientIDPID(0).ID.Value = data.BED; oruR01.GetPATIENT_RESULT().PATIENT.PID.GetPatientName(0).FamilyLastName.FamilyName.Value = data.FIRST_NAME; oruR01.GetPATIENT_RESULT().PATIENT.PID.GetMotherSMaidenName(0).FamilyLastName.FamilyName.Value = data.AREA; oruR01.GetPATIENT_RESULT().PATIENT.PID.Sex.Value = data.SEX; //OBR段,用于传输关于检验报告相关的医嘱信息 oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.SetIDOBR.Value = "1"; oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.PlacerOrderNumber.EntityIdentifier.Value = data.SAMPLE_ID; oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.ObservationDateTime.TimeOfAnEvent.SetLongDate(data.TIME); oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.SpecimenReceivedDateTime.TimeOfAnEvent.SetLongDate(data.SEND_TIME); oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.FillerField1.Value = data.DOCTOR; oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.FillerField2.Value = data.DEPARTMENT; //oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION().OBR.SpecimenReceivedDateTime.TimeOfAnEvent.Value = data.TIME; //0BX段,用于在报告消息中传递观察的信息 ORU_R01_ORDER_OBSERVATION orderObservation = oruR01.GetPATIENT_RESULT().GetORDER_OBSERVATION(); int num = data.Result.Count(); if (num != 0) { OBX[] obx = new OBX[num]; CE[] ce = new CE[num]; Varies value; for (int i = 0; i < num; i++) { obx[i] = orderObservation.GetOBSERVATION(i).OBX; obx[i].SetIDOBX.Value = (i + 1).ToString(); obx[i].ValueType.Value = "NM"; obx[i].ObservationSubID.Value = data.Result[i].ITEM; obx[i].ObservationIdentifier.Identifier.Value = data.Result[i].FULL_NAME; ce[i] = new CE(oruR01); value = obx[i].GetObservationValue(0); value.Data = ce[i]; ce[i].Identifier.Value = data.Result[i].RESULT.ToString(); obx[i].Units.Identifier.Value = data.Result[i].UNIT; obx[i].ReferencesRange.Value = data.Result[i].NORMAL_LOW.ToString() + "---" + data.Result[i].NORMAL_HIGH.ToString(); obx[i].GetAbnormalFlags(0).Value = data.Result[i].RESULT > data.Result[i].NORMAL_HIGH ? "H" : (data.Result[i].RESULT < data.Result[i].NORMAL_LOW ? "L" : "N"); obx[i].NatureOfAbnormalTest.Value = data.Result[i].INDICATE; hl7.Item.Add(data.Result[i].ITEM); } } #endregion hl7.HL7Message = Parser.Encode(oruR01); hl7.Sample_ID = data.SAMPLE_ID; hl7.Device = data.Device; hl7.SendTime = data.SEND_TIME.ToString(); hl7Manager.AddHL7(hl7); log.Info("HL7 DS package " + hl7.Sample_ID); }
/// <summary> /// Add a new ORU_R01 to PATIENT_RESULT /// </summary> public static ORU_R01_PATIENT_RESULT AddPATIENT_RESULT(this ORU_R01 message) { return(message.GetPATIENT_RESULT(message.PATIENT_RESULTRepetitionsUsed)); }