Class: HealthcarePhony::Adt

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(init_args = {}) ⇒ Adt

Returns a new instance of Adt.



16
17
18
19
20
21
22
23
# File 'lib/healthcare_phony.rb', line 16

def initialize(init_args = {})
  @adt_arguments = init_args
  @adt_arguments[:message_types] = 'ADT'
  set_template
  @hl7_message = Hl7Message.new(@adt_arguments)
  @patient = Patient.new(@adt_arguments)
  @visit = PatientVisit.new(@adt_arguments.merge({ visit_type: set_visit_type }))
end

Instance Attribute Details

#adt_argumentsObject (readonly)

Returns the value of attribute adt_arguments.



14
15
16
# File 'lib/healthcare_phony.rb', line 14

def adt_arguments
  @adt_arguments
end

#hl7_messageObject (readonly)

Returns the value of attribute hl7_message.



14
15
16
# File 'lib/healthcare_phony.rb', line 14

def hl7_message
  @hl7_message
end

#patientObject (readonly)

Returns the value of attribute patient.



14
15
16
# File 'lib/healthcare_phony.rb', line 14

def patient
  @patient
end

#templateObject (readonly)

Returns the value of attribute template.



14
15
16
# File 'lib/healthcare_phony.rb', line 14

def template
  @template
end

#visitObject (readonly)

Returns the value of attribute visit.



14
15
16
# File 'lib/healthcare_phony.rb', line 14

def visit
  @visit
end

Instance Method Details

#to_sObject



25
26
27
28
# File 'lib/healthcare_phony.rb', line 25

def to_s
  erb_template = ERB.new(@template)
  erb_template.result_with_hash({ patient: @patient, hl7: @hl7_message, visit: @visit })
end