// Chargement des praticiens $listAnesths = new CMediusers(); $listAnesths = $listAnesths->loadAnesthesistes(PERM_DENY); $listChirs = new CMediusers(); $listChirs = $listChirs->loadPraticiens(PERM_DENY); $type_personnel = array("op", "op_panseuse", "iade", "sagefemme", "manipulateur"); if (count($daily_check_list_types) && $require_check_list) { $type_personnel = array(); foreach ($daily_check_list_types as $check_list_type) { $validateurs = explode("|", $check_list_type->type_validateur); foreach ($validateurs as $validateur) { $type_personnel[] = $validateur; } } } $listValidateurs = CPersonnel::loadListPers(array_unique(array_values($type_personnel)), true, true); $operateurs_disp_vasc = implode("-", array_merge(CMbArray::pluck($listChirs, "_id"), CMbArray::pluck($listValidateurs, "user_id"))); $nb_op_no_close = 0; if ($type == "fermeture_salle") { $salle->loadRefsForDay($date); // Calcul du nombre d'actes codé dans les interventions if ($salle->_ref_plages) { foreach ($salle->_ref_plages as $_plage) { foreach ($_plage->_ref_operations as $_operation) { if (!$_operation->sortie_salle && !$_operation->annulee) { $nb_op_no_close++; } } foreach ($_plage->_unordered_operations as $_operation) { if (!$_operation->sortie_salle && !$_operation->annulee) { $nb_op_no_close++;
$specs = $function->loadSpecialites(PERM_READ, 1); // Liste des Anesthésistes $mediuser = new CMediusers(); $anesths = $mediuser->loadAnesthesistes(); CMbObject::massLoadFwdRef($anesths, "function_id"); foreach ($anesths as $_anesth) { $_anesth->loadRefFunction(); } // Liste des praticiens $chirs = $mediuser->loadChirurgiens(); CMbObject::massLoadFwdRef($chirs, "function_id"); foreach ($chirs as $_chir) { $_chir->loadRefFunction(); } // Chargement du personnel $listPers = array("iade" => CPersonnel::loadListPers("iade"), "op" => CPersonnel::loadListPers("op"), "op_panseuse" => CPersonnel::loadListPers("op_panseuse"), "sagefemme" => CPersonnel::loadListPers("sagefemme"), "manipulateur" => CPersonnel::loadListPers("manipulateur")); if ($plagesel->_id) { $plagesel->multicountOperations(); $plagesel->countOperationsAnnulees(); $plagesel->loadRefsNotes(); $listPers = $plagesel->loadPersonnelDisponible($listPers); } //Création du template $smarty = new CSmartyDP(); $smarty->assign("listBlocs", $listBlocs); $smarty->assign("bloc", $bloc); $smarty->assign("date", $date); $smarty->assign("plagesel", $plagesel); $smarty->assign("specs", $specs); $smarty->assign("anesths", $anesths); $smarty->assign("chirs", $chirs);
$date_close_checklist = CDailyCheckList::getDateLastChecklist($bloc, $type_close); $date_open_checklist = CDailyCheckList::getDateLastChecklist($bloc, $type_checklist); if ($require_check_list) { // Chargement de la liste du personnel pour le reveil if (CModule::getActive("dPpersonnel")) { $type_personnel = array("reveil"); if (count($daily_check_list_types)) { $type_personnel = array(); foreach ($daily_check_list_types as $check_list_type) { $validateurs = explode("|", $check_list_type->type_validateur); foreach ($validateurs as $validateur) { $type_personnel[] = $validateur; } } } $personnel = new CPersonnel(); $personnels = $personnel->loadListPers(array_unique(array_values($type_personnel))); } $curr_user = CMediusers::get(); // Chargement des praticiens $listChirs = $curr_user->loadPraticiens(PERM_DENY); // Chargement des anesths $listAnesths = $curr_user->loadAnesthesistes(PERM_DENY); } } //tri par patient if (CValue::getOrSession("order_col_" . $type) == "_patient") { $sorter = CMbArray::pluck($listOperations, "_ref_patient", "nom"); array_multisort($sorter, $order_way_final == "ASC" ? SORT_ASC : SORT_DESC, $listOperations); $order_col = CValue::getOrSession("order_col_" . $type); }
$anesth_id = null; if ($check_list->object_class == "COperation") { $check_list->_ref_object->loadRefChir(); $anesth_id = $check_list->_ref_object->anesth_id; } $anesth = new CMediusers(); $anesth->load($anesth_id); $type_personnel = array("op", "op_panseuse"); if (!$check_list->validator_id && $check_list->_id) { $validateurs = explode("|", $check_list->_ref_list_type->type_validateur); $type_personnel = array(); foreach ($validateurs as $valid) { $type_personnel[] = $valid; } } $personnel = CPersonnel::loadListPers(array_unique(array_values($type_personnel)), true, true); // Chargement des praticiens $listChirs = new CMediusers(); $listChirs = $listChirs->loadPraticiens(PERM_DENY); // Chargement des anesths $listAnesths = new CMediusers(); $listAnesths = $listAnesths->loadAnesthesistes(PERM_DENY); $check_item_category = new CDailyCheckItemCategory(); if ($check_list->_ref_list_type->type == "fermeture_salle") { $check_item_category->list_type_id = $check_list->list_type_id; } else { $check_item_category->target_class = $check_list->object_class; $check_item_category->type = $check_list->type; } $check_item_categories = $check_item_category->loadMatchingList("title"); // Création du template
function loadPersonnelDisponible() { $listPers = array("iade" => CPersonnel::loadListPers("iade"), "op" => CPersonnel::loadListPers("op"), "op_panseuse" => CPersonnel::loadListPers("op_panseuse"), "sagefemme" => CPersonnel::loadListPers("sagefemme"), "manipulateur" => CPersonnel::loadListPers("manipulateur")); $plage = $this->_ref_plageop; if (!$plage) { $plage = $this->loadRefPlageOp(); } $listPers = $plage->loadPersonnelDisponible($listPers); if (!$this->_ref_affectations_personnel) { $this->loadAffectationsPersonnel(); } $affectations_personnel = $this->_ref_affectations_personnel; $personnel_ids = array(); foreach ($affectations_personnel as $_aff_by_type) { foreach ($_aff_by_type as $_aff) { if ((!$_aff->debut || !$_aff->fin) && !$_aff->parent_affectation_id) { $personnel_ids[] = $_aff->personnel_id; } } } // Suppression de la liste des personnels déjà présents foreach ($listPers as $key => $persByType) { foreach ($persByType as $_key => $pers) { if (in_array($pers->_id, $personnel_ids)) { unset($listPers[$key][$_key]); } } } return $listPers; }
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 20462 $ */ //CCanDo::checkRead(); $emplacement = CValue::getOrSession("emplacement"); $_user_last_name = CValue::getOrSession("_user_last_name"); $_user_first_name = CValue::getOrSession("_user_first_name"); // Chargement du personnel selectionné $personnel_id = CValue::getOrSession("personnel_id"); $personnel = new CPersonnel(); $personnel->load($personnel_id); $personnel->loadRefs($personnel_id); $personnel->loadBackRefs("affectations", "affect_id DESC", "0,20"); $personnel->countBackRefs("affectations"); // Chargement de la liste des affectations pour le filtre $filter = new CPersonnel(); $where = array(); $ljoin["users"] = "users.user_id = personnel.user_id"; $order = "users.user_last_name"; if ($emplacement) { $where["emplacement"] = " = '{$emplacement}'"; $filter->emplacement = $emplacement; } if ($_user_last_name) { $where["user_last_name"] = "LIKE '%{$_user_last_name}%'"; $filter->_user_last_name = $_user_last_name; } if ($_user_first_name) { $where["user_first_name"] = "LIKE '%{$_user_first_name}%'"; $filter->_user_first_name = $_user_first_name; }
function loadPersonnelDisponible($listPers = array(), $remove_pers = false) { if (!count($listPers)) { $listPers = array("iade" => CPersonnel::loadListPers("iade"), "op" => CPersonnel::loadListPers("op"), "op_panseuse" => CPersonnel::loadListPers("op_panseuse"), "sagefemme" => CPersonnel::loadListPers("sagefemme"), "manipulateur" => CPersonnel::loadListPers("manipulateur")); } if ($remove_pers) { if (!$this->_ref_affectations_personnel) { $this->loadAffectationsPersonnel(); } $affectations_personnel = $this->_ref_affectations_personnel; $personnel_ids = array(); foreach ($affectations_personnel as $_aff_by_type) { foreach ($_aff_by_type as $_aff) { if (!$_aff->debut && !$_aff->fin) { $personnel_ids[] = $_aff->personnel_id; } } } // Suppression de la liste des personnels deja presents foreach ($listPers as $key => $persByType) { foreach ($persByType as $_key => $pers) { if (in_array($pers->_id, $personnel_ids)) { unset($listPers[$key][$_key]); } } } } return $listPers; }
$blood_salvage = new CBloodSalvage(); $date = CValue::getOrSession("date", CMbDT::date()); $op = CValue::getOrSession("op"); $totaltime = "00:00:00"; $modif_operation = CCanDo::edit() || $date >= CMbDT::date(); $timing = array(); $tabAffected = array(); /* * Liste des cell saver. */ $cell_saver = new CCellSaver(); $list_cell_saver = $cell_saver->loadList(); /* * Liste du personnel présent en SSPI. */ $list_nurse_sspi = CPersonnel::loadListPers("reveil"); /* * Liste d'incidents transfusionnels possibles. */ $incident = new CTypeEi(); $liste_incident = $incident->loadList(); /* * Création du tableau d'affectation et de celui des timings. */ $tabAffected = array(); $timingAffect = array(); if ($op) { $where = array(); $where["operation_id"] = "='{$op}'"; $blood_salvage->loadObject($where); $blood_salvage->loadRefsFwd();
$user_id = ""; } // Liste des utilisateur faisant parti du personnel $personnel = new CPersonnel(); $groupby = "user_id"; $ljoin["users"] = "users.user_id = personnel.user_id"; $order = "users.user_last_name"; $personnels = $personnel->loadGroupList(array(), $order, null, $groupby, $ljoin); foreach ($personnels as &$personnel) { $mediuser = new CMediusers(); $listUsers[$personnel->user_id] = $mediuser->load($personnel->user_id); } // Calcul des personnel_ids pour chaque user $where = array(); foreach ($listUsers as $key => $user) { $personnel = new CPersonnel(); $where["user_id"] = " = '{$key}'"; $personnels = $personnel->loadList($where); foreach ($personnels as $keyPers => $_personnel) { $listPers[$key][$_personnel->emplacement] = $_personnel->_id; } } $listAffectations = array(); // Chargement de la liste des affectations pour le filtre $filter = new CAffectationPersonnel(); $filter->object_id = $object_id; $filter->object_class = $object_class; $where = array(); if ($object_id) { $where["object_id"] = " = '{$object_id}'"; }
$list->isReadonly(); $list->_ref_object->loadRefPraticien(); $check_lists_no_has[$_checklist_type->_id] = $list; $where_cat = array(); $where_cat["target_class"] = " = 'COperation'"; $where_cat["list_type_id"] = " = '{$_checklist_type->_id}'"; $check_items_no_has_categories[$_checklist_type->_id] = $cat->loadList($where_cat, "title"); } $validateurs = explode("|", $list->loadRefListType()->type_validateur); foreach ($validateurs as $validateur) { $type_personnel_no_has[] = $validateur; } } $listValidateurs_no_has = CPersonnel::loadListPers(array_unique(array_values($type_personnel_no_has)), true, true); $anesth_id = $selOp->anesth_id ? $selOp->anesth_id : $selOp->_ref_plageop->anesth_id; $listValidateurs = CPersonnel::loadListPers($type_personnel, true, true); $operateurs_disp_vasc = implode("-", array_merge(CMbArray::pluck($listChirs, "_id"), CMbArray::pluck($listValidateurs, "user_id"))); } $anesth = new CMediusers(); $anesth->load($anesth_id); // Création du template $smarty = new CSmartyDP(); $smarty->assign("selOp", $selOp); $smarty->assign("date", $date); $smarty->assign("currUser", $currUser); $smarty->assign("listAnesthType", $listAnesthType); $smarty->assign("listAnesths", $listAnesths); $smarty->assign("list_anesths", $listAnesths); $smarty->assign("operateurs_disp_vasc", $operateurs_disp_vasc); $smarty->assign("modeDAS", CAppUI::conf("dPsalleOp CDossierMedical DAS")); $smarty->assign("modif_operation", $selOp->canEdit() || $date >= CMbDT::date());
/** * Charge le personnel pour l'établissement courant * * @param string $emplacement Emplacement du personnel * @param bool $actif Seulement les actifs * @param bool $groupby Grouper par utilisateur * * @return CPersonnel[] */ static function loadListPers($emplacement, $actif = true, $groupby = false) { $personnel = new CPersonnel(); $where = array(); if (is_array($emplacement)) { $where["emplacement"] = $personnel->_spec->ds->prepareIn($emplacement); } else { $where["emplacement"] = "= '{$emplacement}'"; } // Could have been ambiguous with CMediusers.actif if ($actif) { $where[] = "personnel.actif = '1'"; $where[] = "users_mediboard.actif = '1'"; } $ljoin["users"] = "personnel.user_id = users.user_id"; $ljoin["users_mediboard"] = "users_mediboard.user_id = users.user_id"; $order = "users.user_last_name"; $group = $groupby ? "personnel.user_id" : null; /** @var CPersonnel[] $personnels */ $personnels = $personnel->loadGroupList($where, $order, null, $group, $ljoin); $users = CMbObject::massLoadFwdRef($personnels, "user_id"); CMbObject::massLoadFwdRef($users, "function_id"); foreach ($personnels as $_personnel) { $_personnel->loadRefUser()->loadRefFunction(); } return $personnels; }