Class: Renalware::Pathology::Patient

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

Instance Method Summary collapse

Instance Method Details

#current_drug_idsObject



43
44
45
# File 'app/models/renalware/pathology/patient.rb', line 43

def current_drug_ids
  @current_drug_ids ||= prescriptions.current.pluck(:drug_id).uniq
end

#fetch_current_observation_setObject



39
40
41
# File 'app/models/renalware/pathology/patient.rb', line 39

def fetch_current_observation_set
  current_observation_set || build_current_observation_set
end

#high_risk?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'app/models/renalware/pathology/patient.rb', line 35

def high_risk?
  Requests::HighRiskAlgorithm.new(self).patient_is_high_risk?
end

#last_request_for_patient_rule(patient_rule) ⇒ Object



14
15
16
17
18
19
20
21
# File 'app/models/renalware/pathology/patient.rb', line 14

def last_request_for_patient_rule(patient_rule)
  requests
    .includes(:patient_rules)
    .where(
      pathology_requests_patient_rules: { id: [patient_rule] }
    )
    .first
end

#required_observation_requests(clinic) ⇒ Object



23
24
25
26
27
# File 'app/models/renalware/pathology/patient.rb', line 23

def required_observation_requests(clinic)
  Requests::GlobalAlgorithm.new(
    self, clinic, date: date_for_algorithms
  ).determine_required_request_descriptions
end

#required_patient_pathologyObject



29
30
31
32
33
# File 'app/models/renalware/pathology/patient.rb', line 29

def required_patient_pathology
  Requests::PatientAlgorithm.new(
    self, date: date_for_algorithms
  ).determine_required_tests
end