/**
  * Handle event
  *
  * @param CHL7v2Acknowledgment $ack        Acknowledgement
  * @param CPatient             $newPatient Person
  * @param array                $data       Nodes data
  *
  * @return null|string
  */
 function handle(CHL7v2Acknowledgment $ack, CPatient $newPatient, $data)
 {
     $event_temp = $ack->event;
     $exchange_hl7v2 = $this->_ref_exchange_hl7v2;
     $sender = $exchange_hl7v2->_ref_sender;
     $sender->loadConfigValues();
     $this->_ref_sender = $sender;
     // Acquittement d'erreur : identifiants RI et NA, VN non fournis
     if (!$data['admitIdentifiers'] && !$this->getVenueAN($sender, $data)) {
         return $exchange_hl7v2->setAckAR($ack, "E200", null, $newPatient);
     }
     // Traitement du patient
     $hl7v2_record_person = new CHL7v2RecordPerson();
     $hl7v2_record_person->_ref_exchange_hl7v2 = $exchange_hl7v2;
     $msg_ack = $hl7v2_record_person->handle($ack, $newPatient, $data);
     // Retour de l'acquittement si erreur sur le traitement du patient
     if ($exchange_hl7v2->statut_acquittement == "AR") {
         return $msg_ack;
     }
     // Traitement du séjour
     $ack = new CHL7v2Acknowledgment($event_temp);
     $ack->message_control_id = $data['identifiantMessage'];
     $ack->_ref_exchange_hl7v2 = $exchange_hl7v2;
     $newVenue = new CSejour();
     // Affectation du patient
     $newVenue->patient_id = $newPatient->_id;
     $newVenue->loadRefPatient();
     // Affectation de l'établissement
     $newVenue->group_id = $sender->group_id;
     $function_handle = "handle{$exchange_hl7v2->code}";
     if (!method_exists($this, $function_handle)) {
         return $exchange_hl7v2->setAckAR($ack, "E006", null, $newVenue);
     }
     return $this->{$function_handle}($ack, $newVenue, $data);
 }
 /**
  * Get PID
  *
  * @param DOMNode            $node         Node
  * @param CPatient           $patient      Person
  * @param CHL7v2RecordPerson $recordPerson Record person
  *
  * @return void
  */
 function getPerson(DOMNode $node, CPatient $patient, CHL7v2RecordPerson $recordPerson)
 {
     $recordPerson->getPID($node, $patient);
     $patient->_IPP = "";
     $patient->_OID = "";
     foreach ($this->queryNodes("PID.3", $node) as $_PID_3) {
         $patient->_IPP .= $this->queryTextNode("CX.1", $_PID_3) . "\n";
         $patient->_OID .= $this->queryTextNode("CX.4/HD.2", $_PID_3) . "\n";
     }
     $patient->updateFormFields();
     $patient->loadRefsNotes();
 }