/** * @see parent::getValue() */ function getValue($object, $smarty = null, $params = array()) { include_once $smarty->_get_plugin_filepath('modifier', 'date_format'); $propValue = $object->{$this->fieldName}; $format = CValue::first(@$params["format"], CAppUI::conf("time")); return $propValue ? smarty_modifier_date_format($propValue, $format) : ""; }
/** * @see parent::getValue() */ function getValue($object, $smarty = null, $params = array()) { if ($smarty) { include_once $smarty->_get_plugin_filepath('modifier', 'date_format'); } $propValue = $object->{$this->fieldName}; $format = CValue::first(@$params["format"], CAppUI::conf("date")); return $propValue && $propValue != "0000-00-00" ? $this->progressive ? $this->progressiveFormat($propValue) : smarty_modifier_date_format($propValue, $format) : ""; // TODO: test and use strftime($format, strtotime($propValue)) instead of smarty }
/** * @see parent::updateFormFields() */ function updateFormFields() { $this->_query_params_get = $get = json_decode($this->query_params_get, true); $this->_query_params_post = $post = json_decode($this->query_params_post, true); $this->_session_data = $session = json_decode($this->session_data, true); $get = is_array($get) ? $get : array(); $post = is_array($post) ? $post : array(); $this->_module = CValue::first(CMbArray::extract($get, "m"), CMbArray::extract($post, "m")); $this->_action = CValue::first(CMbArray::extract($get, "tab"), CMbArray::extract($get, "a"), CMbArray::extract($post, "dosql")); }
function syncPatient($update = true) { $medecin_id = $this->consume("medecin_id"); // Gestion des id400 $tag = "medecin-patient"; $idex = new CIdSante400(); $idex->object_class = "CPatient"; $idex->id400 = $medecin_id; $idex->tag = $tag; // Identité $patient = new CPatient(); $patient->nom = $this->consume("nom"); $patient->prenom = CValue::first($this->consume("prenom"), $patient->nom); // Simulation de l'âge $year = 1980 - strlen($patient->nom); $month = '01'; $day = str_pad(strlen($patient->prenom) % 30, 2, '0', STR_PAD_LEFT); $patient->naissance = "{$year}-{$month}-{$day}"; // Binding $this->trace($patient->getProperties(true), "Patient à enregistrer"); $idex->bindObject($patient); $this->markStatus(self::STATUS_PATIENT); }
function ccmu_cmp($sejour1, $sejour2) { $ccmu1 = CValue::first($sejour1->_ref_rpu->ccmu, "9"); $ccmu2 = CValue::first($sejour2->_ref_rpu->ccmu, "9"); if ($ccmu1 == "P") { $ccmu1 = "1"; } if ($ccmu2 == "P") { $ccmu2 = "1"; } return $ccmu2 - $ccmu1; }
if ($limit_char_search = CAppUI::conf("dPpatients CPatient limit_char_search")) { $patient_nom_search = substr($patient_nom_search, 0, $limit_char_search); $patient_prenom_search = substr($patient_prenom_search, 0, $limit_char_search); } if ($patient_nom_search) { $patient_nom_soundex = $soundexObj->build($patient_nom_search); $where[] = "`nom` LIKE '{$patient_nom_search}%' OR `nom_jeune_fille` LIKE '{$patient_nom_search}%'"; $whereSoundex[] = "`nom_soundex2` LIKE '{$patient_nom_soundex}%' OR `nomjf_soundex2` LIKE '{$patient_nom_soundex}%'"; } if ($patient_prenom_search) { $patient_prenom_soundex = $soundexObj->build($patient_prenom_search); $where["prenom"] = "LIKE '{$patient_prenom_search}%'"; $whereSoundex["prenom_soundex2"] = "LIKE '{$patient_prenom_soundex}%'"; } if ($patient_year || $patient_month || $patient_day) { $patient_naissance = CValue::first($patient_year, "%") . "-" . CValue::first($patient_month, "%") . "-" . CValue::first($patient_day, "%"); $where["naissance"] = $whereSoundex["naissance"] = "LIKE '{$patient_naissance}'"; } if ($patient_sexe) { $where["sexe"] = $whereSoundex["sexe"] = "= '{$patient_sexe}'"; } if ($patient_ville) { $where["ville"] = $whereSoundex["ville"] = "LIKE '{$patient_ville}%'"; } if ($patient_cp) { $where["cp"] = $whereSoundex["cp"] = "LIKE '{$patient_cp}%'"; } if ($prat_id) { $ljoin["consultation"] = "`consultation`.`patient_id` = `patients`.`patient_id`"; $ljoin["plageconsult"] = "`plageconsult`.`plageconsult_id` = `consultation`.`plageconsult_id`"; $ljoin["sejour"] = "`sejour`.`patient_id` = `patients`.`patient_id`";
/** * Recursive stat building for given files * * @param string $basedir Base directory of the node * @param string|string[] $file File or file collection of the node * * @return array|mixed */ function buildStat($basedir, $file) { $stat = array(); // Directory case if (is_array($file)) { $stats = array(); foreach ($file as $filename => $basename) { $stats[] = $this->buildStat("{$basedir}/{$filename}", $basename); } $stat = call_user_func_array("array_merge_recursive", $stats); return $this->stats[CValue::first($basedir, "-root-")] = $stat; } // File case $subpath = "{$basedir}"; $report = $this->makeReportPath($subpath, "json"); if (is_file($report)) { $stat = json_decode(file_get_contents($report), true); } if (!is_array($stat)) { $stat = array(); } return $this->stats[$subpath] = $stat; }
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html */ CCanDo::checkAdmin(); if (!CAppUI::conf("sip export_dest")) { CAppUI::stepAjax("Aucun destinataire de défini pour l'export.", UI_MSG_ERROR); } // Si pas de tag patient if (!CAppUI::conf("dPpatients CPatient tag_ipp")) { CAppUI::stepAjax("Aucun tag patient de défini.", UI_MSG_ERROR); } // Filtre sur les enregistrements $patient = new CPatient(); $action = CValue::get("action", "start"); // Tous les départs possibles $idMins = array("start" => "000000", "continue" => CValue::getOrSession("idContinue"), "retry" => CValue::getOrSession("idRetry")); $idMin = CValue::first(@$idMins[$action], "000000"); CValue::setSession("idRetry", $idMin); // Requêtes $where = array(); $where[$patient->_spec->key] = "> '{$idMin}'"; $sip_config = CAppUI::conf("sip"); // Bornes if ($export_id_min = $sip_config["export_id_min"]) { $where[] = $patient->_spec->key . " >= '{$export_id_min}'"; } if ($export_id_max = $sip_config["export_id_max"]) { $where[] = $patient->_spec->key . " <= '{$export_id_max}'"; } // Comptage $count = $patient->countList($where); $max = $sip_config["export_segment"];
if ($this->_update_pause && $this->_pause && $this->_pause_repeat_time) { $consult = new CConsultation(); $where = array(); $where["plageconsult_id"] = " = '{$this->_id}' "; $where["patient_id"] = " IS NULL"; $consult->loadObject($where); $consult->plageconsult_id = $this->_id; $consult->heure = $this->_pause; $consult->duree = $this->_pause_repeat_time; $consult->chrono = 16; $consult->_hour = null; $consult->_min = null; if ($msg = $consult->store()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); } } return null; } } $pcConfig = CAppUI::conf("dPcabinet CPlageconsult"); CPlageconsult::$hours_start = str_pad($pcConfig["hours_start"], 2, "0", STR_PAD_LEFT); CPlageconsult::$hours_stop = str_pad($pcConfig["hours_stop"], 2, "0", STR_PAD_LEFT); CPlageconsult::$minutes_interval = CValue::first($pcConfig["minutes_interval"], "15"); $hours = range($pcConfig["hours_start"], $pcConfig["hours_stop"]); $mins = range(0, 59, CPlageconsult::$minutes_interval); foreach ($hours as $key => $hour) { CPlageconsult::$hours[$hour] = str_pad($hour, 2, "0", STR_PAD_LEFT); } foreach ($mins as $key => $min) { CPlageconsult::$minutes[] = str_pad($min, 2, "0", STR_PAD_LEFT); }
$filter->user_id = CValue::get("user_id", CAppUI::$user->_id); $filter->_id = CValue::get("plage_id", ""); $filter->date_debut = CValue::get("date_debut", "{$year}-01-01"); $filter->date_fin = CValue::get("date_fin", "{$year}-12-31"); // load available users $mediuser = new CMediusers(); $mediusers = $mediuser->loadListFromType(); // load ref function foreach ($mediusers as $_medius) { $_medius->loadRefFunction(); } // Query $where = array(); $where["user_id"] = CSQLDataSource::prepareIn(array_keys($mediusers), $filter->user_id); $debut = CValue::first($filter->date_debut, $filter->date_fin); $fin = CValue::first($filter->date_fin, $filter->date_debut); if ($fin || $debut) { $where["date_debut"] = "<= '{$fin}'"; $where["date_fin"] = ">= '{$debut}'"; } $plages = $filter->loadList($where); // Regrouper par utilisateur $found_users = array(); $plages_per_user = array(); foreach ($plages as $_plage) { $found_users[$_plage->user_id] = $mediusers[$_plage->user_id]; if (!isset($plages_per_user[$_plage->user_id])) { $plages_per_user[$_plage->user_id] = 0; } $plages_per_user[$_plage->user_id]++; }
$max = CValue::get("max", CAppUI::conf("sante400 nb_rows")); // Load mouvements $class = CValue::get("class"); $type = CValue::getOrSession("type"); $mouvs = array(); $count = 0; $procs = 0; if (!in_array($type, $types)) { $type = null; } // Mouvement type (or class) provided if ($type || $class) { // Mouvement construction by factory $mouv = $class ? new $class() : CMouvFactory::create($type); if (!$mouv) { CAppUI::stepMessage(UI_MSG_ERROR, "CMouvFactory-error-noclass", CValue::first($type, $class)); return; } // Initialisation d'un fichier de verrou $class = $mouv->class; $lock = new CMbLock("synchro_sante400/{$class}"); // Mouvements counting $count = $mouv->count($marked); // Mouvements loading /** @var CMouvement400[] $mouvs */ $mouvs = array(); if ($rec = CValue::get("rec")) { try { $mouv->load($rec); $mouvs = array($mouv); } catch (Exception $e) {
$equals &= $list_fields["fields"][$_field]; } // On complète éventuellement le séjour existant avant de le storer if ($equals) { foreach ($list_fields["fields"] as $_field => $_state) { $sejour_existant->{$_field} = CValue::first($sejour_existant->{$_field}, $sejour->{$_field}); } if (!($msg_error = $sejour_existant->store())) { $sejour = $sejour_existant; $sejour_ok = true; } // Sinon on propose à l'utilisateur de régler les problèmes } else { $sejour_resultat = clone $sejour; foreach ($list_fields["fields"] as $_field => $_state) { $sejour_resultat->{$_field} = CValue::first($sejour->{$_field}, $sejour_existant->{$_field}); } $list_fields["object"] = $sejour; $list_fields["object_existant"] = $sejour_existant; $list_fields["object_resultat"] = $sejour_resultat; } } } else { $msg_error = "<strong>Impossible de sauvegarder le séjour :</strong> " . $msg_error; } } if ($sejour->libelle && !$sejour_ok) { // Création du template $smarty = new CSmartyDP(); $smarty->assign("praticien_id", $praticien_id); $smarty->assign("list_fields", $list_fields);
function addIntervention($elParent, COperation $operation, $referent = null, $light = false) { $identifiant = $this->addElement($elParent, "identifiant"); $this->addElement($identifiant, "emetteur", $operation->_id); $last_idex = $operation->_ref_last_id400; if (isset($last_idex->_id)) { $this->addElement($identifiant, "recepteur", $last_idex->id400); } $sejour = $operation->loadRefSejour(); if (!$operation->plageop_id) { $operation->completeField("date"); } // Calcul du début de l'intervention $mbOpDate = CValue::first($operation->_ref_plageop->date, $operation->date); $time_operation = $operation->time_operation == "00:00:00" ? null : $operation->time_operation; $mbOpHeureDebut = CValue::first($operation->debut_op, $operation->entree_salle, $time_operation, $operation->horaire_voulu, $operation->_ref_plageop->debut); $mbOpDebut = CMbRange::forceInside($sejour->entree, $sejour->sortie, "{$mbOpDate} {$mbOpHeureDebut}"); // Calcul de la fin de l'intervention $mbOpHeureFin = CValue::first($operation->fin_op, $operation->sortie_salle, CMbDT::addTime($operation->temp_operation, CMbDT::time($mbOpDebut))); $mbOpFin = CMbRange::forceInside($sejour->entree, $sejour->sortie, "{$mbOpDate} {$mbOpHeureFin}"); $debut = $this->addElement($elParent, "debut"); $this->addElement($debut, "date", CMbDT::date($mbOpDebut)); $this->addElement($debut, "heure", CMbDT::time($mbOpDebut)); $fin = $this->addElement($elParent, "fin"); $this->addElement($fin, "date", CMbDT::date($mbOpFin)); $this->addElement($fin, "heure", CMbDT::time($mbOpFin)); if ($light) { // Ajout des participants $mbParticipants = array(); foreach ($operation->_ref_actes_ccam as $acte_ccam) { $acte_ccam->loadRefExecutant(); $mbParticipant = $acte_ccam->_ref_executant; $mbParticipants[$mbParticipant->user_id] = $mbParticipant; } $participants = $this->addElement($elParent, "participants"); foreach ($mbParticipants as $mbParticipant) { $participant = $this->addElement($participants, "participant"); $medecin = $this->addElement($participant, "medecin"); $this->addProfessionnelSante($medecin, $mbParticipant); } // Libellé de l'opération $this->addTexte($elParent, "libelle", $operation->libelle, 80); } else { $this->addUniteFonctionnelle($elParent, $operation); // Uniquement le responsable de l’'intervention $participants = $this->addElement($elParent, "participants"); $participant = $this->addElement($participants, "participant"); $medecin = $this->addElement($participant, "medecin"); $this->addProfessionnelSante($medecin, $operation->loadRefChir()); // Libellé de l'opération $this->addTexte($elParent, "libelle", $operation->libelle, 4000); // Remarques sur l'opération $this->addTexte($elParent, "commentaire", CMbString::convertHTMLToXMLEntities("{$operation->materiel} - {$operation->rques}"), 4000); // Conventionnée ? $this->addElement($elParent, "convention", $operation->conventionne ? 1 : 0); // TypeAnesthésie : nomemclature externe (idex) if ($operation->type_anesth) { $tag_hprimxml = $this->_ref_receiver->_tag_hprimxml; $idexTypeAnesth = CIdSante400::getMatch("CTypeAnesth", $tag_hprimxml, null, $operation->type_anesth); $this->addElement($elParent, "typeAnesthesie", $idexTypeAnesth->id400); } // Indicateurs $indicateurs = $this->addElement($elParent, "indicateurs"); $dossier_medical = new CDossierMedical(); $dossier_medical->object_class = "CPatient"; $dossier_medical->object_id = $operation->loadRefPatient()->_id; $dossier_medical->loadMatchingObject(); $antecedents = $dossier_medical->loadRefsAntecedents(); foreach ($antecedents as $_antecedent) { $rques = CMbString::htmlspecialchars($_antecedent->rques); $rques = CMbString::convertHTMLToXMLEntities($rques); $this->addCodeLibelle($indicateurs, "indicateur", $_antecedent->_id, $rques); } // Extemporané if ($operation->exam_extempo) { $this->addCodeLibelle($indicateurs, "indicateur", "EXT", "Extemporané"); } // Recours / Durée USCPO $this->addElement($elParent, "recoursUscpo", $operation->duree_uscpo ? 1 : 0); $this->addElement($elParent, "dureeUscpo", $operation->duree_uscpo ? $operation->duree_uscpo : null); // Côté (droit|gauche|bilatéral|total|inconnu) // D - Droit // G - Gauche // B - Bilatéral // T - Total // I - Inconnu $cote = array("droit" => "D", "gauche" => "G", "bilatéral" => "B", "total" => "T", "inconnu" => "I", "haut" => "HT", "bas" => "BS"); $this->addCodeLibelle($elParent, "cote", $cote[$operation->cote], CMbString::capitalize($operation->cote)); } }
* $Id$ * * @package Mediboard * @subpackage Labo * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkRead(); // Chargement de la prescription $prescription = new CPrescriptionLabo(); if ($prescription->load(CValue::getOrSession("prescription_id"))) { $prescription->loadRefsBack(); $prescription->loadClassification(); } // Chargement du patient $patient_id = CValue::first($prescription->patient_id, CValue::getOrSession("patient_id")); $patient = new CPatient(); $patient->load($patient_id); $patient->loadRefsPrescriptions(PERM_EDIT); // Chargement de la première prescription dans le cas ou il n'y en a pas if (!$prescription->_id && $patient->_id && count($patient->_ref_prescriptions)) { $prescription->load(reset($patient->_ref_prescriptions)->_id); $prescription->loadRefsBack(); $prescription->loadClassification(); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("patient", $patient); $smarty->assign("prescription", $prescription); $smarty->display("vw_resultats.tpl");
/** * Charge le sejour ayant les traits suivants : * - Meme patient * - Meme praticien si praticien connu * - Date d'entree équivalente * * @param bool $strict Le séjour this exclu * @param bool $notCancel Seulement les non annulés * @param bool $useSortie Filtrer aussi sur la date de sortie * * @return int|void Nombre d'occurences trouvées */ function loadMatchingSejour($strict = false, $notCancel = false, $useSortie = true) { if ($strict && $this->_id) { $where["sejour_id"] = " != '{$this->_id}'"; } $where["patient_id"] = " = '{$this->patient_id}'"; $this->_entree = CValue::first($this->entree_reelle, $this->entree_prevue); if ($useSortie) { $this->_sortie = CValue::first($this->sortie_reelle, $this->sortie_prevue); } if (!$this->_entree) { return null; } if ($this->_entree) { $date_entree = CMbDT::date($this->_entree); $where[] = "DATE(entree_prevue) = '{$date_entree}' OR DATE(entree_reelle) = '{$date_entree}'"; } if ($useSortie) { if ($this->_sortie) { $date_sortie = CMbDT::date($this->_sortie); $where[] = "DATE(sortie_prevue) = '{$date_sortie}' OR DATE(sortie_reelle) = '{$date_sortie}'"; } } if ($notCancel) { $where["annule"] = " = '0'"; } if ($this->type) { $where["type"] = " = '{$this->type}'"; } $this->loadObject($where); return $this->countList($where); }
/** * Get XCN : extended composite ID number and name for persons * * @param CMbObject $object Object * @param CInteropReceiver $actor Actor * @param bool $repeatable Repeatable field * * @return array */ function getXCN(CMbObject $object, CInteropReceiver $actor, $repeatable = false) { $xcn1 = $xcn2 = $xcn3 = $xcn9 = $xcn13 = null; $idex = new CIdSante400(); if ($object instanceof CMedecin) { $object->completeField("adeli", "rpps"); $idex = $object->loadLastId400(); $xcn1 = CValue::first($object->adeli, $object->rpps, $idex->id400, $object->_id); $xcn2 = $object->nom; $xcn3 = $object->prenom; $xcn9 = $this->getXCN9($object, $idex, $actor); $xcn13 = $object->adeli ? "ADELI" : ($object->rpps ? "RPPS" : "RI"); } if ($object instanceof CUser) { $xcn1 = $object->_id; $xcn2 = $object->user_last_name; $xcn3 = $object->user_first_name; $xcn9 = $this->getXCN9($object); $xcn13 = "RI"; } if ($object instanceof CMediusers) { $object->completeField("adeli", "rpps"); $idex = CIdSante400::getMatch("CMediusers", $actor->_tag_mediuser, null, $object->_id); $xcn1 = CValue::first($object->adeli, $object->rpps, $idex->id400, $object->_id); $xcn2 = $object->_user_last_name; $xcn3 = $object->_user_first_name; $xcn9 = $this->getXCN9($object, $idex, $actor); $xcn13 = $object->adeli ? "ADELI" : ($object->rpps ? "RPPS" : "RI"); } if ($repeatable && $actor->_configs["build_PV1_7"] == "repeatable" && $object instanceof CMediusers) { $xcn = array(null, $xcn2, $xcn3, null, null, null, null, null, $xcn9, "L", null, null, null); $xncs = array(); // Ajout du RPPS if ($object->rpps) { $xcn[0] = $object->rpps; $xcn[8] = $this->getAssigningAuthority("RPPS"); $xcn[12] = "RPPS"; $xncs[] = $xcn; } // Ajout de l'ADELI if ($object->adeli) { $xcn[0] = $object->adeli; $xcn[8] = $this->getAssigningAuthority("ADELI"); $xcn[12] = "ADELI"; $xncs[] = $xcn; } // Ajout de l'Idex if ($idex->id400) { $xcn[0] = $idex->id400; $xcn[8] = $this->getAssigningAuthority("actor", null, $actor); $xcn[12] = "RI"; $xncs[] = $xcn; } // Est-ce que l'on transmet notre identifiant de praticien if ($actor->_configs["send_own_identifier"]) { // Ajout de l'ID Mediboard $xcn[0] = $object->_id; $xcn[8] = $this->getAssigningAuthority("mediboard"); $xcn[12] = "RI"; $xncs[] = $xcn; } return $xncs; } else { return array(array($xcn1, $xcn2, $xcn3, null, null, null, null, null, $xcn9, "L", null, null, $xcn13, null, null, null, null, null, null, null, null, null, null)); } }
/** * Donne les heures limites d'une intervention * * @param COperation $interv Reference interv * * @return array */ static function getLimitTimes(COperation $interv) { $round_minutes = 10; $round = $round_minutes * 60000; // FIXME $sejour = $interv->loadRefSejour(); // Cas du partogramme if ($sejour->grossesse_id) { $grossesse = $sejour->loadRefGrossesse(); // Debut = debut travail OU entree salle if ($grossesse->datetime_debut_travail) { $time_debut_op_iso = $grossesse->datetime_debut_travail; } else { $time_min = $interv->entree_salle; $date = CMbDT::date($interv->_datetime); $time_debut_op_iso = "{$date} {$time_min}"; } // Fin = fin accouchement OU debut+1 heure OU maintenant if ($grossesse->datetime_accouchement) { $time_fin_op_iso = $grossesse->datetime_accouchement; } else { $time_fin_op_iso = max(CMbDT::dateTime(), CMbDT::dateTime("+1 HOUR", $time_debut_op_iso)); } } else { $time_min = $interv->entree_salle; $time_max = CMbDT::time("+" . CMbDT::minutesRelative("00:00:00", $interv->temp_operation) . " MINUTES", $interv->entree_salle); $date = CMbDT::date($interv->_datetime); $fin = CValue::first($interv->sortie_salle, $interv->fin_op, $interv->retrait_garrot); if ($fin) { $time_max = max($time_max, $fin); } $time_debut_op_iso = "{$date} {$time_min}"; $time_fin_op_iso = "{$date} {$time_max}"; } $timestamp_min = floor(CMbDate::toUTCTimestamp($time_debut_op_iso) / $round) * $round; $timestamp_max = ceil(CMbDate::toUTCTimestamp($time_fin_op_iso) / $round) * $round; return array($timestamp_min, $timestamp_max, $time_debut_op_iso, $time_fin_op_iso); }
/** * Lazy access to a given user, defaultly connected user * * @param integer $user_id The user id, connected user if null; * * @return CUser */ static function get($user_id = null) { $user = new CUser(); return $user->getCached(CValue::first($user_id, CAppUI::$instance->user_id)); }
$filter->start = CValue::get("start", "{$year}-01-01"); $filter->end = CValue::get("end", "{$year}-12-31"); // load available users $mediuser = new CMediusers(); $mediusers = $mediuser->loadListFromType(); $user = CMediusers::get($filter->user_id); // load ref function foreach ($mediusers as $mid => $_medius) { $_medius->loadRefFunction(); } // Query $where = array(); $where["user_id"] = CSQLDataSource::prepareIn(array_keys($mediusers), $filter->user_id); $where["group_id"] = " = '{$group->_id}'"; $debut = CValue::first($filter->start, $filter->end); $fin = CValue::first($filter->end, $filter->start); if ($fin || $debut) { $where["start"] = "<= '{$fin}'"; $where["end"] = ">= '{$debut}'"; } /** @var CPlageAstreinte[] $plages */ $plages = $filter->loadList($where, "start DESC", "0,100"); // Regrouper par utilisateur $found_users = array(); $plages_per_user = array(); foreach ($plages as $_plage) { if (!isset($found_users[$_plage->user_id])) { $found_users[$_plage->user_id] = null; } $found_users[$_plage->user_id] = $mediusers[$_plage->user_id]; $_plage->_ref_user = $_plage->loadRefUser();
$patient_prenom_search_limited = substr($patient_firstName_search, 0, $limit_char_search); } if ($patient_name_search) { $patient_nom_soundex = $soundexObj->build($patient_name_search); $where[] = "`nom` LIKE '{$patient_name_search}%' OR `nom_jeune_fille` LIKE '{$patient_name_search}%'"; $whereLimited[] = "`nom` LIKE '{$patient_nom_search_limited}%' OR `nom_jeune_fille` LIKE '{$patient_nom_search_limited}%'"; $whereSoundex[] = "`nom_soundex2` LIKE '{$patient_nom_soundex}%' OR `nomjf_soundex2` LIKE '{$patient_nom_soundex}%'"; } if ($patient_firstName_search) { $patient_prenom_soundex = $soundexObj->build($patient_firstName_search); $where["prenom"] = "LIKE '{$patient_firstName_search}%'"; $whereLimited["prenom"] = "LIKE '{$patient_prenom_search_limited}%'"; $whereSoundex["prenom_soundex2"] = "LIKE '{$patient_prenom_soundex}%'"; } if ($patient_year || $patient_month || $patient_day) { $patient_naissance = CValue::first($patient_year, "%") . "-" . CValue::first($patient_month, "%") . "-" . ($patient_day ? str_pad($patient_day, 2, "0", STR_PAD_LEFT) : "%"); $where["naissance"] = $whereSoundex["naissance"] = $whereLimited["naissance"] = "LIKE '{$patient_naissance}'"; } $limit = "0, {$showCount}"; $order = "patients.nom, patients.prenom"; $pat = new CPatient(); /** @var CPatient[] $patients */ $patients = array(); /** @var CPatient[] $patientsSoundex */ $patientsSoundex = array(); /** @var CPatient[] $patientsLimited */ $patientsLimited = array(); if ($where) { // Séparation des patients par fonction if (CAppUI::conf('dPpatients CPatient function_distinct') && !CMediusers::get()->isAdmin()) { $function_id = CMediusers::get()->function_id;
/** * @see parent::updateFormFields(); */ function updateFormFields() { parent::updateFormFields(); // Initialisations $this->gauche_aerien = CValue::first($this->gauche_aerien, "|||||||"); $this->gauche_osseux = CValue::first($this->gauche_osseux, "|||||||"); $this->gauche_conlat = CValue::first($this->gauche_conlat, "|||||||"); $this->gauche_ipslat = CValue::first($this->gauche_ipslat, "|||||||"); $this->gauche_pasrep = CValue::first($this->gauche_pasrep, "|||||||"); $this->gauche_tympan = CValue::first($this->gauche_tympan, "|||||||"); $this->gauche_vocale = CValue::first($this->gauche_vocale, "|||||||"); $this->droite_aerien = CValue::first($this->droite_aerien, "|||||||"); $this->droite_osseux = CValue::first($this->droite_osseux, "|||||||"); $this->droite_conlat = CValue::first($this->droite_conlat, "|||||||"); $this->droite_ipslat = CValue::first($this->droite_ipslat, "|||||||"); $this->droite_pasrep = CValue::first($this->droite_pasrep, "|||||||"); $this->droite_tympan = CValue::first($this->droite_tympan, "|||||||"); $this->droite_vocale = CValue::first($this->droite_vocale, "|||||||"); $this->_gauche_aerien = explode("|", $this->gauche_aerien); $this->_gauche_osseux = explode("|", $this->gauche_osseux); $this->_gauche_conlat = explode("|", $this->gauche_conlat); $this->_gauche_ipslat = explode("|", $this->gauche_ipslat); $this->_gauche_pasrep = explode("|", $this->gauche_pasrep); $this->_gauche_vocale = explode("|", $this->gauche_vocale); $this->_gauche_tympan = explode("|", $this->gauche_tympan); $this->_droite_aerien = explode("|", $this->droite_aerien); $this->_droite_osseux = explode("|", $this->droite_osseux); $this->_droite_conlat = explode("|", $this->droite_conlat); $this->_droite_ipslat = explode("|", $this->droite_ipslat); $this->_droite_pasrep = explode("|", $this->droite_pasrep); $this->_droite_vocale = explode("|", $this->droite_vocale); $this->_droite_tympan = explode("|", $this->droite_tympan); $this->_moyenne_gauche_aerien = ($this->_gauche_aerien[2] + $this->_gauche_aerien[3] + $this->_gauche_aerien[4] + $this->_gauche_aerien[5]) / 4; $this->_moyenne_gauche_osseux = ($this->_gauche_osseux[2] + $this->_gauche_osseux[3] + $this->_gauche_osseux[4] + $this->_gauche_osseux[5]) / 4; $this->_moyenne_droite_aerien = ($this->_droite_aerien[2] + $this->_droite_aerien[3] + $this->_droite_aerien[4] + $this->_droite_aerien[5]) / 4; $this->_moyenne_droite_osseux = ($this->_droite_osseux[2] + $this->_droite_osseux[3] + $this->_droite_osseux[4] + $this->_droite_osseux[5]) / 4; foreach ($this->_gauche_vocale as $key => $value) { $item =& $this->_gauche_vocale[$key]; $item = $value ? explode("-", $value) : array("", ""); } foreach ($this->_droite_vocale as $key => $value) { $item =& $this->_droite_vocale[$key]; $item = $value ? explode("-", $value) : array("", ""); } }
/** * Chargement du kiné référent et kiné journée pour une date donnée * * @param date $date Date courante if null; * * @return CMediusers Kiné journée */ function loadRefKineJournee($date = null) { $this->loadRefKineReferent(); $this->_ref_kine_journee = $this->_ref_kine_referent; // Recherche d'un remplacement $sejour = $this->loadRefSejour(); foreach ($sejour->loadRefReplacements() as $_replacement) { if ($_replacement->_id) { $_replacement->loadRefConge(); $conge = $_replacement->_ref_conge; if (CMbRange::in(CValue::first($date, CMbDT::date()), $conge->date_debut, $conge->date_fin)) { $replacer = $_replacement->loadRefReplacer(); $replacer->loadRefFunction(); $this->_ref_kine_journee = $_replacement->_ref_replacer; break; } } } $this->_kine_journee_id = $this->_ref_kine_journee->_id; return $this->_ref_kine_journee; }
/** * @see parent::getFormHtmlElement() */ function getFormHtmlElement($object, $params, $value, $className) { $maxLength = CValue::first($this->length, $this->maxLength, 255); CMbArray::defaultValue($params, "size", min($maxLength, 25)); CMbArray::defaultValue($params, "maxlength", $maxLength); return $this->getFormElementText($object, $params, $value, $className); }
/** * Charge le propriétaire de la liste * * @return CMediusers|CFunctions|CGroups */ function loadRefOwner() { return CValue::first($this->loadRefUser(), $this->loadRefFunction(), $this->loadRefGroup()); }
/** * Mass load mechanism for forward references of an object collection * * @param self[] $objects Array of objects * @param string $field Field to load * @param string $object_class Restrict to explicit object class in case of meta reference * @param bool $keep_sorted Keep the same order as the one in $objects * * @return self[] Loaded collection, null if unavailable, with ids as keys of guids for meta references */ static function massLoadFwdRef($objects, $field, $object_class = null, $keep_sorted = false) { if (!count($objects)) { return array(); } $object = reset($objects); $spec = $object->_specs[$field]; if (!$spec instanceof CRefSpec) { trigger_error("Can't mass load not ref '{$field}' for class '{$object->_class}'", E_USER_WARNING); return null; } $meta = $spec->meta; if ($object_class && !$spec->meta) { trigger_error("Mass load with object class is unavailable for non meta ref '{$field}' in class '{$object->_class}'", E_USER_WARNING); return null; } // Delegated mass load forward references by meta class then append in global array with guid as keys if ($meta && !$object_class) { $object_classes = array(); foreach ($objects as $_object) { $object_classes[$_object->{$meta}] = true; } $fwd_objects = array(); foreach (array_keys($object_classes) as $_object_class) { // Merge array_values to get rid of non integer keys $fwd_objects = array_merge($fwd_objects, array_values(self::massLoadFwdRef($objects, $field, $_object_class))); } // Final array has guids for keys; return array_combine(CMbArray::pluck($fwd_objects, "_guid"), $fwd_objects); } // No existing class if (!self::classExists($spec->class)) { return null; } /** @var self $fwd */ $class = CValue::first($object_class, $spec->class); $fwd = self::getInstance($class); // Inactive module if (!$fwd->_ref_module) { return null; } // Get the ids $fwd_ids = array(); if ($object_class) { foreach ($objects as $_object) { if ($_object->{$meta} == $object_class) { $fwd_ids[] = $_object->{$field}; } } } else { $fwd_ids = CMbArray::pluck($objects, $field); } // Trim real ids $fwd_ids = array_unique($fwd_ids); CMbArray::removeValue("", $fwd_ids); // Only run when there's something to look for if (!count($fwd_ids)) { return array(); } $where[$fwd->_spec->key] = CSQLDataSource::prepareIn($fwd_ids); $list = $fwd->loadList($where); if (!$keep_sorted) { return $list; } $list_sorted = array(); foreach ($fwd_ids as $_fwd_id) { $list_sorted[$_fwd_id] = $list[$_fwd_id]; } return $list_sorted; }
* @author SARL OpenXtrem * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html */ CCanDo::checkRead(); $canSante400 = CModule::getCanDo("dPsante400"); $idex = new CIdSante400(); $idex->load(CValue::get("idex_id")); $idex->loadRefs(); // Chargement du filtre $filter = new CIdSante400(); $filter->object_id = CValue::get("object_id"); $filter->object_class = CValue::get("object_class"); $filter->tag = CValue::get("tag"); $filter->id400 = CValue::get("id400"); $filter->nullifyEmptyFields(); $filter->last_update = CValue::first($idex->last_update, CMbDT::dateTime()); // Rester sur le même filtre en mode dialogue $dialog = CValue::get("dialog"); if ($dialog && $idex->_id) { $filter->object_class = $idex->object_class; $filter->object_id = $idex->object_id; } // Récupération de la liste des classes disponibles if ($filter->object_class && $filter->object_id) { $listClasses = array($filter->object_class); } else { $listClasses = CApp::getInstalledClasses(); } // Chargement de la cible si oBjet unique $target = null; if ($filter->object_id && $filter->object_class) {
/** * Return the time of the object * * @param CMbObject $object Reference Object * * @return null|time */ function getHourWithObject($object) { $heure = null; switch (get_class($object)) { case "COperation": /** @var COperation $object */ $time_operation = $object->time_operation == "00:00:00" ? null : $object->time_operation; $heure = CValue::first($object->debut_op, $object->entree_salle, $time_operation, $object->horaire_voulu); break; case "CConsultation": /** @var CConsultation $object */ $heure = $object->heure; break; case "CSejour": /** @var CSejour $object */ $heure = CMbDT::time($object->entree); break; } return $heure; }
/** * Load functions with permissions for given group, current group by default * * @param int $permType Level of permission * @param int $group_id Filter on group * @param string $type Type of function * * @return CFunctions[] Found functions */ static function loadFonctions($permType = PERM_READ, $group_id = null, $type = null, $name = "") { $group = CGroups::loadCurrent(); $function = new CFunctions(); $where = array(); $where["actif"] = "= '1'"; $where["group_id"] = "= '" . CValue::first($group_id, $group->_id) . "'"; if ($type) { $where["type"] = "= '{$type}'"; } if ($name) { $where["text"] = "LIKE '{$name}%'"; } $order = "text"; /** @var CFunctions[] $functions */ $functions = $function->loadList($where, $order); CMbObject::filterByPerm($functions, $permType); // Group association foreach ($functions as $function) { $function->_ref_group = $group; } return $functions; }
$type = CValue::get("type", 'check_entree'); $ds = CSQLDataSource::get("std"); $result = ""; switch ($type) { case 'check_entree': $message = " entrée(s) erronée(s)"; $sql = "SELECT COUNT(*) AS total \n FROM `sejour`\n WHERE `sejour`.`entree` != IF(`sejour`.`entree_reelle`,`sejour`.`entree_reelle`,`sejour`.`entree_prevue`)"; $result = $ds->loadResult($sql); break; case 'check_sortie': $message = " sortie(s) erronnée(s)"; $sql = "SELECT COUNT(*) AS total \n FROM `sejour`\n WHERE `sejour`.`sortie` != IF(`sejour`.`sortie_reelle`,`sejour`.`sortie_reelle`,`sejour`.`sortie_prevue`)"; $result = $ds->loadResult($sql); break; case 'fix_entree': $message = " entrée(s) corrigée(s)"; $sql = "UPDATE `sejour` SET\n `sejour`.`entree` = IF(`sejour`.`entree_reelle`,`sejour`.`entree_reelle`,`sejour`.`entree_prevue`)\n WHERE `sejour`.`entree` != IF(`sejour`.`entree_reelle`,`sejour`.`entree_reelle`,`sejour`.`entree_prevue`)"; $ds->query($sql); $result = $ds->affectedRows(); break; case 'fix_sortie': $message = " sortie(s) corrigée(s)"; $sql = "UPDATE `sejour` SET\n `sejour`.`sortie` = IF(`sejour`.`sortie_reelle`,`sejour`.`sortie_reelle`,`sejour`.`sortie_prevue`)\n WHERE `sejour`.`sortie` != IF(`sejour`.`sortie_reelle`,`sejour`.`sortie_reelle`,`sejour`.`sortie_prevue`)"; $ds->query($sql); $result = $ds->affectedRows(); break; default: CAppUI::stepAjax("Commande non reconnue", UI_MSG_ERROR); } CAppUI::stepAjax(CValue::first($result, "Aucune") . $message, $result ? UI_MSG_WARNING : UI_MSG_OK);
$results[$i]["cote"] = CMbArray::get($line, 20); $results[$i]["bilan_preop"] = CMbArray::get($line, 21); $results[$i]["materiel_a_prevoir"] = CMbArray::get($line, 22); $results[$i]["examens_perop"] = CMbArray::get($line, 23); $results[$i]["depassement_honoraires"] = CMbArray::get($line, 24); $results[$i]["forfait_clinique"] = CMbArray::get($line, 25); $results[$i]["fournitures"] = CMbArray::get($line, 26); $results[$i]["rques_interv"] = CMbArray::get($line, 27); $results[$i]["convalesence"] = CMbArray::get($line, 28); $results[$i]["rques_sejour"] = CMbArray::get($line, 29); $results[$i]["septique"] = CMbArray::get($line, 30); $results[$i]["duree_heure_hospi"] = CMbArray::get($line, 31); $results[$i]["pathologie"] = CMbArray::get($line, 32); $results[$i]["type_pec"] = CMbArray::get($line, 33); // Type d'hopistalisation $results[$i]["type_hospi"] = CValue::first(strtolower($results[$i]["type_hospi"]), "comp"); if ($results[$i]["type_hospi"] == "hospi") { $results[$i]["type_hospi"] = "comp"; } if ($results[$i]["type_hospi"] == "ambu") { $results[$i]["duree_hospi"] = 0; } $results[$i]["errors"] = array(); // Fonction $function = new CFunctions(); $function->group_id = CGroups::loadCurrent()->_id; $function->text = $results[$i]["function_name"]; $function->loadMatchingObject(); // Praticien $prat = new CMediusers(); $lastname = $results[$i]["praticien_lastname"];