// Chargement des antecedents et traitements $dossier_medical->loadRefsAntecedents(true); if ($dossier_medical->_ref_antecedents_by_type) { $dossier_medical->countAntecedents(); $dossier_medical->countTraitements(); foreach ($dossier_medical->_ref_antecedents_by_type as &$type) { foreach ($type as $_ant) { $_ant->updateOwnerAndDates(); } } } $dossier_medical->loadRefsTraitements(true); // Chargement de la prescription de sejour $prescription = $sejour->loadRefPrescriptionSejour(); // Chargement des lignes de tp de la prescription /** @var CPrescriptionLineMedicament[] $lines_tp */ $lines_tp = array(); if ($prescription && $prescription->_id) { $line_tp = new CPrescriptionLineMedicament(); $line_tp->prescription_id = $prescription->_id; $line_tp->traitement_personnel = 1; $lines_tp = $line_tp->loadMatchingList(); foreach ($lines_tp as $_line_tp) { $_line_tp->loadRefsPrises(); } } // Création du template $smarty = new CSmartyDP(); $smarty->assign("sejour", $sejour); $smarty->assign("lines_tp", $lines_tp); $smarty->display("inc_list_ant_anesth.tpl");
} } $line->countPlanifications(); if (in_array($line->jour_decalage, array("ER", "R"))) { $line->loadRefOperation(); } $line->loadActiveDates(); } else { // Calcul du dossier de soin complet if ($prescription->_id) { $show_initiales_pharma = CAppUI::conf("dPprescription CPrescription show_initiales_pharma", $group->_guid); // Pour le bouton de gestion des traitements personnels $patient = $prescription->loadRefPatient(); $prescription_tp = $patient->loadRefDossierMedical()->loadUniqueBackRef("prescription"); $prescription->_count_dossier_medical_tp = 0; $_line_tp = new CPrescriptionLineMedicament(); $where = array(); if ($prescription_tp->_id) { $where["prescription_id"] = " = '{$prescription_tp->_id}'"; $where[] = "fin IS NULL OR fin > '" . CMbDT::date() . "'"; $prescription->_count_dossier_medical_tp = $_line_tp->countList($where); } $prescription->countLinesTP(); if (CAppUI::conf("dPprescription CPrescription group_perf_atc", $group) && CAppUI::pref("regroupement_med_plan_soins")) { $atc_classes["other_perf"] = "Autres perfusions"; } $display_level = $prescription->_display_level ? $prescription->_display_level : '2'; $_ref_name = "_ref_ATC_" . $display_level . "_code"; // Chargement des lignes de medicament if (in_array($chapitre, array("all_med", "all_chaps"))) { $prescription->loadRefsLinesMedByCat("1", "1", '', $hide_old_lines, null, null, $hide_line_inactive);
$pat = new CPatient(); $pat->load($_patient_id); // Recherche sur un antécédent if (isset($_result["antecedent_id"])) { $_atcd = new CAntecedent(); $_atcd->load($_result["antecedent_id"]); $pat->_ref_antecedent = $_atcd; } else { // On affiche tous les antécédents du patient $dossier_medical = $pat->loadRefDossierMedical(false); $pat->_refs_antecedents = $dossier_medical->loadRefsAntecedents(); $pat->_refs_allergies = $dossier_medical->loadRefsAllergies(); $pat->_ext_codes_cim = $dossier_medical->_ext_codes_cim; } if (isset($_result["prescription_line_medicament_id"])) { $line = new CPrescriptionLineMedicament(); $line->load($_result["prescription_line_medicament_id"]); $pat->_distant_line = $line; } else { if (isset($_result["prescription_line_mix_item_id"])) { $line = new CPrescriptionLineMixItem(); $line->load($_result["prescription_line_mix_item_id"]); $pat->_distant_line = $line; } } if ($sejour_filled) { $sejour = new CSejour(); $sejour->load($_result["sejour_id"]); $pat->_distant_object = $sejour; $pat->_age_epoque = intval(CMbDT::daysRelative($pat->naissance, $sejour->entree) / 365); } else {
if ($praticien_id && $only_non_checked) { $where_line = array(); $user_id = CMediusers::get()->_id; $where_line["sejour.entree"] = "<= '{$date_max}'"; $where_line["sejour.sortie"] = ">= '{$date}'"; $where_line["sejour.annule"] = " = '0'"; $where_line["prescription.type"] = " = 'sejour'"; $ljoin_line = array(); $ljoin_line["prescription"] = "prescription.prescription_id = prescription_line_medicament.prescription_id"; $ljoin_line["sejour"] = "prescription.object_id = sejour.sejour_id"; $where_line["prescription_line_medicament.praticien_id"] = " = '{$user_id}'"; $where_line["prescription_line_medicament.substituted"] = " = '0'"; $where_line["prescription_line_medicament.variante_for_id"] = "IS NULL"; $where_line["prescription_line_medicament.variante_active"] = " = '1'"; // Lignes de médicament $line = new CPrescriptionLineMedicament(); $lines = $line->loadList($where_line, null, null, null, $ljoin_line); /* @var CPrescriptionLineMedicament[] $lines*/ foreach ($lines as $_line) { $_line->loadRefPrescription(); $_sejour = $_line->_ref_prescription->_ref_object; if (!isset($sejours[$_sejour->_id])) { $sejours[$_sejour->_id] = $_sejour; } } unset($where_line["prescription_line_medicament.substituted"]); unset($where_line["prescription_line_medicament.variante_for_id"]); unset($where_line["prescription_line_medicament.variante_active"]); // Lignes de commentaire $ljoin_line = array(); $line = new CPrescriptionLineComment();