/** * Récupération de la location du patient * * @param DOMNode $node PV1 Node * @param CAffectation $affectation Affectation * @param CSejour $newVenue Séjour * * @return void */ function getPL(DOMNode $node, CAffectation $affectation, CSejour $newVenue = null) { $sender = $this->_ref_sender; // Récupération de la chambre $nom_chambre = $this->queryTextNode("PL.2", $node); $chambre = new CChambre(); // Récupération du lit $nom_lit = $this->queryTextNode("PL.3", $node); $lit = new C**t(); switch ($sender->_configs["handle_PV1_3"]) { // idex du service case 'idex': $chambre_id = CIdSante400::getMatch("CChambre", $sender->_tag_chambre, $nom_chambre)->object_id; $chambre->load($chambre_id); $lit_id = CIdSante400::getMatch("C**t", $sender->_tag_lit, $nom_lit)->object_id; $lit->load($lit_id); break; // Dans tous les cas le nom du lit est celui que l'on reçoit du flux // Dans tous les cas le nom du lit est celui que l'on reçoit du flux default: $where = $ljoin = array(); $ljoin["service"] = "service.service_id = chambre.service_id"; $where["chambre.nom"] = " = '{$nom_chambre}'"; $where["chambre.annule"] = " = '0'"; $where["group_id"] = " = '{$sender->group_id}'"; $chambre->escapeValues(); $chambre->loadObject($where, null, null, $ljoin); $chambre->unescapeValues(); $where = $ljoin = array(); $ljoin["chambre"] = "chambre.chambre_id = lit.chambre_id"; $ljoin["service"] = "service.service_id = chambre.service_id"; $where["lit.nom"] = " = '{$nom_lit}'"; $where["lit.annule"] = " = '0'"; $where["service.cancelled"] = " = '0'"; $where["group_id"] = " = '{$sender->group_id}'"; if ($chambre->_id) { $where["chambre.chambre_id"] = " = '{$chambre->_id}'"; } $lit->escapeValues(); $lit->loadObject($where, null, null, $ljoin); $lit->unescapeValues(); break; } // Affectation du lit $affectation->lit_id = $lit->_id; // Affectation de l'UF hébergement $date_deb = $affectation->_id ? CMbDT::date($affectation->sortie) : CMbDT::date($newVenue->sortie); $date_fin = $affectation->_id ? CMbDT::date($affectation->entree) : CMbDT::date($newVenue->entree); $uf = CUniteFonctionnelle::getUF($this->queryTextNode("PL.1", $node), "hebergement", $newVenue->group_id, $date_deb, $date_fin); if (!$uf->_id) { return; } $affectation->uf_hebergement_id = $uf->_id; // Affectation du service (couloir) if (!$affectation->lit_id) { $affectation_uf = new CAffectationUniteFonctionnelle(); $affectation_uf->uf_id = $uf->_id; $affectation_uf->object_class = "CService"; $affectation_uf->loadMatchingObject(); $affectation->service_id = $affectation_uf->object_id; } }
/** * Récupération de l'emplacement du patient * * @param DOMNode $node Node * @param CSejour $newVenue Sejour * @param CAffectation $affectation Affectation * * @return void */ function getEmplacement(DOMNode $node, CSejour $newVenue, CAffectation $affectation) { $xpath = new CHPrimXPath($node->ownerDocument); $sender = $this->_ref_echange_hprim->_ref_sender; $chambreSeul = $xpath->queryAttributNode("hprim:emplacement", $node, "chambreSeul"); if ($chambreSeul) { $newVenue->chambre_seule = $chambreSeul == "oui" ? 1 : 0; } $emplacement = $xpath->queryUniqueNode("hprim:emplacement", $node); // Récupération de la chambre $chambre_node = $xpath->queryUniqueNode("hprim:chambre", $emplacement); $nom_chambre = $xpath->queryTextNode("hprim:code", $chambre_node); $chambre = new CChambre(); // Récupération du lit $lit_node = $xpath->queryUniqueNode("hprim:lit", $emplacement); $nom_lit = $xpath->queryTextNode("hprim:code", $lit_node); $lit = new C**t(); $where = $ljoin = array(); $ljoin["service"] = "service.service_id = chambre.service_id"; $where["chambre.nom"] = " = '{$nom_chambre}'"; $where["group_id"] = " = '{$sender->group_id}'"; $where["chambre.annule"] = " = '0'"; $chambre->escapeValues(); $chambre->loadObject($where, null, null, $ljoin); $chambre->unescapeValues(); $where = $ljoin = array(); $ljoin["chambre"] = "chambre.chambre_id = lit.chambre_id"; $ljoin["service"] = "service.service_id = chambre.service_id"; $where["lit.nom"] = " = '{$nom_lit}'"; $where["lit.annule"] = " = '0'"; $where["service.cancelled"] = " = '0'"; $where["group_id"] = " = '{$sender->group_id}'"; if ($chambre->_id) { $where["chambre.chambre_id"] = " = '{$chambre->_id}'"; } $lit->escapeValues(); $lit->loadObject($where, null, null, $ljoin); $lit->unescapeValues(); // Affectation du lit $affectation->lit_id = $lit->_id; }