/** * Load postal address object * * @return CGroups|CFunctions|CBlocOperatoire */ function loadRefAddress() { $this->_ref_address = $this->loadFwdRef("address_id", true); if ($this->address_class == "CFunctions" || $this->address_class == "CBlocOperatoire") { $this->_ref_address->loadRefGroup(); } return $this->_ref_address; }
for ($i = -6; $i <= 12; $i++) { $curr_key = CMbDT::transform("{$i} month", $date, "%Y-%m-%d"); $curr_month = CMbDT::transform("{$i} month", $date, "%B %Y"); $listMonthes[$i]["date"] = $curr_key; $listMonthes[$i]["month"] = $curr_month; } // Chargement du chirurgien $mediChir = new CMediusers(); $mediChir->load($chir); $mediChir->loadBackRefs("secondary_functions"); $secondary_functions = array(); foreach ($mediChir->_back["secondary_functions"] as $curr_sec_func) { $secondary_functions[] = $curr_sec_func->function_id; } // Chargement de la liste des blocs opératoires $bloc = new CBlocOperatoire(); $blocs = $bloc->loadGroupList(null, "nom"); foreach ($blocs as $_bloc) { $_bloc->loadRefsSalles(); $_bloc->_date_min = CMbDT::date("+ " . $_bloc->days_locked . " DAYS"); } // Chargement des plages pour le chir ou sa spécialité par bloc $where = array(); $selectPlages = "(plagesop.chir_id = %1 OR plagesop.spec_id = %2 OR plagesop.spec_id " . CSQLDataSource::prepareIn($secondary_functions) . ")"; $where[] = $ds->prepare($selectPlages, $mediChir->user_id, $mediChir->function_id); $month_min = CMbDT::transform("+ 0 month", $date, "%Y-%m-00"); $month_max = CMbDT::transform("+ 1 month", $date, "%Y-%m-00"); $where["date"] = "BETWEEN '{$month_min}' AND '{$month_max}'"; if (!$resp_bloc) { $where[] = "date >= '" . CMbDT::date() . "'"; }
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ $date_depart = CValue::get("date_depart"); $bloc_id = CValue::get("bloc_id"); $order_way = CValue::get("order_way"); $order_col = CValue::get("order_col"); $where = array(); $where["date"] = " = '" . CMbDT::date($date_depart) . "'"; $where["annulee"] = " = '0'"; $ljoin = array(); $ljoin["sallesbloc"] = "sallesbloc.salle_id = operations.salle_id"; if ($bloc_id) { $where["sallesbloc.bloc_id"] = "= '{$bloc_id}'"; } else { $bloc = new CBlocOperatoire(); $where_bloc = array("group_id" => "= '" . CGroups::loadCurrent()->_id . "'"); $blocs = $bloc->loadListWithPerms(PERM_READ, $where_bloc, "nom"); $where["sallesbloc.bloc_id"] = CSQLDataSource::prepareIn(array_keys($blocs)); } $operation = new COperation(); /** @var COperation[] $operations */ $operations = $operation->loadList($where, "time_operation ASC", null, null, $ljoin); $sejours = CMbObject::massLoadFwdRef($operations, "sejour_id"); CMbObject::massLoadFwdRef($sejours, "patient_id"); CMbObject::massLoadFwdRef($operations, "salle_id"); CMbObject::massLoadFwdRef($operations, "plageop_id"); foreach ($operations as $_operation) { $_operation->loadRefPlageOp(); $_operation->updateSalle(); $_operation->updateHeureUS();
/** * @see parent::getPerm() */ function getPerm($permType) { $this->loadRefBloc(); return $this->_ref_bloc->getPerm($permType) && parent::getPerm($permType); }
<?php /** * dPbloc * * @category Bloc * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:$ * @link http://www.mediboard.org */ CCanDo::checkRead(); $date = CValue::get("date"); $bloc_id = CValue::get("bloc_id"); $bloc = new CBlocOperatoire(); $bloc->load($bloc_id); $in_salles = CSQLDataSource::prepareIn($bloc->loadBackIds("salles")); $ljoin["plagesop"] = "operations.plageop_id = plagesop.plageop_id"; $where[] = "operations.salle_id {$in_salles} OR plagesop.salle_id {$in_salles}"; $where[] = "operations.date = '{$date}'"; $where["labo"] = "= 1"; $order = "entree_salle, time_operation"; $operation = new COperation(); /** @var COperation[] $operations */ $operations = $operation->loadList($where, $order, null, null, $ljoin); CMbObject::massLoadFwdRef($operations, "plageop_id"); $chirs = CMbObject::massLoadFwdRef($operations, "chir_id"); CMbObject::massLoadFwdRef($chirs, "function_id"); $sejours = CMbObject::massLoadFwdRef($operations, "sejour_id"); CMbObject::massLoadFwdRef($sejours, "patient_id");
/** * Load blocs operatoires with given permission * * @param int $permType Permission level * @param bool $load_salles Load salles * @param string $order Ordre de chargmeent SQL * @param array $where SQL WHERE parameters * * @return CBlocOperatoire[] */ function loadBlocs($permType = PERM_READ, $load_salles = true, $order = "nom", $where = array()) { $bloc = new CBlocOperatoire(); $whereGroup = array('group_id' => "= '{$this->_id}'"); $where = array_merge($where, $whereGroup); /** @var CBlocOperatoire[] $blocs */ $blocs = $bloc->loadListWithPerms($permType, $where, $order); if ($load_salles) { CStoredObject::massLoadBackRefs($blocs, "salles", "nom"); foreach ($blocs as $_bloc) { $_bloc->loadRefsSalles(); } } return $this->_ref_blocs = $blocs; }
/** * Récupération du graphique du nombre moyen de patient * en SSPI selon le jour de la semaine * * @param string $debut Date de début * @param string $fin Date de fin * @param int $prat_id Identifiant du praticien * @param int $bloc_id Identifiant du bloc * @param null $discipline_id Identifiant de la discipline * @param string $codeCCAM Code CCAM * * @return array */ function graphPatRepartJour($debut = null, $fin = null, $prat_id = 0, $bloc_id = 0, $func_id = 0, $discipline_id = null, $codeCCAM = '') { if (!$debut) { $debut = CMbDT::date("-1 YEAR"); } if (!$fin) { $fin = CMbDT::date(); } $prat = new CMediusers(); $prat->load($prat_id); $discipline = new CDiscipline(); $discipline->load($discipline_id); $ticks = array(array("0", "Dimanche"), array("1", "Lundi"), array("2", "Mardi"), array("3", "Mercredi"), array("4", "Jeudi"), array("5", "Vendredi"), array("6", "Samedi")); $bloc = new CBlocOperatoire(); if ($bloc_id) { $bloc->load($bloc_id); } $series = array(); $serie = array("data" => array()); // Nombre de patients par jour de la semaine $query = "SELECT COUNT(operations.operation_id) AS total,\n COUNT(DISTINCT(operations.date)) AS nb_days,\n DATE_FORMAT(operations.date, '%W') AS jour,\n\t DATE_FORMAT(operations.date, '%w') AS orderitem\n FROM operations\n INNER JOIN sallesbloc ON operations.salle_id = sallesbloc.salle_id\n LEFT JOIN users_mediboard ON operations.chir_id = users_mediboard.user_id\n WHERE sallesbloc.stats = '1'\n AND operations.date BETWEEN '{$debut}' AND '{$fin}'\n AND operations.annulee = '0'"; if ($prat_id) { $query .= "\nAND operations.chir_id = '{$prat_id}'"; } if ($discipline_id) { $query .= "\nAND users_mediboard.discipline_id = '{$discipline_id}'"; } if ($codeCCAM) { $query .= "\nAND operations.codes_ccam LIKE '%{$codeCCAM}%'"; } if ($bloc_id) { $query .= "\nAND sallesbloc.bloc_id = '{$bloc_id}'"; } $query .= "\nGROUP BY jour ORDER BY orderitem"; $result = $prat->_spec->ds->loadlist($query); foreach ($ticks as $i => $tick) { $f = true; foreach ($result as $r) { if ($i == $r["orderitem"]) { $serie["data"][] = array($tick[0], $r["total"] / $r["nb_days"]); $f = false; } } if ($f) { $serie["data"][] = array(count($serie["data"]), 0); } } $serie["label"] = "moyenne"; $series[] = $serie; // Set up the title for the graph $title = "Patients moyens / jour de la semaine"; $subtitle = "Uniquement les jours d'activité"; if ($prat_id) { $subtitle .= " - Dr {$prat->_view}"; } if ($discipline_id) { $subtitle .= " - {$discipline->_view}"; } if ($bloc_id) { $subtitle .= " - {$bloc->_view}"; } if ($codeCCAM) { $subtitle .= " - CCAM : {$codeCCAM}"; } $options = array('title' => utf8_encode($title), 'subtitle' => utf8_encode($subtitle), 'xaxis' => array('labelsAngle' => 45, 'ticks' => $ticks), 'yaxis' => array('autoscaleMargin' => 1, 'min' => 0), 'lines' => array('show' => true, 'filled' => true, 'fillColor' => '#999'), 'markers' => array('show' => true), 'points' => array('show' => true), 'HtmlText' => false, 'legend' => array('show' => true, 'position' => 'nw'), 'mouse' => array('track' => true, 'relative' => true, 'position' => 'ne'), 'spreadsheet' => array('show' => true, 'csvFileSeparator' => ';', 'decimalSeparator' => ',', 'tabGraphLabel' => utf8_encode('Graphique'), 'tabDataLabel' => utf8_encode('Données'), 'toolbarDownload' => utf8_encode('Fichier CSV'), 'toolbarSelectAll' => utf8_encode('Sélectionner tout le tableau'))); return array('series' => $series, 'options' => $options); }
/** * Récuparation du graphique de répartition des patients en salle de reveil * par tranche horaire * * @param string $debut Date de début * @param string $fin Date de fin * @param int $prat_id Identifiant du praticien * @param int $bloc_id Identifiant du bloc * @param int $discipline_id Identifiant de la discipline * @param string $codeCCAM Code CCAM * * @return array */ function graphPatParHeureReveil($debut = null, $fin = null, $prat_id = 0, $bloc_id = 0, $func_id = 0, $discipline_id = null, $codeCCAM = '') { // This stats uses temporary table, impossible on slave // @todo Get rid of temporary table CView::disableSlave(); $ds = CSQLDataSource::get("std"); if (!$debut) { $debut = CMbDT::date("-1 YEAR"); } if (!$fin) { $fin = CMbDT::date(); } $totalWorkDays = 0; for ($i = $debut; $i <= $fin; $i = CMbDT::date("+1 MONTH", $i)) { $totalWorkDays += CMbDT::workDaysInMonth(CMbDT::transform("+0 DAY", $i, "%Y-%m-01")); } $prat = new CMediusers(); $prat->load($prat_id); $discipline = new CDiscipline(); $discipline->load($discipline_id); $ticks = array(); for ($i = 7; $i <= 21; $i++) { $ticks[] = array(count($ticks), CMbDT::transform("+0 DAY", "{$i}:00:00", "%Hh%M")); } $bloc = new CBlocOperatoire(); if ($bloc_id) { $bloc->load($bloc_id); } $series = array(); // Nombre de patients par heure foreach ($ticks as $i => $tick) { $query = "DROP TEMPORARY TABLE IF EXISTS pat_par_heure"; $ds->exec($query); $query = "CREATE TEMPORARY TABLE pat_par_heure\n SELECT COUNT(operations.operation_id) AS total_by_day,\n '" . $tick[1] . "' AS heure,\n operations.date AS date\n FROM operations\n INNER JOIN sallesbloc ON operations.salle_id = sallesbloc.salle_id\n LEFT JOIN users_mediboard ON operations.chir_id = users_mediboard.user_id\n WHERE sallesbloc.stats = '1'\n AND operations.date BETWEEN '{$debut}' AND '{$fin}'\n AND '" . $tick[1] . ":00' BETWEEN operations.entree_reveil AND operations.sortie_reveil_reel\n AND operations.annulee = '0'"; if ($prat_id) { $query .= "\nAND operations.chir_id = '{$prat_id}'"; } if ($discipline_id) { $query .= "\nAND users_mediboard.discipline_id = '{$discipline_id}'"; } if ($codeCCAM) { $query .= "\nAND operations.codes_ccam LIKE '%{$codeCCAM}%'"; } if ($bloc_id) { $query .= "\nAND sallesbloc.bloc_id = '{$bloc_id}'"; } $query .= "\nGROUP BY operations.date"; $ds->exec($query); $query = "SELECT SUM(total_by_day) AS total, MAX(total_by_day) AS max,heure\n FROM pat_par_heure\n GROUP BY heure"; $result = $ds->loadlist($query); if (count($result)) { $serie_moyenne["data"][] = array($i, $result[0]["total"] / $totalWorkDays); $serie_max["data"][] = array($i, $result[0]["max"]); } else { $serie_moyenne["data"][] = array($i, 0); $serie_max["data"][] = array($i, 0); } } // Nombre de patients non renseignés $query = "SELECT COUNT(operations.operation_id) AS total,\n 'err' AS heure\n FROM operations\n INNER JOIN sallesbloc ON operations.salle_id = sallesbloc.salle_id\n LEFT JOIN users_mediboard ON operations.chir_id = users_mediboard.user_id\n WHERE sallesbloc.stats = '1'\n AND operations.date BETWEEN '{$debut}' AND '{$fin}'\n AND (operations.entree_reveil IS NULL OR operations.sortie_reveil_reel IS NULL)\n AND operations.annulee = '0'"; if ($prat_id) { $query .= "\nAND operations.chir_id = '{$prat_id}'"; } if ($discipline_id) { $query .= "\nAND users_mediboard.discipline_id = '{$discipline_id}'"; } if ($codeCCAM) { $query .= "\nAND operations.codes_ccam LIKE '%{$codeCCAM}%'"; } if ($bloc_id) { $query .= "\nAND sallesbloc.bloc_id = '{$bloc_id}'"; } $query .= "\nGROUP BY heure"; $result = $ds->loadlist($query); if (count($result)) { $serie_moyenne["data"][] = array(count($ticks), $result[0]["total"] / $totalWorkDays); } else { $serie_moyenne["data"][] = array(count($ticks), 0); } //$serie_max["data"][] = array(count($ticks), 0); $ticks[] = array(count($ticks), "Erreurs"); $serie_moyenne["label"] = "moyenne"; $serie_max["label"] = "max"; $series[] = $serie_moyenne; $series[] = $serie_max; // Set up the title for the graph $title = "Patients moyens et max / heure du jour"; $subtitle = "Moyenne sur tous les jours ouvrables"; if ($prat_id) { $subtitle .= " - Dr {$prat->_view}"; } if ($discipline_id) { $subtitle .= " - {$discipline->_view}"; } if ($bloc_id) { $subtitle .= " - {$bloc->_view}"; } if ($codeCCAM) { $subtitle .= " - CCAM : {$codeCCAM}"; } $options = array('title' => utf8_encode($title), 'subtitle' => utf8_encode($subtitle), 'xaxis' => array('labelsAngle' => 45, 'ticks' => $ticks), 'yaxis' => array('autoscaleMargin' => 1, 'min' => 0), 'lines' => array('show' => true, 'filled' => true, 'fillColor' => '#999'), 'markers' => array('show' => true), 'points' => array('show' => true), 'HtmlText' => false, 'legend' => array('show' => true, 'position' => 'nw'), 'mouse' => array('track' => true, 'relative' => true, 'position' => 'ne'), 'spreadsheet' => array('show' => true, 'csvFileSeparator' => ';', 'decimalSeparator' => ',', 'tabGraphLabel' => utf8_encode('Graphique'), 'tabDataLabel' => utf8_encode('Données'), 'toolbarDownload' => utf8_encode('Fichier CSV'), 'toolbarSelectAll' => utf8_encode('Sélectionner tout le tableau'))); return array('series' => $series, 'options' => $options); }
$group_id = CValue::getOrSession("group_id"); // Fiche établissement $etab = new CGroups(); $etab->load($group_id); // Services d'hospitalisation $service = new CService(); $service->group_id = $etab->_id; $service->cancelled = 0; $service->externe = 0; /** @var CService[] $services */ $services = $service->loadMatchingList("nom"); foreach ($services as $_service) { $_service->loadRefsChambres(false); foreach ($_service->_ref_chambres as $_chambre) { $_chambre->loadRefsLits(false); } } // Blocs opératoires $bloc = new CBlocOperatoire(); $bloc->group_id = $etab->_id; /** @var CBlocOperatoire[] $blocs */ $blocs = $bloc->loadMatchingList("nom"); foreach ($blocs as $_bloc) { $_bloc->loadRefsSalles(); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("etab", $etab); $smarty->assign("services", $services); $smarty->assign("blocs", $blocs); $smarty->display("vw_structure.tpl");
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html */ $type = CValue::get("type", "week"); $date = CValue::get("date", CMbDT::date()); $bloc_id = CValue::get("bloc_id"); $edit_mode = CValue::get("edit_mode", false); if ($type == "week") { $date = CMbDT::date("last sunday", $date); $fin = CMbDT::date("next sunday", $date); $date = CMbDT::date("+1 day", $date); } else { $fin = $date; } //alerts $nbAlertes = 0; $bloc = new CBlocOperatoire(); $bloc->load($bloc_id); $where = array(); if ($bloc->_id) { $where["bloc_operatoire_id"] = "= '{$bloc->_id}'"; } /** @var CBlocOperatoire[] $blocs */ $blocs = $bloc->loadGroupList($where); foreach ($blocs as $_bloc) { $_bloc->loadRefsSalles(); $alertes = $_bloc->loadRefsAlertesIntervs(); foreach ($alertes as $_alerte) { $nbAlertes++; /** @var COperation $operation */ $operation = $_alerte->loadTargetObject(); $operation->loadExtCodesCCAM();
* * @package Mediboard * @subpackage Bloc * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision:$ */ CCanDo::checkAdmin(); $purge = CView::get("purge", "bool default|0"); $max = CView::get("max", "num default|100"); $group = CGroups::loadCurrent(); $where = array(); $where["bloc_operatoire.group_id"] = "= '{$group->_id}'"; $where[] = "\r\n NOT EXISTS (\r\n SELECT * FROM `sallesbloc`\r\n WHERE `sallesbloc`.`bloc_id` = `bloc_operatoire`.`bloc_operatoire_id`\r\n )\r\n"; $order = "bloc_operatoire.nom"; $bloc = new CBlocOperatoire(); $success_count = 0; $failures = array(); $blocs = array(); if ($purge) { /** @var CBlocOperatoire[] $blocs */ $blocs = $bloc->loadList($where, $order, $max); foreach ($blocs as $_bloc) { $back_props = 0; $back_props += $_bloc->countBackRefs('salles'); $back_props += $_bloc->countBackRefs('check_lists'); $back_props += $_bloc->countBackRefs('stock_locations'); $back_props += $_bloc->countBackRefs('postes'); $back_props += $_bloc->countBackRefs('check_list_categories'); $back_props += $_bloc->countBackRefs('check_list_type_links'); $back_props += $_bloc->countBackRefs('product_address_orders');
$date_min = CMbDT::date("-1 DAY", $date); $group = CGroups::loadCurrent(); $op = new COperation(); $ljoin = array("sejour" => "sejour.sejour_id = operations.sejour_id", "grossesse" => "sejour.grossesse_id = grossesse.grossesse_id"); $where = array(); $where["sejour.grossesse_id"] = " IS NOT NULL"; $where["sejour.group_id"] = " = '{$group->_id}' "; $where[] = " date BETWEEN '{$date_min}' AND '{$date}' "; // accouchement non terminé = datetime_accouche IS NULL // ne pas voir les terminés if (!$see_finished) { //$where["grossesse.datetime_accouchement"] = " IS NULL"; $where["grossesse.active"] = " = '1'"; } //blocs $bloc = new CBlocOperatoire(); $bloc->type = "obst"; $bloc->group_id = $group->_id; /** @var CBlocOperatoire[] $blocs */ $blocs = $bloc->loadMatchingList(); $salles = array(); foreach ($blocs as $_bloc) { $salles = $_bloc->loadRefsSalles(); foreach ($salles as $_salle) { $salles[$_salle->_id] = $_salle->_id; } } // anesth $anesth = new CMediusers(); $anesths = $anesth->loadListFromType(array("Anesthésiste"), PERM_READ); /** @var COperation[] $ops */
/** * Récupération du graphique de l'occupation de salle de bloc * * @param string $debut Date de début * @param string $fin Date de fin * @param int $prat_id Identifiant du praticien * @param int $salle_id Identifiant de la salle * @param int $bloc_id Identifiant du bloc * @param int $discipline_id Identifiant de la discipline * @param string $codeCCAM Code CCAM * @param string $type_hospi Type d'hospitalisation * @param bool $hors_plage Pris en compte du hors plage * @param string $type_duree Type de durée (jours / mois) * * @return array */ function graphOccupationSalle($debut = null, $fin = null, $prat_id = 0, $salle_id = 0, $bloc_id = 0, $func_id = 0, $discipline_id = null, $codeCCAM = "", $type_hospi = "", $hors_plage = true, $type_duree = "MONTH") { $ds = CSQLDataSource::get("std"); if ($type_duree == "MONTH") { $type_duree_fr = "mois"; $date_format = "%m/%Y"; $order_key = "%Y%m"; } else { $type_duree_fr = "jour"; $date_format = "%d/%m/%Y"; $order_key = "%Y%m%d"; } if (!$debut) { $debut = CMbDT::date("-1 YEAR"); } if (!$fin) { $fin = CMbDT::date(); } $prat = new CMediusers(); $prat->load($prat_id); $salle = new CSalle(); $salle->load($salle_id); $bloc = new CBlocOperatoire(); $bloc->load($bloc_id); $discipline = new CDiscipline(); $discipline->load($discipline_id); $ticks = array(); for ($i = $debut; $i <= $fin; $i = CMbDT::date("+1 {$type_duree}", $i)) { $ticks[] = array(count($ticks), CMbDT::transform("+0 DAY", $i, $date_format)); } $salles = CSalle::getSallesStats($salle_id, $bloc_id); $user = new CMediusers(); // Chargement des praticiens $where = array(); $where["users_mediboard.actif"] = "= '1'"; if ($discipline->_id) { $where["users_mediboard.discipline_id"] = "= '{$discipline->_id}'"; } // Filter on user type $utypes_flip = array_flip(CUser::$types); $user_types = array("Chirurgien", "Anesthésiste", "Médecin", "Dentiste"); foreach ($user_types as &$_type) { $_type = $utypes_flip[$_type]; } $where["users.user_type"] = CSQLDataSource::prepareIn($user_types); $ljoin = array("users" => "users.user_id = users_mediboard.user_id"); $order = "users_mediboard.function_id, users_mediboard.discipline_id, users.user_last_name, users.user_first_name"; $listPrats = $user->loadList($where, $order, null, null, $ljoin); $seriesMoy = array(); $seriesTot = array(); $totalMoy = 0; $totalTot = 0; // Gestion du hors plage $where_hors_plage = !$hors_plage ? "AND operations.plageop_id IS NOT NULL" : ""; // First serie : Interv $serieMoy = $serieTot = array('data' => array(), 'label' => utf8_encode("Intervention")); $query = "SELECT COUNT(*) AS nbInterv,\r\n SUM(TIME_TO_SEC(operations.fin_op)-TIME_TO_SEC(operations.debut_op)) AS duree_total,\r\n DATE_FORMAT(operations.date, '{$date_format}') AS {$type_duree_fr},\r\n DATE_FORMAT(operations.date, '{$order_key}') AS orderitem\r\n FROM operations\r\n LEFT JOIN sejour ON operations.sejour_id = sejour.sejour_id\r\n LEFT JOIN plagesop ON operations.plageop_id = plagesop.plageop_id\r\n LEFT JOIN users_mediboard ON operations.chir_id = users_mediboard.user_id\r\n LEFT JOIN users ON operations.chir_id = users.user_id\r\n WHERE operations.annulee = '0'\r\n AND operations.date BETWEEN '{$debut}' AND '{$fin}'\r\n {$where_hors_plage}\r\n AND operations.debut_op IS NOT NULL\r\n AND operations.fin_op IS NOT NULL\r\n AND operations.debut_op < operations.fin_op\r\n AND sejour.group_id = '" . CGroups::loadCurrent()->_id . "'\r\n AND operations.salle_id " . CSQLDataSource::prepareIn(array_keys($salles)) . "\r\n AND users.user_id " . CSQLDataSource::prepareIn(array_keys($listPrats), $prat_id); if ($type_hospi) { $query .= "\nAND sejour.type = '{$type_hospi}'"; } if ($discipline_id) { $query .= "\nAND users_mediboard.discipline_id = '{$discipline_id}'"; } if ($codeCCAM) { $query .= "\nAND operations.codes_ccam LIKE '%{$codeCCAM}%'"; } $query .= "\nGROUP BY {$type_duree_fr} ORDER BY orderitem"; $result = $ds->loadList($query); foreach ($ticks as $i => $tick) { $f = true; foreach ($result as $j => $r) { if ($tick[1] == $r["{$type_duree_fr}"]) { $nb_interv = $r["nbInterv"]; $serieMoy['data'][] = array($i, $r["duree_total"] / (60 * $nb_interv)); $totalMoy += $r["duree_total"] / (60 * $nb_interv); $serieTot['data'][] = array($i, $r["duree_total"] / (60 * 60)); $totalTot += $r["duree_total"] / (60 * 60); $f = false; } } if ($f) { $serieMoy["data"][] = array(count($serieMoy["data"]), 0); $serieTot["data"][] = array(count($serieTot["data"]), 0); } } $seriesMoy[] = $serieMoy; $seriesTot[] = $serieTot; // Second serie : Occupation $serieMoy = $serieTot = array('data' => array(), 'label' => utf8_encode("Occupation de salle")); $query = "SELECT COUNT(*) AS nbInterv,\r\n SUM(TIME_TO_SEC(operations.sortie_salle)-TIME_TO_SEC(operations.entree_salle)) AS duree_total,\r\n DATE_FORMAT(operations.date, '{$date_format}') AS {$type_duree_fr},\r\n DATE_FORMAT(operations.date, '{$order_key}') AS orderitem\r\n FROM operations\r\n LEFT JOIN sejour ON operations.sejour_id = sejour.sejour_id\r\n LEFT JOIN plagesop ON operations.plageop_id = plagesop.plageop_id\r\n LEFT JOIN users_mediboard ON operations.chir_id = users_mediboard.user_id\r\n LEFT JOIN users ON operations.chir_id = users.user_id\r\n WHERE operations.annulee = '0'\r\n AND operations.date BETWEEN '{$debut}' AND '{$fin}'\r\n {$where_hors_plage}\r\n AND operations.entree_salle IS NOT NULL\r\n AND operations.sortie_salle IS NOT NULL\r\n AND operations.entree_salle < operations.sortie_salle\r\n AND sejour.group_id = '" . CGroups::loadCurrent()->_id . "'\r\n AND operations.salle_id " . CSQLDataSource::prepareIn(array_keys($salles)) . "\r\n AND users.user_id " . CSQLDataSource::prepareIn(array_keys($listPrats), $prat_id); if ($type_hospi) { $query .= "\nAND sejour.type = '{$type_hospi}'"; } if ($discipline_id) { $query .= "\nAND users_mediboard.discipline_id = '{$discipline_id}'"; } if ($codeCCAM) { $query .= "\nAND operations.codes_ccam LIKE '%{$codeCCAM}%'"; } $query .= "\nGROUP BY {$type_duree_fr} ORDER BY orderitem"; $result = $ds->loadList($query); foreach ($ticks as $i => $tick) { $f = true; foreach ($result as $j => $r) { if ($tick[1] == $r["{$type_duree_fr}"]) { $nb_interv = $r["nbInterv"]; $serieMoy['data'][] = array($i, $r["duree_total"] / (60 * $nb_interv)); $totalMoy += $r["duree_total"] / (60 * $nb_interv); $serieTot['data'][] = array($i, $r["duree_total"] / (60 * 60)); $totalTot += $r["duree_total"] / (60 * 60); $f = false; } } if ($f) { $serieMoy["data"][] = array(count($serieMoy["data"]), 0); $serieTot["data"][] = array(count($serieTot["data"]), 0); } } $seriesMoy[] = $serieMoy; $seriesTot[] = $serieTot; // Third serie : SSPI $serieMoy = $serieTot = array('data' => array(), 'label' => utf8_encode("Salle de reveil")); $query = "SELECT COUNT(*) AS nbInterv,\r\n SUM(TIME_TO_SEC(operations.sortie_reveil_possible)-TIME_TO_SEC(operations.entree_reveil)) AS duree_total,\r\n DATE_FORMAT(operations.date, '{$date_format}') AS {$type_duree_fr},\r\n DATE_FORMAT(operations.date, '{$order_key}') AS orderitem\r\n FROM operations\r\n LEFT JOIN sejour ON operations.sejour_id = sejour.sejour_id\r\n LEFT JOIN plagesop ON operations.plageop_id = plagesop.plageop_id\r\n LEFT JOIN users_mediboard ON operations.chir_id = users_mediboard.user_id\r\n LEFT JOIN users ON operations.chir_id = users.user_id\r\n WHERE operations.annulee = '0'\r\n AND operations.date BETWEEN '{$debut}' AND '{$fin}'\r\n {$where_hors_plage}\r\n AND operations.entree_reveil IS NOT NULL\r\n AND operations.sortie_reveil_possible IS NOT NULL\r\n AND operations.entree_reveil < operations.sortie_reveil_possible\r\n AND sejour.group_id = '" . CGroups::loadCurrent()->_id . "'\r\n AND operations.salle_id " . CSQLDataSource::prepareIn(array_keys($salles)) . "\r\n AND users.user_id " . CSQLDataSource::prepareIn(array_keys($listPrats), $prat_id); if ($type_hospi) { $query .= "\nAND sejour.type = '{$type_hospi}'"; } if ($discipline_id) { $query .= "\nAND users_mediboard.discipline_id = '{$discipline_id}'"; } if ($codeCCAM) { $query .= "\nAND operations.codes_ccam LIKE '%{$codeCCAM}%'"; } $query .= "\nGROUP BY {$type_duree_fr} ORDER BY orderitem"; $result = $ds->loadList($query); foreach ($ticks as $i => $tick) { $f = true; foreach ($result as $j => $r) { if ($tick[1] == $r[$type_duree_fr]) { $nb_interv = $r["nbInterv"]; $serieMoy['data'][] = array($i, $r["duree_total"] / (60 * $nb_interv)); $totalMoy += $r["duree_total"] / (60 * $nb_interv); $serieTot['data'][] = array($i, $r["duree_total"] / (60 * 60)); $totalTot += $r["duree_total"] / (60 * 60); $f = false; } } if ($f) { $serieMoy["data"][] = array(count($serieMoy["data"]), 0); $serieTot["data"][] = array(count($serieTot["data"]), 0); } } $seriesMoy[] = $serieMoy; $seriesTot[] = $serieTot; // Set up the title for the graph $subtitle = ""; if ($prat_id) { $subtitle .= " - Dr {$prat->_view}"; } if ($discipline_id) { $subtitle .= " - {$discipline->_view}"; } if ($salle_id) { $subtitle .= " - {$salle->nom}"; } if ($bloc_id) { $subtitle .= " - {$bloc->nom}"; } if ($codeCCAM) { $subtitle .= " - CCAM : {$codeCCAM}"; } if ($type_hospi) { $subtitle .= " - " . CAppUI::tr("CSejour.type.{$type_hospi}"); } $optionsMoy = CFlotrGraph::merge("lines", array('title' => utf8_encode("Durées moyennes d'occupation du bloc (en minutes)"), 'subtitle' => utf8_encode("par intervention {$subtitle}"), 'xaxis' => array('ticks' => $ticks), 'grid' => array('verticalLines' => true))); if ($totalMoy == 0) { $optionsMoy['yaxis']['max'] = 1; } $optionsTot = CFlotrGraph::merge("lines", array('title' => utf8_encode("Durées totales d'occupation du bloc (en heures)"), 'subtitle' => utf8_encode("total estimé {$subtitle}"), 'xaxis' => array('ticks' => $ticks), 'grid' => array('verticalLines' => true))); if ($totalTot == 0) { $optionsTot['yaxis']['max'] = 1; } if ($type_duree == "MONTH") { return array("moyenne" => array('series' => $seriesMoy, 'options' => $optionsMoy), "total" => array('series' => $seriesTot, 'options' => $optionsTot)); } else { return array('series' => $seriesTot, 'options' => $optionsTot); } }
/** * Récupération du graphique d'occupation des ressources au bloc opératoire * (personnel, vacations attribuées, ouverture de salle) * * @param string $debut Date de début * @param string $fin Date de fin * @param int $prat_id Identifiant du praticien * @param int $salle_id Identifiant de la salle * @param int $bloc_id Identifiant du bloc * @param null $discipline_id Identifiant de la discipline * @param string $codeCCAM Code CCAM * @param string $type_hospi Type d'hospitalisation * @param bool $hors_plage Pris en compte des hors plage * @param string $type_duree Type de durée analysée (jours / mois) * * @return array */ function graphTempsSalle($debut = null, $fin = null, $prat_id = 0, $salle_id = 0, $bloc_id = 0, $func_id = 0, $discipline_id = null, $codeCCAM = "", $type_hospi = "", $hors_plage = true, $type_duree = "MONTH") { $ds = CSQLDataSource::get("std"); if ($type_duree == "MONTH") { $type_duree_fr = "mois"; $date_format = "%m/%Y"; $order_key = "%Y%m"; } else { $type_duree_fr = "jour"; $date_format = "%d/%m/%Y"; $order_key = "%Y%m%d"; } if (!$debut) { $debut = CMbDT::date("-1 YEAR"); } if (!$fin) { $fin = CMbDT::date(); } $prat = new CMediusers(); $prat->load($prat_id); $salle = new CSalle(); $salle->load($salle_id); $bloc = new CBlocOperatoire(); $bloc->load($bloc_id); $discipline = new CDiscipline(); $discipline->load($discipline_id); $ticks = array(); for ($i = $debut; $i <= $fin; $i = CMbDT::date("+1 {$type_duree}", $i)) { $ticks[] = array(count($ticks), CMbDT::transform("+0 DAY", $i, $date_format)); } $salles = CSalle::getSallesStats($salle_id, $bloc_id); $seriesTot = array(); $totalTot = 0; // First serie : occupation du personnel $serieTot = array('data' => array(), 'label' => utf8_encode("Occupation du personnel")); $query = "SELECT SUM(TIME_TO_SEC(affectation_personnel.fin) - TIME_TO_SEC(affectation_personnel.debut)) as total,\n DATE_FORMAT(plagesop.date, '{$date_format}') AS {$type_duree_fr},\n DATE_FORMAT(plagesop.date, '{$order_key}') AS orderitem\n FROM plagesop\n LEFT JOIN operations ON plagesop.plageop_id = operations.plageop_id\n LEFT JOIN users_mediboard ON plagesop.chir_id = users_mediboard.user_id\n LEFT JOIN affectation_personnel ON operations.operation_id = affectation_personnel.object_id "; if ($type_hospi) { $query .= "LEFT JOIN sejour ON sejour.sejour_id = operations.sejour_id "; } $query .= "WHERE affectation_personnel.debut < affectation_personnel.fin\n AND affectation_personnel.debut IS NOT NULL\n AND affectation_personnel.fin IS NOT NULL\n AND affectation_personnel.object_class = 'COperation'\n AND plagesop.salle_id " . CSQLDataSource::prepareIn(array_keys($salles)); if ($codeCCAM) { $query .= "\nAND operations.codes_ccam LIKE '%{$codeCCAM}%'"; } if ($type_hospi) { $query .= "\nAND sejour.type = '{$type_hospi}'"; } if ($prat_id) { $query .= "\nAND plagesop.chir_id = '{$prat_id}'"; } if ($discipline_id) { $query .= "\nAND users_mediboard.discipline_id = '{$discipline_id}'"; } $query .= "\nAND plagesop.date BETWEEN '{$debut}' AND '{$fin}'\n GROUP BY operations.plageop_id HAVING total > 0 ORDER BY orderitem"; $result = $ds->loadlist($query); $result_hors_plage = array(); if ($hors_plage) { $query_hors_plage = "SELECT SUM(TIME_TO_SEC(affectation_personnel.fin) - TIME_TO_SEC(affectation_personnel.debut)) as total,\n DATE_FORMAT(operations.date, '{$date_format}') AS {$type_duree_fr},\n DATE_FORMAT(operations.date, '{$order_key}') AS orderitem\n FROM operations\n LEFT JOIN users_mediboard ON operations.chir_id = users_mediboard.user_id\n LEFT JOIN affectation_personnel ON operations.operation_id = affectation_personnel.object_id "; if ($type_hospi) { $query_hors_plage .= "LEFT JOIN sejour ON sejour.sejour_id = operations.sejour_id "; } $query_hors_plage .= "WHERE affectation_personnel.debut < affectation_personnel.fin\n AND operations.date IS NOT NULL\n AND operations.plageop_id IS NULL\n AND affectation_personnel.debut IS NOT NULL\n AND affectation_personnel.fin IS NOT NULL\n AND affectation_personnel.object_class = 'COperation'\n AND operations.salle_id " . CSQLDataSource::prepareIn(array_keys($salles)); if ($type_hospi) { $query_hors_plage .= "\nAND sejour.type = '{$type_hospi}'"; } if ($prat_id) { $query_hors_plage .= "\nAND operations.chir_id = '{$prat_id}'"; } if ($discipline_id) { $query_hors_plage .= "\nAND users_mediboard.discipline_id = '{$discipline_id}'"; } if ($codeCCAM) { $query_hors_plage .= "\nAND operations.codes_ccam LIKE '%{$codeCCAM}%'"; } $query_hors_plage .= "\nAND operations.date BETWEEN '{$debut}' AND '{$fin}'\n GROUP BY {$type_duree_fr} HAVING total > 0 ORDER BY orderitem"; $result_hors_plage = $ds->loadlist($query_hors_plage); } $calcul_temp = array(); foreach ($result as $r) { if (!isset($calcul_temp[$r[$type_duree_fr]])) { $calcul_temp[$r[$type_duree_fr]] = 0; } $calcul_temp[$r[$type_duree_fr]] += $r['total']; } foreach ($ticks as $i => $tick) { $f = true; foreach ($calcul_temp as $key => $r) { if ($tick[1] == $key) { if ($hors_plage) { foreach ($result_hors_plage as &$_r_h) { if ($tick[1] == $_r_h[$type_duree_fr]) { $r += $_r_h["total"]; unset($_r_h); break; } } } $serieTot['data'][] = array($i, $r / (60 * 60)); $totalTot += $r / (60 * 60); $f = false; } } if ($f) { $serieTot["data"][] = array(count($serieTot["data"]), 0); } } $seriesTot[] = $serieTot; // Second serie : Ouverture de salle $serieTot = array('data' => array(), 'label' => utf8_encode("Ouverture de salle")); $query = "SELECT MAX(TIME_TO_SEC(operations.sortie_salle)) - MIN(TIME_TO_SEC(operations.entree_salle)) as total,\n DATE_FORMAT(plagesop.date, '{$date_format}') AS {$type_duree_fr},\n DATE_FORMAT(plagesop.date, '{$order_key}') AS orderitem\n FROM plagesop\n LEFT JOIN operations ON plagesop.plageop_id = operations.plageop_id\n LEFT JOIN users_mediboard ON plagesop.chir_id = users_mediboard.user_id "; if ($type_hospi) { $query .= "LEFT JOIN sejour ON sejour.sejour_id = operations.sejour_id "; } $query .= "WHERE operations.entree_salle < operations.sortie_salle\n AND plagesop.salle_id " . CSQLDataSource::prepareIn(array_keys($salles)); if ($codeCCAM) { $query .= "\nAND operations.codes_ccam LIKE '%{$codeCCAM}%'"; } if ($type_hospi) { $query .= "\nAND sejour.type = '{$type_hospi}'"; } if ($prat_id) { $query .= "\nAND plagesop.chir_id = '{$prat_id}'"; } if ($discipline_id) { $query .= "\nAND users_mediboard.discipline_id = '{$discipline_id}'"; } $query .= "\nAND plagesop.date BETWEEN '{$debut}' AND '{$fin}'\n GROUP BY operations.plageop_id ORDER BY orderitem"; $result = $ds->loadlist($query); $calcul_temp = array(); foreach ($result as $r) { if (!isset($calcul_temp[$r[$type_duree_fr]])) { $calcul_temp[$r[$type_duree_fr]] = 0; } $calcul_temp[$r[$type_duree_fr]] += $r['total']; } foreach ($ticks as $i => $tick) { $f = true; foreach ($calcul_temp as $key => $r) { if ($tick[1] == $key) { $serieTot['data'][] = array($i, $r / (60 * 60)); $totalTot += $r / (60 * 60); $f = false; } } if ($f) { $serieTot["data"][] = array(count($serieTot["data"]), 0); } } $seriesTot[] = $serieTot; // Third serie : reservé $serieTot = array('data' => array(), 'label' => utf8_encode("Vacations attribuées")); $query = "SELECT SUM(TIME_TO_SEC(plagesop.fin) - TIME_TO_SEC(plagesop.debut)) AS total,\n DATE_FORMAT(plagesop.date, '{$date_format}') AS {$type_duree_fr},\n DATE_FORMAT(plagesop.date, '{$order_key}') AS orderitem\n FROM plagesop\n LEFT JOIN users_mediboard ON plagesop.chir_id = users_mediboard.user_id "; if ($type_hospi || $codeCCAM) { $query .= "LEFT JOIN operations ON operations.plageop_id = plagesop.plageop_id\n LEFT JOIN sejour ON sejour.sejour_id = operations.sejour_id "; } $query .= "WHERE plagesop.salle_id " . CSQLDataSource::prepareIn(array_keys($salles)); if ($codeCCAM) { $query .= "\nAND operations.codes_ccam LIKE '%{$codeCCAM}%'"; } if ($type_hospi) { $query .= "\nAND sejour.type = '{$type_hospi}'"; } if ($prat_id) { $query .= "\nAND plagesop.chir_id = '{$prat_id}'"; } if ($discipline_id) { $query .= "\nAND users_mediboard.discipline_id = '{$discipline_id}'"; } $query .= "\nAND plagesop.date BETWEEN '{$debut}' AND '{$fin}'\n GROUP BY {$type_duree_fr} ORDER BY orderitem"; $result = $ds->loadList($query); foreach ($ticks as $i => $tick) { $f = true; foreach ($result as $r) { if ($tick[1] == $r[$type_duree_fr]) { $serieTot['data'][] = array($i, $r["total"] / (60 * 60)); $totalTot += $r["total"] / (60 * 60); $f = false; } } if ($f) { $serieTot["data"][] = array(count($serieTot["data"]), 0); } } $seriesTot[] = $serieTot; // Set up the title for the graph $subtitle = ""; if ($prat_id) { $subtitle .= " - Dr {$prat->_view}"; } if ($discipline_id) { $subtitle .= " - {$discipline->_view}"; } if ($salle_id) { $subtitle .= " - {$salle->nom}"; } if ($bloc_id) { $subtitle .= " - {$bloc->nom}"; } if ($codeCCAM) { $subtitle .= " - CCAM : {$codeCCAM}"; } if ($type_hospi) { $subtitle .= " - " . CAppUI::tr("CSejour.type.{$type_hospi}"); } $optionsTot = CFlotrGraph::merge("lines", array('title' => utf8_encode("Utilisation des ressources"), 'subtitle' => utf8_encode("total estimé {$subtitle}"), 'xaxis' => array('ticks' => $ticks), 'grid' => array('verticalLines' => true))); if ($totalTot == 0) { $optionsTot['yaxis']['max'] = 1; } return array('series' => $seriesTot, 'options' => $optionsTot); }
* @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id: vw_idx_blocs.php 19148 2013-05-15 12:41:42Z rhum1 $ * @link http://www.mediboard.org */ CCanDo::checkAdmin(); $bloc_id = CValue::getOrSession("bloc_id"); $salle_id = CValue::getOrSession("salle_id"); $poste_sspi_id = CValue::getOrSession("poste_sspi_id"); // Récupération des blocs de l'etablissement $blocs_list = CGroups::loadCurrent()->loadBlocs(PERM_EDIT); // Récupération des postes de l'établissement $postes_list = CGroups::loadCurrent()->loadPostes(PERM_EDIT); // Récupération du bloc à à ajouter / modifier $bloc = new CBlocOperatoire(); $bloc->load($bloc_id); // Récupération de la salle à ajouter / modifier $salle = new CSalle(); $salle->load($salle_id); // Récupération du poste à ajouter / modifier $poste = new CPosteSSPI(); $poste->load($poste_sspi_id); // Création du template $smarty = new CSmartyDP(); $smarty->assign("blocs_list", $blocs_list); $smarty->assign("postes_list", $postes_list); $smarty->assign("bloc", $bloc); $smarty->assign("salle", $salle); $smarty->assign("poste", $poste); $smarty->display("vw_idx_blocs.tpl");
<?php /** * $Id: vw_reveil.php 25667 2014-11-03 11:07:55Z aurelie17 $ * * @package Mediboard * @subpackage SalleOp * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 25667 $ */ CCanDo::checkRead(); $date = CValue::getOrSession("date", CMbDT::date()); $bloc_id = CValue::getOrSession("bloc_id"); $modif_operation = CCanDo::edit() || $date >= CMbDT::date(); $blocs_list = CGroups::loadCurrent()->loadBlocs(); $bloc = new CBlocOperatoire(); if (!$bloc->load($bloc_id) && count($blocs_list)) { $bloc = reset($blocs_list); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("date", $date); $smarty->assign("hour", CMbDT::time()); $smarty->assign("modif_operation", $modif_operation); $smarty->assign("blocs_list", $blocs_list); $smarty->assign("bloc", $bloc); $smarty->assign("isImedsInstalled", CModule::getActive("dPImeds") && CImeds::getTagCIDC(CGroups::loadCurrent())); $smarty->display("vw_reveil.tpl");
* @version $Revision$ */ // Récupération des paramètres $date = CValue::getOrSession("date", CMbDT::date()); $salle_id = CValue::getOrSession("salle_id"); $bloc_id = CValue::getOrSession("bloc_id"); $type = CValue::getOrSession("type", "ouverture_salle"); // Récupération de l'utilisateur courant $user = CUser::get(); $currUser = new CMediusers(); $currUser->load($user->_id); $currUser->isAnesth(); $currUser->isPraticien(); $salle = new CSalle(); $salle->load($salle_id); $bloc = new CBlocOperatoire(); $bloc->load($bloc_id); // Vérification de la check list journalière $daily_check_lists = array(); $daily_check_list_types = array(); $require_check_list = CAppUI::conf("dPsalleOp CDailyCheckList active", CGroups::loadCurrent()) && $date >= CMbDT::date() && !$currUser->_is_praticien; if ($require_check_list) { if ($bloc->_id) { list($check_list_not_validated, $daily_check_list_types, $daily_check_lists) = CDailyCheckList::getCheckLists($bloc, $date, $type); } else { list($check_list_not_validated, $daily_check_list_types, $daily_check_lists) = CDailyCheckList::getCheckLists($salle, $date, $type); } if ($check_list_not_validated == 0) { $require_check_list = false; } }
$listBlocs = CGroups::loadCurrent()->loadBlocs(); $bloc_id = null; if (count($listBlocs)) { $bloc_id = CValue::getOrSession("bloc_id", reset($listBlocs)->_id); if (!array_key_exists($bloc_id, $listBlocs)) { $bloc_id = reset($listBlocs)->_id; } } $listSalles = array(); /** * @var $curr_bloc CBlocOperatoire */ foreach ($listBlocs as &$curr_bloc) { $curr_bloc->loadRefsSalles(); } $bloc = new CBlocOperatoire(); $bloc->load($bloc_id); $bloc->canDo(); $bloc->loadRefsSalles(); $nbAlertesInterv = count($bloc->loadRefsAlertesIntervs()); if (!($listSalles = $bloc->_ref_salles)) { $listSalles = array(); } // Création du tableau de visualisation $affichages = array(); foreach ($listDays as $keyDate => $valDate) { foreach ($listSalles as $keySalle => $valSalle) { $valSalle->_blocage[$valDate] = $valSalle->loadRefsBlocages($valDate); foreach (CPlageOp::$hours as $keyHours => $valHours) { foreach (CPlageOp::$minutes as $keyMins => $valMins) { // Initialisation du tableau
CCanDo::checkRead(); $group = CGroups::loadCurrent(); $ds = CSQLDataSource::get("std"); $service_id = CValue::getOrSession("service_id", 0); $bloc_id = CValue::getOrSession("bloc_id", 0); $date_suivi = CValue::getOrSession("date_suivi", CMbDT::date()); $listOps = array(); // Liste des services $service = new CService(); $where = array(); $where["group_id"] = "= '{$group->_id}'"; $where["cancelled"] = "= '0'"; $order = "nom"; $services = $service->loadListWithPerms(PERM_READ, $where, $order); // Liste des blocs $bloc = new CBlocOperatoire(); $where = array(); $where["group_id"] = "= '{$group->_id}'"; $order = "nom"; $blocs = $bloc->loadListWithPerms(PERM_READ, $where, $order); // Listes des interventions $operation = new COperation(); $ljoin = array("plagesop" => "`operations`.`plageop_id` = `plagesop`.`plageop_id`", "sallesbloc" => "`operations`.`salle_id` = `sallesbloc`.`salle_id`", "sejour" => "`operations`.`sejour_id` = `sejour`.`sejour_id`"); $where = array(); $where[] = "`plagesop`.`date` = '{$date_suivi}' OR `operations`.`date` = '{$date_suivi}'"; if ($bloc_id) { $where["sallesbloc.bloc_id"] = "= '{$bloc_id}'"; } $where["operations.annulee"] = "= '0'"; $where["sejour.group_id"] = "= '{$group->_id}'"; $order = "operations.time_operation";
* @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 28904 $ */ CCanDo::checkAdmin(); $purge = CView::get("purge", "bool default|0"); $max = CView::get("max", "num default|100"); CView::checkin(); $group = CGroups::loadCurrent(); $ljoin = array(); $ljoin["sallesbloc"] = "`sallesbloc`.`bloc_id` = `bloc_operatoire`.`bloc_operatoire_id`"; $where = array(); $where["bloc_operatoire.group_id"] = "= '{$group->_id}'"; $where["sallesbloc.salle_id"] = "IS NULL"; $order = "bloc_operatoire.nom"; $bloc = new CBlocOperatoire(); $success_count = 0; $failures = array(); $blocs = array(); if ($purge) { /** @var CBlocOperatoire[] $blocs */ $blocs = $bloc->loadList($where, $order, $max, null, $ljoin); foreach ($blocs as $_bloc) { if ($msg = $_bloc->delete()) { $failures[$_bloc->_id] = $msg; continue; } $success_count++; } } $count = $bloc->countList($where, null, $ljoin);
$week_fin = CMbDT::date("next sunday", $week_deb); $week_deb = CMbDT::date("+1 day", $week_deb); $next_week_deb = CMbDT::date("+1 day", $week_fin); $next_week_fin = CMbDT::date("next sunday", $next_week_deb); $rectif = CMbDT::transform("+0 DAY", $now, "%d") - 1; $month_deb = CMbDT::date("-{$rectif} DAYS", $now); $month_fin = CMbDT::date("+1 month", $month_deb); $month_fin = CMbDT::date("-1 day", $month_fin); $next_month_deb = CMbDT::date("+1 day", $month_fin); $next_month_fin = CMbDT::date("+1 month", $month_fin); $next_month_fin = CMbDT::date("-1 day", $next_month_fin); $listPrat = new CMediusers(); $listPrat = $listPrat->loadPraticiens(PERM_READ); $listSpec = new CFunctions(); $listSpec = $listSpec->loadSpecialites(PERM_READ, 1); $bloc = new CBlocOperatoire(); $group = CGroups::loadCurrent(); $where = array(); $where["group_id"] = "= '{$group->_id}'"; /** @var CBlocOperatoire[] $listBlocs */ $listBlocs = $bloc->loadListWithPerms(PERM_READ, $where, "nom"); foreach ($listBlocs as &$bloc) { $bloc->loadRefsSalles(); } $praticien = CMediusers::get(); // Création du template $smarty = new CSmartyDP("modules/dPbloc"); $smarty->assign("praticien", $praticien); $smarty->assign("chir", $praticien->user_id); $smarty->assign("filter", $filter); $smarty->assign("filterSejour", $filterSejour);
$max_date_planning = CMbDT::date("+ {$days_limit_future} DAYS", $today); if ($date_planning > $today && $days_limit_future != 0 && $date_planning > $max_date_planning) { $date_planning = $max_date_planning; } $days_limit_past = abs(CAppUI::pref("planning_resa_past_days_limit")); $min_date_planning = CMbDT::date("- {$days_limit_past} DAYS", $today); if ($date_planning < $today && $days_limit_past != 0 && $date_planning < $min_date_planning) { $date_planning = $min_date_planning; } CValue::setSession("date_planning", $date_planning); //alerts $nbIntervHorsPlage = 0; $nbIntervNonPlacees = 0; $nbAlertesInterv = 0; $debut = $fin = $date_planning; $bloc = new CBlocOperatoire(); $where = array(); if ($bloc_id) { $where["bloc_operatoire_id"] = " = '{$bloc_id}'"; } $where["group_id"] = " = '{$group->_id}' "; /** @var CBlocOperatoire[] $blocs */ $blocs = $bloc->loadList($where); CStoredObject::filterByPerm($blocs, PERM_READ); if (count($blocs) == 1) { $current_bloc = reset($blocs); } // optimisation du chargement des salles (one shot) + alertes $salle = new CSalle(); $ds = $salle->getDS(); $where = array();
$month_fin = CMbDT::date("-1 day", $month_fin); $filter = new CConsultation(); $filter->_date_min = CMbDT::date(); $filter->_date_max = CMbDT::date("+ 0 day"); $filter->_etat_paiement = CValue::getOrSession("_etat_paiement", 0); $filter->_type_affichage = CValue::getOrSession("_type_affichage", 0); $filter_reglement = new CReglement(); $filter_reglement->mode = CValue::getOrSession("mode", 0); // L'utilisateur est-il praticien ? $mediuser = CMediusers::get(); $mediuser->loadRefFunction(); $is_praticien = $mediuser->isPraticien(); $is_admin = in_array(CUser::$types[$mediuser->_user_type], array("Administrator")); $is_admin_or_secretaire = in_array(CUser::$types[$mediuser->_user_type], array("Administrator", "Secrétaire")); $listPrat = CConsultation::loadPraticiensCompta(); $bloc = new CBlocOperatoire(); $blocs = $bloc->loadGroupList(); // Création du template $smarty = new CSmartyDP(); $smarty->assign("filter", $filter); $smarty->assign("filter_reglement", $filter_reglement); $smarty->assign("mediuser", $mediuser); $smarty->assign("is_praticien", $is_praticien); $smarty->assign("is_admin_or_secretaire", $is_admin_or_secretaire); $smarty->assign("listPrat", $listPrat); $smarty->assign("now", $now); $smarty->assign("yesterday", $yesterday); $smarty->assign("week_deb", $week_deb); $smarty->assign("week_fin", $week_fin); $smarty->assign("month_deb", $month_deb); $smarty->assign("three_month_deb", $three_month_deb);
$personnels = array(); if (in_array($type, array("ops", "reveil")) && Cmodule::getActive("dPpersonnel")) { $personnel = new CPersonnel(); $personnels = $personnel->loadListPers("reveil"); } // Vérification de la check list journalière $daily_check_lists = array(); $daily_check_list_types = array(); $require_check_list = 0; $require_check_list_close = 0; $listChirs = array(); $listAnesths = array(); $date_close_checklist = null; $date_open_checklist = null; if ($type == "reveil" || $type == "preop") { $bloc = new CBlocOperatoire(); if (!$bloc->load($bloc_id) && count($listSalles)) { $salle = reset($listSalles); $bloc = $salle->loadRefBloc(); } $require_check_list = CAppUI::conf("dPsalleOp CDailyCheckList active_salle_reveil", $group) && $date >= CMbDT::date(); $require_check_list_close = $require_check_list; $type_checklist = $type == "reveil" ? "ouverture_sspi" : "ouverture_preop"; $type_close = $type == "reveil" ? "fermeture_sspi" : "fermeture_preop"; if ($require_check_list) { list($check_list_not_validated, $daily_check_list_types, $daily_check_lists) = CDailyCheckList::getCheckLists($bloc, $date, $type_checklist); if ($check_list_not_validated == 0) { $require_check_list = false; } } if ($require_check_list_close) {
* @package Mediboard * @subpackage dPbloc * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 22873 $ */ $plageop_id = CValue::getOrSession("plageop_id"); $date = CValue::getOrSession("date", CMbDT::date()); $bloc_id = CValue::get("bloc_id"); // Informations sur la plage demandée $plagesel = new CPlageOp(); $plagesel->load($plageop_id); $plagesel->loadRefSalle(); $listBlocs = CGroups::loadCurrent()->loadBlocs(PERM_READ, null, "nom"); //curent bloc if $bloc_id $bloc = new CBlocOperatoire(); $bloc->load($bloc_id); $listSalles = $bloc->loadRefsSalles(); $arrKeySalle = array_keys($listSalles); // cleanup listBlocs foreach ($listBlocs as $key => $curr_bloc) { $salles = $curr_bloc->loadRefsSalles(); foreach ($salles as $id => $_salle) { if (count($arrKeySalle) && !in_array($id, $arrKeySalle)) { unset($salles[$id]); continue; } } if (!count($salles)) { unset($listBlocs[$key]); continue;
$results = array(); $i = 0; if ($file && ($fp = fopen($file['tmp_name'], 'r'))) { // Object columns on the first line $cols = fgetcsv($fp, null, ";"); // Each line while ($line = fgetcsv($fp, null, ";")) { if (!isset($line[0]) || $line[0] == "") { continue; } // Parsing $results[$i]["bloc"] = addslashes(trim($line[0])); $results[$i]["nom"] = addslashes(trim($line[1])); $results[$i]["error"] = 0; // Bloc $bloc = new CBlocOperatoire(); $bloc->nom = $results[$i]["bloc"]; $bloc->group_id = CGroups::loadCurrent()->_id; $bloc->loadMatchingObject(); if (!$bloc->_id) { $msg = $bloc->store(); if ($msg) { CAppUI::setMsg($msg, UI_MSG_ERROR); $results[$i]["error"] = $msg; $i++; continue; } CAppUI::setMsg("Bloc créé", UI_MSG_OK); } // Salle $salle = new CSalle();