Sha256: 0d1a4aa0facbba77febc1ec376017644efad68529908c2249b0be6541c514f22

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require_dependency "renalware"

module Renalware
  module UKRDC
    class PatientPresenter < SimpleDelegator
      delegate :allergies, to: :clinical_patient
      delegate :clinic_visits, to: :clinics_patient
      delegate :observation_requests, to: :pathology_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

      def pathology_patient
        @pathology_patient ||= Renalware::Pathology.cast_patient(__getobj__)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta8 app/presenters/renalware/ukrdc/patient_presenter.rb