Esempio n. 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;
     }
 }
Esempio n. 2
0
$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) . "%'";
}
if ($patient_year || $patient_month || $patient_day) {
    $patient_naissance = "on";
}
if ($patient_naissance == "on") {
        $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}%'";
        $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}'";
    }
 /**
  * @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);
     }
 }
$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) . "%'";
}
if ($patient_year || $patient_month || $patient_day) {
    $year = $patient_year ? "{$patient_year}-" : "%-";
    $month = $patient_month ? "{$patient_month}-" : "%-";
    $day = $patient_day ? "{$patient_day}" : "%";
Esempio n. 6
0
 // 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);
 }
 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}";