/// <summary> /// Creates and hydrates the 'Examination Details' section. /// </summary> /// <param name="mandatorySectionsOnly">Includes on the mandatory sections</param> /// <returns>A hydrated 'CreateExaminationDetails' object.</returns> public static ExaminationDetails CreateExaminationDetails(Boolean mandatorySectionsOnly) { var examinationDetails = DiagnosticImagingReport.CreateExaminationDetails(); // Image DateTime examinationDetails.ImageDateTime = new ISO8601DateTime(DateTime.Now); return(examinationDetails); }
/// <summary> /// Create the diagnostic imaging examination test results from information in the HL7 V2 message. /// </summary> /// <param name="genericMessage">The HL7 V2 message.</param> /// <returns>List of DiagnosticImagingExaminationResult</returns> internal IList <IDiagnosticImagingExaminationResult> CreateImagingExaminationResults(HL7GenericMessage hl7GenericMessage) { IList <IDiagnosticImagingExaminationResult> imagingTestResults = new List <IDiagnosticImagingExaminationResult>(); foreach (var order in hl7GenericMessage.Order) { foreach (var observation in order.Observation) { OBR obrSegment = observation.ObservationsReportID; if (obrSegment.UniversalServiceID.identifier != TransformerConstants.ReportText) { IDiagnosticImagingExaminationResult testResult = DiagnosticImagingReport.CreateDiagnosticImagingExaminationResult(); // ReportingRadiologistForImagingExaminationResult var principalResultInterpreter = hl7GenericMessage.Order.First().Observation.First().ObservationsReportID.PrincipalResultInterpreter.name; testResult.ReportingRadiologistForImagingExaminationResult = GetNameStringFromCN(principalResultInterpreter); // ExaminationResultName testResult.ExaminationResultName = GetTestResultName(obrSegment.UniversalServiceID); // Modality DiagnosticService diagnosticService; if (EnumHelper.TryGetEnumValue <DiagnosticService, NameAttribute>( attribute => attribute.Code == obrSegment.DiagnosticServSectID, out diagnosticService)) { testResult.Modality = BaseCDAModel.CreateCodableText(obrSegment.DiagnosticServSectID, CodingSystem.HL7DiagnosticServiceSectionID, diagnosticService.GetAttributeValue <NameAttribute, string>(a => a.Name)); } else { testResult.Modality = BaseCDAModel.CreateCodableText(obrSegment.DiagnosticServSectID); } // Examination Procedure (Validate this, must be present) if (obrSegment.UniversalServiceID != null && !string.IsNullOrEmpty(obrSegment.UniversalServiceID.text)) { testResult.ExaminationProcedure = obrSegment.UniversalServiceID.text; } // Examination Details (Validate this, must be present) testResult.ExaminationDetails = DiagnosticImagingReport.CreateExaminationDetails(); testResult.ExaminationDetails.ImageDateTime = new ISO8601DateTime(obrSegment.ObservationDateTime.TimestampValue.GetValueOrDefault()); // Observation Date Time testResult.ObservationDateTime = new ISO8601DateTime(obrSegment.ObservationDateTime.TimestampValue.GetValueOrDefault()); // Overall Result Status Hl7V3ResultStatus resultStatus; if (EnumHelper.TryGetEnumValue <Hl7V3ResultStatus, NameAttribute>( attribute => attribute.Code == obrSegment.ResultStatus, out resultStatus)) { testResult.OverallResultStatus = BaseCDAModel.CreateResultStatus(resultStatus); } else { testResult.OverallResultStatus = BaseCDAModel.CreateCodableText(NullFlavour.NoInformation); } imagingTestResults.Add(testResult); } } } return(imagingTestResults); }