Class: Redox::Models::Patient

Inherits:
Model show all
Defined in:
lib/redox/models/patient.rb

Constant Summary

Constants inherited from AbstractModel

AbstractModel::HIGH_LEVEL_KEYS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#initialize, #to_h

Methods inherited from AbstractModel

from_response, from_response_inflected, #to_json

Constructor Details

This class inherits a constructor from Redox::Models::Model

Class Method Details

.query(params, meta: Meta.new) ⇒ Object



52
53
54
# File 'lib/redox/models/patient.rb', line 52

def query(params, meta: Meta.new)
  return Redox::Request::PatientSearch.query(params, meta: meta)
end

Instance Method Details

#add_identifier(type:, value:) ⇒ Object



31
32
33
34
35
# File 'lib/redox/models/patient.rb', line 31

def add_identifier(type: , value: )
  self[:Identifiers] << Identifier.new({'ID' => value, 'IDType' => type})

  return self
end

#add_insurance(data = {}) ⇒ Object



37
38
39
40
41
# File 'lib/redox/models/patient.rb', line 37

def add_insurance(data = {})
  self[:Insurances] << Insurance.new(data)

  return self
end

#create(meta: Meta.new) ⇒ Object



47
48
49
# File 'lib/redox/models/patient.rb', line 47

def create(meta: Meta.new)
  Redox::Request::PatientAdmin.create(patient: self, meta: meta)
end

#demographicsObject



14
15
16
17
# File 'lib/redox/models/patient.rb', line 14

def demographics
  self[:Demographics] = Demographics.new(self[:Demographics]) unless self[:Demographics].is_a?(Redox::Models::Demographics)
  self[:Demographics] ||= Demographics.new
end

#primary_care_providerObject



23
24
25
# File 'lib/redox/models/patient.rb', line 23

def primary_care_provider
  self[:PCP] ||= PCP.new
end

#update(meta: Meta.new) ⇒ Object



43
44
45
# File 'lib/redox/models/patient.rb', line 43

def update(meta: Meta.new)
  Redox::Request::PatientAdmin.update(patient: self, meta: meta)
end