function fillLimitedTemplate(&$template) { CDestinataire::makeAllFor($this); $destinataires = CDestinataire::$destByClass; foreach ($destinataires as $_destinataires_by_class) { foreach ($_destinataires_by_class as $_destinataire) { if (!isset($_destinataire->nom) || strlen($_destinataire->nom) == 0 || $_destinataire->nom === " ") { continue; } $template->destinataires[] = array("nom" => $_destinataire->nom, "email" => $_destinataire->email, "tag" => $_destinataire->tag); } } $this->loadRefsFwd(); $this->loadRefLatestConstantes(null, array(), null, false); $this->loadIPP(); $this->loadLastINS(); $this->notify("BeforeFillLimitedTemplate", $template); $template->addProperty("Patient - article", $this->_civilite); $template->addProperty("Patient - article long", ucfirst($this->_civilite_long)); $template->addProperty("Patient - article long (minuscule)", strtolower($this->_civilite_long)); $template->addProperty("Patient - nom", $this->nom); $template->addProperty("Patient - nom jeune fille", $this->nom_jeune_fille); $template->addProperty("Patient - prénom", $this->prenom); $template->addProperty("Patient - adresse", $this->adresse); $template->addProperty("Patient - ville", $this->ville); $template->addProperty("Patient - cp", $this->cp); $template->addProperty("Patient - années", $this->_annees); $template->addProperty("Patient - âge", $this->_age); $template->addProperty("Patient - date de naissance", $this->getFormattedValue("naissance")); $template->addProperty("Patient - lieu de naissance", $this->lieu_naissance); $template->addProperty("Patient - sexe", strtolower($this->getFormattedValue("sexe"))); $template->addProperty("Patient - sexe court", substr(strtolower($this->getFormattedValue("sexe")), 0, 1)); $template->addProperty("Patient - numéro d'assuré", $this->getFormattedValue("matricule")); $template->addProperty("Patient - téléphone", $this->getFormattedValue("tel")); $template->addProperty("Patient - mobile", $this->getFormattedValue("tel2")); $template->addProperty("Patient - téléphone autre", $this->tel_autre); $template->addProperty("Patient - profession", $this->profession); $template->addProperty("Patient - IPP", $this->_IPP); $template->addProperty("Patient - Qualité bénéficiaire", $this->qual_beneficiaire); $this->guessExoneration(); $template->addProperty("Patient - Qualité bénéficiaire - Libellé", $this->libelle_exo); $template->addProperty("Patient - Numéro de sécurité sociale", $this->getFormattedValue("matricule")); $template->addBarcode("Patient - Code barre ID", $this->_id); $template->addBarcode("Patient - Code barre IPP", $this->_IPP); $template->addBarcode("Patient - Code barre INS", $this->_ref_last_ins ? $this->_ref_last_ins->ins : ""); if ($this->sexe === "m") { $template->addProperty("Patient - il/elle", "il"); $template->addProperty("Patient - Il/Elle (majuscule)", "Il"); $template->addProperty("Patient - le/la", "le"); $template->addProperty("Patient - Le/La (majuscule)", "Le"); $template->addProperty("Patient - du/de la", "du"); $template->addProperty("Patient - au/à la", "au"); $template->addProperty("Patient - accord genre", ""); } else { $template->addProperty("Patient - il/elle", "elle"); $template->addProperty("Patient - Il/Elle (majuscule)", "Elle"); $template->addProperty("Patient - le/la", "la"); $template->addProperty("Patient - Le/La (majuscule)", "La"); $template->addProperty("Patient - du/de la", "de la"); $template->addProperty("Patient - au/à la", "à la"); $template->addProperty("Patient - accord genre", "e"); } $medecin = $this->_ref_medecin_traitant->_id ? $this->_ref_medecin_traitant : new CMedecin(); $template->addProperty("Patient - médecin traitant", "{$medecin->nom} {$medecin->prenom}"); $template->addProperty("Patient - médecin traitant - Nom Prénom", "{$medecin->nom} {$medecin->prenom}"); $template->addProperty("Patient - médecin traitant - nom", $medecin->nom); $template->addProperty("Patient - médecin traitant - prenom", $medecin->prenom); $template->addProperty("Patient - médecin traitant - adresse", "{$medecin->adresse} \n {$medecin->cp} {$medecin->ville}"); $template->addProperty("Patient - médecin traitant - voie", $medecin->adresse); $template->addProperty("Patient - médecin traitant - cp", $medecin->cp); $template->addProperty("Patient - médecin traitant - ville", $medecin->ville); $template->addProperty("Patient - médecin traitant - confraternité", $medecin->_confraternite); $template->addProperty("Patient - médecin traitant - tel", $medecin->getFormattedValue("tel")); $template->addProperty("Patient - médecin traitant - fax", $medecin->getFormattedValue("fax")); if ($medecin->sexe == "f") { $template->addProperty("Patient - médecin traitant - accord genre", "e"); $template->addProperty("Patient - médecin traitant - article long", "Mme le docteur"); } elseif ($medecin->sexe == "m") { $template->addProperty("Patient - médecin traitant - accord genre", ""); $template->addProperty("Patient - médecin traitant - article long", "Mr le docteur"); } else { $template->addProperty("Patient - médecin traitant - accord genre", ""); $template->addProperty("Patient - médecin traitant - article long", "le docteur"); } // Employeur $this->loadRefsCorrespondantsPatient(); $correspondants = $this->_ref_cp_by_relation; foreach ($correspondants as $relation => $_correspondants) { $_correspondant = @reset($_correspondants); // Dans le cas d'un modèle, création d'un correspondant pour chaque type de relation if (!count($_correspondants)) { $_correspondant = new CCorrespondantPatient(); $_correspondant->relation = $relation; } switch ($_correspondant->relation) { case "employeur": $template->addProperty("Patient - employeur - nom", $_correspondant->nom); $template->addProperty("Patient - employeur - adresse", $_correspondant->adresse); $template->addProperty("Patient - employeur - cp", $_correspondant->cp); $template->addProperty("Patient - employeur - ville", $_correspondant->ville); $template->addProperty("Patient - employeur - tel", $_correspondant->getFormattedValue("tel")); $template->addProperty("Patient - employeur - mobile", $_correspondant->getFormattedValue("mob")); $template->addProperty("Patient - employeur - urssaf", $_correspondant->urssaf); break; case "prevenir": $template->addProperty("Patient - prévenir - nom", $_correspondant->nom); $template->addProperty("Patient - prévenir - prénom", $_correspondant->prenom); $template->addProperty("Patient - prévenir - adresse", $_correspondant->adresse); $template->addProperty("Patient - prévenir - cp", $_correspondant->cp); $template->addProperty("Patient - prévenir - ville", $_correspondant->ville); $template->addProperty("Patient - prévenir - tel", $_correspondant->getFormattedValue("tel")); $template->addProperty("Patient - prévenir - mobile", $_correspondant->getFormattedValue("mob")); $template->addProperty("Patient - prévenir - parente", $_correspondant->parente); break; case "confiance": $template->addProperty("Patient - confiance - nom", $_correspondant->nom); $template->addProperty("Patient - confiance - nom de jeune fille", $_correspondant->nom_jeune_fille); $template->addProperty("Patient - confiance - prénom", $_correspondant->prenom); $template->addProperty("Patient - confiance - date de naissance", $_correspondant->getFormattedValue("naissance")); $template->addProperty("Patient - confiance - adresse", $_correspondant->adresse); $template->addProperty("Patient - confiance - cp", $_correspondant->cp); $template->addProperty("Patient - confiance - ville", $_correspondant->ville); $template->addProperty("Patient - confiance - tel", $_correspondant->getFormattedValue("tel")); $template->addProperty("Patient - confiance - mobile", $_correspondant->getFormattedValue("mob")); $template->addProperty("Patient - confiance - parente", $_correspondant->parente); } } // Vider les anciens holders for ($i = 1; $i < 4; $i++) { $template->addProperty("Patient - médecin correspondant {$i}"); $template->addProperty("Patient - médecin correspondant {$i} - adresse"); $template->addProperty("Patient - médecin correspondant {$i} - spécialité"); } $this->loadRefsCorrespondants(); $i = 0; $noms = array(); foreach ($this->_ref_medecins_correspondants as $corresp) { $i++; $corresp->loadRefsFwd(); $medecin = $corresp->_ref_medecin; $nom = "{$medecin->nom} {$medecin->prenom}"; $noms[] = $nom; $template->addProperty("Patient - médecin correspondant {$i}", $nom); $template->addProperty("Patient - médecin correspondant {$i} - adresse", "{$medecin->adresse}\n{$medecin->cp} {$medecin->ville}"); $template->addProperty("Patient - médecin correspondant {$i} - spécialité", CMbString::htmlEntities($medecin->disciplines)); } $template->addProperty("Patient - médecins correspondants", implode(" - ", $noms)); //Liste des séjours du patient $this->loadRefsSejours(); if (is_array($this->_ref_sejours)) { foreach ($this->_ref_sejours as $_sejour) { $_sejour->loadRefPraticien(); } $smarty = new CSmartyDP("modules/dPpatients"); $smarty->assign("sejours", $this->_ref_sejours); $sejours = $smarty->fetch("print_closed_sejours.tpl", '', '', 0); $sejours = preg_replace('`([\\n\\r])`', '', $sejours); } else { $sejours = CAppUI::tr("CSejour.none"); } $template->addProperty("Patient - liste des séjours", $sejours, '', false); $const_med = $this->_ref_constantes_medicales; $const_dates = $this->_latest_constantes_dates; $grid_complet = CConstantesMedicales::buildGridLatest($const_med, $const_dates, true); $grid_minimal = CConstantesMedicales::buildGridLatest($const_med, $const_dates, false); $grid_valued = CConstantesMedicales::buildGridLatest($const_med, $const_dates, false, true); $smarty = new CSmartyDP("modules/dPpatients"); // Horizontal $smarty->assign("constantes_medicales_grid", $grid_complet); $constantes_complet_horiz = $smarty->fetch("print_constantes.tpl", '', '', 0); $constantes_complet_horiz = preg_replace('`([\\n\\r])`', '', $constantes_complet_horiz); $smarty->assign("constantes_medicales_grid", $grid_minimal); $constantes_minimal_horiz = $smarty->fetch("print_constantes.tpl", '', '', 0); $constantes_minimal_horiz = preg_replace('`([\\n\\r])`', '', $constantes_minimal_horiz); $smarty->assign("constantes_medicales_grid", $grid_valued); $constantes_valued_horiz = $smarty->fetch("print_constantes.tpl", '', '', 0); $constantes_valued_horiz = preg_replace('`([\\n\\r])`', '', $constantes_valued_horiz); // Vertical $smarty->assign("constantes_medicales_grid", $grid_complet); $constantes_complet_vert = $smarty->fetch("print_constantes_vert.tpl", '', '', 0); $constantes_complet_vert = preg_replace('`([\\n\\r])`', '', $constantes_complet_vert); $smarty->assign("constantes_medicales_grid", $grid_minimal); $constantes_minimal_vert = $smarty->fetch("print_constantes_vert.tpl", '', '', 0); $constantes_minimal_vert = preg_replace('`([\\n\\r])`', '', $constantes_minimal_vert); $smarty->assign("constantes_medicales_grid", $grid_valued); $constantes_valued_vert = $smarty->fetch("print_constantes_vert.tpl", '', '', 0); $constantes_valued_vert = preg_replace('`([\\n\\r])`', '', $constantes_valued_vert); // Liste des fichiers $this->loadRefsFiles(); $list = CMbArray::pluck($this->_ref_files, "file_name"); $template->addListProperty("Patient - Liste des fichiers", $list); // Identité $identite = $this->loadNamedFile("identite.jpg"); $template->addImageProperty("Patient - Photo d'identite", $identite->_id); $template->addProperty("Patient - Constantes - mode complet horizontal", $constantes_complet_horiz, '', false); $template->addProperty("Patient - Constantes - mode minimal horizontal", $constantes_minimal_horiz, '', false); $template->addProperty("Patient - Constantes - mode avec valeurs horizontal", $constantes_valued_horiz, '', false); $template->addProperty("Patient - Constantes - mode complet vertical", $constantes_complet_vert, '', false); $template->addProperty("Patient - Constantes - mode minimal vertical", $constantes_minimal_vert, '', false); $template->addProperty("Patient - Constantes - mode avec valeurs vertical", $constantes_valued_vert, '', false); $template->addProperty("Patient - poids", "{$const_med->poids} kg"); $template->addProperty("Patient - taille", "{$const_med->taille} cm"); $template->addProperty("Patient - Pouls", $const_med->pouls); $template->addProperty("Patient - IMC", $const_med->_imc); $template->addProperty("Patient - VST", $const_med->_vst); $template->addProperty("Patient - température", $const_med->temperature . "°"); $template->addProperty("Patient - TA", $const_med->ta ? "{$const_med->_ta_systole} / {$const_med->_ta_diastole}" : ""); $template->addProperty("Patient - Saturation (spo2)", $const_med->spo2); // Assuré social $template->addProperty("Patient - Assuré social - nom", $this->assure_nom); $template->addProperty("Patient - Assuré social - nom jeune fille", $this->assure_nom_jeune_fille); $template->addProperty("Patient - Assuré social - prénom", $this->assure_prenom); $template->addProperty("Patient - Assuré social - date de naissance", $this->getFormattedValue("assure_naissance")); $template->addProperty("Patient - Assuré social - article", $this->_assure_civilite); $template->addProperty("Patient - Assuré social - article long", $this->_assure_civilite_long); $template->addProperty("Patient - Assuré social - adresse", $this->assure_adresse); $template->addProperty("Patient - Assuré social - ville", $this->assure_ville); $template->addProperty("Patient - Assuré social - cp", $this->assure_cp); $template->addProperty("Patient - Assuré social - pays", $this->assure_pays); $template->addProperty("Patient - Assuré social - téléphone", $this->assure_tel); $template->addProperty("Patient - Assuré social - mobile", $this->assure_tel2); $template->addProperty("Patient - Assuré social - cp naissance", $this->assure_cp_naissance); $template->addProperty("Patient - Assuré social - lieu de naissance", $this->assure_lieu_naissance); $template->addProperty("Patient - Assuré social - profession", $this->assure_profession); // Bénéficiaire de soins $template->addProperty("Patient - Bénéficiaire de soin - code régime", $this->code_regime); $template->addProperty("Patient - Bénéficiaire de soin - caisse gest", $this->caisse_gest); $template->addProperty("Patient - Bénéficiaire de soin - centre gest", $this->centre_gest); $template->addProperty("Patient - Bénéficiaire de soin - code gest", $this->code_gestion); $template->addProperty("Patient - Bénéficiaire de soin - régime santé", $this->regime_sante); $template->addDateProperty("Patient - Bénéficiaire de soin - début période", $this->deb_amo); $template->addDateProperty("Patient - Bénéficiaire de soin - fin période", $this->fin_amo); $template->addProperty("Patient - Bénéficiaire de soin - régime am", $this->getFormattedValue("regime_am")); $template->addProperty("Patient - Bénéficiaire de soin - ald", $this->getFormattedValue("ald")); $template->addProperty("Patient - Bénéficiaire de soin - incapable majeur", $this->getFormattedValue("incapable_majeur")); $template->addProperty("Patient - Bénéficiaire de soin - cmu", $this->getFormattedValue("cmu")); $template->addProperty("Patient - Bénéficiaire de soin - ATNC", $this->getFormattedValue("ATNC")); $template->addDateProperty("Patient - Bénéficiaire de soin - validité vitale", $this->fin_validite_vitale); $template->addProperty("Patient - Bénéficiaire de soin - médecin traitant déclaré", $this->getFormattedValue("medecin_traitant_declare")); $template->addProperty("Patient - Bénéficiaire de soin - types contrat mutuelle", addslashes($this->mutuelle_types_contrat)); $template->addProperty("Patient - Bénéficiaire de soin - notes amo", addslashes($this->notes_amo)); $template->addProperty("Patient - Bénéficiaire de soin - libellé exo", addslashes($this->libelle_exo)); $template->addProperty("Patient - Bénéficiaire de soin - notes amc", addslashes($this->notes_amc)); if (CModule::getActive("maternite")) { $allaitement = $this->loadLastAllaitement(); $template->addDateProperty("Patient - Allaitement - Début", $allaitement->date_debut); $template->addDateProperty("Patient - Allaitement - Fin", $allaitement->date_fin); $grossesse = $this->loadLastGrossesse(); $template->addDateProperty("Patient - Grossesse - Terme prévu", $grossesse->terme_prevu); $template->addDateProperty("Patient - Grossesse - Date des dernières règles", $grossesse->date_dernieres_regles); $template->addProperty("Patient - Grossesse - En cours", $grossesse->getFormattedValue("active")); $template->addProperty("Patient - Grossesse - Multiple", $grossesse->getFormattedValue("multiple")); $template->addProperty("Patient - Grossesse - Allaitement maternel", $grossesse->getFormattedValue("allaitement_maternel")); $template->addProperty("Patient - Grossesse - Fausse couche", $grossesse->getFormattedValue('fausse_couche'), null, false); $template->addProperty("Patient - Grossesse - Lieu d'accouchement", $grossesse->getFormattedValue("lieu_accouchement")); $template->addProperty("Patient - Grossesse - Remarques", $grossesse->rques); } if (CModule::getActive("forms")) { CExObject::addFormsToTemplate($template, $this, "Patient"); } $this->notify("AfterFillLimitedTemplate", $template); }
/** * Récupération du segment GT1 * * @param DOMNode $node Node * @param CSejour $newVenue Admit * * @return void */ function getGT1(DOMNode $node, CSejour $newVenue) { if (!$newVenue->_id) { return; } $patient = $newVenue->_ref_patient; if (!$patient->_id) { return; } $GT1_2 = $this->queryTextNode("GT1.2/CX.1", $node); $GT1_3 = $this->queryNode("GT1.3", $node); $nom = $this->queryTextNode("XPN.1/FN.1", $GT1_3); $prenom = $this->queryTextNode("XPN.2", $GT1_3); if ($prenom == "") { $prenom = null; } $GT1_5 = $this->queryNode("GT1.5", $node); $adresse = $this->queryTextNode("XAD.1/SAD.1", $GT1_5); $ville = $this->queryTextNode("XAD.3", $GT1_5); $cp = $this->queryTextNode("XAD.5", $GT1_5); $GT1_6 = $this->queryNodes("GT1.6", $node); $tel = null; $ean = null; $ean_base = null; foreach ($GT1_6 as $_GT1_6) { if (!$tel) { $tel = $this->queryTextNode("XTN.12", $_GT1_6); } if (!$tel) { $tel = $this->queryTextNode("XTN.1", $_GT1_6); } $XTN_4 = $this->queryTextNode("XTN.4", $_GT1_6); // EAN base => Ean Dest if (preg_match('/^Ean Dest=(\\d+)$/', $XTN_4, $matches) === 1) { $ean_base = CMbArray::get($matches, 1); } // EAN => Code Ean if (preg_match('/^Code Ean=(\\d+)$/', $XTN_4, $matches) === 1) { $ean = CMbArray::get($matches, 1); } } $GT1_13 = $this->queryTextNode("GT1.13", $node); $GT1_14 = $this->queryTextNode("GT1.14", $node); $corres_patient = new CCorrespondantPatient(); $where = array(); $where["patient_id"] = " = '{$patient->_id}'"; if ($nom) { $where["nom"] = " = '{$nom}'"; } if ($prenom) { $where["prenom"] = " = '{$prenom}'"; } $where["relation"] = " = 'assurance'"; $now = CMbDT::date(); $next = CMbDT::date("+ 1 DAY"); $where["date_debut"] = " <= '{$now}' AND IFNULL(date_fin, '{$next}') >= '{$now}'"; $corres_patient->loadObject($where); if (!$corres_patient->_id) { $corres_patient->patient_id = $patient->_id; $corres_patient->nom = $nom; $corres_patient->relation = "assurance"; } $corres_patient->prenom = $prenom; $corres_patient->adresse = $adresse; $corres_patient->cp = $cp; $corres_patient->ville = $ville; $corres_patient->tel = $tel; $corres_patient->ean = $ean; $corres_patient->ean_base = $ean_base; if ($ean) { $where = array("patient_id" => "IS NULL", "relation" => "= 'assurance'", "ean" => "= '{$ean}'"); $assurance = new CCorrespondantPatient(); $assurance->loadObject($where); $corres_patient->type_pec = $assurance->type_pec; } if ($GT1_13) { $corres_patient->date_debut = CMbDT::date($GT1_13); } if ($GT1_14) { $corres_patient->date_fin = CMbDT::date($GT1_14); } $sender = $this->_ref_sender; // Notifier les autres destinataires autre que le sender $corres_patient->_eai_sender_guid = $sender->_guid; if ($msg = $corres_patient->store()) { $corres_patient->repair(); $corres_patient->_eai_sender_guid = $sender->_guid; $corres_patient->store(); } }
$ids = explode(",", $_corresp["IDS"]); if (empty($ids)) { continue; } array_unique($ids); sort($ids); array_pop($ids); // Only keep last CAppUI::stepAjax(" -- Patient #" . $_corresp["patient_id"], UI_MSG_OK); $count = 0; foreach ($ids as $_id) { if ($dry_run) { $count++; continue; } $_correspondant = new CCorrespondantPatient(); $_correspondant->load($_id); if ($msg = $_correspondant->delete()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); } else { $count++; } } $count_total += $count; if ($dry_run) { CAppUI::stepAjax("{$count} correspondants à supprimer", UI_MSG_OK); } else { CAppUI::stepAjax("{$count} correspondants supprimés", UI_MSG_OK); } } if ($dry_run) {
/** * Get NK1 segment * * @param DOMNode $node Node * @param CPatient $newPatient Person * * @return void */ function getNK1(DOMNode $node, CPatient $newPatient) { $sender = $this->_ref_sender; $NK1_2 = $this->queryNode("NK1.2", $node); $nom = $this->queryTextNode("XPN.1/FN.1", $NK1_2); $prenom = $this->queryTextNode("XPN.2", $NK1_2); if ($prenom == "") { $prenom = null; } $parente = $this->queryTextNode("NK1.3/CE.1", $node); $parente_autre = null; if ($parente == "OTH") { $parente_autre = $this->queryTextNode("NK1.3/CE.2", $node); } $NK1_4 = $this->queryNode("NK1.4", $node); $adresse = $this->queryTextNode("XAD.1/SAD.1", $NK1_4); $cp = $this->queryTextNode("XAD.5", $NK1_4); $ville = $this->queryTextNode("XAD.3", $NK1_4); $NK1_5 = $this->queryNodes("NK1.5", $node)->item(0); $tel = null; if ($NK1_5) { $tel = $this->queryTextNode("XTN.12", $NK1_5); if (!$tel) { $tel = $this->queryTextNode("XTN.1", $NK1_5); } } $relation = $this->queryTextNode("NK1.7/CE.1", $node); $relation_autre = null; if ($relation == "O") { $relation_autre = $this->queryTextNode("NK1.7/CE.2", $node); } $corres_patient = new CCorrespondantPatient(); $corres_patient->patient_id = $newPatient->_id; $corres_patient->nom = $nom; $corres_patient->prenom = $prenom; $corres_patient->loadMatchingObjectEsc(); $corres_patient->adresse = $adresse; $corres_patient->cp = $cp; $corres_patient->ville = $ville; $corres_patient->tel = $tel; $corres_patient->parente = CHL7v2TableEntry::mapFrom("63", $parente); $corres_patient->parente_autre = $parente_autre; $corres_patient->relation = CHL7v2TableEntry::mapFrom("131", $relation); $corres_patient->relation_autre = $relation_autre; // Notifier les autres destinataires autre que le sender $corres_patient->_eai_sender_guid = $sender->_guid; $corres_patient->store(); }
<?php /** * $Id$ * * @package Mediboard * @subpackage Patients * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkRead(); $patient_id = CValue::get("patient_id"); $type = CValue::get("type"); $nom = @$_POST["{$type}"]; $corresp = new CCorrespondantPatient(); $where = array(); $where[] = "`nom` LIKE '%{$nom}%' OR `surnom` LIKE '%{$nom}%'"; $where["patient_id"] = " = '{$patient_id}'"; $correspondants = $corresp->loadList($where, "nom"); // Création du template $smarty = new CSmartyDP(); $smarty->assign("nom", $nom); $smarty->assign("correspondants", $correspondants); $smarty->display("ajax_correspondant_autocomplete.tpl");
} // Parsing $results[$i]["codeCDM"] = addslashes(trim($line[0])); //not used $results[$i]["nom"] = addslashes(trim($line[1])); $results[$i]["adress"] = addslashes(trim($line[2])); $results[$i]["rue"] = addslashes(trim($line[3])); $explode = explode(" ", addslashes(trim($line[4])), 2); $results[$i]["cp"] = $explode[0]; $results[$i]["localite"] = $explode[1]; $results[$i]["pec"] = addslashes(trim($line[5])); $results[$i]["ean"] = addslashes(trim($line[9])); $results[$i]["surnom"] = addslashes(trim($line[10])); $results[$i]["error"] = 0; // Fonction $corres = new CCorrespondantPatient(); $corres->ean = $results[$i]["ean"]; $corres->nom = $results[$i]["nom"]; $corres->relation = "assurance"; $corres->loadMatchingObject(); if ($corres->_id) { //update $corres->nom = stripslashes($results[$i]["nom"]); $corres->adresse = $results[$i]["rue"]; $corres->cp = $results[$i]["cp"]; $corres->ville = $results[$i]["localite"]; $corres->type_pec = $results[$i]["pec"]; $corres->surnom = $results[$i]["surnom"]; $corres->parente = "autre"; $corres->parente_autre = "assurance"; if ($corres->ean == "" || $corres->nom == "") {
/** * Lecture du fichier XML associé au rejet * * @param string $content_file contenu du fichier * @param bool $details enregistrement des informations * * @return null */ function readXML($content_file = null, $details = false) { if (!$content_file) { $file = $this->loadRefFile(); $file->updateFormFields(); $content_file = file_get_contents($file->_file_path); } $doc = new CMbXMLDocument("UTF-8"); $doc->loadXMLSafe($content_file); $xpath = new CMbXPath($doc); $xpath->registerNamespace("invoice", "http://www.forum-datenaustausch.ch/invoice"); $payload = $xpath->queryUniqueNode("//invoice:payload"); $timestamp = $xpath->getValueAttributNode($payload, "response_timestamp"); $this->date = strftime('%Y-%m-%d', $timestamp); $invoice = $xpath->queryUniqueNode("//invoice:invoice"); $this->num_facture = $xpath->getValueAttributNode($invoice, "request_id"); $this->_date_facture = $xpath->getValueAttributNode($invoice, "request_date"); $insurance = $xpath->queryUniqueNode("//invoice:insurance"); $ean_party = $xpath->getValueAttributNode($insurance, "ean_party"); $corr = new CCorrespondantPatient(); $corr->ean = $ean_party; $corr->loadMatchingObject(); $this->name_assurance = $corr->nom; $patient = $xpath->queryUniqueNode("//invoice:patient"); $this->_avs = $xpath->getValueAttributNode($patient, "ssn"); if ($company = $xpath->queryUniqueNode("//invoice:contact/invoice:company")) { $this->_contact[] = $xpath->queryTextNode("invoice:companyname", $company); $this->_contact[] = $xpath->queryTextNode("invoice:department", $company); $this->_contact[] = $xpath->queryTextNode("invoice:subaddressing", $company); $postal = $xpath->queryUniqueNode("invoice:postal", $company); $this->_contact[] = $xpath->queryTextNode("invoice:pobox", $postal); $this->_contact[] = $xpath->queryTextNode("invoice:street", $postal); $this->_contact[] = $xpath->queryTextNode("invoice:zip", $postal) . " " . $xpath->queryTextNode("invoice:city", $postal); $this->_contact[] = $xpath->queryTextNode("invoice:phone", $xpath->queryUniqueNode("invoice:telecom", $company)); $this->_contact[] = $xpath->queryTextNode("invoice:email", $xpath->queryUniqueNode("invoice:online", $company)); } if ($employee = $xpath->queryUniqueNode("//invoice:contact/invoice:employee")) { $this->_contact[] = $xpath->getValueAttributNode($employee, "salutation") . " " . $xpath->queryTextNode("invoice:givenname", $employee) . " " . $xpath->queryTextNode("invoice:familyname", $employee); $this->_contact[] = $xpath->queryTextNode("invoice:phone", $xpath->queryUniqueNode("invoice:telecom", $employee)); $this->_contact[] = $xpath->queryTextNode("invoice:email", $xpath->queryUniqueNode("invoice:online", $employee)); } if ($person = $xpath->queryUniqueNode("//invoice:contact/invoice:person")) { $this->_contact[] = $xpath->getValueAttributNode($person, "salutation") . " " . $xpath->queryTextNode("invoice:givenname", $person) . " " . $xpath->queryTextNode("invoice:familyname", $person); $this->_contact[] = $xpath->queryTextNode("invoice:phone", $xpath->queryUniqueNode("invoice:subaddressing", $person)); $postal = $xpath->queryUniqueNode("invoice:postal", $person); $this->_contact[] = $xpath->queryTextNode("invoice:pobox", $postal); $this->_contact[] = $xpath->queryTextNode("invoice:street", $postal); $this->_contact[] = $xpath->queryTextNode("invoice:zip", $postal) . " " . $xpath->queryTextNode("invoice:city", $postal); $this->_contact[] = $xpath->queryTextNode("invoice:phone", $xpath->queryUniqueNode("invoice:telecom", $person)); $this->_contact[] = $xpath->queryTextNode("invoice:email", $xpath->queryUniqueNode("invoice:online", $person)); } $this->_contact = array_filter($this->_contact); $pending = $xpath->query("//invoice:pending"); foreach ($pending as $_pending) { $explanation = $xpath->queryTextNode("invoice:explanation", $_pending); $this->motif_rejet = "{$explanation} \r\n"; $this->_commentaire = $explanation; $this->_status_in = $xpath->getValueAttributNode($_pending, "status_in"); $this->_status_out = $xpath->getValueAttributNode($_pending, "status_out"); $nb_message = 0; $messages = $xpath->query("//invoice:message"); foreach ($messages as $_message) { $code = $xpath->getValueAttributNode($_message, "code"); $text = $xpath->getValueAttributNode($_message, "text"); if (!$details) { $this->motif_rejet .= "{$code}: {$text} \r\n"; } else { $this->_erreurs[$nb_message]['code'] = $code; $this->_erreurs[$nb_message]['text'] = $text; } $nb_message++; } $this->_pending = 1; } $rejected = $xpath->query("//invoice:rejected"); foreach ($rejected as $_rejected) { $explanation = $xpath->queryTextNode("invoice:explanation", $_rejected); $this->motif_rejet = "{$explanation} \r\n"; $this->_commentaire = $explanation; $this->_status_in = $xpath->getValueAttributNode($_rejected, "status_in"); $this->_status_out = $xpath->getValueAttributNode($_rejected, "status_out"); $nb_message = 0; $messages = $xpath->query("//invoice:error"); foreach ($messages as $_message) { $code = $xpath->getValueAttributNode($_message, "code"); $text = $xpath->getValueAttributNode($_message, "text"); if (!$details) { $this->motif_rejet .= "{$code}: {$text} \r\n"; } else { $this->_erreurs[$nb_message]['code'] = $code; $this->_erreurs[$nb_message]['text'] = $text; } if ($error_value = $xpath->getValueAttributNode($_message, "error_value")) { $valid_value = $xpath->getValueAttributNode($_message, "valid_value"); if (!$details) { $this->motif_rejet .= "({$error_value}/{$valid_value})"; } else { $this->_erreurs[$nb_message]['error_value'] = $error_value; $this->_erreurs[$nb_message]['valid_value'] = $valid_value; $this->_erreurs[$nb_message]['record_id'] = $xpath->getValueAttributNode($_message, "record_id"); } } $nb_message++; } } if (!$details) { if ($msg = $this->store()) { mbTrace($msg); } } }
<?php /** * $Id: ajax_form_correspondant.php 28237 2015-05-11 16:06:01Z flaviencrochard $ * * @package Mediboard * @subpackage Patients * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 28237 $ */ $correspondant_id = CValue::get("correspondant_id"); $patient_id = CValue::get("patient_id"); $duplicate = CValue::get("duplicate"); $correspondant = new CCorrespondantPatient(); $patient = new CPatient(); if ($correspondant_id) { $correspondant->load($correspondant_id); $patient = $correspondant->loadRefPatient(); if ($duplicate) { $correspondant->_id = ""; } } else { if ($patient_id) { $patient->load($patient_id); $correspondant->patient_id = $patient_id; $correspondant->_duplicate = $duplicate; $correspondant->updatePlainFields(); } if (CAppUI::conf("ref_pays") == 2) { $correspondant->relation = "assurance";
<?php /** * $Id$ * * @package Mediboard * @subpackage Patients * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ $correspondant_id = CValue::get("correspondant_id"); $correspondant = new CCorrespondantPatient(); $correspondant->load($correspondant_id); if (CAppUI::conf('dPpatients CPatient function_distinct') && $correspondant->_id) { $current_user = CMediusers::get(); $is_admin = $current_user->isAdmin(); $same_function = $current_user->function_id == $correspondant->function_id; if (!$is_admin && !$same_function) { CAppUI::redirect("m=system&a=access_denied"); } } //smarty $smarty = new CSmartyDP(); $smarty->assign("correspondant", $correspondant); $smarty->assign("mode_modele", 1); $smarty->display("inc_form_correspondant.tpl");
$corres_nom = CValue::get("nom", ""); $corres_prenom = CValue::get("prenom", ""); $corres_surnom = CValue::get("surnom", ""); $corres_function_id = CValue::get("function_id"); $corres_cp = CValue::get("cp"); $corres_ville = CValue::get("ville"); $corres_relation = CValue::get("relation"); if (!$dialog) { CValue::setSession("correspondant_nom", $corres_nom); CValue::setSession("correspondant_prenom", $corres_prenom); CValue::setSession("correspondant_prenom", $corres_surnom); CValue::setSession("correspondant_cp", $corres_cp); CValue::setSession("correspondant_ville", $corres_ville); CValue::setSession("correspondant_relation", $corres_relation); } $correspondant = new CCorrespondantPatient(); $ds = $correspondant->getDS(); $where = array(); $where["patient_id"] = "IS NULL"; $current_user = CMediusers::get(); $is_admin = $current_user->isAdmin(); if ($corres_function_id && $is_admin) { $where["function_id"] = "= '{$corres_function_id}'"; } elseif (CAppUI::conf('dPpatients CPatient function_distinct') && $dialog && !$is_admin) { $where["function_id"] = "= '{$current_user->function_id}'"; } if ($corres_nom) { $where["nom"] = $ds->prepareLike("%{$corres_nom}%"); } if ($corres_prenom) { $where["prenom"] = $ds->prepareLike("%{$corres_prenom}%");