/**
  * Get contents XML
  *
  * @return array
  */
 function getContentsXML()
 {
     $data = array();
     $xpath = new CHPrimXPath($this);
     $evenementsServeurEtatsPatient = $xpath->queryUniqueNode("/hprim:evenementsServeurEtatsPatient");
     $data['patient'] = $xpath->queryUniqueNode("hprim:patient", $evenementsServeurEtatsPatient);
     $data['idSourcePatient'] = $this->getIdSource($data['patient']);
     $data['idCiblePatient'] = $this->getIdCible($data['patient']);
     $data['venue'] = $xpath->queryUniqueNode("hprim:venue", $evenementsServeurEtatsPatient);
     $data['idSourceVenue'] = $this->getIdSource($data['venue']);
     $data['idCibleVenue'] = $this->getIdCible($data['venue']);
     return $data;
 }
 /**
  * @see parent::getContentsXML()
  */
 function getContentsXML()
 {
     $xpath = new CHPrimXPath($this);
     $query = "/hprim:evenementsPatients/hprim:evenementPatient";
     $evenementPatient = $xpath->queryUniqueNode($query);
     $enregistrementPatient = $xpath->queryUniqueNode("hprim:enregistrementPatient", $evenementPatient);
     $data['action'] = $this->getActionEvenement("hprim:enregistrementPatient", $evenementPatient);
     $data['patient'] = $xpath->queryUniqueNode("hprim:patient", $enregistrementPatient);
     $data['idSourcePatient'] = $this->getIdSource($data['patient']);
     $data['idCiblePatient'] = $this->getIdCible($data['patient']);
     $data["numeroSante"] = $xpath->queryUniqueNode("hprim:numeroIdentifiantSante", $enregistrementPatient);
     return $data;
 }
 /**
  * @see parent::getContentsXML()
  */
 function getContentsXML()
 {
     $xpath = new CHPrimXPath($this);
     $query = "/hprim:evenementsPatients/hprim:evenementPatient";
     $evenementPatient = $xpath->queryUniqueNode($query);
     $venuePatient = $xpath->queryUniqueNode("hprim:venuePatient", $evenementPatient);
     $data['action'] = $this->getActionEvenement("hprim:venuePatient", $evenementPatient);
     $data['patient'] = $xpath->queryUniqueNode("hprim:patient", $venuePatient);
     $data['venue'] = $xpath->queryUniqueNode("hprim:venue", $venuePatient);
     $data['idSourcePatient'] = $this->getIdSource($data['patient']);
     $data['idCiblePatient'] = $this->getIdCible($data['patient']);
     $data['idSourceVenue'] = $this->getIdSource($data['venue']);
     $data['idCibleVenue'] = $this->getIdCible($data['venue']);
     return $data;
 }
 /**
  * Get contents XML
  *
  * @return array
  */
 function getContentsXML()
 {
     $data = array();
     $xpath = new CHPrimXPath($this);
     $evenementsServeurActes = $xpath->queryUniqueNode("/hprim:evenementsServeurActes");
     $evenementServeurIntervention = $xpath->queryUniqueNode("/hprim:evenementsServeurActes/hprim:evenementServeurIntervention");
     $data['action'] = $this->getActionEvenement("hprim:evenementServeurIntervention ", $evenementsServeurActes);
     $data['patient'] = $xpath->queryUniqueNode("hprim:patient", $evenementServeurIntervention);
     $data['idSourcePatient'] = $this->getIdSource($data['patient']);
     $data['idCiblePatient'] = $this->getIdCible($data['patient']);
     $data['venue'] = $xpath->queryUniqueNode("hprim:venue", $evenementServeurIntervention);
     $data['idSourceVenue'] = $this->getIdSource($data['venue']);
     $data['idCibleVenue'] = $this->getIdCible($data['venue']);
     $data['intervention'] = $xpath->queryUniqueNode("hprim:intervention", $evenementServeurIntervention);
     $data['idSourceIntervention'] = $this->getIdSource($data['intervention'], false);
     $data['idCibleIntervention'] = $this->getIdCible($data['intervention'], false);
     return $data;
 }
 /**
  * Get content XML
  *
  * @return array
  */
 function getContentsXML()
 {
     $xpath = new CHPrimXPath($this);
     $query = "/hprim:evenementsPatients/hprim:evenementPatient";
     $evenementPatient = $xpath->queryUniqueNode($query);
     $mouvementPatient = $xpath->queryUniqueNode("hprim:mouvementPatient", $evenementPatient);
     $data['action'] = $this->getActionEvenement("hprim:mouvementPatient", $evenementPatient);
     $data['patient'] = $xpath->queryUniqueNode("hprim:patient", $mouvementPatient);
     $data['idSourcePatient'] = $this->getIdSource($data['patient']);
     $data['idCiblePatient'] = $this->getIdCible($data['patient']);
     $data['venue'] = $xpath->queryUniqueNode("hprim:venue", $mouvementPatient);
     $data['idSourceVenue'] = $this->getIdSource($data['venue']);
     $data['idCibleVenue'] = $this->getIdCible($data['venue']);
     $data['priseEnCharge'] = $xpath->queryUniqueNode("hprim:priseEnCharge", $mouvementPatient);
     $data['mouvements'] = $xpath->queryUniqueNode("hprim:mouvements", $mouvementPatient);
     $data['voletMedical'] = $xpath->queryUniqueNode("hprim:voletMedical", $mouvementPatient);
     $data['dossierResume'] = $xpath->queryUniqueNode("hprim:dossierResume", $mouvementPatient);
     return $data;
 }
 /**
  * Get content XML
  *
  * @return array
  */
 function getContentsXML()
 {
     $data = array();
     $xpath = new CHPrimXPath($this);
     $evenementServeurActe = $xpath->queryUniqueNode("/hprim:evenementsServeurActes/hprim:evenementServeurActe");
     $data['patient'] = $xpath->queryUniqueNode("hprim:patient", $evenementServeurActe);
     //@todo ajouter une configuration pour intervertir le source et le cible
     $data['idSourcePatient'] = $this->getIdCible($data['patient']);
     $data['idCiblePatient'] = $this->getIdSource($data['patient']);
     $data['venue'] = $xpath->queryUniqueNode("hprim:venue", $evenementServeurActe);
     //@todo ajouter une configuration pour intervertir le source et le cible
     $data['idSourceVenue'] = $this->getIdCible($data['venue']);
     $data['idCibleVenue'] = $this->getIdSource($data['venue']);
     $data['intervention'] = $xpath->queryUniqueNode("hprim:intervention", $evenementServeurActe);
     $data['idSourceIntervention'] = $this->getIdSource($data['intervention'], false);
     $data['idCibleIntervention'] = $this->getIdCible($data['intervention'], false);
     $data['actesCCAM'] = $xpath->queryUniqueNode("hprim:actesCCAM", $evenementServeurActe);
     $data['actesNGAP'] = $xpath->queryUniqueNode("hprim:actesNGAP", $evenementServeurActe);
     return $data;
 }
 /**
  * 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;
 }
 /**
  * Récupération de l'assuré
  *
  * @param DOMNode  $node      Node
  * @param CPatient $mbPatient Patient
  *
  * @return CPatient
  */
 static function getAssure(DOMNode $node, CPatient $mbPatient)
 {
     $xpath = new CHPrimXPath($node->ownerDocument);
     $immatriculation = $xpath->queryTextNode("hprim:immatriculation", $node);
     $mbPatient->matricule = $immatriculation;
     $mbPatient->assure_matricule = $immatriculation;
     $personne = $xpath->queryUniqueNode("hprim:personne", $node);
     if (!$personne) {
         return $mbPatient;
     }
     $sexe = $xpath->queryAttributNode("hprim:personne", $node, "sexe");
     $sexeConversion = array("M" => "m", "F" => "f");
     $mbPatient->assure_sexe = $sexeConversion[$sexe];
     $mbPatient->assure_nom = $xpath->queryTextNode("hprim:nomUsuel", $personne);
     $prenoms = $xpath->getMultipleTextNodes("hprim:prenoms/*", $personne);
     $mbPatient->assure_prenom = CMbArray::get($prenoms, 0);
     $mbPatient->assure_prenom_2 = CMbArray::get($prenoms, 1);
     $mbPatient->assure_prenom_3 = CMbArray::get($prenoms, 2);
     $mbPatient->assure_naissance = $xpath->queryTextNode("hprim:naissance", $personne);
     $elementDateNaissance = $xpath->queryUniqueNode("hprim:dateNaissance", $personne);
     $mbPatient->assure_naissance = $xpath->queryTextNode("hprim:date", $elementDateNaissance);
     $mbPatient->rang_beneficiaire = $xpath->queryTextNode("hprim:lienAssure", $node);
     $mbPatient->qual_beneficiaire = CValue::read(CPatient::$rangToQualBenef, $mbPatient->rang_beneficiaire);
     return $mbPatient;
 }
 /**
  * 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);
     }
 }