Sha256: 7ecfa83b598b06dc4d6263aed0f7a0d24257d6392774355f5d3f70df7a1f3215
Contents?: true
Size: 890 Bytes
Versions: 43
Compression:
Stored size: 890 Bytes
Contents
# frozen_string_literal: true 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.current_drug_ids & drug_ids).any? end def to_s "prescribed drugs include #{drug_category.name}" end private def drug_ids drug_category.drugs.pluck(: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
43 entries across 43 versions & 1 rubygems