/// <summary> /// Creates and Hydrates an author /// Note: the data used within this method is intended as a guide and should be replaced. /// </summary> /// <returns>An Hydrated author</returns> public static IParticipationAuthorPerson CreateDocumentAuthor(bool mandatoryOnly) { // Create IParticipationAuthorPerson var author = BaseCDAModel.CreateAuthorPerson(); // Document Author > Participant author.Participant = BaseCDAModel.CreateParticipantForAuthorPerson(); // Create Person var person = BaseCDAModel.CreatePerson(); // Document Author > Participation Period // This element will hold the same value as target Shared Health Summary > Date- Time Attested (ClinicalDocument/ legalAuthenticator/ time) author.AuthorParticipationPeriodOrDateTimeAuthored = BaseCDAModel.CreateParticipationPeriod(new ISO8601DateTime(DateTime.Now, ISO8601DateTime.Precision.Second)); // Document Author > Role author.Role = BaseCDAModel.CreateCodableText(NullFlavour.NotApplicable); // Document Author > Participant > Person or Organisation or Device > Person > Person Name var name = BaseCDAModel.CreatePersonName(); name.FamilyName = "Smith"; // Document Author > Person Names person.PersonNames = new List <IPersonName> { name, name }; var electronicCommunicationDetailPhone = BaseCDAModel.CreateElectronicCommunicationDetail( "0345754566", ElectronicCommunicationMedium.Telephone, ElectronicCommunicationUsage.WorkPlace); var electronicCommunicationDetailEmail = BaseCDAModel.CreateElectronicCommunicationDetail( "*****@*****.**", ElectronicCommunicationMedium.Email, ElectronicCommunicationUsage.WorkPlace); author.Participant.ElectronicCommunicationDetails = new List <ElectronicCommunicationDetail> { electronicCommunicationDetailPhone, electronicCommunicationDetailEmail }; if (!mandatoryOnly) { // Document Author > Participant > Entity Identifier person.Identifiers = new List <Identifier> { BaseCDAModel.CreateIdentifier("Test Authority", null, null, "2.999.1234567890", null), BaseCDAModel.CreateHealthIdentifier(HealthIdentifierType.HPII, "8003615833334118") }; // Document Author > Participant > Address var address = BaseCDAModel.CreateAddress(); address.AddressAbsentIndicator = AddressAbsentIndicator.NoFixedAddressIndicator; address.AddressPurpose = AddressPurpose.Residential; address.AustralianAddress = BaseCDAModel.CreateAustralianAddress(); var addressList = new List <IAddress> { address, address }; author.Participant.Addresses = addressList; name.GivenNames = new List <string> { "Fitun" }; name.Titles = new List <string> { "Dr" }; name.NameUsages = new List <NameUsage> { NameUsage.Legal }; address.AustralianAddress.UnstructuredAddressLines = new List <string> { "1 Clinician Street" }; address.AustralianAddress.SuburbTownLocality = "Nehtaville"; address.AustralianAddress.State = AustralianState.QLD; address.AustralianAddress.PostCode = "5555"; address.AddressAbsentIndicator = null; } author.Participant.Person = person; return(author); }
/// <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); }