Class: FHIR::ObservationReferenceRange
- Inherits:
-
BackboneElement
- Object
- Type
- Element
- BackboneElement
- FHIR::ObservationReferenceRange
- Includes:
- Mongoid::Document
- Defined in:
- app/models/fhir/observation_reference_range.rb
Overview
fhir/observation_reference_range.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.transform_json(json_hash, target = ObservationReferenceRange.new) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/models/fhir/observation_reference_range.rb', line 42 def self.transform_json(json_hash, target = ObservationReferenceRange.new) result = self.superclass.transform_json(json_hash, target) result['low'] = SimpleQuantity.transform_json(json_hash['low']) unless json_hash['low'].nil? result['high'] = SimpleQuantity.transform_json(json_hash['high']) unless json_hash['high'].nil? result['type'] = CodeableConcept.transform_json(json_hash['type']) unless json_hash['type'].nil? result['appliesTo'] = json_hash['appliesTo'].map { |var| CodeableConcept.transform_json(var) } unless json_hash['appliesTo'].nil? result['age'] = Range.transform_json(json_hash['age']) unless json_hash['age'].nil? result['text'] = PrimitiveString.transform_json(json_hash['text'], json_hash['_text']) unless json_hash['text'].nil? result end |
Instance Method Details
#as_json(*args) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/models/fhir/observation_reference_range.rb', line 12 def as_json(*args) result = super unless self.low.nil? result['low'] = self.low.as_json(*args) end unless self.high.nil? result['high'] = self.high.as_json(*args) end unless self.type.nil? result['type'] = self.type.as_json(*args) end unless self.appliesTo.nil? || !self.appliesTo.any? result['appliesTo'] = self.appliesTo.map{ |x| x.as_json(*args) } end unless self.age.nil? result['age'] = self.age.as_json(*args) end unless self.text.nil? result['text'] = self.text.value serialized = Extension.serializePrimitiveExtension(self.text) result['_text'] = serialized unless serialized.nil? end result.delete('id') unless self.fhirId.nil? result['id'] = self.fhirId result.delete('fhirId') end result end |