* @category DPpatients
 * @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
 */
if (!CAppUI::pref("allowed_modify_identity_status")) {
    CAppUI::redirect("m=system&a=access_denied");
}
$number_day = CValue::getOrSession("_number_day", 8);
$number_day = $number_day ?: 8;
$now = CValue::getOrSession("_date_end", CMbDT::date());
$before = CMbDT::date("-{$number_day} DAY", $now);
$csv = new CCSVFile();
$line = array("Date", CAppUI::tr("CPatient.status.PROV"), CAppUI::tr("CPatient.status.DPOT"), CAppUI::tr("CPatient.status.ANOM"), CAppUI::tr("CPatient.status.CACH"), CAppUI::tr("CPatient.status.VALI"));
$csv->writeLine($line);
$results = CPatientStateTools::getPatientStateByDate($before, $now);
$values = array();
for ($i = $number_day; $i >= 0; $i--) {
    $values[CMbDT::date("-{$i} DAY", $now)] = array("PROV" => 0, "DPOT" => 0, "ANOM" => 0, "CACH" => 0, "VALI" => 0);
}
foreach ($results as $_result) {
    $values[$_result["date"]][$_result["state"]] = $_result["total"];
}
foreach ($values as $_date => $_value) {
    $line = array($_date);
    $line = array_merge($line, array_values($_value));
    $csv->writeLine($line);
}
$csv->stream("statut_patient_par_date");
        $list_patient[] = $pat;
    }
    // Le count total
    $request->select = array("count(*)");
    $request->limit = null;
    $count_patient = $ds->loadResult($request->makeSelect());
    if (!$commentaire && $one_field_presc) {
        $request_b->select = array("count(*)");
        $request_b->limit = null;
        $count_patient += $ds->loadResult($request_b->makeSelect());
    }
}
if ($export) {
    $csv = new CCSVFile();
    $titles = array("Patient", "Age à l'époque", "Dossier Médical", "Evenement", "Prescription", "DCI", "Code ATC", "Libellé ATC", "Commentaire / Motif");
    $csv->writeLine($titles);
    foreach ($list_patient as $_patient) {
        $dossier_medical = "";
        if (isset($_patient->_ref_antecedent)) {
            $dossier_medical .= "Antécédents :\n {$_patient->_ref_traitement}->_view";
        } elseif (isset($_patient->_refs_antecedents) && count($_patient->_refs_antecedents)) {
            $dossier_medical .= "Antécédents :\n";
            foreach ($_patient->_refs_antecedents as $_antecedent) {
                if ($_antecedent->type == "alle") {
                    continue;
                }
                $dossier_medical .= $_antecedent->_view . "\n";
            }
        }
        if (isset($_patient->_refs_allergies) && count($_patient->_refs_allergies)) {
            $dossier_medical .= "Allergies :\n";
Пример #3
0
$fields = array(array("CPatient", "_IPP"), array("CPatient", "nom"), array("CPatient", "nom_jeune_fille"), array("CPatient", "prenom"), array("CPatient", "prenom_2"), array("CPatient", "prenom_3"), array("CPatient", "prenom_4"), array("CPatient", "naissance"), array("CPatient", "sexe"), array("CSejour", "_NDA"), array("CSejour", "rques"), array("CSejour", "praticien_id"), array("CSejour", "type"), array("CSejour", "entree"), array("CSejour", "sortie"), array("CSejour", "annule"), array("CSejour", "DP"), array("CSejour", "DR"), array("COperation", "chir_id"), array("COperation", "anesth_id"), array("COperation", "salle_id"), array("COperation", "date"), array("COperation", "libelle"), array("COperation", "cote"), array("COperation", "temp_operation"), array("COperation", "codes_ccam"));
$meta_fields = array(array("CExObject", "datetime_create"), array("CExObject", "datetime_edit"), array("CExObject", "owner_id"));
$row = array();
foreach ($fields as $_field) {
    $row[] = $get_field($_field[0], $_field[1]);
}
foreach ($meta_fields as $_field) {
    $row[] = $get_field($_field[0], $_field[1]);
}
foreach ($ex_class->loadRefsGroups() as $_group) {
    foreach ($_group->_ref_fields as $_field) {
        $row[] = $_group->name . " - " . CAppUI::tr("CExObject_{$ex_class->_id}-{$_field->name}");
    }
}
// Write column headers
$csv->writeLine($row);
foreach ($ex_objects as $_ex_object) {
    /** @var CMbObject[] $_objects */
    $_objects = array();
    /** @var CPatient $_patient */
    $_patient = $_ex_object->getReferenceObject("CPatient");
    $_patient->loadIPP();
    $_objects["CPatient"] = $_patient;
    /** @var CSejour $_sejour */
    $_sejour = $_ex_object->getReferenceObject("CSejour");
    $_objects["CSejour"] = $_sejour;
    /** @var COperation $_interv */
    $_interv = $_ex_object->getReferenceObject("COperation");
    $_objects["COperation"] = $_interv;
    $_row = array();
    foreach ($fields as $_field) {
Пример #4
0
        $_operation->_ref_salle_prevue = $plage->_ref_salle;
        $_operation->_ref_salle_reelle = $_operation->_ref_salle;
        $_operation->_deb_plage = $plage->debut;
        $_operation->_fin_plage = $plage->fin;
    } else {
        $_operation->_ref_salle_prevue = $_operation->_ref_salle;
        $_operation->_ref_salle_reelle = $_operation->_ref_salle;
        $_operation->_deb_plage = $_operation->date;
        $_operation->_fin_plage = $_operation->date;
    }
}
if ($mode == "csv") {
    $csvName = "stats_bloc_" . $deblist . "_" . $finlist . "_" . $bloc_id;
    $csv = new CCSVFile();
    $title = array("Date", "Salle prévue", "Salle réelle", "Début vacation", "Fin vacation", "N° d\\'ordre prévu", "N° d\\'ordre réel", "Patient", "Prise en charge", "Chirurgien", "Anesthésiste", "Libellé", "DP", "CCAM", "Type d\\'anesthésie", "Code ASA", "Placement programme", "Entrée bloc", "Entrée salle", "Début d\\'induction", "Fin d\\'induction", "Début d\\'intervention", "Fin d\\'intervention", "Sortie salle", "Patient suivant", "Entrée reveil", "Sortie reveil");
    $csv->writeLine($title);
    foreach ($operations as $_operation) {
        $line_op = array(CMbDT::date($_operation->_datetime), $_operation->_ref_salle_prevue, $_operation->_ref_salle_reelle, $_operation->_deb_plage, $_operation->_fin_plage, $_operation->rank, $_operation->_rank_reel, $_operation->_ref_sejour->_ref_patient->_view . '(' . $_operation->_ref_sejour->_ref_patient->_age . ')', $_operation->_ref_sejour->type, $_operation->_ref_chir->_view, $_operation->_ref_anesth->_view, $_operation->libelle, $_operation->_ref_sejour->DP, $_operation->codes_ccam, $_operation->_lu_type_anesth, $_operation->ASA, $_operation->_ref_workflow->date_creation, $_operation->entree_bloc, $_operation->entree_salle, $_operation->induction_debut, $_operation->induction_fin, $_operation->debut_op, $_operation->fin_op, $_operation->sortie_salle, $_operation->_pat_next, $_operation->entree_reveil, $_operation->sortie_reveil_possible);
        $csv->writeLine($line_op);
    }
    $csv->stream($csvName);
    return;
} else {
    // Création du template
    $smarty = new CSmartyDP();
    $smarty->assign("deblist", $deblist);
    $smarty->assign("finlist", $finlist);
    $smarty->assign("blocs", $blocs);
    $smarty->assign("plages", $plages);
    $smarty->assign("operations", $operations);
    $smarty->assign("nb_interv", $nb_interv);
    $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);
    $smarty->assign("counts", $list);
    $smarty->display("inc_stats_medecins.tpl");
}
if ($bloc_id) {
    $ljoin["sallesbloc"] = "sallesbloc.salle_id = operations.salle_id";
    $where["sallesbloc.bloc_id"] = $ds->prepare("=?", $bloc_id);
}
if ($hors_plage) {
    $where["operations.plageop_id"] = "IS NULL";
}
if ($codes_ccam) {
    $where["operations.codes_ccam"] = $ds->prepare("LIKE %", "%{$codes_ccam}%");
}
/** @var COperation[] $interventions */
$interventions = $interv->loadList($where, null, null, "operation_id", $ljoin);
// Chargements de masse
$sejours = CMbObject::massLoadFwdRef($interventions, "sejour_id");
CMbObject::massLoadFwdRef($sejours, "patient_id");
CMbObject::massLoadFwdRef($sejours, "praticien_id");
CMbObject::massLoadFwdRef($interventions, "chir_id");
$columns = array("IPP", "Nom", "Nom naissance", "Prénom", "Date naissance", "Sexe", "Date intervention", "Libellé intervention", "Chirurgien nom", "Chirurgien prénom", "NDA", "Praticien nom", "Praticien prénom", "Date entrée", "Date sortie");
$csv = new CCSVFile();
$csv->writeLine($columns);
foreach ($interventions as $_intervention) {
    $_sejour = $_intervention->loadRefSejour();
    $_patient = $_sejour->loadRefPatient();
    $_praticien = $_sejour->loadRefPraticien();
    $_chir = $_intervention->loadRefChir();
    $_patient->loadIPP();
    $_sejour->loadNDA();
    $row = array($_patient->_IPP, $_patient->nom, $_patient->nom_jeune_fille, $_patient->prenom, $_patient->naissance, $_patient->sexe, $_intervention->libelle ?: $_intervention->codes_ccam, $_intervention->date, $_chir->_user_last_name, $_chir->_user_first_name, $_sejour->_NDA, $_praticien->_user_last_name, $_praticien->_user_first_name, $_sejour->entree, $_sejour->sortie);
    $csv->writeLine($row);
}
$csv->stream("Interventions {$date_min} - {$date_max}", true);
Пример #7
0
 * $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);
while ($data = $ds->fetchAssoc($res)) {
    $_new_data = array();
    foreach ($line as $_field) {
Пример #8
0
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage System
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$data = CValue::post("data");
$filename = CValue::post("filename", "data");
$data = stripslashes($data);
$data = json_decode(utf8_encode($data), true);
$csv = new CCSVFile(null, "excel");
foreach ($data as $_line) {
    $csv->writeLine($_line);
}
$csv->stream($filename);
CApp::rip();