Sha256: d87062c20195df525d0b17601f023ed7f5a7d23a1c994b78f3b3766271a3ff17
Contents?: true
Size: 818 Bytes
Versions: 18
Compression:
Stored size: 818 Bytes
Contents
# frozen_string_literal: true module Renalware module HD # Find the lastest PrescriptionAdministration for a particular prescription - ie the last time # it was given. class PrescriptionLastAdministrationQuery pattr_initialize [:prescription!] delegate :patient, to: :prescription def self.call(prescription:) new(prescription: prescription).call end def call raise ArgumentError if prescription.blank? raise ArgumentError if patient.blank? hd_patient .prescription_administrations .where(prescription: prescription, administered: true) .order(recorded_on: :desc, created_at: :desc) .first end private def hd_patient HD.cast_patient(patient) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems