$where = array(); if ($event_type == "register_outpatient") { $where["type"] = "= 'urg'"; } $sejours = $patient->loadRefsSejours($where); CSejour::massLoadNDA($sejours); break; case "A12": $leftjoin = array("affectation" => "affectation.sejour_id = sejour.sejour_id"); $where = array("patient_id" => "= '{$patient->_id}'", "entree_reelle" => "IS NOT NULL", "affectation_id" => "IS NOT NULL"); $sejour = new CSejour(); /** @var CSejour[] $sejours */ $sejours = $sejour->loadList($where, "entree DESC", null, null, $leftjoin); $patient->_ref_sejours = $sejours; CSejour::massLoadNDA($sejours); CSejour::massLoadBackRefs($sejours, "affectations"); foreach ($sejours as $_sejour) { $_sejour->_ref_affectations = $_sejour->_back["affectations"]; } break; case "A13": $sejours = $patient->loadRefsSejours(array("sortie_reelle" => "IS NOT NULL")); CSejour::massLoadNDA($sejours); break; case "A38": $sejours = $patient->loadRefsSejours(array("sortie_reelle" => "IS NULL", "entree_reelle" => "IS NULL")); CSejour::massLoadNDA($sejours); break; case "INSERT": $where = array("entree_reelle" => "IS NOT NULL"); if ($event_type == "event_change_class_inpatient") {
$sejour = $_affectation->loadRefSejour(1); $sejour->_ref_curr_affectation = $_affectation; } } } } } /* @var CPatient[] $patients */ $patients = CStoredObject::massLoadFwdRef($sejours, "patient_id"); CPatient::massLoadIPP($patients); CStoredObject::massLoadBackRefs($patients, "dossier_medical"); CStoredObject::massLoadFwdRef($sejours, "praticien_id"); CStoredObject::massCountBackRefs($sejours, "tasks", array("realise" => "= '0'"), array(), "taches_non_realisees"); CStoredObject::massLoadBackRefs($sejours, "dossier_medical"); CSejour::massLoadSurrAffectation($sejours); CSejour::massLoadBackRefs($sejours, "user_sejour"); CSejour::massLoadNDA($sejours); $count_my_patient = 0; foreach ($sejours as $sejour) { $count_my_patient += count($sejour->loadRefsUserSejour($userCourant)); $sejour->loadRefPatient(); $sejour->loadRefPraticien(); $sejour->checkDaysRelative($date); $sejour->loadRefPrescriptionSejour(); $prescription = $sejour->_ref_prescription_sejour; if ($prescription->_id) { $prescription->loadJourOp(CMbDT::date()); } // Chargement des taches non effectuées $sejour->_count_tasks = $sejour->_count["taches_non_realisees"]; if ($print) {