Esempio n. 1
0
<?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();
$medecin_id = CValue::get("medecin_id");
$medecin = new CMedecin();
$medecin->load($medecin_id);
if (!$medecin || !$medecin->_id) {
    CAppUI::stepAjax('common-error-Invalid object', UI_MSG_ERROR);
}
$smarty = new CSmartyDP();
$smarty->assign("medecin", $medecin);
$smarty->assign("date", CMbDT::date());
$smarty->display("print_medecin.tpl");
}
// Chargements de chargement du patient
$patient->loadRefsSejours();
$patient->loadRefsFwd();
$patient->loadRefsCorrespondants();
$patient->loadRefsCorrespondantsPatient();
$correspondantsMedicaux = array();
if ($patient->_ref_medecin_traitant->_id) {
    $correspondantsMedicaux["traitant"] = $patient->_ref_medecin_traitant;
}
foreach ($patient->_ref_medecins_correspondants as $correspondant) {
    $correspondantsMedicaux["correspondants"][] = $correspondant->_ref_medecin;
}
$medecin_adresse_par = "";
if ($sejour->adresse_par_prat_id && $sejour->adresse_par_prat_id != $patient->_ref_medecin_traitant->_id) {
    $medecin_adresse_par = new CMedecin();
    $medecin_adresse_par->load($sejour->adresse_par_prat_id);
}
// Chargement des etablissements externes
$etab = new CEtabExterne();
$count_etab_externe = $etab->countList();
$sejours =& $patient->_ref_sejours;
$config = CAppUI::conf("dPplanningOp CSejour");
$hours = range($config["heure_deb"], $config["heure_fin"]);
$mins = range(0, 59, $config["min_intervalle"]);
$config = CAppUI::conf("dPplanningOp COperation");
$hours_duree = array("deb" => $config["duree_deb"], "fin" => $config["duree_fin"]);
$hours_urgence = array("deb" => $config["hour_urgence_deb"], "fin" => $config["hour_urgence_fin"]);
$mins_duree = $config["min_intervalle"];
$config = CAppUI::conf("dPplanningOp CSejour");
$heure_sortie_ambu = $config["heure_sortie_ambu"];
Esempio n. 3
0
    fclose($csvfile);
}
// Step 3: Store from CSV summary
$errors = 0;
$updates = 0;
// Open CSV File
if (null == ($csvfile = @fopen($csvpath, "r"))) {
    CAppUI::stepAjax("Fichier '{$csvpath}' non disponible", UI_MSG_ERROR);
}
$cols = fgetcsv($csvfile);
// Each line
$medecins = array();
$mode_import = CValue::get("mode_import");
while ($line = fgetcsv($csvfile)) {
    // Load from CSV
    $medecin = new CMedecin();
    foreach ($cols as $index => $field) {
        $medecin->{$field} = $line[$index];
    }
    // Recherche des siblings
    $siblings = $medecin->loadExactSiblings();
    if ($medecin->_has_siblings = count($siblings)) {
        $sibling = reset($siblings);
        switch ($mode_import) {
            case "comp":
                $medecin->_id = $sibling->_id;
                break;
            case "rpps":
                $rpps = $medecin->rpps;
                $medecin = $sibling;
                $medecin->rpps = $rpps;
 /**
  * Get doctor
  *
  * @param DOMNode $node Node
  *
  * @return int
  */
 function getMedecin(DOMNode $node)
 {
     $xcn1 = $this->queryTextNode("XCN.1", $node);
     $xcn2 = $this->queryTextNode("XCN.2/FN.1", $node);
     $xcn3 = $this->queryTextNode("XCN.3", $node);
     $medecin = new CMedecin();
     switch ($this->queryTextNode("XCN.13", $node)) {
         case "RPPS":
             $medecin->rpps = $xcn1;
             $medecin->loadMatchingObjectEsc();
             break;
         case "ADELI":
             $medecin->adeli = $xcn1;
             $medecin->loadMatchingObjectEsc();
             break;
         case "RI":
             // Gestion de l'identifiant MB
             if ($this->queryTextNode("XCN.9/CX.4/HD.2", $node) == CAppUI::conf("hl7 assigning_authority_universal_id")) {
                 $medecin->load($xcn1);
             }
         default:
     }
     // Si pas retrouvé par son identifiant
     if (!$medecin->_id) {
         $medecin->nom = $xcn2;
         $medecin->prenom = $xcn3;
         $medecin->loadMatchingObjectEsc();
         // Dans le cas où il n'est pas connu dans MB on le créé
         $medecin->store();
     }
     return $medecin->_id;
 }
Esempio n. 5
0
 function completeLabelFields(&$fields, $params)
 {
     $this->loadIPP();
     $medecin_traitant = new CMedecin();
     $medecin_traitant->load($this->medecin_traitant);
     $this->loadRefsCorrespondantsPatient();
     $prevenir = new CCorrespondantPatient();
     if (count($this->_ref_cp_by_relation["prevenir"])) {
         $prevenir = reset($this->_ref_cp_by_relation["prevenir"]);
     }
     $fields = array_merge($fields, array("DATE NAISS" => CMbDT::dateToLocale($this->naissance), "IPP" => $this->_IPP, "LIEU NAISSANCE" => $this->lieu_naissance, "NOM" => $this->nom, "NOM JF" => $this->nom_jeune_fille, "FORMULE NOM JF" => $this->sexe == "f" && $this->nom_jeune_fille ? "née {$this->nom_jeune_fille}" : "", "PRENOM" => $this->prenom, "SEXE" => strtoupper($this->sexe), "CIVILITE" => $this->civilite, "CIVILITE LONGUE" => $this->_civilite_long, "ACCORD GENRE" => $this->sexe == "f" ? "e" : "", "CODE BARRE IPP" => "@BARCODE_" . $this->_IPP . "@", "ADRESSE" => "{$this->adresse} \n{$this->cp} {$this->ville}", "MED. TRAITANT" => "Dr {$medecin_traitant->nom} {$medecin_traitant->prenom}", "TEL" => $this->getFormattedValue("tel"), "TEL PORTABLE" => $this->getFormattedValue("tel2"), "TEL ETRANGER" => $this->getFormattedValue("tel_autre"), "PAYS" => $this->getFormattedValue("pays"), "PREVENIR - NOM" => $prevenir->nom, "PREVENIR - PRENOM" => $prevenir->prenom, "PREVENIR - ADRESSE" => $prevenir->adresse, "PREVENIR - TEL" => $prevenir->getFormattedValue("tel"), "PREVENIR - PORTABLE" => $prevenir->getFormattedValue("mob"), "PREVENIR - CP VILLE" => "{$prevenir->cp} {$prevenir->ville}"));
     switch (CAppUI::conf("ref_pays")) {
         case 1:
             $fields["NUM SECU"] = $this->matricule;
             break;
         case 2:
             $fields["AVS"] = $this->getFormattedValue("avs");
     }
 }
Esempio n. 6
0
$errors = 0;
$count = 0;
$step = 0;
while ($continue) {
    $ch = curl_init();
    $url_request = $url . $departement . str_pad($step, "3", "0", STR_PAD_LEFT);
    $result = file_get_contents($url_request);
    $result = json_decode($result, true);
    $result = $result["mks"];
    $result = array_map_recursive("utf8_decode", $result);
    // Traitement des résultats de la page
    $continue = $step <= 999;
    $step++;
    $count += count($result);
    foreach ($result as $_result) {
        $medecin = new CMedecin();
        $medecin->disciplines = "Kinésitherapeute";
        $medecin->nom = $_result["nom"];
        $medecin->prenom = $_result["prenom"];
        $medecin->adresse = $_result["adresse"];
        if ($_result["adresse_suite"] != "") {
            $medecin->adresse .= "\n" . $_result["adresse_suite"];
        }
        $medecin->cp = $_result["zip"];
        $medecin->ville = $_result["ville"];
        $msg = $medecin->store();
        if ($msg) {
            $errors++;
            CAppUI::stepAjax($msg . "\n" . "{$medecin->nom}, {$medecin->prenom} {$medecin->cp} {$medecin->ville}", UI_MSG_ERROR);
        }
    }
Esempio n. 7
0
<?php

/**
 * $Id$
 *
 * @category Patients
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision$
 * @link     http://www.mediboard.org
 */
CCanDo::checkEdit();
$duplicate = CValue::get("duplicate", 0);
$medecin = new CMedecin();
$medecin->load(CValue::get("medecin_id"));
if ($duplicate) {
    $medecin->_id = null;
}
if (CAppUI::conf('dPpatients CPatient function_distinct') && $medecin->_id) {
    $current_user = CMediusers::get();
    $is_admin = $current_user->isAdmin();
    $same_function = $current_user->function_id == $medecin->function_id;
    if (!$is_admin && !$same_function) {
        CAppUI::redirect("m=system&a=access_denied");
    }
}
$medecin->loadSalutations();
$medecin->loadRefsNotes();
$smarty = new CSmartyDP();
$smarty->assign("object", $medecin);
 /**
  * @see parent::fillLimitedTemplate()
  */
 function fillLimitedTemplate(&$template)
 {
     $chir = $this->_ref_plageconsult->_ref_chir;
     // Ajout du praticien pour les destinataires possibles (dans l'envoi d'un email)
     $template->destinataires[] = array("nom" => "Dr " . $chir->_user_last_name . " " . $chir->_user_first_name, "email" => $chir->_user_email, "tag" => "Praticien");
     $this->updateFormFields();
     $this->loadRefsFwd();
     $this->notify("BeforeFillLimitedTemplate", $template);
     $template->addDateProperty("Consultation - date", $this->_ref_plageconsult->date);
     $template->addLongDateProperty("Consultation - date longue", $this->_ref_plageconsult->date);
     $template->addTimeProperty("Consultation - heure", $this->heure);
     $locExamFields = array("motif" => "motif", "rques" => "remarques", "examen" => "examen", "traitement" => "traitement", "histoire_maladie" => "histoire maladie", "conclusion" => "conclusion");
     foreach ($this->_exam_fields as $field) {
         $loc_field = $locExamFields[$field];
         $template->addProperty("Consultation - {$loc_field}", $this->{$field});
     }
     if (!in_array("traitement", $this->_exam_fields)) {
         $template->addProperty("Consultation - traitement", $this->traitement);
     }
     $medecin = new CMedecin();
     $medecin->load($this->adresse_par_prat_id);
     $nom = "{$medecin->nom} {$medecin->prenom}";
     $template->addProperty("Consultation - adressé par", $nom);
     $template->addProperty("Consultation - adressé par - adresse", "{$medecin->adresse}\n{$medecin->cp} {$medecin->ville}");
     $template->addProperty("Consultation - Accident du travail", $this->getFormattedValue("date_at"));
     $libelle_at = $this->date_at ? "Accident du travail du " . $this->getFormattedValue("date_at") : "";
     $template->addProperty("Consultation - Libellé accident du travail", $libelle_at);
     $this->loadRefsFiles();
     $list = CMbArray::pluck($this->_ref_files, "file_name");
     $template->addListProperty("Consultation - Liste des fichiers", $list);
     $template->addProperty("Consultation - Fin arrêt de travail", CMbDT::dateToLocale(CMbDT::date($this->fin_at)));
     $template->addProperty("Consultation - Prise en charge arrêt de travail", $this->getFormattedValue("pec_at"));
     $template->addProperty("Consultation - Reprise de travail", CMbDT::dateToLocale(CMbDT::date($this->reprise_at)));
     $template->addProperty("Consultation - Accident de travail sans arrêt de travail", $this->getFormattedValue("at_sans_arret"));
     $template->addProperty("Consultation - Arrêt maladie", $this->getFormattedValue("arret_maladie"));
     $this->loadRefsExamsComp();
     $exam = new CExamComp();
     foreach ($exam->_specs["realisation"]->_locales as $key => $locale) {
         $exams = isset($this->_types_examen[$key]) ? $this->_types_examen[$key] : array();
         $template->addListProperty("Consultation - Examens complémentaires - {$locale}", $exams);
     }
     if (CModule::getActive("forms")) {
         CExObject::addFormsToTemplate($template, $this, "Consultation");
     }
     // Séjour et/ou intervention créés depuis la consultation
     $sejour_relie = reset($this->loadBackRefs("sejours_lies"));
     $interv_reliee = reset($this->loadBackRefs("intervs_liees"));
     if ($interv_reliee) {
         $sejour_relie = $interv_reliee->loadRefSejour();
     } else {
         if (!$sejour_relie) {
             $sejour_relie = new CSejour();
         }
         if (!$interv_reliee) {
             $interv_reliee = new COperation();
         }
     }
     $interv_reliee->loadRefChir();
     $interv_reliee->loadRefPlageOp();
     $interv_reliee->loadRefSalle();
     $sejour_relie->loadRefPraticien();
     // Intervention reliée
     $template->addProperty("Consultation - Opération reliée - Chirurgien", $interv_reliee->_ref_chir->_view);
     $template->addProperty("Consultation - Opération reliée - Libellé", $interv_reliee->libelle);
     $template->addProperty("Consultation - Opération reliée - Salle", $interv_reliee->_ref_salle->nom);
     $template->addDateProperty("Consultation - Opération reliée - Date", $interv_reliee->_datetime_best);
     // Séjour relié
     $template->addDateProperty("Consultation - Séjour relié - Date entrée", $sejour_relie->entree);
     $template->addLongDateProperty("Consultation - Séjour relié - Date entrée (longue)", $sejour_relie->entree);
     $template->addTimeProperty("Consultation - Séjour relié - Heure entrée", $sejour_relie->entree);
     $template->addDateProperty("Consultation - Séjour relié - Date sortie", $sejour_relie->sortie);
     $template->addLongDateProperty("Consultation - Séjour relié - Date sortie (longue)", $sejour_relie->sortie);
     $template->addTimeProperty("Consultation - Séjour relié - Heure sortie", $sejour_relie->sortie);
     $template->addDateProperty("Consultation - Séjour relié - Date entrée réelle", $sejour_relie->entree_reelle);
     $template->addTimeProperty("Consultation - Séjour relié - Heure entrée réelle", $sejour_relie->entree_reelle);
     $template->addDateProperty("Consultation - Séjour relié - Date sortie réelle", $sejour_relie->sortie_reelle);
     $template->addTimeProperty("Consultation - Séjour relié - Heure sortie réelle", $sejour_relie->sortie_reelle);
     $template->addProperty("Consultation - Séjour relié - Praticien", "Dr " . $sejour_relie->_ref_praticien->_view);
     $template->addProperty("Consultation - Séjour relié - Libelle", $sejour_relie->getFormattedValue("libelle"));
     $this->notify("AfterFillLimitedTemplate", $template);
 }
 *
 * @package    Mediboard
 * @subpackage Patients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision: 28546 $
 */
CCanDo::checkRead();
$current_user = CMediusers::get();
$keywords = CValue::post("_view");
$all_departements = CValue::post("all_departements", 0);
$function_id = CValue::get("function_id", $current_user->function_id);
if ($keywords == "") {
    $keywords = "%%";
}
$medecin = new CMedecin();
$order = 'nom';
$group = CGroups::loadCurrent();
$where = array();
$medecin_cps_prefs = CAppUI::pref("medecin_cps_pref");
$where["actif"] = "= '1'";
if ($medecin_cps_prefs != "") {
    $cps = preg_split("/\\s*[\\s\\|,]\\s*/", $medecin_cps_prefs);
    CMbArray::removeValue("", $cps);
    if (count($cps)) {
        $where_cp = array();
        foreach ($cps as $cp) {
            $where_cp[] = "cp LIKE '" . $cp . "%'";
        }
        $where[] = "(" . implode(" OR ", $where_cp) . ")";
    }
Esempio n. 10
0
}
if ($medecin_ville) {
    $where["ville"] = $ds->prepareLike("%{$medecin_ville}%");
}
if ($medecin_type) {
    $where["type"] = "= '{$medecin_type}'";
}
$order = "nom, prenom";
if ($order_col == "cp") {
    $order = "cp {$order_way}, nom, prenom";
} else {
    if ($order_col == "ville") {
        $order = "ville {$order_way}, nom, prenom";
    }
}
$medecin = new CMedecin();
$count_medecins = $medecin->countList($where);
/** @var CMedecin[] $medecins */
$medecins = $medecin->loadList($where, $order, "{$start_med}, {$step_med}");
foreach ($medecins as $_medecin) {
    $_medecin->loadRefFunction();
}
$list_types = $medecin->_specs['type']->_locales;
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("is_admin", $is_admin);
$smarty->assign("dialog", $dialog);
$smarty->assign("annuaire", $annuaire);
$smarty->assign("nom", $medecin_nom);
$smarty->assign("prenom", $medecin_prenom);
$smarty->assign("cp", $medecin_cp);
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Patients
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$ds = CSQLDataSource::get("std");
$medecin1 = new CMedecin();
$medecin1->load($_POST["medecin1_id"]);
$medecin2 = new CMedecin();
$medecin2->load($_POST["medecin2_id"]);
$do = new CDoObjectAddEdit("CMedecin", "medecin_id");
$do->doBind();
// Création du nouveau medecin
if (intval(CValue::post("del"))) {
    $do->doDelete();
} else {
    $do->doStore();
}
/** @var CMedecin $newMedecin */
$newMedecin =& $do->_obj;
// Transfert de toutes les backrefs
if ($msg = $newMedecin->transferBackRefsFrom($medecin1)) {
    $do->errorRedirect($msg);
}
if ($msg = $newMedecin->transferBackRefsFrom($medecin2)) {
 /**
  * Get others PV1 QPD element
  *
  * @param DOMNode $node QPD element
  *
  * @return array
  */
 function getOtherRequestSejour(DOMNode $node)
 {
     // Recherche du service
     $service = new CService();
     $ds = $service->getDS();
     $where_returns = array();
     if ($service_name = $this->getDemographicsFields($node, "CSejour", "3.1")) {
         $service_name = preg_replace("/\\*+/", "%", $service_name);
         $where["code"] = $ds->prepare("LIKE %", $service_name);
         $ids = array_unique($service->loadIds($where, null, 100));
         // FIXME prendre les affectations en compte
         $where_returns["sejour.service_id"] = $ds->prepareIn($ids);
     }
     // Praticien
     if (($attending_doctor_name = $this->getDemographicsFields($node, "CSejour", "7.2.1")) || ($attending_doctor_name = $this->getDemographicsFields($node, "CSejour", "17.2.1"))) {
         $user = new CUser();
         $attending_doctor_name = preg_replace("/\\*+/", "%", $attending_doctor_name);
         $where["user_last_name"] = $ds->prepare("LIKE %", $attending_doctor_name);
         $ids = array_unique($user->loadIds($where, null, 100));
         $where_returns["sejour.praticien_id"] = $ds->prepareIn($ids);
     }
     // Médecin adressant
     if ($referring_doctor_name = $this->getDemographicsFields($node, "CSejour", "8.2.1")) {
         $medecin = new CMedecin();
         $referring_doctor_name = preg_replace("/\\*+/", "%", $referring_doctor_name);
         $where["nom"] = $ds->prepare("LIKE %", $referring_doctor_name);
         $ids = array_unique($medecin->loadIds($where, null, 100));
         $where_returns["sejour.adresse_par_prat_id"] = $ds->prepareIn($ids);
     }
     return $where_returns;
 }
        $query_traitant = $ds->prepare($query, $tag);
    }
    $list_corresp = $ds->loadHashList($query_corresp);
    $list_traitant = $ds->loadHashList($query_traitant);
    foreach ($list_traitant as $_medecin_id => $_count) {
        if (array_key_exists($_medecin_id, $list_corresp)) {
            $list_corresp[$_medecin_id] += $_count;
        } else {
            $list_corresp[$_medecin_id] = $_count;
        }
    }
    arsort($list_corresp);
    $list = $list_corresp;
}
$where = array("medecin_id" => $ds->prepareIn(array_keys($list)));
$medecin = new CMedecin();
/** @var CMedecin[] $medecins */
$medecins = $medecin->loadList($where);
if ($csv) {
    $csvfile = new CCSVFile();
    $titles = array("Total", CAppUI::tr("CMedecin-nom"), CAppUI::tr("CMedecin-prenom"), CAppUI::tr("CMedecin-type"), CAppUI::tr("CMedecin-tel"), CAppUI::tr("CMedecin-fax"), CAppUI::tr("CMedecin-email"), CAppUI::tr("CMedecin-adresse"), CAppUI::tr("CMedecin-cp"), CAppUI::tr("CMedecin-adeli"), CAppUI::tr("CMedecin-rpps"));
    $csvfile->writeLine($titles);
    foreach ($list as $_medecin_id => $_count) {
        $_medecin = $medecins[$_medecin_id];
        $_line = array($_count, $_medecin->nom, $_medecin->prenom, $_medecin->type, $_medecin->tel, $_medecin->fax, $_medecin->email, $_medecin->adresse, $_medecin->cp, $_medecin->adeli, $_medecin->rpps);
        $csvfile->writeLine($_line);
    }
    $csvfile->stream("Médecins correspondants");
} else {
    $smarty = new CSmartyDP();
    $smarty->assign("medecins", $medecins);
Esempio n. 14
0
<?php

/**
 * $Id: export_medecins_csv.php 28215 2015-05-07 12:20:27Z phenxdesign $
 *  
 * @category Patients
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision: 28215 $
 * @link     http://www.mediboard.org
 */
CCanDo::checkEdit();
$only_with_emails = CValue::get("only_with_emails", 1);
$csv = new CCSVFile();
$medecin = new CMedecin();
$ds = $medecin->getDS();
$line = array_keys($medecin->getPlainFields());
$csv->writeLine($line);
$where = array();
if ($only_with_emails) {
    $where[] = "email IS NOT NULL OR email_apicrypt IS NOT NULL";
}
$request = new CRequest();
$request->addWhere($where);
// Disable query buffer, to save memory
if ($ds instanceof CPDOMySQLDataSource) {
    $ds->link->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
}
$query = $request->makeSelect($medecin);
$res = $ds->exec($query);