Sha256: 8445366ba5f301422f38db061020cae47d1f673cbec241346c7f4d92801cf440

Contents?: true

Size: 1.03 KB

Versions: 8

Compression:

Stored size: 1.03 KB

Contents

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

8 entries across 8 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta11 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.0.pre.beta10 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.0.pre.beta9 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.0.pre.beta8 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.0.pre.beta7 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.0.pre.beta6 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.0.pre.beta5 app/presenters/renalware/medications/prescription_presenter.rb
renalware-core-2.0.0.pre.beta4 app/presenters/renalware/medications/prescription_presenter.rb