Ejemplo n.º 1
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);
        }