/// <summary> /// Creates and Hydrates a IParticipationReceivingLaboratory /// /// Note: the data used within this method is intended as a guide and should be replaced. /// </summary> /// <returns>IParticipationReceivingLaboratory</returns> private static IParticipationReportingRadiologist CreateReportingRadiologist(Boolean mandatoryOnly) { // Receiving Laboratory var reportingPathologist = BaseCDAModel.CreateReportingRadiologist(); // Document reportingPathologist > Participant reportingPathologist.Participant = BaseCDAModel.CreateParticipantForReportingRadiologist(); var person = BaseCDAModel.CreatePersonWithOrganisation(); // Participation Period reportingPathologist.ParticipationEndTime = new ISO8601DateTime(DateTime.Now); // Document reportingPathologist > Role reportingPathologist.Role = DiagnosticImagingReport.CreateRole(Occupation.Pathologist); // Document reportingPathologist > Participant > Person or Organisation or Device > Person > Person Name var name = BaseCDAModel.CreatePersonName(); name.FamilyName = "Radiologist"; person.PersonNames = new List <IPersonName> { name }; // Document reportingPathologist > Participant > Entity Identifier person.Identifiers = new List <Identifier> { BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.HPII, "8003615833334118"), }; // Employment Organisation person.Organisation = BaseCDAModel.CreateEmploymentOrganisation(); person.Organisation.Name = "Hay Bill Hospital"; person.Organisation.NameUsage = OrganisationNameUsage.Other; person.Organisation.Department = "Some department service provider"; person.Organisation.EmploymentType = BaseCDAModel.CreateCodableText(EmploymentType.Casual); person.Organisation.Occupation = DiagnosticImagingReport.CreateRole(Occupation.DiagnosticandInterventionalRadiologist); person.Organisation.PositionInOrganisation = BaseCDAModel.CreateCodableText("Radiologist"); person.Organisation.Identifiers = new List <Identifier> { BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.HPIO, "8003620833333789"), BaseCDAModel.CreateIdentifier("Test Authority", null, null, "2.999.1234567890", null) }; if (!mandatoryOnly) { // Document reportingPathologist > Participant > Electronic Communication Detail var coms1 = BaseCDAModel.CreateElectronicCommunicationDetail( "0345754566", ElectronicCommunicationMedium.Telephone, ElectronicCommunicationUsage.WorkPlace); var coms2 = BaseCDAModel.CreateElectronicCommunicationDetail( "*****@*****.**", ElectronicCommunicationMedium.Email, ElectronicCommunicationUsage.WorkPlace); reportingPathologist.Participant.ElectronicCommunicationDetails = new List <ElectronicCommunicationDetail> { coms1, coms2 }; // Document reportingPathologist > Participant > Address var address1 = BaseCDAModel.CreateAddress(); address1.AddressPurpose = AddressPurpose.Business; address1.AustralianAddress = BaseCDAModel.CreateAustralianAddress(); var address2 = BaseCDAModel.CreateAddress(); address2.AddressPurpose = AddressPurpose.Business; address2.AustralianAddress = BaseCDAModel.CreateAustralianAddress(); var addressList = new List <IAddress> { address1, address2 }; reportingPathologist.Participant.Addresses = addressList; // Participant > Entitlement 1 var medicarePharmacyApprovalNumberEntitlement = BaseCDAModel.CreateEntitlement(); var code = BaseCDAModel.CreateCodableText("11", CodingSystem.NCTISEntitlementTypeValues, "Medicare Pharmacy Approval Number", null, null); medicarePharmacyApprovalNumberEntitlement.Id = BaseCDAModel.CreateIdentifier("Pharmacy", null, "1234567892", "1.2.36.174030967.1.3.2.1", code); medicarePharmacyApprovalNumberEntitlement.Type = EntitlementType.MedicarePharmacyApprovalNumber; medicarePharmacyApprovalNumberEntitlement.ValidityDuration = BaseCDAModel.CreateInterval("1", TimeUnitOfMeasure.Year); // Participant > Entitlement 2 var medicarePrescriberNumberEntitlement = BaseCDAModel.CreateEntitlement(); //var medicarePharmacyApprovalNumberCode = BaseCDAModel.CreateCodableText("10", CodingSystem.NCTISEntitlementTypeValues, "Medicare Prescriber Number", null, null); medicarePrescriberNumberEntitlement.Id = BaseCDAModel.CreatePrescriberNumber(IdentifierType.PrescriberNumber, "049960CT"); medicarePrescriberNumberEntitlement.Type = EntitlementType.MedicarePrescriberNumber; medicarePrescriberNumberEntitlement.ValidityDuration = BaseCDAModel.CreateInterval("1", TimeUnitOfMeasure.Year); reportingPathologist.Participant.Entitlements = new List <Entitlement> { medicarePharmacyApprovalNumberEntitlement, medicarePrescriberNumberEntitlement }; name.GivenNames = new List <string> { "Fitun" }; name.Titles = new List <string> { "Dr" }; name.NameUsages = new List <NameUsage> { NameUsage.Legal }; address1.AustralianAddress.UnstructuredAddressLines = new List <string> { "1 Clinician Street" }; address1.AustralianAddress.SuburbTownLocality = "Nehtaville"; address1.AustralianAddress.State = AustralianState.QLD; address1.AustralianAddress.PostCode = "5555"; address2.AustralianAddress.UnstructuredAddressLines = new List <string> { "2 Clinician Street" }; address2.AustralianAddress.SuburbTownLocality = "Nehtaville"; address2.AustralianAddress.State = AustralianState.QLD; address2.AustralianAddress.PostCode = "5555"; // Qualifications reportingPathologist.Participant.Qualifications = "FRACGP"; } reportingPathologist.Participant.Person = person; return(reportingPathologist); }
/// <summary> /// Creates and hydrates the 'Imaging Examination Results' section. /// </summary> /// <param name="mandatorySectionsOnly">Includes on the mandatory sections</param> /// <param name="showDescription">Determines wether the anatomicalSite.Description is displayed or not</param> /// <returns>A hydrated 'IImagingExaminationResult' object.</returns> public static IDiagnosticImagingExaminationResult CreateDiagnosticImagingResults(Boolean mandatorySectionsOnly, bool showDescription) { var diagnosticImagingExaminationResult = DiagnosticImagingReport.CreateDiagnosticImagingExaminationResult(); // Examination Result Name diagnosticImagingExaminationResult.ExaminationResultName = BaseCDAModel.CreateCodableText("399208008", CodingSystem.SNOMED, "Plain chest X-ray"); // Begin Modality (Imaging Modality) diagnosticImagingExaminationResult.Modality = BaseCDAModel.CreateCodableText("363680008", CodingSystem.SNOMED, "X-ray"); // Observation Date Time diagnosticImagingExaminationResult.ObservationDateTime = new ISO8601DateTime(DateTime.Now); // ExaminationDetails diagnosticImagingExaminationResult.ExaminationDetails = CreateExaminationDetails(mandatorySectionsOnly); // Examination Procedure diagnosticImagingExaminationResult.ExaminationProcedure = "The examination was carried out using the particular procedure."; // Overall Result Status diagnosticImagingExaminationResult.OverallResultStatus = BaseCDAModel.CreateResultStatus(Hl7V3ResultStatus.FinalResults, "Final Results"); // or BaseCDAModel.CreateResultStatus(Hl7V3ResultStatus.FinalResults) if (!mandatorySectionsOnly) { // Please note optional field - Note: This field is only displayed in the Narrative diagnosticImagingExaminationResult.ReportingRadiologistForImagingExaminationResult = "DR Arreza Araceli"; // Related Image diagnosticImagingExaminationResult.RelatedImage = BaseCDAModel.CreateRelatedImage("http://bassendeanwellness.com.au/sites/default/files/Chest%2520X-Ray%2520Image.jpg", MediaType.JPEG); // Anatomical Site var anatomicalSite = DiagnosticImagingReport.CreateAnatomicalSiteExtended(); // Anatomical Location anatomicalSite.SpecificLocation = BaseCDAModel.CreateAnatomicalLocation(); if (showDescription) { // Description anatomicalSite.Description = "Chest/Thorax"; } else { // Anatomical Location - Name Of Location anatomicalSite.SpecificLocation.NameOfLocation = BaseCDAModel.CreateCodableText("302551006", CodingSystem.SNOMED, "Entire thorax"); // Anatomical Location - Side anatomicalSite.SpecificLocation.Side = BaseCDAModel.CreateCodableText("7771000", CodingSystem.SNOMED, "left"); // Anatomical Region diagnosticImagingExaminationResult.AnatomicalRegion = AnatomicalRegion.Chest; } // Assign Anatomical Site diagnosticImagingExaminationResult.AnatomicalSite = new List <IAnatomicalSiteExtended> { anatomicalSite, anatomicalSite }; } return(diagnosticImagingExaminationResult); }
/// <summary> /// Create a DiagnosticImagingTransformResult instance (containing a DiagnosticImagingReport and a ReportAttachment instance) from a /// HL7 V2 diagnostic imaging message. The DiagnosticImagingTransformResult instance is then used to generate a CDA document. /// </summary> /// <param name="hl7GenericMessage">The HL7 V2 message to transform.</param> /// <param name="metadata">Mandatory information to supplement the transform.</param> /// <param name="reportData">Report data.</param> /// <returns></returns> internal DiagnosticImagingTransformResult Transform(HL7GenericMessage hl7GenericMessage, DiagnosticImagingMetadata metadata, byte[] reportData = null) { DiagnosticImagingReport diagnosticImagingReport = DiagnosticImagingReport.CreateDiagnosticImagingReport(); // Include Logo diagnosticImagingReport.IncludeLogo = false; // Set Creation Time diagnosticImagingReport.DocumentCreationTime = GetResultsReportStatusChange(hl7GenericMessage); // Document Status diagnosticImagingReport.DocumentStatus = GetReportStatus(hl7GenericMessage); #region Setup and populate the CDA context model // CDA Context model var cdaContext = DiagnosticImagingReport.CreateCDAContext(); // Document Id cdaContext.DocumentId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateOid(), null); // Set Id cdaContext.SetId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateGuid(), null); // CDA Context Version cdaContext.Version = "1"; // Legal Authenticator cdaContext.LegalAuthenticator = CreateLegalAuthenticator(hl7GenericMessage); // Custodian cdaContext.Custodian = BaseCDAModel.CreateCustodian(); ICustodian custodian = BaseCDAModel.CreateParticipantCustodian(); cdaContext.Custodian.Participant = custodian; diagnosticImagingReport.CDAContext = cdaContext; #endregion #region Setup and Populate the SCS Context model // SCS Context model diagnosticImagingReport.SCSContext = DiagnosticImagingReport.CreateSCSContext(); // Author Health Care Provider diagnosticImagingReport.SCSContext.Author = CreateAuthor(hl7GenericMessage); // The Reporting Radiologist diagnosticImagingReport.SCSContext.ReportingRadiologist = CreateReportingRadiologist(hl7GenericMessage); // Order Details diagnosticImagingReport.SCSContext.OrderDetails = CreateOrderDetails(hl7GenericMessage); // Subject Of Care diagnosticImagingReport.SCSContext.SubjectOfCare = CreateSubjectOfCare(hl7GenericMessage); #endregion #region Setup and populate the SCS Content model // SCS Content model diagnosticImagingReport.SCSContent = DiagnosticImagingReport.CreateSCSContent(); ReportAttachment reportAttachment = GetReportAttachment(hl7GenericMessage, reportData); // Imaging Examination Results diagnosticImagingReport.SCSContent.ImagingExaminationResults = CreateImagingExaminationResults(hl7GenericMessage); // Related Document diagnosticImagingReport.SCSContent.RelatedDocument = CreateRelatedDocument(hl7GenericMessage, reportAttachment); #endregion FillInAdditionalMetadata(diagnosticImagingReport, metadata); return(new DiagnosticImagingTransformResult { DiagnosticImagingReport = diagnosticImagingReport, Attachment = reportAttachment }); }
/// <summary> /// This sample populates both the mandatory and optional Sections / Entries depending on the /// mandatorySectionsOnly Boolean /// </summary> internal static DiagnosticImagingReport PopulatedDiagnosticImagingReport(Boolean mandatorySectionsOnly) { var diagnosticImagingReport = DiagnosticImagingReport.CreateDiagnosticImagingReport(); // Include Logo diagnosticImagingReport.IncludeLogo = true; diagnosticImagingReport.LogoPath = OutputFolderPath; // Set Creation Time diagnosticImagingReport.DocumentCreationTime = new ISO8601DateTime(DateTime.Now); #region Setup and populate the CDA context model // Setup and populate the CDA context model var cdaContext = DiagnosticImagingReport.CreateCDAContext(); // Document Id cdaContext.DocumentId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateOid()); // Set Id cdaContext.SetId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateGuid()); // CDA Context Version cdaContext.Version = "1"; // Custodian cdaContext.Custodian = BaseCDAModel.CreateCustodian(); GenericObjectReuseSample.HydrateCustodian(cdaContext.Custodian, "Queensland Diagnostic Services", mandatorySectionsOnly); // Legal Authenticator cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator(); GenericObjectReuseSample.HydrateAuthenticator(cdaContext.LegalAuthenticator, mandatorySectionsOnly); diagnosticImagingReport.CDAContext = cdaContext; #endregion #region Setup and Populate the SCS Context model // Setup and Populate the SCS Context model diagnosticImagingReport.SCSContext = DiagnosticImagingReport.CreateSCSContext(); // Reporting Radiologist diagnosticImagingReport.SCSContext.ReportingRadiologist = CreateReportingRadiologist(mandatorySectionsOnly); // Order Details diagnosticImagingReport.SCSContext.OrderDetails = CreateOrderDetails(mandatorySectionsOnly); // Author Health Care Provider diagnosticImagingReport.SCSContext.Author = BaseCDAModel.CreateAuthorHealthcareProvider(); GenericObjectReuseSample.HydrateAuthorHealthcareProvider(diagnosticImagingReport.SCSContext.Author, "Queensland Diagnostic Services", mandatorySectionsOnly); // Subject Of Care diagnosticImagingReport.SCSContext.SubjectOfCare = BaseCDAModel.CreateSubjectOfCare(); GenericObjectReuseSample.HydrateSubjectofCare(diagnosticImagingReport.SCSContext.SubjectOfCare, mandatorySectionsOnly); #endregion #region Setup and populate the SCS Content model // Setup and populate the SCS Content model diagnosticImagingReport.SCSContent = DiagnosticImagingReport.CreateSCSContent(); // Imaging Examination Results diagnosticImagingReport.SCSContent.ImagingExaminationResults = new List <IDiagnosticImagingExaminationResult> { CreateDiagnosticImagingResults(mandatorySectionsOnly, true), CreateDiagnosticImagingResults(mandatorySectionsOnly, false) }; // Related Information diagnosticImagingReport.SCSContent.RelatedDocument = CreateRelatedDocument(mandatorySectionsOnly); #endregion return(diagnosticImagingReport); }
/// <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); }