コード例 #1
0
            $stats->addTotal($_row["user_id"], $_row["refdate"], $_row["total"], "planifies");
        }
        break;
    case "CActeSSR":
        // CsARR
        $query1 = clone $query;
        $query1->addTable("acte_csarr");
        $query1->addLJoinClause("evenement_ssr", "acte_csarr.evenement_ssr_id = evenement_ssr.evenement_ssr_id");
        $query1->addLJoinClause("sejour", "sejour.sejour_id = evenement_ssr.sejour_id");
        $query1->addLJoinClause("users_mediboard", "users_mediboard.user_id = evenement_ssr.therapeute_id");
        $query1->addLJoinClause("functions_mediboard", "functions_mediboard.function_id = users_mediboard.function_id");
        foreach ($ds->loadList($query1->makeSelect()) as $_row) {
            $stats->addTotal($_row["user_id"], $_row["refdate"], $_row["total"], "csarr");
        }
        // CdARR
        $query1 = clone $query;
        $query1->addTable("acte_cdarr");
        $query1->addLJoinClause("evenement_ssr", "acte_cdarr.evenement_ssr_id = evenement_ssr.evenement_ssr_id");
        $query1->addLJoinClause("sejour", "sejour.sejour_id = evenement_ssr.sejour_id");
        $query1->addLJoinClause("users_mediboard", "users_mediboard.user_id = evenement_ssr.therapeute_id");
        $query1->addLJoinClause("functions_mediboard", "functions_mediboard.function_id = users_mediboard.function_id");
        foreach ($ds->loadList($query1->makeSelect()) as $_row) {
            $stats->addTotal($_row["user_id"], $_row["refdate"], $_row["total"], "cdarr");
        }
        break;
    default:
        trigger_error("Type '{$type}' unknown", E_USER_WARNING);
        return;
}
$stats->display("CMediusersStats-SSR-{$type}");
コード例 #2
0
<?php

/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage Cabinet
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
CCanDo::checkAdmin();
$type = CValue::get("type", "RDV");
$date = CValue::get("date");
$period = CValue::get("period", "month");
$stats = new CMediusersStats($date, $period, "date", 18);
$consult = new CConsultation();
$group = CGroups::loadCurrent();
$ds = $consult->_spec->ds;
$query_complement = "1";
if ($type == "consult") {
    $query_complement = "consultation.chrono > 32\r\n     OR consultation.traitement       IS NOT NULL\r\n     OR consultation.histoire_maladie IS NOT NULL\r\n     OR consultation.conclusion       IS NOT NULL\r\n     OR consultation.examen           IS NOT NULL\r\n  ";
}
$query = "SELECT COUNT(*) total, user_id, {$stats->sql_date} AS refdate\r\n  FROM `consultation`\r\n  LEFT JOIN plageconsult AS plage ON plage.plageconsult_id = consultation.plageconsult_id\r\n  LEFT JOIN users_mediboard AS user ON user.user_id = plage.chir_id\r\n  LEFT JOIN functions_mediboard AS function ON function.function_id = user.function_id\r\n  WHERE {$stats->sql_date} BETWEEN '{$stats->min_date}' AND '{$stats->max_date}'\r\n  AND function.group_id = '{$group->_id}'\r\n  AND consultation.annule != '1'\r\n  AND consultation.patient_id IS NOT NULL\r\n  AND consultation.sejour_id IS NULL\r\n  AND ({$query_complement})\r\n  GROUP BY user_id, refdate\r\n  ORDER BY refdate DESC\r\n";
foreach ($result = $ds->loadList($query) as $_row) {
    $stats->addTotal($_row["user_id"], $_row["refdate"], $_row["total"]);
}
$stats->display("CMediusersStats-CConsultation-{$type}");