Beispiel #1
0
if ($rpu && $rpu->_id) {
    // Mise en session du rpu_id
    $_SESSION["dPurgences"]["rpu_id"] = $rpu->_id;
    $rpu->loadRefSejourMutation();
    $affectation = $sejour->loadRefCurrAffectation();
    $affectation->loadRefService();
    // Urgences pour un séjour "urg"
    if ($sejour->type == "urg") {
        $services = CService::loadServicesUrgence();
    }
    // UHCD pour un séjour "comp" et en UHCD
    if ($sejour->type == "comp" && $sejour->UHCD) {
        $services = CService::loadServicesUHCD();
    }
    if ($affectation->_ref_service && $affectation->_ref_service->radiologie == "1") {
        $services = CService::loadServicesImagerie();
    }
    if (CAppUI::conf("dPplanningOp CSejour use_custom_mode_sortie")) {
        $mode_sortie = new CModeSortieSejour();
        $where = array("actif" => "= '1'");
        $list_mode_sortie = $mode_sortie->loadGroupList($where);
    }
}
$where = array();
$where["entree"] = "<= '" . CMbDT::dateTime() . "'";
$where["sortie"] = ">= '" . CMbDT::dateTime() . "'";
$where["function_id"] = "IS NOT NULL";
$affectation = new CAffectation();
/** @var CAffectation[] $blocages_lit */
$blocages_lit = $affectation->loadList($where);
$where["function_id"] = "IS NULL";
$services = array();
$services_type = array("Urgences" => CService::loadServicesUrgence(), "UHCD" => CService::loadServicesUHCD());
if (CAppUI::conf("dPurgences view_rpu_uhcd")) {
    // Affichage des services UHCD et d'urgence
    $services = CService::loadServicesUHCDRPU();
} elseif ($sejour->type == "comp" && $sejour->UHCD) {
    // UHCD pour un séjour "comp" et en UHCD
    $services = $services_type["UHCD"];
    unset($services_type["Urgences"]);
} else {
    // Urgences pour un séjour "urg"
    $services = $services_type["Urgences"];
    unset($services_type["UHCD"]);
}
if ($imagerie_etendue) {
    $service_imagerie = CService::loadServicesImagerie();
    $services_type["Imagerie"] = $service_imagerie;
    $services = array_merge($services, $services_type["Imagerie"]);
}
$module_orumip = CModule::getActive("orumip");
$orumip_active = $module_orumip && $module_orumip->mod_active;
$nb_printers = 0;
if (CModule::getActive("printing")) {
    // Chargement des imprimantes pour l'impression d'étiquettes
    $user_printers = CMediusers::get();
    $function = $user_printers->loadRefFunction();
    $nb_printers = $function->countBackRefs("printers");
}
$list_mode_entree = array();
if (CAppUI::conf("dPplanningOp CSejour use_custom_mode_entree")) {
    $mode_entree = new CModeEntreeSejour();
// Chargement du sejour
if ($sejour && $sejour->_id) {
    $sejour->loadExtDiagnostics();
    $sejour->loadRefDossierMedical();
    $sejour->loadNDA();
    // Cas des urgences
    $rpu = $sejour->loadRefRPU();
    if ($rpu && $rpu->_id) {
        $rpu->loadRefSejourMutation();
        $sejour->loadRefCurrAffectation()->loadRefService();
        // Urgences pour un séjour "urg"
        if ($sejour->type == "urg") {
            $services = CService::loadServicesUrgence();
        }
        if ($sejour->_ref_curr_affectation->_ref_service->radiologie == "1") {
            $services = array_merge($services, CService::loadServicesImagerie());
        }
        // UHCD pour un séjour "comp" et en UHCD
        if ($sejour->type == "comp" && $sejour->UHCD) {
            $services = CService::loadServicesUHCD();
        }
        if (CAppUI::conf("dPplanningOp CSejour use_custom_mode_sortie")) {
            $mode_sortie = new CModeSortieSejour();
            $where = array("actif" => "= '1'");
            $list_mode_sortie = $mode_sortie->loadGroupList($where);
        }
    }
}
$smarty = new CSmartyDP();
$smarty->assign("listAnesths", $listAnesths);
$smarty->assign("listChirs", $listChirs);
        foreach ($chambre->_ref_lits as $lit) {
            $boxes[$lit->_id] = $lit;
        }
    }
}
if (CAppUI::conf("dPurgences view_rpu_uhcd")) {
    foreach (CService::loadServicesUHCD() as $service) {
        foreach ($service->_ref_chambres as $chambre) {
            foreach ($chambre->_ref_lits as $lit) {
                $boxes[$lit->_id] = $lit;
            }
        }
    }
}
if (CAppUI::conf("dPurgences CRPU imagerie_etendue", $group)) {
    foreach (CService::loadServicesImagerie() as $_service) {
        foreach ($_service->_ref_chambres as $_chambre) {
            foreach ($_chambre->_ref_lits as $_lit) {
                $boxes[$_lit->_id] = $_lit;
            }
        }
    }
}
// Si admin sur le module urgences, alors modification autorisée du diagnostic
// infirmier depuis la main courante.
$module = new CModule();
$module->mod_name = "dPurgences";
$module->loadMatchingObject();
$admin_urgences = $module->canAdmin();
// Création du template
$smarty = new CSmartyDP();