Sha256: 2e326e3ce5f5d1b6e0cc461712bab9582efdeaa512f1000968ba3cd7919903a7

Contents?: true

Size: 921 Bytes

Versions: 1

Compression:

Stored size: 921 Bytes

Contents

require "renalware/letters/part"

module Renalware
  module Letters
    class Part::RecentPathologyResults < Part

      delegate :each, :present?, to: :recent_pathology_results

      def to_partial_path
        "renalware/letters/parts/recent_pathology_results"
      end

      private

      def recent_pathology_results
        @recent_pathology_results ||= find_recent_pathology_results
      end

      def find_recent_pathology_results
        presenter = Pathology::CurrentObservationResults::Presenter.new
        descriptions = Letters::RelevantObservationDescription.all
        results = Pathology::CurrentObservationsForDescriptionsQuery
          .new(patient: @patient, descriptions: descriptions)
          .call
        # Removes the header from the results, this will be unnecessary when
        # a custom Presenter is implemented
        presenter.present(results)[1..-1]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta4 app/models/renalware/letters/part/recent_pathology_results.rb