コード例 #1
0
ファイル: ajax_vw_month.php プロジェクト: fbone/mediboard4
             $calendar->addClassesForDay("disabled", $first_day);
             if ($replaced_by->_id) {
                 $event = new CPlanningEvent($_conge->_guid, $first_day);
                 $event->title = "<strong>" . ($_conge->_view ? $_conge->_view : "Congés");
                 if ($function_id) {
                     $event->title .= " (" . $_prat->_shortview . ")";
                 }
                 $event->title .= $replaced_by ? " remplacé par " . $replaced_by->_view . "</strong> " : null;
                 $calendar->days[$first_day][$_conge->_guid] = $event;
             }
             $first_day = CMbDT::date("+1 DAY", $first_day);
         }
     }
 }
 // plages consult
 $plage = new CPlageconsult();
 $plages_c = $plage->loadForDays($_prat->_id, $calendar->date_min, $calendar->date_max);
 foreach ($plages_c as $_plage) {
     $_plage->loadRefsConsultations(false);
     $count = count($_plage->_ref_consultations);
     $_plage->loadFillRate();
     $event = new CPlanningEvent($_plage->_guid, $_plage->date . " {$_plage->debut}", CMbDT::minutesRelative($_plage->date . " " . $_plage->debut, $_plage->date . " " . $_plage->fin), null, "#" . $_plage->color);
     $title = $_plage->libelle ? $_plage->libelle : CAppUI::tr($_plage->_class);
     $event->title = $_plage->locked ? "<img src=\"images/icons/lock.png\" style='max-height: 1em;' alt=\"\" />" : null;
     $event->title .= "<strong>" . CMbDT::format($_plage->debut, "%H:%M") . " - " . CMbDT::format($_plage->fin, "%H:%M") . "</strong> {$count} " . CAppUI::tr("CConsultation");
     $event->title .= $count > 1 ? "s" : null;
     $event->title .= "<small>";
     $event->title .= "<br/>{$title}";
     if ($function_id) {
         $event->title .= " - " . $_prat->_shortview . "";
     }
コード例 #2
0
ファイル: vw_planning_new.php プロジェクト: fbone/mediboard4
 * @package    Mediboard
 * @subpackage Cabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 26656 $
 */
CCanDo::checkRead();
$group = CGroups::loadCurrent();
// L'utilisateur est-il praticien ?
$chir = null;
$mediuser = CMediusers::get();
if ($mediuser->isPraticien()) {
    $chir = $mediuser->createUser();
}
// Droit en écriture sur les plages
$plage = new CPlageconsult();
$canEditPlage = $plage->getPerm(PERM_EDIT);
// Praticien selectionné
$chirSel = CValue::getOrSession("chirSel", $chir ? $chir->user_id : null);
// function selected
$function_id = CValue::getOrSession("function_id");
$listFnc = array();
if ($function_id) {
    $listChir = CConsultation::loadPraticiens(PERM_EDIT, $function_id, null, true);
    foreach ($listChir as $_chir) {
        $_chir->loadRefFunction();
    }
} else {
    $listChir = CConsultation::loadPraticiens(PERM_EDIT);
}
// Liste des consultations a avancer si desistement
コード例 #3
0
$boardItem = CValue::get("boardItem", 1);
$consult = new CConsultation();
// Récupération des fonctions
$cabinets = CMediusers::loadFonctions();
// Récupération de la liste des anesthésistes
$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 */
コード例 #4
0
 */
CCanDo::checkRead();
// L'utilisateur est-il praticien ?
$chir = null;
$mediuser = CMediusers::get();
if ($mediuser->isPraticien()) {
    $chir = $mediuser->createUser();
}
// Praticien selectionné
$chirSel = CValue::getOrSession("chirSel", $chir ? $chir->user_id : null);
// Type de vue
$show_payees = CValue::getOrSession("show_payees", 1);
$show_annulees = CValue::getOrSession("show_annulees", 0);
// Plage de consultation selectionnée
$plageconsult_id = CValue::getOrSession("plageconsult_id", null);
$plageSel = new CPlageconsult();
if ($plageconsult_id === null && $chirSel && $is_in_period) {
    $nowTime = CMbDT::time();
    $where = array("chir_id = '{$chirSel}' OR remplacant_id = '{$chirSel}' OR pour_compte_id = '{$chirSel}'", "date" => "= '{$today}'", "debut" => "<= '{$nowTime}'", "fin" => ">= '{$nowTime}'");
    $plageSel->loadObject($where);
}
if (!$plageSel->plageconsult_id) {
    $plageSel->load($plageconsult_id);
} else {
    $plageconsult_id = $plageSel->plageconsult_id;
}
$plageSel->loadRefChir();
$plageSel->loadRefRemplacant();
$plageSel->loadRefPourCompte();
$plageSel->loadRefsNotes();
$plageSel->loadRefsBack($show_annulees, true, $show_payees);
コード例 #5
0
 */
CCanDo::checkRead();
$now = CMbDT::date();
$filter = new CConsultation();
$filter->plageconsult_id = CValue::get("plage_id", null);
$filter->_date_min = CValue::get("_date_min", "{$now}");
$filter->_date_max = CValue::get("_date_max", "{$now}");
$filter->_telephone = CValue::get("_telephone", 1);
$filter->_coordonnees = CValue::get("_coordonnees");
$filter->_plages_vides = CValue::get("_plages_vides", 1);
$filter->_non_pourvues = CValue::get("_non_pourvues", 1);
$filter->_print_ipp = CValue::get("_print_ipp", CAppUI::conf("dPcabinet CConsultation show_IPP_print_consult"));
$chir = CValue::getOrSession("chir");
$show_lit = false;
// On selectionne les plages
$plage = new CPlageconsult();
$where = array();
if ($filter->plageconsult_id) {
    $plage->load($filter->plageconsult_id);
    $filter->_date_min = $filter->_date_max = $plage->date;
    $filter->_ref_plageconsult = $plage;
    $where["plageconsult_id"] = "= '{$filter->plageconsult_id}'";
} else {
    $where["date"] = "BETWEEN '{$filter->_date_min}' AND '{$filter->_date_max}'";
    // Liste des praticiens
    $listPrat = CConsultation::loadPraticiens(PERM_EDIT);
    $where["chir_id"] = CSQLDataSource::prepareIn(array_keys($listPrat), $chir);
}
$order = array();
$order[] = "date";
$order[] = "chir_id";
コード例 #6
0
$_line_element_id = CValue::get("_line_element_id");
if (!$chir_id) {
    $chir_id = reset($listPraticiens);
}
$prat = new CMediusers();
$prat->load($chir_id);
//Planning au format  CPlanningWeek
$today = CMbDT::date();
$debut = $date;
$debut = CMbDT::date("-1 week", $debut);
$debut = CMbDT::date("next monday", $debut);
$fin = CMbDT::date("next sunday", $debut);
$bank_holidays = array_merge(CMbDate::getHolidays($debut), CMbDate::getHolidays($fin));
// Nombre de jours
$nbDays = 5;
$plage = new CPlageconsult();
$whereInterv = array();
$whereHP = array();
$where = array();
$whereInterv["chir_id"] = $whereHP["chir_id"] = " = '{$chir_id}'";
$where[] = "chir_id = '{$chir_id}' OR remplacant_id = '{$chir_id}'";
$where["date"] = $whereInterv["date"] = $whereHP["date"] = "= '{$fin}'";
if ($_line_element_id) {
    $where["pour_tiers"] = "= '1'";
}
if ($plage->countList($where)) {
    $nbDays = 7;
} else {
    $where["date"] = "= '" . CMbDT::date("-1 day", $fin) . "'";
    if ($plage->countList($where)) {
        $nbDays = 6;
コード例 #7
0
ファイル: vw_week.php プロジェクト: fbone/mediboard4
        $nbjours--;
    }
}
// Instanciation du planning
$planning = new CPlanningWeek($debut, $debut, $fin, $nbjours, false, null, null, true);
if ($user->load($chirSel)) {
    $planning->title = $user->load($chirSel)->_view;
} else {
    $planning->title = "";
}
$planning->guid = $mediuser->_guid;
$planning->hour_min = "07";
$planning->hour_max = "20";
$planning->pauses = array("07", "12", "19");
$hours = CPlageconsult::$hours;
$plageConsult = new CPlageconsult();
$plageOp = new CPlageOp();
$plagesConsult = array();
$plagesOp = array();
$hours_stop = CPlageconsult::$hours_stop;
$hours_start = CPlageconsult::$hours_start;
$where = array();
$where["chir_id"] = "= '{$chirSel}'";
$last_day = CMbDT::date("+7 day", $debut);
//plages consult
$plagesConsult = $plageConsult->loadForDays($chirSel, $debut, $last_day);
$color = "#BFB";
foreach ($plagesConsult as $_consult) {
    $_consult->loadFillRate();
    $_consult->countPatients();
    $_consult->loadRefChir();
コード例 #8
0
/**
 * $Id: ajax_stats_medecins_correspondants.php 26397 2014-12-15 11:13:59Z phenxdesign $
 *  
 * @category Cabinet
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision: 26397 $
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
// Current user and current function
$mediuser = CMediusers::get();
$function = $mediuser->loadRefFunction();
// Filter
$filter = new CPlageconsult();
$filter->_function_id = CValue::get("_function_id", $function->type == "cabinet" ? $function->_id : null);
$filter->_date_min = CValue::get("_date_min", CMbDT::date("last month"));
$filter->_date_max = CValue::get("_date_max", CMbDT::date());
$filter->_user_id = CValue::get("_user_id", null);
$compute_mode = CValue::get("compute_mode");
$csv = CValue::get("csv");
$page = (int) CValue::get("page", 0);
$limit = 1000;
if ($csv) {
    $limit = 10000;
}
$group_id = CGroups::loadCurrent()->_id;
$ds = $filter->getDS();
$list = array();
if ($compute_mode == "adresse_par") {
コード例 #9
0
$chir_ids = CValue::get("chir_ids");
$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])) {
コード例 #10
0
ファイル: ajax_list_plages.php プロジェクト: fbone/mediboard4
        $pdate = CMbDT::date("-1 day", $date);
        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;
}
$currPlage = new CPlageconsult();
foreach ($listPlage as $currPlage) {
    if (!$plageconsult_id && $date == $currPlage->date) {
        $plageconsult_id = $currPlage->_id;
    }
    $currPlage->_ref_chir = $listPrat[$currPlage->chir_id];
    $currPlage->loadCategorieFill();
    $currPlage->loadRefsNotes();
    $currPlage->countPatients();
    $currPlage->loadRefsConsultations(false);
    $currPlage->loadDisponibilities();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("period", $period);
$smarty->assign("periods", $periods);
コード例 #11
0
        /** @var $_consult CConsultation */
        foreach ($consultation_temp->loadListWithPerms(PERM_READ, $where_next, "date", $limit, null, $ljoin_next) as $_consult) {
            $consultation_temp->loadRefPlageConsult()->loadRefChir();
            $_consult->loadRefElementPrescription();
            $consultation_ids[] = array($_consult->plageconsult_id, $_consult->_id, $_consult->_ref_plageconsult->date, $_consult->heure, $_consult->_ref_chir->_id, utf8_encode($_consult->_ref_chir->_view), $_consult->annule, $_consult->rques, $_consult->element_prescription_id, utf8_encode($_consult->_ref_element_prescription->libelle));
        }
    }
}
if ($heure && !$consultation_id) {
    $consultation_ids[] = array($plageconsult_id, null, $date, $heure, $chir_id, "chir", 0, null, null, null);
}
//functions
$function = new CFunctions();
$listFunctions = $function->loadSpecialites(PERM_EDIT);
// Récupération des plages de consultation disponibles
$plage = new CPlageconsult();
$where = array();
// Praticiens sélectionnés
$listPrat = CConsultation::loadPraticiens(PERM_EDIT, $function_id, null, true);
if ($_line_element_id) {
    $where["pour_tiers"] = "= '1'";
}
$chir_sel = CSQLDataSource::prepareIn(array_keys($listPrat), $chir_id);
$where[] = "chir_id {$chir_sel} OR remplacant_id {$chir_sel}";
// Filtres
if ($hour) {
    $where["debut"] = "<= '{$hour}:00'";
    $where["fin"] = "> '{$hour}:00'";
}
if ($hide_finished) {
    $where[] = $ds->prepare("`date` >= %", CMbDT::date());
コード例 #12
0
ファイル: ajax_guess_next.php プロジェクト: fbone/mediboard4
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkRead();
$type = CValue::get("type");
$nb = CValue::get("number", 1);
$date = CValue::get("date");
$chir_id = CValue::get("chir_id");
$function_id = CValue::get("function_id");
$plages = array();
if (!$type || !$nb) {
    CApp::json($plages);
}
// get current
$plage_consult = new CPlageconsult();
$ds = $plage_consult->getDS();
$where = array();
$where['date'] = " = '{$date}' ";
$where['locked'] = " != '1' ";
if ($chir_id) {
    $where['chir_id'] = " = '{$chir_id}' ";
    $plage_consult->loadObject($where);
}
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) {
コード例 #13
0
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage dPcabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
// Object binding
$obj = new CPlageconsult();
$obj->bind($_POST);
$del = CValue::post("del", 0);
$repeat = min(CValue::post("_repeat", 0), 100);
if ($del) {
    // Suppression des plages
    $obj->load();
    while ($repeat > 0) {
        if (!$obj->_id) {
            CAppUI::setMsg("Plage non trouvée", UI_MSG_ERROR);
        } else {
            if ($msg = $obj->delete()) {
                CAppUI::setMsg("Plage non supprimée", UI_MSG_ERROR);
                CAppUI::setMsg("Plage du {$obj->date}: {$msg}", UI_MSG_ERROR);
            } else {
                CAppUI::setMsg("Plage supprimée", UI_MSG_OK);
            }
        }
        $repeat -= $obj->becomeNext();
コード例 #14
0
        unset($plageSel->_ref_consultations[$keyConsult]);
        continue;
    }
    // Cache les annulées
    if ($consultation->annule) {
        unset($plageSel->_ref_consultations[$keyConsult]);
        continue;
    }
    $consultation->loadRefSejour(1);
    $consultation->loadRefPatient(1);
    $consultation->loadRefCategorie(1);
    $consultation->countDocItems();
}
if ($chirSel && $plageSel->chir_id != $chirSel) {
    $plageconsult_id = null;
    $plageSel = new CPlageconsult();
}
CValue::setSession("plageconsult_id", $plageconsult_id);
// Liste des chirurgiens
$mediusers = new CMediusers();
$listChirs = $mediusers->loadProfessionnelDeSanteByPref(PERM_EDIT);
$listDaysSelect = array();
for ($i = 0; $i < 7; $i++) {
    $dateArr = CMbDT::date("+{$i} day", $debut);
    $listDaysSelect[$dateArr] = $dateArr;
}
$holidays = CMbDate::getHolidays();
// Variable permettant de compter les jours pour la suppression du samedi et du dimanche
$i = 0;
// Détermination des bornes du semainier
$min = CPlageconsult::$hours_start . ":" . reset(CPlageconsult::$minutes) . ":00";
コード例 #15
0
 * @version    $Revision$
 */
CCanDo::check();
global $period, $periods, $listPraticiens, $chir_id, $function_id, $date, $ndate, $pdate, $heure, $plageconsult_id, $consultation_id;
$period = CValue::get("period", CAppUI::pref("DefaultPeriod"));
$periods = array("day", "week", "month", "weekly");
$chir_id = CValue::get("chir_id");
$function_id = $chir_id ? null : CValue::get("function_id");
$date = CValue::get("date", CMbDT::date());
$plageconsult_id = CValue::get("plageconsult_id");
$consultation_id = CValue::get("consultation_id");
$heure = CValue::get("heure");
// Vérification des droits sur les praticiens
$listPraticiens = CConsultation::loadPraticiens(PERM_EDIT);
// Récupération des consultations de la plage séléctionnée
$plage = new CPlageconsult();
if ($plageconsult_id) {
    $plage->load($plageconsult_id);
    $date = $plage->date;
}
// Récupération de la periode précédente et suivante
$unit = $period;
if ($period == "weekly") {
    $unit = "week";
}
if ($period == "month") {
    $ndate = CMbDT::date("first day of next month", $date);
    $pdate = CMbDT::date("last day of previous month", $date);
} else {
    $ndate = CMbDT::date("+1 {$unit}", $date);
    $pdate = CMbDT::date("-1 {$unit}", $date);
コード例 #16
0
if (!$resolve) {
    CMbObject::massLoadFwdRef($consultations, "plageconsult_id");
}
foreach ($consultations as $consult) {
    $consult->loadRefPlageConsult();
    if (!$resolve) {
        $consult->loadRefPatient();
    }
}
if ($resolve) {
    foreach ($consultations as $consult) {
        $where = array();
        $where["chir_id"] = " = '" . $consult->_ref_plageconsult->chir_id . "'";
        $where["date"] = " = '" . $consult->_ref_plageconsult->date . "'";
        $where[] = " '{$consult->heure}' BETWEEN debut AND fin";
        $plage = new CPlageconsult();
        if ($plage->loadObject($where)) {
            $consult->plageconsult_id = $plage->_id;
            if ($msg = $consult->store()) {
                mbLog($msg);
            }
        }
    }
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("nb_consult", $nb_consult);
$smarty->assign("consultations", $consultations);
$smarty->assign("resolve", $resolve);
$smarty->assign("limit", $limit);
$smarty->display("vw_move_consult_plage.tpl");
コード例 #17
0
ファイル: export_ical.php プロジェクト: fbone/mediboard4
$prat_id = CValue::get("prat_id");
$details = CValue::get("details");
$export = CValue::get("export");
$weeks_before = CValue::get("weeks_before");
$weeks_after = CValue::get("weeks_after");
$date = CValue::get("date", CMbDT::date());
$debut = CMbDT::date("-{$weeks_before} week", $date);
$debut = CMbDT::date("last sunday", $debut);
$fin = CMbDT::date("+{$weeks_after} week", $date);
$fin = CMbDT::date("next sunday", $fin);
// Liste des Salles
$salle = new CSalle();
/** @var CSalle[] $listSalles */
$listSalles = $salle->loadGroupList();
// 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) {
コード例 #18
0
 *
 * @package    Mediboard
 * @subpackage dPcabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 20068 $
 */
// Filtre des plages
$chir_id = $_POST['_old_chir_id'];
$where["chir_id"] = "= '{$chir_id}'";
if ($date_min = CValue::post("_date_min")) {
    $where[] = "date >= '{$date_min}'";
}
if ($date_max = CValue::post("_date_max")) {
    $where[] = "date <= '{$date_max}'";
}
// Chargement des plages
$plage = new CPlageconsult();
$plages = $plage->loadList($where);
foreach ($plages as $_plage) {
    $_POST["plageconsult_id"] = $_plage->_id;
    // Calcul de collisions
    $_POST["date"] = $_plage->date;
    // Do it !
    $do = new CDoObjectAddEdit("CPlageconsult", "plageconsult_id");
    $do->redirect = null;
    $do->doIt();
}
// Redirection finale
$do->redirect = "m={$m}&a=transfert_plageconsult&dialog=1";
$do->doRedirect();
コード例 #19
0
<?php

/**
 * $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();
// 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");
コード例 #20
0
$user->load($chirSel);
if ($user->_id) {
    $user->loadRefFunction();
    $planning->title = CMbString::htmlEntities($user->_view);
} else {
    $planning->title = "";
}
$can_edit = CCanDo::edit();
$planning->guid = $user->_guid;
$planning->hour_min = "07";
$planning->hour_max = "20";
$planning->pauses = array("07", "12", "19");
$planning->dragndrop = $planning->resizable = $can_edit ? 1 : 0;
$planning->hour_divider = 60 / CAppUI::conf("dPcabinet CPlageconsult minutes_interval");
$planning->no_dates = 0;
$plage = new CPlageconsult();
$whereHP["plageop_id"] = " IS NULL";
$users = array();
$conges_day = array();
if ($user->_id) {
    $muser = new CMediusers();
    $users = $muser->loadUsers(PERM_READ, $user->function_id);
}
for ($i = 0; $i < $nbDays; $i++) {
    $jour = CMbDT::date("+{$i} day", $debut);
    $is_holiday = array_key_exists($jour, $bank_holidays);
    $planning->addDayLabel($jour, '<span style="font-size: 1.4em">' . CMbDT::format($jour, "%a %d %b") . '</span>');
    // conges dans le header
    if (count($users)) {
        if (CModule::getActive("dPpersonnel")) {
            $_conges = CPlageConge::loadForIdsForDate(array_keys($users), $jour);
コード例 #21
0
 */
global $date, $chir_id, $print;
$print = 1;
$function_id = CValue::get("function_id");
$date = CValue::get("date");
$start = CMbDT::date("this monday", $date);
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();
コード例 #22
0
 static function makeConsult($patient_id, $chir_id, $date, $store = true, $time = null)
 {
     $consult = new CConsultation();
     $date = CMbDT::date($date);
     $plage = new CPlageconsult();
     $where = array("plageconsult.chir_id" => "= '{$chir_id}'", "plageconsult.date" => "= '{$date}'");
     $plage->loadObject($where);
     if (!$plage->_id) {
         $plage->date = $date;
         $plage->chir_id = $chir_id;
         $plage->debut = "09:00:00";
         $plage->fin = "19:00:00";
         $plage->freq = "00:30:00";
         $plage->libelle = "Importation";
         if ($msg = $plage->store()) {
             return $msg;
         }
     }
     $consult->patient_id = $patient_id;
     $consult->plageconsult_id = $plage->_id;
     $consult->heure = $time ? $time : "09:00:00";
     $consult->chrono = $date < CMbDT::date() ? CConsultation::TERMINE : CConsultation::PLANIFIE;
     if ($store) {
         if ($msg = $consult->store()) {
             return $msg;
         }
         if (!$consult->_id) {
             CAppUI::setMsg("Consultation non trouvée et non importée : {$patient_id} / {$chir_id} / {$date}", UI_MSG_WARNING);
             return false;
         }
     }
     return $consult;
 }
コード例 #23
0
ファイル: edit_planning.php プロジェクト: fbone/mediboard4
    if (!$consult->grossesse_id && $grossesse_id) {
        $consult->grossesse_id = $grossesse_id;
    }
    if (CModule::getActive("maternite")) {
        $grossesse = $consult->loadRefGrossesse();
        if (!$consult->patient_id) {
            $consult->patient_id = $grossesse->parturiente_id;
        }
    }
    if ($line_element_id) {
        // RDV issu d'une ligne d'élément
        $consult->sejour_id = $sejour_id;
        $line = new CPrescriptionLineElement();
        $line->load($line_element_id);
        $func_categ = reset($line->_ref_element_prescription->_ref_category_prescription->loadBackRefs("functions_category", null, "1"));
        $plageconsult = new CPlageconsult();
        $where = $ljoin = array();
        $where["pour_tiers"] = "= '1'";
        $where["date"] = "BETWEEN '" . CMbDT::date() . "' AND '" . CMbDT::date("+3 month") . "'";
        if ($func_categ) {
            $_function_id = $func_categ->function_id;
            $where["users_mediboard.function_id"] = "= '{$_function_id}'";
            $ljoin["users_mediboard"] = "users_mediboard.user_id = plageconsult.chir_id";
        }
        $nb_plages = $plageconsult->countList($where, null, $ljoin);
    }
} else {
    // Consultation existante
    $consult->load($consultation_id);
    $canConsult = $consult->canDo();
    $canConsult->needsRead("consultation_id");
コード例 #24
0
 function getPreviousPlage()
 {
     $plage = new CPlageconsult();
     if (!$this->_id) {
         return $plage;
     }
     $where = array();
     $where[] = " chir_id = '{$this->chir_id}' OR remplacant_id = '{$this->remplacant_id}'";
     $where["locked"] = " != '1' ";
     $where["date"] = "< '{$this->date}' ";
     $where["plageconsult_id"] = " != '{$this->plageconsult_id}' ";
     $plage->loadObject($where, "date DESC, debut DESC");
     return $plage;
 }
コード例 #25
0
 */
$prat_id = CValue::post("prat_id");
$consult = new CConsultation();
$consult->load(CValue::post("consultation_id"));
$consult->loadRefPlageConsult();
$_datetime = $consult->_datetime;
if (!isset($current_m)) {
    $current_m = CValue::post("current_m", "dPcabinet");
}
$day_now = CMbDT::format($_datetime, "%Y-%m-%d");
$time_now = CMbDT::format($_datetime, "%H:%M:00");
$hour_now = CMbDT::format($_datetime, "%H:00:00");
$hour_next = CMbDT::time("+1 HOUR", $hour_now);
$plage = new CPlageconsult();
$plageBefore = new CPlageconsult();
$plageAfter = new CPlageconsult();
// Cas ou une plage correspond
$where = array();
$where["chir_id"] = "= '{$prat_id}'";
$where["date"] = "= '{$day_now}'";
$where["debut"] = "<= '{$time_now}'";
$where["fin"] = "> '{$time_now}'";
$plage->loadObject($where);
if (!$plage->_id) {
    // Cas ou on a des plage en collision
    $where = array();
    $where["chir_id"] = "= '{$prat_id}'";
    $where["date"] = "= '{$day_now}'";
    $where["debut"] = "<= '{$hour_now}'";
    $where["fin"] = ">= '{$hour_now}'";
    $plageBefore->loadObject($where);
コード例 #26
0
 /**
  * Crée une consultation à une horaire arbitraire et créé les plages correspondantes au besoin
  *
  * @param string $datetime     Date et heure
  * @param ref    $praticien_id Praticien
  * @param ref    $patient_id   Patient
  *
  * @return null|string Store-like message
  */
 function createByDatetime($datetime, $praticien_id, $patient_id)
 {
     $day_now = CMbDT::format($datetime, "%Y-%m-%d");
     $time_now = CMbDT::format($datetime, "%H:%M:00");
     $hour_now = CMbDT::format($datetime, "%H:00:00");
     $hour_next = CMbDT::time("+1 HOUR", $hour_now);
     $plage = new CPlageconsult();
     $plageBefore = new CPlageconsult();
     $plageAfter = new CPlageconsult();
     // Cas ou une plage correspond
     $where = array();
     $where["chir_id"] = "= '{$praticien_id}'";
     $where["date"] = "= '{$day_now}'";
     $where["debut"] = "<= '{$time_now}'";
     $where["fin"] = "> '{$time_now}'";
     $plage->loadObject($where);
     if (!$plage->plageconsult_id) {
         // Cas ou on a des plage en collision
         $where = array();
         $where["chir_id"] = "= '{$praticien_id}'";
         $where["date"] = "= '{$day_now}'";
         $where["debut"] = "<= '{$hour_now}'";
         $where["fin"] = ">= '{$hour_now}'";
         $plageBefore->loadObject($where);
         $where["debut"] = "<= '{$hour_next}'";
         $where["fin"] = ">= '{$hour_next}'";
         $plageAfter->loadObject($where);
         if ($plageBefore->_id) {
             $plageBefore->fin = $plageAfter->_id ? $plageAfter->debut : max($plageBefore->fin, $hour_next);
             $plage = $plageBefore;
         } elseif ($plageAfter->_id) {
             $plageAfter->debut = min($plageAfter->debut, $hour_now);
             $plage = $plageAfter;
         } else {
             $plage->chir_id = $praticien_id;
             $plage->date = $day_now;
             $plage->freq = "00:" . CPlageconsult::$minutes_interval . ":00";
             $plage->debut = $hour_now;
             $plage->fin = $hour_next;
         }
         $plage->updateFormFields();
         if ($msg = $plage->store()) {
             return $msg;
         }
     }
     $this->plageconsult_id = $plage->_id;
     $this->patient_id = $patient_id;
     // Chargement de la consult avec la plageconsult && le patient
     $this->loadMatchingObject();
     if (!$this->_id) {
         $this->heure = $time_now;
         $this->arrivee = "{$day_now} {$time_now}";
         $this->duree = 1;
         $this->chrono = CConsultation::PLANIFIE;
     }
     return $this->store();
 }
コード例 #27
0
// Période
$filter = new CPlageconsult();
$filter->_date_min = CValue::getOrSession("_date_min");
$filter->_date_max = CValue::getOrSession("_date_max");
// Tri sur les praticiens
$mediuser = CMediusers::get();
$mediuser->loadRefFunction();
$prat = new CMediusers();
$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;
コード例 #28
0
ファイル: vw_planning.php プロジェクト: fbone/mediboard4
}
if (!$plageSel->plageconsult_id) {
    $plageSel->load($plageconsult_id);
} else {
    $plageconsult_id = $plageSel->plageconsult_id;
}
if ($plageSel->chir_id != $chirSel && $plageSel->remplacant_id != $chirSel) {
    $plageconsult_id = null;
    $plageSel = new CPlageconsult();
}
CValue::setSession("plageconsult_id", $plageconsult_id);
// Liste des consultations a avancer si desistement
$count_si_desistement = CConsultation::countDesistementsForDay(array($chirSel));
$nbjours = 7;
$dateArr = CMbDT::date("+6 day", $debut);
$plage = new CPlageconsult();
//where interv/hp
$whereInterv = array();
$whereHP = array();
$where = array();
$where["date"] = "= '{$dateArr}'";
$where["chir_id"] = " = '{$chirSel}'";
$whereInterv["chir_id"] = $whereHP["chir_id"] = " = '{$chirSel}'";
$whereInterv["date"] = $whereHP["date"] = "= '{$dateArr}'";
if (!$plage->countList($where)) {
    $nbjours--;
    // Aucune plage le dimanche, on peut donc tester le samedi.
    $dateArr = CMbDT::date("+5 day", $debut);
    $where["date"] = "= '{$dateArr}'";
    if (!$plage->countList($where)) {
        $nbjours--;
コード例 #29
0
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkRead();
$ds = CSQLDataSource::get("std");
// Initialisation des variables
$plageconsult_id = CValue::get("plageconsult_id");
$consult_id = CValue::get("consult_id");
$slot_id = CValue::get("slot_id");
$heure = CValue::get("heure");
$multiple = CValue::get("multipleMode", false);
$display_nb_consult = CAppUI::conf("dPcabinet display_nb_consult");
$quotas = null;
// Récupération des consultations de la plage séléctionnée
$plage = new CPlageconsult();
if ($plageconsult_id) {
    $plage->load($plageconsult_id);
    $plage->loadRefsNotes();
    $date = $plage->date;
} else {
    $date = CValue::get("date", CMbDT::date());
}
// consultation précise
$consultation_target = new CConsultation();
if ($consult_id) {
    $consultation_target->load($consult_id);
} elseif ($heure) {
    $consultation_target->heure = $heure;
}
$consultation_target->loadRefElementPrescription();
コード例 #30
0
ファイル: do_clean_plages.php プロジェクト: fbone/mediboard4
<?php

/**
 * $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);