Class: AQI::AnesthesiaStaff

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ AnesthesiaStaff

Returns a new instance of AnesthesiaStaff.



13
14
15
16
17
18
19
20
# File 'lib/aqi/anesthesia_staff.rb', line 13

def initialize(options)
  self.staff_id       = options[:staff_id]
  self.responsibility = validate_responsibility(options[:responsibility])
  self.role           = validate_role(options[:role])
  self.        = options[:sign_in]
  self.sign_out       = options[:sign_out]
  self.notes          = options[:notes]
end

Instance Attribute Details

#notesObject

Returns the value of attribute notes.



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

def notes
  @notes
end

#responsibilityObject

Returns the value of attribute responsibility.



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

def responsibility
  @responsibility
end

#roleObject

Returns the value of attribute role.



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

def role
  @role
end

#sign_inObject

Returns the value of attribute sign_in.



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

def 
  @sign_in
end

#sign_outObject

Returns the value of attribute sign_out.



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

def sign_out
  @sign_out
end

#staff_idObject

Returns the value of attribute staff_id.



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

def staff_id
  @staff_id
end

Class Method Details

.responsibilitiesObject



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

def self.responsibilities
  ["Supervisory", "Monitoring", "Administrative", "In charge", "Performing the case", "Medically responsible"]
end

.rolesObject



9
10
11
# File 'lib/aqi/anesthesia_staff.rb', line 9

def self.roles
  ["MD", "CRNA", "DO", "RESIDENT", "PACU Nurse", "AA"]
end

Instance Method Details

#to_xmlObject



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/aqi/anesthesia_staff.rb', line 30

def to_xml
  builder = Builder::XmlMarkup.new
  builder.AnesthesiaStaff do |as|
    as.StaffID(staff_id)
    as.StaffResponsibility(responsibility)      if responsibility
    as.StaffRole(role)                          if role
    as.StaffSignIn(.strftime('%FT%T'))   if 
    as.StaffSignOut(sign_out.strftime('%FT%T')) if sign_out
    as.StaffNotes(notes)                        if notes
  end
end

#validate_responsibility(value) ⇒ Object



22
23
24
# File 'lib/aqi/anesthesia_staff.rb', line 22

def validate_responsibility(value)
  self.class.responsibilities.include?(value) ? value : nil
end

#validate_role(value) ⇒ Object



26
27
28
# File 'lib/aqi/anesthesia_staff.rb', line 26

def validate_role(value)
  self.class.roles.include?(value) ? value : nil
end