/* * This class shows how to walk through a MB CDA Document object (ConsultationNote, in this case) and * access various fields. * */ public void ProcessConsultationNote(ConsultationNote consultationNote) { Console.WriteLine("\n\nWriting out various values from ConsultationNote objects:\n"); Console.WriteLine("Title: " + consultationNote.Title); Console.WriteLine("Template Id: " + consultationNote.TemplateId); RenderAuthor(consultationNote.Author.Count == 0 ? null : consultationNote.Author[0]); RenderPatient(consultationNote.RecordTarget.Count == 0 ? null : consultationNote.RecordTarget[0].PatientRole); RenderSections(consultationNote); }
// used to add more information to the document object after initially creating it public void AddHistoryOfPresentIllness(ConsultationNote consultationNote) { Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Historyofpresentillnesssection.Section historyOfPresentIllnessSection = new Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Historyofpresentillnesssection.Section(); historyOfPresentIllnessSection.Title = "HISTORY OF PRESENT ILLNESS"; historyOfPresentIllnessSection.Text = CreateIllnessHistoryText(); HistoryOfPresentIllnessSectionComponent3 historyOfPresentIllness = new HistoryOfPresentIllnessSectionComponent3(); historyOfPresentIllness.Section = historyOfPresentIllnessSection; consultationNote.Component.Component2ChoiceAsStructuredBody.Component.Add(historyOfPresentIllness); }
public void ObtainDocumentXmlAndConvertToBean() { Console.WriteLine("\n\nNow taking a large sample document (as xml) and converting to objects.\n"); // this method takes a full sample ConsultationNote document and converts it into objects, walking the object model and printing out various fields // Relaxes code vocabulary code checks and sets up some basic code resolvers. // This only needs to be done once (which occurred in createDocumentBeanAndConvertToXml()), but including it here for completeness. DefaultCodeResolutionConfigurator.ConfigureCodeResolversWithTrivialDefault(); String xml = ReadResourceFile(this.documentXml); ConsultationNote consultationNote = (ConsultationNote)ProcessDocumentXml(xml); ConsultationNoteAccessor consultationNoteAccessor = new ConsultationNoteAccessor(); consultationNoteAccessor.ProcessConsultationNote(consultationNote); }
private void RenderSections(ConsultationNote consultationNote) { if (consultationNote.Component != null) { Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Consultationnote.Component2 component = consultationNote.Component; if (component.HasComponent2ChoiceAsNonXMLBody()) { // not much to render in this case NonXMLBody nonXmlBody = component.Component2ChoiceAsNonXMLBody; Console.WriteLine("Non-XML Body Text: "); RenderText(nonXmlBody.Text); } else if (component.HasComponent2ChoiceAsStructuredBody()) { Ca.Infoway.Messagebuilder.Model.Ccda_r1_1.Consultationnote.StructuredBody structuredBody = component.Component2ChoiceAsStructuredBody; foreach (IComponent3Choice section in structuredBody.Component) { RenderSection(section); } } } }