$departements[] = "HC"; // Haute Corse $departements[] = "MA"; // Martinique $departements[] = "MY"; // Mayotte $departements[] = "PS"; // Nouvelle Calédonie $departements[] = "PF"; // Polynésie française $departements[] = "RE"; // Réunion $departements[] = "PM"; // Saitn Pierre et Miquelon $departements[] = "WF"; // Wallis et Futuna // Nombre de patients $patient = new CPatient(); $nb_patients = $patient->countList(); // Création du template $smarty = new CSmartyDP(); $smarty->assign("nb_patients", $nb_patients); $smarty->assign("active_types", $active_types); $smarty->assign("mandatory_types", $mandatory_types); $smarty->assign("active_appareils", $active_appareils); $smarty->assign("all_types", $all_types); $smarty->assign("all_mandatory_types", $all_types); $smarty->assign("all_appareils", $all_appareils); $smarty->assign("pass", CValue::get("pass")); $smarty->assign("departements", $departements); $smarty->display("configure.tpl");
$where["nom"] = "LIKE '{$nom}%'"; if ($sexe != "") { $where["sexe"] = "= '{$sexe}'"; } /*if ($IPP) { /*$patient = new CPatient; $patient->_IPP = $patient_ipp; $patient->loadFromIPP(); }*/ $order = "nom, prenom, naissance"; $step = 30; $limit = "{$page}, {$step}"; $patient = new CPatient(); $patient->nom = $nom; $patient->prenom = $prenom; $patient->nom_jeune_fille = $nom_jeune_fille; $patient->sexe = $sexe; //$patient->_IPP = $IPP; $nb_pat = $patient->countList($where); /** @var CPatient[] $patients CPatient[] */ $patients = $patient->loadList($where, $order, $limit); CPatient::massLoadIPP($patients); foreach ($patients as $_patient) { $_patient->loadFirstLog()->loadRefUser(); } $smarty = new CSmartyDP(); $smarty->assign("patient", $patient); $smarty->assign("patients", $patients); $smarty->assign("nb_pat", $nb_pat); $smarty->assign("page", $page); $smarty->display("inc_list_demographic.tpl");
/** * Get the number patient stateless * * @return int */ static function verifyStatus() { $patient = new CPatient(); $where = array("status" => "IS NULL"); return $patient->countList($where); }
CValue::setSession("ignore_files", $ignore_files); CValue::setSession("generate_pdfpreviews", $generate_pdfpreviews); CValue::setSession("date_min", $date_min); $step = min($step, 1000); CStoredObject::$useObjectCache = false; $backrefs_tree = array("CPatient" => array("identifiants", "notes", "files", "documents", "permissions", "observation_result_sets", "constantes", "contextes_constante", "consultations", "correspondants", "correspondants_patient", "sejours", "dossier_medical", "correspondants_courrier", "grossesses", "allaitements", "patient_observation_result_sets", "patient_links", 'arret_travail', "facture_patient_consult", "facture_patient_sejour"), "CConsultation" => array("files", "documents", "notes", "consult_anesth", "examaudio", "examcomp", "examnyha", "exampossum", "sejours_lies", "intervs_liees", "consults_liees", "facturable", "actes_ngap", "actes_ccam", "codages_ccam", "actes_caisse"), "CConsultAnesth" => array("files", "documents", "notes", "techniques"), "CSejour" => array("identifiants", "files", "documents", "notes", "dossier_medical", "operations", "facturable", "actes_ngap", "actes_ccam", "codages_ccam", "actes_caisse"), "COperation" => array("files", "documents", "notes", "anesth_perops", "facturable", "actes_ngap", "actes_ccam", "actes_caisse"), "CCompteRendu" => array("files"), "CDossierMedical" => array("antecedents", "traitements", "etats_dent"), "CFactureCabinet" => array("items", "reglements"), "CFactureEtablissement" => array("items", "reglements")); $fwdrefs_tree = array("CPatient" => array("medecin_traitant"), "CConstantesMedicales" => array("context_id", "patient_id", "user_id"), "CConsultation" => array("plageconsult_id", "sejour_id", "grossesse_id", "patient_id", "consult_related_id"), "CConsultAnesth" => array("consultation_id", "operation_id", "sejour_id", "chir_id"), "CPlageconsult" => array("chir_id"), "CSejour" => array("patient_id", "praticien_id", "service_id", "group_id", "grossesse_id"), "COperation" => array("sejour_id", "chir_id", "anesth_id", "plageop_id", "salle_id", "type_anesth", "consult_related_id", "prat_visite_anesth_id"), "CGrossesse" => array("group_id", "parturiente_id"), "CCorrespondant" => array("patient_id", "medecin_id"), "CMediusers" => array("user_id"), "CPlageOp" => array("chir_id", "anesth_id", "spec_id", "salle_id"), "CActeCCAM" => array("executant_id"), "CActeNGAP" => array("executant_id"), "CActeCaisse" => array("executant_id"), "CFraidDivers" => array("executant_id"), "CFactureItem" => array("object_id"), "CFactureLiaison" => array("facture_id", "object_id"), "CFactureCabinet" => array("group_id", "patient_id", "praticien_id"), "CFactureEtablissement" => array("group_id", "patient_id", "praticien_id"), "CTypeAnesth" => array("group_id"), "CFile" => array("object_id", "author_id"), "CCompteRendu" => array("object_id", "author_id", "user_id", "function_id", "group_id", "content_id", "locker_id")); $patient = new CPatient(); $ds = $patient->getDS(); $order = array("patients.nom", "patients.nom_jeune_fille", "patients.prenom", "patients.naissance", "patients.patient_id"); if ($all_prats && !$date_min) { $limit = "{$start}, {$step}"; /** @var CPatient[] $patients */ $patients = $patient->loadList(null, $order, $limit); $patient_count = count($patients); $patient_total = $patient->countList(); } else { $ljoin_consult = array("consultation" => "consultation.patient_id = patients.patient_id", "plageconsult" => "plageconsult.plageconsult_id = consultation.plageconsult_id"); $where_consult = array(); if (!$all_prats) { $where_consult["plageconsult.chir_id"] = $ds->prepareIn($praticien_id); } if ($date_min) { $where_consult["plageconsult.date"] = $ds->prepare(">= ?", $date_min); } $patient_ids_consult = $patient->loadIds($where_consult, $order, null, "patients.patient_id", $ljoin_consult); $ljoin_sejour = array("sejour" => "sejour.patient_id = patients.patient_id"); $where_sejour = array(); if (!$all_prats) { $where_sejour["sejour.praticien_id"] = $ds->prepareIn($praticien_id); }
} $merge_patient = CValue::getOrSession("_merge_patient"); $number_day = CValue::getOrSession("_number_day", 8); $number_day = $number_day ?: 8; if ($number_day > 31) { $number_day = 31; } elseif ($number_day < 0) { $number_day = 0; } $now = CValue::getOrSession("_date_end", CMbDT::date()); $before = CMbDT::date("-{$number_day} DAYS", $now); CValue::setSession("_number_day", $number_day); CValue::setSession("_date_end", $now); CValue::setSession("_merge_patient", $merge_patient); $patient = new CPatient(); $count_patient = $patient->countList(); $count_status = $patient->countMultipleList(array("status" => "IS NOT NULL"), null, "status", null, array("status")); $patient_link = new CPatientLink(); $count_status[] = array("total" => $patient_link->countList(), "status" => "DPOT"); //répartition total $series = CPatientStateTools::createGraphPie($count_status); foreach ($series["datum"] as $_k => $_serie) { $series["datum"][$_k]["percent"] = $series["count"] > 0 ? round($_serie["data"] / $series["count"] * 100) : 0; } //Répartition par journée $values = array(); $ids = array(); if ($merge_patient) { $results = CPatientStateTools::getPatientMergeByDate($before, $now); for ($i = $number_day; $i >= 0; $i--) { $values["merged"][CMbDT::date("-{$i} DAYS", $now)] = 0;
/** * Get all number patient by a state and the filter * * @param String $date_min Date minimum * @param String $date_max Date maximum * * @return array */ static function getAllNumberPatient($date_min = null, $date_max = null) { $patients_count = array(); $leftjoin = null; $where = array(); if ($date_min) { $where["entree"] = ">= '{$date_min}'"; $leftjoin["sejour"] = "patients.patient_id = sejour.patient_id"; } if ($date_max) { $where["entree"] = "<= '{$date_max}'"; $leftjoin["sejour"] = "patients.patient_id = sejour.patient_id"; } $ds = CSQLDataSource::get("std"); $request = new CRequest(); $request->addSelect("`status`, COUNT(DISTINCT(`patients`.`patient_id`)) as `total`"); $request->addTable("patients"); $request->addLJoin($leftjoin); $request->addWhere($where); $request->addGroup("`status`"); $result = $ds->loadList($request->makeSelect()); $state_count = array(); foreach ($result as $_result) { $state_count[$_result["status"]] = $_result["total"]; } foreach (self::$list_state as $_state) { $patients_count[CMbString::lower($_state)] = CMbArray::get($state_count, $_state, 0); if ($_state == "CACH") { $where = array("vip" => "= '1'", "status" => "!= 'VALI'"); $patient = new CPatient(); $patients_count[CMbString::lower($_state)] = $patient->countList($where, null, $leftjoin); } if ($_state == "DPOT") { $patient_link = new CPatientLink(); $patients_count[CMbString::lower($_state)] = $patient_link->countList($where, null, array("sejour" => "patient_link.patient_id1 = sejour.patient_id")); } } return $patients_count; }
switch ($mode = CValue::get("mode")) { case "check": $ds = $patient->_spec->ds; $query = "SELECT `{$_field}`, COUNT( * ) AS `counts`\r\n FROM `patients`\r\n GROUP BY `{$_field}`"; foreach ($ds->loadHashList($query) as $value => $count) { $msgType = $value ? UI_MSG_OK : UI_MSG_WARNING; CAppUI::stepAjax("Nombre d'occurences pour '%s' valant '%s' : '%s'", $msgType, CAppUI::tr("CPatient-{$_field}-desc"), CAppUI::tr("CPatient.{$_field}.{$value}"), $count); } break; case "repair": $where = array(); $where["{$_field}"] = "IS NULL"; $repaired = 0; $max = CValue::get("max", 1000); $limit = "0, {$max}"; CAppUI::stepAjax("Patients détectés pour une correction de '%s' : %s trouvés.", UI_MSG_OK, CAppUI::tr("CPatient-{$_field}-desc"), $patient->countList($where)); foreach ($patient->loadList($where, null, $limit) as $_patient) { $_patient->{$_field} = "guess"; if ($msg = $_patient->store()) { CAppUI::stepAjax("Echec de la correction de %s pour le patient '%s' : %s", UI_MSG_WARNING, CAppUI::tr("CPatient-{$_field}-desc"), $_patient, $msg); continue; } $repaired++; } CAppUI::stepAjax("%s patients corrigés", UI_MSG_OK, $repaired); break; default: CAppUI::stepAjax("Mode '{$mode}' non pris en charge", UI_MSG_ERROR); break; } }