Exemplo n.º 1
0
        /// <summary>
        /// Creates and Hydrates an Participation Dispenser(IParticipationDispenser).
        ///
        /// Note: the data used within this method is intended as a guide and should be replaced.
        /// </summary>
        /// <param name="mandatorySectionsOnly">Only show mandatory fields</param>
        /// <param name="dispenserId">The identifier of the dispenser</param>
        /// <returns>A Hydrated IParticipationDispenser </returns>
        internal static IParticipationDispenser CreateDispenser(Boolean mandatorySectionsOnly, Guid dispenserId)
        {
            var dispenser = BaseCDAModel.CreateDispenser();

            dispenser.Participant = BaseCDAModel.CreateParticipantForDispenser();
            dispenser.Participant.UniqueIdentifier = dispenserId;

            dispenser.Role = BaseCDAModel.CreateRole(Occupation.HospitalPharmacist);

            // Date Time Authored
            dispenser.Time = new ISO8601DateTime(DateTime.Now);

            // Person
            dispenser.Participant.Person = BaseCDAModel.CreatePersonForDispenser();

            // Dispenser > Participant > Entity Identifier
            dispenser.Participant.Person.Identifiers = new List <Identifier> {
                BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.HPII, "8003615833334118")
            };

            //LegalAuthenticator/assignedEntity/assignedPerson/<Person Name>
            var name1 = BaseCDAModel.CreatePersonName();

            name1.GivenNames = new List <string> {
                "Good"
            };
            name1.FamilyName = "Doctor";
            name1.Titles     = new List <string> {
                "Doctor"
            };
            name1.NameUsages = new List <NameUsage> {
                NameUsage.Legal
            };

            var name2 = BaseCDAModel.CreatePersonName();

            name2.GivenNames = new List <string> {
                "Davey"
            };
            name2.FamilyName = "Wong";
            name2.Titles     = new List <string> {
                "Brother"
            };
            name2.NameUsages = new List <NameUsage> {
                NameUsage.NewbornName
            };

            dispenser.Participant.Person.PersonNames = new List <IPersonName> {
                name1, name2
            };

            if (!mandatorySectionsOnly)
            {
                // Dispenser > Participant > Address
                var address1 = BaseCDAModel.CreateAddress();
                address1.AddressPurpose    = AddressPurpose.Business;
                address1.AustralianAddress = BaseCDAModel.CreateAustralianAddress();
                address1.AustralianAddress.UnstructuredAddressLines = new List <string> {
                    "1 Clinician Street"
                };
                address1.AustralianAddress.SuburbTownLocality = "Nehtaville";
                address1.AustralianAddress.State           = AustralianState.QLD;
                address1.AustralianAddress.PostCode        = "5555";
                address1.AustralianAddress.DeliveryPointId = 32568931;

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

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

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

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

                dispenser.Participant.Person.Qualifications = "M.B.B.S., F.R.A.C.S.";
            }

            return(dispenser);
        }