$patient->loadRefPhotoIdentite(); $patient->countDocItems(); $patient->loadRefsCorrespondantsPatient(); $patient->countINS(); // Chargement de l'ipp $patient->loadIPP(); if (CModule::getActive("fse")) { $cv = CFseFactory::createCV(); if ($cv) { $cv->loadIdVitale($patient); } } if (!$modal) { // Save history $params = array("patient_id" => $patient_id, "name" => $name, "firstName" => $firstName, "naissance_day" => $naissance_day, "naissance_month" => $naissance_month, "naissance_year" => $naissance_year); CViewHistory::save($patient, $patient_id ? CViewHistory::TYPE_EDIT : CViewHistory::TYPE_NEW, $params); } if (!$patient_id) { $patient->nom = $name; $patient->prenom = $firstName; $patient->assure_nom = $name; $patient->assure_prenom = $firstName; $patient->unescapeValues(); if ($naissance_day && $naissance_month && $naissance_year) { $patient->naissance = sprintf('%04d-%02d-%02d', $naissance_year, $naissance_month, $naissance_day); } if (CAppUI::conf("dPpatients CPatient default_value_allow_sms", CGroups::loadCurrent())) { $patient->allow_sms_notification = 1; } } // Peut etre pas besoin de verifier si on n'utilise pas VitaleVision
$patient_cp = CValue::get("cp"); $patient_day = CValue::getOrSession("Date_Day"); $patient_month = CValue::getOrSession("Date_Month"); $patient_year = CValue::getOrSession("Date_Year"); $patient_naissance = "{$patient_year}-{$patient_month}-{$patient_day}"; $patient_ipp = CValue::get("patient_ipp"); $patient_nda = CValue::get("patient_nda"); $useVitale = CValue::get("useVitale", CModule::getActive("fse") && CAppUI::pref('LogicielLectureVitale') != 'none' ? 1 : 0); $prat_id = CValue::get("prat_id"); $patient_sexe = CValue::get("sexe"); $useCovercard = CValue::get("usecovercard", CModule::getActive("fse") && CModule::getActive("covercard") ? 1 : 0); $patient_nom_search = null; $patient_prenom_search = null; // Save history $params = array("new" => $new, "patient_id" => $patient_id, "nom" => $patient_nom, "prenom" => $patient_prenom, "ville" => $patient_ville, "cp" => $patient_cp, "Date_Day" => $patient_day, "Date_Month" => $patient_month, "Date_Year" => $patient_year, "patient_ipp" => $patient_ipp, "patient_nda" => $patient_nda, "prat_id" => $prat_id, "sexe" => $patient_sexe); CViewHistory::save($patient, CViewHistory::TYPE_SEARCH, $params); $patVitale = new CPatient(); // Liste des praticiens $prats = $mediuser->loadPraticiens(); // Création du template $smarty = new CSmartyDP(); $smarty->assign("dPsanteInstalled", CModule::getInstalled("dPsante400")); $smarty->assign("nom", $patient_nom); $smarty->assign("prenom", $patient_prenom); $smarty->assign("naissance", $patient_naissance); $smarty->assign("ville", $patient_ville); $smarty->assign("cp", $patient_cp); $smarty->assign("nom_search", $patient_nom_search); $smarty->assign("prenom_search", $patient_prenom_search); $smarty->assign("covercard", CValue::get("covercard", "")); $smarty->assign("sexe", $patient_sexe);
$patient_id = CValue::getOrSession("patient_id", 0); $vw_cancelled = CValue::get("vw_cancelled", 0); // recuperation des id dans le cas d'une recherche de dossiers cliniques $consultation_id = CValue::get("consultation_id", 0); $sejour_id = CValue::get("sejour_id", 0); $operation_id = CValue::get("operation_id", 0); // Récuperation du patient sélectionné $patient = new CPatient(); $patient->load($patient_id); if (!$patient->_id || $patient->_vip) { CAppUI::setMsg("Vous devez selectionner un patient", UI_MSG_ALERT); CAppUI::redirect("m=patients&tab=vw_idx_patients"); } // Save history $params = array("patient_id" => $patient_id, "vw_cancelled" => $vw_cancelled, "consultation_id" => $consultation_id, "sejour_id" => $sejour_id, "operation_id" => $operation_id); CViewHistory::save($patient, CViewHistory::TYPE_VIEW, $params); $patient->loadDossierComplet(PERM_READ, false); $patient->_nb_files_docs -= $patient->_nb_cancelled_files; // Chargement de l'IPP $patient->loadIPP(); $patient->countINS(); // Chargement du dossier medical du patient $dossier_medical = $patient->loadRefDossierMedical(); $dossier_medical->loadComplete(); $nb_consults_annulees = 0; // Suppression des consultations d'urgences foreach ($patient->_ref_consultations as $consult) { if ($consult->motif == "Passage aux urgences" || $consult->annule && !$vw_cancelled) { unset($patient->_ref_consultations[$consult->_id]); $nb_consults_annulees++; }
if (!$modal) { // Save history $params = array("consult_urgence_id" => $consult_urgence_id, "consultation_id" => $consultation_id, "plageconsult_id" => $plageconsult_id, "sejour_id" => $sejour_id, "date_planning" => $date_planning, "grossesse_id" => $grossesse_id); $object = null; $type = CViewHistory::TYPE_VIEW; if ($consultation_id) { $object = $consult; $type = CViewHistory::TYPE_EDIT; } elseif ($plageconsult_id) { $object = new CPlageconsult(); $object->load($plageconsult_id); $type = CViewHistory::TYPE_NEW; } else { $object = $chir; } CViewHistory::save($object, $type, $params); } // Chargement des categories $categorie = new CConsultationCategorie(); $whereCategorie["function_id"] = " = '{$chir->function_id}'"; $orderCategorie = "nom_categorie ASC"; /** @var CConsultationCategorie[] $categories */ $categories = $categorie->loadList($whereCategorie, $orderCategorie); // Creation du tableau de categories simplifié pour le traitement en JSON $listCat = array(); foreach ($categories as $_categorie) { $listCat[$_categorie->_id] = array("nom_icone" => $_categorie->nom_icone, "duree" => $_categorie->duree, "commentaire" => utf8_encode($_categorie->commentaire)); } // Ajout du motif de la consultation passé en parametre if (!$consult->_id && $consult_urgence_id) { // Chargement de la consultation de passage aux urgences
$debut = CMbDT::date("next monday", $debut); //Instanciation du planning $user = new CMediusers(); $planning = new CPlanningWeek($debut, $debut, $fin, $nbjours, false, 450, null, true); if ($user->load($chirSel)) { $planning->title = $user->load($chirSel)->_view; } else { $planning->title = ""; } $planning->guid = $mediuser->_guid; $planning->hour_min = "07"; $planning->hour_max = "20"; $planning->pauses = array("07", "12", "19"); // Save history $params = array("chirSel" => $chirSel, "debut" => $debut, "plageconsult_id" => $plageconsult_id, "show_payees" => $show_payees, "show_annulees" => $show_annulees); CViewHistory::save($user, CViewHistory::TYPE_VIEW, $params); $where = array(); $where[] = "chir_id = '{$chirSel}' OR remplacant_id = '{$chirSel}' OR pour_compte_id = '{$chirSel}'"; for ($i = 0; $i < 7; $i++) { $jour = CMbDT::date("+{$i} day", $debut); $is_holiday = array_key_exists($jour, $bank_holidays); $whereInterv["date"] = $whereHP["date"] = "= '{$jour}'"; $where["date"] = "= '{$jour}'"; if ($is_holiday && !CAppUI::pref("show_plage_holiday")) { continue; } if (CAppUI::pref("showIntervPlanning")) { //INTERVENTIONS /** @var CPlageOp[] $intervs */ $interv = new CPlageOp(); $intervs = $interv->loadList($whereInterv);