Class: Renalware::Pathology::ObservationForPatientRequestDescriptionQuery

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/pathology/observation_for_patient_request_description_query.rb

Instance Method Summary collapse

Constructor Details

#initialize(patient, request_description) ⇒ ObservationForPatientRequestDescriptionQuery

Returns a new instance of ObservationForPatientRequestDescriptionQuery.



8
9
10
11
# File 'app/models/renalware/pathology/observation_for_patient_request_description_query.rb', line 8

def initialize(patient, request_description)
  @patient = patient
  @observation_description = request_description.required_observation_description
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
# File 'app/models/renalware/pathology/observation_for_patient_request_description_query.rb', line 13

def call
  @patient
    .observations
    .where(description: @observation_description)
    .order(observed_at: :desc)
    .first
end