Module: Renalware::Transplants::MDMPatientsQuery::NamedFilterScopes

Defined in:
app/models/renalware/transplants/mdm_patients_query.rb

Instance Method Summary collapse

Instance Method Details

#noneObject



42
43
44
# File 'app/models/renalware/transplants/mdm_patients_query.rb', line 42

def none
  self # NOOP
end

#patients_on_the_worry_boardObject Also known as: on_worryboard



55
56
57
# File 'app/models/renalware/transplants/mdm_patients_query.rb', line 55

def patients_on_the_worry_board
  joins("RIGHT OUTER JOIN patient_worries ON patient_worries.patient_id = patients.id")
end

#patients_with_a_transplant_date_in_the_past_3_monthsObject Also known as: recent



46
47
48
49
50
51
52
# File 'app/models/renalware/transplants/mdm_patients_query.rb', line 46

def patients_with_a_transplant_date_in_the_past_3_months
  joins(<<-SQL.squish)
    LEFT JOIN transplant_recipient_operations
    ON patients.id = transplant_recipient_operations.patient_id
  SQL
  .where("transplant_recipient_operations.performed_on >= ?", 3.months.ago)
end

#patients_with_a_transplant_operation_in_the_past_yearObject Also known as: past_year



60
61
62
63
64
65
66
# File 'app/models/renalware/transplants/mdm_patients_query.rb', line 60

def patients_with_a_transplant_operation_in_the_past_year
  joins(<<-SQL.squish)
    LEFT JOIN transplant_recipient_operations
    ON patients.id = transplant_recipient_operations.patient_id
  SQL
  .where("transplant_recipient_operations.performed_on >= ?", 1.year.ago)
end