} // Reglements via les factures de consultation $where["cloture"] = "IS NOT NULL"; $where["patient_id"] = "IS NOT NULL"; $order = "ouverture, praticien_id"; $facture = new CFactureCabinet(); if ($all_group_money) { $listFactures = $facture->loadList($where, $order, null, null, $ljoin); } else { $listFactures = $facture->loadGroupList($where, $order, null, null, $ljoin); } $listPlages = array(); CMbObject::massLoadFwdRef($listFactures, "praticien_id"); CMbObject::massLoadFwdRef($listFactures, "patient_id"); CMbObject::massCountBackRefs($listFactures, "reglements"); CMbObject::massCountBackRefs($listFactures, "notes"); foreach ($listFactures as $_facture) { /* @var CFactureCabinet $_facture */ $_facture->loadRefGroup(); $_facture->loadRefPatient(); $_facture->loadRefPraticien(); $_facture->loadRefsConsultation(); if (count($_facture->_ref_consults)) { $_facture->loadRefCoeffFacture(); $_facture->updateMontants(); $_facture->loadRefsReglements(); $_facture->loadRefsNotes(); if ($all_impayes) { $_facture->loadRefsRelances(); } // Ajout de reglements
$ljoin["patients"] = "sejour.patient_id = patients.patient_id"; $where = array(); $where["entree"] = "BETWEEN '{$date}' AND '{$next}'"; $where["sejour.annule"] = "= '0'"; $where["group_id"] = "= '{$group->_id}'"; $where["type_pec"] = "= 'O'"; if ($view == "non_eff") { $where[] = "(entree_reelle IS NULL OR entree_reelle = '0000-00-00 00:00:00')"; } if ($view == "non_prep") { $where["sejour.entree_preparee"] = "= '0'"; } $sejours = $sejour->loadList($where, "patients.nom ASC", null, null, $ljoin); CMbObject::massLoadFwdRef($sejours, "patient_id"); CMbObject::massLoadFwdRef($sejours, "grossesse_id"); CMbObject::massCountBackRefs($sejours, "operations"); /** @var $sejours CSejour[] */ foreach ($sejours as $_sejour) { $_sejour->loadRefPatient(); $_sejour->loadRefsOperations(); $grossesse = $_sejour->loadRefGrossesse(); $grossesse->_praticiens = CMbObject::massLoadFwdRef($grossesse->loadRefsSejours(), "praticien_id"); $grossesse->_praticiens += CMbObject::massLoadFwdRef($grossesse->loadRefsConsultations(), "_prat_id"); $naissances = $grossesse->loadRefsNaissances(); $sejours_enfant = CMbObject::massLoadFwdRef($naissances, "sejour_enfant_id"); CMbObject::massLoadFwdRef($sejours_enfant, "patient_id"); foreach ($naissances as $_naissance) { $_naissance->loadRefSejourEnfant()->loadRefPatient(); } CMbObject::massLoadFwdRef($grossesse->_praticiens, "function_id"); foreach ($grossesse->_praticiens as $_praticien) {
/** * Charge la liste de plages et opérations pour un jour donné * Analogue à CMediusers::loadRefsForDay * * @param string $date Date to look for * @param bool $second_chir Use chir_2, chir_3 and chir_4 * * @return void */ function loadRefsForDay($date, $second_chir = false) { // Liste des utilisateurs $user = new CMediusers(); $listPrats = $user->loadPraticiens(PERM_READ); // Liste des fonctions $function = new CFunctions(); $listFunctions = $function->loadListWithPerms(PERM_READ); // Plages d'opérations $plage = new CPlageOp(); $conf_chambre_operation = $plage->conf("chambre_operation"); $ljoin = array(); $add_where = ""; $add_or_where = ""; if ($second_chir) { $ljoin["operations"] = "plagesop.plageop_id = operations.plageop_id"; $prepare_prats = CSQLDataSource::prepareIn(array_keys($listPrats)); $add_where = "operations.chir_id " . $prepare_prats . " OR operations.chir_2_id " . $prepare_prats . " OR operations.chir_3_id " . $prepare_prats . " OR operations.chir_4_id " . $prepare_prats; $add_or_where = " OR {$add_where}"; } $where = array(); $where["plagesop.date"] = "= '{$date}'"; $where["plagesop.salle_id"] = "= '{$this->_id}'"; $where[] = "`plagesop`.`chir_id` " . CSQLDataSource::prepareIn(array_keys($listPrats)) . " OR `plagesop`.`spec_id` " . CSQLDataSource::prepareIn(array_keys($listFunctions)) . $add_or_where; $order = "debut"; $this->_ref_plages = $plage->loadList($where, $order, null, "plageop_id", $ljoin); // Chargement d'optimisation CMbObject::massLoadFwdRef($this->_ref_plages, "chir_id"); CMbObject::massLoadFwdRef($this->_ref_plages, "anesth_id"); CMbObject::massLoadFwdRef($this->_ref_plages, "spec_id"); CMbObject::massLoadFwdRef($this->_ref_plages, "salle_id"); CMbObject::massCountBackRefs($this->_ref_plages, "notes"); CMbObject::massCountBackRefs($this->_ref_plages, "affectations_personnel"); foreach ($this->_ref_plages as $_plage) { /** @var CPlageOp $_plage */ $_plage->loadRefChir(); $_plage->loadRefAnesth(); $_plage->loadRefSpec(); $_plage->loadRefSalle(); $_plage->makeView(); $_plage->loadRefsOperations(); $_plage->loadRefsNotes(); $_plage->loadAffectationsPersonnel(); $_plage->_unordered_operations = array(); // Chargement d'optimisation CMbObject::massLoadFwdRef($_plage->_ref_operations, "chir_id"); $sejours = CMbObject::massLoadFwdRef($_plage->_ref_operations, "sejour_id"); CMbObject::massLoadFwdRef($sejours, "patient_id"); foreach ($_plage->_ref_operations as $operation) { $operation->loadRefAnesth(); $operation->loadRefChirs(); $operation->loadRefPatient(); $operation->loadExtCodesCCAM(); $operation->loadRefPlageOp(); if ($conf_chambre_operation) { $operation->loadRefAffectation(); } // Extraire les interventions non placées if ($operation->rank == 0) { $_plage->_unordered_operations[$operation->_id] = $operation; unset($_plage->_ref_operations[$operation->_id]); } } } // Interventions déplacés $deplacee = new COperation(); $ljoin = array(); $ljoin["plagesop"] = "operations.plageop_id = plagesop.plageop_id"; $where = array(); $where["operations.plageop_id"] = "IS NOT NULL"; $where["plagesop.salle_id"] = "!= operations.salle_id"; $where["plagesop.date"] = "= '{$date}'"; $where["operations.salle_id"] = "= '{$this->_id}'"; $where[] = "`plagesop`.`chir_id` " . CSQLDataSource::prepareIn(array_keys($listPrats)) . " OR `plagesop`.`spec_id` " . CSQLDataSource::prepareIn(array_keys($listFunctions)) . $add_or_where; $order = "operations.time_operation"; $this->_ref_deplacees = $deplacee->loadList($where, $order, null, "operation_id", $ljoin); // Chargement d'optimisation CMbObject::massLoadFwdRef($this->_ref_deplacees, "chir_id"); $sejours_deplacees = CMbObject::massLoadFwdRef($this->_ref_deplacees, "sejour_id"); CMbObject::massLoadFwdRef($sejours_deplacees, "patient_id"); foreach ($this->_ref_deplacees as $_deplacee) { /** @var COperation $_deplacee */ $_deplacee->loadRefChirs(); $_deplacee->loadRefPatient(); $_deplacee->loadExtCodesCCAM(); $_deplacee->loadRefPlageOp(); } // Hors plage $urgence = new COperation(); $ljoin = array(); $ljoin["plagesop"] = "operations.plageop_id = plagesop.plageop_id"; $where = array(); $where["operations.date"] = "= '{$date}'"; $where["operations.plageop_id"] = "IS NULL"; $where["operations.salle_id"] = "= '{$this->_id}'"; if ($second_chir) { $where[] = $add_where; } else { $where["operations.chir_id"] = CSQLDataSource::prepareIn(array_keys($listPrats)); } $order = "time_operation, chir_id"; $this->_ref_urgences = $urgence->loadList($where, $order, null, "operation_id"); // Chargement d'optimisation CMbObject::massLoadFwdRef($this->_ref_urgences, "chir_id"); $sejours_urgences = CMbObject::massLoadFwdRef($this->_ref_urgences, "sejour_id"); CMbObject::massLoadFwdRef($sejours_urgences, "patient_id"); foreach ($this->_ref_urgences as $_urgence) { /** @var COperation $_urgence */ $_urgence->loadRefChirs(); $_urgence->loadRefPatient(); $_urgence->loadExtCodesCCAM(); $_urgence->loadRefPlageOp(); if ($conf_chambre_operation) { $_urgence->loadRefAffectation(); } } }
/** @var CEvenementSSR[] $evenements */ $evenements = $evenement->loadList($where); // Chargement des evenements SSR de "charge" $where["type_seance"] = $surveillance ? " <> 'non_dediee'" : " = 'non_dediee'"; /** @var CEvenementSSR[] $evenements_charge */ $evenements_charge = $evenement->loadList($where); foreach ($evenements_charge as $_evenement) { $planning->addLoad($_evenement->debut, $_evenement->duree); } CMbObject::massLoadFwdRef($evenements, "prescription_line_element_id"); CMbObject::massLoadFwdRef($evenements, "equipement_id"); $therapeutes = CMbObject::massLoadFwdRef($evenements, "therapeute_id"); CMbObject::massLoadFwdRef($therapeutes, "function_id"); CMbObject::massCountBackRefs($evenements, "evenements_ssr"); CMbObject::massCountBackRefs($evenements, "actes_cdarr"); CMbObject::massCountBackRefs($evenements, "actes_csarr"); foreach ($evenements as $_evenement) { $important = $sejour_id ? $_evenement->sejour_id == $sejour_id : true; $sejour = $_evenement->loadRefSejour(); $patient = $sejour->loadRefPatient(); $equipement = $_evenement->loadRefEquipement(); // Title if ($_evenement->sejour_id) { $title = $patient->nom; } else { $title = $_evenement->_count["evenements_ssr"] . " patient(s)"; } if ($large) { $title .= " " . substr($patient->prenom, 0, 2) . "."; } if (!$sejour_id && $_evenement->remarque) {
$_plage->loadRefSalle(); $_plage->makeView(); $_plage->loadRefsNotes(); //compare current group with bloc group $_plage->_ref_salle->loadRefBloc(); if ($_plage->_ref_salle->_ref_bloc->group_id != $current_group->_id) { $_plage->_ref_salle->_ref_bloc->loadRefGroup(); } $where = array(); if ($userSel->_id && !$userSel->isAnesth()) { $where["chir_id"] = "= '{$userSel->_id}'"; } $_plage->loadRefsOperations($canceled, "annulee ASC, rank, rank_voulu, horaire_voulu", true, null, $where); // Chargement d'optimisation CMbObject::massLoadFwdRef($_plage->_ref_operations, "chir_id"); CMbObject::massCountBackRefs($_plage->_ref_operations, 'actes_ccam'); $sejours = CMbObject::massLoadFwdRef($_plage->_ref_operations, "sejour_id"); CMbObject::massLoadFwdRef($sejours, "patient_id"); foreach ($_plage->_ref_operations as $_op) { $_op->loadRefsFwd(); $_sejour = $_op->_ref_sejour; $_op->countDocItems(); $_op->canDo(); $_op->loadRefCommande(); $_sejour->canDo(); $_sejour->loadRefsFwd(); $_sejour->_ref_patient->loadRefDossierMedical()->countAllergies(); $_sejour->countDocItems(); /* Comptage du nombre d'activités CCAM */ $_op->_count['codes_ccam'] = 0; foreach (CMbArray::pluck($_op->_ext_codes_ccam, "activites") as $_code) {
} // Chargement des interventions $operation = new COperation(); $listOperations = $operation->loadList($where, "{$order_col} {$order_way_final}", null, null, $ljoin); // Optimisations de chargement $chirs = CMbObject::massLoadFwdRef($listOperations, "chir_id"); CMbObject::massLoadFwdRef($chirs, "function_id"); CMbObject::massLoadFwdRef($listOperations, "plageop_id"); if ($use_poste) { CMbObject::massLoadFwdRef($listOperations, "poste_sspi_id"); CMbObject::massLoadFwdRef($listOperations, "poste_preop_id"); } $anesths = CMbObject::massLoadFwdRef($listOperations, "sortie_locker_id"); CMbObject::massLoadFwdRef($anesths, "function_id"); if (in_array($type, array("ops", "reveil")) && CModule::getActive("bloodSalvage")) { CMbObject::massCountBackRefs($listOperations, "blood_salvages"); } $sejours = CMbObject::massLoadFwdRef($listOperations, "sejour_id"); CMbObject::massLoadFwdRef($sejours, "patient_id"); $nb_sorties_non_realisees = 0; $now = CMbDT::time(); $keywords = explode("|", CAppUI::conf("soins Other ignore_allergies", $group)); /** @var $op COperation */ foreach ($listOperations as $op) { $sejour = $op->loadRefSejour(); if ($sejour->type == "exte") { unset($listOperations[$op->_id]); continue; } $sejour->loadNDA(); $op->loadRefChir()->loadRefFunction();
<?php /** * Tâche automatique de suppression de documents déclarés temporaires * * @category CompteRendu * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:\$ * @link http://www.mediboard.org */ CCanDo::checkEdit(); $modele = new CCompteRendu(); $limit = CValue::get("limit", 100); $where = array(); $where["object_id"] = "IS NULL"; $where["purgeable"] = "= '1'"; $modeles = $modele->loadList($where); CMbObject::massCountBackRefs($modeles, "documents_generated"); foreach ($modeles as $_modele) { $documents = $_modele->loadBackRefs("documents_generated", null, $limit); foreach ($documents as $_doc) { $_doc->delete(); } }
*/ 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["terme_prevu"] = "BETWEEN '{$date_min}' AND '{$date_max}'"; $where["group_id"] = " = '{$group->_id}' "; $ljoin["patients"] = "patients.patient_id = grossesse.parturiente_id"; $grossesse = new CGrossesse(); /** @var CStoredObject[] $grossesses */ $grossesses = $grossesse->loadGroupList($where, "terme_prevu ASC, nom ASC", null, null, $ljoin); CMbObject::massLoadFwdRef($grossesses, "parturiente_id"); CMbObject::massCountBackRefs($grossesses, "sejours"); $consultations = CMbObject::massLoadBackRefs($grossesses, "consultations"); CMbObject::massLoadFwdRef($consultations, "plageconsult_id"); /** @var CGrossesse[] $grossesses */ foreach ($grossesses as $_grossesse) { $_grossesse->loadRefParturiente(); $_grossesse->countRefSejours(); $_grossesse->loadRefsConsultations(true); foreach ($_grossesse->_ref_consultations as $_consult) { $_consult->loadRefPlageConsult(); } } $smarty = new CSmartyDP(); $smarty->assign("grossesses", $grossesses); $smarty->assign("date", $date); $smarty->assign("date_min", $date_min);
<?php /** * Liste des grossesses pour une parturiente * * @category Maternite * @package Mediboard * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version SVN: $Id:$ * @link http://www.mediboard.org */ CCanDo::checkRead(); $parturiente_id = CValue::getOrSession("parturiente_id"); $object_guid = CValue::getOrSession("object_guid"); $show_checkbox = CValue::get("show_checkbox"); $object = new CMbObject(); if ($object_guid) { $object = CMbObject::loadFromGuid($object_guid); } $grossesse = new CGrossesse(); $grossesse->parturiente_id = $parturiente_id; $grossesses = $grossesse->loadMatchingList("terme_prevu DESC, active DESC"); CMbObject::massCountBackRefs($grossesses, "sejours"); CMbObject::massCountBackRefs($grossesses, "consultations"); CMbObject::massCountBackRefs($grossesses, "naissances"); $smarty = new CSmartyDP(); $smarty->assign("grossesses", $grossesses); $smarty->assign("object", $object); $smarty->assign("show_checkbox", $show_checkbox); $smarty->display("inc_list_grossesses.tpl");
/** * Comptage des antécédents par type * * @param self[] $dossiers liste des dossiers * @param string $type Type des antécédents * * @return void */ static function massCountAntecedentsByType($dossiers, $type = "") { if ($type && !preg_match("/{$type}/", CAppUI::conf("patients CAntecedent types"))) { return; } $where = array(); if ($type) { $where["type"] = "= '{$type}'"; } CMbObject::massCountBackRefs($dossiers, "antecedents", $where); foreach ($dossiers as $_dossier) { if ($type) { $_dossier->_count_antecedents_by_type[$type] = $_dossier->_count["antecedents"]; } else { $_dossier->_count_antecedents = $_dossier->_count["antecedents"]; } } }
/** * Charge la liste de plages et interventions pour un jour donné * Analogue à CSalle::loadRefsForDay * * @param string $date Date to look for * @param bool $second_chir Use chir_2, chir_3 and chir_4 * * @return void */ function loadRefsForDay($date, $second_chir = false) { $this->loadBackRefs("secondary_functions"); $secondary_specs = array(); foreach ($this->_back["secondary_functions"] as $_sec_spec) { /** @var CSecondaryFunction $_sec_spec */ $_sec_spec->loadRefFunction(); $_sec_spec->loadRefUser(); $_function = $_sec_spec->_ref_function; $secondary_specs[$_function->_id] = $_function; } // Plages d'intervention $plage = new CPlageOp(); $ljoin = array(); $add_where = ""; if ($second_chir) { $ljoin["operations"] = "plagesop.plageop_id = operations.plageop_id"; $add_where = " OR operations.chir_id = '{$this->_id}' OR operations.chir_2_id = '{$this->_id}'\r\n OR operations.chir_3_id = '{$this->_id}' OR operations.chir_4_id = '{$this->_id}'"; } $where = array(); $where["plagesop.date"] = "= '{$date}'"; $where[] = "plagesop.chir_id = '{$this->_id}' OR plagesop.spec_id = '{$this->function_id}' OR plagesop.spec_id " . CSQLDataSource::prepareIn(array_keys($secondary_specs)) . $add_where; $order = "debut"; $this->_ref_plages = $plage->loadList($where, $order, null, "plageop_id", $ljoin); // Chargement d'optimisation CMbObject::massLoadFwdRef($this->_ref_plages, "chir_id"); CMbObject::massLoadFwdRef($this->_ref_plages, "anesth_id"); CMbObject::massLoadFwdRef($this->_ref_plages, "spec_id"); CMbObject::massLoadFwdRef($this->_ref_plages, "salle_id"); CMbObject::massCountBackRefs($this->_ref_plages, "notes"); CMbObject::massCountBackRefs($this->_ref_plages, "affectations_personnel"); foreach ($this->_ref_plages as $_plage) { /** @var CPlageOp $_plage */ $_plage->loadRefChir(); $_plage->loadRefAnesth(); $_plage->loadRefSpec(); $_plage->loadRefSalle(); $_plage->makeView(); $_plage->loadRefsOperations(); $_plage->loadRefsNotes(); $_plage->loadAffectationsPersonnel(); $_plage->_unordered_operations = array(); // Chargement d'optimisation CMbObject::massLoadFwdRef($_plage->_ref_operations, "chir_id"); $sejours = CMbObject::massLoadFwdRef($_plage->_ref_operations, "sejour_id"); CMbObject::massLoadFwdRef($sejours, "patient_id"); foreach ($_plage->_ref_operations as $_operation) { if ($_operation->chir_id != $this->_id && (!$second_chir || $_operation->chir_2_id != $this->_id && $_operation->chir_3_id != $this->_id && $_operation->chir_4_id != $this->_id)) { unset($_plage->_ref_operations[$_operation->_id]); } else { $_operation->_ref_chir = $this; $_operation->loadExtCodesCCAM(); $_operation->updateSalle(); $_operation->loadRefPatient(); // Extraire les interventions non placées if ($_operation->rank == 0) { $_plage->_unordered_operations[$_operation->_id] = $_operation; unset($_plage->_ref_operations[$_operation->_id]); } } } if (count($_plage->_ref_operations) + count($_plage->_unordered_operations) < 1) { unset($this->_ref_plages[$_plage->_id]); } } // Interventions déplacés $deplacee = new COperation(); $ljoin = array(); $ljoin["plagesop"] = "operations.plageop_id = plagesop.plageop_id"; $where = array(); $where["operations.plageop_id"] = "IS NOT NULL"; $where["operations.annulee"] = "= '0'"; $where["plagesop.salle_id"] = "!= operations.salle_id"; $where["plagesop.date"] = "= '{$date}'"; $where[] = "plagesop.chir_id = '{$this->_id}'" . $add_where; $order = "operations.time_operation"; $this->_ref_deplacees = $deplacee->loadList($where, $order, null, "operation_id", $ljoin); // Chargement d'optimisation CMbObject::massLoadFwdRef($this->_ref_deplacees, "chir_id"); $sejours_deplacees = CMbObject::massLoadFwdRef($this->_ref_deplacees, "sejour_id"); CMbObject::massLoadFwdRef($sejours_deplacees, "patient_id"); foreach ($this->_ref_deplacees as $_deplacee) { /** @var COperation $_deplacee */ $_deplacee->loadRefChir(); $_deplacee->loadRefPatient(); $_deplacee->loadExtCodesCCAM(); } // Urgences $urgence = new COperation(); $where = array(); $where["plageop_id"] = "IS NULL"; $where["date"] = "= '{$date}'"; if ($second_chir) { $where[] = "chir_id = '{$this->_id}' OR chir_2_id = '{$this->_id}' OR chir_3_id = '{$this->_id}' OR chir_4_id = '{$this->_id}'"; } else { $where["chir_id"] = "= '{$this->_id}'"; } $where["annulee"] = "= '0'"; $this->_ref_urgences = $urgence->loadList($where, null, null, "operation_id"); // Chargement d'optimisation CMbObject::massLoadFwdRef($this->_ref_urgences, "chir_id"); $sejours_urgences = CMbObject::massLoadFwdRef($this->_ref_urgences, "sejour_id"); CMbObject::massLoadFwdRef($sejours_urgences, "patient_id"); foreach ($this->_ref_urgences as $_urgence) { /** @var COperation $_urgence */ $_urgence->loadRefChir(); $_urgence->loadRefPatient(); $_urgence->loadExtCodesCCAM(); } }
$curr_aff = $sejour->getCurrAffectation(); if (!$curr_aff->_id && (!$sejour->service_id || $sejour->service_id != $service_id) || $curr_aff->service_id != $service_id) { unset($listSejours[$key]); } } } CMbObject::massLoadFwdRef($listSejours, "patient_id"); CMbObject::massLoadFwdRef($listSejours, "group_id"); $prats = CMbObject::massLoadFwdRef($listSejours, "praticien_id"); CMbObject::massLoadFwdRef($prats, "function_id"); CMbObject::massCountBackRefs($listSejours, "notes"); CMbObject::massCountBackRefs($listSejours, "rpu"); CMbObject::massCountBackRefs($listSejours, "consultations"); CMbObject::massCountBackRefs($listSejours, "prescriptions"); CMbObject::massCountBackRefs($listSejours, "documents"); CMbObject::massCountBackRefs($listSejours, "files"); foreach ($listSejours as $sejour) { // Chargement du numero de dossier $sejour->loadNDA(); $sejour->loadRefsFwd(); $rpu = $sejour->loadRefRPU(); $rpu->loadRefSejourMutation(); $rpu->loadRefIDEResponsable(); $sejour->loadRefsConsultations(); $sejour->loadRefsNotes(); $sejour->countDocItems(); $sejour->loadRefCurrAffectation()->loadRefService(); $sejour->_ref_curr_affectation->loadRefLit()->loadRefChambre(); $prescription = $sejour->loadRefPrescriptionSejour(); if ($prescription->_id) { if (@CAppUI::conf("object_handlers CPrescriptionAlerteHandler")) {
*/ $date = CValue::getOrSession("date", CMbDT::date()); $show_cancelled = CValue::getOrSession("show_cancelled", 0); $days_terme = CAppUI::conf("maternite days_terme"); $date_min = CMbDT::date("- {$days_terme} days", $date); $date_max = CMbDT::date("+{$days_terme} days", $date); $where = array(); $ljoin = array(); $where["terme_prevu"] = "BETWEEN '{$date_min}' AND '{$date_max}'"; $ljoin["patients"] = "patients.patient_id = grossesse.parturiente_id"; $grossesse = new CGrossesse(); $grossesses = $grossesse->loadGroupList($where, "terme_prevu DESC, nom ASC", null, null, $ljoin); /** @var CStoredObject[] $grossesses */ CMbObject::massLoadFwdRef($grossesses, "parturiente_id"); CMbObject::massCountBackRefs($grossesses, "sejours"); CMbObject::massCountBackRefs($grossesses, "consultations"); /** @var CGrossesse[] $grossesses */ foreach ($grossesses as $_grossesse) { $sejours = $_grossesse->loadRefsSejours(); if (!$show_cancelled && count($sejours) == 1 && reset($sejours)->annule == 1) { unset($grossesses[$_grossesse->_id]); continue; } $_grossesse->loadRefParturiente(); $_grossesse->loadLastConsultAnesth(); $_grossesse->_ref_last_consult_anesth->loadRefPlageConsult(); } $smarty = new CSmartyDP(); $smarty->assign("grossesses", $grossesses); $smarty->assign("date", $date); $smarty->assign("date_min", $date_min);
$canUserSel->needsEdit(array("chirSel" => 0)); if ($consult->_id) { $date = $consult->_ref_plageconsult->date; CValue::setSession("date", $date); } // Récupération des plages de consultation du jour et chargement des références $plage = new CPlageconsult(); $plage->chir_id = $userSel->_id; $plage->date = $date; if ($plageconsult_id && $boardItem) { $plage->plageconsult_id = $plageconsult_id; } $order = "debut"; /** @var CPlageconsult[] $listPlage */ $listPlage = $plage->loadMatchingList($order); CMbObject::massCountBackRefs($listPlage, "notes"); foreach ($listPlage as $_plage) { $_plage->_ref_chir =& $userSel; $consultations = $_plage->loadRefsConsultations(false, !$vue && $withClosed); $_plage->loadRefsNotes(); // Mass preloading CStoredObject::massLoadFwdRef($consultations, "patient_id"); CStoredObject::massLoadFwdRef($consultations, "sejour_id"); CStoredObject::massLoadFwdRef($consultations, "categorie_id"); CMbObject::massCountDocItems($consultations); /** @var CConsultAnesth[] $dossiers */ $dossiers = CStoredObject::massLoadBackRefs($consultations, "consult_anesth"); $count = CMbObject::massCountDocItems($dossiers); foreach ($consultations as $_consultation) { $_consultation->loadRefPatient(); $_consultation->loadRefSejour();