/// <summary> /// This method populates an consumerEnteredNotes model with either the mandatory sections only, or both /// the mandatory and optional sections /// </summary> /// <param name="mandatorySectionsOnly">mandatorySectionsOnly</param> /// <returns>ConsumerEnteredNotes</returns> public static ConsumerEnteredNotes PopulateConsumerEnteredNotes(Boolean mandatorySectionsOnly) { var consumerEnteredNotes = ConsumerEnteredNotes.CreateConsumerEnteredNotes(); // Include Logo consumerEnteredNotes.IncludeLogo = true; consumerEnteredNotes.LogoPath = OutputFolderPath; // Set Creation Time consumerEnteredNotes.DocumentCreationTime = new ISO8601DateTime(DateTime.Now); #region Setup and populate the CDA context model // Setup and populate the CDA context model var cdaContext = ConsumerEnteredNotes.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"; // Custodian cdaContext.Custodian = BaseCDAModel.CreateCustodian(); GenericObjectReuseSample.HydrateCustodian(cdaContext.Custodian, mandatorySectionsOnly); // Legal authenticator if (!mandatorySectionsOnly) { cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator(); GenericObjectReuseSample.HydrateAuthenticator(cdaContext.LegalAuthenticator, mandatorySectionsOnly); } consumerEnteredNotes.CDAContext = cdaContext; #endregion #region Setup and Populate the SCS Context model // Setup and Populate the SCS Context model consumerEnteredNotes.SCSContext = ConsumerEnteredNotes.CreateSCSContext(); consumerEnteredNotes.SCSContext.Author = ConsumerEnteredNotes.CreateAuthor(); PopulateAuthor(consumerEnteredNotes.SCSContext.Author, mandatorySectionsOnly); consumerEnteredNotes.SCSContext.SubjectOfCare = PopulateSubjectofCare(mandatorySectionsOnly); #endregion #region Setup and populate the SCS Content model // Setup and populate the SCS Content model consumerEnteredNotes.SCSContent = ConsumerEnteredNotes.CreateSCSContent(); consumerEnteredNotes.SCSContent.Title = "My Health Summary"; consumerEnteredNotes.SCSContent.Description = "I have been really healthy all my life."; #endregion return(consumerEnteredNotes); }
/// <summary> /// This method populates an consumerEnteredHealthSummary model with either the mandatory sections only, or both /// the mandatory and optional sections /// </summary> /// <param name="mandatorySectionsOnly">mandatorySectionsOnly</param> /// <returns>ConsumerEnteredHealthSummary</returns> public static ConsumerEnteredHealthSummary PopulateConsumerEnteredHealthSummary(Boolean mandatorySectionsOnly) { var consumerEnteredHealthSummary = ConsumerEnteredHealthSummary.CreateConsumerEnteredHealthSummary(); // Include Logo consumerEnteredHealthSummary.IncludeLogo = true; // Set Creation Time consumerEnteredHealthSummary.DocumentCreationTime = new ISO8601DateTime(DateTime.Now); #region Setup and populate the CDA context model // Setup and populate the CDA context model var cdaContext = ConsumerEnteredHealthSummary.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"; // Custodian cdaContext.Custodian = BaseCDAModel.CreateCustodian(); GenericObjectReuseSample.HydrateCustodian(cdaContext.Custodian, mandatorySectionsOnly); // Legal authenticator if (!mandatorySectionsOnly) { cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator(); GenericObjectReuseSample.HydrateAuthenticator(cdaContext.LegalAuthenticator, mandatorySectionsOnly); } consumerEnteredHealthSummary.CDAContext = cdaContext; #endregion #region Setup and Populate the SCS Context model // Setup and Populate the SCS Context model consumerEnteredHealthSummary.SCSContext = ConsumerEnteredHealthSummary.CreateSCSContext(); consumerEnteredHealthSummary.SCSContext.Author = ConsumerEnteredHealthSummary.CreateAuthor(); PopulateAuthor(consumerEnteredHealthSummary.SCSContext.Author, mandatorySectionsOnly); consumerEnteredHealthSummary.SCSContext.SubjectOfCare = BaseCDAModel.CreateSubjectOfCare(); GenericObjectReuseSample.HydrateSubjectofCare(consumerEnteredHealthSummary.SCSContext.SubjectOfCare, mandatorySectionsOnly); #endregion #region Setup and populate the SCS Content model // Setup and populate the SCS Content model consumerEnteredHealthSummary.SCSContent = ConsumerEnteredHealthSummary.CreateSCSContent(); // Allergies And Adverse Reactions consumerEnteredHealthSummary.SCSContent.AllergiesAndAdverseReactions = CreateAllergiesAndAdverseReactions(mandatorySectionsOnly); // Medications consumerEnteredHealthSummary.SCSContent.Medications = CreateMedications(mandatorySectionsOnly); #endregion return(consumerEnteredHealthSummary); }
/// <summary> /// This sample populates both the mandatory and optional Sections / Entries depending on the /// mandatorySectionsOnly Boolean /// </summary> internal static AdvanceCareInformation PopulatedAdvanceCareInformation(Boolean mandatorySectionsOnly, AuthorType authorType) { var advanceCareInformation = AdvanceCareInformation.CreateAdvanceCareInformation(); // Include Logo advanceCareInformation.IncludeLogo = true; advanceCareInformation.LogoPath = OutputFolderPath; // Set Creation Time advanceCareInformation.DocumentCreationTime = new ISO8601DateTime(DateTime.Now); #region Setup and populate the CDA context model // Setup and populate the CDA context model var cdaContext = AdvanceCareInformation.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, "Organisation Name", mandatorySectionsOnly); // Legal Authenticator cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator(); GenericObjectReuseSample.HydrateAuthenticator(cdaContext.LegalAuthenticator, mandatorySectionsOnly); advanceCareInformation.CDAContext = cdaContext; #endregion #region Setup and Populate the SCS Context model // Setup and Populate the SCS Context model advanceCareInformation.SCSContext = AdvanceCareInformation.CreateSCSContext(); // Switch on the author enumerator. switch (authorType) { case AuthorType.AuthorHealthcareProvider: // Create Author Healthcare Provider var authorHealthcareProvider = BaseCDAModel.CreateAuthorHealthcareProvider(); GenericObjectReuseSample.HydrateAuthorHealthcareProvider(authorHealthcareProvider, "Organisation Name", mandatorySectionsOnly); advanceCareInformation.SCSContext.Author = authorHealthcareProvider; break; case AuthorType.AuthorNonHealthcareProvider: // Create Author Non Healthcare Provider var authorNonHealthcareProvider = BaseCDAModel.CreateAuthorPerson(); GenericObjectReuseSample.HydrateAuthorNonHealthcareProvider(authorNonHealthcareProvider, mandatorySectionsOnly); advanceCareInformation.SCSContext.Author = authorNonHealthcareProvider; break; } advanceCareInformation.SCSContext.SubjectOfCare = BaseCDAModel.CreateSubjectOfCare(); GenericObjectReuseSample.HydrateSubjectofCare(advanceCareInformation.SCSContext.SubjectOfCare, mandatorySectionsOnly); // REMOVE THESE FIELDS AS NOT ALLOWED IN ACI advanceCareInformation.SCSContext.SubjectOfCare.Participant.Person.DateOfDeath = null; advanceCareInformation.SCSContext.SubjectOfCare.Participant.Person.DateOfDeathAccuracyIndicator = null; advanceCareInformation.SCSContext.SubjectOfCare.Participant.Person.SourceOfDeathNotification = null; #endregion #region Setup and populate the SCS Content model // Setup and populate the SCS Content model advanceCareInformation.SCSContent = AdvanceCareInformation.CreateSCSContent(); // Related Information advanceCareInformation.SCSContent.DocumentDetails = CreateRelatedDocument(mandatorySectionsOnly); #endregion return(advanceCareInformation); }
/// <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); }
public void Process(Spia.PathologyReportModel.Model.PathologyReport Report, string CdaOutputDirectory, string PdfDirectory, byte[] LogoBytes = null) { var pathologyResultReport = PathologyResultReport.CreatePathologyResultReport(); // Include Logo if (LogoBytes != null) { pathologyResultReport.IncludeLogo = true; pathologyResultReport.LogoByte = LogoBytes; } else { pathologyResultReport.IncludeLogo = false; } // Set Creation Time DateTimeOffset DocumentCreationDateTime = Report.GetOldestReportReleaseDateTime(); pathologyResultReport.DocumentCreationTime = new ISO8601DateTime(DocumentCreationDateTime.DateTime, ISO8601DateTime.Precision.Second, DocumentCreationDateTime.Offset); #region Setup and populate the CDA context model // Setup and populate the CDA context model var cdaContext = PathologyResultReport.CreateCDAContext(); // Document Id cdaContext.DocumentId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateOid(), null); // Set Id cdaContext.SetId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateGuid(), null); // CDA Context Version , this needs to increment for each correction to the first report instance cdaContext.Version = "1"; // Custodian cdaContext.Custodian = BaseCDAModel.CreateCustodian(); //custodian/assignedCustodian cdaContext.Custodian.Participant = BaseCDAModel.CreateParticipantCustodian();; // custodian/assignedCustodian/representedCustodianOrganization cdaContext.Custodian.Participant.Organisation = BaseCDAModel.CreateOrganisationName(); // custodian/assignedCustodian/representedCustodianOrganization/<Entity Identifier> cdaContext.Custodian.Participant.Organisation.Identifiers = new List <Identifier> { BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.HPIO, Report.PerformingLaboratory.Hpio.Replace(" ", string.Empty)) }; // custodian/assignedCustodian/representedCustodianOrganization/name cdaContext.Custodian.Participant.Organisation.Name = Report.PerformingLaboratory.FacilityName; ElectronicCommunicationDetail PerformingPathologyLabComms = BaseCDAModel.CreateElectronicCommunicationDetail( Report.PerformingLaboratory.BusinessPhoneNumber, ElectronicCommunicationMedium.Telephone, ElectronicCommunicationUsage.WorkPlace); // custodian/assignedCustodian/representedCustodianOrganization/<Address> cdaContext.Custodian.Participant.Address = GetCdaAddress(Report.PerformingLaboratory.Address); // custodian/assignedCustodian/representedCustodianOrganization/<Electronic Communication Detail> cdaContext.Custodian.Participant.ElectronicCommunicationDetail = PerformingPathologyLabComms; // Legal Authenticator cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator(); // LegalAuthenticator/assignedEntity cdaContext.LegalAuthenticator.Participant = BaseCDAModel.CreateParticipantForLegalAuthenticator(); // LegalAuthenticator/assignedEntity/assignedPerson cdaContext.LegalAuthenticator.Participant.Person = BaseCDAModel.CreatePerson(); DateTimeOffset OldestReportReleaseDate = Report.GetOldestReportReleaseDateTime(); // LegalAuthenticator/time/@value cdaContext.LegalAuthenticator.Participant.DateTimeAuthenticated = new ISO8601DateTime(OldestReportReleaseDate.DateTime, ISO8601DateTime.Precision.Second, OldestReportReleaseDate.Offset); Spia.PathologyReportModel.Model.Provider FirstReportingPathologist = Report.ReportList.First().ReportingPathologist; //LegalAuthenticator/assignedEntity/assignedPerson/<Person Name> var ReportingPathologistName = BaseCDAModel.CreatePersonName(); if (FirstReportingPathologist.Name.Given is object) { ReportingPathologistName.GivenNames = new List <string> { FirstReportingPathologist.Name.Given }; } ReportingPathologistName.FamilyName = FirstReportingPathologist.Name.Family; if (FirstReportingPathologist.Name.Title is object) { ReportingPathologistName.Titles = new List <string> { FirstReportingPathologist.Name.Title }; } ReportingPathologistName.NameUsages = new List <NameUsage> { NameUsage.Legal }; cdaContext.LegalAuthenticator.Participant.Person.PersonNames = new List <Nehta.VendorLibrary.CDA.IPersonName> { ReportingPathologistName }; // LegalAuthenticator/assignedEntity/<Entity Identifier> cdaContext.LegalAuthenticator.Participant.Person.Identifiers = new List <Identifier> { BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.HPII, FirstReportingPathologist.IdentifierList.SingleOrDefault(x => x.Type == PathologyReportModel.Model.IdentifierType.HPII).Value.Replace(" ", "")) }; // LegalAuthenticator/assignedEntity/code cdaContext.LegalAuthenticator.Role = BaseCDAModel.CreateRole(Occupation.Pathologist, Nehta.VendorLibrary.CDA.Generator.Enums.CodingSystem.ANZSCORevision1); cdaContext.LegalAuthenticator.Participant.Addresses = new List <IAddress>() { GetCdaAddress(Report.PerformingLaboratory.Address) }; // LegalAuthenticator/assignedEntity/<Electronic Communication Detail> cdaContext.LegalAuthenticator.Participant.ElectronicCommunicationDetails = new List <ElectronicCommunicationDetail> { PerformingPathologyLabComms }; // LegalAuthenticator/assignedEntity/representedOrganization cdaContext.LegalAuthenticator.Participant.Organisation = BaseCDAModel.CreateOrganisationName(); // LegalAuthenticator/assignedEntity/representedOrganization/name cdaContext.LegalAuthenticator.Participant.Organisation.Name = Report.PerformingLaboratory.FacilityName; // LegalAuthenticator/assignedEntity/representedOrganization/<Entity Identifier> cdaContext.LegalAuthenticator.Participant.Organisation.Identifiers = new List <Identifier>(); var CodableConceptNataSiteNumber = BaseCDAModel.CreateCodableText(); CodableConceptNataSiteNumber.Code = "XX"; CodableConceptNataSiteNumber.CodeSystemName = "Identifier Type (HL7)"; CodableConceptNataSiteNumber.CodeSystemCode = "2.16.840.1.113883.12.203"; CodableConceptNataSiteNumber.DisplayName = "Organization identifier"; var NataSiteNumber = BaseCDAModel.CreateIdentifier("1.2.36.1.2001.1005.74", Report.PerformingLaboratory.NataSiteNumber); NataSiteNumber.Code = CodableConceptNataSiteNumber; NataSiteNumber.AssigningGeographicArea = "National Identifier"; NataSiteNumber.AssigningAuthorityName = "NATA Site Number"; cdaContext.LegalAuthenticator.Participant.Organisation.Identifiers.Add(NataSiteNumber); //cdaContext.LegalAuthenticator.Participant.Organisation.Identifiers.Add(BaseCDAModel.CreateIdentifier("NATA", Nehta.VendorLibrary.CDA.Generator.Enums.HealthcareIdentifierGeographicArea.NationalIdentifier, PerformingPathologyLab.NataSiteNumber, "1.2.36.1.2001.1005.12", BaseCDAModel.CreateCodableText("AUSNATA", Nehta.VendorLibrary.CDA.Generator.Enums.CodingSystem.HL7IdentifierType, "National Association of Testing Authorities (NATA) Site Number"))); cdaContext.LegalAuthenticator.Participant.Organisation.Identifiers.Add(BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.HPIO, Report.PerformingLaboratory.Hpio.Replace(" ", ""))); pathologyResultReport.CDAContext = cdaContext; #endregion #region Setup and Populate the SCS Context model pathologyResultReport.SCSContext = PathologyResultReport.CreateSCSContext(); // Author Health Care Provider pathologyResultReport.SCSContext.Author = BaseCDAModel.CreateAuthorHealthcareProvider(); // Document Author > Participant pathologyResultReport.SCSContext.Author.Participant = BaseCDAModel.CreateParticipantForAuthorHealthcareProvider(); pathologyResultReport.SCSContext.Author.AuthorParticipationPeriodOrDateTimeAuthored = BaseCDAModel.CreateParticipationPeriod(new ISO8601DateTime(OldestReportReleaseDate.DateTime, ISO8601DateTime.Precision.Second, OldestReportReleaseDate.Offset)); // Document Author > Role = AddressPurpose.Residential pathologyResultReport.SCSContext.Author.Role = BaseCDAModel.CreateRole(Occupation.Pathologist, Nehta.VendorLibrary.CDA.Generator.Enums.CodingSystem.ANZSCORevision1); // Document Author > Participant > Person or Organisation or Device > Person > Person Name (Note: 1..* in ACI) pathologyResultReport.SCSContext.Author.Participant.Person = BaseCDAModel.CreatePersonHealthcareProvider(); pathologyResultReport.SCSContext.Author.Participant.Person.PersonNames = new List <IPersonName> { ReportingPathologistName }; //person.PersonNames = new List<IPersonName> { ReportingPathologistName }; //if (!mandatoryOnly) //{ // // Not providing a family name will insert a nullflavor of 'NI' // name.FamilyName = "Doctor family name"; //} pathologyResultReport.SCSContext.Author.Participant.Person.Identifiers = cdaContext.LegalAuthenticator.Participant.Person.Identifiers; pathologyResultReport.SCSContext.Author.Participant.Person.Organisation = BaseCDAModel.CreateEmploymentOrganisation(); pathologyResultReport.SCSContext.Author.Participant.Person.Organisation.Name = Report.PerformingLaboratory.FacilityName; pathologyResultReport.SCSContext.Author.Participant.Person.Organisation.Identifiers = new List <Identifier>() { BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.HPIO, Report.PerformingLaboratory.Hpio.Replace(" ", "")) }; pathologyResultReport.SCSContext.Author.Participant.ElectronicCommunicationDetails = new List <ElectronicCommunicationDetail>() { PerformingPathologyLabComms }; // Document Author > Participant > Addresses pathologyResultReport.SCSContext.Author.Participant.Addresses = new List <IAddress> { GetCdaAddress(Report.PerformingLaboratory.Address) }; // Document Author > Participant > Address (Note: optional in ACI) pathologyResultReport.SCSContext.Author.Participant.Person.Organisation.Addresses = new List <IAddress> { GetCdaAddress(Report.PerformingLaboratory.Address) }; pathologyResultReport.SCSContext.Author.Participant.Person.Organisation.Name = Report.PerformingLaboratory.FacilityName; pathologyResultReport.SCSContext.Author.Participant.Person.Organisation.NameUsage = OrganisationNameUsage.BusinessName; //pathologyResultReport.SCSContext.Author.Participant.Person.Organisation.Department = "Some department service provider"; //pathologyResultReport.SCSContext.Author.Participant.Person.Organisation.EmploymentType = BaseCDAModel.CreateCodableText(null, null, null, "Casual", null); pathologyResultReport.SCSContext.Author.Participant.Person.Organisation.Occupation = BaseCDAModel.CreateRole(Occupation.Pathologist, Nehta.VendorLibrary.CDA.Generator.Enums.CodingSystem.ANZSCORevision1); //pathologyResultReport.SCSContext.Author.Participant.Person.Organisation.PositionInOrganisation = BaseCDAModel.CreateCodableText(null, null, null, "Manager", null); pathologyResultReport.SCSContext.Author.Participant.Person.Organisation.ElectronicCommunicationDetails = new List <ElectronicCommunicationDetail> { PerformingPathologyLabComms }; // The Reporting Pathologist pathologyResultReport.SCSContext.ReportingPathologist = PathologyResultReport.CreateReportingPathologist(); // Document reportingPathologist > Participant pathologyResultReport.SCSContext.ReportingPathologist.Participant = PathologyResultReport.CreateParticipantForReportingPathologist(); pathologyResultReport.SCSContext.ReportingPathologist.Participant.Person = BaseCDAModel.CreatePersonWithOrganisation(); pathologyResultReport.SCSContext.ReportingPathologist.Participant.Person.PersonNames = new List <IPersonName> { ReportingPathologistName }; // Participation Period pathologyResultReport.SCSContext.ReportingPathologist.ParticipationEndTime = new ISO8601DateTime(OldestReportReleaseDate.DateTime, ISO8601DateTime.Precision.Second, OldestReportReleaseDate.Offset); // Document reportingPathologist > Role pathologyResultReport.SCSContext.ReportingPathologist.Role = PathologyResultReport.CreateRole(Occupation.Pathologist); // Document reportingPathologist > Participant > Address pathologyResultReport.SCSContext.ReportingPathologist.Participant.Addresses = new List <IAddress>() { GetCdaAddress(Report.PerformingLaboratory.Address) }; pathologyResultReport.SCSContext.ReportingPathologist.Participant.ElectronicCommunicationDetails = new List <ElectronicCommunicationDetail> { PerformingPathologyLabComms }; pathologyResultReport.SCSContext.ReportingPathologist.Participant.Person = pathologyResultReport.SCSContext.Author.Participant.Person; // Order Details pathologyResultReport.SCSContext.OrderDetails = DiagnosticImagingReport.CreateOrderDetails(); // Requester Order Identifier //pathologyResultReport.SCSContext.OrderDetails.RequesterOrderIdentifier = BaseCDAModel.CreateIdentifier("1.2.36.1.2001.1005.52.8003620833333789", "10523479"); // Requester pathologyResultReport.SCSContext.OrderDetails.Requester = BaseCDAModel.CreateRequester(); pathologyResultReport.SCSContext.OrderDetails.Requester.ParticipationEndTime = new ISO8601DateTime(Report.Request.RequestedDate.DateTime, ISO8601DateTime.Precision.Day, Report.Request.RequestedDate.Offset); // Document Requester> Role pathologyResultReport.SCSContext.OrderDetails.Requester.Role = BaseCDAModel.CreateRole(Occupation.GeneralMedicalPractitioner, Nehta.VendorLibrary.CDA.Generator.Enums.CodingSystem.ANZSCORevision1); pathologyResultReport.SCSContext.OrderDetails.Requester.Participant = BaseCDAModel.CreateParticipantForRequester(); pathologyResultReport.SCSContext.OrderDetails.Requester.Participant.Person = BaseCDAModel.CreatePersonWithOrganisation(); // Participation Period var RequestingDoctorName = BaseCDAModel.CreatePersonName(); RequestingDoctorName.FamilyName = Report.Request.RequestingProvider.Name.Family; if (Report.Request.RequestingProvider.Name.Given is object) { RequestingDoctorName.GivenNames = new List <string>() { Report.Request.RequestingProvider.Name.Given }; } pathologyResultReport.SCSContext.OrderDetails.Requester.Participant.Person.PersonNames = new List <IPersonName>() { RequestingDoctorName }; pathologyResultReport.SCSContext.OrderDetails.Requester.Participant.Person.Identifiers = new List <Identifier>(); ///Get Requester HPI-I var RequesterHpii = Report.Request.RequestingProvider.IdentifierList.SingleOrDefault(x => x.Type == PathologyReportModel.Model.IdentifierType.HPII); if (RequesterHpii is object) { pathologyResultReport.SCSContext.OrderDetails.Requester.Participant.Person.Identifiers.Add(BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.HPII, RequesterHpii.Value.Replace(" ", ""))); } ///Get Requester Medicare Provider Number var RequesterMedicareProvidernumber = Report.Request.RequestingProvider.IdentifierList.SingleOrDefault(x => x.Type == PathologyReportModel.Model.IdentifierType.MedicareProviderNumber); if (RequesterMedicareProvidernumber is object) { var MedicareProvidernumberIdentifier = BaseCDAModel.CreateIdentifier("Medicare", Nehta.VendorLibrary.CDA.Generator.Enums.HealthcareIdentifierGeographicArea.NationalIdentifier, RequesterMedicareProvidernumber.Value, "1.2.36.174030967.0.2", BaseCDAModel.CreateCodableText("AUSHICPR", Nehta.VendorLibrary.CDA.Generator.Enums.CodingSystem.HL7IdentifierType, "Medicare Provider Number")); pathologyResultReport.SCSContext.OrderDetails.Requester.Participant.Person.Identifiers.Add(MedicareProvidernumberIdentifier); } // Subject Of Care pathologyResultReport.SCSContext.SubjectOfCare = BaseCDAModel.CreateSubjectOfCare(); pathologyResultReport.SCSContext.SubjectOfCare.Participant = BaseCDAModel.CreateParticipantForSubjectOfCare(); pathologyResultReport.SCSContext.SubjectOfCare.Participant.Person = BaseCDAModel.CreatePersonForSubjectOfCare(); pathologyResultReport.SCSContext.SubjectOfCare.Participant.Person.PersonNames = new List <IPersonName>(); pathologyResultReport.SCSContext.SubjectOfCare.Participant.Person.PersonNames.Add(GetCdaPatientName(Report.Patient.Name)); pathologyResultReport.SCSContext.SubjectOfCare.Participant.Person.Gender = GetCdaGender(Report.Patient.Gender); pathologyResultReport.SCSContext.SubjectOfCare.Participant.Person.DateOfBirth = new ISO8601DateTime(Report.Patient.DateOfBirth, ISO8601DateTime.Precision.Day); pathologyResultReport.SCSContext.SubjectOfCare.Participant.Person.IndigenousStatus = IndigenousStatus.NeitherAboriginalNorTorresStraitIslanderOrigin; //Phone numbers if (Report.Patient.HomePhoneNumber is object) { if (pathologyResultReport.SCSContext.SubjectOfCare.Participant.ElectronicCommunicationDetails is null) { pathologyResultReport.SCSContext.SubjectOfCare.Participant.ElectronicCommunicationDetails = new List <ElectronicCommunicationDetail>(); } //Work out if it is a Mobile number ElectronicCommunicationMedium ElectronicCommunicationMedium = ElectronicCommunicationMedium.Telephone; if (Report.Patient.HomePhoneNumber.Replace(" ", "").StartsWith("04", StringComparison.CurrentCultureIgnoreCase) || Report.Patient.HomePhoneNumber.Replace(" ", "").StartsWith("+614", StringComparison.CurrentCultureIgnoreCase)) { ElectronicCommunicationMedium = ElectronicCommunicationMedium.Mobile; } pathologyResultReport.SCSContext.SubjectOfCare.Participant.ElectronicCommunicationDetails.Add( BaseCDAModel.CreateElectronicCommunicationDetail( Report.Patient.HomePhoneNumber, ElectronicCommunicationMedium, ElectronicCommunicationUsage.Home) ); } //Address pathologyResultReport.SCSContext.SubjectOfCare.Participant.Addresses = new List <IAddress>(); foreach (var Address in Report.Patient.AddressList) { pathologyResultReport.SCSContext.SubjectOfCare.Participant.Addresses.Add(GetCdaAddress(Address)); } pathologyResultReport.SCSContext.SubjectOfCare.Participant.Person.Identifiers = new List <Identifier>(); var IhiNumber = Report.Patient.IdentifierList.SingleOrDefault(x => x.Type == PathologyReportModel.Model.IdentifierType.IHI); if (IhiNumber is object) { pathologyResultReport.SCSContext.SubjectOfCare.Participant.Person.Identifiers.Add(BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.IHI, IhiNumber.Value.Replace(" ", ""))); } var MedicareNumber = Report.Patient.IdentifierList.SingleOrDefault(x => x.Type == PathologyReportModel.Model.IdentifierType.MedicareNumber); if (MedicareNumber is object) { //Medicare Number goes in Entitlements as it is not a true identifier legally var MedicareEntitlement = BaseCDAModel.CreateEntitlement(); MedicareEntitlement.Id = BaseCDAModel.CreateMedicareNumber(MedicareNumberType.MedicareCardNumber, MedicareNumber.Value.Replace(" ", "")); MedicareEntitlement.Type = EntitlementType.MedicareBenefits; //MedicareEntitlement.ValidityDuration = BaseCDAModel.CreateInterval(new ISO8601DateTime(DateTime.Now), new ISO8601DateTime(DateTime.Now)); pathologyResultReport.SCSContext.SubjectOfCare.Participant.Entitlements = new List <Entitlement> { MedicareEntitlement }; } //var MrnNumber = this.Input.Message.Segment("PID").Element(3).RepeatList.SingleOrDefault(x => x.Component(5).AsString.Equals("MR", StringComparison.CurrentCultureIgnoreCase)); //if (MrnNumber is object) //{ // pathologyResultReport.SCSContext.SubjectOfCare.Participant.Person.Identifiers.Add(BaseCDAModel.CreateMedicalRecordNumber(MrnNumber.Component(1).AsString, "We need a root OID for the MRN Facility", MrnNumber.Component(4).AsString)); //} #endregion #region Setup and populate the SCS Content model // Setup and populate the SCS Content model pathologyResultReport.SCSContent = PathologyResultReport.CreateSCSContent(); // Pathology Test Result string ReportLinkName = string.Empty; pathologyResultReport.SCSContent.PathologyTestResult = new List <Nehta.VendorLibrary.CDA.SCSModel.Pathology.PathologyTestResult>(); foreach (var Panel in Report.ReportList) { var TestResult = PathologyResultReport.CreatePathologyTestResult(); pathologyResultReport.SCSContent.PathologyTestResult.Add(TestResult); // Please note optional field - Note: This field is only displayed in the Narrative TestResult.ReportingPathologistForTestResult = Report.ReportList.First().ReportingPathologist.Name.Title ?? ""; TestResult.ReportingPathologistForTestResult = $"{TestResult.ReportingPathologistForTestResult} {Report.ReportList.First().ReportingPathologist.Name.Family.ToUpper()}"; TestResult.ReportingPathologistForTestResult = $"{TestResult.ReportingPathologistForTestResult}, {Report.ReportList.First().ReportingPathologist.Name.Given ?? ""}"; if (!string.IsNullOrWhiteSpace(Panel.ReportType.Local.Oid)) { TestResult.TestResultName = BaseCDAModel.CreateCodableText(); TestResult.TestResultName.Code = Panel.ReportType.Local.Term; TestResult.TestResultName.DisplayName = Panel.ReportType.Local.Description; TestResult.TestResultName.CodeSystemCode = Panel.ReportType.Local.Oid; TestResult.TestResultName.OriginalText = Panel.ReportType.Local.Description; } else { TestResult.TestResultName = BaseCDAModel.CreateCodableText(); TestResult.TestResultName.OriginalText = Panel.ReportType.Local.Description; } if (Panel.ReportType.Snomed is object) { TestResult.TestResultName.Translations = new List <ICodableTranslation>(); TestResult.TestResultName.Translations.Add(BaseCDAModel.CreateCodableTranslation(Panel.ReportType.Snomed.Term, Nehta.VendorLibrary.CDA.Generator.Enums.CodingSystem.SNOMED, Panel.ReportType.Snomed.Description)); } // Department Code TestResult.PathologyDiscipline = GetCdaDiagnosticService(Panel.Department); // ResultStatus TestResult.OverallTestResultStatus = GetCdaResultStatus(Panel.ReportStatus); // Test Specimen Detail TestResult.TestSpecimenDetail = PathologyResultReport.CreateTestSpecimenDetail(); TestResult.TestSpecimenDetail.CollectionDateTime = new ISO8601DateTime(Panel.CollectionDateTime.DateTime, ISO8601DateTime.Precision.Minute, Panel.CollectionDateTime.Offset); TestResult.ObservationDateTime = TestResult.TestSpecimenDetail.CollectionDateTime; } // Related Document pathologyResultReport.SCSContent.RelatedDocument = PathologyResultReport.CreateRelatedDocument(); System.IO.FileInfo PdfFileInfo = new System.IO.FileInfo(System.IO.Path.Combine(PdfDirectory, Report.PdfFileName)); if (!PdfFileInfo.Exists) { throw new FieldAccessException($"Unable to locate PDF attachment file at path: {PdfFileInfo.FullName}"); } if (!PdfFileInfo.Extension.EndsWith(".pdf", StringComparison.CurrentCultureIgnoreCase)) { throw new FieldAccessException($"The report attachment file must be in a .pdf format."); } // Pathology PDF var AttachmentPdf = BaseCDAModel.CreateExternalData(); AttachmentPdf.ExternalDataMediaType = Nehta.VendorLibrary.CDA.Generator.Enums.MediaType.PDF; //We have to move the PDF attachment file to a new place and then rename it to 'attachment.pdf' and then after //generating the CDA document we will delete at copy of the PDF. System.IO.FileInfo TempAttachmentFilePath = new System.IO.FileInfo(System.IO.Path.Combine(TempWorkingDirectoryPath.FullName, "attachment.pdf")); if (TempAttachmentFilePath.Exists) { TempAttachmentFilePath.Delete(); } PdfFileInfo.CopyTo(TempAttachmentFilePath.FullName); AttachmentPdf.Path = TempAttachmentFilePath.FullName; pathologyResultReport.SCSContent.RelatedDocument.ExaminationResultRepresentation = AttachmentPdf; // Document Provenance pathologyResultReport.SCSContent.RelatedDocument.DocumentDetails = BaseCDAModel.CreateDocumentDetails(); // Report Identifier pathologyResultReport.SCSContent.RelatedDocument.DocumentDetails.ReportIdentifier = BaseCDAModel.CreateIdentifier($"1.2.36.1.2001.1005.54.{Report.PerformingLaboratory.Hpio.Replace(" ", "")}", Report.ReportList.First().ReportId); // Report Date pathologyResultReport.SCSContent.RelatedDocument.DocumentDetails.ReportDate = new ISO8601DateTime(Report.GetOldestReportReleaseDateTime().DateTime, ISO8601DateTime.Precision.Second, Report.GetOldestReportReleaseDateTime().Offset); // Result Status pathologyResultReport.SCSContent.RelatedDocument.DocumentDetails.ReportStatus = GetCdaResultStatus(Report.GetRolledUpReportStatus()); // Report Name if (Report.ReportList.Count == 1) { pathologyResultReport.SCSContent.RelatedDocument.DocumentDetails.ReportDescription = Report.ReportList[0].ReportType.Local.Description; } else { pathologyResultReport.SCSContent.RelatedDocument.DocumentDetails.ReportDescription = "Pathology Report"; } #endregion XmlDocument xmlDoc; try { Nehta.VendorLibrary.CDA.Generator.CDAGenerator.NarrativeGenerator = new Nehta.VendorLibrary.CDA.Generator.CDANarrativeGenerator(); //Pass the Event Summary model into the GeneratePathologyResultReport method xmlDoc = Nehta.VendorLibrary.CDA.Generator.CDAGenerator.GeneratePathologyResultReport(pathologyResultReport); System.IO.DirectoryInfo CdaOutputDirectoryInfo = new System.IO.DirectoryInfo(CdaOutputDirectory); System.IO.FileInfo CdaFileInfo = new System.IO.FileInfo(System.IO.Path.Combine(CdaOutputDirectoryInfo.FullName, Report.PdfFileName.Replace(".pdf", ".xml"))); if (System.IO.File.Exists(CdaFileInfo.FullName)) { System.IO.File.Delete(CdaFileInfo.FullName); } using (var writer = XmlWriter.Create(CdaFileInfo.FullName, new XmlWriterSettings { Indent = true })) { xmlDoc.Save(writer); } } catch (Nehta.VendorLibrary.Common.ValidationException ex) { //Catch any validation exceptions var validationMessages = ex.GetMessagesString(); throw new ApplicationException($"Error encountered in generating CDA document: {validationMessages}"); } finally { TempAttachmentFilePath.Delete(); } }
/// <summary> /// Creates and hydrates the 'SpecimenDetail' section. /// </summary> /// <returns>A hydrated 'SpecimenDetail' object.</returns> public static SpecimenDetail CreateTestSpecimenDetail(Boolean mandatorySectionsOnly) { // Test Specimen Detail (SPECIMEN) SpecimenDetail specimenDetailOne = BaseCDAModel.CreateSpecimenDetail(); // Date and Time of Collection (Collection DateTime) specimenDetailOne.CollectionDateTime = new ISO8601DateTime(DateTimeNow); if (!mandatorySectionsOnly) { // Specimen Tissue Type specimenDetailOne.SpecimenTissueType = BaseCDAModel.CreateCodableText("85756007", CodingSystem.SNOMED, "Body tissue structure"); // Collection Procedure specimenDetailOne.CollectionProcedure = BaseCDAModel.CreateCodableText("82078001", CodingSystem.SNOMED, "Collection of blood specimen for laboratory"); // Anatomical Site (ANATOMICAL LOCATION) specimenDetailOne.AnatomicalSite = new List <AnatomicalSite> { CreateAnatomicalSite( BaseCDAModel.CreateCodableText("88738008", CodingSystem.SNOMED, "Subcutaneous tissue structure of lateral surface of index finger"), BaseCDAModel.CreateCodableText("7771000", CodingSystem.SNOMED, "Left"), new List <ExternalData> { BaseCDAModel.CreateExternalData(MediaType.JPEG, ImageFileNameAndPath, "Anatomical Site") } ), CreateAnatomicalSite( "Subcutaneous tissue structure of lateral surface of index finger" ), }; // Anatomical Location Description specimenDetailOne.PhysicalDescription = "Physical Details Description"; // Physical Details (PHYSICAL PROPERTIES OF AN OBJECT) specimenDetailOne.PhysicalDetails = new List <PhysicalDetails> { BaseCDAModel.CreatePhysicalDetails("6", "ml", BaseCDAModel.CreateExternalData(MediaType.PDF, AttachmentFileNameAndPath, "Physical Details One")) }; // Sampling Preconditions specimenDetailOne.SamplingPreconditions = BaseCDAModel.CreateCodableText("16985007", CodingSystem.SNOMED, "fasting"); // Collection Setting specimenDetailOne.CollectionSetting = "Ward 1A"; // Date and Time of Receipt (DateTime Received) specimenDetailOne.ReceivedDateTime = new ISO8601DateTime(DateTime.Now); // Parent Specimen Identifier specimenDetailOne.ParentSpecimenIdentifier = BaseCDAModel.CreateInstanceIdentifier("1.2.36.84425496912", BaseCDAModel.CreateGuid()); // Container Identifier specimenDetailOne.ContainerIdentifier = BaseCDAModel.CreateInstanceIdentifier("1.2.36.84425496912", BaseCDAModel.CreateGuid()); // Specimen Identifier specimenDetailOne.SpecimenIdentifier = BaseCDAModel.CreateInstanceIdentifier("1.2.36.84425496912", BaseCDAModel.CreateGuid()); } return(specimenDetailOne); }
/// <summary> /// Creates and hydrates the 'Pathology Test Results' section. /// </summary> /// <returns>A hydrated 'PathologyTestResult' object.</returns> public static PathologyTestResult CreatePathologyResults(Boolean mandatorySectionsOnly) { DateTimeNow = DateTime.Now; // Pathology test result PathologyTestResult pathologyTestResult = BaseCDAModel.CreatePathologyTestResult(); // Test Result Name pathologyTestResult.TestResultName = BaseCDAModel.CreateCodableText("104950002", CodingSystem.SNOMED, "Sulfhaemoglobin measurement"); // Diagnostic Service pathologyTestResult.DiagnosticService = DiagnosticServiceSectionID.Chemistry; // Overall Pathology Test Result Status pathologyTestResult.OverallTestResultStatus = BaseCDAModel.CreateCodableText(HL7ResultStatus.FinalResultsResultsStoredAndVerifiedCanOnlyBeChangedWithACorrectedResult); // Observation Date Time pathologyTestResult.ObservationDateTime = new ISO8601DateTime(DateTimeNow); if (!mandatorySectionsOnly) { // Clinical Information Provided pathologyTestResult.ClinicalInformationProvided = "Hepatitus"; //Pathological Diagnosis pathologyTestResult.PathologicalDiagnosis = new List <ICodableText> { BaseCDAModel.CreateCodableText("17621005", CodingSystem.SNOMED, "Normal"), BaseCDAModel.CreateCodableText("263654008", CodingSystem.SNOMED, "Abnormal") }; // Conclusion pathologyTestResult.Conclusion = "Test Result Group Conclusion"; // Test Result Representation pathologyTestResult.TestResultRepresentation = BaseCDAModel.CreateEncapsulatedData(); pathologyTestResult.TestResultRepresentation.ExternalData = BaseCDAModel.CreateExternalData(MediaType.PDF, AttachmentFileNameAndPath, "Test Result Representation"); // // Demonstrating Text for EncapsulatedData // //pathologyTestResult.TestResultRepresentation = BaseCDAModel.CreateEncapsulatedData(); //pathologyTestResult.TestResultRepresentation.Text = "Lipase 150 U/L (RR < 70)"; // Test Comment pathologyTestResult.TestComment = "Test Result Group Comment"; // Test request details one ITestRequest testRequestDetailsOne = BaseCDAModel.CreateTestRequest(); // Requester Order Identifier testRequestDetailsOne.RequesterOrderIdentifier = BaseCDAModel.CreateInstanceIdentifier("1.2.36.1.2001.1005.52.8003620833333789", "10523479"); // LaboratoryTestResultIdentifier testRequestDetailsOne.LaboratoryTestResultIdentifier = BaseCDAModel.CreateInstanceIdentifier(BaseCDAModel.CreateGuid(), "Laboratory Test Result Identifier"); // Tests Requested Name testRequestDetailsOne.TestsRequestedName = new List <ICodableText> { BaseCDAModel.CreateCodableText("401324008", CodingSystem.SNOMED, "Urinary microscopy, culture and sensitivities"), BaseCDAModel.CreateCodableText("401324008", CodingSystem.SNOMED, "Urinary microscopy, culture and sensitivities"), }; // Test Request Details pathologyTestResult.TestRequestDetails = new List <ITestRequest> { testRequestDetailsOne }; // Result Group (PATHOLOGY TEST RESULT GROUP) pathologyTestResult.ResultGroup = new List <ITestResultGroup> { CreateTestResultGroup(mandatorySectionsOnly) }; } else { // Reporting Pathologist pathologyTestResult.ReportingPathologist = CreateReportingPathologist(mandatorySectionsOnly); } pathologyTestResult.TestSpecimenDetail = new List <SpecimenDetail> { CreateTestSpecimenDetail(mandatorySectionsOnly) }; return(pathologyTestResult); }
/// <summary> /// This method populates a shared health summary model with either the mandatory sections only, or both /// the mandatory and optional sections /// </summary> /// <param name="mandatorySectionsOnly">mandatorySectionsOnly</param> /// <returns>SharedHealthSummary</returns> internal static SharedHealthSummary PopulateSharedHealthSummary(Boolean mandatorySectionsOnly) { var sharedHealthSummary = SharedHealthSummary.CreateSharedHealthSummary(DocumentStatus.Final); // Include Logo sharedHealthSummary.IncludeLogo = true; sharedHealthSummary.LogoPath = OutputFolderPath; // Set Creation Time sharedHealthSummary.DocumentCreationTime = new ISO8601DateTime(DateTime.Now, ISO8601DateTime.Precision.Second); #region Setup and populate the CDA context model // Setup and populate the CDA context model var cdaContext = SharedHealthSummary.CreateCDAContext(); // Document Id cdaContext.DocumentId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateOid()); // CDA Context Version if (!mandatorySectionsOnly) { // Version cdaContext.Version = "1"; // Set Id cdaContext.SetId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateGuid()); } // Custodian cdaContext.Custodian = BaseCDAModel.CreateCustodian(); GenericObjectReuseSample.HydrateCustodian(cdaContext.Custodian, mandatorySectionsOnly); sharedHealthSummary.ShowAdministrativeObservationsSection = !mandatorySectionsOnly; cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator(); GenericObjectReuseSample.HydrateAuthenticator(cdaContext.LegalAuthenticator, mandatorySectionsOnly); sharedHealthSummary.CDAContext = cdaContext; #endregion #region Setup and Populate the SCS Context model // Setup and Populate the SCS Context model sharedHealthSummary.SCSContext = SharedHealthSummary.CreateSCSContext(); sharedHealthSummary.SCSContext.Author = BaseCDAModel.CreateAuthor(); GenericObjectReuseSample.HydrateAuthorV2(sharedHealthSummary.SCSContext.Author, mandatorySectionsOnly); // Subject of Care sharedHealthSummary.SCSContext.SubjectOfCare = BaseCDAModel.CreateSubjectOfCare(); GenericObjectReuseSample.HydrateSubjectofCare(sharedHealthSummary.SCSContext.SubjectOfCare, mandatorySectionsOnly, true); #endregion #region Setup and populate the SCS Content model // Setup and populate the SCS Content model sharedHealthSummary.SCSContent = SharedHealthSummary.CreateSCSContent(); // Adverse reactions sharedHealthSummary.SCSContent.AdverseReactions = CreateAdverseReactions(mandatorySectionsOnly); // Reviewed medications sharedHealthSummary.SCSContent.Medications = CreateMedications(mandatorySectionsOnly); // Reviewed medical history sharedHealthSummary.SCSContent.MedicalHistory = CreateMedicalHistory(mandatorySectionsOnly); // Reviewed Immunizations sharedHealthSummary.SCSContent.Immunisations = CreateImmunisations(mandatorySectionsOnly); #endregion return(sharedHealthSummary); }
/// <summary> /// This method populates an PCEHRPrescriptionRecord model with either the mandatory sections only, or both /// the mandatory and optional sections /// </summary> /// <param name="mandatorySectionsOnly">mandatorySectionsOnly</param> /// <returns>PCEHRPrescriptionRecord</returns> internal static PCEHRPrescriptionRecord PopulatePrescriptionRecord(Boolean mandatorySectionsOnly) { var prescriptionRecord = PCEHRPrescriptionRecord.CreatePrescriptionRecord(); // Set Creation Time prescriptionRecord.DocumentCreationTime = new ISO8601DateTime(DateTime.Now); // Include Logo prescriptionRecord.IncludeLogo = true; prescriptionRecord.LogoPath = OutputFolderPath; #region Setup and populate the CDA context model // Setup and populate the CDA context model var cdaContext = PCEHRPrescriptionRecord.CreateCDAContext(); // Document Id cdaContext.DocumentId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateOid(), null); // Set Id cdaContext.SetId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateGuid(), null); // CDA Context Version cdaContext.Version = "2"; if (mandatorySectionsOnly) { // Hide Administrative Observations prescriptionRecord.ShowAdministrativeObservationsNarrativeAndTitle = false; // Set Parent Document cdaContext.ParentDocuments = new List <ParentDocument> { CreateParentDocument(ReleatedDocumentType.Transform, null, BaseCDAModel.CreateGuid(), null, null, mandatorySectionsOnly) }; } else { // Set Parent Document cdaContext.ParentDocuments = new List <ParentDocument> { CreateParentDocument(ReleatedDocumentType.Transform, null, BaseCDAModel.CreateGuid(), null, "1", mandatorySectionsOnly), CreateParentDocument(ReleatedDocumentType.Replace, cdaContext.SetId, BaseCDAModel.CreateGuid(), CDADocumentType.PrescriptionRecord, "1", mandatorySectionsOnly), }; } var prescriberOrganisationId = new Guid(BaseCDAModel.CreateGuid()); var prescriberId = new Guid(BaseCDAModel.CreateGuid()); // Custodian cdaContext.Custodian = CreateCustodian(mandatorySectionsOnly, prescriberOrganisationId); cdaContext.LegalAuthenticator = CreateLegalAuthenticator(mandatorySectionsOnly, prescriberId); prescriptionRecord.CDAContext = cdaContext; #endregion #region Setup and Populate the SCS Context model // Setup and Populate the SCS Context model prescriptionRecord.SCSContext = PCEHRPrescriptionRecord.CreateSCSContext(); prescriptionRecord.SCSContext.Prescriber = CreatePrescriber(mandatorySectionsOnly, prescriberId); prescriptionRecord.SCSContext.PrescriberOrganisation = CreatePrescriberOrganisation(mandatorySectionsOnly, prescriberOrganisationId); prescriptionRecord.SCSContext.SubjectOfCare = BaseCDAModel.CreateSubjectOfCare(); GenericObjectReuseSample.HydrateSubjectofCare(prescriptionRecord.SCSContext.SubjectOfCare, mandatorySectionsOnly, false); #endregion #region Setup and populate the SCS Content model // Setup and populate the SCS Content model // Create SCS Content prescriptionRecord.SCSContent = PCEHRPrescriptionRecord.CreateSCSContent(); // Prescription Item prescriptionRecord.SCSContent.PrescriptionItem = CreatePrescriptionItem(mandatorySectionsOnly, BaseCDAModel.CreateGuid()); #endregion return(prescriptionRecord); }
/// <summary> /// This method populates an PCEHRDispenseRecord model with either the mandatory sections only, or both /// the mandatory and optional sections /// </summary> /// <param name="mandatorySectionsOnly">mandatorySectionsOnly</param> /// <returns>PCEHRDispenseRecord</returns> internal static PCEHRDispenseRecord PopulateDispenseRecord(Boolean mandatorySectionsOnly) { var dispenseRecord = PCEHRDispenseRecord.CreateDispenseRecord(); // Set Creation Time dispenseRecord.DocumentCreationTime = new ISO8601DateTime(DateTime.Now); // Include Logo dispenseRecord.IncludeLogo = true; #region Setup and populate the CDA context model // Setup and populate the CDA context model var cdaContext = PCEHRDispenseRecord.CreateCDAContext(); // Document Id cdaContext.DocumentId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateOid(), null); // Set Id cdaContext.SetId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateGuid(), null); // CDA Context Version cdaContext.Version = "2"; if (mandatorySectionsOnly) { // Set Parent Document cdaContext.ParentDocuments = new List <ParentDocument> { CreateParentDocument(ReleatedDocumentType.Transform, null, BaseCDAModel.CreateGuid(), null, null, mandatorySectionsOnly) }; } else { // Set Parent Document cdaContext.ParentDocuments = new List <ParentDocument> { CreateParentDocument(ReleatedDocumentType.Transform, null, BaseCDAModel.CreateGuid(), null, "1", mandatorySectionsOnly), CreateParentDocument(ReleatedDocumentType.Replace, cdaContext.SetId, BaseCDAModel.CreateGuid(), CDADocumentType.DispenseRecord, "1", mandatorySectionsOnly), }; } var dispenserOrganisationId = new Guid(BaseCDAModel.CreateGuid()); var dispenserId = new Guid(BaseCDAModel.CreateGuid()); // Custodian cdaContext.Custodian = CreateCustodian(mandatorySectionsOnly, dispenserOrganisationId); cdaContext.LegalAuthenticator = CreateLegalAuthenticator(mandatorySectionsOnly, dispenserId); dispenseRecord.CDAContext = cdaContext; #endregion #region Setup and Populate the SCS Context model // Setup and Populate the SCS Context model dispenseRecord.SCSContext = PCEHRDispenseRecord.CreateSCSContext(); dispenseRecord.SCSContext.Dispenser = CreateDispenser(mandatorySectionsOnly, dispenserId); dispenseRecord.SCSContext.DispenserOrganisation = CreateDispenserOrganisation(mandatorySectionsOnly, dispenserOrganisationId); dispenseRecord.SCSContext.SubjectOfCare = BaseCDAModel.CreateSubjectOfCare(); GenericObjectReuseSample.HydrateSubjectofCare(dispenseRecord.SCSContext.SubjectOfCare, mandatorySectionsOnly); #endregion #region Setup and populate the SCS Content model // Setup and populate the SCS Content model // Create SCS Content dispenseRecord.SCSContent = PCEHRDispenseRecord.CreateSCSContent(); // Prescription Item dispenseRecord.SCSContent.DispenseItem = CreateDispenseItem(mandatorySectionsOnly, BaseCDAModel.CreateGuid()); #endregion return(dispenseRecord); }
/// <summary> /// Creates and Hydrates an Dispense Item. /// /// Note: the data used within this method is intended as a guide and should be replaced. /// </summary> /// <param name="mandatorySectionsOnly">Only show mandatorySectionsOnly fields</param> /// <returns>A Hydrated DispenseItem </returns> internal static IPCEHRDispenseItem CreateDispenseItem(Boolean mandatorySectionsOnly, string dispenseDocumentId) { var dispenseItem = PCEHRDispenseRecord.CreateDispenseItem(); // Status of the document dispenseItem.Status = MedicationStatus.Completed; // Dispense Item Identifier (Medication Action Instance Identifier) dispenseItem.DispenseItemIdentifier = BaseCDAModel.CreateIdentifier("DispenseItemIdentifierAssigningAuthorityName", null, dispenseDocumentId, "1.2.3.4.5.66666", null); // DateTime of Dispense Event (Medication Action DateTime) dispenseItem.DateTimeOfDispenseEvent = new ISO8601DateTime(DateTime.Now); if (!mandatorySectionsOnly) { // Therapeutic Good Identification - The medicine, vaccine or other therapeutic good being ordered, administered to or used by the subject of care dispenseItem.TherapeuticGoodId = BaseCDAModel.CreateCodableText("01471K", CodingSystem.PBSCode, "fluconazole 50 mg capsule, 28"); // Example of translation //var translations = new List<ICodableTranslation>(); //translations.Add(BaseCDAModel.CreateCodableTranslation("01471K", CodingSystem.PBSCode, "fluconazole 50 mg capsule, 28")); //dispenseItem.TherapeuticGoodId = BaseCDAModel.CreateTherapeuticGoodIdentification("28190011000036104", // CodingSystem.AMTV3, "fluconazole 50 mg capsule, 28", null, translations); // Therapeutic Good Strength (Additional Therapeutic Good Detail) - Information concerning the strength of the Therapeutic Good dispenseItem.TherapeuticGoodStrength = "Therapeutic Good Strength (Additional Therapeutic Good Detail)"; // Therapeutic Good Generic Name (Additional Therapeutic Good Detail) - The generic name of the Therapeutic Good dispenseItem.TherapeuticGoodGenericName = "Therapeutic Good Generic Name"; // Additional Dispensed Item Description (Additional Therapeutic Good Detail) dispenseItem.AdditionalDispensedItemDescription = "Additional Dispensed Item Description (Additional Therapeutic Good Detail)"; // Label Instruction (Medication Action Instructions) dispenseItem.LabelInstruction = "Label Instruction (Medication Action Instructions)"; // Formula - The recipe for compounding a medicine dispenseItem.Formula = "Formula"; // Form - The formulation or presentation of the overall substance dispenseItem.Form = BaseCDAModel.CreateCodableText("385057009", CodingSystem.SNOMED, "Film-coated tablet"); // Dispensing - Quantity Description - Free text description of the amount which may consist of the quantity and dose unit. dispenseItem.QuantityDescription = "Dispensing Information - Quantity"; // Comment (Medication Action Comment) dispenseItem.Comment = "Comment (Medication Action Comment)"; // Brand Substitution Permitted - Indicates whether or not the substitution of a prescribed medicine with a different brand name of the same medicine, vaccine or other therapeutic good. // which has been determined as bioequivalent, is allowed when the medication is dispensed/supplied dispenseItem.BrandSubstitutionOccurred = false; // Number of this Dispense dispenseItem.NumberOfThisDispense = 1; // Maximum Number Of Repeats - The number of times the expressed quantity of medicine, vaccine or other therapeutic good may be refilled or re-dispensed without a new prescription dispenseItem.MaximumNumberOfRepeats = 6; // PBS Manufacturer Code (Administrative Manufacturer Code) - Administrative code of the manufacturer of the pharmaceutical item supplied dispenseItem.PBSManufacturerCode = BaseCDAModel.CreateExternalConceptIdentifier(ExternalConcepts.AustralianPBSManufacturerCode, "AB"); // Unique Pharmacy Prescription Number (Administrative System Identifier) dispenseItem.UniquePharmacyPrescriptionNumber = "UniquePharmacyPrescriptionNumber"; // Prescription Item Identifier - A globally unique object identifier for each instance of a Medication Instruction dispenseItem.PrescriptionItemIdentifier = BaseCDAModel.CreateIdentifier( "PrescriptionItemIdentifierAssigningAuthorityName", null, BaseCDAModel.CreateGuid(), "1.2.36.1.2001.1005.36", null); } else { // Therapeutic Good Identification - The medicine, vaccine or other therapeutic good being ordered, administered to or used by the subject of care dispenseItem.TherapeuticGoodId = BaseCDAModel.CreateCodableText("23641011000036102", CodingSystem.AMTV2, "paracetamol 500 mg + codeine phosphate 30 mg tablet"); } return(dispenseItem); }
/// <summary> /// This method populates an acdCustodianRecord model with either the mandatory sections only, or both /// the mandatory and optional sections /// </summary> /// <param name="mandatorySectionsOnly">mandatorySectionsOnly</param> /// <returns>AcdCustodianRecord</returns> public static AcdCustodianRecord PopulateAcdCustodianRecord(Boolean mandatorySectionsOnly) { var acdCustodianRecord = AcdCustodianRecord.CreateAcdCustodianRecord(); // Include Logo acdCustodianRecord.IncludeLogo = true; acdCustodianRecord.LogoPath = OutputFolderPath; // Set Creation Time acdCustodianRecord.DocumentCreationTime = new ISO8601DateTime(DateTime.Now); #region Setup and populate the CDA context model // Setup and populate the CDA context model var cdaContext = AcdCustodianRecord.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"; // Custodian cdaContext.Custodian = BaseCDAModel.CreateCustodian(); GenericObjectReuseSample.HydrateCustodian(cdaContext.Custodian, mandatorySectionsOnly); // Legal authenticator if (!mandatorySectionsOnly) { cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator(); GenericObjectReuseSample.HydrateAuthenticator(cdaContext.LegalAuthenticator, mandatorySectionsOnly); } acdCustodianRecord.CDAContext = cdaContext; #endregion #region Setup and Populate the SCS Context model // Setup and Populate the SCS Context model acdCustodianRecord.SCSContext = AcdCustodianRecord.CreateSCSContext(); acdCustodianRecord.SCSContext.Author = BaseCDAModel.CreateAuthor(); GenericObjectReuseSample.HydrateAuthor(acdCustodianRecord.SCSContext.Author, mandatorySectionsOnly); // If only mandatory sections are required, then remove person employment if (mandatorySectionsOnly) { acdCustodianRecord.SCSContext.Author.Participant.Person.Organisation = null; } acdCustodianRecord.SCSContext.SubjectOfCare = BaseCDAModel.CreateSubjectOfCare(); GenericObjectReuseSample.HydrateSubjectofCare(acdCustodianRecord.SCSContext.SubjectOfCare, mandatorySectionsOnly, false); #endregion #region Setup and populate the SCS Content model // Setup and populate the SCS Content model acdCustodianRecord.SCSContent = AcdCustodianRecord.CreateSCSContent(); // ACD Custodian Record acdCustodianRecord.SCSContent.AcdCustodians = CreateAcdCustodians(mandatorySectionsOnly); #endregion return(acdCustodianRecord); }
/// <summary> /// Create a PathologyTransformResult instance (containing a PathologyResultReport and a ReportAttachment instance) from a HL7 V2 pathology message. /// The PathologyTransformResult 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 PathologyTransformResult Transform(HL7GenericMessage hl7GenericMessage, PathologyMetadata metadata, byte[] reportData = null) { PathologyResultReport pathologyResultReport = PathologyResultReport.CreatePathologyResultReport(); // Include Logo pathologyResultReport.IncludeLogo = false; // Set Creation Time pathologyResultReport.DocumentCreationTime = GetResultsReportStatusChange(hl7GenericMessage); // Document Status pathologyResultReport.DocumentStatus = GetReportStatus(hl7GenericMessage); #region Setup and populate the CDA context model // CDA Context model var cdaContext = PathologyResultReport.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; pathologyResultReport.CDAContext = cdaContext; #endregion #region Setup and Populate the SCS Context model // SCS Context model pathologyResultReport.SCSContext = PathologyResultReport.CreateSCSContext(); // Author Health Care Provider pathologyResultReport.SCSContext.Author = CreateAuthor(hl7GenericMessage); // The Reporting Pathologist pathologyResultReport.SCSContext.ReportingPathologist = CreateReportingPathologist(hl7GenericMessage); // Order Details pathologyResultReport.SCSContext.OrderDetails = CreateOrderDetails(hl7GenericMessage); // Subject Of Care pathologyResultReport.SCSContext.SubjectOfCare = CreateSubjectOfCare(hl7GenericMessage); #endregion #region Setup and populate the SCS Content model // SCS Content model pathologyResultReport.SCSContent = PathologyResultReport.CreateSCSContent(); ReportAttachment reportAttachment = GetReportAttachment(hl7GenericMessage, reportData); // Pathology Test Result pathologyResultReport.SCSContent.PathologyTestResult = CreatePathologyTestResults(hl7GenericMessage); // Related Document pathologyResultReport.SCSContent.RelatedDocument = CreateRelatedDocument(hl7GenericMessage, reportAttachment); #endregion FillInAdditionalMetadata(pathologyResultReport, metadata); return(new PathologyTransformResult { PathologyResultReport = pathologyResultReport, Attachment = reportAttachment }); }
/// <summary> /// This sample populates both the mandatory and optional Sections / Entries depending on the /// mandatorySectionsOnly Boolean /// </summary> internal static EventSummary PopulatedEventSummary(Boolean mandatorySectionsOnly) { var eventSummary = EventSummary.CreateEventSummary(); // Include Logo eventSummary.IncludeLogo = true; eventSummary.LogoPath = OutputFolderPath; // Set Creation Time eventSummary.DocumentCreationTime = new ISO8601DateTime(DateTime.Now); #region Setup and populate the CDA context model // Setup and populate the CDA context model var cdaContext = EventSummary.CreateCDAContext(); // Document Id cdaContext.DocumentId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateOid()); // Set Id if (!mandatorySectionsOnly) { cdaContext.SetId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateGuid()); } // CDA Context Version if (!mandatorySectionsOnly) { cdaContext.Version = "1"; } // Custodian cdaContext.Custodian = BaseCDAModel.CreateCustodian(); GenericObjectReuseSample.HydrateCustodian(cdaContext.Custodian, mandatorySectionsOnly); cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator(); GenericObjectReuseSample.HydrateAuthenticator(cdaContext.LegalAuthenticator, mandatorySectionsOnly); eventSummary.CDAContext = cdaContext; #endregion #region Setup and Populate the SCS Context model // Setup and Populate the SCS Context model eventSummary.SCSContext = EventSummary.CreateSCSContext(); eventSummary.SCSContext.Author = BaseCDAModel.CreateAuthor(); GenericObjectReuseSample.HydrateAuthorV2(eventSummary.SCSContext.Author, mandatorySectionsOnly); eventSummary.SCSContext.SubjectOfCare = BaseCDAModel.CreateSubjectOfCare(); GenericObjectReuseSample.HydrateSubjectofCare(eventSummary.SCSContext.SubjectOfCare, mandatorySectionsOnly, false); // DateTime Health Event Started & DateTime Health Event Ended allowable combinations var dateTimeHealthEventEnded = new ISO8601DateTime(DateTime.Now); var dateTimeHealthEventStarted = new ISO8601DateTime(DateTime.Now.AddMonths(-12)); eventSummary.SCSContext.EncounterPeriod = !mandatorySectionsOnly? BaseCDAModel.CreateLowHigh(dateTimeHealthEventStarted, dateTimeHealthEventEnded) : BaseCDAModel.CreateHigh(dateTimeHealthEventEnded); #endregion #region Setup and populate the SCS Content model // Setup and populate the SCS Content model eventSummary.SCSContent = EventSummary.CreateSCSContent(); if (!mandatorySectionsOnly) { eventSummary.SCSContent.EventDetails = CreateEventDetails(); // Adverse reactions eventSummary.SCSContent.AdverseReactions = CreateAdverseReactions(); // Medications eventSummary.SCSContent.Medications = CreateMedications(); // Medical history eventSummary.SCSContent.DiagnosesIntervention = CreateDiagnosesIntervention(mandatorySectionsOnly); // Immunisations eventSummary.SCSContent.Immunisations = CreateImmunisations(); // Diagnostic Investigations eventSummary.SCSContent.DiagnosticInvestigations = CreateDiagnosticInvestigations(mandatorySectionsOnly); } #endregion return(eventSummary); }
/// <summary> /// This sample populates both the mandatory and optional Sections / Entries depending on the /// mandatorySectionsOnly Boolean /// </summary> internal static PathologyResultReport PopulatedPathologyResultReport(Boolean mandatorySectionsOnly) { var pathologyResultReport = PathologyResultReport.CreatePathologyResultReport(); // Include Logo pathologyResultReport.IncludeLogo = true; pathologyResultReport.LogoPath = OutputFolderPath; // Set Creation Time pathologyResultReport.DocumentCreationTime = new ISO8601DateTime(DateTime.Now); #region Setup and populate the CDA context model // Setup and populate the CDA context model var cdaContext = PathologyResultReport.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"; // Custodian cdaContext.Custodian = BaseCDAModel.CreateCustodian(); GenericObjectReuseSample.HydrateCustodian(cdaContext.Custodian, "Pathology Queensland", mandatorySectionsOnly); // Legal Authenticator cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator(); GenericObjectReuseSample.HydrateAuthenticator(cdaContext.LegalAuthenticator, mandatorySectionsOnly); pathologyResultReport.CDAContext = cdaContext; #endregion // Setup and Populate the SCS Context model #region Setup and Populate the SCS Context model pathologyResultReport.SCSContext = PathologyResultReport.CreateSCSContext(); // Author Health Care Provider pathologyResultReport.SCSContext.Author = BaseCDAModel.CreateAuthorHealthcareProvider(); GenericObjectReuseSample.HydrateAuthorHealthcareProvider(pathologyResultReport.SCSContext.Author, "Pathology Queensland", mandatorySectionsOnly); // The Reporting Pathologist pathologyResultReport.SCSContext.ReportingPathologist = CreateReportingPathologist(mandatorySectionsOnly); // Order Details pathologyResultReport.SCSContext.OrderDetails = CreateOrderDetails(mandatorySectionsOnly); // Subject Of Care pathologyResultReport.SCSContext.SubjectOfCare = BaseCDAModel.CreateSubjectOfCare(); GenericObjectReuseSample.HydrateSubjectofCare(pathologyResultReport.SCSContext.SubjectOfCare, mandatorySectionsOnly); #endregion #region Setup and populate the SCS Content model // Setup and populate the SCS Content model pathologyResultReport.SCSContent = PathologyResultReport.CreateSCSContent(); // Pathology Test Result pathologyResultReport.SCSContent.PathologyTestResult = new List <PathologyTestResult> { CreatePathologyTestResult(mandatorySectionsOnly ? null : "DR Arreza Araceli"), CreatePathologyTestResult(mandatorySectionsOnly ? null : "DR Arshi Lakdawala") }; // Related Document pathologyResultReport.SCSContent.RelatedDocument = CreateRelatedDocument(mandatorySectionsOnly); #endregion return(pathologyResultReport); }
/// <summary> /// Creates and Hydrates an Prescription Item. /// /// Note: the data used within this method is intended as a guide and should be replaced. /// </summary> /// <param name="mandatorySectionsOnly">Only show mandatorySectionsOnly fields</param> /// <param name="prescriptionId">Prescription Identifier </param> /// <returns>A Hydrated PrescriptionItem </returns> internal static IPCEHRPrescriptionItem CreatePrescriptionItem(Boolean mandatorySectionsOnly, string prescriptionId) { var prescriptionItem = PCEHRPrescriptionRecord.CreatePrescriptionItem(); // The Dispensing Information Object prescriptionItem.DispensingInformation = CreateDispensingInformation(mandatorySectionsOnly); // Prescription Item Identifier - A globally unique object identifier for each instance of a Medication Instruction prescriptionItem.PrescriptionItemIdentifier = BaseCDAModel.CreateIdentifier("1.2.36.1.2001.1005.36", BaseCDAModel.CreateGuid()); if (!mandatorySectionsOnly) { // Therapeutic Good Identification - The medicine, vaccine or other therapeutic good being ordered, administered to or used by the subject of care prescriptionItem.TherapeuticGoodId = BaseCDAModel.CreateCodableText("01158Y", CodingSystem.PBSCode, "cimetidine 400 mg tablet, 60", null, null); // Therapeutic Good Strength (Additional Therapeutic Good Detail) - Information concerning the strength of the Therapeutic Good prescriptionItem.TherapeuticGoodStrength = "Therapeutic Good Strength"; // Therapeutic Good Generic Name (Additional Therapeutic Good Detail) - The generic name of the Therapeutic Good prescriptionItem.TherapeuticGoodGenericName = "Therapeutic Good Generic Name"; // Directions - A complete narrative description of how much, when and how to use the medicine, vaccine or other therapeutic good prescriptionItem.Directions = "Directions"; // Formula - The recipe for compounding a medicine prescriptionItem.Formula = "Formula"; // Form - The formulation or presentation of the overall substance prescriptionItem.Form = BaseCDAModel.CreateCodableText("385057009", CodingSystem.SNOMED, "Film-coated tablet", null, null); // ClinicalIndication - A reason for ordering the medicine, vaccine or other therapeutic good prescriptionItem.ClinicalIndication = "Clinical Indication"; // Route - The route by which the medication is administered prescriptionItem.Route = BaseCDAModel.CreateCodableText("26643006", CodingSystem.SNOMED, "Oral route", null, null); // Comment - Any additional information that may be needed to ensure the continuity of supply, rationale for current dose and timing, or safe and appropriate use prescriptionItem.Comment = "Comment"; // DateTime Prescription Expires prescriptionItem.DateTimePrescriptionExpires = new ISO8601DateTime(DateTime.Now.AddMonths(12)); // PBS Manufacturer Code (Administrative Manufacturer Code) - Administrative code of the manufacturer of the pharmaceutical item supplied prescriptionItem.PBSManufacturerCode = BaseCDAModel.CreateExternalConceptIdentifier(ExternalConcepts.AustralianPBSManufacturerCode, "AB"); } else { // Therapeutic Good Identification - The medicine, vaccine or other therapeutic good being ordered, administered to or used by the subject of care prescriptionItem.TherapeuticGoodId = BaseCDAModel.CreateCodableText("28237011000036107", CodingSystem.AMTV3, "amoxycillin 500 mg capsule, 20", null, null); } return(prescriptionItem); }
/// <summary> /// This method populates a specialistLetter /// </summary> /// <param name="mandatorySectionsOnly">mandatorySectionsOnly</param> /// <returns>SpecialistLetter</returns> internal static SpecialistLetter PopulateSpecialistLetter(Boolean mandatorySectionsOnly) { var specialistLetter = SpecialistLetter.CreateSpecialistLetter(); // Set Creation Time specialistLetter.DocumentCreationTime = new ISO8601DateTime(DateTime.Now); // Include Logo specialistLetter.IncludeLogo = true; #region Setup and populate the CDA context model // Setup and populate the CDA context model var cdaContext = SpecialistLetter.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"; // Custodian cdaContext.Custodian = BaseCDAModel.CreateCustodian(); GenericObjectReuseSample.HydrateCustodian(cdaContext.Custodian, mandatorySectionsOnly); // Legal authenticator if (!mandatorySectionsOnly) { cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator(); GenericObjectReuseSample.HydrateAuthenticator(cdaContext.LegalAuthenticator, mandatorySectionsOnly); } // Create information recipient if (!mandatorySectionsOnly) { var recipient1 = BaseCDAModel.CreateInformationRecipient(); var recipient2 = BaseCDAModel.CreateInformationRecipient(); GenericObjectReuseSample.HydrateRecipient(recipient1, RecipientType.Primary, mandatorySectionsOnly); GenericObjectReuseSample.HydrateRecipient(recipient2, RecipientType.Secondary, mandatorySectionsOnly); cdaContext.InformationRecipients = new List <IParticipationInformationRecipient> { recipient1, recipient2 }; } specialistLetter.CDAContext = cdaContext; #endregion #region Setup and Populate the SCS Context model specialistLetter.SCSContext = SpecialistLetter.CreateSCSContext(); specialistLetter.SCSContext.Author = BaseCDAModel.CreateAuthor(); GenericObjectReuseSample.HydrateAuthor(specialistLetter.SCSContext.Author, mandatorySectionsOnly); specialistLetter.SCSContext.SubjectOfCare = BaseCDAModel.CreateSubjectOfCare(); GenericObjectReuseSample.HydrateSubjectofCare(specialistLetter.SCSContext.SubjectOfCare, mandatorySectionsOnly); specialistLetter.SCSContext.DateTimeSubjectSeen = new ISO8601DateTime(DateTime.Now); if (!mandatorySectionsOnly) { specialistLetter.SCSContext.Referrer = CreateReferrer(mandatorySectionsOnly); specialistLetter.SCSContext.UsualGP = CreateUsualGPPerson(mandatorySectionsOnly); } #endregion #region Setup and populate the SCS Content model specialistLetter.SCSContent = SpecialistLetter.CreateSCSContent(); // Response details specialistLetter.SCSContent.ResponseDetails = CreateResponseDetails(mandatorySectionsOnly); // Recommendations specialistLetter.SCSContent.Recommendations = CreateRecommendations(mandatorySectionsOnly); // Medications specialistLetter.SCSContent.Medications = CreateMedications(mandatorySectionsOnly); if (!mandatorySectionsOnly) { // Adverse reactions specialistLetter.SCSContent.AdverseReactions = CreateAdverseReactions(); // Diagnostic Investigations specialistLetter.SCSContent.DiagnosticInvestigations = CreateDiagnosticInvestigations(mandatorySectionsOnly); } #endregion return(specialistLetter); }
/// <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 }); }