/** * @see parent::getSpec() */ function getSpec() { $spec = parent::getSpec(); $spec->dsn = 'cdarr'; $spec->incremented = false; return $spec; }
/** * @see parent::getSpec() */ function getProps() { $props = parent::getProps(); $props["salle_id"] = "ref class|CSalle notNull"; $props["date"] = "date notNull"; $props["status"] = "enum list|mined|remined|postmined"; return $props; }
/** * Get the properties of our class as strings * * @return array */ function getProps() { $props = parent::getProps(); $props["object_class"] = "str notNull maxLength|50"; $props["object_id"] = "ref class|CMbObject meta|object_class notNull unlink"; $props["type"] = "enum list|create|store|delete|merge default|create"; $props["date"] = "dateTime notNull"; return $props; }
/** * @see parent::getBackProps() */ function getBackProps() { $backProps = parent::getBackProps(); $backProps["access_logs"] = "CAccessLog module_action_id"; $backProps["datasource_logs"] = "CDataSourceLog module_action_id"; $backProps["access_logs_archive"] = "CAccessLogArchive module_action_id"; $backProps["datasource_logs_archive"] = "CDataSourceLogArchive module_action_id"; return $backProps; }
/** * Get target object * * @return CMbObject */ function getObject() { if (!$this->object) { $this->object = CStoredObject::loadFromGuid($this->object_guid); } if ($this->object) { $this->object->loadComplete(); } return $this->object; }
/** * @see parent::getProps() */ function getProps() { $specs = parent::getProps(); foreach (CMbFieldSpecFact::$classes as $spec => $class) { $specs[$spec] = $spec; } $specs['enum'] .= ' list|1|2|3|4'; $specs['set'] .= ' list|1|2|3|4'; $specs['ref'] .= ' class|CMbObject'; return $specs; }
/** * Make JavaScript callback * * @return void */ function doCallback() { $messages = CAppUI::$instance->messages; echo CAppUI::getMsg(); $fields = $this->_obj->getProperties(); $fields["_guid"] = $this->_obj->_guid; $fields["_class"] = $this->_obj->_class; foreach ($messages as &$_level) { $_keys = array_map("utf8_encode", array_keys($_level)); $_values = array_map("utf8_encode", array_values($_level)); $_level = array_combine($_keys, $_values); } $fields["_ui_messages"] = $messages; $id = $this->_obj->_id ? $this->_obj->_id : 0; if ($this->callBack) { CAppUI::callbackAjax($this->callBack, $id, $fields); } else { $guid = "{$this->className}-{$id}"; CAppUI::callbackAjax("Form.onSubmitComplete", $guid, $fields); } if (!CAppUI::$mobile) { CApp::rip(); } }
$where["reglement.object_class"] = " = 'CFactureCabinet'"; $reglement = new CReglement(); /** @var CReglement[] $reglements */ $reglements = $reglement->loadList($where, " facture_cabinet.facture_id, reglement.date", null, null, $ljoin); $reglement = new CReglement(); // Calcul du récapitulatif // Initialisation du tableau de reglements $recapReglement["total"] = array("nb_consultations" => "0", "du_patient" => "0", "du_tiers" => "0", "nb_reglement_patient" => "0", "nb_reglement_tiers" => "0", "secteur1" => "0", "secteur2" => "0", "secteur3" => "0", "du_tva" => "0"); foreach (array_merge($reglement->_specs["mode"]->_list, array("")) as $_mode) { $recapReglement[$_mode] = array("du_patient" => "0", "du_tiers" => "0", "nb_reglement_patient" => "0", "nb_reglement_tiers" => "0"); } $listReglements = array(); $listConsults = array(); $factures = CStoredObject::massLoadFwdRef($reglements, "object_id"); $patients = CStoredObject::massLoadFwdRef($factures, "patient_id"); CStoredObject::massCountBackRefs($factures, "notes"); foreach ($reglements as $_reglement) { $facture = $_reglement->loadRefFacture(); $facture->loadRefGroup(); $facture->loadRefsNotes(); $facture->loadRefsConsultation(); $facture->loadRefsReglements(); if (count($facture->_ref_consults)) { if (CAppUI::conf("dPccam CCodeCCAM use_cotation_ccam")) { foreach ($facture->_ref_consults as $_consult) { if (!array_key_exists($_consult->_id, $listConsults)) { $listConsults[$_consult->_id] = $_consult; $recapReglement["total"]["secteur1"] += $_consult->secteur1; $recapReglement["total"]["secteur2"] += $_consult->secteur2; $recapReglement["total"]["secteur3"] += $_consult->secteur3; $recapReglement["total"]["du_tva"] += $_consult->du_tva;
function mapDocs($object, $with_cancelled, $tri) { // Documents et fichiers $object->loadRefsDocItems($with_cancelled); CStoredObject::massLoadFwdRef($object->_ref_documents, "file_category_id"); foreach ($object->_ref_documents as $_doc) { CDocumentItem::makeIconName($_doc); $_doc->loadContent(false); $_doc->loadRefCategory(); $_doc->_ref_object = $object; $this->_all_docs[$this->makePrefix($tri, $object, $_doc)][] = $_doc; } CStoredObject::massLoadFwdRef($object->_ref_files, "file_category_id"); foreach ($object->_ref_files as $_file) { CDocumentItem::makeIconName($_file); $_file->loadRefCategory(); $_file->_ref_object = $object; $this->_all_docs[$this->makePrefix($tri, $object, $_file)][] = $_file; } // Formulaires $ex_link = new CExLink(); $ex_link->setObject($object); $ex_link->level = "object"; $ex_links = $ex_link->loadMatchingList(); $ex_objects = CExLink::massLoadExObjects($ex_links); CStoredObject::massLoadFwdRef($ex_objects, "object_id"); foreach ($ex_links as $_link) { $_ex = $_link->loadRefExObject(); $_ex->updateCreationFields(); $object = $_ex->loadTargetObject(); $_ex->_ex_class_id = $_link->ex_class_id; $_ex->loadRefExClass(); CDocumentItem::makeIconName($_ex->_ref_ex_class); $this->_all_docs[$this->makePrefix($tri, $object, $_ex)][] = $_link; } }
} /* @var CConsultation[] $consultations*/ $consultation = new CConsultation(); $consultations = $consultation->loadList($where, null, null, null, $ljoin); $totals["consultations"] = count($consultations); /** @var CPlageConsult[] $plages */ $plages = CStoredObject::massLoadFwdRef($consultations, "plageconsult_id"); CStoredObject::massLoadFwdRef($consultations, "sejour_id"); CStoredObject::massLoadFwdRef($consultations, "patient_id"); // Pré-chargement des users $where = array("user_id" => CSQLDataSource::prepareIn(CMbArray::pluck($plages, "chir_id"))); $user->loadList($where); /** @var CMediusers[] $chirs */ $chirs = CStoredObject::massLoadFwdRef($plages, "chir_id"); CStoredObject::massLoadFwdRef($chirs, "function_id"); CStoredObject::massLoadBackRefs($consultations, "actes_ccam"); foreach ($consultations as $key => $_consult) { // Chargemement des codes CCAM $_consult->loadExtCodesCCAM(); $codes_ccam = $_consult->_ext_codes_ccam; // Nombre d'acte cotés par le praticien et réinitialisation du count pour le cache $nb_actes_ccam = count($_consult->loadRefsActesCCAM()); // Aucun acte prévu ou coté if (!count($codes_ccam) && !$_consult->_count_actes) { $_consult->loadRefSejour(); $_consult->loadRefPraticien()->loadRefFunction(); $_consult->loadRefPatient(); continue; } // Actes prévus restant en suspend $activites = CMbArray::pluck($codes_ccam, "activites");
} // Can create new if ($detail <= 0.5) { // Loading the events if ($ex_class_events === null) { $_ex_class_creation = array(); $ex_class_events = array(); foreach (CExClass::$_list_cache as $_ex_class_id => $_ex_class) { if (!$_ex_class->conditional && (!$cross_context_class || $cross_context_class == $_ex_class->cross_context_class)) { $_ex_class_creation[] = $_ex_class_id; } } $where = array("ex_class_event.ex_class_id" => $ex_class_event->getDS()->prepareIn($_ex_class_creation), "ex_class_event.disabled" => "= '0'"); /** @var CExClassEvent[] $ex_class_events_by_ref */ $ex_class_events_by_ref = $ex_class_event->loadList($where); CStoredObject::massLoadBackRefs($ex_class_events_by_ref, "constraints"); foreach ($ex_class_events_by_ref as $_ex_class_event) { $_key = "{$_ex_class_event->host_class}/{$_ex_class_event->ex_class_id}"; /** @var CExClassEvent[] $_ex_class_events */ if (!array_key_exists($_key, $ex_class_events)) { $ex_class_events[$_key] = array(); } $ex_class_events[$_key][] = $_ex_class_event; } } foreach ($_ex_class_creation as $_ex_class_id) { if (!isset($ex_class_events["{$creation_context->_class}/{$_ex_class_id}"])) { continue; } $_ex_class_events = $ex_class_events["{$creation_context->_class}/{$_ex_class_id}"]; // TODO canCreateNew
*/ CCanDo::checkRead(); $praticien_id = CValue::getOrSession("praticien_id"); $function_id = CValue::getOrSession("function_id"); $filter = new COperation(); $filter->_date_min = CValue::getOrSession("_date_min", CMbDT::date("-7 day")); $filter->_date_max = CValue::getOrSession("_date_max", CMbDT::date()); $blocs = CGroups::loadCurrent()->loadBlocs(PERM_READ, null, "nom"); $bloc_id = CValue::getOrSession("bloc_id", reset($blocs)->_id); $bloc = new CBlocOperatoire(); $bloc->load($bloc_id); // Récupération des opérations $ljoin = array(); $ljoin["plagesop"] = "operations.plageop_id = plagesop.plageop_id"; $salles = $bloc->loadRefsSalles(); CStoredObject::filterByPerm($salles, PERM_READ); $in_salles = CSQLDataSource::prepareIn(array_keys($salles)); $where = array(); $where[] = "plagesop.salle_id {$in_salles} OR operations.salle_id {$in_salles}"; $where["materiel"] = "!= ''"; $where["operations.date"] = "BETWEEN '{$filter->_date_min}' AND '{$filter->_date_max}'"; if ($praticien_id) { $where["operations.chir_id"] = " = '{$praticien_id}'"; } elseif ($function_id) { $mediuser = new CMediusers(); $users = $mediuser->loadProfessionnelDeSante(PERM_READ, $function_id); $where["operations.chir_id"] = CSQLDataSource::prepareIn(array_keys($users)); } $order = "operations.date, rank"; $operation = new COperation(); $ops = $operation->loadList($where, $order, null, null, $ljoin);
/** * Ajoute les données des graphiques de supervision * * @param CTemplateManager $template The template manager * @param CMbObject $object The host object * @param string $name The field name * * @return void */ static function addObservationDataToTemplate(CTemplateManager $template, CMbObject $object, $name) { $prefix = "Supervision"; $group_id = CGroups::loadCurrent()->_id; $results = array(); $times = array(); if ($object->_id) { list($results, $times) = CObservationResultSet::getResultsFor($object, false); $times = array_combine($times, $times); } // CSupervisionGraphAxis $axis = new CSupervisionGraphAxis(); $ds = $axis->getDS(); $where = array("supervision_graph_axis.in_doc_template" => "= '1'", "supervision_graph.owner_class" => "= 'CGroups'", "supervision_graph.owner_id" => $ds->prepare("= ?", $group_id)); $ljoin = array("supervision_graph" => "supervision_graph.supervision_graph_id = supervision_graph_axis.supervision_graph_id"); $order = array("supervision_graph.title", "supervision_graph_axis.title"); /** @var CSupervisionGraphAxis[] $axes */ $axes = $axis->loadList($where, $order, null, null, $ljoin); CStoredObject::massLoadFwdRef($axes, "supervision_graph_id", null, true); foreach ($axes as $_axis) { $_graph = $_axis->loadRefGraph(); $_series = $_axis->loadRefsSeries(); $_axis->loadRefsLabels(); $_data = array_fill_keys($times, array()); foreach ($_series as $_serie) { $_unit_id = $_serie->value_unit_id ?: "none"; $_unit_label = $_serie->loadRefValueUnit(); if (!isset($results[$_serie->value_type_id][$_unit_id])) { continue; } foreach ($results[$_serie->value_type_id][$_unit_id] as $_value) { foreach ($times as $_time) { if ($_value["datetime"] != $_time) { continue; } $_value["unit"] = $_unit_label->label; $_data["{$_time}"][$_serie->_id] = $_value; break; } } } $view = ""; if (count($_data)) { $smarty = new CSmartyDP("modules/dPsalleOp"); $smarty->assign("data", $_data); $smarty->assign("series", $_series); $smarty->assign("times", $times); $view = $smarty->fetch("inc_print_observation_result_set.tpl", '', '', 0); $view = preg_replace('`([\\n\\r])`', '', $view); } $template->addProperty("{$name} - {$prefix} - {$_graph->title} - {$_axis->title}", trim($view), "", false); } // CSupervisionTimedPicture // CSupervisionTimedData $data = array("CSupervisionTimedPicture", "CSupervisionTimedData"); foreach ($data as $_class) { /** @var CSupervisionTimedPicture|CSupervisionTimedData $_object */ $_object = new $_class(); $_table = $_object->_spec->table; $_ds = $_object->getDS(); $where = array("{$_table}.in_doc_template" => "= '1'", "{$_table}.owner_class" => "= 'CGroups'", "{$_table}.owner_id" => $_ds->prepare("= ?", $group_id)); $order = "title"; /** @var CSupervisionTimedPicture[]|CSupervisionTimedData[] $_objects */ $_objects = $_object->loadList($where, $order); foreach ($_objects as $_timed) { $_data = array_fill_keys($times, null); if (!isset($results[$_timed->value_type_id])) { continue; } foreach ($results[$_timed->value_type_id]["none"] as $_value) { foreach ($times as $_time) { if ($_value["datetime"] != $_time) { continue; } if ($_value["file_id"]) { $_file = new CFile(); $_file->load($_value["file_id"]); $_value["datauri"] = $_file->getDataURI(); $_value["file"] = $_file; } $_data["{$_time}"] = $_value; break; } } $view = ""; if (count($_data)) { $smarty = new CSmartyDP("modules/dPsalleOp"); $smarty->assign("data", $_data); $smarty->assign("times", $times); $smarty->assign("timed_data", true); $view = $smarty->fetch("inc_print_observation_result_set.tpl", '', '', 0); $view = preg_replace('`([\\n\\r])`', '', $view); } $template->addProperty("{$name} - {$prefix} - {$_timed->title}", trim($view), "", false); } } }
* $Id$ * * @package Mediboard * @subpackage dPpatients * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CSessionHandler::writeClose(); $const = new CConstantesMedicales(); $perms = $const->canDo(); if (!$perms->read) { $perms->redirect(); } $context_guid = CValue::get('context_guid'); $context = CStoredObject::loadFromGuid($context_guid); $ranks = CConstantesMedicales::getConstantsByRank('graph', false, CConstantesMedicales::guessHost($context)); $list_cste = array(); $list_cumul = array(); $cste_nb = 0; $cumul_nb = 0; if (array_key_exists(1, $ranks['all'])) { /* We only display constants with rank 1 */ foreach ($ranks['all'][1] as $_cste) { if (substr($_cste, 0, 1) === "_") { continue; } /* We display at most 4 graph with cumuled constants */ if (isset(CConstantesMedicales::$list_constantes[$_cste]['cumul_reset_config'])) { if ($cumul_nb < 4) { $list_cumul[] = $_cste;
/** @var CSejour[] $sejours */ $sejours = $sejour->loadList($where, $order, null, null, $ljoin); $patients = CStoredObject::massLoadFwdRef($sejours, "patient_id"); CStoredObject::massLoadFwdRef($sejours, "etablissement_sortie_id"); CStoredObject::massLoadFwdRef($sejours, "service_sortie_id"); $praticiens = CStoredObject::massLoadFwdRef($sejours, "praticien_id"); $functions = CStoredObject::massLoadFwdRef($praticiens, "function_id"); CStoredObject::massLoadBackRefs($sejours, "affectations"); // Chargement optimisée des prestations CSejour::massCountPrestationSouhaitees($sejours); CStoredObject::massLoadBackRefs($sejours, "notes"); CStoredObject::massLoadBackRefs($patients, "dossier_medical"); $operations = CStoredObject::massLoadBackRefs($sejours, "operations", "date ASC", array("annulee" => "= '0'")); CStoredObject::massLoadBackRefs($operations, "actes_ngap", "lettre_cle DESC"); $order = "code_association, code_acte,code_activite, code_phase, acte_id"; CStoredObject::massLoadBackRefs($operations, "actes_ccam", $order); // Chargement des NDA CSejour::massLoadNDA($sejours); // Chargement des IPP CPatient::massLoadIPP($patients); $maternite_active = CModule::getActive("maternite"); foreach ($sejours as $sejour_id => $_sejour) { // Filtre sur la fonction du praticien $praticien = $_sejour->loadRefPraticien(1); if ($filterFunction && $filterFunction != $praticien->function_id) { unset($sejours[$sejour_id]); continue; } // Chargement du patient $_sejour->loadRefPatient(); // Chargements des notes sur le séjour
$error_logs[] = $error_log; $user_ids = array_merge($user_ids, $error_log->_similar_user_ids); $list_ids = array_merge($list_ids, $error_log->_similar_ids); } // Load users for similar groupings $user_ids = array_unique($user_ids); $user = new CUser(); $users = $user->loadAll($user_ids); } else { $total = $error_log->countList($where); $error_logs = $error_log->loadList($where, $order, $limit, $groupby); $list_ids = CMbArray::pluck($error_logs, "_id"); $users = CStoredObject::massLoadFwdRef($error_logs, "user_id"); } // Get all data CStoredObject::massLoadFwdRef($error_logs, "stacktrace_id"); CStoredObject::massLoadFwdRef($error_logs, "param_GET_id"); CStoredObject::massLoadFwdRef($error_logs, "param_POST_id"); CStoredObject::massLoadFwdRef($error_logs, "session_data_id"); foreach ($error_logs as $_error_log) { $_error_log->loadComplete(); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("error_logs", $error_logs); $smarty->assign("list_ids", $list_ids); $smarty->assign("total", $total); $smarty->assign("start", $start); $smarty->assign("users", $users); $smarty->assign("group_similar", $group_similar); $smarty->display('inc_list_error_logs.tpl');
/** * Load blocs operatoires with given permission * * @param int $permType Permission level * @param bool $load_salles Load salles * @param string $order Ordre de chargmeent SQL * @param array $where SQL WHERE parameters * * @return CBlocOperatoire[] */ function loadBlocs($permType = PERM_READ, $load_salles = true, $order = "nom", $where = array()) { $bloc = new CBlocOperatoire(); $whereGroup = array('group_id' => "= '{$this->_id}'"); $where = array_merge($where, $whereGroup); /** @var CBlocOperatoire[] $blocs */ $blocs = $bloc->loadListWithPerms($permType, $where, $order); if ($load_salles) { CStoredObject::massLoadBackRefs($blocs, "salles", "nom"); foreach ($blocs as $_bloc) { $_bloc->loadRefsSalles(); } } return $this->_ref_blocs = $blocs; }
foreach ($consultations as $_consultation) { if ($_consultation->sejour_id != $_sejour->_id) { continue; } if ($_consultation->type == "entree") { continue; } $_consultation->loadRefPraticien()->loadRefFunction(); $patients_offline[$patient->_guid]["consultations"][$_consultation->_ref_chir->function_id] = $_consultation; } array_multisort(CMbArray::pluck($patients_offline[$patient->_guid]["consultations"], "_datetime"), SORT_DESC, $patients_offline[$patient->_guid]["consultations"]); // Constantes $patients_offline[$patient->_guid]["constantes"] = ""; $cstes = array_reverse($_sejour->loadListConstantesMedicales($where_cste)); if (count($cstes)) { CStoredObject::massLoadFwdRef($cstes, "user_id"); foreach ($cstes as $_cste) { $_cste->loadRefUser(); } $smarty_cstes->assign("constantes_medicales_grid", CConstantesMedicales::buildGrid($cstes, false)); $smarty_cstes->assign("sejour", $_sejour); $patients_offline[$patient->_guid]["constantes"] = $smarty_cstes->fetch("print_constantes.tpl", '', '', 0); } // Plan de soins $page_break = 0; if (count($patients_offline[$patient->_guid]["transmissions"]) || count($patients_offline[$patient->_guid]["observations"]) || count($patients_offline[$patient->_guid]["consultations"]) || $patients_offline[$patient->_guid]["constantes"]) { $page_break = 1; } $params = array("sejours_ids" => $_sejour->_id, "date" => $date, "hours_before" => "2", "hours_after" => "2", "empty_lines" => "2", "dialog" => 1, "mode_lite" => 1, "page_break" => $page_break); $patients_offline[$patient->_guid]["plan_soins"] = CApp::fetch("soins", "offline_plan_soins", $params); // Pour IE9 qui a des soucis avec les espaces entre une fermeture et une ouverture de td
if (!is_dir($directory)) { CAppUI::stepAjax("'%s' is not a directory", UI_MSG_WARNING, $directory); return; } if ($files_directory && !is_dir($files_directory)) { CAppUI::stepAjax("'%s' is not a directory", UI_MSG_WARNING, $files_directory); return; } $directory = str_replace("\\\\", "\\", $directory); $files_directory = str_replace("\\\\", "\\", $files_directory); CValue::setSession("step", $step); CValue::setSession("start", $start); CValue::setSession("directory", $directory); CValue::setSession("files_directory", $files_directory); $step = min($step, 1000); CStoredObject::$useObjectCache = false; // Import ... $iterator = new DirectoryIterator($directory); $count_dirs = 0; $i = 0; foreach ($iterator as $_fileinfo) { if ($_fileinfo->isDot()) { continue; } if ($_fileinfo->isDir() && strpos($_fileinfo->getFilename(), "CPatient-") === 0) { $i++; if ($i <= $start) { continue; } if ($i > $start + $step) { break;
$plageSel->loadRefChir(); $plageSel->loadRefRemplacant(); $plageSel->loadRefPourCompte(); $plageSel->loadRefsNotes(); $plageSel->loadRefsBack($show_annulees, true, $show_payees); if ($plageSel->_affected && count($plageSel->_ref_consultations)) { $firstconsult = reset($plageSel->_ref_consultations); $_firstconsult_time = substr($firstconsult->heure, 0, 5); $lastconsult = end($plageSel->_ref_consultations); $_lastconsult_time = substr($lastconsult->heure, 0, 5); } $consults = $plageSel->_ref_consultations; CStoredObject::massLoadFwdRef($consults, "sejour_id"); $patients = CMbObject::massLoadFwdRef($consults, "patient_id"); CStoredObject::massCountBackRefs($patients, "notes"); CStoredObject::massLoadFwdRef($consults, "categorie_id"); // Détails sur les consultation affichées foreach ($plageSel->_ref_consultations as $keyConsult => &$consultation) { $consultation->_ref_plageconsult = $plageSel; $consultation->loadRefSejour(); $consultation->loadRefPatient()->loadRefsNotes(); $consultation->loadRefCategorie(); $consultation->countDocItems(); $consultation->_view = "Consult. de " . $consultation->_ref_patient->_view; $consultation->_view .= " (" . CMbDT::format($plageSel->date, "%d/%m/%Y") . ")"; //check 3333tel if (CModule::getActive("3333tel")) { C3333TelTools::checkConsults($consultation, $plageSel->_ref_chir->function_id); } } if ($plageSel->chir_id != $chirSel && $plageSel->remplacant_id != $chirSel && $plageSel->pour_compte_id != $chirSel) {
if (CAppUI::conf("dPhospi vue_temporelle show_imc_patient", "CService-" . $_affectation_imc->service_id)) { $_affectation_imc->loadRefSejour()->loadRefPatient()->loadRefLatestConstantes(null, array("poids", "taille")); } } // Préchargement des users $user = new CUser(); $where = array("user_id" => CSQLDataSource::prepareIn(CMbArray::pluck($_sejours, "praticien_id"))); $users = $user->loadList($where); $praticiens = CStoredObject::massLoadFwdRef($_sejours, "praticien_id"); CStoredObject::massLoadFwdRef($praticiens, "function_id"); CStoredObject::massCountBackRefs($affectations, "affectations_enfant"); $_operations = CStoredObject::massLoadBackRefs($sejours, "operations", "date ASC"); CStoredObject::massLoadFwdRef($_operations, "plageop_id"); loadVueTempo($sejours, $suivi_affectation, null, $operations, $date_min, $date_max, $period, $prestation_id, $functions_filter, $filter_function, $sejours_non_affectes); if (CAppUI::conf("dPadmissions show_deficience")) { CStoredObject::massLoadBackRefs($patients, "dossier_medical"); $dossiers = CMbArray::pluck($sejours, "_ref_patient", "_ref_dossier_medical"); CDossierMedical::massCountAntecedentsByType($dossiers, "deficience"); } loadVueTempo($affectations, $suivi_affectation, null, $operations, $date_min, $date_max, $period, $prestation_id, $functions_filter, $filter_function, $sejours_non_affectes); if (count($affectations) && CAppUI::conf("dPadmissions show_deficience")) { $dossiers = CMbArray::pluck($affectations, "_ref_sejour", "_ref_patient", "_ref_dossier_medical"); CDossierMedical::massCountAntecedentsByType($dossiers, "deficience"); } ksort($sejours_non_affectes, SORT_STRING); $_sejour = new CSejour(); $_sejour->_type_admission = $_type_admission; $smarty = new CSmartyDP(); $smarty->assign("sejours_non_affectes", $sejours_non_affectes); $smarty->assign("_sejour", $_sejour); $smarty->assign("triAdm", $triAdm);
*/ CCanDo::checkRead(); $date = CValue::get("date", CMbDT::date()); $group = CGroups::loadCurrent(); $date_min = CMbDT::date("-" . CAppUI::conf("maternite CGrossesse min_check_terme", $group) . " DAYS", $date); $date_max = CMbDT::date("+" . CAppUI::conf("maternite CGrossesse max_check_terme", $group) . " DAYS", $date); $where = array(); $ljoin = array(); $where["grossesse.terme_prevu"] = "BETWEEN '{$date_min}' AND '{$date_max}'"; $where["grossesse.group_id"] = "= '{$group->_id}' "; $where["grossesse.active"] = "= '1'"; $ljoin["patients"] = "patients.patient_id = grossesse.parturiente_id"; $grossesse = new CGrossesse(); /** @var CStoredObject[] $grossesses */ $grossesses = $grossesse->loadList($where, "terme_prevu ASC, nom ASC", null, null, $ljoin); CStoredObject::massLoadFwdRef($grossesses, "parturiente_id"); CStoredObject::massCountBackRefs($grossesses, "sejours"); $consultations = CStoredObject::massLoadBackRefs($grossesses, "consultations"); CStoredObject::massLoadFwdRef($consultations, "plageconsult_id"); /** @var CGrossesse[] $grossesses */ foreach ($grossesses as $_grossesse) { $_grossesse->loadRefParturiente(); $_grossesse->countRefSejours(); $_grossesse->loadRefsConsultations(true); } $smarty = new CSmartyDP(); $smarty->assign("grossesses", $grossesses); $smarty->assign("date", $date); $smarty->assign("date_min", $date_min); $smarty->assign("date_max", $date_max); $smarty->display("inc_tdb_grossesses.tpl");
* @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 27681 $ */ CCanDo::checkRead(); $object_guid = CValue::get("object_guid"); $pack_id = CValue::get("pack_id"); $result_set_id = CValue::get("result_set_id"); $result_id = CValue::get("result_id"); $result_set = new CObservationResultSet(); if ($result_set_id) { $result_set->load($result_set_id); $object = $result_set->loadRefContext(); } else { /** @var COperation|CSejour $object */ $object = CStoredObject::loadFromGuid($object_guid); $result_set->context_class = $object->_class; $result_set->context_id = $object->_id; $result_set->datetime = CMbDT::dateTime(); $result_set->patient_id = $object->loadRelPatient()->_id; } list($results) = CObservationResultSet::getResultsFor($object); $pack = new CSupervisionGraphPack(); $pack->load($pack_id); $links = $pack->loadRefsGraphLinks(); foreach ($links as $_link) { $_graph = $_link->loadRefGraph(); if ($_graph instanceof CSupervisionGraph) { $axes = $_graph->loadRefsAxes(); foreach ($axes as $_axis) { $series = $_axis->loadRefsSeries();
/** * Internal DOM export method * * @param CStoredObject $object Object to export * @param int $depth Export depth * * @return void */ private function _toDOM(CStoredObject $object, $depth) { if ($depth == 0 || !$object->_id || !$object->getPerm(PERM_READ)) { return; } $doc = $this->doc; $object_node = $doc->getElementById($object->_guid); // Objet deja exporté if ($object_node) { return; } $object_node = $doc->createElement("object"); $object_node->setAttribute('class', $object->_class); $object_node->setAttribute('id', $object->_guid); $object_node->setIdAttribute('id', true); $doc->documentElement->appendChild($object_node); $db_fields = $object->getPlainFields(); foreach ($db_fields as $key => $value) { // Forward Refs Fields $_fwd_spec = $object->_specs[$key]; if ($_fwd_spec instanceof CRefSpec) { if ($key === $object->_spec->key && $object->_specs[$key]->className !== $object->_class) { continue; } if (!isset($this->fwdrefs_tree[$object->_class]) || !in_array($key, $this->fwdrefs_tree[$object->_class])) { continue; } $object->loadFwdRef($key); $guid = ""; $_object = $object->_fwd[$key]; if ($_object && $_object->_id) { $this->_toDOM($_object, $depth - 1); $guid = $_object->_guid; } if ($this->empty_values || $guid) { $object_node->setAttribute($key, $guid); //$doc->insertTextElement($object_node, "field", $id, array("name" => $key)); } } else { $value = self::trimString($value); if ($this->empty_values || $value !== "") { $doc->insertTextElement($object_node, "field", $value, array("name" => $key)); } } } if ($this->object_callback && is_callable($this->object_callback)) { call_user_func($this->object_callback, $object, $object_node, $depth); } // Collections if (!isset($this->backrefs_tree[$object->_class])) { return; } foreach ($object->_backProps as $backName => $backProp) { if (!in_array($backName, $this->backrefs_tree[$object->_class])) { continue; } $_backspec = $object->makeBackSpec($backName); // Add fwd ref field value for each object in the collection if ($_backspec) { $_class = $_backspec->class; if (!isset($this->fwdrefs_tree[$_class])) { $this->fwdrefs_tree[$_class] = array(); } if (!array_key_exists($_backspec->field, $this->fwdrefs_tree[$_class])) { $this->fwdrefs_tree[$_class][] = $_backspec->field; } } $objects = $object->loadBackRefs($backName); if ($objects) { foreach ($objects as $_object) { $this->_toDOM($_object, $depth - 1); } } } }
if ($praticien->isAnesth()) { $ljoin = array(); $ljoin["operations"] = "operations.sejour_id = sejour.sejour_id"; $ljoin["plagesop"] = "operations.plageop_id = plagesop.plageop_id"; $where[] = "operations.anesth_id = '{$chirSel}' OR (operations.anesth_id IS NULL AND plagesop.anesth_id = '{$chirSel}')"; } else { $where["sejour.praticien_id"] = "= '{$chirSel}'"; } $where["sejour.entree"] = "<= '{$date} 23:59:59'"; $where["sejour.sortie"] = ">= '{$date} 00:00:00'"; $where["sejour.annule"] = "= '0'"; $where["sejour.group_id"] = "= '" . CGroups::loadCurrent()->_id . "'"; $sejour = new CSejour(); /** @var CSejour[] $listSejours */ $listSejours = $sejour->loadList($where, null, null, null, $ljoin); CStoredObject::massLoadFwdRef($listSejours, "patient_id"); foreach ($listSejours as $_sejour) { $_sejour->loadRefPraticien(); $_sejour->loadRefPatient(); $_sejour->loadRefsOperations(); $_sejour->loadRefCurrAffectation("{$date} " . CMbDT::time()); $_sejour->_ref_curr_affectation->loadRefLit(); $_sejour->_ref_curr_affectation->_ref_lit->loadCompleteView(); } $lits = CMbArray::pluck($listSejours, "_ref_curr_affectation", "_ref_lit"); $sorter_chambre = CMbArray::pluck($lits, "_ref_chambre", "_view"); $sorter_service = CMbArray::pluck($lits, "_ref_chambre", "_ref_service", "_view"); $sorter_lit = CMbArray::pluck($lits, "_view"); $sorter_sejour_sortie = CMbArray::pluck($listSejours, "sortie"); $sorter_sejour_entree = CMbArray::pluck($listSejours, "entree"); array_multisort($sorter_service, SORT_ASC, $sorter_chambre, SORT_ASC, $sorter_lit, SORT_ASC, $sorter_sejour_sortie, SORT_ASC, $sorter_sejour_entree, SORT_DESC, $listSejours);
$whereUrg["service.service_id"] = "IS NULL"; $listInterv["ambu"]["non_place"] = $interv->loadList($whereAmbu, $order, null, null, $ljoin); $listInterv["comp"]["non_place"] = $interv->loadList($whereHospi, $order, null, null, $ljoin); $listInterv["hors_plage"]["non_place"] = $interv->loadList($whereUrg, $order, null, null, $ljoin); $allInterv = array_merge($allInterv, $listInterv["ambu"]["non_place"]); $allInterv = array_merge($allInterv, $listInterv["comp"]["non_place"]); $allInterv = array_merge($allInterv, $listInterv["hors_plage"]["non_place"]); $count_ops["ambu"] += count($listInterv["ambu"]["non_place"]); $count_ops["comp"] += count($listInterv["comp"]["non_place"]); $count_ops["hors_plage"] += count($listInterv["hors_plage"]["non_place"]); // Complétion du chargement $chirs = CStoredObject::massLoadFwdRef($allInterv, "chir_id"); $functions = CStoredObject::massLoadFwdRef($chirs, "function_id"); $plages = CStoredObject::massLoadFwdRef($allInterv, "plageop_id"); $sejours = CStoredObject::massLoadFwdRef($allInterv, "sejour_id"); $patients = CStoredObject::massLoadFwdRef($sejours, "patient_id"); foreach ($allInterv as $_interv) { $_interv->loadRefAffectation(); $_interv->loadRefChir()->loadRefFunction(); $_interv->loadRefPatient()->loadRefLatestConstantes(null, array("poids", "taille")); $_interv->loadRefVisiteAnesth()->loadRefFunction(); $_interv->loadRefsConsultAnesth()->loadRefConsultation()->loadRefPraticien()->loadRefFunction(); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("date", $date); $smarty->assign("listPrat", $listPrat); $smarty->assign("listInterv", $listInterv); $smarty->assign("services", $services); $smarty->assign("selPrat", $selPrat); $smarty->assign("canceled", $canceled);
* @package Mediboard * @subpackage Patients * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ $salutation_id = CValue::get('salutation_id'); $object_class = CValue::get('object_class'); $object_id = CValue::get('object_id'); $salutation = new CSalutation(); $salutation->load($salutation_id); if (!$salutation_id) { if (!$object_class || !in_array('CStoredObject', class_parents($object_class))) { CAppUI::stepAjax('common-error-Invalid class name', UI_MSG_ERROR); } $object = CStoredObject::loadFromGuid("{$object_class}-{$object_id}"); if (!$object || !$object->_id) { CAppUI::stepAjax('common-error-Invalid object', UI_MSG_ERROR); } $salutation->owner_id = CMediusers::get()->_id; $salutation->object_class = $object_class; $salutation->object_id = $object_id; } $salutation->loadRefOwner(); $salutation->loadTargetObject(); $users = new CMediusers(); $users = $users->loadListWithPerms(PERM_EDIT, array('actif' => "= '1'")); $smarty = new CSmartyDP(); $smarty->assign("salutation", $salutation); $smarty->assign("object_class", $object_class); $smarty->display("vw_edit_salutation.tpl");
/** * @return CAffectationUniteFonctionnelle[] */ function loadRefAffectationsUF() { /** @var CAffectationUniteFonctionnelle[] $affectations_uf */ $affectations_uf = $this->loadBackRefs("ufs"); CStoredObject::massLoadFwdRef($affectations_uf, "uf_id"); foreach ($affectations_uf as $_aff_uf) { $_aff_uf->loadRefUniteFonctionnelle(); } return $this->_ref_affectations_uf = $affectations_uf; }
$file_class = CValue::get("object_class"); $destination_guid = CValue::get("destination_guid"); $name = CValue::get("file_name"); $category_id = CValue::get("category_id"); $allowed = array("CFile", "CCompteRendu"); if (!in_array($file_class, $allowed)) { CAppUI::stepAjax("CFile-msg-not_allowed_object_to_move", UI_MSG_ERROR); } /** @var CFile|CCompteRendu $file */ $file = new $file_class(); $file->load($file_id); $file->file_category_id = $category_id && $category_id != $file->file_category_id ? $category_id : $file->file_category_id; if ($file instanceof CFile) { $file->file_name = $name ? $name : $file->file_name; } $destination = CStoredObject::loadFromGuid($destination_guid); if ($file->object_id == $destination->_id && $file->object_class == $destination->_class) { CAppUI::stepAjax("CFile-msg-from_equal_to", UI_MSG_ERROR); } $file->setObject($destination); // check category $cat = new CFilesCategory(); $cat->load($file->file_category_id); if ($cat->class && $cat->class != $destination->_class) { $file->file_category_id = ""; } if ($msg = $file->store()) { CAppUI::setMsg($msg, UI_MSG_ERROR); } else { CAppUI::setMsg("CFile-msg-moved"); }
/** * Clears the internal CMbObject cache * * @return void */ public function clearCache() { self::$objectCount = 0; self::$cachableCounts = array(); self::$objectCache = array(); }