Method: DdeClient::DdeService#save_remote_patient

Defined in:
app/services/dde_client/dde_service.rb

#save_remote_patient(remote_patient) ⇒ Object

Convert a Dde person to an openmrs person.

NOTE: This creates a person on the database.



278
279
280
281
282
283
284
285
286
287
288
# File 'app/services/dde_client/dde_service.rb', line 278

def save_remote_patient(remote_patient)
  LOGGER.debug "Converting Dde person to openmrs: #{remote_patient}"
  params = dde_patient_to_local_person(remote_patient)

  Person.transaction do
    person = person_service.create_person(params)

    patient = Patient.create(patient_id: person.id)
    merging_service.link_local_to_remote_patient(patient, remote_patient)
  end
end