Пример #1
0
 /**
  * Apply the mode of identito vigilance
  *
  * @param String $string                  String
  * @param Bool   $firstname               Apply the lower and the capitalize
  * @param string $mode_identito_vigilance Identito-vigilance mode
  * @param bool   $anonyme                 Is anonyme
  *
  * @return string
  */
 static function applyModeIdentitoVigilance($string, $firstname = false, $mode_identito_vigilance = null, $anonyme = false)
 {
     $mode = $mode_identito_vigilance ? $mode_identito_vigilance : CAppUI::conf("dPpatients CPatient mode_identito_vigilance", CGroups::loadCurrent());
     switch ($mode) {
         case "medium":
             $result = CMbString::removeBanCharacter($string, true);
             $result = $firstname ? CMbString::capitalize(CMbString::lower($result)) : CMbString::upper($result);
             break;
         case "strict":
             $result = CMbString::upper(CMbString::removeBanCharacter($string, $anonyme));
             break;
         default:
             $result = $firstname ? CMbString::capitalize(CMbString::lower($string)) : CMbString::upper($string);
     }
     return $result;
 }
 /**
  * Ajoute un champ de type date longue
  *
  * @param string  $field     Nom du champ
  * @param string  $value     Valeur du champ
  * @param boolean $lowercase Champ avec des minuscules
  *
  * @return void
  */
 function addLongDateProperty($field, $value, $lowercase = false)
 {
     $value = $value ? ucfirst(CMbDT::format($value, CAppUI::conf("longdate"))) : "";
     $this->addProperty($field, $lowercase ? CMbString::lower($value) : $value);
 }
Пример #3
0
 $ds = $tag2->_spec->ds;
 $where = array("name" => $ds->prepare("=%", $line["tag_name_2"]), "object_class" => $ds->prepare("=%", $object_class));
 $tag2->loadObject($where);
 if (!$tag2->_id) {
     $tag2->name = $line["tag_name_2"];
     $tag2->object_class = $object_class;
     $tag2->parent_id = $tag1->_id;
     if ($msg = $tag2->store()) {
         CAppUI::setMsg("Ligne {$line_number} : {$msg}", UI_MSG_WARNING);
         continue;
     } else {
         CAppUI::setMsg("{$tag2->_class}-msg-create", UI_MSG_OK);
     }
 }
 // CONCEPT
 $concept_prop = CValue::read($prop_map, CMbString::lower($line["concept_type"]));
 if (!$concept_prop) {
     CAppUI::setMsg("Ligne {$line_number} : type de concept invalide : <strong>{$line['concept_type']}</strong>", UI_MSG_WARNING);
     continue;
 }
 // If list name provided, it needs to exist
 if ($line["list_name"]) {
     $_list = new CExList();
     $_list->name = $line["list_name"];
     if (!$_list->loadMatchingObject()) {
         CAppUI::setMsg("Ligne {$line_number} : nom de liste introuvable : <strong>{$line['list_name']}</strong>", UI_MSG_WARNING);
         continue;
     }
 }
 $concept = new CExConcept();
 $ds = $concept->_spec->ds;
 /**
  * @see parent::updatePlainFields()
  */
 function updatePlainFields()
 {
     parent::updatePlainFields();
     if ($this->nom) {
         $this->nom = CMbString::upper($this->nom);
     }
     if ($this->nom_jeune_fille) {
         $this->nom_jeune_fille = CMbString::upper($this->nom_jeune_fille);
     }
     if ($this->prenom) {
         $this->prenom = CMbString::capitalize(CMbString::lower($this->prenom));
     }
 }
Пример #5
0
$where = "WHERE {$column} LIKE '{$needle}'";
// France
if (CAppUI::conf("dPpatients INSEE france")) {
    $nbPays++;
    $queryFrance = "SELECT commune, code_postal, departement, 'France' AS pays FROM communes_france {$where}";
}
// Suisse
if (CAppUI::conf("dPpatients INSEE suisse")) {
    $nbPays++;
    $querySuisse = "SELECT commune, code_postal, '' AS departement, 'Suisse' AS pays FROM communes_suisse {$where}";
}
if (CAppUI::conf("dPpatients INSEE france")) {
    $france = $ds->loadList($queryFrance, intval($max / $nbPays));
    $matches = array_merge($matches, $france);
}
if (CAppUI::conf("dPpatients INSEE suisse")) {
    $suisse = $ds->loadList($querySuisse, intval($max / $nbPays));
    $matches = array_merge($matches, $suisse);
}
array_multisort(CMbArray::pluck($matches, "code_postal"), SORT_ASC, CMbArray::pluck($matches, "commune"), SORT_ASC, $matches);
foreach ($matches as $key => $_match) {
    $matches[$key]["commune"] = CMbString::capitalize(CMbString::lower($matches[$key]["commune"]));
    $matches[$key]["departement"] = CMbString::capitalize(CMbString::lower($matches[$key]["departement"]));
    $matches[$key]["pays"] = CMbString::capitalize(CMbString::lower($matches[$key]["pays"]));
}
// Template
$smarty = new CSmartyDP();
$smarty->assign("keyword", $keyword);
$smarty->assign("matches", $matches);
$smarty->assign("nodebug", true);
$smarty->display("autocomplete_cp_commune.tpl");
 /**
  * store the patient
  *
  * @param String[] $identifier identifier
  * @param CPatient $patient    patient
  * @param DOMNode  $node       node
  *
  * @return null|CHPrimSanteError
  */
 function storePatient($identifier, $patient, $node)
 {
     $sender = $this->_ref_sender;
     if ($identifier["merge"] === "FU") {
         return $this->mergePatient($identifier, $sender->_tag_patient, $patient);
     }
     //@todo voir pour nouveau né
     /**
      * H2.3C: Si le patient est un nouveau né, les champs 8.3 et 8.5 peuvent contenir les numéros permanent et
      * dossier administratif de la mère. Dans ce cas, afin de distinguer (en plus des nom et prénom) le nouveau né de sa mère,
      * et pour permettre une meilleure gestion des admissions, il faut renseigner le sous-champ 8.5.2, dans les contextes ADM et ORM.
      */
     $person = $this->getNamePerson($node);
     $patient->nom_jeune_fille = $person["family_name"];
     $patient->nom = $person["name"];
     $patient->prenom = $person["firstname"];
     $patient->prenom_2 = $person["secondname"];
     $patient->civilite = CMbString::lower($person["civilite"]);
     $patient->naissance = $this->getBirthdate($node);
     $patient->sexe = CMbString::lower($this->getSexPerson($node));
     $address = $this->getAddress($node);
     $address["street"] .= $address["comp"] ? "\n{$address["comp"]}" : null;
     $patient->adresse = $address["street"];
     $patient->ville = $address["city"];
     $patient->pays = $address["country"];
     $patient->cp = $address["postal"];
     $phone = $this->getPhone($node);
     $patient->tel = CMbArray::get($phone, 0);
     $patient->tel2 = CMbArray::get($phone, 1);
     $patient->situation_famille = $this->getMaritalStatus($node);
     $patient->deces = $this->getDeathDate($node);
     $patient->repair();
     if ($msg = $patient->store()) {
         return new CHPrimSanteError($this->_ref_exchange_hpr, "P", "08", array("P", $this->loop, $this->identifier_patient), "8.3", $msg);
     }
     /*$ins = $this->getINS($node);
     
         foreach ($ins as $_ins) {
           $ins_patient           = new CINSPatient();
           $ins_patient->ins      = $_ins["ins"];
           $ins_patient->type     = substr($_ins["type"], -1);
           $ins_patient->date     = $_ins["date"];
           $ins_patient->provider = $sender->nom;
     
           if ($msg = $ins_patient->store()) {
             return new CHPrimSanteError($this->_ref_exchange_hpr, "P", "11", array("P", $this->loop, $this->identifier_patient), "8.12", $msg);
           }
         }*/
     return null;
 }
Пример #7
0
 /**
  * Get all number patient by a state and the filter
  *
  * @param String $date_min Date minimum
  * @param String $date_max Date maximum
  *
  * @return array
  */
 static function getAllNumberPatient($date_min = null, $date_max = null)
 {
     $patients_count = array();
     $leftjoin = null;
     $where = array();
     if ($date_min) {
         $where["entree"] = ">= '{$date_min}'";
         $leftjoin["sejour"] = "patients.patient_id = sejour.patient_id";
     }
     if ($date_max) {
         $where["entree"] = "<= '{$date_max}'";
         $leftjoin["sejour"] = "patients.patient_id = sejour.patient_id";
     }
     $ds = CSQLDataSource::get("std");
     $request = new CRequest();
     $request->addSelect("`status`, COUNT(DISTINCT(`patients`.`patient_id`)) as `total`");
     $request->addTable("patients");
     $request->addLJoin($leftjoin);
     $request->addWhere($where);
     $request->addGroup("`status`");
     $result = $ds->loadList($request->makeSelect());
     $state_count = array();
     foreach ($result as $_result) {
         $state_count[$_result["status"]] = $_result["total"];
     }
     foreach (self::$list_state as $_state) {
         $patients_count[CMbString::lower($_state)] = CMbArray::get($state_count, $_state, 0);
         if ($_state == "CACH") {
             $where = array("vip" => "= '1'", "status" => "!= 'VALI'");
             $patient = new CPatient();
             $patients_count[CMbString::lower($_state)] = $patient->countList($where, null, $leftjoin);
         }
         if ($_state == "DPOT") {
             $patient_link = new CPatientLink();
             $patients_count[CMbString::lower($_state)] = $patient_link->countList($where, null, array("sejour" => "patient_link.patient_id1 = sejour.patient_id"));
         }
     }
     return $patients_count;
 }