$sejourNonAffectes = $sejourNonAffectes->loadList($where, null, null, null, $leftjoin); foreach ($sejourNonAffectes as $keySejour => $valSejour) { $sejour =& $sejourNonAffectes[$keySejour]; } return $sejourNonAffectes; } $today = CMbDT::date() . " 01:00:00"; $to = CMbDT::dateTime("-1 second", $today); $list = array(); for ($i = 1; $i <= 7; $i++) { $from = CMbDT::dateTime("+1 second", $to); $to = CMbDT::dateTime("+1 day", $to); $where = array(); $where["annule"] = "= '0'"; switch ($type_admission) { case "ambucomp": $where[] = "sejour.type = 'ambu' OR sejour.type = 'comp' OR sejour.type = 'ssr'"; break; case "0": break; default: $where["sejour.type"] = "= '{$type_admission}'"; } $where["sejour.entree"] = "BETWEEN '{$from}' AND '{$to}'"; $list[$from] = loadSejourNonAffectes($where); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("list", $list); $smarty->assign("type_admission", $type_admission); $smarty->display("vw_etat_semaine.tpl");
// Liste des patients à placer $order = "entree_prevue ASC"; // Admissions de la veille $dayBefore = CMbDT::date("-1 days", $date); $where = array("entree_prevue" => "BETWEEN '{$dayBefore} 00:00:00' AND '{$date} 00:00:00'", "type" => $type_admission ? " = '{$type_admission}'" : "!= 'exte'", "annule" => "= '0'"); $groupSejourNonAffectes["veille"] = loadSejourNonAffectes($where, $order, $praticien_id); // Admissions du matin $where = array("entree_prevue" => "BETWEEN '{$date} 00:00:00' AND '{$date} " . CMbDT::time("-1 second", $heureLimit) . "'", "type" => $type_admission ? " = '{$type_admission}'" : "!= 'exte'", "annule" => "= '0'"); $groupSejourNonAffectes["matin"] = loadSejourNonAffectes($where, $order, $praticien_id); // Admissions du soir $where = array("entree_prevue" => "BETWEEN '{$date} {$heureLimit}' AND '{$date} 23:59:59'", "type" => $type_admission ? " = '{$type_admission}'" : "!= 'exte'", "annule" => "= '0'"); $groupSejourNonAffectes["soir"] = loadSejourNonAffectes($where, $order, $praticien_id); // Admissions antérieures $twoDaysBefore = CMbDT::date("-2 days", $date); $where = array("entree_prevue" => "<= '{$twoDaysBefore} 23:59:59'", "sortie_prevue" => ">= '{$date} 00:00:00'", "annule" => "= '0'", "type" => $type_admission ? " = '{$type_admission}'" : "!= 'exte'"); $groupSejourNonAffectes["avant"] = loadSejourNonAffectes($where, $order, $praticien_id); if ($_is_praticien || $_is_anesth) { foreach ($groupSejourNonAffectes as $sejours_by_moment) { foreach ($sejours_by_moment as $_sejour) { if ($_sejour->praticien_id == $userCourant->user_id || $_is_anesth) { $tab_sejour[$_sejour->_id] = $_sejour; } } } } } else { $service->load($service_id); loadServiceComplet($service, $date, $mode, $praticien_id, $type_admission); } if ($service->_id) { foreach ($service->_ref_chambres as $_chambre) {
$date = CValue::getOrSession("date", CMbDT::date()); $pathos = new CDiscipline(); $heureLimit = "16:00:00"; // Liste des patients à placer $groupSejourNonAffectes = array(); if (CCanDo::edit()) { // Admissions de la veille $dayBefore = CMbDT::date("-1 days", $date); $where = array("entree_prevue" => "BETWEEN '{$dayBefore} 00:00:00' AND '{$date} 00:00:00'", "type" => "!= 'exte'", "annule" => "= '0'"); $groupSejourNonAffectes["veille"] = loadSejourNonAffectes($where); // Admissions du matin $where = array("entree_prevue" => "BETWEEN '{$date} 00:00:00' AND '{$date} " . CMbDT::time("-1 second", $heureLimit) . "'", "type" => "!= 'exte'", "annule" => "= '0'"); $groupSejourNonAffectes["matin"] = loadSejourNonAffectes($where); // Admissions du soir $where = array("entree_prevue" => "BETWEEN '{$date} {$heureLimit}' AND '{$date} 23:59:59'", "type" => "!= 'exte'", "annule" => "= '0'"); $groupSejourNonAffectes["soir"] = loadSejourNonAffectes($where); // Admissions antérieures $twoDaysBefore = CMbDT::date("-2 days", $date); $where = array("annule" => "= '0'", "'{$twoDaysBefore}' BETWEEN entree_prevue AND sortie_prevue"); $groupSejourNonAffectes["avant"] = loadSejourNonAffectes($where); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("affichage_patho", $affichage_patho); $smarty->assign("pathos", $pathos); $smarty->assign("date", $date); $smarty->assign("yesterday", CMbDT::date("-1 day", $date)); $smarty->assign("tomorow", CMbDT::date("+1 day", $date)); $smarty->assign("heureLimit", $heureLimit); $smarty->assign("groupSejourNonAffectes", $groupSejourNonAffectes); $smarty->display("vw_idx_pathologies.tpl");
CApp::$chrono->start(); // Admissions du matin $where["sejour.entree"] = "BETWEEN '{$date} 02:00:00' AND '{$date} " . CMbDT::time("-1 second", $heureLimit) . "'"; $groupSejourNonAffectes["matin"] = loadSejourNonAffectes($where, $order, null, $prestation_id); CApp::$chrono->stop("Non affectés: matin"); CApp::$chrono->start(); // Admissions du soir $where["sejour.entree"] = "BETWEEN '{$date} {$heureLimit}' AND '{$date} 23:59:59'"; $groupSejourNonAffectes["soir"] = loadSejourNonAffectes($where, $order, null, $prestation_id); CApp::$chrono->stop("Non affectés: soir"); CApp::$chrono->start(); // Admissions antérieures $twoDaysBefore = CMbDT::date("-2 days", $date); $where["sejour.entree"] = "<= '{$twoDaysBefore} 23:59:59'"; $where["sejour.sortie"] = ">= '{$date} 00:00:00'"; $groupSejourNonAffectes["avant"] = loadSejourNonAffectes($where, $order, null, $prestation_id); CApp::$chrono->stop("Non affectés: avant"); CApp::$chrono->start(); // Affectations dans les couloirs $where = array(); $where[] = "affectation.service_id IN (" . join($services_ids, ',') . ")"; $where["sejour.annule"] = " = '0'"; $where[] = "(affectation.entree BETWEEN '{$date} 00:00:00' AND '{$date} 23:59:59')\r\n OR (affectation.sortie BETWEEN '{$date} 00:00:00' AND '{$date} 23:59:59')"; $groupSejourNonAffectes["couloir"] = loadAffectationsCouloirs($where, $order, null, $prestation_id); } $imeds_active = CModule::getActive("dPImeds"); $functions_filter = array(); foreach ($groupSejourNonAffectes as $_keyGroup => $_group) { if ($_keyGroup == "couloir") { continue; }