function updatePatNumPaysInsee($nomPays) { $pays = new CPaysInsee(); $pays->nom_fr = $this->_spec->ds->escape($nomPays); $pays->loadMatchingObject(); if (!$pays->_id) { return "000"; } return $pays->numerique; }
/** * Get first name * * @param string $adress Adress * @param CPatient $newPatient Person * * @return void */ function getAdress($adress, CPatient $newPatient) { $newPatient->adresse = $adress["adresse"]; if ($adress["adresse_comp"]) { $newPatient->adresse .= $this->getCompAdress($adress["adresse_comp"]); } $newPatient->ville = $adress["ville"]; $newPatient->cp = $adress["cp"]; if ($adress["pays_insee"]) { $pays = CPaysInsee::getPaysByAlpha($adress["pays_insee"]); $newPatient->pays_insee = $pays->numerique; } }
/** * Build PID segement * * @param CHL7v2Event $event Event * * @return null */ function build(CHL7v2Event $event) { parent::build($event); $message = $event->message; $sender = $event->_sender; $group = $sender->loadRefGroup(); $domains_returned = $this->domains_returned; $patient = $this->patient; $data = array(); // PID-1: Set ID - PID (SI) (optional) $data[] = $this->set_id; // PID-2: Patient ID (CX) (optional) $data[] = null; $identifiers = array(); if (empty($domains_returned)) { $idex = new CIdSante400(); $idex->object_id = $patient->_id; $idex->object_class = "CPatient"; $ljoin = array(); $ljoin[] = "group_domain AS g1 ON g1.domain_id = domain.domain_id AND g1.object_class = 'CPatient'"; foreach ($idex->loadMatchingList() as $_idex) { $domain = new CDomain(); $where["tag"] = " = '{$_idex->tag}'"; $domain->loadObject($where, null, null, $ljoin); if (!$domain->_id) { continue; } $identifiers[] = array($_idex->id400, null, null, $this->getAssigningAuthority("domain", null, null, $domain), "MR"); } } else { foreach ($domains_returned as $_domain_returned) { $assigning_authority = $this->getAssigningAuthority("domain", null, null, $_domain_returned); $identifiers[] = array(CIdSante400::getValueFor($patient, $_domain_returned->tag), null, null, $assigning_authority, "MR"); } } // PID-3: Patient Identifier List (CX) (repeating) $data[] = $identifiers; // PID-4: Alternate Patient ID - PID (CX) (optional repeating) $data[] = null; // PID-5: Patient Name (XPN) (repeating) $data[] = $this->getXPN($patient); // PID-6: Mother's Maiden Name (XPN) (optional repeating) $data[] = null; // PID-7: Date/Time of Birth (TS) (optional) $data[] = CMbDT::isLunarDate($patient->naissance) ? null : $patient->naissance; // PID-8: Administrative Sex (IS) (optional) // Table - 0001 // F - Female // M - Male // O - Other // U - Unknown // A - Ambiguous // N - Not applicable $data[] = CHL7v2TableEntry::mapTo("1", $patient->sexe); // PID-9: Patient Alias (XPN) (optional repeating) $data[] = null; // PID-10: Race (CE) (optional repeating) $data[] = null; // PID-11: Patient Address (XAD) (optional repeating) $address = array(); if ($patient->adresse || $patient->ville || $patient->cp) { $linesAdress = explode("\n", $patient->adresse, 2); $address[] = array(CValue::read($linesAdress, 0), str_replace("\n", $message->componentSeparator, CValue::read($linesAdress, 1)), $patient->ville, $patient->province, $patient->cp, CPaysInsee::getAlpha3($patient->pays_insee), "H"); } if ($patient->lieu_naissance || $patient->cp_naissance || $patient->pays_naissance_insee) { $address[] = array(null, null, $patient->lieu_naissance, null, $patient->cp_naissance, CPaysInsee::getAlpha3($patient->pays_naissance_insee), "BDL"); } $data[] = $address; // PID-12: County Code (IS) (optional) $data[] = null; // PID-13: Phone Number - Home (XTN) (optional repeating) // Table - 0201 // ASN - Answering Service Number // BPN - Beeper Number // EMR - Emergency Number // NET - Network (email) Address // ORN - Other Residence Number // PRN - Primary Residence Number // VHN - Vacation Home Number // WPN - Work Number // Table - 0202 // BP - Beeper // CP - Cellular Phone // FX - Fax // Internet - Internet Address: Use Only If Telecommunication Use Code Is NET // MD - Modem // PH - Telephone // TDD - Telecommunications Device for the Deaf // TTY - Teletypewriter $phones = array(); if ($patient->tel) { $area_city_code = null; $local_number = null; if ($sender->_configs["send_area_local_number"]) { $area_city_code = substr($patient->tel, 0, 3); $local_number = substr($patient->tel, 3); } $phones[] = array(null, "PRN", "PH", null, null, $area_city_code, $local_number, null, null, null, null, $sender->_configs["send_area_local_number"] ? null : $patient->tel); } $data[] = $phones; // PID-14: Phone Number - Business (XTN) (optional repeating) $data[] = null; // PID-15: Primary Language (CE) (optional) $data[] = null; // PID-16: Marital Status (CE) (optional) $data[] = null; // PID-17: Religion (CE) (optional) $data[] = null; // PID-18: Patient Account Number (CX) (optional) if ($this->sejour) { $sejour = $this->sejour; $sejour->loadNDA($group->_id); $domain = new CDomain(); $domain->tag = $sejour->getTagNDA(); $domain->loadMatchingObject(); $data[] = $sejour->_NDA ? array(array($sejour->_NDA, null, null, $this->getAssigningAuthority("domain", null, null, $domain))) : null; } else { $data[] = null; } // PID-19: SSN Number - Patient (ST) (optional) $data[] = $patient->matricule; // PID-20: Driver's License Number - Patient (DLN) (optional) $data[] = null; // PID-21: Mother's Identifier (CX) (optional repeating) $data[] = null; // PID-22: Ethnic Group (CE) (optional repeating) $data[] = null; // PID-23: Birth Place (ST) (optional) $data[] = null; // PID-24: Multiple Birth Indicator (ID) (optional) $data[] = null; // PID-25: Birth Order (NM) (optional) $data[] = $patient->rang_naissance; // PID-26: Citizenship (CE) (optional repeating) $data[] = null; // PID-27: Veterans Military Status (CE) (optional) $data[] = null; // PID-28: Nationality (CE) (optional) $data[] = null; // PID-29: Patient Death Date and Time (TS) (optional) $data[] = $patient->deces ? $patient->deces : null; // PID-30: Patient Death Indicator (ID) (optional) $data[] = $patient->deces ? "Y" : "N"; // PID-31: Identity Unknown Indicator (ID) (optional) $data[] = null; // PID-32: Identity Reliability Code (IS) (optional repeating) $data[] = null; // PID-33: Last Update Date/Time (TS) (optional) $data[] = null; // PID-34: Last Update Facility (HD) (optional) $data[] = null; // PID-35: Species Code (CE) (optional) $data[] = null; // PID-36: Breed Code (CE) (optional) $data[] = null; // PID-37: Strain (ST) (optional) $data[] = null; // PID-38: Production Class Code (CE) (optional) $data[] = null; // PID-39: Tribal Citizenship (CWE) (optional repeating) $data[] = null; $this->fill($data); }
/** * Build PID segement * * @param CHL7v2Event $event Event * * @return null */ function build(CHL7v2Event $event) { parent::build($event); $message = $event->message; $receiver = $event->_receiver; $group = $receiver->loadRefGroup(); $patient = $this->patient; $mother = null; $sejour_maman = null; $naissance = null; if ($patient->_naissance_id) { $naissance = new CNaissance(); $naissance->load($patient->_naissance_id); $sejour_maman = $naissance->loadRefSejourMaman(); $sejour_maman->loadNDA($group->_id); $sejour_maman->loadRefPatient()->loadIPP($group->_id); $mother = $sejour_maman->_ref_patient; } $data = array(); // PID-1: Set ID - PID (SI) (optional) $data[] = $this->set_id; // PID-2: Patient ID (CX) (optional) $data[] = null; // PID-3: Patient Identifier List (CX) (repeating) $data[] = $this->getPersonIdentifiers($patient, $group, $receiver); // PID-4: Alternate Patient ID - PID (CX) (optional repeating) $data[] = null; // PID-5: Patient Name (XPN) (repeating) $data[] = $this->getXPN($patient, $receiver); // PID-6: Mother's Maiden Name (XPN) (optional repeating) if ($patient->nom_jeune_fille && $receiver->_configs["build_PID_6"] == "nom_naissance") { $anonyme = is_numeric($patient->nom); $mode_identito_vigilance = $receiver->_configs["mode_identito_vigilance"]; $prenom = CPatient::applyModeIdentitoVigilance($patient->prenom, true, $mode_identito_vigilance, $anonyme); $nom_jf = CPatient::applyModeIdentitoVigilance($patient->nom_jeune_fille, true, $mode_identito_vigilance, $anonyme); $data[] = array(array($nom_jf, $prenom, null, null, null, null, null, "L")); } else { // Dans le cas d'une naissance on va mettre l'identité de la mère $data[] = $mother ? $this->getXPN($mother, $receiver) : null; } // PID-7: Date/Time of Birth (TS) (optional) if ($patient->_naissance_id) { $data[] = $naissance->date_time; } else { if ($patient->naissance) { $data[] = CMbDT::isLunarDate($patient->naissance) ? null : $patient->naissance; } else { $data[] = null; } } // PID-8: Administrative Sex (IS) (optional) // Table - 0001 // F - Female // M - Male // O - Other // U - Unknown // A - Ambiguous // N - Not applicable $sexe = CHL7v2TableEntry::mapTo("1", $patient->sexe); $data[] = $sexe ?: "U"; // PID-9: Patient Alias (XPN) (optional repeating) $data[] = null; // PID-10: Race (CE) (optional repeating) $data[] = null; // PID-11: Patient Address (XAD) (optional repeating) $address = array(); if ($patient->adresse || $patient->ville || $patient->cp) { $linesAdress = explode("\n", $patient->adresse, 2); $address[] = array(CValue::read($linesAdress, 0), str_replace("\n", $message->componentSeparator, CValue::read($linesAdress, 1)), $patient->ville, null, $patient->cp, CPaysInsee::getAlpha3($patient->pays_insee), "H"); } if ($receiver->_configs["build_PID_11"] == "simple") { $address = array(reset($address)); } else { if ($patient->lieu_naissance || $patient->cp_naissance || $patient->pays_naissance_insee) { $address[] = array(null, null, $patient->lieu_naissance, null, $patient->cp_naissance, CPaysInsee::getAlpha3($patient->pays_naissance_insee), "BDL"); } } $data[] = $address; // PID-12: County Code (IS) (optional) $data[] = null; // PID-13: Phone Number - Home (XTN) (optional repeating) // Table - 0201 // ASN - Answering Service Number // BPN - Beeper Number // EMR - Emergency Number // NET - Network (email) Address // ORN - Other Residence Number // PRN - Primary Residence Number // VHN - Vacation Home Number // WPN - Work Number // Table - 0202 // BP - Beeper // CP - Cellular Phone // FX - Fax // Internet - Internet Address: Use Only If Telecommunication Use Code Is NET // MD - Modem // PH - Telephone // TDD - Telecommunications Device for the Deaf // TTY - Teletypewriter $phones = array(); if ($patient->tel) { $phones[] = $this->getXTN($receiver, $patient->tel, "PRN", "PH"); } if ($patient->tel2) { // Pour le portable on met soit PRN ou ORN $phones[] = $this->getXTN($receiver, $patient->tel2, $receiver->_configs["build_cellular_phone"], "CP"); } if ($patient->tel_autre) { $phones[] = $this->getXTN($receiver, $patient->tel_autre, $receiver->_configs["build_other_residence_number"], "PH"); } if ($patient->email) { $phones[] = array(null, "NET", "Internet", $patient->email); } if ($receiver->_configs["build_PID_13"] === "simple") { $phones = array(reset($phones)); } $data[] = $phones; // PID-14: Phone Number - Business (XTN) (optional repeating) $data[] = null; // PID-15: Primary Language (CE) (optional) $data[] = null; // PID-16: Marital Status (CE) (table 0002)(optional) $data[] = $patient->situation_famille; // PID-17: Religion (CE) (optional) $data[] = null; // PID-18: Patient Account Number (CX) (optional) if ($this->sejour && $receiver->_configs["build_NDA"] == "PID_18") { switch ($build_PID_18 = $receiver->_configs["build_PID_18"]) { case 'normal': case 'simple': case 'sejour_id': $sejour = $this->sejour; $sejour->loadNDA($group->_id); $NDA = $sejour->_NDA; if ($build_PID_18 == "sejour_id" && !$sejour->_NDA) { $data[] = array(array($sejour->_id, null, null, $this->getAssigningAuthority("mediboard"), "RI")); break; } if (!$sejour->_NDA && !CValue::read($receiver->_configs, "send_not_master_NDA")) { $NDA = "===NDA_MISSING==="; } if ($build_PID_18 == "simple") { $data[] = $NDA; } else { // Même traitement que pour l'IPP switch ($receiver->_configs["build_PID_3_4"]) { case 'actor': $assigning_authority = $this->getAssigningAuthority("actor", null, $receiver); break; case 'domain': // Master domain $group_domain = new CGroupDomain(); $group_domain->group_id = $group->_id; $group_domain->master = 1; $group_domain->object_class = "CSejour"; $group_domain->loadMatchingObject(); $domain = $group_domain->loadRefDomain(); $assigning_authority = $this->getAssigningAuthority("domain", null, null, $domain); break; default: $assigning_authority = $this->getAssigningAuthority("FINESS", $group->finess); break; } $data[] = $NDA ? array(array($NDA, null, null, $assigning_authority, "AN")) : null; } break; default: $data[] = null; } } else { $data[] = null; } // PID-19: SSN Number - Patient (ST) (forbidden) switch ($receiver->_configs["build_PID_19"]) { case 'matricule': $data[] = $patient->matricule; break; default: $data[] = null; break; } // PID-20: Driver's License Number - Patient (DLN) (optional) $data[] = null; // PID-21: Mother's Identifier (CX) (optional repeating) // Même traitement que pour l'IPP switch ($receiver->_configs["build_PID_3_4"]) { case 'actor': $assigning_authority = $this->getAssigningAuthority("actor", null, $receiver); break; default: $assigning_authority = $this->getAssigningAuthority("FINESS", $group->finess); break; } if ($this->sejour) { $naissance = new CNaissance(); $naissance->sejour_enfant_id = $this->sejour->_id; $naissance->loadMatchingObject(); if ($naissance->_id) { $sejour_maman = $naissance->loadRefSejourMaman(); $sejour_maman->loadNDA($group->_id); $sejour_maman->loadRefPatient()->loadIPP($group->_id); $mother = $sejour_maman->_ref_patient; $identifiers = array(); if ($mother->_IPP) { $identifiers[] = array($mother->_IPP, null, null, $assigning_authority, "PI"); } if ($sejour_maman->_NDA) { $identifiers[] = array($sejour_maman->_NDA, null, null, $assigning_authority, "AN"); } $data[] = $identifiers; } else { $data[] = null; } } else { if ($mother) { $identifiers = array(); if ($mother->_IPP) { $identifiers[] = array($mother->_IPP, null, null, $assigning_authority, "PI"); } if ($sejour_maman->_NDA) { $identifiers[] = array($sejour_maman->_NDA, null, null, $assigning_authority, "AN"); } $data[] = $identifiers; } else { $data[] = null; } } // PID-22: Ethnic Group (CE) (optional repeating) $data[] = null; // PID-23: Birth Place (ST) (optional) $data[] = null; // PID-24: Multiple Birth Indicator (ID) (optional) $data[] = null; // PID-25: Birth Order (NM) (optional) $data[] = $patient->rang_naissance; // PID-26: Citizenship (CE) (optional repeating) $data[] = null; // PID-27: Veterans Military Status (CE) (optional) $data[] = null; // PID-28: Nationality (CE) (optional) $data[] = null; // PID-29: Patient Death Date and Time (TS) (optional) $data[] = $patient->deces ? $patient->deces : null; // PID-30: Patient Death Indicator (ID) (optional) $data[] = $patient->deces ? "Y" : "N"; // PID-31: Identity Unknown Indicator (ID) (optional) switch ($receiver->_configs["build_PID_31"]) { case 'avs': $data[] = $patient->avs; break; default: $data[] = null; break; } // PID-32: Identity Reliability Code (IS) (optional repeating) // Table - 0445 // VIDE - Identité non encore qualifiée // PROV - Provisoire // VALI - Validé // DOUB - Doublon ou esclave // DESA - Désactivé // DPOT - Doublon potentiel // DOUA - Doublon avéré // COLP - Collision potentielle // COLV - Collision validée // FILI - Filiation // CACH - Cachée // ANOM - Anonyme // IDVER - Identité vérifiée par le patient // RECD - Reçue d'un autre domaine // IDRA - Identité rapprochée dans un autre domaine // USUR - Usurpation // HOMD - Homonyme detecté // HOMA - Homonyme avéré if (CAppUI::conf("dPpatients CPatient manage_identity_status", $receiver->_ref_group)) { //todo voir pour DPOT $data[] = array($patient->status, $patient->vip ? "CACH" : null); } else { $data[] = array(is_numeric($patient->nom) ? "ANOM" : "VALI"); } // PID-33: Last Update Date/Time (TS) (optional) $data[] = $event->last_log->date; // PID-34: Last Update Facility (HD) (optional) $data[] = null; // PID-35: Species Code (CE) (optional) $data[] = null; // PID-36: Breed Code (CE) (optional) $data[] = null; // PID-37: Strain (ST) (optional) $data[] = null; // PID-38: Production Class Code (CE) (optional) $data[] = null; // PID-39: Tribal Citizenship (CWE) (optional repeating) $data[] = null; $this->fill($data); }
/** * Build IN1 segement * * @param CHL7v2Event $event Event * * @return null */ function build(CHL7v2Event $event) { parent::build($event); $message = $event->message; $receiver = $event->_receiver; $group = $receiver->loadRefGroup(); /** @var CPatient $patient */ $patient = $this->patient; $data = array(); // IN1-1: Insured's Employee ID $data[] = $this->set_id; // IN1-2: Insured's Social Security Number $data[] = $this->getIN12($patient); // IN1-3: Insurance Company ID (CX) (repeating) $data[] = array($patient->code_regime . $patient->caisse_gest . $patient->centre_gest); // IN1-4: Insurance Company Name (XON) (optional repeating) $data[] = null; // IN1-5: Insurance Company Address (XAD) (optional repeating) $data[] = null; // IN1-6: Insurance Co Contact Person (XPN) (optional repeating) $data[] = null; // IN1-7: Insurance Co Phone Number (XTN) (optional repeating) $data[] = null; // IN1-8: Group Number (ST) (optional) $data[] = null; // IN1-9: Group Name (XON) (optional repeating) $data[] = null; // IN1-10: Insured's Group Emp ID (CX) (optional repeating) $data[] = null; // IN1-11: Insured's Group Emp Name (XON) (optional repeating) $data[] = null; // IN1-12: Plan Effective Date (DT) (optional) $data[] = $patient->deb_amo; // IN1-13: Plan Expiration Date (DT) (optional) $data[] = $patient->fin_amo; // IN1-14: Authorization Information (AUI) (optional) $data[] = null; // IN1-15: Plan Type (IS) (optional) $data[] = null; // IN1-16: Name Of Insured (XPN) (optional repeating) $names = array(); $mode_identito_vigilance = "light"; if ($receiver) { $mode_identito_vigilance = $receiver->_configs["mode_identito_vigilance"]; } $anonyme = is_numeric($patient->assure_nom); $nom = CPatient::applyModeIdentitoVigilance($patient->assure_nom, false, $mode_identito_vigilance); $prenom = CPatient::applyModeIdentitoVigilance($patient->assure_prenom, true, $mode_identito_vigilance, $anonyme); $prenom_2 = CPatient::applyModeIdentitoVigilance($patient->assure_prenom_2, true, $mode_identito_vigilance, $anonyme); $prenom_3 = CPatient::applyModeIdentitoVigilance($patient->assure_prenom_3, true, $mode_identito_vigilance, $anonyme); $prenom_4 = CPatient::applyModeIdentitoVigilance($patient->assure_prenom_4, true, $mode_identito_vigilance, $anonyme); $prenoms = array($prenom_2, $prenom_3, $prenom_4); CMbArray::removeValue("", $prenoms); // Nom usuel $assure_usualname = array($nom, $prenom, implode(",", $prenoms), null, $patient->assure_civilite, null, is_numeric($nom) ? "S" : "L", "A"); $assure_birthname = array(); // Cas nom de naissance if ($patient->assure_nom_jeune_fille) { $nom_jeune_fille = CPatient::applyModeIdentitoVigilance($patient->assure_nom_jeune_fille, true, $mode_identito_vigilance, $anonyme); $assure_birthname = $assure_usualname; $assure_birthname[0] = $nom_jeune_fille; // Legal Name devient Display Name $assure_usualname[6] = "D"; } $names[] = $assure_usualname; if ($patient->assure_nom_jeune_fille && $receiver && $receiver->_configs["build_PID_6"] == "none") { $names[] = $assure_birthname; } $data[] = $names; // IN1-17: Insured's Relationship To Patient (CE) (optional) $data[] = $patient->qual_beneficiaire; // IN1-18: Insured's Date Of Birth (TS) (optional) $data[] = $patient->assure_naissance; // IN1-19: Insured's Address (XAD) (optional repeating) $address = array(); $linesAdress = explode("\n", $patient->assure_adresse, 2); $address[] = array(CValue::read($linesAdress, 0), str_replace("\n", $message->componentSeparator, CValue::read($linesAdress, 1)), $patient->assure_ville, null, $patient->assure_cp, CPaysInsee::getAlpha3($patient->assure_pays_insee), "H"); $data[] = $address; // IN1-20: Assignment Of Benefits (IS) (optional) $data[] = null; // IN1-21: Coordination Of Benefits (IS) (optional) $data[] = null; // IN1-22: Coord Of Ben. Priority (ST) (optional) $data[] = null; // IN1-23: Notice Of Admission Flag (ID) (optional) $data[] = null; // IN1-24: Notice Of Admission Date (DT) (optional) $data[] = null; // IN1-25: Report Of Eligibility Flag (ID) (optional) $data[] = null; // IN1-26: Report Of Eligibility Date (DT) (optional) $data[] = null; // IN1-27: Release Information Code (IS) (optional) $data[] = null; // IN1-28: Pre-Admit Cert (PAC) (ST) (optional) $data[] = null; // IN1-29: Verification Date/Time (TS) (optional) $data[] = null; // IN1-30: Verification By (XCN) (optional repeating) $data[] = null; // IN1-31: Type Of Agreement Code (IS) (optional) $data[] = null; // IN1-32: Billing Status (IS) (optional) $data[] = null; // IN1-33: Lifetime Reserve Days (NM) (optional) $data[] = null; // IN1-34: Delay Before L.R. Day (NM) (optional) $data[] = null; // IN1-35: Company Plan Code (IS) (optional) $data[] = $patient->code_gestion; // IN1-36: Policy Number (ST) (optional) $data[] = null; // IN1-37: Policy Deductible (CP) (optional) $data[] = null; // IN1-38: Policy Limit - Amount (CP) (optional) $data[] = null; // IN1-39: Policy Limit - Days (NM) (optional) $data[] = null; // IN1-40: Room Rate - Semi-Private (CP) (optional) $data[] = null; // IN1-41: Room Rate - Private (CP) (optional) $data[] = null; // IN1-42: Insured's Employment Status (CE) (optional) $data[] = null; // IN1-43: Insured's Administrative Sex (IS) (optional) $data[] = null; // IN1-44: Insured's Employer's Address (XAD) (optional repeating) $data[] = null; // IN1-45: Verification Status (ST) (optional) $data[] = null; // IN1-46: Prior Insurance Plan ID (IS) (optional) $data[] = null; // IN1-47: Coverage Type (IS) (optional) $data[] = null; // IN1-48: Handicap (IS) (optional) $data[] = null; // IN1-49: Insured's ID Number (CX) (optional repeating) $data[] = $patient->matricule; // IN1-50: Signature Code (IS) (optional) $data[] = null; // IN1-51: Signature Code Date (DT) (optional) $data[] = null; // IN1-52: Insured_s Birth Place (ST) (optional) $data[] = null; // IN1-53: VIP Indicator (IS) (optional) $data[] = null; $this->fill($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; }