/// <summary>
        /// Creates and hydrates the 'Other Test Result' Attachment section.
        /// </summary>
        /// <returns>A hydrated 'OtherTestResult' object.</returns>
        public static OtherTestResult CreateOtherTestResultAttachment()
        {
            var otherTestResult = BaseCDAModel.CreateOtherTestResult();

            // Report Name
            otherTestResult.ReportName = BaseCDAModel.CreateCodableText("Report with Attachment");

            // Report Status
            otherTestResult.ReportStatus = BaseCDAModel.CreateCodableText(Hl7V3ResultStatus.NoOrderOnRecordForThisTest);

            // Report ExternalData
            ExternalData report = BaseCDAModel.CreateExternalData(MediaType.PDF, AttachmentFileNameAndPath, "Path File");

            otherTestResult.ReportContent = BaseCDAModel.CreateEncapsulatedData();
            otherTestResult.ReportContent.ExternalData = report;

            // Report Date
            otherTestResult.ReportDate = new ISO8601DateTime(DateTime.Now.AddDays(-2));

            return(otherTestResult);
        }
        /// <summary>
        /// Creates and hydrates the 'Other Test Result' text only section.
        /// </summary>
        /// <returns>A hydrated 'OtherTestResult' object.</returns>
        public static OtherTestResult CreateOtherTestResultText()
        {
            var otherTestResult = BaseCDAModel.CreateOtherTestResult();

            // Report Name
            otherTestResult.ReportName = BaseCDAModel.CreateCodableText("Report Name");

            // Report Status
            otherTestResult.ReportStatus = BaseCDAModel.CreateCodableText(HL7ResultStatus.CorrectionToResults);

            // Report Content
            otherTestResult.ReportContent = BaseCDAModel.CreateEncapsulatedData();

            // Report Content
            otherTestResult.ReportContent.Text = "Report Content - Text";

            // Report Date
            otherTestResult.ReportDate = new ISO8601DateTime(DateTimeNow);

            return(otherTestResult);
        }
Exemplo n.º 3
0
        /// <summary>
        /// This method populates an PCML model with either the mandatory sections only, or both
        /// the mandatory and optional sections
        /// </summary>
        /// <param name="mandatorySectionsOnly">mandatorySectionsOnly</param>
        /// <returns>PCML</returns>
        public static Nehta.VendorLibrary.CDA.Common.PCML PopulatePCML_1B(Boolean mandatorySectionsOnly)
        {
            var pharmacyCuratedMedsList = Nehta.VendorLibrary.CDA.Common.PCML.CreatePCML();

            // Include Logo
            pharmacyCuratedMedsList.IncludeLogo = false;

            // Set Creation Time
            pharmacyCuratedMedsList.DocumentCreationTime = new ISO8601DateTime(DateTime.Now);

            #region Setup and populate the CDA context model

            // Setup and populate the CDA context model
            var cdaContext = Nehta.VendorLibrary.CDA.Common.PCML.CreateCDAContext();
            // Document Id
            cdaContext.DocumentId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateOid(), null);

            // Custodian
            cdaContext.Custodian = BaseCDAModel.CreateCustodian();
            GenericObjectReuseSample.HydrateCustodian(cdaContext.Custodian, mandatorySectionsOnly);


            //Optional sections
            // Legal authenticator
            if (!mandatorySectionsOnly)
            {
                // Set Id
                cdaContext.SetId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateOid(), null);
                // CDA Context Version
                cdaContext.Version = "1";

                cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator();
                GenericObjectReuseSample.HydrateAuthenticator(cdaContext.LegalAuthenticator, mandatorySectionsOnly);
            }

            pharmacyCuratedMedsList.CDAContext = cdaContext;
            #endregion

            #region Setup and Populate the SCS Context model
            // Setup and Populate the SCS Context model

            pharmacyCuratedMedsList.SCSContext = Nehta.VendorLibrary.CDA.Common.PCML.CreateSCSContext();

            var authorHealthcareProvider = BaseCDAModel.CreateAuthorHealthcareProvider();
            GenericObjectReuseSample.HydrateAuthorHealthcareProvider(authorHealthcareProvider, mandatorySectionsOnly);
            pharmacyCuratedMedsList.SCSContext.Author = authorHealthcareProvider;

            //Cannot use as a device : prohibited by CORE Level One
            //healthCheckAssessment.SCSContext.Author = GenericObjectReuseSample.CreateAuthorDevice();

            pharmacyCuratedMedsList.SCSContext.Encounter = new Encounter
            {
                HealthcareFacility = PopulateHealthcareFacility(mandatorySectionsOnly)
            };

            pharmacyCuratedMedsList.SCSContext.SubjectOfCare = BaseCDAModel.CreateSubjectOfCare();
            GenericObjectReuseSample.HydrateSubjectofCare(pharmacyCuratedMedsList.SCSContext.SubjectOfCare, mandatorySectionsOnly);



            IParticipationPersonOrOrganisation person = Nehta.VendorLibrary.CDA.Common.PCML.CreateParticipationPersonOrOrganisation();
            person.Participant        = Nehta.VendorLibrary.CDA.Common.PCML.CreateParticipantPersonOrOrganisation();
            person.Role               = BaseCDAModel.CreateRole(HealthcareFacilityTypeCodes.AgedCareResidentialServices);
            person.Participant.Person = BaseCDAModel.CreatePersonWithOrganisation();



            var name1 = BaseCDAModel.CreatePersonName();
            name1.FamilyName = "Grant";
            name1.GivenNames = new List <string> {
                "Sally", "Wally"
            };
            name1.Titles = new List <string> {
                "Miss"
            };
            name1.NameUsages = new List <NameUsage> {
                NameUsage.Legal
            };

            person.Participant.Person.PersonNames = new List <IPersonName> {
                name1
            };

            // Subject of Care > Participant > Person or Organisation or Device > Person > Demographic Data > Sex

            var address1 = BaseCDAModel.CreateAddress();

            address1.AddressPurpose    = AddressPurpose.Residential;
            address1.AustralianAddress = BaseCDAModel.CreateAustralianAddress();

            address1.AustralianAddress.UnstructuredAddressLines = new List <string> {
                "1 Clinician Street"
            };
            address1.AustralianAddress.SuburbTownLocality = "Nehtaville";
            address1.AustralianAddress.State           = AustralianState.NSW;
            address1.AustralianAddress.PostCode        = "5555";
            address1.AustralianAddress.DeliveryPointId = 32568931;

            person.Participant.Addresses = new List <IAddress> {
                address1
            };


            person.Participant.Person.Organisation = BaseCDAModel.CreateEmploymentOrganisation();


            person.Participant.Person.Organisation           = BaseCDAModel.CreateEmploymentOrganisation();
            person.Participant.Person.Organisation.Name      = "Hay Bill Hospital";
            person.Participant.Person.Organisation.NameUsage = OrganisationNameUsage.Other;

            person.Participant.Person.Organisation.Identifiers = new List <Identifier> {
                BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.HPIO, "8003620833333789"),
                //BaseCDAModel.CreateIdentifier("SampleAuthority", null, null, "1.2.3.4.5.66666", null)
            };

            if (!mandatorySectionsOnly)
            {
                //populate with full person details

                // Subject of Care > Participant > Address


                // Subject of Care > Participant > Person or Organisation or Device > Person > Demographic Data > Indigenous Status


                // Subject of Care > Participant > Electronic Communication Detail
                var coms1 = BaseCDAModel.CreateElectronicCommunicationDetail(
                    "0345754566",
                    ElectronicCommunicationMedium.Telephone,
                    ElectronicCommunicationUsage.WorkPlace);
                var coms2 = BaseCDAModel.CreateElectronicCommunicationDetail(
                    "*****@*****.**",
                    ElectronicCommunicationMedium.Email,
                    ElectronicCommunicationUsage.WorkPlace);

                person.Participant.ElectronicCommunicationDetails = new List <ElectronicCommunicationDetail> {
                    coms1, coms2
                };


                // Subject of Care > Participant > Entitlement
                var entitlement1 = BaseCDAModel.CreateEntitlement();
                entitlement1.Id               = BaseCDAModel.CreateMedicareNumber(MedicareNumberType.MedicareCardNumber, "1234567881");
                entitlement1.Type             = EntitlementType.MedicareBenefits;
                entitlement1.ValidityDuration = BaseCDAModel.CreateInterval("1", TimeUnitOfMeasure.Year);

                var entitlement2 = BaseCDAModel.CreateEntitlement();
                entitlement2.Id               = BaseCDAModel.CreateMedicareNumber(MedicareNumberType.MedicareCardNumber, "1234567881");
                entitlement2.Type             = EntitlementType.MedicareBenefits;
                entitlement2.ValidityDuration = BaseCDAModel.CreateInterval("1", TimeUnitOfMeasure.Year);

                person.Participant.Entitlements = new List <Entitlement> {
                    entitlement1, entitlement2
                };
            }


            pharmacyCuratedMedsList.SCSContext.Participant = new List <IParticipationPersonOrOrganisation>();
            pharmacyCuratedMedsList.SCSContext.Participant.Add(person);

            #endregion

            #region Setup and populate the SCS Content model
            // Setup and populate the SCS Content model
            pharmacyCuratedMedsList.SCSContent = Nehta.VendorLibrary.CDA.Common.PCML.CreateSCSContent();

            pharmacyCuratedMedsList.SCSContent.EncapsulatedData = BaseCDAModel.CreateEncapsulatedData();

            ExternalData report1 = EventSummary.CreateExternalData();
            //report1.ExternalDataMediaType = MediaType.PDF;
            //report1.Path = StructuredFileAttachment;
            //report1.Caption = "Attachment One";



            //healthCheckAssessment.SCSContent.EncapsulatedData.ExternalData = report1;
            #endregion

            return(pharmacyCuratedMedsList);
        }
        /// <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);
        }