/** * Test A02 - Transfer the patient to a new room * * @param CCnStep $step Step * * @throws CMbException * * @return void */ static function testA02(CCnStep $step) { // PES-PAM_Encounter_Management_IN_OUT $patient = self::loadPatientPES($step, 40); $sejour = self::loadAdmitPES($patient); $lit = new C**t(); $lit->loadMatchingObject(); $affectation = new CAffectation(); $affectation->lit_id = $lit->_id; $affectation->sejour_id = $sejour->_id; $affectation->entree = $sejour->entree; $affectation->sortie = CMbDT::dateTime("+2 day", $affectation->entree); self::storeObject($affectation); }
foreach ($lit->_ref_affectations as $_affectation) { $intervals[$_affectation->_id] = array("lower" => $_affectation->_entree, "upper" => $_affectation->_sortie); } $lit->_lines = CMbRange::rearrange($intervals); } // Pour les alertes, il est nécessaire de charger les autres lits // de la chambre concernée ainsi que les affectations $where = array(); $where["entree"] = "<= '{$date_max}'"; $where["sortie"] = ">= '{$date_min}'"; $lits_ids = $chambre->loadBackIds("lits"); foreach ($lits_ids as $_lit_id) { if ($lit_id == $_lit_id) { continue; } $_lit = new C**t(); $_lit->load($_lit_id); $where["lit_id"] = "= '{$_lit->_id}'"; $_affectations = $affectation->loadList($where); $_sejours = CStoredObject::massLoadFwdRef($_affectations, "sejour_id"); CStoredObject::massLoadFwdRef($_sejours, "patient_id"); CStoredObject::massLoadFwdRef($_sejours, "praticien_id"); /** @var $_affectations CAffectation[] */ foreach ($_affectations as $_affectation) { $_sejour = $_affectation->loadRefSejour(); $_sejour->loadRefPraticien(); $_sejour->loadRefPatient(); } $_lit->_ref_affectations = $_affectations; $chambre->_ref_lits[$_lit->_id] = $_lit; }
if ($services_ids) { $services_ids_suggest = explode("|", $services_ids); } } if (!count($services_ids_suggest)) { $services_ids_suggest = array($affectation->_ref_lit->_ref_chambre->service_id); } } else { $services_ids_suggest = explode(",", $services_ids_suggest); } $sortie = $affectation->sortie; $where = array(); $where["chambre.service_id"] = CSQLDataSource::prepareIn($services_ids_suggest); $ljoin = array(); $ljoin["chambre"] = "lit.chambre_id = chambre.chambre_id"; $lit = new C**t(); /** @var C**t[] $lits */ $lits = $lit->loadList($where, null, null, null, $ljoin); //unset($lits[$affectation->lit_id]); $max_entree = 0; $max_sortie = 0; $ds = $lit->getDS(); foreach ($lits as $key => $_lit) { $_lit->_ref_affectations = array(); $_lit->loadCompleteView(); if ($_lit->_id == $affectation->lit_id) { $_lit->_ref_last_dispo = new CAffectation(); $_lit->_ref_last_dispo->sortie = $entree; $_lit->_dispo_depuis = 0; } else { $where = array();
/** * Load lits * * @param bool $annule Annulé * * @return C**t[] */ function loadRefsLits($annule = false) { $lit = new C**t(); $where = array("chambre_id" => "= '{$this->_id}'"); if (!$annule) { $where["annule"] = " ='0'"; } $order = "ISNULL(lit.rank), lit.rank, "; $order .= $this->lits_alpha ? "lit.nom ASC" : "lit.nom DESC"; return $this->_ref_lits = $this->_back["lits"] = $lit->loadList($where, $order); }
/** * Update the form (derived) fields plain fields * * @return void */ function updateFormFields() { parent::updateFormFields(); $this->_view = $this->libelle ? $this->libelle : $this->nom; $this->_type_echange = $this->_class; $this->_self_tag = $this->getTag($this->group_id); $this->_tag_patient = CPatient::getTagIPP($this->group_id); $this->_tag_sejour = CSejour::getTagNDA($this->group_id); $this->_tag_consultation = CConsultation::getObjectTag($this->group_id); $this->_tag_mediuser = CMediusers::getObjectTag($this->group_id); $this->_tag_service = CService::getObjectTag($this->group_id); $this->_tag_chambre = CChambre::getObjectTag($this->group_id); $this->_tag_lit = C**t::getObjectTag($this->group_id); $this->_tag_movement = CMovement::getObjectTag($this->group_id); $this->_tag_visit_number = CSmp::getObjectTag($this->group_id); }
$smarty->display("inc_form_stats.tpl"); CAppUI::stepMessage(UI_MSG_ALERT, "warning-hospi-stats-choose_service"); return; } $ds = CSQLDataSource::get("std"); $dates = array(); $date_temp = $date_min; $series = array(); while ($date_temp <= $date_max) { $dates[] = array(count($dates), CMbDT::dateToLocale($date_temp)); $date_temp = CMbDT::date("+1 day", $date_temp); } // Table temporaraire de dates pour les jointures $tab_name = CSQLDataSource::tempTableDates($date_min, $date_max); // Nombre de lits totaux sur le service $lit = new C**t(); $where = array(); $ljoin = array(); $ljoin["chambre"] = "chambre.chambre_id = lit.chambre_id"; $where["service_id"] = " = '{$service_id}'"; $where["lit.annule"] = " = '0'"; $nb_lits = $lit->countList($where, null, $ljoin); if (!$nb_lits) { $smarty->display("inc_form_stats.tpl"); CAppUI::stepMessage(UI_MSG_WARNING, "warning-hospi-stats-no_beds"); return; } // Lits ouverts (non bloqués - non compris les blocages des urgence) $serie = array("data" => array(), "label" => utf8_encode("Ouvert / Total"), "markers" => array("show" => true)); // Sauvegarde des lits ouverts par date $lits_ouverts_par_date = array();
/** * 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; }
* $Id$ * * @package Mediboard * @subpackage Hospi * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkEdit(); $affectation_id = CValue::get("affectation_id"); $lit_id = CValue::get("lit_id"); $urgence = CValue::get("urgence"); $from_tempo = CValue::get("from_tempo", 0); $affectation = new CAffectation(); $affectation->load($affectation_id); $lit = new C**t(); $lit->load($affectation->lit_id); if ($urgence) { $service_urgence = CGroups::loadCurrent()->service_urgences_id; $affectation->function_id = $service_urgence; } $sejour_maman = null; if (CModule::getActive("maternite") && $affectation->sejour_id) { $naissance = new CNaissance(); $naissance->sejour_enfant_id = $affectation->sejour_id; $naissance->loadMatchingObject(); if ($naissance->_id) { $sejour_maman = $naissance->loadRefSejourMaman(); $sejour_maman->loadRefPatient(); } }
} /** * Construit le tag Lit en fonction des variables de configuration * * @param int $group_id Permet de charger l'id externe d'un lit pour un établissement donné si non null * * @return string|null */ static function getTagLit($group_id = null) { // Pas de tag Lit if (null == ($tag_lit = CAppUI::conf("dPhospi C**t tag"))) { return null; } // Permettre des id externes en fonction de l'établissement $group = CGroups::loadCurrent(); if (!$group_id) { $group_id = $group->_id; } return str_replace('$g', $group_id, $tag_lit); } /** * @see parent::getDynamicTag */ function getDynamicTag() { return $this->conf("tag"); } } C**t::$_prefixe = CAppUI::conf("dPhospi C**t prefixe");
$chambre->service_id = $service->_id; $chambre->loadMatchingObject(); if (!$chambre->_id) { $chambre->lits_alpha = 0; $chambre->annule = 0; $msg = $chambre->store(); if ($msg) { CAppUI::setMsg($msg, UI_MSG_ERROR); $results[$i]["error"] = $msg; $i++; continue; } CAppUI::setMsg("Chambre créée", UI_MSG_OK); } // Lit $lit = new C**t(); $lit->nom = $results[$i]["nom"]; $lit->chambre_id = $chambre->_id; $lit->loadMatchingObject(); $lit->nom_complet = $results[$i]["nomcomplet"]; if ($lit->_id) { $msg = "Lit existant"; CAppUI::setMsg($msg, UI_MSG_ERROR); $results[$i]["error"] = $msg; $i++; continue; } $msg = $lit->store(); if ($msg) { CAppUI::setMsg($msg, UI_MSG_ERROR); $results[$i]["error"] = $msg;
$where["tag"] = " = '{$tag_ipp}'"; $where["object_class"] = " = 'CPatient'"; $idex = new CIdSante400(); $res_current_etab["CPatient-_IPP"] = $idex->countList($where); // - Nombre de consultations $where = array(); $consultation = new CConsultation(); $ljoin["plageconsult"] = "consultation.plageconsult_id = plageconsult.plageconsult_id"; $ljoin["users_mediboard"] = "plageconsult.chir_id = users_mediboard.user_id"; $ljoin["functions_mediboard"] = "users_mediboard.function_id = functions_mediboard.function_id"; $where["functions_mediboard.group_id"] = " = '{$current_group}'"; $res_current_etab["CConsultation"] = $consultation->countList($where, null, $ljoin); // - Lits $ljoin = array(); $where = array(); $lit = new C**t(); $ljoin["chambre"] = "lit.chambre_id = chambre.chambre_id"; $ljoin["service"] = "chambre.service_id = service.service_id"; $where["service.group_id"] = " = '{$current_group}'"; $res_current_etab["C**t"] = $lit->countList($where, null, $ljoin); // - Chambres $ljoin = array(); $where = array(); $chambre = new CChambre(); $ljoin["service"] = "chambre.service_id = service.service_id"; $where["service.group_id"] = " = '{$current_group}'"; $res_current_etab["CChambre"] = $chambre->countList($where, null, $ljoin); // - Utilisateurs $ljoin = array(); $where = array(); $mediuser = new CMediusers();
/** * Mettre en cache les lits * * @param CAffectation $affectation Affectation * * @return void */ function cacheLit(CAffectation $affectation) { // Cache des lits $lit_id = $affectation->lit_id; static $lits = array(); if (!array_key_exists($lit_id, $lits)) { $lit = new C**t(); $lit->load($lit_id); $lits[$lit_id] = $lit; } $lit = $lits[$lit_id]; $lit->_ref_affectations[$affectation->_id] = $affectation; // Cache des chambres $chambre_id = $lit->chambre_id; static $chambres = array(); if (!array_key_exists($chambre_id, $chambres)) { $chambre = new CChambre(); $chambre->load($chambre_id); $chambres[$chambre_id] = $chambre; } $chambre = $chambres[$chambre_id]; $chambre->_ref_lits[$lit_id] = $lit; // Cache de services global $sejoursParService; $service_id = $chambre->service_id; if (!array_key_exists($service_id, $sejoursParService)) { $service = new CService(); $service->load($service_id); $sejoursParService[$service_id] = $service; } $service = $sejoursParService[$service_id]; $service->_ref_chambres[$chambre_id] = $chambre; }
* @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @link http://www.mediboard.org */ CCanDo::checkAdmin(); $service_id = CValue::getOrSession("service_id"); $chambre_id = CValue::getOrSession("chambre_id"); $lit_id = CValue::getOrSession("lit_id"); $group = CGroups::loadCurrent(); // Chargement de la chambre à ajouter/editer $chambre = new CChambre(); $chambre->service_id = $service_id; $chambre->load($chambre_id); $chambre->loadRefsNotes(); $chambre->loadRefService(); foreach ($chambre->loadRefsLits(true) as $_lit) { $_lit->loadRefsNotes(); } // Récupération des chambres/services $where = array(); $where["group_id"] = "= '{$group->_id}'"; $order = "nom"; $service = new CService(); $services = $service->loadListWithPerms(PERM_READ, $where, $order); // Création du template $smarty = new CSmartyDP(); $smarty->assign("services", $services); $smarty->assign("chambre", $chambre); $smarty->assign("tag_chambre", CChambre::getTagChambre($group->_id)); $smarty->assign("tag_lit", C**t::getTagLit($group->_id)); $smarty->display("inc_vw_chambre.tpl");
<?php /** * $Id$ * * @package Mediboard * @subpackage Hospi * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ $keywords = CValue::get("keywords", "%%"); $lit_id = CValue::get("lit_id"); $lit = new C**t(); $lit->load($lit_id); $liaisons_items = $lit->loadRefsLiaisonsItems(); $items_prestations = CMbObject::massLoadFwdRef($liaisons_items, "item_prestation_id"); $items_prestations_ids = CMbArray::pluck($items_prestations, "object_id"); // Un niveau unique par prestation $where = array(); $where["object_id"] = CSQLDataSource::prepareNotIn($items_prestations_ids); $where["object_class"] = " = 'CPrestationJournaliere'"; $where["group_id"] = "= '" . CGroups::loadCurrent()->_id . "'"; $ljoin = array(); $ljoin["prestation_journaliere"] = "prestation_journaliere.prestation_journaliere_id = item_prestation.object_id"; $item_prestation = new CItemPrestation(); /** @var CItemPrestation[] $items_prestations */ $items_prestations = $item_prestation->seek($keywords, $where, null, null, $ljoin); $items_by_prestation = array(); $prestations = array(); foreach ($items_prestations as $_item_prestation) {
$prescription = $sejour->loadRefPrescriptionSejour(); if ($prescription->_id) { if (@CAppUI::conf("object_handlers CPrescriptionAlerteHandler")) { $prescription->_count_fast_recent_modif = $prescription->countAlertsNotHandled("medium"); $prescription->_count_urgence["all"] = $prescription->countAlertsNotHandled("high"); } else { $prescription->countFastRecentModif(); $prescription->loadRefsLinesMedByCat(); $prescription->loadRefsLinesElementByCat(); $prescription->countUrgence(CMbDT::date($date)); } $sejour->countDocItems(); } $chambre_id = $sejour->_ref_curr_affectation->loadRefLit()->chambre_id; if (!$chambre_id && !CAppUI::conf("dPurgences create_affectation")) { $lit = new C**t(); $lit->load($sejour->_ref_rpu->box_id); $chambre_id = $lit->chambre_id; } $sejours_chambre[$chambre_id][] = $sejour; } for ($num = 0; $num <= 1; $num++) { /** @var CChambre[] $chambres */ if ($num == 0) { $chambres = $chambres_uhcd; $nom = "uhcd"; } else { $chambres = $chambres_urgences; $nom = "urgence"; } foreach ($chambres as $chambre) {
/** * @see parent::fillLimitedTemplate() */ function fillLimitedTemplate(&$template) { $this->loadRefConsult(); $this->_ref_consult->loadRefPraticien(); $this->notify("BeforeFillLimitedTemplate", $template); // Duplication des champs de la consultation $template->addProperty("RPU - Consultation - Praticien nom", $this->_ref_consult->_ref_praticien->_user_first_name); $template->addProperty("RPU - Consultation - Praticien prénom", $this->_ref_consult->_ref_praticien->_user_last_name); $template->addProperty("RPU - Consultation - Motif", $this->_ref_consult->motif); $template->addProperty("RPU - Consultation - Remarques", $this->_ref_consult->rques); $template->addProperty("RPU - Consultation - Examen", $this->_ref_consult->examen); $template->addProperty("RPU - Consultation - Traitement", $this->_ref_consult->traitement); $template->addProperty("RPU - Diagnostic infirmier", $this->diag_infirmier); $template->addProperty("RPU - Prise en charge douleur", $this->pec_douleur); $template->addProperty("RPU - PeC Transport", $this->getFormattedValue("pec_transport")); $template->addProperty("RPU - Motif", $this->motif); $template->addProperty("RPU - CCMU", $this->getFormattedValue("ccmu")); $template->addProperty("RPU - Code GEMSA", $this->getFormattedValue("gemsa")); $template->addDateTimeProperty("RPU - Départ Radio", $this->radio_debut); $template->addDateTimeProperty("RPU - Retour Radio", $this->radio_fin); $template->addDateTimeProperty("RPU - Dépôt Biologie", $this->bio_depart); $template->addDateTimeProperty("RPU - Réception Biologie", $this->bio_retour); $template->addDateTimeProperty("RPU - Attente spécialiste", $this->specia_att); $template->addDateTimeProperty("RPU - Arrivée spécialiste", $this->specia_arr); $template->addProperty("RPU - Accident du travail", $this->getFormattedValue("date_at")); $libelle_at = $this->date_at ? "Accident du travail du " . $this->getFormattedValue("date_at") : ""; $template->addProperty("RPU - Libellé accident du travail", $libelle_at); $template->addProperty("RPU - Sortie autorisée", $this->getFormattedValue("sortie_autorisee")); $lit = new C**t(); if ($this->box_id) { $lit->load($this->box_id); } $template->addProperty("RPU - Box", $lit->_view); if (CAppUI::conf("dPurgences old_rpu") == "1") { if (CModule::getActive("sherpa")) { $template->addProperty("RPU - Soins pour trauma", $this->getFormattedValue("urtrau")); $template->addProperty("RPU - Cause du transfert", $this->getFormattedValue("urmuta")); } $template->addProperty("RPU - Type de pathologie", $this->getFormattedValue("type_pathologie")); } else { $template->addProperty("RPU - Orientation", $this->getFormattedValue("orientation")); } if (CModule::getActive("forms")) { CExObject::addFormsToTemplate($template, $this, "RPU"); } $this->notify("AfterFillLimitedTemplate", $template); }
if ($rpu->radio_debut && !$rpu->radio_fin) { $datas['RADIO']++; $comptabilise = true; } if (!$comptabilise) { $consult = $rpu->loadRefConsult(); // Si on a pas de consult on considère qu'il est en salle d'attente if (!$consult || !$consult->_id) { $datas["ATTENTE"]++; } // S'il y a une consult et pas placé, il est au moins dans un box ? // $datas["BOX"]++; } } //totaux $lit = new C**t(); $where = array(); $ljoin = array(); $ljoin["chambre"] = "lit.chambre_id = chambre.chambre_id"; $ljoin["service"] = "service.service_id = chambre.service_id"; $where["service.externe"] = "= '0'"; $where["service.uhcd"] = "= '1'"; $where["service.group_id"] = " = '{$group->_id}'"; $where["lit.annule"] = " = '0'"; //uhcd $totporte = CAppUI::conf("dPurgences send_RPU totporte", $group); $datas["TOTPORTE"] = $totporte ? $totporte : $lit->countList($where, null, $ljoin); //urgences $where["service.uhcd"] = " IS NOT NULL"; $where["service.urgence"] = "= '1'"; $where["chambre.is_examination_room"] = " = '1'";
/** * */ function loadRefsLits($annule = false) { $lit = new C**t(); $where = array(); $ljoin = array(); $where["chambre.service_id"] = "= '{$this->_id}'"; $ljoin["chambre"] = "lit.chambre_id = chambre.chambre_id"; if (!$annule) { $where["lit.annule"] = "= '0'"; $where["chambre.annule"] = "= '0'"; } $order = "ISNULL(chambre.rank), chambre.rank, chambre.nom, ISNULL(lit.rank), lit.rank,lit.nom "; $lits = $lit->loadList($where, $order, null, null, $ljoin); $this->_ref_chambres = self::massLoadFwdRef($lits, "chambre_id", null, true); foreach ($lits as $_lit) { $_chambre = $_lit->loadRefChambre(); $_chambre->_ref_service = $this; $_chambre->_ref_lits[$_lit->_id] = $_lit; } return $lits; }
// Chargement du séjour $sejour->loadRefPatient()->loadIPP(); $sejour->loadNDA(); $sejour->loadRefsConsultations(); $sejour->loadRefCurrAffectation(); // Horaire par défaut $sejour->sortie_reelle = $sortie_reelle; if (!$sejour->sortie_reelle) { $sejour->sortie_reelle = CMbDT::dateTime(); } $where = array(); $where["entree"] = "<= '{$sejour->sortie_reelle}'"; $where["sortie"] = ">= '{$sejour->sortie_reelle}'"; $where["function_id"] = "IS NOT NULL"; $leftjoin = array("affectation" => "affectation.lit_id = lit.lit_id"); $lit = new C**t(); //Lit réservé pour les urgences $lits_urgence = $lit->loadList($where, null, null, null, $leftjoin); $where["function_id"] = "IS NULL"; $where["sejour_id"] = "IS NULL"; $where["lit.lit_id"] = CSQLDataSource::prepareIn(array_keys($lits_urgence)); //lit qui sont bloqués $lits_bloque = $lit->loadList($where, null, null, null, $leftjoin); $affectation = new CAffectation(); unset($where["lit.lit_id"]); unset($where["sejour_id"]); /** @var C**t $_lit */ foreach ($lits_urgence as $_lit) { $sortie = CMbDT::transform($affectation->sortie, null, "%Hh%M %d-%m-%Y"); $_lit->loadRefService()->loadRefsChambres(); if (array_key_exists($_lit->_id, $lits_bloque)) {
/** * 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; } }
$days = array_unique($days); // Cas de la semaine 00 if ($granularite == "4weeks" && count($days) == 5) { array_pop($days); } // Chargement des lits $where = array(); $where["chambre.service_id"] = CSQLDataSource::prepareIn($services_ids); $where["service.group_id"] = " = '{$group->_id}'"; $where["chambre.annule"] = "= '0'"; $where["lit.annule"] = "= '0'"; $ljoin = array(); $ljoin["chambre"] = "lit.chambre_id = chambre.chambre_id"; $ljoin["service"] = "chambre.service_id = service.service_id"; $order = "ISNULL(chambre.rank), chambre.rank, chambre.nom, ISNULL(lit.rank), lit.rank"; $lit = new C**t(); /** @var C**t[] $lits */ $lits = $lit->loadList($where, $order, null, null, $ljoin); $chambres = CStoredObject::massLoadFwdRef($lits, "chambre_id"); $services = CStoredObject::massLoadFwdRef($chambres, "service_id"); $liaisons = CStoredObject::massLoadBackRefs($lits, "liaisons_items"); CStoredObject::massLoadFwdRef($liaisons, "item_prestation_id"); foreach ($lits as $_lit) { $_lit->_ref_affectations = array(); $chambre = $_lit->loadRefChambre(); $chambre->_ref_lits[$_lit->_id] = $_lit; $service = $chambre->loadRefService(); $service->_ref_chambres[$chambre->_id] = $chambre; $liaisons_items = $_lit->_back["liaisons_items"]; foreach ($liaisons_items as $_liaison) { $_liaison->loadRefItemPrestation();