Class: Renalware::Patient
Constant Summary
Renalware::PatientsRansackHelper::UUID_REGEXP
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#first_or_create_by!, #save_by, #save_by!, #update_by
Instance Attribute Details
#skip_death_validations ⇒ Object
Returns the value of attribute skip_death_validations.
102
103
104
|
# File 'app/models/renalware/patient.rb', line 102
def skip_death_validations
@skip_death_validations
end
|
Class Method Details
.policy_class ⇒ Object
113
114
115
|
# File 'app/models/renalware/patient.rb', line 113
def self.policy_class
BasePolicy
end
|
Instance Method Details
#assigned_to_primary_care_physician?(primary_care_physician) ⇒ Boolean
137
138
139
|
# File 'app/models/renalware/patient.rb', line 137
def assigned_to_primary_care_physician?(primary_care_physician)
self.primary_care_physician == primary_care_physician
end
|
#current_modality_death? ⇒ Boolean
145
146
147
148
149
|
# File 'app/models/renalware/patient.rb', line 145
def current_modality_death?
return false if current_modality.blank?
current_modality.description.is_a?(Deaths::ModalityDescription)
end
|
#diabetic? ⇒ Boolean
117
118
119
|
# File 'app/models/renalware/patient.rb', line 117
def diabetic?
document&.diabetes&.diagnosis == true
end
|
#hospital_identifier ⇒ Object
151
152
153
|
# File 'app/models/renalware/patient.rb', line 151
def hospital_identifier
hospital_identifiers.first
end
|
#hospital_identifiers ⇒ Object
#secure_id ⇒ Object
For compactness in urls, remove the dashes, so that
a12d9a8e-9cc9-4fbe-88dd-2d1c983ea04f
becomes
a12d9a8e9cc94fbe88dd2d1c983ea04f
27
28
29
|
# File 'app/models/renalware/patient.rb', line 27
def secure_id
@secure_id_without_dashes ||= super&.gsub("-", "")
end
|
#secure_id_dashed ⇒ Object
31
32
33
|
# File 'app/models/renalware/patient.rb', line 31
def secure_id_dashed
self[:secure_id]
end
|
#to_s(format = :default) ⇒ Object
Overrides Personable mixin
122
123
124
125
126
127
128
129
130
131
|
# File 'app/models/renalware/patient.rb', line 122
def to_s(format = :default)
title_suffix = " (#{title})" if has_title?
formatted_name = "#{family_name.upcase}, #{given_name}#{title_suffix}"
formatted_nhs_number = " (#{nhs_number})" if nhs_number.present?
case format
when :default then formatted_name
when :long then "#{formatted_name}#{formatted_nhs_number}"
else full_name
end
end
|
#validate_death_attributes? ⇒ Boolean
141
142
143
|
# File 'app/models/renalware/patient.rb', line 141
def validate_death_attributes?
current_modality_death? && !skip_death_validations
end
|