} $libelle = "Intervention par le Dr " . $_operation->_ref_chir->_view . " - {$_operation->libelle}"; $event = new CPlanningEvent($_operation->_guid, $_operation->_datetime, CMbDT::minutesRelative($_operation->_datetime, $_operation->_acte_execution), $libelle, $color, true); $event->onmousover = true; $planning->addEvent($event); } $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) {
$where["affectation.service_id"] = " = '{$service_id}'"; $affectations = $affectation->loadList($where); $planifications = array(); $ressources = array(); CMbObject::massLoadFwdRef($affectations, "sejour_id"); foreach ($affectations as $_affectation) { $_affectation->loadView(); // Chargement du séjour $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();
foreach ($_period_dates as $_key_real_date => $_period_hours) { foreach ($_period_hours as $_key_hour => $_hour) { if (!$date_min) { $date_min = "{$_key_real_date} {$_key_hour}"; } $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":