Class: Renalware::Pathology::NearestObservationsQuery
- Inherits:
-
Object
- Object
- Renalware::Pathology::NearestObservationsQuery
- Defined in:
- app/models/renalware/pathology/nearest_observations_query.rb
Instance Method Summary collapse
-
#call ⇒ Object
rubocop:disable Metrics/MethodLength.
Instance Method Details
#call ⇒ Object
rubocop:disable Metrics/MethodLength
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/models/renalware/pathology/nearest_observations_query.rb', line 11 def call pathology_patient .observations .joins(:description) .where(description_id: observation_description_ids) .where("observed_at >= ?", (date - look_behind_days.days).beginning_of_day) .select( :observed_at, :result, :description_id, "pathology_observation_descriptions.code as code" ) .map do |row| { code: row.code, observed_on: row.observed_at.to_date, result: row.result } end end |