} $dates = array($debut, $fin); $prescription = $sejour->loadRefPrescriptionSejour(); $lines["imagerie"] = $prescription->loadRefsLinesElement(null, "imagerie"); $lines["kine"] = $prescription->loadRefsLinesElement(null, "kine"); foreach ($lines as $category => $cat) { $color = $category == "kine" ? "#ccf" : "aaa"; foreach ($cat as $_line) { /* @var CPrescriptionLineElement $_line*/ // Chargement des planifications pour la date courante $planif = new CPlanificationSysteme(); $where = array(); $where["object_id"] = " = '{$_line->_id}'"; $where["object_class"] = " = '{$_line->_class}'"; $where["dateTime"] = " BETWEEN '{$debut} 00:00:00' AND '{$fin} 23:59:59'"; $planifs = $planif->loadList($where, "dateTime"); foreach ($planifs as $_planif) { /* @var CPlanificationSysteme $_planif*/ $_planif->loadRefPrise(); $libelle = $_planif->_ref_prise->quantite . " " . $_line->_unite_prise . " - " . $_line->_view; $event = new CPlanningEvent($_line->_guid, $_planif->dateTime, 60, $libelle, $color, true); $event->onmousover = true; $planning->addEvent($event); } $_line->loadRefsAdministrations($dates); foreach ($_line->_ref_administrations as $_admin) { /* @var CAdministration $_admin*/ $libelle = $_admin->quantite . " " . $_line->_unite_prise . " - " . $_line->_view; $event = new CPlanningEvent($_admin->_guid, $_admin->dateTime, 60, $libelle, $color, true); $event->onmousover = true; $planning->addEvent($event);
$sejour = $_affectation->loadRefSejour(1); $sejour->_ref_current_affectation = $_affectation; $sejour->loadRefPatient(); $sejour->entree = CMbDate::dirac($period, $sejour->entree); $sejour->sortie = CMbDate::dirac($period, $sejour->sortie); $sejours[$sejour->_id] = $sejour; // Chargement des planification système $planif = new CPlanificationSysteme(); $ljoin = array(); $ljoin["affectation"] = "affectation.sejour_id = planification_systeme.sejour_id"; $where = array(); $where["planification_systeme.sejour_id"] = " = '{$sejour->_id}'"; $where["dateTime"] = " BETWEEN '{$datetime_min}' AND '{$datetime_max}'"; $where["affectation.service_id"] = " = '{$service_id}'"; $where["object_class"] = " = 'CPrescriptionLineElement'"; $planifs = $planif->loadList($where, null, null, null, $ljoin); // Classement par séjour if (!isset($planifications[$sejour->_id])) { $planifications[$sejour->_id] = array(); } $planifications[$sejour->_id] += $planifs; } $total_sejour = array(); $total_date = array(); $total = array(); $charge = array(); foreach ($datetimes as $_datetime) { $total_datetime[$_datetime] = array(); } // Parcours des planifications et calcul de la charge foreach ($planifications as &$_planifs) {
} $date_max = "{$_key_real_date} {$_key_hour}"; } $count_composition_dossier[$_key_date][$_key_periode] += count($_period_hours); } } } $with_med = in_array("med", $categories_id_pancarte); CMbArray::removeValue("med", $categories_id_pancarte); $date_max = CMbDT::dateTime("+ 1 HOUR", $date_max); // Chargement des planifications systemes $planif = new CPlanificationSysteme(); $where = array(); $where["sejour_id"] = CSQLDataSource::prepareIn(CMbArray::pluck($prescriptions, "object_id")); $where["dateTime"] = " BETWEEN '{$date_min}' AND '{$date_max}'"; $planifs_systeme = $planif->loadList($where, "sejour_id ASC, dateTime ASC"); CStoredObject::massLoadFwdRef($planifs_systeme, "object_id"); CStoredObject::massLoadFwdRef($planifs_systeme, "prise_id"); // Parcours et stockage des planifications systeme dans la pancarte /* @var CPlanificationSysteme[] $planifs_systeme*/ foreach ($planifs_systeme as $_planif) { // Chargement et stockage de la ligne $line = $_planif->loadTargetObject(); $_date = CMbDT::date($_planif->dateTime); switch ($line->_class) { case "CPrescriptionLineMedicament": case "CPrescriptionLineElement": if ($line instanceof CPrescriptionLineMedicament && !$with_med) { continue; } elseif ($line instanceof CPrescriptionLineElement && !in_array($line->element_prescription_id, $categories_id_pancarte)) { continue;