$patient_id = CValue::get("patient_id");
// Création du patient
$patient = new CPatient();
$patient->load($patient_id);
$patient->updateNomPaysInsee();
$patient->loadRefsSejours();
foreach ($patient->_ref_sejours as $sejour) {
    $sejour->loadRefPraticien();
    $sejour->loadRefsOperations();
    $sejour->loadNDA();
    foreach ($sejour->_ref_operations as $operation) {
        $operation->loadRefPlageOp();
        $operation->loadRefChir();
    }
}
$patient->loadRefsConsultations();
foreach ($patient->_ref_consultations as $consultation) {
    $consultation->loadRefPlageConsult();
}
$patient->loadRefsCorrespondants();
$patient->loadRefsCorrespondantsPatient();
$patient->loadIPP();
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("patient", $patient);
$smarty->assign("today", $today);
if (CAppUI::conf('dPpatients CPatient extended_print')) {
    $smarty->display("print_patient_extended.tpl");
} else {
    $smarty->display("print_patient.tpl");
}
CCanDo::checkRead();
$patient_id = CValue::get("patient_id");
$patient = new CPatient();
$patient->load($patient_id);
$listPrat = CConsultation::loadPraticiens(PERM_EDIT, null, null, null, false);
$patient->loadRefsDocItems();
foreach ($patient->_ref_files_by_cat as $cat => $files_by_cat) {
    foreach ($files_by_cat as $key => $_file) {
        if ($_file->annule) {
            unset($patient->_ref_files_by_cat[$cat][$key]);
        }
    }
}
$where = array();
$where["plageconsult.chir_id"] = CSQLDataSource::prepareIn(array_keys($listPrat));
$patient->loadRefsConsultations($where);
$patient->loadRefsSejours();
$dossier_medical = $patient->loadRefDossierMedical();
$dossier_medical->loadRefsAntecedents();
$dossier_medical->loadRefsTraitements();
$prescription = $dossier_medical->loadRefPrescription();
if ($prescription && is_array($prescription->_ref_prescription_lines)) {
    foreach ($dossier_medical->_ref_prescription->_ref_prescription_lines as $_line) {
        $_line->loadRefsPrises();
    }
}
$consultations =& $patient->_ref_consultations;
$sejours =& $patient->_ref_sejours;
// Consultations
foreach ($consultations as $consultation) {
    $consultation->loadRefsDocItems(false);
<?php

/**
 * $Id$
 *  
 * @category ${Module}
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 * @link     http://www.mediboard.org */
CCanDo::checkRead();
$patient_id = CValue::get("patient_id");
$consult_anesth_id = CValue::get("consult_anesth_id");
$patient = new CPatient();
$patient->load($patient_id);
$dossiers_anesth = array();
foreach ($patient->loadRefsConsultations() as $_consult) {
    foreach ($_consult->loadRefsDossiersAnesth() as $_dossier) {
        if ($_dossier->_id != $consult_anesth_id) {
            $_dossier->_ref_consultation = $_consult;
            $_consult->loadRefPraticien()->loadRefFunction();
            $_consult->loadRefPlageConsult(true);
            $dossiers_anesth[] = $_dossier;
        }
    }
}
$smarty = new CSmartyDP();
$smarty->assign("dossiers_anesth", $dossiers_anesth);
$smarty->assign("patient", $patient);
$smarty->display("inc_consult_anesth/vw_old_consult_anesth.tpl");
$patient = new CPatient();
$patient->load($patient_id);
$where = array("group_id" => "= '" . CGroups::loadCurrent()->_id . "'", "annule" => "= '0'");
//sejours & opé
foreach ($patient->loadRefsSejours($where) as $_sejour) {
    foreach ($_sejour->loadRefsConsultations() as $_consult) {
        $_consult->getType();
        $_consult->loadRefPlageConsult();
        $_consult->loadRefPraticien()->loadRefFunction();
    }
    foreach ($_sejour->loadRefsOperations(array("annulee" => "= '0'")) as $_operation) {
        $_operation->loadRefsFwd();
    }
}
//consultations
foreach ($patient->loadRefsConsultations(array("annule" => "= '0'")) as $_consult) {
    if ($_consult->sejour_id) {
        unset($patient->_ref_consultations[$_consult->_id]);
        continue;
    }
    $function = $_consult->loadRefPraticien()->loadRefFunction();
    if ($function->group_id != CGroups::loadCurrent()->_id) {
        unset($patient->_ref_consultations[$_consult->_id]);
        continue;
    }
    $_consult->getType();
    $_consult->loadRefPlageConsult();
    // Facture de consultation
    $facture = $_consult->loadRefFacture();
    if ($facture->_id) {
        $facture->loadRefsNotes();