Class: PreOp

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

Defined Under Namespace

Classes: ICD, PreRisk

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ PreOp

Returns a new instance of PreOp.



26
27
28
29
30
31
32
33
34
35
# File 'lib/aqi/pre_op.rb', line 26

def initialize(options)
  self.age           = validate_age(options.delete(:age))
  self.weight_pounds = options.delete(:weight_pounds)
  self.height_inches = options.delete(:height_inches)
  self.asa_class     = validate_asa_class(options.delete(:asa_class))
  self.pre_anesthesia_status = validate_pre_anesthesia_status(options.delete(:pre_anesthesia_status))

  self.icd_set       = setup_icd_set(options.delete(:icd_set))
  self.pre_risk_set  = setup_pre_risk_set(options.delete(:pre_risk_set))
end

Instance Attribute Details

#ageObject

Returns the value of attribute age.



24
25
26
# File 'lib/aqi/pre_op.rb', line 24

def age
  @age
end

#asa_classObject

Returns the value of attribute asa_class.



24
25
26
# File 'lib/aqi/pre_op.rb', line 24

def asa_class
  @asa_class
end

#height_inchesObject

Returns the value of attribute height_inches.



24
25
26
# File 'lib/aqi/pre_op.rb', line 24

def height_inches
  @height_inches
end

#icd_setObject

Returns the value of attribute icd_set.



24
25
26
# File 'lib/aqi/pre_op.rb', line 24

def icd_set
  @icd_set
end

#pre_anesthesia_statusObject

Returns the value of attribute pre_anesthesia_status.



24
25
26
# File 'lib/aqi/pre_op.rb', line 24

def pre_anesthesia_status
  @pre_anesthesia_status
end

#pre_risk_setObject

Returns the value of attribute pre_risk_set.



24
25
26
# File 'lib/aqi/pre_op.rb', line 24

def pre_risk_set
  @pre_risk_set
end

#weight_poundsObject

Returns the value of attribute weight_pounds.



24
25
26
# File 'lib/aqi/pre_op.rb', line 24

def weight_pounds
  @weight_pounds
end

Class Method Details

.asa_classesObject



37
38
39
# File 'lib/aqi/pre_op.rb', line 37

def self.asa_classes
  ["I", "II", "III", "IV", "V", "VI", "IE", "IIE", "IIIE", "IVE", "VE", "VIE"]
end

.pre_anesthesia_statusesObject



41
42
43
# File 'lib/aqi/pre_op.rb', line 41

def self.pre_anesthesia_statuses
  ["Awake", "Awake", "Asleep", "Confused", "Unresponsive", "Apprehensive", "Uncooperative", "OTHER", "UNKNOWN"]
end

Instance Method Details

#height_in_cmObject



45
46
47
# File 'lib/aqi/pre_op.rb', line 45

def height_in_cm
  self.height_inches.to_f / 0.3937
end

#to_xmlObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/aqi/pre_op.rb', line 53

def to_xml
  builder = Builder::XmlMarkup.new
  builder.PreOp do |pre|
    pre.Age(age)                 if age
    pre.Weight(weight_pounds)    if weight_pounds
    pre.WeightInKg(weight_in_kg) if weight_pounds
    pre.Height(height_inches)    if height_inches
    pre.HeightInCm(height_in_cm) if height_inches
    pre.ASAClass(asa_class)      if asa_class
    pre.PreAnesthStatus(pre_anesthesia_status) if pre_anesthesia_status

    pre.ICDSet do |set|
      icd_set.each do |icd|
        set << icd.to_xml
      end
    end

    pre.PreRiskSet do |set|
      pre_risk_set.each do |prs|
        set << prs.to_xml
      end
    end

#    pre.PreLabSet
  end
end

#weight_in_kgObject



49
50
51
# File 'lib/aqi/pre_op.rb', line 49

def weight_in_kg
 self.weight_pounds.to_f / 0.45359
end