Class: Renalware::Pathology::Requests::GlobalRule::LatestCRFOlderThanWeeks

Inherits:
Renalware::Pathology::Requests::GlobalRule show all
Defined in:
app/models/renalware/pathology/requests/global_rule/latest_crf_older_than_weeks.rb

Constant Summary

Constants inherited from Renalware::Pathology::Requests::GlobalRule

PARAM_COMPARISON_OPERATORS

Instance Method Summary collapse

Instance Method Details

#observation_required_for_patient?(patient, date) ⇒ Boolean

Returns true if the patient has a transplant registration with a latest CRF date older than <param_comparison_value> weeks ago.

Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
22
23
# File 'app/models/renalware/pathology/requests/global_rule/latest_crf_older_than_weeks.rb', line 14

def observation_required_for_patient?(patient, date)
  registration = registration_for(patient)
  return false unless registration

  latest_crf_date = registration.document.crf.latest.recorded_on
  return false if latest_crf_date.blank?

  max_crf_date = date - param_comparison_value.to_i.weeks
  latest_crf_date < max_crf_date
end

#to_sObject



25
26
27
# File 'app/models/renalware/pathology/requests/global_rule/latest_crf_older_than_weeks.rb', line 25

def to_s
  "latest CRF older than #{param_comparison_value} weeks"
end