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); }
public static CdaIntObservation CreateIntObservation(Observation observation) { CdaIntObservation returnVal; int tempVal = -1; if (int.TryParse(observation.Value, out tempVal)) { returnVal = new CdaIntObservation(); // *** 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 *** returnVal.Value = tempVal; } else { returnVal = null; } return(returnVal); }
public static CdaIntObservation CreatePregnancyHistoryIntObservation(Observation observation) { CdaIntObservation returnVal = CreateIntObservation(observation); if (returnVal != null) { returnVal.TemplateIds = new CdaTemplateIdList(SimpleObservationTemplateId, PregnancyObservationTemplateId); returnVal.EffectiveTime = new CdaEffectiveTime() { Value = observation.EntryDate }; } return(returnVal); }
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); }