/// <summary>
        /// Creates a Related Document.
        /// </summary>
        /// <returns>RelatedDocument</returns>
        public static RelatedDocument CreateRelatedDocument(Boolean mandatorySectionsOnly)
        {
            // Related Document
            RelatedDocument relatedDocument = PathologyReportWithStructuredContent.CreateRelatedDocument();

            // Examination Result Representation
            relatedDocument.ExaminationResultRepresentation = BaseCDAModel.CreateExternalData(MediaType.PDF, AttachmentFileNameAndPath, null);;

            // Document Provenance
            relatedDocument.DocumentDetails = CreateDocumentProvenance(mandatorySectionsOnly);

            return(relatedDocument);
        }
        /// <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 IParticipationReportingPathologist CreateReportingPathologist(Boolean mandatoryOnly)
        {
            // Receiving Laboratory
            var reportingPathologist = PathologyReportWithStructuredContent.CreateReportingPathologist();

            // Document reportingPathologist > Participant
            reportingPathologist.Participant = PathologyReportWithStructuredContent.CreateParticipantForReportingPathologist();

            var person = BaseCDAModel.CreatePersonWithOrganisation();

            // Participation Period
            reportingPathologist.ParticipationEndTime = new ISO8601DateTime(DateTime.Now);

            // Document reportingPathologist > Role
            reportingPathologist.Role = PathologyReportWithStructuredContent.CreateRole(Occupation.Pathologist);

            // Document reportingPathologist > Participant > Person or Organisation or Device > Person > Person Name
            var name = BaseCDAModel.CreatePersonName();

            name.FamilyName = "Healthy";

            person.PersonNames = new List <IPersonName> {
                name
            };

            // 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;

            // 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
            };

            // Participant > Entitlement
            var entitlement = BaseCDAModel.CreateEntitlement();
            var code        = BaseCDAModel.CreateCodableText("11", CodingSystem.NCTISEntitlementTypeValues, "Medicare Pharmacy Approval Number", null, null);

            entitlement.Id = BaseCDAModel.CreateIdentifier("Pharmacy",
                                                           null,
                                                           "1234567892",
                                                           "1.2.36.174030967.1.3.2.1",
                                                           code);

            entitlement.Type             = EntitlementType.MedicarePharmacyApprovalNumber;
            entitlement.ValidityDuration = BaseCDAModel.CreateInterval("1", TimeUnitOfMeasure.Year);

            reportingPathologist.Participant.Entitlements = new List <Entitlement> {
                entitlement, entitlement
            };

            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             = PathologyReportWithStructuredContent.CreateRole(Occupation.GeneralMedicalPractitioner);
            person.Organisation.PositionInOrganisation = BaseCDAModel.CreateCodableText(null, null, null, "Manager", null);

            person.Organisation.Identifiers = new List <Identifier> {
                BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.HPIO, "8003620833333789"),
                BaseCDAModel.CreateIdentifier("NATA", null, "3715", "1.2.36.1.2001.1005.12", BaseCDAModel.CreateCodableText("XX", CodingSystem.HL7IdentifierType, "Organization identifier"))
            };

            // Document reportingPathologist > Participant > Entity Identifier
            person.Identifiers = new List <Identifier> {
                BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.HPII, "8003615833334118"),
            };

            if (!mandatoryOnly)
            {
                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>
        /// This sample populates both the mandatory and optional Sections / Entries depending on the
        /// mandatorySectionsOnly Boolean
        /// </summary>
        internal static PathologyReportWithStructuredContent PopulatedPathologyReportWithStructuredContent(Boolean mandatorySectionsOnly)
        {
            var pathologyReportWithStructuredContent = PathologyReportWithStructuredContent.CreatePathologyReportWithStructuredContent();

            // Include Logo
            pathologyReportWithStructuredContent.IncludeLogo = true;
            pathologyReportWithStructuredContent.LogoPath    = OutputFolderPath;

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

            #region Setup and populate the CDA context model

            // Setup and populate the CDA context model
            var cdaContext = PathologyReportWithStructuredContent.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);

            pathologyReportWithStructuredContent.CDAContext = cdaContext;

            #endregion

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

            pathologyReportWithStructuredContent.SCSContext = PathologyReportWithStructuredContent.CreateSCSContext();

            // Author Health Care Provider
            pathologyReportWithStructuredContent.SCSContext.Author = BaseCDAModel.CreateAuthorHealthcareProvider();
            GenericObjectReuseSample.HydrateAuthorHealthcareProvider(pathologyReportWithStructuredContent.SCSContext.Author, "Pathology Queensland", mandatorySectionsOnly);

            if (!mandatorySectionsOnly)
            {
                // The Reporting Pathologist
                pathologyReportWithStructuredContent.SCSContext.ReportingPathologist = CreateReportingPathologist(mandatorySectionsOnly);
            }

            // Order Details
            pathologyReportWithStructuredContent.SCSContext.OrderDetails = CreateOrderDetails(mandatorySectionsOnly);

            // Subject Of Care
            pathologyReportWithStructuredContent.SCSContext.SubjectOfCare = BaseCDAModel.CreateSubjectOfCare();
            GenericObjectReuseSample.HydrateSubjectofCare(pathologyReportWithStructuredContent.SCSContext.SubjectOfCare, mandatorySectionsOnly);

            #endregion

            #region Setup and populate the SCS Content model
            // Setup and populate the SCS Content model
            pathologyReportWithStructuredContent.SCSContent = PathologyReportWithStructuredContent.CreateSCSContent();

            // Pathology Test Result
            pathologyReportWithStructuredContent.SCSContent.PathologyTestResult = new List <PathologyTestResult>
            {
                CreatePathologyResults(mandatorySectionsOnly),
                CreatePathologyResults(mandatorySectionsOnly)
            };

            // Related Document
            pathologyReportWithStructuredContent.SCSContent.RelatedDocument = CreateRelatedDocument(mandatorySectionsOnly);

            #endregion

            return(pathologyReportWithStructuredContent);
        }