/// <summary> /// Create the pathology test result from information in the HL7 V2 message. /// </summary> /// <param name="obrSegment">OBR segment.</param> /// <returns>PathologyTestResult</returns> internal static PathologyTestResult CreatePathologyTestResult(OBR obrSegment) { PathologyTestResult testResult = PathologyResultReport.CreatePathologyTestResult(); // Test Result Name testResult.TestResultName = GetTestResultName(obrSegment.UniversalServiceID); // Pathology Discipline DiagnosticService diagnosticService; if (!EnumHelper.TryGetEnumValue <DiagnosticService, NameAttribute>(attribute => attribute.Code == obrSegment.DiagnosticServSectID, out diagnosticService)) { diagnosticService = DiagnosticService.Laboratory; } testResult.PathologyDiscipline = diagnosticService; // Report Status Hl7V3ResultStatus hl7V3ResultStatus; if (!EnumHelper.TryGetEnumValue <Hl7V3ResultStatus, NameAttribute>(attribute => attribute.Code == obrSegment.ResultStatus, out hl7V3ResultStatus)) { throw new ArgumentException("No matching Hl7V3ResultStatus value found"); } testResult.OverallTestResultStatus = BaseCDAModel.CreateResultStatus(hl7V3ResultStatus); // Test Specimen Detail testResult.TestSpecimenDetail = PathologyResultReport.CreateTestSpecimenDetail(); testResult.TestSpecimenDetail.CollectionDateTime = new ISO8601DateTime(obrSegment.ObservationDateTime.TimestampValue.Value); // Pathology Test Result Date Time testResult.ObservationDateTime = new ISO8601DateTime(obrSegment.ObservationDateTime.TimestampValue.Value); return(testResult); }
/// <summary> /// Create the pathology test results from information in the HL7 V2 message. /// </summary> /// <param name="genericMessage">The HL7 V2 message.</param> /// <returns>List of PathologyTestResult</returns> internal static IList <PathologyTestResult> CreatePathologyTestResults(HL7GenericMessage genericMessage) { IList <PathologyTestResult> pathologyTestResults = new List <PathologyTestResult>(); foreach (var orderGroup in genericMessage.Order) { foreach (var observationGroup in orderGroup.Observation) { OBR obrSegment = observationGroup.ObservationsReportID; if (obrSegment.UniversalServiceID.identifier != TransformerConstants.ReportText) { PathologyTestResult testResult = CreatePathologyTestResult(obrSegment); pathologyTestResults.Add(testResult); } } } return(pathologyTestResults); }