$consult = new CConsultation(); $consult->load($consult_id); $consult->loadRefPlageConsult(); $sejour = $consult->loadRefSejour(); $rpu = $sejour->loadRefRPU(); $services = array(); $list_mode_sortie = null; 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();
{ $ccmu1 = CValue::first($sejour1->_ref_rpu->ccmu, "9"); $ccmu2 = CValue::first($sejour2->_ref_rpu->ccmu, "9"); if ($ccmu1 == "P") { $ccmu1 = "1"; } if ($ccmu2 == "P") { $ccmu2 = "1"; } return $ccmu2 - $ccmu1; } uasort($listSejours, "ccmu_cmp"); } // Chargement des boxes d'urgences $boxes = array(); foreach (CService::loadServicesUrgence() as $service) { foreach ($service->_ref_chambres as $chambre) { 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; } } } }
$sejour->_ref_grossesse = $patient->loadLastGrossesse(); $patient->loadLastAllaitement(); } else { $rpu->_responsable_id = $user->_id; $rpu->_entree = CMbDT::dateTime(); $sejour = new CSejour(); $patient = new CPatient(); $praticien = new CMediusers(); } // Contraintes sur le mode d'entree / provenance $contrainteProvenance[6] = array("", 1, 2, 3, 4); $contrainteProvenance[7] = array("", 1, 2, 3, 4); $contrainteProvenance[8] = array("", 5, 8); // Chargement des boxes $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;
// Contraintes sur le mode de sortie / orientation $contrainteOrientation["transfert"] = array("", "HDT", "HO", "SC", "SI", "REA", "UHCD", "MED", "CHIR", "OBST"); $contrainteOrientation["normal"] = array("", "FUGUE", "SCAM", "PSA", "REO"); // Praticiens urgentistes $group = CGroups::loadCurrent(); $listPrats = CAppUI::$user->loadPraticiens(PERM_READ, $group->service_urgences_id); // Si accès au module PMSI : peut modifier le diagnostic principal $access_pmsi = 0; if (CModule::exists("dPpmsi")) { $module = new CModule(); $module->mod_name = "dPpmsi"; $module->loadMatchingObject(); $access_pmsi = $module->getPerm(PERM_EDIT); } // Si praticien : peut modifier le CCMU, GEMSA et diagnostic principal $is_praticien = CMediusers::get()->isPraticien(); // Création du template $smarty = new CSmartyDP(); $smarty->assign("contrainteDestination", $contrainteDestination); $smarty->assign("contrainteOrientation", $contrainteOrientation); $smarty->assign("services_urg", CService::loadServicesUrgence()); $smarty->assign("services", $services); $smarty->assign("service_id", $service_id); $smarty->assign("listSejours", $listSejours); $smarty->assign("view_sortie", $view_sortie); $smarty->assign("listPrats", $listPrats); $smarty->assign("date", $date); $smarty->assign("access_pmsi", $access_pmsi); $smarty->assign("is_praticien", $is_praticien); $smarty->assign("today", CMbDT::date()); $smarty->display("vw_sortie_rpu.tpl");