示例#1
0
$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();
    $class = null;
    if ($_consult->pour_tiers) {
        $class = "pour_tiers";
    }
    if (CModule::getActive("3333tel")) {
        C3333TelTools::checkPlagesConsult($_consult, $_consult->_ref_chir->function_id);
    }
    ajoutEvent($planning, $_consult, $_consult->date, $_consult->libelle, $color, "consultation", $class);
}
// plages op
$plagesOp = $plageOp->loadForDays($chirSel, $debut, CMbDT::date("+7 day", $debut));
foreach ($plagesOp as $_op) {
    $_op->loadRefSalle();
    $_op->multicountOperations();
    $color = "#BCE";
    //to check if group is present group
    $g = CGroups::loadCurrent();
    $_op->loadRefSalle();
    $_op->_ref_salle->loadRefBloc();
    if ($_op->_ref_salle->_ref_bloc->group_id != $g->_id) {
        $color = "#748dee";
$consults = $plageSel->_ref_consultations;
CStoredObject::massLoadFwdRef($consults, "sejour_id");
$patients = CMbObject::massLoadFwdRef($consults, "patient_id");
CStoredObject::massCountBackRefs($patients, "notes");
CStoredObject::massLoadFwdRef($consults, "categorie_id");
// Détails sur les consultation affichées
foreach ($plageSel->_ref_consultations as $keyConsult => &$consultation) {
    $consultation->_ref_plageconsult = $plageSel;
    $consultation->loadRefSejour();
    $consultation->loadRefPatient()->loadRefsNotes();
    $consultation->loadRefCategorie();
    $consultation->countDocItems();
    $consultation->_view = "Consult. de " . $consultation->_ref_patient->_view;
    $consultation->_view .= " (" . CMbDT::format($plageSel->date, "%d/%m/%Y") . ")";
    //check 3333tel
    if (CModule::getActive("3333tel")) {
        C3333TelTools::checkConsults($consultation, $plageSel->_ref_chir->function_id);
    }
}
if ($plageSel->chir_id != $chirSel && $plageSel->remplacant_id != $chirSel && $plageSel->pour_compte_id != $chirSel) {
    $plageconsult_id = null;
    $plageSel = new CPlageconsult();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("plageSel", $plageSel);
$smarty->assign("chirSel", $chirSel);
$smarty->assign("show_payees", $show_payees);
$smarty->assign("show_annulees", $show_annulees);
$smarty->assign("mediuser", $mediuser);
$smarty->display("inc_consultations.tpl");
if ($plageconsult_id === null && $chirSel && $is_in_period) {
    $nowTime = CMbDT::time();
    $where = array("chir_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->loadRefsFwd(1);
$plageSel->loadRefsNotes();
$plageSel->loadRefsBack();
//check 3333tel
if (CModule::getActive("3333tel")) {
    C3333TelTools::checkPlagesConsult($plageSel, $plageSel->_ref_chir->function_id);
}
$pause = new CConsultation();
//find the unique pause;
if ($plageSel->_id) {
    $where_p = array();
    $where_p["plageconsult_id"] = " = '{$plageSel->_id}' ";
    $where_p["patient_id"] = " IS NULL";
    $list = $pause->loadList($where_p);
    if (count($list) == 1) {
        /** @var CConsultation $pause */
        $pause = reset($list);
        $plageSel->_pause = $pause->heure;
        $plageSel->_pause_id = $pause->_id;
        $plageSel->_pause_repeat_time = $pause->duree;
    }