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

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

Instance Method Summary collapse

Instance Method Details

#noneObject



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

def none
  self # NOOP
end

#patients_on_the_worry_boardObject Also known as: on_worryboard



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

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



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

def patients_with_a_transplant_date_in_the_past_3_months
  joins("LEFT JOIN transplant_recipient_operations\nON patients.id = transplant_recipient_operations.patient_id\n")
  .where("transplant_recipient_operations.performed_on >= ?", 3.months.ago)
end

#patients_with_a_transplant_operation_in_the_past_yearObject Also known as: past_year



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

def patients_with_a_transplant_operation_in_the_past_year
  joins("LEFT JOIN transplant_recipient_operations\nON patients.id = transplant_recipient_operations.patient_id\n")
  .where("transplant_recipient_operations.performed_on >= ?", 1.year.ago)
end