// Préchargement des users $user = new CUser(); $where = array("user_id" => CSQLDataSource::prepareIn(CMbArray::pluck($_sejours, "praticien_id"))); $users = $user->loadList($where); $praticiens = CStoredObject::massLoadFwdRef($_sejours, "praticien_id"); CStoredObject::massLoadFwdRef($praticiens, "function_id"); CStoredObject::massCountBackRefs($affectations, "affectations_enfant"); $_operations = CStoredObject::massLoadBackRefs($sejours, "operations", "date ASC"); CStoredObject::massLoadFwdRef($_operations, "plageop_id"); loadVueTempo($sejours, $suivi_affectation, null, $operations, $date_min, $date_max, $period, $prestation_id, $functions_filter, $filter_function, $sejours_non_affectes); if (CAppUI::conf("dPadmissions show_deficience")) { CStoredObject::massLoadBackRefs($patients, "dossier_medical"); $dossiers = CMbArray::pluck($sejours, "_ref_patient", "_ref_dossier_medical"); CDossierMedical::massCountAntecedentsByType($dossiers, "deficience"); } loadVueTempo($affectations, $suivi_affectation, null, $operations, $date_min, $date_max, $period, $prestation_id, $functions_filter, $filter_function, $sejours_non_affectes); if (count($affectations) && CAppUI::conf("dPadmissions show_deficience")) { $dossiers = CMbArray::pluck($affectations, "_ref_sejour", "_ref_patient", "_ref_dossier_medical"); CDossierMedical::massCountAntecedentsByType($dossiers, "deficience"); } ksort($sejours_non_affectes, SORT_STRING); $_sejour = new CSejour(); $_sejour->_type_admission = $_type_admission; $smarty = new CSmartyDP(); $smarty->assign("sejours_non_affectes", $sejours_non_affectes); $smarty->assign("_sejour", $_sejour); $smarty->assign("triAdm", $triAdm); $smarty->assign("functions_filter", $functions_filter); $smarty->assign("filter_function", $filter_function); $smarty->assign("granularite", $granularite); $smarty->assign("date", $date);
} $sejours = CStoredObject::massLoadFwdRef($affectations, "sejour_id"); $patients = CStoredObject::massLoadFwdRef($sejours, "patient_id"); $praticiens = CStoredObject::massLoadFwdRef($sejours, "praticien_id"); CStoredObject::massLoadFwdRef($praticiens, "function_id"); CStoredObject::massLoadBackRefs($patients, "dossier_medical"); CPatient::massCountPhotoIdentite($patients); foreach ($affectations as $_affectation_imc) { /* @var CAffectation $_affectation_imc*/ if (CAppUI::conf("dPhospi vue_temporelle show_imc_patient", "CService-" . $_affectation_imc->service_id)) { $_affectation_imc->loadRefSejour()->loadRefPatient()->loadRefLatestConstantes(null, array("poids", "taille")); } } $operations = array(); $suivi_affectation = false; loadVueTempo($affectations, $suivi_affectation, $lits, $operations, $date_min, $date_max, $period, $prestation_id); $intervals = array(); if (count($lit->_ref_affectations)) { foreach ($lit->_ref_affectations as $_affectation) { $intervals[$_affectation->_id] = array("lower" => $_affectation->_entree, "upper" => $_affectation->_sortie); } $lit->_lines = CMbRange::rearrange($intervals); } // Pour les alertes, il est nécessaire de charger les autres lits // de la chambre concernée ainsi que les affectations $where = array(); $where["entree"] = "<= '{$date_max}'"; $where["sortie"] = ">= '{$date_min}'"; $lits_ids = $chambre->loadBackIds("lits"); foreach ($lits_ids as $_lit_id) { if ($lit_id == $_lit_id) {