Sha256: e586e550ebe0a2cdbb640be308f40b44431681de55aaa4a85bece7b5f2a99b41

Contents?: true

Size: 914 Bytes

Versions: 4

Compression:

Stored size: 914 Bytes

Contents

require_dependency "renalware"

module Renalware
  module UKRDC
    class PatientPresenter < SimpleDelegator
      delegate :allergies, to: :clinical_patient
      delegate :clinic_visits, to: :clinics_patient

      def smoking_history
        @smoking_history ||= document.history&.smoking&.upcase
      end

      def letters
        CollectionPresenter.new(
          letters_patient.letters.approved,
          Renalware::Letters::LetterPresenterFactory
        )
      end

      def hospital_unit_code
        letter_head.site_code
      end

      private

      def clinical_patient
        @clinical_patient ||= Renalware::Clinical.cast_patient(__getobj__)
      end

      def clinics_patient
        @clinic_patient ||= Renalware::Clinics.cast_patient(__getobj__)
      end

      def letters_patient
        @letters_patient ||= Renalware::Letters.cast_patient(__getobj__)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta7 app/presenters/renalware/ukrdc/patient_presenter.rb
renalware-core-2.0.0.pre.beta6 app/presenters/renalware/ukrdc/patient_presenter.rb
renalware-core-2.0.0.pre.beta5 app/presenters/renalware/ukrdc/patient_presenter.rb
renalware-core-2.0.0.pre.beta4 app/presenters/renalware/ukrdc/patient_presenter.rb