Example #1
0
        public static ApsDocument CreateApsDocument(CdaSource cdaSource)
        {
            // *** Creates the APS document ***

            ApsDocument aps = new ApsDocument();

            // *** Set id ***
            Guid tempGuid = new Guid(cdaSource.DocumentId);

            aps.DocumentId = tempGuid.ToString();

            // *** Create Record Target Section ***
            aps.RecordTarget = CdaSectionFactory.CreateRecordTarget(cdaSource.VprData.Demographics);

            // *** Add provider organization to record target ***
            aps.RecordTarget.ProviderOrganization = CdaSectionFactory.CreateProviderOrganization(cdaSource.VprData.Demographics, cdaSource.ProviderOrganizationPhone);

            // *** Create Author ***
            aps.Author = CdaSectionFactory.CreateAuthor(cdaSource.VprData);

            // *** Information Recipient ***
            aps.Recipient              = new CdaRecipient();
            aps.Recipient.FirstName    = cdaSource.Options.IntendedRecipientFirstName;
            aps.Recipient.LastName     = cdaSource.Options.IntendedRecipientLastName;
            aps.Recipient.Organization = cdaSource.Options.IntendedRecipientOrganization;

            // *** Participants ***
            //aphp.Participants = CreateParticipants(cdaSource.VprData);

            // *** Custodian ***
            aps.Custodian = CdaSectionFactory.CreateCustodian(aps.RecordTarget.ProviderOrganization);

            // *** Documentation Of ***
            aps.DocumentationOf = CdaSectionFactory.CreateDocumentationOf();

            // *** Allergies ***
            aps.Allergies = CdaSectionFactory.CreateAllergiesSection(cdaSource.VprData.Reactions);

            CdaAllergy latexAllergy = CdaObservationFactory.CreateLatexAllergy(cdaSource.Observations);

            if (latexAllergy != null)
            {
                aps.Allergies.Allergies.Add(latexAllergy);
            }

            // *** Advance Directves ***
            aps.AdvanceDirectiveSection = CdaSectionFactory.CreateAdvanceDirectivesSection(cdaSource.Observations);

            // *** Care Plan ***
            aps.CarePlanSection = CdaSectionFactory.CreateApsCarePlanSection(cdaSource.Observations);

            // *** Problems ***
            aps.ProblemsSection = CdaSectionFactory.CreateProblemsSection(cdaSource.Observations, cdaSource.VprData.Problems);

            // *** Meds ***
            aps.MedicationsSection = CdaSectionFactory.CreateMedicationSection(cdaSource.VprData.Meds);

            // *** EDD ***
            aps.EstimatedDeliveryDatesSection = CdaSectionFactory.CreateEddSection(cdaSource.Observations);

            // *** Antepartum Visit Summary ***
            aps.AntepartumVisitSummarySection = CdaSectionFactory.CreateVisitSummarySection(cdaSource.Observations);

            return(aps);
        }