示例#1
0
        /// <summary>
        /// Method to map a Fhir Model observation element to an Observation object
        /// </summary>
        /// <param name="element"> Observation element from Fhir model </param>
        /// <returns> An Observation object with values from Fhir model element </returns>
        public override Models.Observation Map(Hl7.Fhir.Model.Observation element)
        {
            /// create a new Observation object and map values from Fhir model to it
            var observation = new Observation
            {
                Id       = element.Id,
                Code     = element.Code.Coding[0].Code,
                CodeText = element.Code.Text
            };

            if (element.Issued != null)
            {
                observation.Issued = ((DateTimeOffset)element.Issued).DateTime;
            }
            else
            {
                observation.Issued = null;
            }

            Hl7.Fhir.Model.Quantity fhirQuantity = (Hl7.Fhir.Model.Quantity)element.Value;

            observation.MeasurementResult = new Measurement
            {
                Value = fhirQuantity.Value,
                Unit  = fhirQuantity.Unit
            };

            return(observation);
        }
示例#2
0
        private void TestStandardizing(decimal d, string compare)
        {
            Hl7.Fhir.Model.Quantity quantity = new Hl7.Fhir.Model.Quantity();
            quantity.Value = d;

            string s = quantity.ValueAsSearchableString();
            Assert.AreEqual(s, compare);
        }
示例#3
0
        private void TestStandardizing(decimal d, string compare)
        {
            Hl7.Fhir.Model.Quantity quantity = new Hl7.Fhir.Model.Quantity();
            quantity.Value = d;

            string s = quantity.ValueAsSearchableString();

            Assert.AreEqual(s, compare);
        }
        /// <summary>
        /// Method to map a Fhir Model component observation element to an Observation object
        /// </summary>
        /// <param name="element"> Component Observation element from Fhir model </param>
        /// <returns> An Observation object with values from Fhir model element </returns>
        public override Models.Observation Map(Hl7.Fhir.Model.Observation.ComponentComponent element)
        {
            /// create a new Observation object and map values from Fhir model to it
            var observation = new Observation
            {
                Code = element.Code.Coding[0].Code,

                CodeText = element.Code.Text
            };

            Hl7.Fhir.Model.Quantity fhirQuantity = (Hl7.Fhir.Model.Quantity)element.Value;

            observation.MeasurementResult = new Measurement
            {
                Value = fhirQuantity.Value,
                Unit  = fhirQuantity.Unit
            };

            return(observation);
        }