Exemple #1
0
 /**
  * @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();
 }
 /**
  * Clears locales cache
  *
  * @return int The number of cache entries cleared
  */
 static function clearLocales()
 {
     $count = DSHM::remKeys("exclass-locales-*");
     self::$_locales_ready = false;
     return $count;
 }
 /**
  * @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();
 }
 /**
  * @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();
 }