Sha256: 1f5e8e63f9e4a4803effd02eb1402a332ec0fe4a2dbe5f05e0bd7b8bb99a0513

Contents?: true

Size: 1.06 KB

Versions: 72

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require_dependency "renalware/medications"

module Renalware
  module Medications
    class PrescriptionPresenter < DumbDelegator
      delegate :drug_types, to: :drug
      delegate :local_patient_id, :age, :sex, :current_modality, to: :patient, prefix: true

      def patient_name
        patient.to_s
      end

      def patient_current_modality_name
        return unless patient_current_modality

        patient_current_modality.description.to_s
      end

      def route_code
        medication_route.other? ? route_description : medication_route.code
      end

      def drug_type_names
        drug_types.map(&:name).join(", ")
      end

      def provider
        ::I18n.t(super, scope: "enums.provider")
      end

      def dose
        "#{dose_amount} #{translated_dose_unit}"
      end

      def administer_on_hd?
        administer_on_hd ? "Yes" : "No"
      end

      private

      def translated_dose_unit
        ::I18n.t(dose_unit, scope: "enumerize.renalware.medications.prescription.dose_unit")
      end
    end
  end
end

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
renalware-core-2.0.102 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.101 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.100 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.99 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.98 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.97 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.96 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.95 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.94 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.93 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.92 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.91 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.90 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.89 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.88 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.87 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.86 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.85 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.84 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.83 app/presenters/renalware/medications/prescription_presenter.rb