Class: Renalware::Patients::Ingestion::MessageMappers::Patient

Inherits:
Renalware::Patients::Ingestion::MessageMapper show all
Defined in:
app/models/renalware/patients/ingestion/message_mappers/patient.rb

Overview

Given an HL7 message that instructs us to update a patient (eg ADT^A31) or add a new one (ADT^A28) we parse the patient level information from the HL7 message and update or create the patient.

Instance Attribute Summary collapse

Attributes inherited from Renalware::Patients::Ingestion::MessageMapper

#message

Instance Method Summary collapse

Constructor Details

#initialize(message, patient = nil) ⇒ Patient

Returns a new instance of Patient.



16
17
18
19
20
# File 'app/models/renalware/patients/ingestion/message_mappers/patient.rb', line 16

def initialize(message, patient = nil)
  @patient = patient || ::Renalware::Patient.new

  super(message)
end

Instance Attribute Details

#patientObject (readonly)

Returns the value of attribute patient.



22
23
24
# File 'app/models/renalware/patients/ingestion/message_mappers/patient.rb', line 22

def patient
  @patient
end

Instance Method Details

#fetchObject



24
25
26
27
# File 'app/models/renalware/patients/ingestion/message_mappers/patient.rb', line 24

def fetch
  map_attributes
  patient
end