$do = CValue::get("do"); $calcul_planifs = CValue::get("calcul_planifs", 1); if (!$calcul_planifs) { CView::enforceSlave(); } $group = CGroups::loadCurrent(); if ($offline) { $by_patient = true; $do = 1; $dateTime_min = CMbDT::dateTime(" - " . CAppUI::conf("soins bilan hour_before", $group) . " HOURS"); $dateTime_max = CMbDT::dateTime(" + " . CAppUI::conf("soins bilan hour_after", $group) . " HOURS"); } else { $dateTime_min = CValue::getOrSession("_dateTime_min", "{$date} 00:00:00"); $dateTime_max = CValue::getOrSession("_dateTime_max", "{$date} 23:59:59"); } $categories = CCategoryPrescription::loadCategoriesByChap(null, "current", 1); $date_min = CMbDT::date($dateTime_min); $date_max = CMbDT::date($dateTime_max); if ($token_cat == "all") { $token_cat = "trans|med|inj|perf|aerosol"; foreach ($categories as $categories_by_chap) { foreach ($categories_by_chap as $category_id => $_categorie) { $token_cat .= "|{$category_id}"; } } } $elts = $cats = explode("|", $token_cat); CMbArray::removeValue("med", $elts); CMbArray::removeValue("perf", $elts); CMbArray::removeValue("inj", $elts); CMbArray::removeValue("trans", $elts);
} foreach ($patient->_ref_medecins_correspondants as $correspondant) { $correspondantsMedicaux["correspondants"][] = $correspondant->_ref_medecin; } } else { $sejour->group_id = $group_id; $sejour->praticien_id = $user->_id; $sejour->entree_prevue = CMbDT::date() . " 08:00:00"; $sejour->sortie_prevue = CMbDT::date() . " 18:00:00"; $sejour->recuse = CAppUI::conf("ssr recusation use_recuse") ? -1 : 0; } // Chargement des categories de prescription $categories = null; if (CModule::getActive("dPprescription")) { $categories = array(); $category = new CCategoryPrescription(); $where = array(); $where[] = "chapitre = 'kine'"; $where[] = "group_id = '{$group_id}' OR group_id IS NULL"; $order = "nom"; $categories = $category->loadList($where, $order); } // Dossier médical visibile ? $can_view_dossier_medical = $user->isMedical(); $can_edit_prescription = $user->isPraticien() || $user->isAdmin(); // Suppression des categories vides if (!$can_edit_prescription) { foreach ($categories as $_cat_id => $_category) { if (!array_key_exists($_cat_id, $lines)) { unset($categories[$_cat_id]); }
foreach ($_elements_by_chap as $elements_cat) { foreach ($elements_cat as $_element) { $nb_lines_element += count($_element); } } } } $bed = $_prescription->_ref_object->_ref_curr_affectation->_ref_lit; $bedroom_name = $bed->_ref_chambre->nom . $bed->nom . $_prescription->_ref_object->_ref_curr_affectation->_id; $prescriptions_order[$bedroom_name] = $key; } // Tri par numéro de chambre ksort($prescriptions_order); $prescriptions = CMbArray::ksortByArray($prescriptions, $prescriptions_order); // Chargement des categories pour chaque chapitre $categories = CCategoryPrescription::loadCategoriesByChap(); $smarty = new CSmartyDP(); $smarty->assign("lines", $lines); $smarty->assign("patients", $patients); $smarty->assign("tabHours", $tabHours); $smarty->assign("prescriptions", $prescriptions); $smarty->assign("categories", $categories); $smarty->assign("tabHours", $tabHours); $smarty->assign("composition_dossier", $composition_dossier); $smarty->assign("bornes_composition_dossier", $bornes_composition_dossier); $smarty->assign("count_composition_dossier", $count_composition_dossier); $smarty->assign("operations", array()); $smarty->assign("nb_decalage", $nb_decalage); $smarty->assign("mode_dossier", $mode_dossier); $smarty->assign("nb_lines_element", $nb_lines_element); $smarty->assign("now", CMbDT::dateTime());