Exemplo n.º 1
0
        public static Observation GetObservation(DsioObservation dsioObs)
        {
            Observation returnVal = new Observation()
            {
                Ien                 = dsioObs.Ien,
                BabyIen             = dsioObs.BabyIen,
                BabyNumber          = dsioObs.BabyNum,
                Category            = dsioObs.Category,
                Code                = dsioObs.Code.Code,
                Description         = dsioObs.Code.DisplayName,
                EnteredBy           = dsioObs.EnteredBy,
                PatientDfn          = dsioObs.PatientDfn,
                PregnancyIen        = dsioObs.PregnancyIen,
                Value               = dsioObs.Value,
                Narrative           = dsioObs.Narrative,
                Unit                = dsioObs.Unit,
                ExchangeDocumentIen = dsioObs.ExchangeDocumentIen
            };

            returnVal.CodeSystem = CodingSystemUtility.GetCodingSystemName(dsioObs.Code.CodeSystemName);

            returnVal.EntryDate = VistaDates.FlexParse(dsioObs.EntryDate);
            returnVal.ExamDate  = VistaDates.FlexParse(dsioObs.ExamDate);

            returnVal.Relationship = CdaRoleCode.GetHl7FamilyMember(dsioObs.Relationship);

            returnVal.Negation = dsioObs.Negation.Equals("true", StringComparison.CurrentCultureIgnoreCase);

            return(returnVal);
        }
        //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);
        }