Sha256: 3734c199c42640548cf8cd0eea7542f3cbc897760775bf370bbcab0887f7dfb8
Contents?: true
Size: 856 Bytes
Versions: 28
Compression:
Stored size: 856 Bytes
Contents
require_dependency "renalware/pathology/requests" module Renalware module Pathology module Requests class GlobalRule class PrescriptionDrugCategory < GlobalRule validate :drug_category_present def observation_required_for_patient?(patient, _date) (patient.drugs.map(&:id) & drug_ids).any? end def to_s "prescribed drugs include #{drug_category.name}" end private def drug_ids drug_category.drugs.map(&:id) end def drug_category DrugCategory.find_by(id: param_id) end def drug_category_present return if drug_category.present? errors.add(:param_id, "param_id must be the id of a DrugCategory") end end end end end end
Version data entries
28 entries across 28 versions & 1 rubygems