/** * @see parent::store() */ function store() { $this->completeField("patient_link_id"); if ($this->_id && $this->_id == $this->patient_link_id) { $this->patient_link_id = ""; } // Création d'un patient en mode cabinets distincts if (CAppUI::conf('dPpatients CPatient function_distinct') && !$this->_id) { $this->function_id = CMediusers::get()->function_id; } if ($this->fieldModified("naissance") || $this->fieldModified("sexe")) { // _guid is not valued yet !! DSHM::remKeys("alertes-*-CPatient-" . $this->_id); } // Si changement de sexe on essaie de retrouver la civilité if ($this->fieldModified("sexe") && !$this->fieldModified("civilite")) { $this->civilite = "guess"; } $this->_anonyme = $this->checkAnonymous(); if ($state = CPatientState::getState($this)) { $this->status = $state; } // Standard store if ($msg = parent::store()) { return $msg; } if ($this->_anonyme) { $this->nom = $this->_id; $this->store(); } CPatientState::storeState($this); // Vitale if (CModule::getActive("fse")) { $cv = CFseFactory::createCV(); if ($cv) { if ($msg = $cv->bindVitale($this)) { return $msg; } } } // Génération de l'IPP ? if ($this->_generate_IPP) { if ($msg = $this->generateIPP()) { return $msg; } } if ($this->_vitale_nir_certifie) { if ($msg = CINSPatient::createINSC($this)) { return $msg; } } return null; }
/** * @see parent::delete() */ function delete() { $this->completeField("taille", "poids", "patient_id"); if ($this->taille || $this->poids) { DSHM::remKeys("alertes-*-CPatient-" . $this->patient_id); } return parent::delete(); }
/** * Remove a value from all defined layers of the cache * * @return void */ public function rem() { $layers = $this->layers; // Inner cache if ($layers & Cache::INNER) { unset(self::$data[$this->prefix][$this->key]); } // Flat key for outer and distributed layers $key = "{$this->prefix}-{$this->key}"; // Outer cache if ($layers & Cache::OUTER) { SHM::rem($key); } // Distributed cache if ($layers & Cache::DISTR) { DSHM::rem($key); } }
/** * @see parent::store() */ function store() { $this->completeField("codes_cim"); $this->_codes_cim = $this->codes_cim ? explode("|", $this->codes_cim) : array(); if ($this->_added_code_cim) { $da = CCodeCIM10::get($this->_added_code_cim); if (!$da->exist) { CAppUI::setMsg("Le code CIM saisi n'est pas valide", UI_MSG_WARNING); return null; } $this->_codes_cim[] = $this->_added_code_cim; } if ($this->_deleted_code_cim) { CMbArray::removeValue($this->_deleted_code_cim, $this->_codes_cim); } $this->codes_cim = implode("|", array_unique($this->_codes_cim)); $this->completeField("object_id", "object_class"); if ($this->object_class == "CPatient" && $this->fieldModified("codes_cim")) { DSHM::remKeys("alertes-*-CPatient-" . $this->object_id); } return parent::store(); }
/** * Inits locale cache * * @return void */ static function initLocales() { if (self::$_locales_ready) { return; } $lang = CAppUI::pref("LOCALE"); $_all_locales = DSHM::get("exclass-locales-{$lang}"); if (!$_all_locales) { $undefined = CAppUI::tr("Undefined"); $ds = CSQLDataSource::get("std"); $_all_locales = array(); $request = new CRequest(); $request->addTable("ex_class_field_translation"); $request->addWhere(array("lang" => "= '{$lang}'")); $request->addLJoin(array("ex_class_field" => "ex_class_field.ex_class_field_id = ex_class_field_translation.ex_class_field_id", "ex_concept" => "ex_concept.ex_concept_id = ex_class_field.concept_id", "ex_class_field_group" => "ex_class_field_group.ex_class_field_group_id = ex_class_field.ex_group_id")); $request->addSelect(array("ex_class_field_translation.std", "IF(ex_class_field_translation.desc IS NOT NULL, ex_class_field_translation.desc, ex_class_field_translation.std) AS `desc`", "IF(ex_class_field_translation.court IS NOT NULL, ex_class_field_translation.court, ex_class_field_translation.std) AS `court`", "ex_class_field.ex_class_field_id AS field_id", "ex_class_field.name", "ex_class_field.prop", "ex_class_field.concept_id", "ex_class_field_group.ex_class_id", "ex_concept.ex_list_id")); $list = $ds->loadList($request->makeSelect()); // Chargement des list_items par concept, field ou list $request = new CRequest(); $request->addTable("ex_list_item"); $request->addSelect(array("ex_list_item_id", "list_id", "concept_id", "field_id", "name")); $list_items = $ds->loadList($request->makeSelect()); // Chargement en une seule requete de toutes les traductions de champs $enum_list_cache = array("list" => array(), "concept" => array(), "field" => array()); $mapper = array("list_id" => "list", "concept_id" => "concept", "field_id" => "field"); foreach ($list_items as $_item) { $_item_id = $_item["ex_list_item_id"]; $_item_name = $_item["name"]; foreach ($mapper as $_field_name => $_to) { if ($_field_value = $_item[$_field_name]) { $enum_list_cache[$_to][$_field_value][$_item_id] = $_item_name; } } } foreach ($list as $_item) { $_locales = array(); $key = "-{$_item['name']}"; $_locales[$key] = $_item["std"]; if ($_item["desc"]) { $_locales["{$key}-desc"] = $_item["desc"]; } if ($_item["court"]) { $_locales["{$key}-court"] = $_item["court"]; } $_ex_class_id = $_item['ex_class_id']; $_prefix = "CExObject_{$_ex_class_id}"; $prop = $_item["prop"]; if (strpos($prop, "enum") === false && strpos($prop, "set") === false) { if (!isset($_all_locales[$_prefix])) { $_all_locales[$_prefix] = array(); } $_all_locales[$_prefix] = array_merge($_all_locales[$_prefix], $_locales); continue; } $key = ".{$_item['name']}"; $_locales["{$key}."] = $undefined; $concept_id = $_item["concept_id"]; $ex_list_id = $_item["ex_list_id"]; $field_id = $_item["field_id"]; $enum_list = array(); if ($concept_id) { if ($ex_list_id) { if (isset($enum_list_cache["list"][$ex_list_id])) { $enum_list = $enum_list_cache["list"][$ex_list_id]; } } else { if (isset($enum_list_cache["concept"][$concept_id])) { $enum_list = $enum_list_cache["concept"][$concept_id]; } } } else { if (isset($enum_list_cache["field"][$field_id])) { $enum_list = $enum_list_cache["field"][$field_id]; } } foreach ($enum_list as $_value => $_locale) { $_locales["{$key}.{$_value}"] = $_locale; } if (!isset($_all_locales[$_prefix])) { $_all_locales[$_prefix] = array(); } $_all_locales[$_prefix] = array_merge($_all_locales[$_prefix], $_locales); } DSHM::put("exclass-locales-{$lang}", $_all_locales, true); } foreach ($_all_locales as $_prefix => $_locales) { CAppUI::addLocales($_prefix, $_locales); } self::$_locales_ready = true; }
/** * @see parent::delete() */ function delete() { $this->completeField("type", "dossier_medical_id"); if ($this->type == "alle") { $this->loadRefDossierMedical(); $dossier_medical = $this->_ref_dossier_medical; if ($dossier_medical->object_class == "CPatient") { DSHM::remKeys("alertes-*-CPatient-" . $dossier_medical->object_id); } } return parent::delete(); }