Sha256: 6b1cf87fdb7584606417daab4b0086dab7e077cebda488fa807ab6ee3e9e06ec

Contents?: true

Size: 1.17 KB

Versions: 22

Compression:

Stored size: 1.17 KB

Contents

require_dependency "renalware/hd"
require "document/base"

module Renalware
  module HD
    class Profile < ApplicationRecord
      include Document::Base
      include PatientScope
      include Accountable
      include Supersedeable

      belongs_to :patient, touch: true
      belongs_to :hospital_unit, class_name: "Hospitals::Unit"
      belongs_to :dialysate
      belongs_to :prescriber, class_name: "User", foreign_key: "prescriber_id"
      belongs_to :named_nurse, class_name: "User", foreign_key: "named_nurse_id"
      belongs_to :transport_decider, class_name: "User", foreign_key: "transport_decider_id"
      belongs_to :schedule_definition, foreign_key: "schedule_definition_id"

      has_document class_name: "Renalware::HD::ProfileDocument"
      has_paper_trail class_name: "Renalware::HD::Version"

      validates :patient, presence: true
      validates :prescriber, presence: true

      delegate :hospital_centre, to: :hospital_unit, allow_nil: true

      scope :ordered, -> { order(deactivated_at: :desc) }
      scope :dialysing_at_unit, ->(unit_id) { where(hospital_unit_id: unit_id) }

      def self.policy_class
        BasePolicy
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
renalware-core-2.0.8 app/models/renalware/hd/profile.rb
renalware-core-2.0.7 app/models/renalware/hd/profile.rb
renalware-core-2.0.5 app/models/renalware/hd/profile.rb
renalware-core-2.0.4 app/models/renalware/hd/profile.rb
renalware-core-2.0.3 app/models/renalware/hd/profile.rb
renalware-core-2.0.2 app/models/renalware/hd/profile.rb
renalware-core-2.0.1 app/models/renalware/hd/profile.rb
renalware-core-2.0.0 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.rc13 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.rc11 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.rc10 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.rc9 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.rc8 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.rc7 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.rc6 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.rc5 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.rc4 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.rc3 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.rc1 app/models/renalware/hd/profile.rb
renalware-core-2.0.0.pre.beta12 app/models/renalware/hd/profile.rb