Class: Renalware::LowClearance::MDMPatientsQuery
- Inherits:
-
Object
- Object
- Renalware::LowClearance::MDMPatientsQuery
- Includes:
- ModalityScopes
- Defined in:
- app/models/renalware/low_clearance/mdm_patients_query.rb
Defined Under Namespace
Modules: NamedFilterScopes
Constant Summary collapse
- DEFAULT_SEARCH_PREDICATE =
"hgb_date DESC"
Instance Attribute Summary collapse
-
#named_filter ⇒ Object
readonly
Returns the value of attribute named_filter.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#relation ⇒ Object
readonly
Returns the value of attribute relation.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(relation: LowClearance::Patient.all, query: nil, named_filter: nil) ⇒ MDMPatientsQuery
constructor
A new instance of MDMPatientsQuery.
-
#search ⇒ Object
rubocop:disable Metrics/MethodLength.
Methods included from ModalityScopes
#with_current_modality_matching, #with_current_modality_of_class
Constructor Details
#initialize(relation: LowClearance::Patient.all, query: nil, named_filter: nil) ⇒ MDMPatientsQuery
Returns a new instance of MDMPatientsQuery.
12 13 14 15 16 17 |
# File 'app/models/renalware/low_clearance/mdm_patients_query.rb', line 12 def initialize(relation: LowClearance::Patient.all, query: nil, named_filter: nil) @query = query || {} @named_filter = named_filter || :none @query[:s] = DEFAULT_SEARCH_PREDICATE if @query[:s].blank? @relation = relation end |
Instance Attribute Details
#named_filter ⇒ Object (readonly)
Returns the value of attribute named_filter.
10 11 12 |
# File 'app/models/renalware/low_clearance/mdm_patients_query.rb', line 10 def named_filter @named_filter end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
10 11 12 |
# File 'app/models/renalware/low_clearance/mdm_patients_query.rb', line 10 def query @query end |
#relation ⇒ Object (readonly)
Returns the value of attribute relation.
10 11 12 |
# File 'app/models/renalware/low_clearance/mdm_patients_query.rb', line 10 def relation @relation end |
Instance Method Details
#call ⇒ Object
19 20 21 |
# File 'app/models/renalware/low_clearance/mdm_patients_query.rb', line 19 def call search.result end |
#search ⇒ Object
rubocop:disable Metrics/MethodLength
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/models/renalware/low_clearance/mdm_patients_query.rb', line 24 def search @search ||= begin relation .extending(PatientTransplantScopes) .extending(PatientPathologyScopes) .extending(ModalityScopes) .extending(NamedFilterScopes) .with_registration_statuses .with_current_pathology .left_outer_joins(:current_observation_set) .with_current_modality_of_class(LowClearance::ModalityDescription) .public_send(named_filter.to_s) .search(query) end end |