$mediuser = new CMediusers(); $anesthesistes = $mediuser->loadAnesthesistes(PERM_READ); if ($consult->consultation_id) { $date = $consult->_ref_plageconsult->date; CValue::setSession("date", $date); } // Récupération des plages de consultation du jour et chargement des références $listPlages = array(); foreach ($anesthesistes as $anesth) { $listPlages[$anesth->_id]["anesthesiste"] = $anesth; $plage = new CPlageconsult(); $where = array(); $where["chir_id"] = "= '{$anesth->_id}'"; $where["date"] = "= '{$date}'"; $order = "debut"; $listPlage = $plage->loadList($where, $order); if (count($listPlage)) { $listPlages[$anesth->_id]["plages"] = $listPlage; } else { unset($listPlages[$anesth->_id]); unset($anesthesistes[$anesth->_id]); } } foreach ($listPlages as &$element) { foreach ($element["plages"] as &$plage) { /** @var CPlageconsult $plage */ $plage->_ref_chir =& $element["anesthesiste"]; $plage->loadRefsBack(); foreach ($plage->_ref_consultations as $keyConsult => &$consultation) { if ($consultation->chrono == CConsultation::TERMINE) { unset($plage->_ref_consultations[$keyConsult]);
$user = new CMediusers(); $user->load($plage->chir_id); $function = $user->loadRefFunction(); if ($function->quotas) { $quotas = $function->quotas; } $listPrat = CConsultation::loadPraticiens(PERM_EDIT, $user->function_id, null, true); $listAllPrat = CConsultation::loadPraticiens(null, null, null, true); $where = array(); $where["date"] = $ds->prepare("BETWEEN %1 AND %2", "{$plage->date}", "{$plage->date}"); $where[] = "libelle != 'automatique' OR libelle IS NULL"; $where["chir_id"] = " = '{$user->_id}'"; if ($display_nb_consult == "cab" || $display_nb_consult == "etab") { $where["chir_id"] = CSQLDataSource::prepareIn(array_keys($listPrat)); /** @var CPlageconsult[] $plages_func */ $plages_func = $plage->loadList($where); $utilisation_func = utilisation_rdv($plages_func, $listPlace, $plage); } if ($display_nb_consult == "etab") { $where["chir_id"] = CSQLDataSource::prepareIn(array_keys($listAllPrat)); /** @var CPlageconsult[] $plages_etab */ $plages_etab = $plage->loadList($where); $utilisation_etab = utilisation_rdv($plages_etab, $listPlace, $plage); } // next consult $next_plage = $plage->getNextPlage(); // previous consult $previous_plage = $plage->getPreviousPlage(); } // user's function available $mediuser = new CMediusers();
if ($start > $date) { $start = CMbDT::date("last monday", $date); } $end = CMbDT::date("next sunday", $start); $muser = new CMediusers(); $musers = $muser->loadProfessionnelDeSanteByPref(PERM_READ, $function_id); $function = new CFunctions(); $function->load($function_id); echo "<h1>" . $function->_view . " (" . CMbDT::format($start, CAppUI::conf('longdate')) . " - " . CMbDT::format($end, CAppUI::conf('longdate')) . ")</h1>"; $pconsult = new CPlageconsult(); $ds = $pconsult->getDS(); $where = array(); $where[] = "chir_id " . $ds->prepareIn(array_keys($musers)) . " OR remplacant_id " . $ds->prepareIn(array_keys($musers)); $where["date"] = " BETWEEN '{$start}' AND '{$end}' "; /** @var CPlageconsult[] $pconsults */ $pconsults = $pconsult->loadList($where, "date", null, "chir_id"); $pconsults_by_date_and_prat = array(); if (!count($pconsults)) { echo "<div class='small-info'>Les praticiens de ce cabinet n'ont pas de plages de consultations sur cette période</div>"; CApp::rip(); } foreach ($pconsults as $_pc) { $chir_id = CValue::get("chir_id", $_pc->chir_id); $_pc->loadRefChir(); $_pc->loadRefRemplacant(); echo "<h2>"; echo $_pc->_ref_chir->_view; if ($_pc->remplacant_id) { echo "remplacé par : " . $_pc->_ref_remplacant->_view; } echo "</h2>";
$prat->load(CValue::getOrSession("chir")); if (!$prat->_id) { CAppUI::stepMessage(UI_MSG_WARNING, "CMediusers-warning-undefined"); return; } $prat->loadRefFunction(); $listPrat = array($prat->_id => $prat); $plageconsult = new CPlageconsult(); $ljoin = array(); $ljoin["consultation"] = "consultation.plageconsult_id = plageconsult.plageconsult_id"; $where = array(); $where[] = "\n (plageconsult.chir_id <> '{$prat->_id}' AND \n (plageconsult.remplacant_id = '{$prat->_id}' OR plageconsult.pour_compte_id = '{$prat->_id}'))\n OR \n (plageconsult.chir_id = '{$prat->_id}' AND \n ((plageconsult.remplacant_id <> '{$prat->_id}' AND plageconsult.remplacant_id IS NOT NULL)\n OR \n (plageconsult.pour_compte_id <> '{$prat->_id}' AND plageconsult.pour_compte_id IS NOT NULL))\n )"; $where["plageconsult.date"] = " BETWEEN '{$filter->_date_min}' AND '{$filter->_date_max}'"; $where["consultation.annule"] = "= '0'"; $order = "chir_id ASC"; $listPlages = $plageconsult->loadList($where, $order, null, null, $ljoin); $plages = array(); foreach ($listPlages as $plage) { $plage->loadRefsConsultations(); $plages[$plage->_id]["total"] = 0; foreach ($plage->_ref_consultations as $consult) { $consult->loadRefPatient(); $plages[$plage->_id]["total"] += $consult->du_patient * $plage->pct_retrocession / 100; } } // Création du template $smarty = new CSmartyDP(); $smarty->assign("listPrat", $listPrat); $smarty->assign("listPlages", $listPlages); $smarty->assign("filter", $filter); $smarty->assign("plages", $plages);
foreach ($horsPlages as $_horsplage) { $lenght = CMBDT::minutesRelative("00:00:00", $_horsplage->temp_operation); $op = new CPlanningRange($_horsplage->_guid, $jour . " " . $_horsplage->time_operation, $lenght, $_horsplage, "3c75ea", "horsplage"); $planning->addRange($op); } // INTERVENTIONS /** @var CPlageOp[] $intervs */ $interv = new CPlageOp(); $intervs = $interv->loadList($whereInterv); CMbObject::massLoadFwdRef($intervs, "chir_id"); foreach ($intervs as $_interv) { $range = new CPlanningRange($_interv->_guid, $jour . " " . $_interv->debut, CMbDT::minutesRelative($_interv->debut, $_interv->fin), CAppUI::tr($_interv->_class), "bbccee", "plageop"); $planning->addRange($range); } } $plages = $plage->loadList($where); CMbObject::massLoadFwdRef($plages, "chir_id"); /** @var $_plage CPlageconsult */ foreach ($plages as $_plage) { $_plage->loadRefsFwd(1); $_plage->loadRefsConsultations(false); $range = new CPlanningRange($_plage->_guid, $jour . " " . $_plage->debut, CMbDT::minutesRelative($_plage->debut, $_plage->fin)); $range->color = $_plage->color; $range->type = "plageconsult"; $planning->addRange($range); foreach ($_plage->_ref_consultations as $_consult) { $debute = "{$jour} {$_consult->heure}"; if ($_consult->patient_id) { $_consult->loadRefPatient(); $color = "#fee"; if ($_consult->premiere) {
*/ CCanDo::checkAdmin(); // Vérification des droits sur les praticiens $praticiens = CConsultation::loadPraticiens(PERM_EDIT); // Filtre $filter = new CPlageconsult(); $where = array(); if ($filter->chir_id = CValue::getOrSession("chir_id")) { $where["chir_id"] = "= '{$filter->chir_id}'"; } if ($filter->_date_min = CValue::getOrSession("_date_min")) { $where[] = "date >= '{$filter->_date_min}'"; } if ($filter->_date_max = CValue::getOrSession("_date_max")) { $where[] = "date <= '{$filter->_date_max}'"; } // Chargement des plages $plages = array(); if ($filter->chir_id) { /** @var CPlageconsult[] $plages */ $plages = $filter->loadList($where, "date"); foreach ($plages as $_plage) { $_plage->loadFillRate(); } } // Création du template $smarty = new CSmartyDP(); $smarty->assign("praticiens", $praticiens); $smarty->assign("plages", $plages); $smarty->assign("filter", $filter); $smarty->display("transfert_plageconsult.tpl");
$range = new CPlanningRange($_interv->_guid, $jour . " " . $_interv->debut, CMbDT::minutesRelative($_interv->debut, $_interv->fin), CAppUI::tr($_interv->_class), "bbccee", "plageop"); $planning->addRange($range); } //HORS PLAGE $horsPlage = new COperation(); /** @var COperation[] $horsPlages */ $horsPlages = $horsPlage->loadList($whereHP); CMbObject::massLoadFwdRef($horsPlages, "chir_id"); foreach ($horsPlages as $_horsplage) { $lenght = CMBDT::minutesRelative("00:00:00", $_horsplage->temp_operation); $op = new CPlanningRange($_horsplage->_guid, $jour . " " . $_horsplage->time_operation, $lenght, $_horsplage, "3c75ea", "horsplage"); $planning->addRange($op); } } /** @var CPlageconsult[] $listPlages */ $listPlages = $plage->loadList($where, "date, debut"); foreach ($listPlages as $_plage) { $_plage->loadRefsBack(); $_plage->countPatients(); $_plage->loadDisponibilities(); $debute = "{$jour} {$_plage->debut}"; $libelle = ""; if (CMbDT::minutesRelative($_plage->debut, $_plage->fin) >= 30) { $libelle = $_plage->libelle; } $color = "#DDD"; if ($_plage->desistee) { if (!$_plage->remplacant_id) { $color = "#CCC"; } elseif ($_plage->remplacant_id && $_plage->remplacant_id != $chirSel) { $color = "#FAA";
// Plages de Consultations $plageConsult = new CPlageconsult(); $plageOp = new CPlageOp(); $listDays = array(); /** @var CPlageconsult[] $plagesConsult */ $plagesConsult = array(); $plagesOp = array(); $plagesPerDayOp = array(); for ($i = 0; CMbDT::date("+{$i} day", $debut) != $fin; $i++) { $date = CMbDT::date("+{$i} day", $debut); if (in_array("consult", $export)) { $where = array(); $where["chir_id"] = "= '{$prat_id}'"; $where["date"] = "= '{$date}'"; /** @var CPlageconsult[] $plagesPerDayConsult */ $plagesPerDayConsult = $plageConsult->loadList($where); if ($details) { CMbObject::massLoadBackRefs($plagesPerDayConsult, "consultations"); } foreach ($plagesPerDayConsult as $key => $plageConsult) { $plageConsult->countPatients(); $plageConsult->loadFillRate(); if ($details) { $plageConsult->loadRefsConsultations(); } } $plagesConsult[$date] = $plagesPerDayConsult; } if (in_array("interv", $export)) { $where = array(); $where[] = "chir_id = '{$prat_id}' OR anesth_id = '{$prat_id}'";
$date = CValue::get("date", CMbDT::date()); // Praticiens sélectionnés $user = new CMediusers(); $praticiens = array(); if ($function_id) { $praticiens = CConsultation::loadPraticiens(PERM_EDIT, $function_id); } if ($chir_ids) { $praticiens = $user->loadAll(explode("-", $chir_ids)); } //plages de consultation $where = array(); $where["chir_id"] = CSQLDataSource::prepareIn(array_keys($praticiens)); $where["date"] = " = '{$date}'"; $Pconsultation = new CPlageconsult(); $Pconsultations = $Pconsultation->loadList($where, array("debut")); $nbConsultations = 0; $consultations = array(); $resumes_patient = array(); /** @var $Pconsultations CPlageConsult[] */ foreach ($Pconsultations as $_plage_consult) { $_plage_consult->loadRefsConsultations(false, false); $_plage_consult->loadRefChir(); $_plage_consult->countPatients(); $_plage_consult->_ref_chir->loadRefFunction(); $_plage_consult->updateFormFields(); $_plage_consult->loadFillRate(); /** @var $consultations CConsultation[] */ foreach ($_plage_consult->_ref_consultations as $_consult) { if (isset($resumes_patient[$_consult->patient_id])) { continue;
$maxDate = CMbDT::transform("+1 month", $minDate, "%Y-%m-01"); $maxDate = CMbDT::date("-1 day", $maxDate); $refDate = $minDate; break; default: trigger_error("Période '{$period}' inconnue"); break; } $bank_holidays = array_merge(CMbDate::getHolidays($minDate), CMbDate::getHolidays($maxDate)); $where["date"] = $ds->prepare("BETWEEN %1 AND %2", $minDate, $maxDate); $where[] = "libelle != 'automatique' OR libelle IS NULL"; $ljoin["users"] = "users.user_id = plageconsult.chir_id OR users.user_id = plageconsult.remplacant_id "; $order = "date, user_last_name, user_first_name, debut"; // Chargement des plages disponibles /** @var CPlageconsult[] $listPlage */ $listPlage = $plage->loadList($where, $order, null, "plageconsult_id", $ljoin); if (!array_key_exists($plageconsult_id, $listPlage)) { $plage->_id = $plageconsult_id = null; } foreach ($listPlage as $currPlage) { if (!$plageconsult_id && $date == $currPlage->date) { $plageconsult_id = $currPlage->_id; } $currPlage->_ref_chir = $listPrat[$currPlage->chir_id]; $currPlage->loadFillRate(); $currPlage->loadCategorieFill(); $currPlage->loadRefsNotes(); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("period", $period);
if (!$plage_consult->_id && $function_id) { $mediuser = new CMediusers(); $users = $mediuser->loadProfessionnelDeSante(PERM_READ, $function_id); $where["chir_id"] = $ds->prepareIn(array_keys($users)); $plage_consult->loadObject($where); } if (!$plage_consult->_id) { CApp::json($plages); } // guess next dates $dates = array(); for ($a = 1; $a <= $nb; $a++) { $dates[$a] = CMbDT::date("+{$a} {$type}", $date); } $where["date"] = $ds->prepareIn($dates); $plages = $plage_consult->loadList($where, "date ASC"); $date_plage = array(); // fill out foreach ($dates as $nb => $_date) { $date_plage[$_date] = array(); } foreach ($plages as $_plage) { $date_plage[$_plage->date] = $_plage->_id; //$date_plage[$_plage->date][] = $_plage->_id; //@TODO : array } $results = array(); foreach ($dates as $nb => $_date) { // try to find something else if no result on date if (!count($date_plage[$_date])) { $results[] = $_date; continue;
* $Id$ * * @package Mediboard * @subpackage Cabinet * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkAdmin(); $praticien_id = CValue::get("praticien_id"); $date = CValue::get("date", CMbDT::date("+5 year")); $limit = CValue::get("limit", 100); $plage = new CPlageconsult(); $plage->_spec->loggable = false; $where = array(); if ($praticien_id) { $where["plageconsult.chir_id"] = "= '{$praticien_id}'"; } $where["plageconsult.date"] = "> '{$date}'"; $count = $plage->countList($where); CAppUI::setMsg("'{$count}' plages à supprimer après '{$date}'", UI_MSG_OK); /** @var CPlageconsult[] $listPlages */ $listPlages = $plage->loadList($where, null, $limit); foreach ($listPlages as $_plage) { if ($msg = $_plage->delete()) { CAppUI::setMsg("Plage non supprimée", UI_MSG_ERROR); } else { CAppUI::setMsg("Plage supprimée", UI_MSG_OK); } } echo CAppUI::getMsg();
if ($chir_ids) { $praticiens = $user->loadAll(explode("-", $chir_ids)); } // Bornes de dates list($period_count, $period_type) = explode("-", $period); $period_count++; $date_min = CMbDT::date($date); $date_max = CMbDT::date("first day of this month", $date); $date_max = CMbDT::date("+ {$period_count} {$period_type} - 1 day", $date_max); // Chargement de toutes les plages concernées $where["chir_id"] = CSQLDataSource::prepareIn(array_keys($praticiens)); $where["date"] = $ds->prepare("BETWEEN %1 AND %2", $date_min, $date_max); $order = "date, debut"; $plage = new CPlageconsult(); /** @var CPlageconsult[] $plages */ $plages = $plage->loadList($where, $order); /** @var CPlageconsult[][] $plages Plages par mois*/ $listPlages = array(); $bank_holidays = array_merge(CMbDate::getHolidays($date_min), CMbDate::getHolidays($date_max)); $totals = array(); // Chargement des places disponibles pour chaque plage foreach ($plages as $_plage) { // Classement par mois $month = CMbDT::format($_plage->date, "%B %Y"); $listPlages[$month][] = $_plage; // Praticien $_plage->_ref_chir = $praticiens[$_plage->chir_id]; $_plage->_ref_chir->loadRefFunction(); // Totaux if (!isset($totals[$month])) { $totals[$month] = array("affected" => 0, "total" => 0);