Sha256: 50b7e3cbddf6a329e17889abc9cfe0d7c752c0137098befdf96237f20d11e01e
Contents?: true
Size: 1.37 KB
Versions: 28
Compression:
Stored size: 1.37 KB
Contents
require_dependency "renalware/pathology/requests" module Renalware module Pathology module Requests class Request < ApplicationRecord include Accountable TEMPLATES = %w(crs manual).freeze belongs_to :patient, class_name: "::Renalware::Pathology::Patient", touch: true belongs_to :clinic, class_name: "::Renalware::Clinics::Clinic" belongs_to :consultant, class_name: "::Renalware::Pathology::Consultant" has_and_belongs_to_many :request_descriptions, class_name: "::Renalware::Pathology::RequestDescription" has_and_belongs_to_many :patient_rules, class_name: "::Renalware::Pathology::Requests::PatientRule" validates :patient, presence: true validates :clinic, presence: true validates :consultant, presence: true validates :template, presence: true validates :template, inclusion: { in: TEMPLATES, allow_nil: false } def print_form save end def has_global_requests? request_descriptions.any? end def has_patient_requests? patient_rules.any? end def has_tests_required? has_global_requests? || has_patient_requests? end def requested_on created_at.to_date end alias_method :printed_on, :requested_on end end end end
Version data entries
28 entries across 28 versions & 1 rubygems