Class: Redox::Models::Patient
Constant Summary
AbstractModel::HIGH_LEVEL_KEYS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Model
#initialize, #to_h
add_helpers, from_response, from_response_inflected, get_inflected_class, #to_json
Class Method Details
.query(params, meta: Meta.new) ⇒ Object
56
57
58
|
# File 'lib/redox/models/patient.rb', line 56
def query(params, meta: Meta.new)
Redox::Request::PatientSearch.query(params, meta: meta)
end
|
Instance Method Details
#add_identifier(type:, value:) ⇒ Object
35
36
37
38
39
|
# File 'lib/redox/models/patient.rb', line 35
def add_identifier(type:, value:)
self[:Identifiers] << Identifier.new({ 'ID' => value, 'IDType' => type })
self
end
|
#add_insurance(data = {}) ⇒ Object
41
42
43
44
45
|
# File 'lib/redox/models/patient.rb', line 41
def add_insurance(data = {})
self[:Insurances] << Insurance.new(data)
self
end
|
29
30
31
32
33
|
# File 'lib/redox/models/patient.rb', line 29
def contacts
self[:Contacts] = self[:Contacts].map do |contact|
contact.is_a?(Redox::Models::Contact) ? contact : Contact.new(contact)
end
end
|
#create(meta: Meta.new) ⇒ Object
51
52
53
|
# File 'lib/redox/models/patient.rb', line 51
def create(meta: Meta.new)
Redox::Request::PatientAdmin.create(patient: self, meta: meta)
end
|
#demographics ⇒ Object
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
|
#insurances ⇒ Object
19
20
21
22
23
|
# File 'lib/redox/models/patient.rb', line 19
def insurances
self[:Insurances] = self[:Insurances].map do |ins|
ins.is_a?(Redox::Models::Insurance) ? ins : Insurance.new(ins)
end
end
|
#primary_care_provider ⇒ Object
25
26
27
|
# File 'lib/redox/models/patient.rb', line 25
def primary_care_provider
self[:PCP] ||= PCP.new
end
|
#update(meta: Meta.new) ⇒ Object
47
48
49
|
# File 'lib/redox/models/patient.rb', line 47
def update(meta: Meta.new)
Redox::Request::PatientAdmin.update(patient: self, meta: meta)
end
|