private VocabularyCode[] GetCodes(ValueSet valueSet, DateTime?bindingDate, bool isCDA) { List <ValueSetMember> members = valueSet.GetActiveMembers(bindingDate); List <VocabularyCode> vocabularyCodes = new List <VocabularyCode>(); foreach (var vc in members) { VocabularyCode vocabularyCode = new VocabularyCode() { Value = vc.Code, DisplayName = vc.DisplayName, CodeSystem = vc.CodeSystem.Oid, CodeSystemName = vc.CodeSystem.Name }; if (isCDA && vocabularyCode.CodeSystem.StartsWith("urn:oid:")) { vocabularyCode.CodeSystem = vocabularyCode.CodeSystem.Substring(8); } vocabularyCodes.Add(vocabularyCode); } return(vocabularyCodes.ToArray()); }
private void AddValueSetDetailTable(ValueSet valueSet, DateTime bindingDate) { string valueSetIdentifier = valueSet.GetIdentifier(this.igTypePlugin); string bookmarkId = this.GetValueSetBookmark(valueSet); List <ValueSetMember> members = valueSet.GetActiveMembers(bindingDate); if (members == null || members.Count == 0) { return; } TableCell headingCell = new TableCell( new TableCellProperties() { GridSpan = new GridSpan() { Val = 4 } }, new Paragraph( new ParagraphProperties(new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun( string.Format("Value Set: {0} {1}", valueSet.Name, valueSet.GetIdentifier(igTypePlugin))))); if (!string.IsNullOrEmpty(valueSet.Description)) { headingCell.Append( new Paragraph( new ParagraphProperties(new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun(valueSet.Description))); } if (!string.IsNullOrEmpty(valueSet.Source)) { headingCell.Append( new Paragraph( new ParagraphProperties(new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun("Value Set Source: "), this.hyperlinkTracker.CreateUrlHyperlink(this.mainPart, valueSet.Source, valueSet.Source, Properties.Settings.Default.LinkStyle))); } TableRow headerRow = DocHelper.CreateTableHeader("Code", "Code System", "Code System OID", "Print Name"); List <TableCell> headerCells = headerRow.ChildElements.OfType <TableCell>().ToList(); headerCells[0].ChildElements.OfType <TableCellProperties>().First().TableCellWidth = new TableCellWidth() { Width = "1560" }; headerCells[1].ChildElements.OfType <TableCellProperties>().First().TableCellWidth = new TableCellWidth() { Width = "3000" }; headerCells[2].ChildElements.OfType <TableCellProperties>().First().TableCellWidth = new TableCellWidth() { Width = "3000" }; headerCells[3].ChildElements.OfType <TableCellProperties>().First().TableCellWidth = new TableCellWidth() { Width = "2520" }; Table t = DocHelper.CreateTable( new TableRow(headingCell), headerRow); int maximumMembers = this.defaultMaxMembers; if (this.valueSetMaximumMembers != null && this.valueSetMaximumMembers.ContainsKey(valueSetIdentifier)) { maximumMembers = this.valueSetMaximumMembers[valueSetIdentifier]; } int count = 0; foreach (ValueSetMember currentMember in members) { if (count >= maximumMembers) { break; } TableRow memberRow = new TableRow( new TableCell( new TableCellProperties() { TableCellWidth = new TableCellWidth() { Width = "1170" } }, new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun(currentMember.Code))), new TableCell( new TableCellProperties() { TableCellWidth = new TableCellWidth() { Width = "3195" } }, new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun(currentMember.CodeSystem.Name))), new TableCell( new TableCellProperties() { TableCellWidth = new TableCellWidth() { Width = "3195" } }, new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun(currentMember.CodeSystem.Oid))), new TableCell( new TableCellProperties() { TableCellWidth = new TableCellWidth() { Width = "2520" } }, new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun(currentMember.DisplayName))) ); t.Append(memberRow); count++; } if (count <= members.Count - 1 || valueSet.IsIncomplete) { TableRow moreMembersRow = new TableRow( new TableCell( new TableCellProperties() { GridSpan = new GridSpan() { Val = 4 } }, new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun("...")))); t.Append(moreMembersRow); } this.tables.AddTable(valueSet.Name, t, bookmarkId); }
private void AddValueSetDetailTable(ValueSet valueSet, DateTime bindingDate) { string bookmarkId = this.GetValueSetBookmark(valueSet); List <ValueSetMember> members = valueSet.GetActiveMembers(bindingDate); if (members == null || members.Count == 0) { return; } TableCell headingCell = new TableCell( new TableCellProperties() { GridSpan = new GridSpan() { Val = 4 } }, new Paragraph( new ParagraphProperties(new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun( string.Format("Value Set: {0} {1}", valueSet.Name, valueSet.Oid)))); if (!string.IsNullOrEmpty(valueSet.Description)) { headingCell.Append( new Paragraph( new ParagraphProperties(new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun(valueSet.Description))); } if (!string.IsNullOrEmpty(valueSet.Source)) { headingCell.Append( new Paragraph( new ParagraphProperties(new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun("Value Set Source: "), DocHelper.CreateUrlHyperlink(this.mainPart, valueSet.Source, valueSet.Source, Properties.Settings.Default.LinkStyle))); } Table t = DocHelper.CreateTable( new TableRow(headingCell), DocHelper.CreateTableHeader("Code", "Code System", "Code System OID", "Print Name")); int maximumMembers = this.defaultMaxMembers; if (this.valueSetMaximumMembers != null && this.valueSetMaximumMembers.ContainsKey(valueSet.Oid)) { maximumMembers = this.valueSetMaximumMembers[valueSet.Oid]; } int count = 0; foreach (ValueSetMember currentMember in members) { if (count >= maximumMembers) { break; } TableRow memberRow = new TableRow( new TableCell( new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun(currentMember.Code))), new TableCell( new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun(currentMember.CodeSystem.Name))), new TableCell( new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun(currentMember.CodeSystem.Oid))), new TableCell( new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun(currentMember.DisplayName))) ); t.Append(memberRow); count++; } if (count <= members.Count - 1 || valueSet.IsIncomplete) { TableRow moreMembersRow = new TableRow( new TableCell( new TableCellProperties() { GridSpan = new GridSpan() { Val = 4 } }, new Paragraph( new ParagraphProperties( new ParagraphStyleId() { Val = Properties.Settings.Default.TableContentStyle }), DocHelper.CreateRun("...")))); t.Append(moreMembersRow); } this.tables.AddTable(valueSet.Name, t, bookmarkId); }