protected virtual StrucDocText GetSectionText() { // *** Create the section text *** // **** Narrative + Entries Table *** StrucDocText returnVal = new StrucDocText(); // *** Create list of items *** List <object> textItems = new List <object>(); if (!string.IsNullOrWhiteSpace(this.Narrative)) { // *** Add narrative *** StrucDocParagraph narrativeParagraph = new StrucDocParagraph(); narrativeParagraph.Text = new string[] { this.Narrative }; textItems.Add(narrativeParagraph); } // *** Add entries *** StrucDocTable entriesTable = this.GetEntriesTable(); if (entriesTable != null) { textItems.Add(entriesTable); } // *** Add any additional text needed *** List <object> additionalText = this.GetAdditionalText(); if (additionalText != null) { if (additionalText.Count > 0) { textItems.AddRange(additionalText); } } returnVal.Items = textItems.ToArray(); return(returnVal); }
/// <summary> /// Creates a CDA component containing all required data /// </summary> /// <returns>A CDA component</returns> public override POCD_MT000040Component3 ToPocdComponent() { // *** Converts this item to raw component *** POCD_MT000040Component3 returnVal = base.ToPocdComponent(); // *** Create a list of entries *** List <POCD_MT000040Entry> entryList = new List <POCD_MT000040Entry>(); // *** Loop through observations *** foreach (CdaSimpleObservation observation in this.Observations) { // *** Create an entry *** POCD_MT000040Entry tempEntry = new POCD_MT000040Entry(); // *** Add a single pregnancy observation *** tempEntry.Item = observation.ToPocd(); // *** Add entry to list *** entryList.Add(tempEntry); } // *** Add pregnancy status observation *** POCD_MT000040Entry pregEntry = new POCD_MT000040Entry(); pregEntry.Item = this.PregnancyStatusObservation.ToPocd(); entryList.Add(pregEntry); // *** Add bold to pregnancy status *** if (returnVal.section.text.Items != null) { if (returnVal.section.text.Items.Length > 0) { if (returnVal.section.text.Items[0] is StrucDocParagraph) { StrucDocParagraph para = new StrucDocParagraph(); StrucDocContent cont = new StrucDocContent() { Text = new string[] { this.Narrative } }; cont.styleCode = "Bold"; para.Items = new object[] { cont }; returnVal.section.text.Items[0] = para; } } } // *** Add pregnancy organizers *** foreach (var pregOrg in this.PregnancyOrganizers.Values) { POCD_MT000040Entry pocdOrgEntry = pregOrg.ToPocdOrganizerEntry(); if (pocdOrgEntry != null) { entryList.Add(pocdOrgEntry); } } // *** Add entry list as array *** returnVal.section.entry = entryList.ToArray(); return(returnVal); }
public override POCD_MT000040Component3 ToPocdComponent() { POCD_MT000040Component3 returnVal = base.ToPocdComponent(); // *** Skip unless we have a pediatrician name *** if (!string.IsNullOrWhiteSpace(this.PediatricianName)) { // *** Create encounter containing pediatrician name *** POCD_MT000040Encounter enc = new POCD_MT000040Encounter(); // *** Set Class, Mood *** enc.classCode = "ENC"; enc.moodCode = x_DocumentEncounterMood.PRP; // *** Set Template Ids *** CdaTemplateIdList templateIds = new CdaTemplateIdList("1.3.6.1.4.1.19376.1.5.3.1.4.14", "2.16.840.1.113883.10.20.1.21", "2.16.840.1.113883.10.20.1.25"); enc.templateId = templateIds.ToPocd(); // *** Add Id *** enc.id = new II[] { new II() { root = Guid.NewGuid().ToString() } }; // *** Code *** enc.code = new CD() { code = "Ambulatory", codeSystem = "2.16.840.1.113883.5.4", codeSystemName = "ActEncounterCode" }; // *** Add name as performer *** CdaName cdaName = new CdaName() { Last = this.PediatricianName }; enc.performer = new POCD_MT000040Performer2[] { new POCD_MT000040Performer2() { typeCode = ParticipationPhysicalPerformer.PRF, typeCodeSpecified = true, assignedEntity = new POCD_MT000040AssignedEntity() { assignedPerson = new POCD_MT000040Person() { name = new PN[] { cdaName.ToPN() } } } } }; // *** Add encounter to list of entries *** List <POCD_MT000040Entry> entryList = new List <POCD_MT000040Entry>(returnVal.section.entry); entryList.Add(new POCD_MT000040Entry() { Item = enc }); returnVal.section.entry = entryList.ToArray(); // *** Add pediatrician to human-readable *** List <object> items = new List <object>(returnVal.section.text.Items); // *** Create a new paragraph *** StrucDocParagraph para = new StrucDocParagraph(); para.Text = new[] { string.Format("Pediatrician: {0}", this.PediatricianName) }; // *** Add it to list *** items.Add(para); // *** Add list to document *** returnVal.section.text.Items = items.ToArray(); } return(returnVal); }