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); }
/// <summary> /// Creates an observation where the value is a date /// </summary> /// <param name="observation"></param> /// <returns></returns> public static CdaDateObservation CreateDateObservation(Observation observation) { CdaDateObservation returnVal; // TODO: What if this date is in another format ? // *** Attempt to parse the date *** DateTime tempDate = VistaDates.ParseDateString(observation.Value, VistaDates.VistADateOnlyFormat); // *** Check if we have a date *** if (tempDate == DateTime.MinValue) { returnVal = null; } else { // *** Create the observation *** returnVal = new CdaDateObservation(); // *** Add the date *** returnVal.Value = tempDate; // *** Add Id, Status *** returnVal.Id = Guid.NewGuid().ToString(); //observation.Ien; returnVal.Status = Hl7ProblemActStatus.completed; // *** Create code *** returnVal.Code = new CdaCode() { CodeSystem = observation.CodeSystem, Code = observation.Code, DisplayName = observation.Description }; } return(returnVal); }
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); }
public static CdaDateObservation CreatePregnancyHistoryDateObservation(Observation observation) { CdaDateObservation returnVal = CreateDateObservation(observation); if (returnVal != null) { returnVal.TemplateIds = new CdaTemplateIdList(SimpleObservationTemplateId, PregnancyObservationTemplateId); } return(returnVal); }
internal static CdaDateObservation CreateEddObservation() { CdaDateObservation returnVal = new CdaDateObservation(); returnVal.TemplateIds.AddId("1.3.6.1.4.1.19376.1.5.3.1.4.13"); returnVal.TemplateIds.AddId("1.3.6.1.4.1.19376.1.5.3.1.1.11.2.3.1"); returnVal.Status = Hl7ProblemActStatus.completed; returnVal.Code = new CdaCode() { CodeSystem = CodingSystem.Loinc, Code = "11778-8", DisplayName = "Estimated Delivery Date" }; return(returnVal); }