Sha256: d093e81d1ac505ba2ea93f632f0a8913c180f1ea92354b715af4a2ca9ae81734

Contents?: true

Size: 946 Bytes

Versions: 68

Compression:

Stored size: 946 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/renal"

module Renalware
  module Renal
    class AKIAlert < ApplicationRecord
      include Accountable
      include PatientsRansackHelper
      scope :ordered, -> { order(created_at: :desc) }
      belongs_to :patient, class_name: "Renal::Patient", touch: true
      belongs_to :action, class_name: "Renal::AKIAlertAction"
      belongs_to :hospital_ward, class_name: "Hospitals::Ward"
      validates :patient, presence: true
      validates :max_aki, inclusion: 1..3, allow_nil: true
      alias_attribute :decided_by, :updated_by

      scope :today, -> { where(created_at: Time.zone.today.all_day) }
      scope :hotlist, -> { where(hotlist: true) }

      has_paper_trail class_name: "Renalware::Renal::Version", on: [:create, :update, :destroy]

      ransacker :created_at_casted do |_parent|
        Arel.sql("date(renal_aki_alerts.created_at)")
      end
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
renalware-core-2.0.128 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.127 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.126 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.125 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.124 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.123 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.121 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.120 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.119 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.118 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.117 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.116 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.115 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.113 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.112 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.111 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.110 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.109 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.108 app/models/renalware/renal/aki_alert.rb
renalware-core-2.0.106 app/models/renalware/renal/aki_alert.rb