Class: FHIR::SpecimenDefinition

Inherits:
DomainResource show all
Includes:
Mongoid::Document
Defined in:
app/models/fhir/specimen_definition.rb

Overview

fhir/specimen_definition.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from FHIR::Resource

Class Method Details

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



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

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

  result = self.superclass.transform_json(json_hash, target)
  result['identifier'] = Identifier.transform_json(json_hash['identifier']) unless json_hash['identifier'].nil?
  result['typeCollected'] = CodeableConcept.transform_json(json_hash['typeCollected']) unless json_hash['typeCollected'].nil?
  result['patientPreparation'] = json_hash['patientPreparation'].map { |var| CodeableConcept.transform_json(var) } unless json_hash['patientPreparation'].nil?
  result['timeAspect'] = PrimitiveString.transform_json(json_hash['timeAspect'], json_hash['_timeAspect']) unless json_hash['timeAspect'].nil?
  result['collection_local'] = json_hash['collection'].map { |var| CodeableConcept.transform_json(var) } unless json_hash['collection'].nil?
  result['typeTested'] = json_hash['typeTested'].map { |var| SpecimenDefinitionTypeTested.transform_json(var) } unless json_hash['typeTested'].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/specimen_definition.rb', line 12

def as_json(*args)
  result = super      
  unless self.identifier.nil? 
    result['identifier'] = self.identifier.as_json(*args)
  end
  unless self.typeCollected.nil? 
    result['typeCollected'] = self.typeCollected.as_json(*args)
  end
  unless self.patientPreparation.nil?  || !self.patientPreparation.any? 
    result['patientPreparation'] = self.patientPreparation.map{ |x| x.as_json(*args) }
  end
  unless self.timeAspect.nil? 
    result['timeAspect'] = self.timeAspect.value
    serialized = Extension.serializePrimitiveExtension(self.timeAspect)            
    result['_timeAspect'] = serialized unless serialized.nil?
  end
  unless self.collection_local.nil?  || !self.collection_local.any? 
    result['collection'] = self.collection_local.map{ |x| x.as_json(*args) }
  end
  unless self.typeTested.nil?  || !self.typeTested.any? 
    result['typeTested'] = self.typeTested.map{ |x| x.as_json(*args) }
  end
  result.delete('id')
  unless self.fhirId.nil?
    result['id'] = self.fhirId
    result.delete('fhirId')
  end  
  result
end