CCanDo::checkRead();
} else {
    CCanDo::checkEdit();
}
// L'utilisateur est-il chirurgien?
$chir_id = CValue::getOrSession("chir_id");
$mediuser = CMediusers::get($chir_id);
if (!$mediuser->isPraticien()) {
    $mediuser = new CMediusers();
}
$function_id = CValue::getOrSession("function_id");
$type = CValue::getOrSession("type", "interv");
$page = CValue::get("page");
$sejour_type = CValue::get("sejour_type");
$step = 30;
$protocole = new CProtocole();
$where = array();
$chir = new CMediusers();
$chir->load($chir_id);
if ($chir->_id) {
    $chir->loadRefFunction();
    $functions = array($chir->function_id);
    $chir->loadBackRefs("secondary_functions");
    foreach ($chir->_back["secondary_functions"] as $curr_sec_func) {
        $functions[] = $curr_sec_func->function_id;
    }
    $list_functions = implode(",", $functions);
    $where[] = "protocole.chir_id = '{$chir->_id}' OR protocole.function_id IN ({$list_functions})";
} else {
    $where["function_id"] = " = '{$function_id}'";
}
 *
 * @package    Mediboard
 * @subpackage PlanningOp
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$field = CValue::get('field');
$view_field = CValue::get('view_field', $field);
$input_field = CValue::get('input_field', $view_field);
$keywords = CValue::get($input_field);
$limit = CValue::get('limit', 30);
$chir_id = CValue::get('chir_id');
$function_id = CValue::get('function_id');
$for_sejour = CValue::get('for_sejour');
$object = new CProtocole();
$ds = $object->_spec->ds;
$where = array();
if ($chir_id) {
    $chir = new CMediusers();
    $chir->load($chir_id);
    $chir->loadRefFunction();
    $functions_ids = array($chir->function_id);
    $chir->loadBackRefs("secondary_functions");
    if (count($chir->_back["secondary_functions"])) {
        $functions_ids = array_merge($functions_ids, CMbArray::pluck($chir->_back["secondary_functions"], "function_id"));
    }
    $where[] = "(protocole.chir_id = '{$chir->_id}' OR protocole.function_id " . CSQLDataSource::prepareIn($functions_ids) . ")";
} elseif ($function_id) {
    $where["protocole.function_id"] = "= '{$function_id}'";
} else {
Esempio n. 3
0
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage PlanningOp
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$protocole_id = CValue::get("protocole_id");
$chir_id = CValue::get("chir_id");
$protocole = new CProtocole();
$protocole->load($protocole_id);
$protocole->loadRefsFwd();
if (CAppUI::conf("dPbloc CPlageOp systeme_materiel")) {
    $protocole->_types_ressources_ids = implode(",", CMbArray::pluck($protocole->loadRefsBesoins(), "type_ressource_id"));
}
$smarty = new CSmartyDP();
$smarty->assign("chir_id", $chir_id);
$smarty->assign("protocole", $protocole);
$smarty->display("inc_get_protocole.tpl");
Esempio n. 4
0
global $m, $tab;
CCanDo::checkEdit();
$protocole_id = CValue::getOrSession("protocole_id", 0);
$mediuser = CMediusers::get();
$is_praticien = $mediuser->isPraticien();
$chir_id = CValue::getOrSession("chir_id", $is_praticien ? $mediuser->user_id : null);
// Chargement du praticien
$chir = new CMediusers();
if ($chir_id) {
    $chir->load($chir_id);
}
// Vérification des droits sur les listes
$listPraticiens = $mediuser->loadPraticiens(PERM_EDIT);
$function = new CFunctions();
$listFunctions = $function->loadSpecialites(PERM_EDIT);
$protocole = new CProtocole();
if ($protocole_id) {
    $protocole->load($protocole_id);
    // On vérifie que l'utilisateur a les droits sur le protocole
    if (!$protocole->getPerm(PERM_EDIT)) {
        CAppUI::setMsg("Vous n'avez pas accès à ce protocole", UI_MSG_WARNING);
        CAppUI::redirect("m={$m}&tab={$tab}&protocole_id=0");
    }
    $protocole->loadRefs();
    $protocole->loadRefsNotes();
    $protocole->loadRefPrescriptionChir();
    $chir =& $protocole->_ref_chir;
} else {
    $protocole->temp_operation = '00:00:00';
}
// Durée d'une intervention
 function countProtocoles($type = null)
 {
     $this->loadRefFunction();
     $functions = array($this->function_id);
     $this->loadBackRefs("secondary_functions");
     foreach ($this->_back["secondary_functions"] as $curr_sec_func) {
         $functions[] = $curr_sec_func->function_id;
     }
     $list_functions = implode(",", $functions);
     $where = array("protocole.chir_id = '{$this->_id}' OR protocole.function_id IN ({$list_functions})");
     if ($type) {
         $where["type"] = "= '{$type}'";
     }
     $protocole = new CProtocole();
     $this->_count_protocoles = $protocole->countList($where);
 }
Esempio n. 6
0
 /**
  * Count protocole
  *
  * @param string $type Type
  *
  * @return int
  */
 function countProtocoles($type = null)
 {
     $where = array("function_id" => "= '{$this->_id}'");
     if ($type) {
         $where["type"] = "= '{$type}'";
     }
     $protocole = new CProtocole();
     return $this->_count_protocoles = $protocole->countList($where);
 }
/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage PlanningOp
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$chir_id = CValue::get("chir_id");
$function_id = CValue::get("function_id");
$function = new CFunctions();
$function->load($function_id);
$chir = new CMediusers();
$chir->load($chir_id);
$protocole = new CProtocole();
$protocole->chir_id = $chir_id ? $chir_id : null;
$protocole->function_id = $function_id ? $function_id : null;
/** @var CProtocole[] $protocoles */
$protocoles = $protocole->loadMatchingList("libelle");
if (!$function->_id) {
    $function = $chir->loadRefFunction();
}
$csv = new CCSVFile();
$line = array("Nom de la fonction", "Nom du praticien", "Prénom du praticien", "Motif d'hospitalisation", "Libellé du séjour", "Durée d'intervention", "Actes CCAM", "Diagnostic", "Type d'hospitalisation", "Durée d'hospitalisation", "Durée USCPO", "Durée préop", "Présence préop", "Présence postop", "UF d'hébergement", "UF de soins", "UF médicale", "Facturable", "Médical", "Exam. extempo. prévu", "Côté", "Bilan préop", "Matériel à prévoir", "Examens per-op", "Dépassement d'honoraires", "Forfait clinique", "Fournitures", "Remarques sur l'intervention", "Convalescence", "Remarques sur le séjour", "Septique", "Durée en heure d'hospitalisation", "Pathologie", "Type de prise en charge");
$csv->writeLine($line);
CMbObject::massLoadFwdRef($protocoles, "chir_id");
CMbObject::massLoadFwdRef($protocoles, "function_id");
foreach ($protocoles as $_protocole) {
    $_protocole->loadRefUfHebergement();
    $_protocole->loadRefUfMedicale();
 $firstname = $results[$i]["praticien_firstname"];
 if ($lastname) {
     $ljoin = array();
     $ljoin["users"] = "users.user_id = users_mediboard.user_id";
     $where = array();
     $where["users.user_last_name"] = "= '{$lastname}'";
     $where["users.user_first_name"] = "= '{$firstname}'";
     //$where["users_mediboard.function_id"] = "= '$function->_id'";
     $prat->loadObject($where, null, null, $ljoin);
 }
 if (!$function->_id && !$prat->_id) {
     $results[$i]["errors"][] = "Fonction et utilisateur non trouvé";
     $unfound["praticien_lastname"][$lastname] = true;
 }
 // Protocole
 $protocole = new CProtocole();
 $protocole->_time_op = null;
 $protocole->for_sejour = $results[$i]["for_sejour"];
 if (isset($results[$i]["motif"]) && $results[$i]["motif"] != "") {
     $protocole->libelle = $results[$i]["motif"];
 }
 if (isset($results[$i]["libelle_sejour"]) && $results[$i]["libelle_sejour"] != "") {
     $protocole->libelle_sejour = $results[$i]["libelle_sejour"];
 }
 if ($prat->_id) {
     $protocole->chir_id = $prat->_id;
 } else {
     $protocole->function_id = $function->_id;
 }
 // Mise à jour du protocole éventuel existant
 $protocole->loadMatchingObject();