$where = array();
$where["group_id"] = "= '{$g}'";
$where["cancelled"] = "= '0'";
$services = new CService();
$order = "externe, nom";
$services = $services->loadListWithPerms(PERM_READ, $where, $order);
$where_service = "";
if (reset($services_ids)) {
    $where_service = "sejour.service_id IN (" . join($services_ids, ',') . ") OR sejour.service_id IS NULL";
}
// Chargement des services
foreach ($services as &$service) {
    if (!in_array($service->_id, $services_ids)) {
        continue;
    }
    loadServiceComplet($service, $date, $mode, "", "", $prestation_id);
    CApp::$chrono->stop("Load Service Complet : '{$service->_view}'");
    CApp::$chrono->start();
    $totalLits += $service->_nb_lits_dispo;
}
foreach ($services as $key => $_service) {
    if (!count($_service->_ref_chambres)) {
        unset($services[$key]);
    }
}
// Nombre de patients à placer pour la semaine qui vient (alerte)
$today = CMbDT::date() . " 01:00:00";
$endWeek = CMbDT::dateTime("+7 days", $today);
$where = array();
$where["annule"] = "= '0'";
$where["sejour.entree"] = "BETWEEN '{$today}' AND '{$endWeek}'";
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Hospi
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
global $m;
CAppUI::requireModuleFile($m, "inc_vw_affectations");
$date = CValue::getOrSession("date", CMbDT::date());
$mode = CValue::getOrSession("mode", 0);
$service_id = CValue::get("service_id");
// Chargement du service
$service = new CService();
$service->load($service_id);
loadServiceComplet($service, $date, $mode);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("date", $date);
$smarty->assign("demain", CMbDT::date("+ 1 day", $date));
$smarty->assign("curr_service", $service);
$smarty->display("inc_affectations_services.tpl");
    $ljoin["patients"] = "sejour.patient_id = patients.patient_id";
    $where = array();
    $g = CGroups::loadCurrent()->_id;
    $where["entree_prevue"] = " <= '{$date} 23:59:59'";
    $where["sortie_prevue"] = ">= '{$date} 00:00:00'";
    $where["annule"] = " = '0'";
    $where["type"] = " != 'exte'";
    $where["sejour.group_id"] = "= '{$g}'";
    $where["sejour.type"] = " != 'urg'";
    $where[] = "affectation.affectation_id IS NULL";
    $order = "patients.nom, patients.prenom";
    $sejour = new CSejour();
    $_sejours = $sejour->loadList($where, $order, null, null, $ljoin);
} else {
    $service->load($service_id);
    loadServiceComplet($service, $date, 1);
    foreach ($service->_ref_chambres as $chambre) {
        foreach ($chambre->_ref_lits as $_lit) {
            foreach ($_lit->_ref_affectations as $_affectation) {
                $_sejours[] =& $_affectation->_ref_sejour;
            }
        }
    }
}
$outputs = array();
$fiches_anesth = array();
foreach ($_sejours as $_sejour) {
    $consult_id = "";
    $_sejour->loadRefPatient();
    $_sejour->loadRefPraticien();
    $_sejour->loadRefsConsultAnesth();
Esempio n. 4
0
     // 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) {
         foreach ($_chambre->_ref_lits as $_lits) {
             foreach ($_lits->_ref_affectations as $_affectation) {
                 if ($_affectation->_ref_sejour->annule) {
                     unset($_lits->_ref_affectations[$_affectation->_id]);
                     continue;
                 }
                 if ($_is_anesth || $_is_praticien && $_affectation->_ref_sejour->praticien_id == $userCourant->user_id) {
                     $tab_sejour[$_affectation->_ref_sejour->_id] = $_affectation->_ref_sejour;
                 }
                 $sejour = $_affectation->_ref_sejour;
                 $sejour->loadRefsPrescriptions();
                 $sejour->_ref_praticien->loadRefFunction();
Esempio n. 5
0
 * @package    Mediboard
 * @subpackage Hospi
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
CAppUI::requireModuleFile("dPhospi", "inc_vw_affectations");
$g = CGroups::loadCurrent()->_id;
$date = CValue::get("date", CMbDT::date());
$mode = CValue::get("mode", 0);
$services_ids = CValue::getOrSession("services_ids", "");
$services_ids = CService::getServicesIdsPref($services_ids);
// Récupération des chambres/services
$where = array();
$where["group_id"] = "= '{$g}'";
$where["service_id"] = CSQLDataSource::prepareIn($services_ids);
$where["cancelled"] = "= '0'";
$service = new CService();
$order = "nom";
$services = $service->loadListWithPerms(PERM_READ, $where, $order);
// Chargement de chaque services
foreach ($services as $_service) {
    loadServiceComplet($_service, $date, $mode, null, null, null, false);
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("date", $date);
$smarty->assign("demain", CMbDT::date("+ 1 day", $date));
$smarty->assign("services", $services);
$smarty->display("print_tableau.tpl");