$nbIntervHorsPlage = CIntervHorsPlage::countForDates($date_planning, null, array($praticien_id)); $prats = CStoredObject::massLoadFwdRef($operations, "chir_id"); CStoredObject::massLoadFwdRef($prats, "function_id"); CStoredObject::massLoadFwdRef($operations, "plageop_id"); CStoredObject::massLoadFwdRef($operations, "salle_id"); CStoredObject::massLoadFwdRef($operations, "anesth_id"); CStoredObject::massLoadFwdRef($operations, "chir_2_id"); CStoredObject::massLoadFwdRef($operations, "chir_3_id"); CStoredObject::massLoadFwdRef($operations, "chir_4_id"); CStoredObject::massLoadBackRefs($operations, "workflow"); $sejours = CStoredObject::massLoadFwdRef($operations, "sejour_id"); $affectations = CStoredObject::massLoadBackRefs($sejours, "affectations"); CStoredObject::massLoadFwdRef($affectations, "lit_id"); $patients = CStoredObject::massLoadFwdRef($sejours, "patient_id"); $dossiers = CStoredObject::massLoadBackRefs($patients, "dossier_medical"); CDossierMedical::massCountAllergies($dossiers); // Récupération des commentaires $commentaire = new CCommentairePlanning(); $where = array(); $where["debut"] = " <= '{$date_planning} 23:59:59'"; $where["fin"] = " >= '{$date_planning} 00:00:00'"; $where["salle_id"] = CSQLDataSource::prepareIn($salles_ids); $commentaires = $commentaire->loadListWithPerms(PERM_READ, $where); // Récupération des plages opératoires $plageop = new CPlageOp(); $where = array(); $where["date"] = " = '{$date_planning}'"; $where["salle_id"] = CSQLDataSource::prepareIn($salles_ids); $plages = $plageop->loadListWithPerms(PERM_READ, $where); // Création du planning $planning = new CPlanningWeek(0, 0, count($salles), count($salles), false, "auto");
$patient = $sejour->_ref_patient; $patient->loadRefPhotoIdentite(); $patient->loadRefDossierMedical(false); if (CAppUI::conf("pharmacie Display show_risq_population", CGroups::loadCurrent()) && $lite_view && $patient->sexe == "f") { $patient->loadLastGrossesse(); } $dossier_medical = $patient->_ref_dossier_medical; if ($dossier_medical->_id) { $dossiers[$dossier_medical->_id] = $dossier_medical; } } // Récupération des identifiants des dossiers médicaux $dossiers_id = CMbArray::pluck($sejours, "_ref_patient", "_ref_dossier_medical", "_id"); // Suppressions des dossiers médicaux inexistants CMbArray::removeValue("", $dossiers); $_counts_allergie = CDossierMedical::massCountAllergies($dossiers_id); $_counts_antecedent = CDossierMedical::massCountAntecedents($dossiers_id); /* @var CDossierMedical[] $dossiers*/ foreach ($dossiers as $_dossier) { if ($print) { $_dossier->loadRefsAllergies(); $_dossier->loadRefsAntecedents(); } $_dossier->_count_allergies = array_key_exists($_dossier->_id, $_counts_allergie) ? $_counts_allergie[$_dossier->_id] : 0; $_dossier->_count_antecedents = array_key_exists($_dossier->_id, $_counts_antecedent) ? $_counts_antecedent[$_dossier->_id] : 0; } if ($service_id == "NP") { $sorter = CMbArray::pluck($sejours, "_ref_patient", "nom"); array_multisort($sorter, SORT_ASC, $sejours); } $function = new CFunctions();