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



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

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

Instance Method Details

#add_identifier(type:, value:) ⇒ Object



25
26
27
28
29
# File 'lib/redox/models/patient.rb', line 25

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

  return self
end

#add_insurance(data = {}) ⇒ Object



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

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

  return self
end

#create(meta: Meta.new) ⇒ Object



41
42
43
# File 'lib/redox/models/patient.rb', line 41

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

#demographicsObject



12
13
14
15
# File 'lib/redox/models/patient.rb', line 12

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

#primary_care_providerObject



21
22
23
# File 'lib/redox/models/patient.rb', line 21

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

#update(meta: Meta.new) ⇒ Object



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

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