Example #1
0
$group_id = CValue::getOrSession("group_id");
// Fiche établissement
$etab = new CGroups();
$etab->load($group_id);
// Services d'hospitalisation
$service = new CService();
$service->group_id = $etab->_id;
$service->cancelled = 0;
$service->externe = 0;
/** @var CService[] $services */
$services = $service->loadMatchingList("nom");
foreach ($services as $_service) {
    $_service->loadRefsChambres(false);
    foreach ($_service->_ref_chambres as $_chambre) {
        $_chambre->loadRefsLits(false);
    }
}
// Blocs opératoires
$bloc = new CBlocOperatoire();
$bloc->group_id = $etab->_id;
/** @var CBlocOperatoire[] $blocs */
$blocs = $bloc->loadMatchingList("nom");
foreach ($blocs as $_bloc) {
    $_bloc->loadRefsSalles();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("etab", $etab);
$smarty->assign("services", $services);
$smarty->assign("blocs", $blocs);
$smarty->display("vw_structure.tpl");
$where = array();
$where["sejour.grossesse_id"] = " IS NOT NULL";
$where["sejour.group_id"] = " = '{$group->_id}' ";
$where[] = " date BETWEEN '{$date_min}' AND '{$date}' ";
// accouchement non terminé = datetime_accouche IS NULL
// ne pas voir les terminés
if (!$see_finished) {
    //$where["grossesse.datetime_accouchement"] = " IS NULL";
    $where["grossesse.active"] = " = '1'";
}
//blocs
$bloc = new CBlocOperatoire();
$bloc->type = "obst";
$bloc->group_id = $group->_id;
/** @var CBlocOperatoire[] $blocs */
$blocs = $bloc->loadMatchingList();
$salles = array();
foreach ($blocs as $_bloc) {
    $salles = $_bloc->loadRefsSalles();
    foreach ($salles as $_salle) {
        $salles[$_salle->_id] = $_salle->_id;
    }
}
// anesth
$anesth = new CMediusers();
$anesths = $anesth->loadListFromType(array("Anesthésiste"), PERM_READ);
/** @var COperation[] $ops */
$ops = $op->loadList($where, "date DESC, time_operation", null, null, $ljoin);
CMbObject::massLoadFwdRef($ops, "sejour_id");
CMbObject::massLoadFwdRef($ops, "anesth_id");
$chirs = CMbObject::massLoadFwdRef($ops, "chir_id");