Class: Renalware::Pathology::Requests::RequestPresenter

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/presenters/renalware/pathology/requests/request_presenter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.present(requests) ⇒ Object



9
10
11
# File 'app/presenters/renalware/pathology/requests/request_presenter.rb', line 9

def self.present(requests)
  requests.map { |request| new request }
end

Instance Method Details

#clinical_detailObject Also known as: contact



29
30
31
# File 'app/presenters/renalware/pathology/requests/request_presenter.rb', line 29

def clinical_detail
  clinic.name
end

#consultantObject



25
26
27
# File 'app/presenters/renalware/pathology/requests/request_presenter.rb', line 25

def consultant
  request_form.consultant&.name
end

#dateObject



17
18
19
# File 'app/presenters/renalware/pathology/requests/request_presenter.rb', line 17

def date
  I18n.l Date.current
end

#date_of_birthObject



21
22
23
# File 'app/presenters/renalware/pathology/requests/request_presenter.rb', line 21

def date_of_birth
  I18n.l patient.born_on
end

#global_requests_by_lab_and_bottle_typeObject



44
45
46
47
48
# File 'app/presenters/renalware/pathology/requests/request_presenter.rb', line 44

def global_requests_by_lab_and_bottle_type
  request_descriptions.group_by do |request_description|
    [request_description.lab.name, request_description.bottle_type]
  end
end

#patient_nameObject



13
14
15
# File 'app/presenters/renalware/pathology/requests/request_presenter.rb', line 13

def patient_name
  patient.full_name.upcase
end

#patient_requests_by_labObject



50
51
52
# File 'app/presenters/renalware/pathology/requests/request_presenter.rb', line 50

def patient_requests_by_lab
  patient_rules.group_by { |patient_rule| patient_rule.lab.name }
end

#patient_rulesObject



40
41
42
# File 'app/presenters/renalware/pathology/requests/request_presenter.rb', line 40

def patient_rules
  ::Renalware::Pathology::Requests::PatientRulePresenter.present(super)
end

#requested_byObject



34
35
36
37
38
# File 'app/presenters/renalware/pathology/requests/request_presenter.rb', line 34

def requested_by
  return "" if created_by.nil?

  created_by.full_name
end