/// <summary>
        /// This sample populates both the mandatory and optional Sections / Entries; as a result this sample
        /// includes all of the sections within the body and each section includes at least one example for
        /// each of its optional entries.
        /// </summary>
        public XmlDocument MaxPopulatedSpecialistLetterSample(string fileName)
        {
            XmlDocument xmlDoc = null;

            var specialistLetter = PopulateSpecialistLetter(false);

            try
            {
                CDAGenerator.NarrativeGenerator = new CDANarrativeGenerator();

                //Pass the E-Referral model into the GenerateSpecialistLetter method
                xmlDoc = CDAGenerator.GenerateSpecialistLetter(specialistLetter);

                using (var writer = XmlWriter.Create(OutputFolderPath + @"\" + fileName, new XmlWriterSettings()
                {
                    Indent = true
                }))
                {
                    if (!fileName.IsNullOrEmptyWhitespace())
                    {
                        xmlDoc.Save(writer);
                    }
                }
            }
            catch (ValidationException ex)
            {
                //Catch any validation exceptions
                var validationMessages = ex.GetMessagesString();

                //Handle any validation errors as appropriate.
                throw;
            }

            return(xmlDoc);
        }
        /// <summary>
        /// This sample populates only the mandatory sections / entries
        /// </summary>
        public XmlDocument MinPopulatedAdvanceCareInformation(string fileName, AuthorType authorType)
        {
            XmlDocument xmlDoc = null;

            var advanceCareInformation = PopulatedAdvanceCareInformation(true, authorType);

            try
            {
                CDAGenerator.NarrativeGenerator = new CDANarrativeGenerator();

                //Pass the Event Summary model into the GenerateAdvanceCareInformation method
                xmlDoc = CDAGenerator.GenerateAdvanceCareInformation(advanceCareInformation);

                using (var writer = XmlWriter.Create(OutputFolderPath + @"\" + fileName, new XmlWriterSettings {
                    Indent = true
                }))
                {
                    if (!fileName.IsNullOrEmptyWhitespace())
                    {
                        xmlDoc.Save(writer);
                    }
                }
            }
            catch (ValidationException ex)
            {
                //Catch any validation exceptions
                var validationMessages = ex.GetMessagesString();

                //Handle any validation errors as appropriate.
                throw;
            }

            return(xmlDoc);
        }
        /// <summary>
        /// This sample populates only the mandatory sections / entries
        /// </summary>
        public XmlDocument MinPopulatedPathologyResultReport(string fileName)
        {
            XmlDocument xmlDoc;

            var ePathologyResultReport = PopulatedPathologyResultReport(true);

            try
            {
                CDAGenerator.NarrativeGenerator = new CDANarrativeGenerator();

                //Pass the Event Summary model into the GeneratePathologyResultReport method
                xmlDoc = CDAGenerator.GeneratePathologyResultReport(ePathologyResultReport);

                using (var writer = XmlWriter.Create(OutputFolderPath + @"\" + fileName, new XmlWriterSettings {
                    Indent = true
                }))
                {
                    if (!fileName.IsNullOrEmptyWhitespace())
                    {
                        xmlDoc.Save(writer);
                    }
                }
            }
            catch (ValidationException ex)
            {
                //Catch any validation exceptions
                var validationMessages = ex.GetMessagesString();

                //Handle any validation errors as appropriate.
                throw;
            }

            return(xmlDoc);
        }
Пример #4
0
        /// <summary>
        /// This sample populates both the mandatory and optional Sections / Entries; as a result this sample
        /// includes all of the sections within the body and each section includes at least one example for
        /// each of its optional entries.
        /// </summary>
        public XmlDocument MaxPopulatedPCMLAuthorHealthcareProviderSample_1A(string fileName)
        {
            XmlDocument xmlDoc = null;

            var PCML = PopulatePCML_1A(false);

            try
            {
                CDAGenerator.NarrativeGenerator = new CDANarrativeGenerator();

                //Pass the Child Parent Questionnaire model into the GeneratePCML method
                xmlDoc = CDAGenerator.GeneratePCML(PCML);

                using (var writer = XmlWriter.Create(OutputFolderPath + @"\" + fileName, new XmlWriterSettings {
                    Indent = true
                }))
                {
                    if (!fileName.IsNullOrEmptyWhitespace())
                    {
                        xmlDoc.Save(writer);
                    }
                }
            }
            catch (ValidationException ex)
            {
                //Catch any validation exceptions
                var validationMessages = ex.GetMessagesString();

                //Handle any validation errors as appropriate.
                throw;
            }

            return(xmlDoc);
        }
Пример #5
0
        /// <summary>
        /// This example populates only the mandatory Sections / Entries; as a result this sample omits all
        /// of the content within the body of the CDA document; as each of the sections within the body
        /// are optional.
        /// </summary>
        public XmlDocument PopulatedPCMLSample()
        {
            XmlDocument xmlDoc = null;

            var PCML = PopulatePCML_1A(true);

            try
            {
                CDAGenerator.NarrativeGenerator = new CDANarrativeGenerator();

                xmlDoc = CDAGenerator.GeneratePCML(PCML);

                xmlDoc.Save(OutputFileNameAndPath);
            }
            catch (ValidationException ex)
            {
                //Catch any validation exceptions
                Console.WriteLine(ex.Messages);

                //Handle any validation errors as appropriate.
                throw;
            }

            return(xmlDoc);
        }
Пример #6
0
        /// <summary>
        /// This sample populates both the mandatory and optional Sections / Entries; as a result this sample
        /// includes all of the sections within the body and each section includes at least one example for
        /// each of its optional entries
        /// </summary>
        public XmlDocument MaxPopulatedSharedHealthSummarySample(string fileName)
        {
            XmlDocument xmlDoc;

            var sharedHealthSummary = PopulateSharedHealthSummary(false);

            try
            {
                //Pass the Shared health Summary model into the GenerateSharedHealthSummary method
                xmlDoc = CDAGenerator.GenerateSharedHealthSummary(sharedHealthSummary);

                using (var writer = XmlWriter.Create(OutputFolderPath + @"\" + fileName, new XmlWriterSettings {
                    Indent = true
                }))
                {
                    if (!fileName.IsNullOrEmptyWhitespace())
                    {
                        xmlDoc.Save(writer);
                    }
                }
            }
            catch (ValidationException ex)
            {
                //Catch any validation exceptions
                var validationMessages = ex.GetMessagesString();

                //Handle any validation errors as appropriate.
                throw;
            }

            return(xmlDoc);
        }
        /// <summary>
        /// This example show an example of populating a 1B document
        /// </summary>
        public XmlDocument PopulateSpecialistLetterSample_1B(string fileName)
        {
            XmlDocument xmlDoc = null;

            var document = PopulateSpecialistLetter(true);

            document.SCSContent = SpecialistLetter.CreateSCSContent();

            document.IncludeLogo = false;
            // Hide Administrative Observations Section
            document.ShowAdministrativeObservationsSection = false;

            var narrativeOnlyDocumentList = new List <NarrativeOnlyDocument>();

            var narrativeOnlyDocument = BaseCDAModel.CreateNarrativeOnlyDocument();

            narrativeOnlyDocument.Title     = "Narrative Title";
            narrativeOnlyDocument.Narrative = new StrucDocText
            {
                paragraph = new[] { new StrucDocParagraph {
                                        Text = new[] { "The narrative goes here" }
                                    } }
            };


            // Add One
            narrativeOnlyDocumentList.Add(narrativeOnlyDocument);

            document.SCSContent.NarrativeOnlyDocument = narrativeOnlyDocumentList;

            try
            {
                CDAGenerator.NarrativeGenerator = new CDANarrativeGenerator();

                //Pass the document model into the Generate method
                xmlDoc = CDAGenerator.GenerateSpecialistLetter(document);

                using (var writer = XmlWriter.Create(OutputFolderPath + @"\" + fileName, new XmlWriterSettings {
                    Indent = true
                }))
                {
                    if (!fileName.IsNullOrEmptyWhitespace())
                    {
                        xmlDoc.Save(writer);
                    }
                }
            }
            catch (ValidationException ex)
            {
                //Catch any validation exceptions
                var validationMessages = ex.GetMessagesString();

                //Handle any validation errors as appropriate.
                throw;
            }

            return(xmlDoc);
        }
        /// <summary>
        /// Generates an XML document from the pathology report model.
        /// </summary>
        /// <param name="pathologyResultReport">HL7 pathology message model.</param>
        /// <returns>Pathology XML document.</returns>
        /// <exception cref="ArgumentNullException">pathologyResultReport</exception>
        public XmlDocument Generate(PathologyResultReport pathologyResultReport)
        {
            if (pathologyResultReport == null)
            {
                throw new ArgumentNullException(nameof(pathologyResultReport));
            }

            return(CDAGenerator.GeneratePathologyResultReport(pathologyResultReport));
        }
Пример #9
0
        /// <summary>
        /// Generates an XML document from the diagnostic imaging report model.
        /// </summary>
        /// <param name="diagnosticImagingReport">HL7 diagnostic imaging message model.</param>
        /// <returns>Pathology XML document.</returns>
        public XmlDocument Generate(DiagnosticImagingReport diagnosticImagingReport)
        {
            if (diagnosticImagingReport == null)
            {
                throw new ArgumentNullException(nameof(diagnosticImagingReport));
            }

            return(CDAGenerator.GenerateDiagnosticImagingReport(diagnosticImagingReport));
        }
Пример #10
0
        /// <summary>
        /// This example populates only the mandatory Sections / Entries; as a result this sample omits all
        /// of the content within the body of the CDA document; as each of the sections within the body
        /// are optional.
        /// </summary>
        public XmlDocument PopulateEventSummarySample_1A(string fileName)
        {
            XmlDocument xmlDoc;

            var document = PopulatedEventSummary(true);

            // Hide Administrative Observations Section
            document.ShowAdministrativeObservationsSection = false;

            document.SCSContent = EventSummary.CreateSCSContent();

            document.IncludeLogo = false;

            var structuredBodyFileList = new List <ExternalData>();

            var structuredBodyFile = BaseCDAModel.CreateStructuredBodyFile();

            structuredBodyFile.Caption = "Structured Body File";
            structuredBodyFile.ExternalDataMediaType = MediaType.PDF;
            structuredBodyFile.Path = StructuredFileAttachment;
            structuredBodyFileList.Add(structuredBodyFile);

            document.SCSContent.StructuredBodyFiles = structuredBodyFileList;

            try
            {
                CDAGenerator.NarrativeGenerator = new CDANarrativeGenerator();

                //Pass the document model into the Generate method
                xmlDoc = CDAGenerator.GenerateEventSummary(document);

                using (var writer = XmlWriter.Create(OutputFolderPath + @"\" + fileName, new XmlWriterSettings()
                {
                    Indent = true
                }))
                {
                    if (!fileName.IsNullOrEmptyWhitespace())
                    {
                        xmlDoc.Save(writer);
                    }
                }
            }
            catch (ValidationException ex)
            {
                //Catch any validation exceptions
                var validationMessages = ex.GetMessagesString();

                //Handle any validation errors as appropriate.
                throw;
            }

            return(xmlDoc);
        }