Class: FHIR::MedicationBatch
- Inherits:
-
BackboneElement
- Object
- Type
- Element
- BackboneElement
- FHIR::MedicationBatch
- Includes:
- Mongoid::Document
- Defined in:
- app/models/fhir/medication_batch.rb
Overview
fhir/medication_batch.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.transform_json(json_hash, target = MedicationBatch.new) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'app/models/fhir/medication_batch.rb', line 28 def self.transform_json(json_hash, target = MedicationBatch.new) result = self.superclass.transform_json(json_hash, target) result['lotNumber'] = PrimitiveString.transform_json(json_hash['lotNumber'], json_hash['_lotNumber']) unless json_hash['lotNumber'].nil? result['expirationDate'] = PrimitiveDateTime.transform_json(json_hash['expirationDate'], json_hash['_expirationDate']) unless json_hash['expirationDate'].nil? result end |
Instance Method Details
#as_json(*args) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/fhir/medication_batch.rb', line 8 def as_json(*args) result = super unless self.lotNumber.nil? result['lotNumber'] = self.lotNumber.value serialized = Extension.serializePrimitiveExtension(self.lotNumber) result['_lotNumber'] = serialized unless serialized.nil? end unless self.expirationDate.nil? result['expirationDate'] = self.expirationDate.value serialized = Extension.serializePrimitiveExtension(self.expirationDate) result['_expirationDate'] = serialized unless serialized.nil? end result.delete('id') unless self.fhirId.nil? result['id'] = self.fhirId result.delete('fhirId') end result end |