/** * Mapping et enregistrement de la naissance * * @param CSejour $newVenue Admit * @param array $data Datas * * @return string|null */ function mapAndStoreNaissance(CSejour $newVenue, $data) { if ($this->queryTextNode("PV1.4", $data["PV1"]) != "N") { return null; } // Récupération du séjour de la maman if (!($mother_AN = $this->getANMotherIdentifier($data["PID"]))) { return CAppUI::tr("CHL7Event-AA-E227"); } $sender = $this->_ref_sender; $idex_mother = CIdSante400::getMatch("CSejour", $sender->_tag_sejour, $mother_AN); if (!$idex_mother->_id) { return CAppUI::tr("CHL7Event-AA-E228"); } $sejour_mother = new CSejour(); $sejour_mother->load($idex_mother->object_id); // Récupération de l'IPP de la maman if (!($mother_PI = $this->getPIMotherIdentifier($data["PID"]))) { return CAppUI::tr("CHL7Event-AA-E229"); } if (CIdSante400::getMatch("CPatient", $sender->_tag_patient, $mother_PI)->object_id != $sejour_mother->patient_id) { return CAppUI::tr("CHL7Event-AA-E230"); } $naissance = new CNaissance(); $naissance->sejour_enfant_id = $newVenue->_id; $naissance->sejour_maman_id = $sejour_mother->_id; $naissance->grossesse_id = $sejour_mother->grossesse_id; $naissance->loadMatchingObject(); $naissance->rang = $this->queryTextNode("PID.25", $data["PID"]); // On récupère l'entrée réelle ssi msg A01 pour indiquer l'heure de la naissance if ($this->_ref_exchange_hl7v2->code == "A01") { $naissance->date_time = $this->queryTextNode("PV1.44", $data["PV1"]); } // Notifier les autres destinataires autre que le sender $naissance->_eai_sender_guid = $sender->_guid; return $naissance->store(); }