Class: Renalware::Pathology::Requests::RequestPresenter
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Renalware::Pathology::Requests::RequestPresenter
- Defined in:
- app/presenters/renalware/pathology/requests/request_presenter.rb
Class Method Summary collapse
Instance Method Summary collapse
- #clinical_detail ⇒ Object (also: #contact)
- #consultant ⇒ Object
- #date ⇒ Object
- #date_of_birth ⇒ Object
- #global_requests_by_lab_and_bottle_type ⇒ Object
- #patient_name ⇒ Object
- #patient_requests_by_lab ⇒ Object
- #patient_rules ⇒ Object
- #requested_by ⇒ Object
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_detail ⇒ Object Also known as: contact
29 30 31 |
# File 'app/presenters/renalware/pathology/requests/request_presenter.rb', line 29 def clinical_detail clinic.name end |
#consultant ⇒ Object
25 26 27 |
# File 'app/presenters/renalware/pathology/requests/request_presenter.rb', line 25 def consultant request_form.consultant&.name end |
#date ⇒ Object
17 18 19 |
# File 'app/presenters/renalware/pathology/requests/request_presenter.rb', line 17 def date I18n.l Date.current end |
#date_of_birth ⇒ Object
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_type ⇒ Object
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_name ⇒ Object
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_lab ⇒ Object
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_rules ⇒ Object
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_by ⇒ Object
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 |