/// <summary>
        /// Creates and Hydrates a Service Provider Person
        ///
        /// Note: the data used within this method is intended as a guide and should be replaced.
        /// </summary>
        /// <returns>A Hydrated IParticipationHealthProfessional object</returns>
        private static IParticipationServiceProvider CreateServiceProviderPerson(Boolean mandatorySectionsOnly)
        {
            var serviceProvider = BaseCDAModel.CreateServiceProvider();

            var participant = BaseCDAModel.CreateParticipantForServiceProvider();

            participant.Person = BaseCDAModel.CreatePersonHealthcareProvider();

            var personName = BaseCDAModel.CreatePersonName();

            personName.FamilyName = "Anderson";
            personName.GivenNames = new List <string> {
                "Jane"
            };
            personName.Titles = new List <string> {
                "Dr"
            };
            personName.NameUsages = new List <NameUsage> {
                NameUsage.Legal
            };
            participant.Person.Identifiers = new List <Identifier> {
                BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.HPII, "8003610000001145")
            };
            participant.Person.PersonNames = new List <IPersonName> {
                personName
            };

            var electronicCommunicationDetail1 = BaseCDAModel.CreateElectronicCommunicationDetail("0345754566", ElectronicCommunicationMedium.Telephone, ElectronicCommunicationUsage.WorkPlace);
            var electronicCommunicationDetail2 = BaseCDAModel.CreateElectronicCommunicationDetail("*****@*****.**", ElectronicCommunicationMedium.Email, ElectronicCommunicationUsage.WorkPlace);

            participant.ElectronicCommunicationDetails = new List <ElectronicCommunicationDetail>
            {
                electronicCommunicationDetail1,
                electronicCommunicationDetail2
            };

            var address = BaseCDAModel.CreateAddress();

            address.AddressPurpose    = AddressPurpose.Business;
            address.AustralianAddress = BaseCDAModel.CreateAustralianAddress();
            address.AustralianAddress.UnstructuredAddressLines = new List <string>
            {
                "1 Clinician Street"
            };
            address.AustralianAddress.SuburbTownLocality = "Nehtaville";
            address.AustralianAddress.State    = AustralianState.QLD;
            address.AustralianAddress.PostCode = "5555";

            serviceProvider.Role = !mandatorySectionsOnly?BaseCDAModel.CreateRole(Occupation.GeneralMedicalPractitioner) : BaseCDAModel.CreateRole(NullFlavour.NegativeInfinity);

            participant.Addresses = new List <IAddress>
            {
                address,
                address
            };

            var entitlement = BaseCDAModel.CreateEntitlement();

            entitlement.Id                  = BaseCDAModel.CreatePrescriberNumber(IdentifierType.PrescriberNumber, "049960CT");
            entitlement.Type                = EntitlementType.MedicarePrescriberNumber;
            entitlement.ValidityDuration    = BaseCDAModel.CreateHigh(new ISO8601DateTime(DateTime.Now.AddMonths(15), ISO8601DateTime.Precision.Day));
            participant.Person.Entitlements = new List <Entitlement> {
                entitlement, entitlement
            };

            participant.Person.Qualifications = "M.B.B.S., F.R.A.C.S.";

            participant.Person.Organisation             = BaseCDAModel.CreateEmploymentOrganisation();
            participant.Person.Organisation.Name        = "Hay Bill Hospital (ServiceProviderPerson)";
            participant.Person.Organisation.NameUsage   = OrganisationNameUsage.Other;
            participant.Person.Organisation.Identifiers = new List <Identifier> {
                BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.HPIO, "8003620000045562")
            };
            participant.Person.Organisation.Department             = "Some department service provider";
            participant.Person.Organisation.EmploymentType         = BaseCDAModel.CreateCodableText(EmploymentType.Casual);
            participant.Person.Organisation.Occupation             = BaseCDAModel.CreateRole(Occupation.GeneralMedicalPractitioner);
            participant.Person.Organisation.PositionInOrganisation = BaseCDAModel.CreateCodableText("Service Provider Manager");
            participant.Person.Organisation.Addresses = new List <IAddress> {
                address
            };
            participant.Person.Organisation.ElectronicCommunicationDetails = new List <ElectronicCommunicationDetail>()
            {
                electronicCommunicationDetail1, electronicCommunicationDetail2
            };

            serviceProvider.Participant = participant;

            return(serviceProvider);
        }
コード例 #2
0
        /// <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>
        /// Creates and Hydrates an SubjectofCare
        /// Note: the data used within this method is intended as a guide and should be replaced.
        /// </summary>
        /// <returns>A Hydrated SubjectofCare</returns>
        public static void HydrateSubjectofCare(IParticipationSubjectOfCare subjectOfCare, bool mandatoryOnly)
        {
            var participant = BaseCDAModel.CreateParticipantForSubjectOfCare();

            // Subject of Care > Participant > Person or Organisation or Device > Person
            var person = BaseCDAModel.CreatePersonForSubjectOfCare();

            // Subject of Care > Participant > Address
            var address = BaseCDAModel.CreateAddress();

            address.AustralianAddress = BaseCDAModel.CreateAustralianAddress();
            participant.Addresses     = new List <IAddress> {
                address, address
            };
            //address.AddressAbsentIndicator = AddressAbsentIndicator.NotIndicated;
            //participant.Addresses = new List<IAddress> { address };

            // Subject of Care > Participant > Person or Organisation or Device > Person > Demographic Data > Sex
            person.Gender = Gender.Male;

            // Subject of Care > Participant > Person or Organisation or Device > Person > Demographic Data > Date of Birth Detail >
            // Date of Birth
            person.DateOfBirth = new ISO8601DateTime(DateTime.Now.AddYears(-57));

            // Subject of Care > Participant > Person or Organisation or Device > Person > Demographic Data > Indigenous Status
            person.IndigenousStatus = IndigenousStatus.NeitherAboriginalNorTorresStraitIslanderOrigin;

            // Subject of Care > Participant > Entity Identifier
            person.Identifiers = new List <Identifier>
            {
                BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.IHI, "8003608666701594"),
                BaseCDAModel.CreateMedicalRecordNumber("123456", "1.2.3.4", "Croydon GP Centre"),

                // NOTE : ONLY 11 digit Individual Medicare Card Number's is permitted in the Entity Identifier
                BaseCDAModel.CreateIndividualMedicareNumber("59501704511"),
            };

            // Subject of Care > Participant > Person or Organisation or Device > Person > Person Name
            var name1 = BaseCDAModel.CreatePersonName();

            name1.FamilyName = "Harding";

            var name2 = BaseCDAModel.CreatePersonName();

            name2.FamilyName = "Harding";

            person.PersonNames = new List <IPersonName> {
                name1, name2
            };

            if (!mandatoryOnly)
            {
                address.AddressPurpose = AddressPurpose.Residential;

                name1.GivenNames = new List <string> {
                    "Frank", "Troy"
                };
                name1.Titles = new List <string> {
                    "Mr"
                };
                name1.NameUsages = new List <NameUsage> {
                    NameUsage.Legal
                };

                name2.GivenNames = new List <string> {
                    "Frank", "Tobie"
                };
                name2.Titles = new List <string> {
                    "Mr"
                };
                name2.NameUsages = new List <NameUsage> {
                    NameUsage.Legal
                };

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

                var coms2 = BaseCDAModel.CreateElectronicCommunicationDetail(
                    "*****@*****.**",
                    ElectronicCommunicationMedium.Email,
                    ElectronicCommunicationUsage.WorkPlace);

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

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

                person.DateOfBirthCalculatedFromAge = true;
                person.DateOfBirthAccuracyIndicator = new DateAccuracyIndicator(true, true, true);
                person.Age = 54;
                person.AgeUnitOfMeasure = AgeUnitOfMeasure.Year;

                person.AgeAccuracyIndicator = true;
                person.BirthPlurality       = 3;
                person.BirthOrder           = 2;

                // DateOfDeath & DateOfDeathAccuracyIndicator is not permitted in ACI so set to null in AdvanceCareInformationSample.cs.
                person.DateOfDeath = new ISO8601DateTime(DateTime.Now, ISO8601DateTime.Precision.Day);
                person.DateOfDeathAccuracyIndicator = new DateAccuracyIndicator(true, true, true);
                person.SourceOfDeathNotification    = SourceOfDeathNotification.Relative;

                person.CountryOfBirth = Country.Australia;
                person.StateOfBirth   = AustralianState.QLD;

                var mothersOriginalFamilyName = BaseCDAModel.CreatePersonName();
                mothersOriginalFamilyName.FamilyName = "Jones";

                // Subject of Care > Participant > Person or Organisation or Device > Person > Mothers Original Family Name
                person.MothersOriginalFamilyName = mothersOriginalFamilyName;

                // Subject of Care > Participant > Entitlement
                var entitlement1 = BaseCDAModel.CreateEntitlement();
                entitlement1.Id               = BaseCDAModel.CreateMedicareNumber(MedicareNumberType.MedicareCardNumber, "1234567881");
                entitlement1.Type             = EntitlementType.MedicareBenefits;
                entitlement1.ValidityDuration = BaseCDAModel.CreateHigh(new ISO8601DateTime(DateTime.Now.AddMonths(15), ISO8601DateTime.Precision.Day));

                var entitlement2 = BaseCDAModel.CreateEntitlement();
                entitlement2.Id               = BaseCDAModel.CreateMedicareNumber(MedicareNumberType.MedicareCardNumber, "1234567881");
                entitlement2.Type             = EntitlementType.MedicareBenefits;
                entitlement2.ValidityDuration = BaseCDAModel.CreateHigh(new ISO8601DateTime(DateTime.Now.AddMonths(15), ISO8601DateTime.Precision.Day));

                participant.Entitlements = new List <Entitlement> {
                    entitlement1, entitlement2
                };
            }
            else
            {
                address.AddressAbsentIndicator = AddressAbsentIndicator.NoFixedAddressIndicator;
            }

            participant.Person        = person;
            subjectOfCare.Participant = participant;
        }