} $consultation_target->loadRefElementPrescription(); // Chargement des places disponibles $listPlace = array(); $listBefore = array(); $listAfter = array(); $next_plage = $previous_plage = new CPlageconsult(); $function_id = null; if ($plageconsult_id) { if (!$plage->plageconsult_id) { $plage->load($plageconsult_id); } $plage->loadRefsFwd(true); $function_id = $plage->_ref_chir->function_id; $plage->loadRefsConsultations(false, true, true); $plage->loadFillRate(); $plage->_ref_chir->loadRefFunction(); for ($i = 0; $i < $plage->_total; $i++) { $minutes = $plage->_freq * $i; $listPlace[$i]["time"] = CMbDT::time("+ {$minutes} minutes", $plage->debut); $listPlace[$i]["consultations"] = array(); } foreach ($plage->_ref_consultations as $keyConsult => $valConsult) { $consultation =& $plage->_ref_consultations[$keyConsult]; $consultation->loadRefPatient(); // Chargement de la categorie $consultation->loadRefCategorie(); $keyPlace = CMbDT::timeCountIntervals($plage->debut, $consultation->heure, $plage->freq); if ($keyPlace < 0) { $listBefore[$keyPlace] =& $consultation; }
$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}'"; $where["date"] = "= '{$date}'"; $where["salle_id"] = CSQLDataSource::prepareIn(array_keys($listSalles)); $plagesPerDayOp = $plageOp->loadList($where); $salles = CMbObject::massLoadFwdRef($plagesPerDayOp, "salle_id"); CMbObject::massLoadFwdRef($salles, "bloc_id"); CMbObject::massLoadBackRefs($plagesPerDayOp, "operations");