Sha256: 36fd370dd7c3f7edca3198329150b3f37f2d02353dd15b4390dcd1658bbf318e

Contents?: true

Size: 1.31 KB

Versions: 102

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

require_dependency "renalware/pathology"

module Renalware
  module Pathology
    module Requests
      class RequestPresenter < SimpleDelegator
        def self.present(requests)
          requests.map { |request| new request }
        end

        def patient_name
          patient.full_name.upcase
        end

        def date
          I18n.l Date.current
        end

        def date_of_birth
          I18n.l patient.born_on
        end

        def consultant
          request_form.consultant.full_name
        end

        def clinical_detail
          clinic.name
        end
        alias_method :contact, :clinical_detail

        def requested_by
          return "" if created_by.nil?

          created_by.full_name
        end

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

        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

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

        private

        def request_form
          __getobj__
        end
      end
    end
  end
end

Version data entries

102 entries across 102 versions & 1 rubygems

Version Path
renalware-core-2.0.68 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.67 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.64 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.63 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.62 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.61 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.60 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.58 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.57 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.56 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.55 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.54 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.53 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.52 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.51 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.50 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.48 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.47 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.46 app/presenters/renalware/pathology/requests/request_presenter.rb
renalware-core-2.0.45 app/presenters/renalware/pathology/requests/request_presenter.rb