Class: Patient
- Inherits:
-
Object
- Object
- Patient
- Defined in:
- lib/ruby_astm/patient.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#orders ⇒ Object
Returns the value of attribute orders.
-
#patient_id ⇒ Object
Returns the value of attribute patient_id.
-
#sequence_number ⇒ Object
sequence number can only be from 0 – 9.
Instance Method Summary collapse
-
#build_response(options) ⇒ Object
patient id.
-
#initialize(args = {}) ⇒ Patient
constructor
A new instance of Patient.
- #set_patient_id(args) ⇒ Object
- #set_sequence_number(args) ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Patient
Returns a new instance of Patient.
20 21 22 23 24 |
# File 'lib/ruby_astm/patient.rb', line 20 def initialize(args={}) set_sequence_number(args) set_patient_id(args) self.orders = [] end |
Instance Attribute Details
#orders ⇒ Object
Returns the value of attribute orders.
6 7 8 |
# File 'lib/ruby_astm/patient.rb', line 6 def orders @orders end |
#patient_id ⇒ Object
Returns the value of attribute patient_id.
5 6 7 |
# File 'lib/ruby_astm/patient.rb', line 5 def patient_id @patient_id end |
#sequence_number ⇒ Object
sequence number can only be from 0 – 9.
4 5 6 |
# File 'lib/ruby_astm/patient.rb', line 4 def sequence_number @sequence_number end |
Instance Method Details
#build_response(options) ⇒ Object
patient id.
27 28 29 30 31 32 33 |
# File 'lib/ruby_astm/patient.rb', line 27 def build_response() if ([:machine_name] && ([:machine_name] == "cobas-e411")) "P|1\r" else "P|#{self.sequence_number}|#{self.patient_id}|||||||||||||||\r" end end |
#set_patient_id(args) ⇒ Object
16 17 18 |
# File 'lib/ruby_astm/patient.rb', line 16 def set_patient_id(args) self.patient_id = args[:patient_id] end |
#set_sequence_number(args) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/ruby_astm/patient.rb', line 8 def set_sequence_number(args) if line = args[:line] self.sequence_number = line.fields[-1].to_i else self.sequence_number = args[:sequence_number] end end |
#to_json ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/ruby_astm/patient.rb', line 35 def to_json hash = {} self.instance_variables.each do |x| hash[x] = self.instance_variable_get x end return hash.to_json end |