/** * Ajout des éléments Reponses * * @param string $statut Statut de l'acquittement * @param array $codes Codes d'erreurs * @param string $commentaires Commentaire * @param CMbObject $mbObject Object * @param array $data Datas * * @return void */ function addReponses($statut, $codes, $commentaires = null, $mbObject = null, $data = array()) { $acquittementsServeurActivitePmsi = $this->documentElement; $mbPatient = $mbSejour = null; if ($mbObject instanceof CSejour) { $mbPatient = $mbObject->loadRefPatient(); $mbSejour = $mbObject; } if ($mbObject instanceof COperation) { $mbPatient = $mbObject->loadRefSejour()->loadRefPatient(); $mbSejour = $mbObject->_ref_sejour; } // Ajout des réponses $reponses = $this->addElement($acquittementsServeurActivitePmsi, "reponses"); // Ajout du patient et de la venue $patient = $this->addElement($reponses, "patient"); if (isset($mbPatient->_id)) { $this->addPatient($patient, $mbPatient, false, true); } $venue = $this->addElement($reponses, "venue"); if (isset($mbSejour->_id)) { $this->addVenue($venue, $mbSejour, false, true); } if (!is_array($codes)) { if (!isset($mbPatient->_id)) { $this->addPatientError($reponses, $data); } $this->addReponseGeneral($reponses, $statut, $codes, null, $mbObject, $commentaires, $data); return; } // Génération des réponses en fonction du type de l'acquittement switch (get_class($this)) { case "CHPrimXMLAcquittementsServeurActes": if (!$data && !CMbArray::get($data, "CCAM") && !CMbArray::get($data, "NGAP")) { break; } $actesCCAM = $data["CCAM"]; $actesNGAP = $data["NGAP"]; foreach ($actesCCAM as $_acteCCAM) { $code_ccam = $codes[$_acteCCAM["idSourceActeCCAM"]]; $this->addReponseCCAM($reponses, $_acteCCAM["statut"], $code_ccam["code"], $_acteCCAM, $mbObject, $code_ccam["commentaires"]); } foreach ($actesNGAP as $_acteNGAP) { $code_ngap = $codes[$_acteNGAP["idSourceActeNGAP"]]; $this->addReponseNGAP($reponses, $_acteNGAP["statut"], $code_ngap["code"], $_acteNGAP, $mbObject, $code_ngap["commentaires"]); } break; case "CHPrimXMLAcquittementsServeurIntervention": $this->addReponseIntervention($reponses, $statut, $codes, null, $mbObject, $commentaires); break; } }