/**
  * Récupération des éléments Reponses de l'acquittement
  *
  * @return array
  */
 function getAcquittementReponsesServeurActivitePmsi()
 {
     $xpath = new CHPrimXPath($this);
     $statut = $xpath->queryAttributNode("/hprim:a{$this->acquittement}/hprim:enteteMessage", null, "statut");
     $query = "/hprim:{$this->evenement}/hprim:enteteMessageAcquittement";
     $enteteMessageAcquittement = $xpath->queryUniqueNode($query);
     $observations = array();
     if ($statut == "ok") {
         $d = array();
         $observations[] =& $d;
         $observation = $xpath->queryUniqueNode("hprim:observation", $enteteMessageAcquittement);
         $d['code'] = chunk_split($xpath->queryTextNode("hprim:code", $observation, "", false), 4, ' ');
         $d['libelle'] = $xpath->queryTextNode("hprim:libelle", $observation, "", false);
         $d['commentaire'] = $xpath->queryTextNode("hprim:commentaire", $observation, "", false);
     } else {
         $query = "/hprim:{$this->evenements}/hprim:reponses/*";
         $reponses = $xpath->query($query);
         foreach ($reponses as $_reponse) {
             $d = array();
             $observation = $xpath->queryUniqueNode("hprim:observations/hprim:observation", $_reponse);
             $d['code'] = chunk_split($xpath->queryTextNode("hprim:code", $observation, "", false), 4, ' ');
             $d['libelle'] = $xpath->queryTextNode("hprim:libelle", $observation, "", false);
             $d['commentaire'] = $xpath->queryTextNode("hprim:commentaire", $observation, "", false);
             $observations[] = $d;
         }
     }
     return $observations;
 }
 /**
  * Sauvegarde des INSC
  *
  * @param CPatient $patient Patient
  * @param DOMNode  $node    Elément NumeroIdentifiantSante
  *
  * @return void
  */
 function storeINSC(CPatient $patient, DOMNode $node)
 {
     $xpath = new CHPrimXPath($node->ownerDocument);
     $list_insc = $xpath->query("insC", $node);
     $insc = new CINSPatient();
     $insc->type = "C";
     $insc->patient_id = $patient->_id;
     foreach ($list_insc as $_insc) {
         $ins = $xpath->queryTextNode("valeur", $_insc);
         $date = $xpath->queryTextNode("dateEffet", $_insc);
         if (!$ins) {
             continue;
         }
         $insc->ins_patient_id = null;
         $insc->date = null;
         $insc->provider = null;
         $insc->ins = $ins;
         $insc->loadMatchingObject();
         if ($insc->date < $date) {
             $insc->date = $date;
             $insc->provider = $this->_ref_sender->nom;
         }
         $insc->store();
     }
 }
 /**
  * Récupération des observations de l'acquittement patient
  *
  * @return array
  */
 function getAcquittementObservationPatients()
 {
     $xpath = new CHPrimXPath($this);
     $statut = $xpath->queryAttributNode("/hprim:acquittementsPatients/hprim:enteteMessageAcquittement", null, "statut");
     $query = "/hprim:acquittementsPatients/hprim:enteteMessageAcquittement";
     $enteteMessageAcquittement = $xpath->queryUniqueNode($query);
     $observations = array();
     if ($statut == "OK") {
         $d = array();
         $observations[] =& $d;
         $observation = $xpath->queryUniqueNode("hprim:observation", $enteteMessageAcquittement);
         $d['code'] = chunk_split($xpath->queryTextNode("hprim:code", $observation, "", false), 4, ' ');
         $d['libelle'] = $xpath->queryTextNode("hprim:libelle", $observation, "", false);
         $d['commentaire'] = $xpath->queryTextNode("hprim:commentaire", $observation, "", false);
     } else {
         $query = "/hprim:acquittementsPatients/hprim:erreursAvertissements/*";
         $erreursAvertissements = $xpath->query($query);
         foreach ($erreursAvertissements as $erreurAvertissement) {
             $d = array();
             $observation = $xpath->queryUniqueNode("hprim:observations/hprim:observation", $erreurAvertissement);
             $d['code'] = chunk_split($xpath->queryTextNode("hprim:code", $observation, "", false), 4, ' ');
             $d['libelle'] = $xpath->queryTextNode("hprim:libelle", $observation, "", false);
             $d['commentaire'] = $xpath->queryTextNode("hprim:commentaire", $observation, "", false);
             $observations[] = $d;
         }
     }
     return $observations;
 }
 /**
  * Mapp the montant node
  *
  * @param DOMNode $node Node
  *
  * @return array
  */
 function getMontant($node)
 {
     $xpath = new CHPrimXPath($node->ownerDocument);
     $data = array();
     $montant = $xpath->queryUniqueNode("hprim:montant", $node);
     $data["montantTotal"] = $xpath->queryTextNode("montantTotal", $montant);
     $data["numeroForfaitTechnique"] = $xpath->queryTextNode("numeroForfaitTechnique", $montant);
     $data["numeroAgrementAppareil"] = $xpath->queryTextNode("numeroAgrementAppareil", $montant);
     $data["montantDepassement"] = $xpath->queryTextNode("montantDepassement", $montant);
     return $data;
 }
 /**
  * Return person
  *
  * @param DOMNode   $node       Node
  * @param CMbObject $mbPersonne Person
  *
  * @return CMbObject|CMediusers|CPatient
  */
 static function getPersonne(DOMNode $node, CMbObject $mbPersonne)
 {
     $xpath = new CHPrimXPath($node->ownerDocument);
     $civilite = $xpath->queryAttributNode("hprim:civiliteHprim", $node, "valeur");
     $civiliteHprimConversion = array("mme" => "mme", "mlle" => "mlle", "mr" => "m", "dr" => "dr", "pr" => "pr", "bb" => "enf", "enf" => "enf");
     $nom = $xpath->queryTextNode("hprim:nomUsuel", $node);
     $prenoms = $xpath->getMultipleTextNodes("hprim:prenoms/*", $node);
     $adresses = $xpath->queryUniqueNode("hprim:adresses", $node);
     $adresse = $xpath->queryUniqueNode("hprim:adresse", $adresses);
     $ligne = $xpath->getMultipleTextNodes("hprim:ligne", $adresse, true);
     $ville = $xpath->queryTextNode("hprim:ville", $adresse);
     $cp = $xpath->queryTextNode("hprim:codePostal", $adresse);
     if ($cp) {
         $cp = preg_replace("/[^0-9]/", "", $cp);
     }
     $telephones = $xpath->getMultipleTextNodes("hprim:telephones/*", $node);
     $email = $xpath->getFirstTextNode("hprim:emails/*", $node);
     if ($mbPersonne instanceof CPatient) {
         if ($civilite) {
             $mbPersonne->civilite = $civiliteHprimConversion[$civilite];
         } else {
             if ($mbPersonne->civilite == null) {
                 $mbPersonne->civilite = "guess";
             }
         }
         $mbPersonne->nom = $nom;
         $mbPersonne->nom_jeune_fille = $xpath->queryTextNode("hprim:nomNaissance", $node);
         $mbPersonne->prenom = CMbArray::get($prenoms, 0);
         $mbPersonne->prenom_2 = CMbArray::get($prenoms, 1);
         $mbPersonne->prenom_3 = CMbArray::get($prenoms, 2);
         $mbPersonne->adresse = $ligne;
         $mbPersonne->ville = $ville;
         $mbPersonne->pays_insee = $xpath->queryTextNode("hprim:pays", $adresse);
         $pays = new CPaysInsee();
         $pays->numerique = $mbPersonne->pays_insee;
         $pays->loadMatchingObject();
         $mbPersonne->pays = $pays->nom_fr;
         $mbPersonne->cp = $cp;
         $tel1 = $tel2 = null;
         if (isset($telephones[0])) {
             $tel1 = $telephones[0];
         }
         if (isset($telephones[1])) {
             $tel2 = $telephones[1];
         }
         $mbPersonne->tel = $tel1 != $mbPersonne->tel2 && strlen($tel1) <= 10 ? $tel1 : null;
         $mbPersonne->tel2 = $tel2 != $mbPersonne->tel && strlen($tel2) <= 10 ? $tel2 : null;
         if (strlen($tel1) > 10) {
             $mbPersonne->tel_autre = $tel1;
         }
         if (strlen($tel2) > 10) {
             $mbPersonne->tel_autre = $tel2;
         }
         $mbPersonne->email = $email;
     } elseif ($mbPersonne instanceof CMediusers) {
         $mbPersonne->_user_last_name = $nom;
         $mbPersonne->_user_first_name = CMbArray::get($prenoms, 0);
         $mbPersonne->_user_email = $email;
         $mbPersonne->_user_phone = CMbArray::get($telephones, 0);
         $mbPersonne->_user_adresse = $ligne;
         $mbPersonne->_user_cp = $cp;
         $mbPersonne->_user_ville = $ville;
     }
     return $mbPersonne;
 }
 /**
  * Récupération de l'identifiant source (emetteur)
  *
  * @param DOMNode $node   Node
  * @param bool    $valeur Valeur
  *
  * @return string
  */
 function getIdCible(DOMNode $node, $valeur = true)
 {
     $xpath = new CHPrimXPath($this);
     $identifiant = $xpath->queryUniqueNode("hprim:identifiant", $node);
     if ($valeur) {
         $recepteur = $xpath->queryUniqueNode("hprim:recepteur", $identifiant);
         return $xpath->queryTextNode("hprim:valeur", $recepteur);
     } else {
         return $xpath->queryTextNode("hprim:recepteur", $identifiant);
     }
 }