Class: Redox::Models::Visit

Inherits:
Model show all
Defined in:
lib/redox/models/visit.rb

Constant Summary collapse

DEFAULT_LOCATION =
{
  Department: nil,
  Facility: nil
}
DEFAULT_REFERRING_PROVIDER =
{
  ID: nil,
  IDType: nil,
  FirstName: nil,
  LastName: nil
}
DEFAULT_ATTENDING_PROVIDER =
{
  ID: nil,
  IDType: nil,
  FirstName: nil,
  LastName: nil
}

Constants inherited from AbstractModel

AbstractModel::HIGH_LEVEL_KEYS

Instance Method Summary collapse

Methods inherited from Model

#initialize

Methods inherited from AbstractModel

from_response, from_response_inflected

Constructor Details

This class inherits a constructor from Redox::Models::Model

Instance Method Details

#add_equipment(description: nil, code: nil) ⇒ Object



94
95
96
97
98
# File 'lib/redox/models/visit.rb', line 94

def add_equipment(description: nil, code: nil)
  self[:Equipment] ||= []
  self[:Equipment] << { Description: description, Code: code }
  self
end

#as_json(args = {}) ⇒ Object



118
119
120
# File 'lib/redox/models/visit.rb', line 118

def as_json(args = {})
  self.to_h.dig('Visit')
end

#attending_provider_first_name=(v) ⇒ Object



64
65
66
67
# File 'lib/redox/models/visit.rb', line 64

def attending_provider_first_name=(v)
  self[:AttendingProvider] ||= DEFAULT_ATTENDING_PROVIDER
  self[:AttendingProvider][:FirstName] = v
end

#attending_provider_id=(v) ⇒ Object



54
55
56
57
# File 'lib/redox/models/visit.rb', line 54

def attending_provider_id=(v)
  self[:AttendingProvider] ||= DEFAULT_ATTENDING_PROVIDER
  self[:AttendingProvider][:ID] = v
end

#attending_provider_id_type=(v) ⇒ Object



59
60
61
62
# File 'lib/redox/models/visit.rb', line 59

def attending_provider_id_type=(v)
  self[:AttendingProvider] ||= DEFAULT_ATTENDING_PROVIDER
  self[:AttendingProvider][:IDType] = v
end

#attending_provider_last_name=(v) ⇒ Object



69
70
71
72
# File 'lib/redox/models/visit.rb', line 69

def attending_provider_last_name=(v)
  self[:AttendingProvider] ||= DEFAULT_ATTENDING_PROVIDER
  self[:AttendingProvider][:LastName] = v
end

#department=(v) ⇒ Object



42
43
44
45
46
# File 'lib/redox/models/visit.rb', line 42

def department=(v)
  self[:Location] ||= DEFAULT_LOCATION
  self[:Location][:Department] = v
  self
end

#facility=(v) ⇒ Object



48
49
50
51
52
# File 'lib/redox/models/visit.rb', line 48

def facility=(v)
  self[:Location] ||= DEFAULT_LOCATION
  self[:Location][:Facility] = v
  self
end

#referring_provider_first_name=(v) ⇒ Object



84
85
86
87
# File 'lib/redox/models/visit.rb', line 84

def referring_provider_first_name=(v)
  self[:ReferringProvider] ||= DEFAULT_REFERRING_PROVIDER
  self[:ReferringProvider][:FirstName] = v
end

#referring_provider_id=(v) ⇒ Object



74
75
76
77
# File 'lib/redox/models/visit.rb', line 74

def referring_provider_id=(v)
  self[:ReferringProvider] ||= DEFAULT_REFERRING_PROVIDER
  self[:ReferringProvider][:ID] = v
end

#referring_provider_id_type=(v) ⇒ Object



79
80
81
82
# File 'lib/redox/models/visit.rb', line 79

def referring_provider_id_type=(v)
  self[:ReferringProvider] ||= DEFAULT_REFERRING_PROVIDER
  self[:ReferringProvider][:IDType] = v
end

#referring_provider_last_name=(v) ⇒ Object



89
90
91
92
# File 'lib/redox/models/visit.rb', line 89

def referring_provider_last_name=(v)
  self[:ReferringProvider] ||= DEFAULT_REFERRING_PROVIDER
  self[:ReferringProvider][:LastName] = v
end

#to_hObject



104
105
106
107
108
109
110
111
112
# File 'lib/redox/models/visit.rb', line 104

def to_h
  result = super.to_h

  %w[VisitDateTime DischargeDateTime].each do |k|
    result[key][k] = Redox::Models.format_datetime(result[key][k])
  end

  result
end

#to_json(args = {}) ⇒ Object



114
115
116
# File 'lib/redox/models/visit.rb', line 114

def to_json(args = {})
  self.to_h.to_json
end