Exemple #1
0
 /**
  * Vérification de la similarité du patient avec un autre nom / prénom
  *
  * @param string $nom    Nom à tester
  * @param string $prenom Prénom à taster
  * @param bool   $strict Test strict
  *
  * @return bool
  */
 function checkSimilar($nom, $prenom, $strict = true)
 {
     $soundex2 = new soundex2();
     $testNom = CMbString::lower($this->nom_soundex2) == CMbString::lower($soundex2->build($nom));
     $testPrenom = CMbString::lower($this->prenom_soundex2) == CMbString::lower($soundex2->build($prenom));
     if ($strict) {
         return $testNom && $testPrenom;
     } else {
         return $testNom || $testPrenom;
     }
 }
Exemple #2
0
$patient_id = CValue::getOrSession("patient_id");
$patient = new CHprim21Patient();
$patient->load($patient_id);
// Récuperation des patients recherchés
$patient_nom = CValue::getOrSession("nom", "");
$patient_prenom = CValue::getOrSession("prenom", "");
$patient_jeuneFille = CValue::getOrSession("jeuneFille", "");
$patient_ville = CValue::getOrSession("ville", "");
$patient_cp = CValue::getOrSession("cp", "");
$patient_day = CValue::get("Date_Day", "");
$patient_month = CValue::get("Date_Month", "");
$patient_year = CValue::get("Date_Year", "");
$patient_naissance = null;
$where = array();
$whereSoundex = array();
$soundexObj = new soundex2();
if ($patient_nom) {
    $patient_nom = trim($patient_nom);
    $where["nom"] = "LIKE '{$patient_nom}%'";
    $whereSoundex["nom_soundex2"] = "LIKE '" . $soundexObj->build($patient_nom) . "%'";
}
if ($patient_prenom) {
    $patient_prenom = trim($patient_prenom);
    $where["prenom"] = "LIKE '{$patient_prenom}%'";
    $whereSoundex["prenom_soundex2"] = "LIKE '" . $soundexObj->build($patient_prenom) . "%'";
}
if ($patient_jeuneFille) {
    $patient_jeuneFille = trim($patient_jeuneFille);
    $where["nom_jeune_fille"] = "LIKE '{$patient_jeuneFille}%'";
    $whereSoundex["nomjf_soundex2"] = "LIKE '" . $soundexObj->build($patient_jeuneFille) . "%'";
}
    $patients = array();
    $patientsSoundex = array();
    $patientsCount = 0;
    $patientsSoundexCount = 0;
    $patient = new CPatient();
    $patient->_IPP = $patient_ipp;
    $patient->loadFromIPP();
    if ($patient->_id) {
        CValue::setSession("patient_id", $patient->_id);
        $patients[$patient->_id] = $patient;
    }
} else {
    $where = array();
    $whereSoundex = array();
    $ljoin = array();
    $soundexObj = new soundex2();
    // Limitation du nombre de caractères
    $patient_nom_search = trim($patient_nom);
    $patient_prenom_search = trim($patient_prenom);
    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}%'";
 /**
  * @see parent::updatePlainFields()
  */
 function updatePlainFields()
 {
     parent::updatePlainFields();
     $soundex2 = new soundex2();
     if ($this->nom) {
         $this->nom = strtoupper($this->nom);
         $this->nom_soundex2 = $soundex2->build($this->nom);
     }
     if ($this->nom_jeune_fille) {
         $this->nom_jeune_fille = strtoupper($this->nom_jeune_fille);
         $this->nomjf_soundex2 = $soundex2->build($this->nom_jeune_fille);
     }
     if ($this->prenom) {
         $this->prenom = ucwords(strtolower($this->prenom));
         $this->prenom_soundex2 = $soundex2->build($this->prenom);
     }
 }
    $findyear = CMbDT::format($patient->naissance, "%Y");
    //$findmonth = CMbDT::format($patient->naissance, "%m");
    //$findday   = CMbDT::format($patient->naissance, "%d");
}
$name = CValue::get("name", $patient->nom);
$firstName = CValue::get("firstName", $patient->prenom);
$nomjf = CValue::get("nomjf", $patient->nom_jeune_fille);
$patient_year = CValue::get("Date_Year", $findyear);
$patient_month = CValue::get("Date_Month", $findmonth);
$patient_day = CValue::get("Date_Day", $findday);
$IPP = CValue::get("IPP", $patient->_ref_IPP ? $patient->_ref_IPP->id400 : null);
$showCount = 30;
// Recherche sur valeurs exactes et phonétique
$where = array();
$whereSoundex = array();
$soundexObj = new soundex2();
if ($name) {
    $name = trim($name);
    $where["nom"] = "LIKE '{$name}%'";
    $whereSoundex["nom_soundex2"] = "LIKE '" . $soundexObj->build($name) . "%'";
}
if ($firstName) {
    $firstName = trim($firstName);
    $where["prenom"] = "LIKE '{$firstName}%'";
    $whereSoundex["prenom_soundex2"] = "LIKE '" . $soundexObj->build($firstName) . "%'";
}
if ($nomjf) {
    $nomjf = trim($nomjf);
    $where["nom_jeune_fille"] = "LIKE '{$nomjf}%'";
    $whereSoundex["nomjf_soundex2"] = "LIKE '" . $soundexObj->build($nomjf) . "%'";
}
Exemple #6
0
 // Gestion du cas vitale
 if ($useVitale && CModule::getActive("fse") && CAppUI::pref('LogicielLectureVitale') == 'none') {
     $patVitale = new CPatient();
     $cv = CFseFactory::createCV();
     if ($cv) {
         $cv->loadFromIdVitale($patVitale);
         $cv->getPropertiesFromVitale($patVitale);
         $name = $patVitale->nom;
         $firstName = $patVitale->prenom;
     }
 }
 // Recherche sur valeurs exactes et phonétique
 $where = array();
 $whereLimited = array();
 $whereSoundex = array();
 $soundexObj = new soundex2();
 $lenSearchConfig = false;
 //not enought char in string to perform the limited search
 // Limitation du nombre de caractères
 $patient_name_search = trim($name);
 $patient_firstName_search = trim($firstName);
 //limitation de la recherche par config :
 $patient_nom_search_limited = $patient_name_search;
 $patient_prenom_search_limited = $patient_firstName_search;
 if ($limit_char_search = CAppUI::conf("dPpatients CPatient limit_char_search")) {
     //not enought characters
     if (strlen($patient_firstName_search) < $limit_char_search && strlen($patient_name_search < $limit_char_search)) {
         $lenSearchConfig = true;
     }
     $patient_nom_search_limited = substr($patient_name_search, 0, $limit_char_search);
     $patient_prenom_search_limited = substr($patient_firstName_search, 0, $limit_char_search);