Example #1
0
        protected override StrucDocTable GetEntriesTable()
        {
            // *** Creates a structured document text object from a list of observations ***

            // *** Create the table ***
            StrucDocTable returnVal = null;

            if (this.Observations.Count > 0)
            {
                returnVal = new StrucDocTable();

                returnVal.caption = new StrucDocCaption()
                {
                    Text = new string[] { "Pregnancy History Summary" }
                };

                // *** Create Header information ***
                returnVal.thead    = new StrucDocThead();
                returnVal.thead.tr = new StrucDocTr[] { new StrucDocTr() };

                returnVal.thead.tr[0].Items = new StrucDocTh[] {
                    new StrucDocTh()
                    {
                        Text = new string[] { "Date/Time" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Description" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Number" }
                    }
                };

                // *** Create Body Information ***
                returnVal.tbody = new StrucDocTbody[] { new StrucDocTbody() };
                List <StrucDocTr> trList = new List <StrucDocTr>();

                // *** Create a Row for each observation ***
                foreach (CdaSimpleObservation obs in this.Observations)
                {
                    // *** Create the row ***
                    StrucDocTr tr = new StrucDocTr()
                    {
                        ID = obs.ReferenceId
                    };

                    // *** Create a list of TD ***
                    List <StrucDocTd> tdList = new List <StrucDocTd>();

                    // *** Add TD's ***
                    tdList.Add(
                        new StrucDocTd()
                    {
                        Text = new string[] {
                            obs.EffectiveTime.Value.ToString(VistaDates.UserDateTimeFormat)
                        }
                    });

                    tdList.Add(new StrucDocTd()
                    {
                        Text = new string[] { obs.Code.DisplayName }
                    });

                    StrucDocTd td;
                    if (obs is CdaIntObservation)
                    {
                        CdaIntObservation intObs = (CdaIntObservation)obs;
                        td = new StrucDocTd()
                        {
                            Text = new string[] { intObs.Value.ToString() }
                        };
                    }
                    else if (obs is CdaTextObservation)
                    {
                        CdaTextObservation textObs = (CdaTextObservation)obs;
                        td = new StrucDocTd()
                        {
                            Text = new string[] { textObs.Value }
                        };
                    }
                    else
                    {
                        td = new StrucDocTd()
                        {
                            Text = new string[] { "" }
                        }
                    };

                    td.align          = StrucDocTdAlign.center;
                    td.alignSpecified = true;
                    tdList.Add(td);

                    tr.Items = tdList.ToArray();

                    trList.Add(tr);
                }

                // *** Add rows to body ***
                returnVal.tbody[0].tr = trList.ToArray();
            }

            return(returnVal);
        }
Example #2
0
        //private 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 entriesTble = this.GetEntriesTable();

        //    textItems.Add(entriesTble);

        //    returnVal.Items = textItems.ToArray();

        //    return returnVal;
        //}

        protected override StrucDocTable GetEntriesTable()
        {
            // *** Create the table ***
            StrucDocTable returnTable = null;

            if (this.MenstrualHistoryObservations.Count > 0)
            {
                returnTable = new StrucDocTable();

                // *** Create Header information ***
                returnTable.thead             = new StrucDocThead();
                returnTable.thead.tr          = new StrucDocTr[] { new StrucDocTr() };
                returnTable.thead.tr[0].Items = new StrucDocTh[] {
                    new StrucDocTh()
                    {
                        Text = new string[] { "Description" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Value" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Comment" }
                    },
                };

                // *** Create Body Information ***
                returnTable.tbody = new StrucDocTbody[] { new StrucDocTbody() };
                List <StrucDocTr> trList = new List <StrucDocTr>();

                // *** Sort list to put positives first ***
                this.MenstrualHistoryObservations.Sort(delegate(CdaSimpleObservation x, CdaSimpleObservation y)
                {
                    return(x.NegationIndicator.CompareTo(y.NegationIndicator));
                });

                // *** Create a Row for each observation ***
                foreach (CdaSimpleObservation obs in this.MenstrualHistoryObservations)
                {
                    // *** Create the row ***
                    StrucDocTr tr = new StrucDocTr()
                    {
                        ID = obs.ReferenceId
                    };

                    // *** Create a list of TD ***
                    List <StrucDocTd> tdList = new List <StrucDocTd>();

                    // *** Add TD's ***
                    tdList.Add(new StrucDocTd()
                    {
                        Text = new string[] { obs.Code.DisplayName }
                    });

                    StrucDocTd td = new StrucDocTd()
                    {
                        Text = new string[] { obs.DisplayValue }
                    };
                    tdList.Add(td);

                    tdList.Add(new StrucDocTd()
                    {
                        Text = new string[] { obs.Comment }
                    });

                    tr.Items = tdList.ToArray();

                    trList.Add(tr);
                }

                // *** Add rows to body ***
                returnTable.tbody[0].tr = trList.ToArray();

                returnTable.caption = new StrucDocCaption()
                {
                    Text = new string[] { "Menstrual History" }
                };
            }

            return(returnTable);
        }
Example #3
0
        protected override StrucDocTable GetEntriesTable()
        {
            // *** Create the table ***
            StrucDocTable returnTable = null;

            if (this.Observations.Count > 0)
            {
                returnTable = new StrucDocTable();

                // *** Create Header information ***
                returnTable.thead             = new StrucDocThead();
                returnTable.thead.tr          = new StrucDocTr[] { new StrucDocTr() };
                returnTable.thead.tr[0].Items = new StrucDocTh[] {
                    new StrucDocTh()
                    {
                        Text = new string[] { "Date/Time" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Description" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Value" }
                    }
                };

                // *** Create Body Information ***
                returnTable.tbody = new StrucDocTbody[] { new StrucDocTbody() };
                List <StrucDocTr> trList = new List <StrucDocTr>();

                foreach (var obs in this.Observations)
                {
                    // *** Create the row ***
                    StrucDocTr tr = new StrucDocTr()
                    {
                        ID = obs.ReferenceId
                    };

                    // *** Create a list of TD ***
                    List <StrucDocTd> tdList = new List <StrucDocTd>();

                    // *** Add TD's ***

                    // *** Date/Time ***
                    tdList.Add(new StrucDocTd()
                    {
                        Text = new string[] { obs.EffectiveTime.Value.ToString() }
                    });

                    // *** Description ***
                    tdList.Add(new StrucDocTd()
                    {
                        Text = new string[] { obs.Code.DisplayName }
                    });

                    // *** Value ***
                    StrucDocTd td = new StrucDocTd()
                    {
                        Text = new string[] { obs.DisplayValue }
                    };
                    td.align          = StrucDocTdAlign.center;
                    td.alignSpecified = true;
                    tdList.Add(td);

                    // *** Add td's to tr ***
                    tr.Items = tdList.ToArray();

                    // *** Add tr to tr list ***
                    trList.Add(tr);
                }

                // *** Add rows to body ***
                returnTable.tbody[0].tr = trList.ToArray();
            }

            return(returnTable);
        }
Example #4
0
        public StrucDocTable ToTable()
        {
            // *** Create the table ***
            StrucDocTable returnTable = null;

            if (this.Observations.Count > 0)
            {
                returnTable = new StrucDocTable();

                // *** Create Header information ***
                returnTable.thead             = new StrucDocThead();
                returnTable.thead.tr          = new StrucDocTr[] { new StrucDocTr() };
                returnTable.thead.tr[0].Items = new StrucDocTh[] {
                    new StrucDocTh()
                    {
                        Text = new string[] { "Problem" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Yes/No" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Comment" }
                    },
                };

                // *** Create Body Information ***
                returnTable.tbody = new StrucDocTbody[] { new StrucDocTbody() };
                List <StrucDocTr> trList = new List <StrucDocTr>();

                // *** Sort list to put positives first ***
                this.Observations.Sort(delegate(CdaCodeObservation x, CdaCodeObservation y)
                {
                    return(x.NegationIndicator.CompareTo(y.NegationIndicator));
                });

                // *** Create a Row for each observation ***
                foreach (CdaCodeObservation obs in this.Observations)
                {
                    // *** Create the row ***
                    StrucDocTr tr = new StrucDocTr()
                    {
                        ID = obs.ReferenceId
                    };

                    // *** Create a list of TD ***
                    List <StrucDocTd> tdList = new List <StrucDocTd>();

                    // *** Add TD's ***
                    //string problemDescription;
                    //if (obs.NegationIndicator)
                    //    problemDescription = string.Format("(Patient Does Not Have) {0}", obs.Code.DisplayName);
                    //else
                    //    problemDescription = obs.Code.DisplayName;

                    //tdList.Add(new StrucDocTd() { Text = new string[] { problemDescription } });
                    tdList.Add(new StrucDocTd()
                    {
                        Text = new string[] { obs.Value.DisplayName }
                    });

                    StrucDocTd td = new StrucDocTd()
                    {
                        Text = new string[] { (obs.NegationIndicator) ? "NO" : "YES" }
                    };
                    td.align          = StrucDocTdAlign.center;
                    td.alignSpecified = true;
                    tdList.Add(td);
                    tdList.Add(new StrucDocTd()
                    {
                        Text = new string[] { obs.Comment }
                    });

                    tr.Items = tdList.ToArray();

                    trList.Add(tr);
                }

                // *** Add rows to body ***
                returnTable.tbody[0].tr = trList.ToArray();
            }

            return(returnTable);
        }