Sha256: db3c90e9c25fcba56859767f66f69dc04cfa8e4c1b6e3c15d7e7870cc5a73327

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

class Encounter < Entry
  field :admitType, as: :admit_type, type: Hash
  field :dischargeDisposition, as: :discharge_disposition, type: Hash
  field :admitTime, as: :admit_time, type: Integer
  field :dischargeTime, as: :discharge_time, type: Integer

  embeds_one :principalDiagnosis, class_name: "EncounterPrincipalDiagnosis"
  embeds_one :diagnosis, class_name: "EncounterPrincipalDiagnosis"
  
  embeds_one :transferTo, class_name: "Transfer"
  embeds_one :transferFrom, class_name: "Transfer"

  embeds_one :facility
  embeds_one :reason, class_name: "Entry"

  belongs_to :performer, class_name: "Provider"

  alias :transfer_to :transferTo
  alias :transfer_to= :transferTo=
  alias :transfer_from :transferFrom
  alias :transfer_from= :transferFrom=
  alias :principal_diagnosis :principalDiagnosis
  alias :principal_diagnosis= :principalDiagnosis=

  def shift_dates(date_diff)
    super
    if self.facility
      self.facility.shift_dates(date_diff)
    end

    if self.transferTo
      self.transferTo.shift_dates(date_diff)
    end

    if self.transferFrom
      self.transferFrom.shift_dates(date_diff)
    end

    self.admitTime = (self.admitTime.nil?) ? nil : self.admitTime + date_diff
    self.dischargeTime = (self.dischargeTime.nil?) ? nil : self.dischargeTime + date_diff
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
health-data-standards-3.7.0 lib/health-data-standards/models/encounter.rb