* $Id$ * * @package Mediboard * @subpackage SalleOp * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ // @todo bloc n'est pas forcément actif global $can; $can->read |= CModule::getActive("dPbloc")->_can->read; $can->needsRead(); $operation_id = CValue::getOrSession("operation_id", null); $operation = new COperation(); $operation->load($operation_id); $operation->loadRefsAnesthPerops(); $operation->loadRefsFwd(); $operation->loadRefsActesCCAM(); foreach ($operation->_ref_actes_ccam as $acte) { $acte->loadRefsFwd(); } $operation->loadAffectationsPersonnel(); if (CAppUI::conf('dPccam CCodeCCAM use_new_association_rules')) { $operation->guessActesAssociation(); } else { foreach ($operation->_ref_actes_ccam as $acte) { $acte->guessAssociation(); } } $operation->loadRefSortieLocker()->loadRefFunction(); $sejour = $operation->_ref_sejour;
static function buildEventsGrid(COperation $interv, $time_debut_op_iso, $time_fin_op_iso, $time_min, $time_max) { // --------------------------------------------------- // Gestes, Medicaments, Perfusions peranesth $evenements = array("CAnesthPerop" => array(), "CAffectationPersonnel" => array()); // Personnel de l'interv $interv->loadAffectationsPersonnel(); foreach ($interv->_ref_affectations_personnel as $affectations) { foreach ($affectations as $_affectation) { if (!$_affectation->debut || !$_affectation->fin) { continue; } $evenements["CAffectationPersonnel"][$_affectation->_id] = array("icon" => null, "label" => $_affectation->_ref_personnel, "unit" => null, "alert" => false, "datetime" => $_affectation->debut, "position" => CSupervisionTimedEntity::getPosition($_affectation->debut, $time_min, $time_max), "width" => CSupervisionTimedEntity::getWidth($_affectation->debut, $_affectation->fin, $time_min, $time_max), "object" => $_affectation, "editable" => false); } } // Personnel de la plage $plageop = $interv->_ref_plageop; $plageop->loadAffectationsPersonnel(); foreach ($plageop->_ref_affectations_personnel as $affectations) { foreach ($affectations as $_affectation) { if (!$_affectation->debut || !$_affectation->fin) { continue; } $evenements["CAffectationPersonnel"][$_affectation->_id] = array("icon" => null, "label" => $_affectation->_ref_personnel, "unit" => null, "alert" => false, "datetime" => $_affectation->debut, "position" => CSupervisionTimedEntity::getPosition($_affectation->debut, $time_min, $time_max), "width" => CSupervisionTimedEntity::getWidth($_affectation->debut, $_affectation->fin, $time_min, $time_max), "object" => $_affectation, "editable" => false); } } // Gestes perop $interv->loadRefsAnesthPerops(); foreach ($interv->_ref_anesth_perops as $_perop) { $evenements["CAnesthPerop"][$_perop->_id] = array("icon" => null, "label" => $_perop->libelle, "unit" => null, "alert" => $_perop->incident, "datetime" => $_perop->datetime, "position" => CSupervisionTimedEntity::getPosition($_perop->datetime, $time_min, $time_max), "object" => $_perop, "editable" => true); } // Lignes de medicaments et d'elements $sejour = $interv->loadRefSejour(); $prescription = $sejour->loadRefPrescriptionSejour(); if ($prescription->_id) { $lines = $prescription->loadPeropLines(false); foreach ($lines as $_line_array) { $_line = $_line_array["object"]; $key = "CPrescription._chapitres.{$_line->_chapitre}"; if (!isset($evenements[$key])) { $evenements[$key] = array("subitems" => array(), "icon" => $_line->_chapitre); } // Build view $_subkey = array("line" => $_line, "label" => ""); $_view = ""; if ($_line instanceof CPrescriptionLineElement) { $_view = $_line->_view; } elseif ($_line instanceof CPrescriptionLineMix) { foreach ($_line->_ref_lines as $_mix_item) { $_view .= "{$_mix_item->_ucd_view} / "; } } else { $_view = $_line->_ucd_view; } $_subkey["label"] = $_view; $_subkey_guid = $_subkey["line"]->_guid; if (!isset($evenements[$key]["subitems"][$_subkey_guid])) { $evenements[$key]["subitems"][$_subkey_guid] = array("label" => $_subkey["label"], "line" => $_line, "items" => array()); } foreach ($_line_array["administrations"] as $_adms) { $_adms = CModelObject::naturalSort($_adms, array("dateTime")); foreach ($_adms as $_adm) { $unite = ""; if ($_line instanceof CPrescriptionLineMedicament || $_line instanceof CPrescriptionLineMix) { $unite = $_adm->_ref_object->_ref_produit->libelle_unite_presentation; } $evenements[$key]["subitems"][$_subkey_guid]["items"][] = array("label" => "", "unit" => "{$_adm->quantite} {$unite}", "alert" => false, "datetime" => $_adm->dateTime, "position" => CSupervisionTimedEntity::getPosition($_adm->dateTime, $time_min, $time_max), "object" => $_adm, "editable" => false); } } } } return $evenements; }