Class: AQI::AnesthesiaCase

Inherits:
Object
  • Object
show all
Defined in:
lib/aqi/anesthesia_case.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ AnesthesiaCase

Returns a new instance of AnesthesiaCase.



10
11
12
13
14
15
# File 'lib/aqi/anesthesia_case.rb', line 10

def initialize(options)
  self.anesthesia_record_id = options[:anesthesia_record_id]
  self.anesthesia_coverage  = validate_anesthesia_coverage(options[:anesthesia_coverage])
  self.anesthesia_staff_set = options[:anesthesia_staff_set] || []
  self.monitoring_set       = options[:monitoring_set]       || []
end

Instance Attribute Details

#anesthesia_coverageObject

Returns the value of attribute anesthesia_coverage.



3
4
5
# File 'lib/aqi/anesthesia_case.rb', line 3

def anesthesia_coverage
  @anesthesia_coverage
end

#anesthesia_record_idObject

Returns the value of attribute anesthesia_record_id.



3
4
5
# File 'lib/aqi/anesthesia_case.rb', line 3

def anesthesia_record_id
  @anesthesia_record_id
end

#anesthesia_staff_setObject

Returns the value of attribute anesthesia_staff_set.



3
4
5
# File 'lib/aqi/anesthesia_case.rb', line 3

def anesthesia_staff_set
  @anesthesia_staff_set
end

#monitoring_setObject

Returns the value of attribute monitoring_set.



3
4
5
# File 'lib/aqi/anesthesia_case.rb', line 3

def monitoring_set
  @monitoring_set
end

Class Method Details

.anesthesia_coveragesObject



5
6
7
8
# File 'lib/aqi/anesthesia_case.rb', line 5

def self.anesthesia_coverages
  ["MD-ALONE", "MD-DIRECTING", "CRNA-DIRECTED", "CRNA-ALONE",
    "MD-SUPERVISING", "CRNA-DIRECTING", "MD-MD"]
end

Instance Method Details

#to_xmlObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/aqi/anesthesia_case.rb', line 21

def to_xml
  builder = Builder::XmlMarkup.new
  builder.AnesthesiaCase do |ac|
    ac.AnesthesiaRecordID(anesthesia_record_id)
    ac.AnesthesiaCoverage(anesthesia_coverage) if anesthesia_coverage
    ac.AnesthesiaStaffSet do |ass|
      anesthesia_staff_set.each do |as|
        ass << as.to_xml
      end
    end
  end
end

#validate_anesthesia_coverage(value) ⇒ Object



17
18
19
# File 'lib/aqi/anesthesia_case.rb', line 17

def validate_anesthesia_coverage(value)
  self.class.anesthesia_coverages.include?(value) ? value : nil
end