$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;
$services = $services + CStoredObject::massLoadFwdRef($affectations, "service_id"); $patients = CStoredObject::massLoadFwdRef($_sejours, "patient_id"); CPatient::massCountPhotoIdentite($patients); foreach ($affectations as $_affectation_imc) { /* @var CAffectation $_affectation_imc*/ 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();
$where[] = $where_chir; } } /** @var COperation[] $interventions */ $operation = new COperation(); if (!$interv_with_no_codes) { $where[] = "LENGTH(codes_ccam) > 0"; } $interventions = $operation->loadList($where, null, null, null, $ljoin); $totals["interventions"] = count($interventions); $where = array(); if (!$all_prats) { //$where["executant_id"] = "= '$user->_id'"; $where["code_activite"] = $user->_is_anesth ? "= '4'" : "!= '4'"; } CStoredObject::massCountBackRefs($interventions, "actes_ccam", $where); // Préparation des interventions CDatedCodeCCAM::$cache_layers = Cache::INNER_OUTER; foreach ($interventions as $key => $_interv) { $_interv->loadExtCodesCCAM(); } foreach ($interventions as $key => $_interv) { $codes_ccam = $_interv->_ext_codes_ccam; // Nombre d'acte cotés par le praticien et réinitialisation du count pour le cache $nb_actes_ccam = $_interv->_count["actes_ccam"]; $_interv->_count["actes_ccam"] = null; // Aucun acte prévu ou coté if (!count($codes_ccam) && !$_interv->_count_actes) { continue; } // Actes prévus restant en suspend
} $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); } }
*/ 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");
$ex_object->setFieldsDisplay($all_fields); $ex_object->loadRefAdditionalObject(); // depends on setReferenceObject_1 and setReferenceObject_2 $ex_object->loadNativeViews($ex_class_event); /** @var CExClassField[] $fields */ $fields = array(); foreach ($groups as $_group) { $fields = array_merge($_group->_ref_fields, $fields); if ($_group->_ref_host_fields) { foreach ($_group->_ref_host_fields as $_host_field) { $_host_field->getHostObject($ex_object); } } } CStoredObject::massLoadFwdRef($fields, "concept_id"); CStoredObject::massCountBackRefs($fields, "ex_triggers"); foreach ($fields as $_field) { $_field->loadTriggeredData(); } $ex_object->_rel_patient = null; if (in_array("IPatientRelated", class_implements($ex_object->object_class))) { if ($ex_object->_ref_object->_id) { $rel_patient = $ex_object->_ref_object->loadRelPatient(); $rel_patient->loadIPP(); } else { $rel_patient = new CPatient(); if ($preview) { $rel_patient->_view = "Patient exemple"; $rel_patient->_IPP = "0123456"; $ex_object->_ref_object->_view = CAppUI::tr($ex_object->_ref_object->_class) . " test"; }
break; default: $where["affectation.entree"] = "<= '{$datetime_max}'"; $where["affectation.sortie"] = ">= '{$datetime_min}'"; $where["affectation.service_id"] = " = '{$service_id}'"; } $patients_offline = array(); /** @var CSejour[] $sejours */ $sejours = $sejour->loadList($where, null, null, "sejour.sejour_id", $ljoin); CSejour::massLoadSurrAffectation($sejours, $datetime_avg); CSejour::massLoadCurrAffectation($sejours, $datetime_avg, $service_id); CSejour::massLoadNDA($sejours); /** @var CPatient[] $patients */ $patients = CStoredObject::massLoadFwdRef($sejours, "patient_id"); CPatient::massLoadIPP($patients); CStoredObject::massCountBackRefs($sejours, "operations"); // Recherche de transmissions // observations // consultations $datetime_delta = CMbDT::date("-3 days", $datetime_avg); $sejours_ids = CMbArray::pluck($sejours, "_id"); $where = array("sejour_id" => CSQLDataSource::prepareIn($sejours_ids)); // Transmissions $whereTrans = $where; $whereTrans["libelle_atc"] = "IS NOT NULL"; $whereTrans["date"] = "BETWEEN '{$datetime_delta}' AND '{$datetime_avg}'"; $transmission = new CTransmissionMedicale(); $transmissions = $transmission->loadList($whereTrans, "date"); $whereTrans = $where; $whereTrans["date"] = "BETWEEN '{$datetime_delta}' AND '{$datetime_avg}'"; $whereTrans["object_id"] = "IS NOT NULL"; $transmission = new CTransmissionMedicale(); $transmissions = array_merge($transmissions, $transmission->loadList($whereTrans, "date"));
if ($max_date) { $where[] = $ds->prepare("`datetime_login` <= %", $max_date); } $where["platform_name"] = $ds->prepare("!= 'unknown'"); $total = $ua->countMultipleList($where, null, "`user_agent`.`user_agent_id`", $ljoin); $total = count($total); $browsers = $ua->countMultipleList($where, null, "browser_name", $ljoin, "browser_name"); $versions = $ua->countMultipleList($where, null, "browser_name, browser_version", $ljoin, "browser_name, browser_version"); $platforms = $ua->countMultipleList($where, null, "platform_name", $ljoin, "platform_name"); $devices = $ua->countMultipleList($where, null, "device_type", $ljoin, "device_type"); $screens = $ua->countMultipleList($where, null, "screen_width", $ljoin, "screen_width"); $methods = $ua->countMultipleList($where, null, "pointing_method", $ljoin, "pointing_method"); //$connections = $auth->countMultipleList($where, null, "DATE_FORMAT(`datetime_login`, '%Y-%m-%d')", null, "DATE_FORMAT(`datetime_login`, '%Y-%m-%d') as datetime_login"); $graphs = array(); $graphs[] = CUserAgentGraph::getBrowserNameSeries($browsers); $graphs[] = CUserAgentGraph::getPlatformNameSeries($platforms); $graphs[] = CUserAgentGraph::getDeviceTypeSeries($devices); $graphs[] = CUserAgentGraph::getScreenSizeSeries($screens); $graphs[] = CUserAgentGraph::getPointingMethodSeries($methods); $graphs[] = CUserAgentGraph::getBrowserVersionSeries($versions); //$graphs[] = CUserAgentGraph::getNbConnectionsSeries($connections); // To get them in the list unset($where["platform_name"]); $uas = $ua->loadList($where, "browser_name, browser_version", "{$start}, 50", "`user_agent`.`user_agent_id`", $ljoin); CStoredObject::massCountBackRefs($uas, "user_authentications"); $smarty = new CSmartyDP(); $smarty->assign("graphs", $graphs); $smarty->assign("user_agents", $uas); $smarty->assign("total", $total); $smarty->assign("start", $start); $smarty->display("inc_vw_user_agents.tpl");
static function massCountNamed($objects, $name) { $where = array(); $where["file_name"] = " = '{$name}'"; CStoredObject::massCountBackRefs($objects, "files", $where, array(), "named_file_{$name}"); }
foreach ($affectations as $_affectation) { $_affectation->loadRefLit()->loadCompleteView(); $_affectation->_view = $_affectation->_ref_lit->_view; $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()); }
} if ($order_col == "praticien_id") { $order = "users.user_last_name {$order_way}, users.user_first_name"; } /** @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::massCountBackRefs($sejours, "notes"); CStoredObject::massCountBackRefs($patients, "dossier_medical"); $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(1)->loadIPP(); // Chargment du numéro de dossier $_sejour->loadNDA(); // Chargements des notes sur le séjour $_sejour->loadRefsNotes(); // Chargement des prestations
* @package Mediboard * @subpackage Hospi * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ $sejour_id = CValue::get("sejour_id"); $transmission = new CTransmissionMedicale(); $where = array("sejour_id" => "= '{$sejour_id}'"); $nb_trans_obs = $transmission->countList($where); $observation = new CObservationMedicale(); $nb_trans_obs += $observation->countList($where); $consultation = new CConsultation(); $where["annule"] = "= '0'"; $nb_trans_obs += $consultation->countList($where); unset($where["annule"]); // Compter les consultations d'anesthésie hors séjour $sejour = new CSejour(); $sejour->load($sejour_id); $patient = $sejour->loadRefPatient(); $consultations = $patient->loadRefsConsultations(array("annule" => "= '0'")); CStoredObject::massCountBackRefs($consultations, "consult_anesth"); foreach ($consultations as $_consult) { if ($_consult->_count["consult_anesth"]) { $nb_trans_obs++; } } $constantes = new CConstantesMedicales(); $where = array("context_class" => "= 'CSejour'", "context_id" => "= '{$sejour_id}'"); $nb_trans_obs += $constantes->countList($where); echo $nb_trans_obs;
/** * Build the grid * * @param int $w Grid width * @param int $h Grid height * @param bool $reduce Reduced the grid if it contains empty rows or empty columns * * @return array */ function getGrid($w = 4, $h = 40, $reduce = true) { $big_grid = array(); $big_out_of_grid = array(); $groups = $this->loadRefsGroups(true); $empty_cell = array("type" => null, "object" => null); foreach ($groups as $_ex_group) { $grid = array_fill(0, $h, array_fill(0, $w, $empty_cell)); $out_of_grid = array("field" => array(), "label" => array(), "message_title" => array(), "message_text" => array()); $_fields = $_ex_group->loadRefsFields(); CStoredObject::massCountBackRefs($_fields, "properties"); foreach ($_fields as $_ex_field) { $_ex_field->getSpecObject(); $_ex_field->getDefaultProperties(); $label_x = $_ex_field->coord_label_x; $label_y = $_ex_field->coord_label_y; $field_x = $_ex_field->coord_field_x; $field_y = $_ex_field->coord_field_y; // label if ($label_x === null || $label_y === null) { $out_of_grid["label"][$_ex_field->name] = $_ex_field; } else { $grid[$label_y][$label_x] = array("type" => "label", "object" => $_ex_field); } // field if ($field_x === null || $field_y === null) { $out_of_grid["field"][$_ex_field->name] = $_ex_field; } else { $grid[$field_y][$field_x] = array("type" => "field", "object" => $_ex_field); } } // Host fields $_host_fields = $_ex_group->loadRefsHostFields(); foreach ($_host_fields as $_host_field) { if ($_host_field->type) { continue; } $label_x = $_host_field->coord_label_x; $label_y = $_host_field->coord_label_y; $value_x = $_host_field->coord_value_x; $value_y = $_host_field->coord_value_y; // label if ($label_x !== null && $label_y !== null) { $grid[$label_y][$label_x] = array("type" => "label", "object" => $_host_field); } // value if ($value_x !== null && $value_y !== null) { $grid[$value_y][$value_x] = array("type" => "value", "object" => $_host_field); } } // Messages $_ex_messages = $_ex_group->loadRefsMessages(); CStoredObject::massCountBackRefs($_ex_messages, "properties"); foreach ($_ex_messages as $_message) { $_message->getDefaultProperties(); $title_x = $_message->coord_title_x; $title_y = $_message->coord_title_y; $text_x = $_message->coord_text_x; $text_y = $_message->coord_text_y; // label if ($title_x === null || $title_y === null) { $out_of_grid["message_title"][$_message->_id] = $_message; } else { $grid[$title_y][$title_x] = array("type" => "message_title", "object" => $_message); } // value if ($text_x === null || $text_y === null) { $out_of_grid["message_text"][$_message->_id] = $_message; } else { $grid[$text_y][$text_x] = array("type" => "message_text", "object" => $_message); } } if ($reduce) { $max_filled = 0; foreach ($grid as $_y => $_line) { $n_filled = 0; $x_filled = 0; foreach ($_line as $_x => $_cell) { if ($_cell !== $empty_cell) { $n_filled++; $x_filled = max($_x, $x_filled); } } if ($n_filled == 0) { unset($grid[$_y]); } $max_filled = max($max_filled, $x_filled); } if (empty($out_of_grid)) { foreach ($grid as $_y => $_line) { $grid[$_y] = array_slice($_line, 0, $max_filled + 1); } } } $big_grid[$_ex_group->_id] = $grid; $big_out_of_grid[$_ex_group->_id] = $out_of_grid; } return array($big_grid, $big_out_of_grid, $groups, "grid" => $big_grid, "out_of_grid" => $big_out_of_grid, "groups" => $groups); }
$func = new CFunctions(); $func->load($owner_id); $owners = array("func" => $func, "etab" => $func->loadRefGroup()); } else { $sec_func = $user->loadRefsSecondaryFunctions(); foreach ($sec_func as $_func) { $owners["func" . $_func->_id] = $_func; } } $modeles = CCompteRendu::loadAllModelesFor($owner_id, $owner, $filtre->object_class, $filtre->type, 1, $order); if ($filtre->function_id) { unset($modeles["prat"]); } foreach ($modeles as $key => &$_modeles) { /** @var $_modeles CStoredObject[] */ CStoredObject::massCountBackRefs($_modeles, "documents_generated"); /** @var $_modele CCompteRendu */ foreach ($_modeles as $_modele) { $_modele->canDo(); switch ($_modele->type) { case "body": $_modele->loadComponents(); break; case "header": $_modele->countBackRefs("modeles_headed", array("object_id" => "IS NULL")); break; case "footer": $_modele->countBackRefs("modeles_footed", array("object_id" => "IS NULL")); break; case "preface": $_modele->countBackRefs("modeles_prefaced");
$where = array(); $where["sejour_id"] = "IN ({$sejours_ids})"; $sejours = $sejour->loadList($where); /** @var CPatient[] $patients */ $patients = CStoredObject::massLoadFwdRef($sejours, "patient_id"); CStoredObject::massLoadFwdRef($sejours, "praticien_id"); /** @var $sejours CSejour[] */ foreach ($sejours as $_sejour) { $_sejour->loadRefPatient(); $_sejour->loadRefPraticien(); } CSejour::massLoadNDA($sejours); CPatient::massLoadIPP($patients); CStoredObject::massCountBackRefs($sejours, "affectations"); CStoredObject::massCountBackRefs($sejours, "consultations"); CStoredObject::massCountBackRefs($sejours, "files"); // Tri par nom de patient $sorter = CMbArray::pluck($sejours, "_ref_patient", "nom"); array_multisort($sorter, SORT_ASC, $sejours); // Chargement du modèle $modele = new CCompteRendu(); $modele->load($modele_id); $modele->loadContent(); $source = $modele->generateDocFromModel(); $nbDoc = array(); foreach ($sejours as $_sejour) { $compte_rendu = new CCompteRendu(); $compte_rendu->setObject($_sejour); $compte_rendu->nom = $modele->nom; $compte_rendu->modele_id = $modele->_id; $compte_rendu->margin_top = $modele->margin_top;
/** * Comptage de masse des prestations souhaitées pour une collection de séjours * * @param CSejour[] $sejours Collection * * @return void */ static function massCountPrestationSouhaitees($sejours) { $where["item_souhait_id"] = "IS NOT NULL"; CStoredObject::massCountBackRefs($sejours, "items_liaisons", $where); }