コード例 #1
0
        public static CdaSimpleObservation CreateObservation(POCD_MT000040Observation pocdObservation)
        {
            CdaSimpleObservation returnVal = null;

            if (pocdObservation.value != null)
            {
                if (pocdObservation.value.Length > 0)
                {
                    ANY first = pocdObservation.value[0];

                    if (first is INT)
                    {
                        returnVal = new CdaIntObservation(pocdObservation);
                    }
                    else if (first is TS)
                    {
                        returnVal = new CdaDateObservation(pocdObservation);
                    }
                    else if (first is PQ)
                    {
                        returnVal = new CdaPqObservation(pocdObservation);
                    }
                    else if (first is ST)
                    {
                        returnVal = new CdaTextObservation(pocdObservation);
                    }
                }
            }

            return(returnVal);
        }
コード例 #2
0
        public static CdaTextObservation CreateTextObservation(Observation observation)
        {
            CdaTextObservation returnVal = new CdaTextObservation();

            // *** Add Id, status ***
            returnVal.Id     = Guid.NewGuid().ToString(); //observation.Ien;
            returnVal.Status = Hl7ProblemActStatus.completed;

            // *** Add code ***
            returnVal.Code = new CdaCode()
            {
                CodeSystem = observation.CodeSystem, Code = observation.Code, DisplayName = observation.Description
            };

            // *** Add value, try narrative ***
            if (string.IsNullOrWhiteSpace(observation.Value))
            {
                returnVal.Value = observation.Narrative;
            }
            else
            {
                returnVal.Value = observation.Value;
            }

            returnVal.EffectiveTime = new CdaEffectiveTime()
            {
                High = observation.EntryDate
            };

            return(returnVal);
        }
コード例 #3
0
        private CdaSubject CreateBabySubject()
        {
            // *** Create the subject of the section for the baby ***

            CdaSubject returnVal = new CdaSubject();

            if (this.Observations != null)
            {
                foreach (var obs in this.Observations)
                {
                    switch (obs.Code.Code)
                    {
                    case "46098-0":     // Sex
                        CdaTextObservation tempObservation = obs as CdaTextObservation;
                        CdaGender          gender          = new CdaGender(obs.DisplayValue);
                        returnVal.Gender = gender.Value;
                        break;

                    case "45392-8":     // First Name
                        returnVal.FirstName = obs.DisplayValue;
                        break;

                    case "21112-8":     // Birth Date + Time
                        CdaDateObservation dateObs = obs as CdaDateObservation;
                        returnVal.BirthTime = dateObs.Value;
                        break;
                    }
                }
            }

            return(returnVal);
        }
コード例 #4
0
        public static CdaTextObservation CreatePregnancyHistoryTextObservation(Observation observation)
        {
            CdaTextObservation returnVal = CreateTextObservation(observation);

            if (returnVal != null)
            {
                returnVal.TemplateIds = new CdaTemplateIdList(SimpleObservationTemplateId, PregnancyObservationTemplateId);

                returnVal.EffectiveTime = new CdaEffectiveTime()
                {
                    Value = observation.EntryDate
                };
            }

            return(returnVal);
        }
コード例 #5
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);
        }