Class: FHIR::NutritionOrderOralDiet

Inherits:
BackboneElement show all
Includes:
Mongoid::Document
Defined in:
app/models/fhir/nutrition_order_oral_diet.rb

Overview

fhir/nutrition_order_oral_diet.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.transform_json(json_hash, target = NutritionOrderOralDiet.new) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/models/fhir/nutrition_order_oral_diet.rb', line 42

def self.transform_json(json_hash, target = NutritionOrderOralDiet.new)

  result = self.superclass.transform_json(json_hash, target)
  result['type'] = json_hash['type'].map { |var| CodeableConcept.transform_json(var) } unless json_hash['type'].nil?
  result['schedule'] = json_hash['schedule'].map { |var| Timing.transform_json(var) } unless json_hash['schedule'].nil?
  result['nutrient'] = json_hash['nutrient'].map { |var| NutritionOrderOralDietNutrient.transform_json(var) } unless json_hash['nutrient'].nil?
  result['texture'] = json_hash['texture'].map { |var| NutritionOrderOralDietTexture.transform_json(var) } unless json_hash['texture'].nil?
  result['fluidConsistencyType'] = json_hash['fluidConsistencyType'].map { |var| CodeableConcept.transform_json(var) } unless json_hash['fluidConsistencyType'].nil?
  result['instruction'] = PrimitiveString.transform_json(json_hash['instruction'], json_hash['_instruction']) unless json_hash['instruction'].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/nutrition_order_oral_diet.rb', line 12

def as_json(*args)
  result = super      
  unless self.type.nil?  || !self.type.any? 
    result['type'] = self.type.map{ |x| x.as_json(*args) }
  end
  unless self.schedule.nil?  || !self.schedule.any? 
    result['schedule'] = self.schedule.map{ |x| x.as_json(*args) }
  end
  unless self.nutrient.nil?  || !self.nutrient.any? 
    result['nutrient'] = self.nutrient.map{ |x| x.as_json(*args) }
  end
  unless self.texture.nil?  || !self.texture.any? 
    result['texture'] = self.texture.map{ |x| x.as_json(*args) }
  end
  unless self.fluidConsistencyType.nil?  || !self.fluidConsistencyType.any? 
    result['fluidConsistencyType'] = self.fluidConsistencyType.map{ |x| x.as_json(*args) }
  end
  unless self.instruction.nil? 
    result['instruction'] = self.instruction.value
    serialized = Extension.serializePrimitiveExtension(self.instruction)            
    result['_instruction'] = serialized unless serialized.nil?
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end