private static Quantity Map(this DV_QUANTITY model) { var quantity = new Quantity(); if (model.accuracy.HasValue) { quantity.Accuracy = model.accuracy.Value; } if (model.accuracy_is_percent.HasValue) { quantity.IsAccuracyPercent = model.accuracy_is_percent.Value; } quantity.Magnitude = model.magnitude; quantity.MagnitudeStatus = model.magnitude_status; quantity.NormalRange = model.normal_range.Map <Quantity>(); if (model.other_reference_ranges != null) { foreach (var range in model.other_reference_ranges) { quantity.OtherReferenceRanges.Add(range.Map <Quantity>()); } } if (model.precision.HasValue) { quantity.Precision = model.precision.Value; } quantity.Units = model.units; return(quantity); }
protected virtual DV_QUANTITY CloneDvQuantity(openehr.openehr.am.openehr_profile.data_types.quantity.Impl.QUANTITY o) { DV_QUANTITY result = new DV_QUANTITY(); // Inherits DV_AMOUNT (only in Reference Model) // 0..1 normal_range DV_INTERVAL // 0..* other_reference_ranges REFERENCE_RANGE // 0..1 normal_status CODE_PHRASE // 0..1 magnitude_status string // 0..1 accuracy float // 0..1 accuracy_is_percent boolean result.magnitude = o.magnitude(); result.precision = o.precision(); if (o.units() != null) { result.units = o.units().ToString(); } return(result); }