Class: Renalware::Patients::DeceasedPatientsQuery
- Inherits:
-
Object
- Object
- Renalware::Patients::DeceasedPatientsQuery
- Defined in:
- app/models/renalware/patients/deceased_patients_query.rb
Overview
Finds patients with a death modality or who have a died_on date
Instance Attribute Summary collapse
-
#query_params ⇒ Object
readonly
Returns the value of attribute query_params.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(query_params) ⇒ DeceasedPatientsQuery
constructor
A new instance of DeceasedPatientsQuery.
- #search ⇒ Object
Constructor Details
#initialize(query_params) ⇒ DeceasedPatientsQuery
Returns a new instance of DeceasedPatientsQuery.
9 10 11 12 |
# File 'app/models/renalware/patients/deceased_patients_query.rb', line 9 def initialize(query_params) @query_params = query_params || {} @query_params[:s] = "family_name ASC" if @query_params[:s].blank? end |
Instance Attribute Details
#query_params ⇒ Object (readonly)
Returns the value of attribute query_params.
7 8 9 |
# File 'app/models/renalware/patients/deceased_patients_query.rb', line 7 def query_params @query_params end |
Instance Method Details
#call ⇒ Object
14 15 16 |
# File 'app/models/renalware/patients/deceased_patients_query.rb', line 14 def call search.result.where(id: ids_of_deceased_patients) end |
#search ⇒ Object
18 19 20 21 22 |
# File 'app/models/renalware/patients/deceased_patients_query.rb', line 18 def search Patient .includes(:first_cause, current_modality: :description) .ransack(query_params) end |