예제 #1
0
        /// <summary>
        /// This method populates an consumerEnteredNotes model with either the mandatory sections only, or both
        /// the mandatory and optional sections
        /// </summary>
        /// <param name="mandatorySectionsOnly">mandatorySectionsOnly</param>
        /// <returns>ConsumerEnteredNotes</returns>
        public static ConsumerEnteredNotes PopulateConsumerEnteredNotes(Boolean mandatorySectionsOnly)
        {
            var consumerEnteredNotes = ConsumerEnteredNotes.CreateConsumerEnteredNotes();

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

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

            #region Setup and populate the CDA context model

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

            // Legal authenticator
            if (!mandatorySectionsOnly)
            {
                cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator();
                GenericObjectReuseSample.HydrateAuthenticator(cdaContext.LegalAuthenticator, mandatorySectionsOnly);
            }

            consumerEnteredNotes.CDAContext = cdaContext;
            #endregion

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

            consumerEnteredNotes.SCSContext = ConsumerEnteredNotes.CreateSCSContext();

            consumerEnteredNotes.SCSContext.Author = ConsumerEnteredNotes.CreateAuthor();
            PopulateAuthor(consumerEnteredNotes.SCSContext.Author, mandatorySectionsOnly);

            consumerEnteredNotes.SCSContext.SubjectOfCare = PopulateSubjectofCare(mandatorySectionsOnly);

            #endregion

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

            consumerEnteredNotes.SCSContent.Title       = "My Health Summary";
            consumerEnteredNotes.SCSContent.Description = "I have been really healthy all my life.";

            #endregion

            return(consumerEnteredNotes);
        }
        /// <summary>
        /// This method populates a specialistLetter
        /// </summary>
        /// <param name="mandatorySectionsOnly">mandatorySectionsOnly</param>
        /// <returns>SpecialistLetter</returns>
        internal static SpecialistLetter PopulateSpecialistLetter(Boolean mandatorySectionsOnly)
        {
            var specialistLetter = SpecialistLetter.CreateSpecialistLetter();

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

            // Include Logo
            specialistLetter.IncludeLogo = true;

            #region Setup and populate the CDA context model

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

            // Legal authenticator
            if (!mandatorySectionsOnly)
            {
                cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator();
                GenericObjectReuseSample.HydrateAuthenticator(cdaContext.LegalAuthenticator, mandatorySectionsOnly);
            }

            // Create information recipient
            if (!mandatorySectionsOnly)
            {
                var recipient1 = BaseCDAModel.CreateInformationRecipient();
                var recipient2 = BaseCDAModel.CreateInformationRecipient();
                GenericObjectReuseSample.HydrateRecipient(recipient1, RecipientType.Primary, mandatorySectionsOnly);
                GenericObjectReuseSample.HydrateRecipient(recipient2, RecipientType.Secondary, mandatorySectionsOnly);
                cdaContext.InformationRecipients = new List <IParticipationInformationRecipient> {
                    recipient1, recipient2
                };
            }

            specialistLetter.CDAContext = cdaContext;

            #endregion

            #region Setup and Populate the SCS Context model

            specialistLetter.SCSContext = SpecialistLetter.CreateSCSContext();

            specialistLetter.SCSContext.Author = BaseCDAModel.CreateAuthor();
            GenericObjectReuseSample.HydrateAuthor(specialistLetter.SCSContext.Author, mandatorySectionsOnly);

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

            specialistLetter.SCSContext.DateTimeSubjectSeen = new ISO8601DateTime(DateTime.Now);

            if (!mandatorySectionsOnly)
            {
                specialistLetter.SCSContext.Referrer = CreateReferrer(mandatorySectionsOnly);
                specialistLetter.SCSContext.UsualGP  = CreateUsualGPPerson(mandatorySectionsOnly);
            }
            #endregion

            #region Setup and populate the SCS Content model

            specialistLetter.SCSContent = SpecialistLetter.CreateSCSContent();

            // Response details
            specialistLetter.SCSContent.ResponseDetails = CreateResponseDetails(mandatorySectionsOnly);

            // Recommendations
            specialistLetter.SCSContent.Recommendations = CreateRecommendations(mandatorySectionsOnly);

            // Medications
            specialistLetter.SCSContent.Medications = CreateMedications(mandatorySectionsOnly);

            if (!mandatorySectionsOnly)
            {
                // Adverse reactions
                specialistLetter.SCSContent.AdverseReactions = CreateAdverseReactions();

                // Diagnostic Investigations
                specialistLetter.SCSContent.DiagnosticInvestigations = CreateDiagnosticInvestigations(mandatorySectionsOnly);
            }

            #endregion

            return(specialistLetter);
        }
예제 #3
0
        /// <summary>
        /// This method populates an consumerEnteredHealthSummary model with either the mandatory sections only, or both
        /// the mandatory and optional sections
        /// </summary>
        /// <param name="mandatorySectionsOnly">mandatorySectionsOnly</param>
        /// <returns>ConsumerEnteredHealthSummary</returns>
        public static ConsumerEnteredHealthSummary PopulateConsumerEnteredHealthSummary(Boolean mandatorySectionsOnly)
        {
            var consumerEnteredHealthSummary = ConsumerEnteredHealthSummary.CreateConsumerEnteredHealthSummary();

            // Include Logo
            consumerEnteredHealthSummary.IncludeLogo = true;

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

            #region Setup and populate the CDA context model

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

            // Legal authenticator
            if (!mandatorySectionsOnly)
            {
                cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator();
                GenericObjectReuseSample.HydrateAuthenticator(cdaContext.LegalAuthenticator, mandatorySectionsOnly);
            }

            consumerEnteredHealthSummary.CDAContext = cdaContext;
            #endregion

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

            consumerEnteredHealthSummary.SCSContext = ConsumerEnteredHealthSummary.CreateSCSContext();

            consumerEnteredHealthSummary.SCSContext.Author = ConsumerEnteredHealthSummary.CreateAuthor();
            PopulateAuthor(consumerEnteredHealthSummary.SCSContext.Author, mandatorySectionsOnly);

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

            #endregion

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

            // Allergies And Adverse Reactions
            consumerEnteredHealthSummary.SCSContent.AllergiesAndAdverseReactions = CreateAllergiesAndAdverseReactions(mandatorySectionsOnly);

            // Medications
            consumerEnteredHealthSummary.SCSContent.Medications = CreateMedications(mandatorySectionsOnly);

            #endregion

            return(consumerEnteredHealthSummary);
        }
예제 #4
0
        /// <summary>
        /// This method populates a shared health summary model with either the mandatory sections only, or both
        /// the mandatory and optional sections
        /// </summary>
        /// <param name="mandatorySectionsOnly">mandatorySectionsOnly</param>
        /// <returns>SharedHealthSummary</returns>
        internal static SharedHealthSummary PopulateSharedHealthSummary(Boolean mandatorySectionsOnly)
        {
            var sharedHealthSummary = SharedHealthSummary.CreateSharedHealthSummary(DocumentStatus.Final);

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

            // Set Creation Time
            sharedHealthSummary.DocumentCreationTime = new ISO8601DateTime(DateTime.Now, ISO8601DateTime.Precision.Second);

            #region Setup and populate the CDA context model

            // Setup and populate the CDA context model
            var cdaContext = SharedHealthSummary.CreateCDAContext();

            // Document Id
            cdaContext.DocumentId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateOid());

            // CDA Context Version
            if (!mandatorySectionsOnly)
            {
                // Version
                cdaContext.Version = "1";

                // Set Id
                cdaContext.SetId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateGuid());
            }

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

            sharedHealthSummary.ShowAdministrativeObservationsSection = !mandatorySectionsOnly;

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

            sharedHealthSummary.CDAContext = cdaContext;

            #endregion

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

            sharedHealthSummary.SCSContext = SharedHealthSummary.CreateSCSContext();

            sharedHealthSummary.SCSContext.Author = BaseCDAModel.CreateAuthor();
            GenericObjectReuseSample.HydrateAuthorV2(sharedHealthSummary.SCSContext.Author, mandatorySectionsOnly);

            // Subject of Care
            sharedHealthSummary.SCSContext.SubjectOfCare = BaseCDAModel.CreateSubjectOfCare();
            GenericObjectReuseSample.HydrateSubjectofCare(sharedHealthSummary.SCSContext.SubjectOfCare, mandatorySectionsOnly, true);

            #endregion

            #region Setup and populate the SCS Content model
            // Setup and populate the SCS Content model

            sharedHealthSummary.SCSContent = SharedHealthSummary.CreateSCSContent();

            // Adverse reactions
            sharedHealthSummary.SCSContent.AdverseReactions = CreateAdverseReactions(mandatorySectionsOnly);

            // Reviewed medications
            sharedHealthSummary.SCSContent.Medications = CreateMedications(mandatorySectionsOnly);

            // Reviewed medical history
            sharedHealthSummary.SCSContent.MedicalHistory = CreateMedicalHistory(mandatorySectionsOnly);

            // Reviewed Immunizations
            sharedHealthSummary.SCSContent.Immunisations = CreateImmunisations(mandatorySectionsOnly);

            #endregion

            return(sharedHealthSummary);
        }
        /// <summary>
        /// This method populates an acdCustodianRecord model with either the mandatory sections only, or both
        /// the mandatory and optional sections
        /// </summary>
        /// <param name="mandatorySectionsOnly">mandatorySectionsOnly</param>
        /// <returns>AcdCustodianRecord</returns>
        public static AcdCustodianRecord PopulateAcdCustodianRecord(Boolean mandatorySectionsOnly)
        {
            var acdCustodianRecord = AcdCustodianRecord.CreateAcdCustodianRecord();

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

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

            #region Setup and populate the CDA context model

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

            // Legal authenticator
            if (!mandatorySectionsOnly)
            {
                cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator();
                GenericObjectReuseSample.HydrateAuthenticator(cdaContext.LegalAuthenticator, mandatorySectionsOnly);
            }

            acdCustodianRecord.CDAContext = cdaContext;
            #endregion

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

            acdCustodianRecord.SCSContext = AcdCustodianRecord.CreateSCSContext();

            acdCustodianRecord.SCSContext.Author = BaseCDAModel.CreateAuthor();
            GenericObjectReuseSample.HydrateAuthor(acdCustodianRecord.SCSContext.Author, mandatorySectionsOnly);

            // If only mandatory sections are required, then remove person employment
            if (mandatorySectionsOnly)
            {
                acdCustodianRecord.SCSContext.Author.Participant.Person.Organisation = null;
            }

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

            #endregion

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

            // ACD Custodian Record
            acdCustodianRecord.SCSContent.AcdCustodians = CreateAcdCustodians(mandatorySectionsOnly);

            #endregion

            return(acdCustodianRecord);
        }
예제 #6
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);
        }