/**
  * @see parent::build
  */
 function build(CHPrimSanteEvent $event)
 {
     parent::build($event);
     $patient = $this->patient;
     $sejour = $this->sejour;
     $actor = isset($event->_sender->_id) ? $event->_sender : $event->_receiver;
     $group = $actor->loadRefGroup();
     $patient->loadIPP($group->_id);
     // P-1: type segment - P(par défaut) (ST)
     // P-2: rang segment - (NM)
     $data[] = "1";
     // P-3: Patient ID (SPEC) (optional)
     $data[] = array(array($patient->_IPP, $patient->_patient_elimine ? $patient->_patient_elimine->_IPP : null, $patient->_patient_elimine ? "FU" : null));
     // P-4: Patient ID (ST) (optional)
     $data[] = null;
     // P-5: sejour ID (ST) (optional)
     $data[] = null;
     // P-6: Nom patient (PN) (optional)
     $data[] = array(array($patient->_p_last_name, $patient->_p_first_name, $patient->prenom_2, $patient->civilite));
     // P-7: Nom de naissance (ST) (optional)
     $data[] = $patient->_p_maiden_name;
     // P-8: Date de naissance (TS) (optional)
     $data[] = $patient->_p_birth_date;
     // P-9: Sexe (ID) (optional)
     $data[] = CMbString::upper($patient->sexe);
     // P-10: race (forbidden)
     $data[] = null;
     $address = explode("\n", $patient->_p_street_address, 1);
     // P-11: adresse (AD) (optional)
     $data[] = array(array(CMbArray::get($address, 0), str_replace("\n", " ", CMbArray::get($address, 1)), $patient->_p_city, null, $patient->_p_postal_code, $patient->pays_insee));
     // P-12: INS (version 2.3) (optional)
     $data[] = null;
     // P-13: téléphone (TN) (optional) (repeatable)
     $data[] = array($patient->_p_phone_number, $patient->_p_mobile_phone_number);
     // P-14: Médecins (CNA) (optional) (repeatable)
     $data[] = null;
     // P-15: Traitement local 1 (ST) (optional)
     $data[] = null;
     // P-16: Traitement local 2 (ST) (optional)
     $data[] = null;
     // P-17: Taille (CQ) (optional)
     $data[] = null;
     // P-18: Poids (CQ) (optional)
     $data[] = null;
     // P-19: Diagnostic (CE) (optional) (repeatable)
     $data[] = null;
     // P-20: Traitement (ST) (optional) (repeatable)
     $data[] = null;
     // P-21: Régime (ST) (optional)
     $data[] = null;
     // P-22: Commentaire 1 (ST) (optional)
     $data[] = null;
     // P-23: Commentaire 2 (ST) (optional)
     $data[] = null;
     // P-24: Date de mouvement (TS) (optional) (repeatable)
     $data[] = null;
     // P-25: Statut de l'admission (ID) (optional)
     $data[] = null;
     // P-26: Localisation (SPEC) (optional)
     $data[] = null;
     // P-27: classification diagnostic (CE) (optional)
     $data[] = null;
     // P-28: Religion (forbidden)
     $data[] = null;
     // P-29: Situation maritale (ID) (optional)
     $data[] = $this->getMaritalStatus($patient->situation_famille);
     // P-30: Précauton à prendre (ID) (optional)
     $data[] = null;
     // P-31: Langue (ST) (optional)
     $data[] = null;
     // P-32: Statut de confidentialité (ID) (optional)
     $data[] = null;
     // P-33: Date de dernière modification (TS) (optional)
     $data[] = null;
     // P-34: Date de décès (TS) (optional)
     $data[] = null;
     $this->fill($data);
 }
 /**
  * @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));
     }
 }
Example #3
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;
 }
 /**
  * Chargement de l'utilisateur système
  *
  * @return CUser
  */
 function loadRefUser()
 {
     $user = new CUser();
     // Usefull hack for mass preloading
     if (self::$user_autoload) {
         $user = $user->getCached($this->user_id);
     }
     if ($user->_id) {
         $this->_user_type = $user->user_type;
         $this->_user_username = $user->user_username;
         $this->_user_password = $user->user_password;
         $this->_user_first_name = CMbString::capitalize($user->user_first_name);
         $this->_user_last_name = CMbString::upper($user->user_last_name);
         $this->_user_email = $user->user_email;
         $this->_user_phone = $user->user_phone;
         $this->_user_astreinte = $user->user_astreinte;
         $this->_user_adresse = $user->user_address1;
         $this->_user_cp = $user->user_zip;
         $this->_user_ville = $user->user_city;
         $this->_user_template = $user->template;
         $this->_profile_id = $user->profile_id;
         $this->_force_change_password = $user->force_change_password;
         // Encrypt this datas
         $this->checkConfidential();
         $this->_view = "{$this->_user_last_name} {$this->_user_first_name}";
         $this->_shortview = "";
         // Initiales
         if (!($this->_shortview = $this->initials)) {
             $this->_shortview .= CMbString::makeInitials($this->_user_first_name, "-");
             $this->_shortview .= CMbString::makeInitials($this->_user_last_name);
         }
         $this->_user_type_view = CValue::read(CUser::$types, $this->_user_type);
     }
     $this->_ref_user = $user;
     $this->mapPerson();
     $this->updateSpecs();
     return $this->_ref_user;
 }
Example #5
0
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $this->_view = $this->text;
     $this->_shortview = $this->initials;
     if (!$this->_shortview) {
         $_initials = preg_replace('/[a-z]+\'/', '', $this->text);
         $_initials = str_replace('-', ' ', $_initials);
         $_initials = str_split($_initials);
         $this->_shortview = '';
         foreach ($_initials as $_letter) {
             if (ctype_upper($_letter)) {
                 $this->_shortview .= $_letter;
             }
         }
         if (strlen($this->_shortview) < 2) {
             $this->_shortview = CMbString::upper(substr($this->text, 0, 3));
         } else {
             $this->_shortview = substr($this->_shortview, 0, 5);
         }
     }
 }
Example #6
0
 /**
  * @see parent::updateFormFields()
  */
 function updateFormFields()
 {
     parent::updateFormFields();
     $user_first_name = CMbString::capitalize($this->user_first_name);
     $user_last_name = CMbString::upper($this->user_last_name);
     $this->_view = "{$user_last_name} {$user_first_name}";
     $this->_login_locked = $this->user_login_errors >= CAppUI::conf('admin CUser max_login_attempts');
     $this->_user_type_view = CValue::read(self::$types, $this->user_type);
     $this->mapPerson();
 }
 $current_class = null;
 $current_group = null;
 $line_number = 0;
 while ($current_line = fgetcsv($fp, null, $separator, $enclosure)) {
     $line_number++;
     $current_line = array_map("trim", $current_line);
     $current_line = array_map("reduce_whitespace", $current_line);
     $current_line = array_combine($keys, $current_line);
     foreach ($current_line as $_key => $_value) {
         if (in_array($_key, $multiline) && $_value == "") {
             $current_line[$_key] = $line[$_key];
         }
     }
     $line = $current_line;
     // EX CLASS
     if (empty($line["group_1"]) && empty($line["group_2"]) && $line["field_name"] === CMbString::upper($line["field_name"])) {
         // we assume exclasses are uppercase
         $current_group = null;
         $current_class = new CExClass();
         $class = $line["field_name"];
         $ds = $current_class->_spec->ds;
         $where = array("name" => $ds->prepare("=%", $class));
         $current_class->loadObject($where);
         if (!$current_class->_id) {
             CAppUI::setMsg("Ligne {$line_number} : formulaire non trouvé ({$class})", UI_MSG_WARNING);
         }
         continue;
     }
     // EX CLASS FIELD GROUP
     if (!empty($line["group_1"]) && !empty($current_class->_id)) {
         $current_group = new CExClassFieldGroup();
 /**
  * Ajout de l'assuré
  *
  * @param DOMNode  $elParent  Node
  * @param CPatient $mbPatient Patient
  *
  * @return void
  */
 function addAssure(DOMNode $elParent, CPatient $mbPatient)
 {
     $this->addElement($elParent, "immatriculation", $mbPatient->matricule);
     $personne = $this->addElement($elParent, "personne");
     $sexeConversion = array("m" => "M", "f" => "F");
     $sexe = $mbPatient->assure_sexe ? $sexeConversion[$mbPatient->assure_sexe] : "I";
     $this->addAttribute($personne, "sexe", $sexe);
     $assure_nom = $mbPatient->assure_nom;
     $assure_nom_jeune_fille = $mbPatient->assure_nom_jeune_fille;
     $assure_prenom = $mbPatient->assure_prenom;
     $assure_prenom_2 = $mbPatient->assure_prenom_2;
     $assure_prenom_3 = $mbPatient->assure_prenom_3;
     $assure_prenom_4 = $mbPatient->assure_prenom_4;
     $assure_adresse = $mbPatient->assure_adresse;
     $assure_ville = $mbPatient->assure_ville;
     if (isset($this->_ref_receiver->_id) && $this->_ref_receiver->_configs["uppercase_fields"]) {
         $assure_nom = CMbString::upper($assure_nom);
         $assure_nom_jeune_fille = CMbString::upper($assure_nom_jeune_fille);
         $assure_prenom = CMbString::upper($assure_prenom);
         $assure_prenom_2 = CMbString::upper($assure_prenom_2);
         $assure_prenom_3 = CMbString::upper($assure_prenom_3);
         $assure_prenom_4 = CMbString::upper($assure_prenom_4);
         $assure_adresse = CMbString::upper($assure_adresse);
         $assure_ville = CMbString::upper($assure_ville);
     }
     $this->addTexte($personne, "nomUsuel", $assure_nom);
     $this->addTexte($personne, "nomNaissance", $assure_nom_jeune_fille);
     $prenoms = $this->addElement($personne, "prenoms");
     $this->addTexte($prenoms, "prenom", $assure_prenom);
     $this->addTexte($prenoms, "prenom", $assure_prenom_2);
     $this->addTexte($prenoms, "prenom", $assure_prenom_3);
     $this->addTexte($prenoms, "prenom", $assure_prenom_4);
     $adresses = $this->addElement($personne, "adresses");
     $adresse = $this->addElement($adresses, "adresse");
     $this->addTexte($adresse, "ligne", substr($assure_adresse, 0, 35));
     $this->addTexte($adresse, "ville", $assure_ville);
     if ($mbPatient->assure_pays_insee) {
         $this->addElement($adresse, "pays", str_pad($mbPatient->assure_pays_insee, 3, '0', STR_PAD_LEFT));
     }
     $this->addElement($adresse, "codePostal", $mbPatient->assure_cp);
     $dateNaissance = $this->addElement($personne, "dateNaissance");
     $assureNaissance = $mbPatient->assure_naissance ? $mbPatient->assure_naissance : $mbPatient->naissance;
     $this->addElement($dateNaissance, CMbDT::isLunarDate($assureNaissance) ? "dateLunaire" : "date", $assureNaissance);
     $this->addElement($elParent, "lienAssure", $mbPatient->rang_beneficiaire);
 }