Class: Encounter

Inherits:
Entry show all
Defined in:
lib/health-data-standards/models/encounter.rb

Instance Method Summary collapse

Methods inherited from Entry

#==, #add_reference, #as_point_in_time, #calculate_hash!, from_event_hash, #hash, #identifier, #is_date_range?, #is_in_code_set?, #set_value, #status, #status=, time_to_s, #times_to_s, #to_hash, #usable?

Methods included from ThingWithCodes

#add_code, #codes_in_code_set, #codes_to_s, convert_codes_to_s, included, #preferred_code, #single_code_value?, #translation_codes

Instance Method Details

#shift_dates(date_diff) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/health-data-standards/models/encounter.rb', line 28

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