Sha256: 7b6f0a553a574bf8716d2503486c50754218598e287aac593b59453a5b5d3cbb

Contents?: true

Size: 1.51 KB

Versions: 15

Compression:

Stored size: 1.51 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
  field :diagnosis, type: Hash # This is a Hash to align with the 'Collection' object
  field :facility, type: Hash

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

  embeds_one :admission_source, class_name: "AdmissionSource"
  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=
  alias :admissionSource :admission_source
  alias :admissionSource= :admission_source=

  def shift_dates(date_diff)
    super
    if self.facility
      # Facility is now stored as a Hash; shift its dates by updating its start_time and end_time values.
      self.facility['start_time'] += date_diff if self.facility['start_time']
      self.facility['end_time'] += date_diff if self.facility['end_time']
    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

15 entries across 15 versions & 1 rubygems

Version Path
health-data-standards-4.3.5 lib/health-data-standards/models/encounter.rb
health-data-standards-4.3.4 lib/health-data-standards/models/encounter.rb
health-data-standards-4.3.3 lib/health-data-standards/models/encounter.rb
health-data-standards-4.3.2 lib/health-data-standards/models/encounter.rb
health-data-standards-4.3.1 lib/health-data-standards/models/encounter.rb
health-data-standards-4.3.0 lib/health-data-standards/models/encounter.rb
health-data-standards-4.2.0 lib/health-data-standards/models/encounter.rb
health-data-standards-4.1.0 lib/health-data-standards/models/encounter.rb
health-data-standards-4.0.6 lib/health-data-standards/models/encounter.rb
health-data-standards-4.0.5 lib/health-data-standards/models/encounter.rb
health-data-standards-4.0.4 lib/health-data-standards/models/encounter.rb
health-data-standards-4.0.3 lib/health-data-standards/models/encounter.rb
health-data-standards-4.0.2 lib/health-data-standards/models/encounter.rb
health-data-standards-4.0.1 lib/health-data-standards/models/encounter.rb
health-data-standards-4.0.0 lib/health-data-standards/models/encounter.rb