/// <summary>
        /// Gets a list of rows to add to an existing table
        /// </summary>
        /// <returns>A list of StrucDocTr objects</returns>
        public List <StrucDocTr> GetRows()
        {
            List <StrucDocTr> returnList = new List <StrucDocTr>();

            // *** Check that there are observations ***
            if (this.Observations.Count > 0)
            {
                // *** Create a "header" which will be inside rows of table ***
                StrucDocTr headerRow = new StrucDocTr();
                headerRow.Items = new StrucDocTh[] { new StrucDocTh()
                                                     {
                                                         Text = new string[] { this.Caption }, colspan = "3"
                                                     } };
                returnList.Add(headerRow);

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

                // *** 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.Code.DisplayName }
                    });

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

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

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

                    // *** Add row to return ***
                    returnList.Add(tr);
                }
            }

            return(returnList);
        }
        private StrucDocTr CreateRow(CdaSimpleObservation obs, bool isFinal, DateTime dateTime)
        {
            // *** 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[] { dateTime.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);

            //// *** Is final ***
            //StrucDocTd td1 = new StrucDocTd() { Text = new string[] { (isFinal) ? "YES" : "NO" } };
            //td1.align = StrucDocTdAlign.center;
            //td1.alignSpecified = true;
            //tdList.Add(td1);

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

            return(tr);
        }
        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);
        }
        protected override StrucDocTable GetEntriesTable()
        {
            // *** Create the table ***
            StrucDocTable returnTable = null;

            if (this.EstimatedDeliveryDate != null)
            {
                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>();

                DateTime dt = DateTime.MinValue;
                if (this.EstimatedDeliveryDate.Author != null)
                {
                    dt = this.EstimatedDeliveryDate.Author.Time;
                }

                StrucDocTr tr = CreateRow(this.EstimatedDeliveryDate, true, dt);

                trList.Add(tr);

                foreach (var item in this.EstimatedDeliveryDate.SupportingObservations)
                {
                    //tr = CreateRow(item, false, dt);

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

                    if (item.SupportingObservations.Count > 0)
                    {
                        foreach (var sprt in item.SupportingObservations)
                        {
                            tr = CreateRow(sprt, false, dt);
                            trList.Add(tr);
                        }
                    }
                }

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

            return(returnTable);
        }
Exemple #5
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.High.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);
        }
        //private StrucDocText GetSectionText()
        //{
        //    // *** Get the text section ***

        //    StrucDocText returnVal = new StrucDocText();

        //    // *** Create list of items ***
        //    List<object> textItems = new List<object>();

        //    // *** Add narrative ***
        //    if (!string.IsNullOrWhiteSpace(this.Narrative))
        //    {
        //        StrucDocParagraph narrativeParagraph = new StrucDocParagraph();
        //        narrativeParagraph.Text = new string[] { this.Narrative };

        //        textItems.Add(narrativeParagraph);
        //    }

        //    // *** Add entries ***
        //    StrucDocTable entriesTble = this.GetTable();

        //    // *** Add entries to items list ***
        //    textItems.Add(entriesTble);

        //    // *** Add items as array ***
        //    returnVal.Items = textItems.ToArray();

        //    return returnVal;
        //}

        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[] { "Description" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Amount" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Comment" }
                    },
                };

                // *** Create Body Information ***
                returnTable.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 ***
                    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 }
                    });
                    if (obs is CdaPqObservation)
                    {
                        CdaPqObservation pqObs = (CdaPqObservation)obs;
                        tdList.Add(new StrucDocTd()
                        {
                            Text = new string[] { pqObs.Amount }
                        });
                    }
                    else
                    {
                        tdList.Add(new StrucDocTd()
                        {
                            Text = new string[] { "N/A" }
                        });
                    }

                    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);
        }
        /// <summary>
        /// Creates a table based on observations ***
        /// </summary>
        /// <returns>A StrucDocTable</returns>
        protected virtual 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[] { "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.Observations.Sort(delegate(CdaSimpleObservation x, CdaSimpleObservation y)
                {
                    return(x.NegationIndicator.CompareTo(y.NegationIndicator));
                });

                // *** 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.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);
                }

                // *** Get additional rows needed by parent ***
                List <StrucDocTr> additionalRows = this.GetAdditionalRows();
                if (additionalRows != null)
                {
                    trList.AddRange(additionalRows);
                }

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

                returnTable.caption = new StrucDocCaption()
                {
                    Text = new string[] { this.Caption }
                };
            }

            return(returnTable);
        }
Exemple #8
0
        protected override StrucDocTable GetEntriesTable()
        {
            //return this.Organizer.gE
            // *** Create the table ***
            StrucDocTable returnTable = null;

            if (this.Procedures.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[] { "Code System" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Code" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Description" }
                    }
                };

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

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

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

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

                    // *** Code System ***
                    tdList.Add(new StrucDocTd()
                    {
                        Text = new string[] { CodingSystemUtility.GetDescription(obs.Code.CodeSystem) }
                    });

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

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

                    // *** 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);
        }
        //private StrucDocText GetSectionText()
        //{
        //    // *** Create the section text ***

        //    StrucDocText returnVal = new StrucDocText();

        //    // *** Create list of items ***
        //    List<object> textItems = new List<object>();

        //    // *** Add entries ***
        //    StrucDocTable entriesTble = this.GetTable();
        //    textItems.Add(entriesTble);

        //    // *** Add text items to return ***
        //    returnVal.Items = textItems.ToArray();

        //    return returnVal;
        //}

        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[] { "Relationship" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Diagnosis" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Yes/No" }
                    }
                };

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

                foreach (var key in this.Observations.Keys)
                {
                    // *** Sort list to put positives first ***
                    this.Observations[key].Sort(delegate(CdaCodeObservation x, CdaCodeObservation y)
                    {
                        return(x.NegationIndicator.CompareTo(y.NegationIndicator));
                    });

                    bool first = true;

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

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

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

                        // *** Show relationship for first only ***
                        if (first)
                        {
                            CdaRoleCode role = new CdaRoleCode()
                            {
                                FamilyMember = obs.Relationship
                            };
                            StrucDocTd tempTd = new StrucDocTd()
                            {
                                Text = new string[] { role.DisplayName }
                            };
                            tempTd.styleCode = "Bold";
                            tdList.Add(tempTd);
                            first = false;
                        }
                        else
                        {
                            tdList.Add(new StrucDocTd());
                        }

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

                        // *** Yes/No ***
                        StrucDocTd td = new StrucDocTd()
                        {
                            Text = new string[] { (obs.NegationIndicator) ? "NO" : "YES" }
                        };
                        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);
        }
        protected StrucDocTable GetEntriesTable()
        {
            // *** Create the table ***
            StrucDocTable returnTable = null;

            if (this.LabObservations.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[] { "Test" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Result" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Range" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Interpretation" }
                    }
                };

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

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

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

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

                    // *** Test ***
                    StrucDocTd td = new StrucDocTd()
                    {
                        Text = new string[] { lab.Code.DisplayName }
                    };
                    tdList.Add(td);

                    // *** Result ***
                    tdList.Add(new StrucDocTd()
                    {
                        Text = new string[] { lab.DisplayValue }
                    });

                    //// *** Units ***
                    //td = new StrucDocTd() { Text = new string[] { lab.Unit } };
                    //td.align = StrucDocTdAlign.center;
                    //td.alignSpecified = true;
                    //tdList.Add(td);

                    // *** Range ***
                    string range = string.Format("{0}-{1}", lab.ReferenceRange.Low, lab.ReferenceRange.High);
                    td = new StrucDocTd()
                    {
                        Text = new string[] { range }
                    };
                    td.align          = StrucDocTdAlign.center;
                    td.alignSpecified = true;
                    tdList.Add(td);

                    // *** Interpretation ***
                    td = new StrucDocTd()
                    {
                        Text = new string[] { lab.InterpretationCode }
                    };
                    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);
        }
Exemple #11
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);
        }
Exemple #12
0
        protected override StrucDocTable GetEntriesTable()
        {
            // *** Create the table ***
            StrucDocTable returnTable = null;

            if (this.Medications.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[] { "Medication" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Start" }
                    },
                    new StrucDocTh()
                    {
                        Text = new string[] { "Stop" }
                    }
                };

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

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

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

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

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

                    // *** Start ***
                    string low = "";
                    if (med.EffectiveTime != null)
                    {
                        if (med.EffectiveTime.Low != null)
                        {
                            if (med.EffectiveTime.Low != DateTime.MinValue)
                            {
                                low = med.EffectiveTime.Low.ToString();
                            }
                        }
                    }

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

                    // *** Stop ***
                    string high = "";
                    if (med.EffectiveTime != null)
                    {
                        if (med.EffectiveTime.High != null)
                        {
                            if (med.EffectiveTime.High != DateTime.MinValue)
                            {
                                high = med.EffectiveTime.High.ToString();
                            }
                        }
                    }

                    StrucDocTd td = new StrucDocTd()
                    {
                        Text = new string[] { high }
                    };
                    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);
        }
Exemple #13
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[] { "Measurement" }
                    },
                    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>();

                // *** Create a Row for each observation ***
                foreach (CdaPqObservation 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.Code.DisplayName }
                    });
                    if (obs is CdaPqObservation)
                    {
                        CdaPqObservation pqObs = (CdaPqObservation)obs;
                        tdList.Add(new StrucDocTd()
                        {
                            Text = new string[] { pqObs.Amount }
                        });
                    }
                    else
                    {
                        tdList.Add(new StrucDocTd()
                        {
                            Text = new string[] { "N/A" }
                        });
                    }

                    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);
        }
        private StrucDocText GetObservationTable(List <CdaAllergy> allergies)
        {
            // *** Creates a structured document text object from a list of allergies ***

            StrucDocText returnVal = new StrucDocText();

            // *** Create the table ***
            StrucDocTable tbl = new StrucDocTable();

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

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

            // *** Create a Row for each observation ***
            foreach (CdaAllergy allergy in allergies)
            {
                // *** Create the row ***
                StrucDocTr tr = new StrucDocTr()
                {
                    ID = allergy.ReferenceId
                };

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

                // *** Add TD's ***
                string allergyDateTime = "";
                if (allergy.EffectiveTime != null)
                {
                    if (allergy.Status == Common.CdaConcernStatus.Actve)
                    {
                        if (allergy.EffectiveTime.Low != null)
                        {
                            if (allergy.EffectiveTime.Low != DateTime.MinValue)
                            {
                                allergyDateTime = allergy.EffectiveTime.Low.ToString();
                            }
                        }
                    }
                    else if (allergy.EffectiveTime.High != null)
                    {
                        if (allergy.EffectiveTime.High != DateTime.MinValue)
                        {
                            allergyDateTime = allergy.EffectiveTime.High.ToString();
                        }
                    }
                }

                tdList.Add(new StrucDocTd()
                {
                    Text = new string[] { allergyDateTime }
                });
                tdList.Add(new StrucDocTd()
                {
                    Text = new string[] { allergy.AllergyText }
                });
                tdList.Add(new StrucDocTd()
                {
                    Text = new string[] { allergy.StatusText }
                });

                tr.Items = tdList.ToArray();

                trList.Add(tr);
            }

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

            // *** Add a table caption ***
            StrucDocCaption caption = new StrucDocCaption()
            {
                Text = new string[] { "Allergies & Intolerances" }
            };

            tbl.caption = caption;

            // *** Add list of items ***
            List <object> textItems = new List <object>();

            textItems.Add(tbl);

            returnVal.Items = textItems.ToArray();

            return(returnVal);
        }