Exemple #1
0
 $listOp = $op->loadList($where, $order, null, null, $ljoin);
 $chirs = CStoredObject::massLoadFwdRef($listOp, "chir_id");
 $sejours = CStoredObject::massLoadFwdRef($listOp, "sejour_id");
 CStoredObject::massLoadFwdRef($sejours, "patient_id");
 foreach ($listOp as $key => $operation) {
     $operation->loadRefPlageOp();
     if ($operation->_datetime_best < $filter->_datetime_min || $operation->_datetime_best > $filter->_datetime_max) {
         unset($listOp[$key]);
         continue;
     }
     $operation->loadRefsConsultAnesth();
     if ($no_consult_anesth && $operation->_ref_consult_anesth->_id) {
         unset($listOp[$operation->_id]);
     }
     $operation->loadRefPraticien();
     $operation->loadExtCodesCCAM();
     $operation->updateHeureUS();
     $operation->updateSalle();
     $operation->loadAffectationsPersonnel();
     $operation->loadRefCommande();
     $sejour = $operation->loadRefSejour();
     $sejour->loadRefsFwd();
     if ($_print_ipp) {
         $sejour->_ref_patient->loadIPP();
     }
     if ($_print_numdoss) {
         $sejour->loadNDA();
     }
     if ($prestation_id) {
         $sejour->loadLiaisonsForPrestation($prestation_id);
     }
CCanDo::checkRead();
$chir_id = CValue::get("chir_id");
$plageop = new CPlageOp();
$plageop->load(CValue::get("plageop_id"));
$plageop->loadRefSalle();
$where = array("chir_id" => "= '{$chir_id}'");
$plageop->loadRefsOperations(false, null, true, null, $where);
$plageop->guessHoraireVoulu();
$rank_validated = array();
$rank_not_validated = array();
$_op = new COperation();
$_last_op = null;
foreach ($plageop->_ref_operations as $_op) {
    $_op->loadRefChir()->loadRefFunction();
    $_op->loadRefSejour()->loadRefPatient()->loadRefDossierMedical()->countAllergies();
    $_op->loadExtCodesCCAM();
    if ($_op->_horaire_voulu) {
        $_last_op = $_op;
    }
}
$horaire_voulu = $plageop->debut;
if ($_last_op) {
    $horaire_voulu = $_last_op->_horaire_voulu;
    $horaire_voulu = CMbDT::addTime($_last_op->temp_operation, $horaire_voulu);
    $horaire_voulu = CMbDT::addTime($plageop->temps_inter_op, $horaire_voulu);
    $horaire_voulu = CMbDT::addTime($_last_op->pause, $horaire_voulu);
}
$new_op = new COperation();
$new_op->_horaire_voulu = $horaire_voulu;
$plageop->_ref_operations[] = $new_op;
// Création du template