本文整理汇总了PHP中CRequest::addGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP CRequest::addGroup方法的具体用法?PHP CRequest::addGroup怎么用?PHP CRequest::addGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRequest
的用法示例。
在下文中一共展示了CRequest::addGroup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPatientMergeByDate
/**
* Get the patient merge by date
*
* @param Date $before before date
* @param Date $now now date
*
* @return array
*/
static function getPatientMergeByDate($before, $now)
{
$where = array("date >= '{$before} 00:00:00'", "date <= '{$now} 23:59:59'", "type = 'merge'", "object_class = 'CPatient'");
$ds = CSQLDataSource::get("std");
$ds->exec("SET SESSION group_concat_max_len = 100000;");
$request = new CRequest();
$request->addSelect("DATE(date) AS 'date', COUNT(*) AS 'total', GROUP_CONCAT( object_id SEPARATOR '-') as ids");
$request->addTable("user_log");
$request->addWhere($where);
$request->addGroup("DATE(date)");
return $ds->loadList($request->makeSelect());
}
示例2: CMediusersStats
*/
CCanDo::checkAdmin();
$type = CValue::get("type", "CEvenementSSR");
$date = CValue::get("date");
$period = CValue::get("period", "month");
$stats = new CMediusersStats($date, $period, "DATE(debut)", 18);
$consult = new CConsultation();
$ds = $consult->_spec->ds;
$group = CGroups::loadCurrent();
$query = new CRequest();
$query->addColumn("COUNT(*) total");
$query->addColumn("therapeute_id", "user_id");
$query->addColumn($stats->sql_date, "refdate");
$query->addWhere("{$stats->sql_date} BETWEEN '{$stats->min_date}' AND '{$stats->max_date}'");
$query->addWhereClause("functions_mediboard.group_id", "= '{$group->_id}'");
$query->addGroup("therapeute_id, refdate");
$query->addOrder("refdate DESC");
$totals = array();
switch ($type) {
case "CEvenementSSR":
$query->addTable("`evenement_ssr`");
$query->addLJoinClause("sejour", "sejour.sejour_id = evenement_ssr.sejour_id");
$query->addLJoinClause("users_mediboard", "users_mediboard.user_id = evenement_ssr.therapeute_id");
$query->addLJoinClause("functions_mediboard", "functions_mediboard.function_id = users_mediboard.function_id");
// Réalisés
$query1 = clone $query;
$query1->addWhereClause("evenement_ssr.realise", "= '1'");
foreach ($ds->loadList($query1->makeSelect()) as $_row) {
$stats->addTotal($_row["user_id"], $_row["refdate"], $_row["total"], "realises");
}
// Annulés
示例3: array
$series[$key]['data'][$i] = array($i, intval($count));
}
}
break;
// Nombre de transferts
// Nombre de transferts
case "transfers_count":
$data[$axe] = array("options" => array("title" => utf8_encode("Nombre de transferts")), "series" => array());
$series =& $data[$axe]['series'];
$sejour = new CSejour();
$end = end($dates);
$start = reset($dates);
$query = new CRequest();
$query->addSelect("sejour.etablissement_sortie_id");
$query->addTable("sejour");
$query->addGroup("sejour.etablissement_sortie_id");
$query->addWhere(array("sejour.entree" => "BETWEEN '{$start}' AND '{$end}'", "sejour.etablissement_sortie_id" => "IS NOT NULL"));
$etab_externe_ids = $sejour->_spec->ds->loadColumn($query->makeSelect());
$etab_externe = new CEtabExterne();
$etabs = $etab_externe->loadList(array($etab_externe->_spec->key => $etab_externe->_spec->ds->prepareIn($etab_externe_ids)));
$etabs["none"] = $etab_externe;
$etabs["none"]->_view = "Non renseigné";
$where["sejour.mode_sortie"] = "= 'transfert'";
$key = 0;
foreach ($etabs as $_id => $_etab) {
$series[$key] = array('data' => array(), 'label' => utf8_encode($_etab->_view));
$sub_total = 0;
foreach ($dates as $i => $_date) {
$_date_next = CMbDT::date("+1 {$period}", $_date);
$where['sejour.entree'] = "BETWEEN '{$_date}' AND '{$_date_next}'";
$where['sejour.etablissement_sortie_id'] = $_id === "none" ? "IS NULL" : "= '{$_id}'";
示例4: CRequest
CCanDo::checkEdit();
$date = CValue::getOrSession("date", CMbDT::date());
$date_min = CMbDT::date("last monday", CMbDT::date("+1 day", $date));
$date_max = CMbDT::date("+7 DAY", $date_min);
// Comptage des événements hors-séjours
$group = "sejour.sejour_id";
$query = new CRequest();
$query->addTable("evenement_ssr");
$query->addColumn("COUNT(evenement_ssr_id)", "evenements_count");
$query->addWhereClause("debut", "BETWEEN '{$date_min}' AND '{$date_max}'");
$query->addWhereClause("type", "= 'ssr'");
$query->addLJoinClause("sejour", "sejour.sejour_id = evenement_ssr.sejour_id");
$query->addColumn("sejour.sejour_id");
$query->addWhereClause(null, "debut NOT BETWEEN DATE(entree) AND DATE(ADDDATE(sortie, 1))");
$query->addWhereClause("sejour.annule", "!= '1'");
$query->addGroup("sejour.sejour_id");
$sejour = new CSejour();
$ds = $sejour->_spec->ds;
$evenements_counts = array();
foreach ($ds->loadList($query->makeSelect()) as $row) {
$evenements_counts[$row["sejour_id"]] = $row["evenements_count"];
}
// Chargement des séjours concernés
/** @var CSejour[] $sejours */
$sejours = $sejour->loadAll(array_keys($evenements_counts));
$sejours_count = count($sejours);
// Détails sur les séjours concernés
foreach ($sejours as $_sejour) {
$_sejour->checkDaysRelative($date);
$_sejour->loadRefPatient()->loadIPP();
}
示例5: CSejour
CCanDo::checkAdmin();
global $dPconfig;
$dPconfig["sa"]["trigger_sejour"] = "facture";
$limit = CValue::get("limit", 10);
$day = CValue::get("day", 3);
$sejour = new CSejour();
$ds = $sejour->getDS();
$request = new CRequest();
$request->addSelect("sejour.sejour_id");
$request->addTable("sejour");
$request->addLJoinClause("rpu", "rpu.sejour_id = sejour.sejour_id");
$request->addWhereClause("annule", "!='1'");
$request->addWhereClause("facture", "!='1'");
$request->addWhereClause("sortie_reelle", "BETWEEN '" . CMbDT::dateTime("-{$day}DAY") . "' AND '" . CMbDT::dateTime() . "'");
$request->addWhereClause("rpu.sejour_id", "IS NOT NULL");
$request->addGroup("sejour.sejour_id");
$request->addHaving("count(*) = 1");
$request->setLimit($limit);
$list_sejour = $ds->loadList($request->makeSelect());
foreach ($list_sejour as $_sejour_id) {
$sejour = new CSejour();
$sejour->load($_sejour_id["sejour_id"]);
if (!($nda = $sejour->getTagNDA())) {
continue;
}
$rpu = $sejour->loadRefRPU();
if ($rpu->mutation_sejour_id) {
$sejour_reliquat = $rpu->loadRefSejourMutation();
if (!($nda = $sejour_reliquat->getTagNDA())) {
continue;
}
示例6: max
CMbArray::removeValue($spec->key, $fields);
// Don't group by date
if ($merge_dates) {
CMbArray::removeValue("date_debut", $fields);
}
$select = $fields;
$select["TOTAL"] = "COUNT(*)";
$select["IDS"] = "GROUP_CONCAT(CAST({$spec->key} AS CHAR))";
$orderby = "TOTAL DESC";
$count_min = max(1, $count_min);
$having = array("TOTAL" => $spec->ds->prepare("> ?", $count_min));
$where = array("patient_id" => "IS NOT NULL");
$request = new CRequest();
$request->addSelect($select);
$request->addTable($spec->table);
$request->addGroup($fields);
$request->addWhere($where);
$request->addOrder($orderby);
$request->addHaving($having);
$list = $spec->ds->loadList($request->makeSelect());
$count_total = 0;
foreach ($list as $_corresp) {
$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);
示例7: CRequest
$where["sejour.type"] = "!= 'urg' AND `sejour`.`type` != 'seances'";
}
// filtre sur le praticien
if ($prat_id) {
$where["sejour.praticien_id"] = "= '{$prat_id}'";
}
$where["sejour.entree"] = " BETWEEN '{$month_min}' AND '{$nextmonth}'";
$where["sejour.group_id"] = " = '{$group->_id}'";
$where["sejour.annule"] = " = '0'";
// Liste des admissions par jour
$request = new CRequest();
$request->addSelect(array("DATE_FORMAT(sejour.entree, '%Y-%m-%d') AS 'date'", "COUNT(sejour.sejour_id) AS 'num'"));
$request->addTable("sejour");
$request->addWhere($where);
$request->addLJoin($leftjoin);
$request->addGroup("date");
$request->addOrder("date");
foreach ($ds->loadHashList($request->makeSelect()) as $day => $num1) {
$days[$day]["admissions"] = $num1;
}
// Liste des admissions non préparées
$where["sejour.entree_preparee"] = " = '0'";
$request->addWhere($where);
foreach ($ds->loadHashList($request->makeSelect()) as $day => $num3) {
$days[$day]["admissions_non_preparee"] = $num3;
}
// Liste des admissions non effectuées par jour
unset($where['sejour.entree']);
unset($where['sejour.entree_preparee']);
$request->where = array();
$where["sejour.entree_prevue"] = " BETWEEN '{$month_min}' AND '{$nextmonth}'";
示例8: getSupplyMultiple
/**
* Get supply stats
*
* @param CProduct[] $products List of products
* @param string $since Date start offset
* @param string $date_max Max date
*
* @return array
*/
static function getSupplyMultiple($products, $since = "-1 MONTH", $date_max = null)
{
$ds = CSQLDataSource::get("std");
$where = array("product.product_id" => $ds->prepareIn(CMbArray::pluck($products, "_id")), "product_order_item_reception.date > '" . CMbDT::date($since) . "'");
if ($date_max) {
$where[] = "product_order_item_reception.date <= '" . CMbDT::date($date_max) . "'";
}
$ljoin = array("product_order_item" => "product_order_item.order_item_id = product_order_item_reception.order_item_id", "product_reference" => "product_reference.reference_id = product_order_item.reference_id", "product" => "product.product_id = product_reference.product_id");
$sql = new CRequest();
$sql->addTable("product_order_item_reception");
$sql->addSelect("product.product_id, SUM(product_order_item_reception.quantity) AS sum");
$sql->addLJoin($ljoin);
$sql->addGroup("product.product_id");
$sql->addWhere($where);
return $ds->loadHashList($sql->makeSelect());
}
示例9: getAllNumberPatient
/**
* Get all number patient by a state and the filter
*
* @param String $date_min Date minimum
* @param String $date_max Date maximum
*
* @return array
*/
static function getAllNumberPatient($date_min = null, $date_max = null)
{
$patients_count = array();
$leftjoin = null;
$where = array();
if ($date_min) {
$where["entree"] = ">= '{$date_min}'";
$leftjoin["sejour"] = "patients.patient_id = sejour.patient_id";
}
if ($date_max) {
$where["entree"] = "<= '{$date_max}'";
$leftjoin["sejour"] = "patients.patient_id = sejour.patient_id";
}
$ds = CSQLDataSource::get("std");
$request = new CRequest();
$request->addSelect("`status`, COUNT(DISTINCT(`patients`.`patient_id`)) as `total`");
$request->addTable("patients");
$request->addLJoin($leftjoin);
$request->addWhere($where);
$request->addGroup("`status`");
$result = $ds->loadList($request->makeSelect());
$state_count = array();
foreach ($result as $_result) {
$state_count[$_result["status"]] = $_result["total"];
}
foreach (self::$list_state as $_state) {
$patients_count[CMbString::lower($_state)] = CMbArray::get($state_count, $_state, 0);
if ($_state == "CACH") {
$where = array("vip" => "= '1'", "status" => "!= 'VALI'");
$patient = new CPatient();
$patients_count[CMbString::lower($_state)] = $patient->countList($where, null, $leftjoin);
}
if ($_state == "DPOT") {
$patient_link = new CPatientLink();
$patients_count[CMbString::lower($_state)] = $patient_link->countList($where, null, array("sejour" => "patient_link.patient_id1 = sejour.patient_id"));
}
}
return $patients_count;
}
示例10: CRequest
*
* @category dPurgences
* @package Mediboard
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
* @link http://www.mediboard.org
*/
$nb_month = CValue::get("month_maintenance", "1");
$date = CMbDT::dateTime("-" . $nb_month . "MONTH");
$crequest = new CRequest();
$crequest->addSelect(array("`sejour`.`sejour_id`", "`sejour`.`sortie`"));
$crequest->addTable("`sejour`");
$crequest->addLJoinClause("rpu", "`sejour`.`sejour_id` = `rpu`.`sejour_id`");
$crequest->addWhereClause("sejour.entree", "> '{$date}'");
$crequest->addGroup(array("`sejour_id`"));
$crequest->addHaving(array("COUNT(`sejour`.`sejour_id`)>1"));
$sejour = new CSejour();
$ds = $sejour->getDS();
$list_id_sejour = $ds->loadList($crequest->makeSelect());
usort($list_id_sejour, function ($a, $b) {
return -strnatcmp($a["sortie"], $b["sortie"]);
});
$list_sejour = array();
$patients = array();
$guesses = array();
foreach ($list_id_sejour as $_id_sejour) {
$sejour = new CSejour();
$sejour->load($_id_sejour["sejour_id"]);
$sejour->loadBackRefs("rpu");
$sejour->loadRefPatient();
示例11: CRequest
<?php
/**
* $Id$
*
* @category dPurgences
* @package Mediboard
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
* @link http://www.mediboard.org
*/
$request = new CRequest();
$request->addSelect("categorie");
$request->addTable("motif_sfmu");
$request->addGroup("categorie");
$query = $request->makeSelect();
$motif_sfmu = new CMotifSFMU();
$ds = $motif_sfmu->getDS();
$categories = $ds->loadList($query);
$smarty = new CSmartyDP();
$smarty->assign("categories", $categories);
$smarty->display("inc_search_motif_sfmu.tpl");
示例12: graphWorkflowOperation
/**
* Récuparation du graphique du nombre d'interventions annulées le jour même
*
* @param string $date_min Date de début
* @param string $date_max Date de fin
* @param int $prat_id Filtre du praticien
* @param int $salle_id Filtre de la salle
* @param int $bloc_id Filtre du bloc
* @param int $func_id Filtre sur un cabinet
* @param int $discipline_id Filtre sur une discipline
* @param string $code_ccam Code CCAM
* @param string $type_sejour Type de séjour
* @param bool $hors_plage Prise en charge des hors plage
*
* @return array
*/
function graphWorkflowOperation($date_min = null, $date_max = null, $prat_id = null, $salle_id = null, $bloc_id = null, $func_id = null, $discipline_id = null, $code_ccam = null, $type_sejour = null, $hors_plage = false)
{
$miner = new COperationWorkflow();
$miner->warnUsage();
if (!$date_min) {
$date_min = CMbDT::date("-1 YEAR");
}
if (!$date_max) {
$date_max = CMbDT::date();
}
$date_min = CMbDT::format($date_min, "%Y-%m-01");
$date_max = CMbDT::transform("+1 MONTH", $date_max, "%Y-%m-01");
// Series declarations
$labels = array("op_count" => utf8_encode("Nombre d'interventions"), "creation" => utf8_encode("Planification intervention"), "consult_chir" => utf8_encode("Consultation chirurgicale"), "consult_anesth" => utf8_encode("Consultation anesthésiste"), "visite_anesth" => utf8_encode("Visite anesthésiste"), "creation_consult_chir" => utf8_encode("RDV de consultation chirurgicale"), "creation_consult_anesth" => utf8_encode("RDV de consultation anesthésiste"));
$salles = CSalle::getSallesStats($salle_id, $bloc_id);
$query = new CRequest();
$query->addColumn("DATE_FORMAT(date_operation, '%Y-%m')", "mois");
$query->addColumn("COUNT(operations.operation_id)", "op_count");
// Prévention des données négatives aberrantes
$tolerance_in_days = 0;
$columns = array("creation", "consult_chir", "consult_anesth", "visite_anesth", "creation_consult_chir", "creation_consult_anesth");
foreach ($columns as $_column) {
$field = "date_{$_column}";
$diff = "DATEDIFF(ow.date_operation, ow.{$field})";
$query->addColumn("AVG (IF({$diff} > {$tolerance_in_days}, {$diff}, NULL))", $_column);
$query->addColumn("COUNT(IF({$diff} > {$tolerance_in_days}, {$diff}, NULL))", "count_{$_column}");
}
$query->addTable("operations");
$query->addLJoin("operation_workflow AS ow ON ow.operation_id = operations.operation_id");
$query->addWhereClause("date_operation", "BETWEEN '{$date_min}' AND '{$date_max}'");
$query->addWhereClause("salle_id", CSQLDataSource::prepareIn(array_keys($salles)));
$query->addGroup("mois");
$query->addOrder("mois");
$subtitle = "";
// Filtre sur hors plage
if (!$hors_plage) {
$query->addWhereClause("plageop_id", "IS NOT NULL");
$subtitle .= " - sans hors plage";
}
// Filtre sur le salle (pas besoin de clause supplémentaire)
if ($salle_id) {
$salle = reset($salles);
$subtitle .= " - {$salle->_view}";
}
// Filtre sur le praticien
if ($prat_id) {
$query->addWhereClause("operations.chir_id", "= '{$prat_id}'");
$prat = new CMediusers();
$prat->load($prat_id);
$subtitle .= " - Dr {$prat->_view}";
}
// Filtre sur le cabinet
if ($func_id) {
$query->addLJoinClause("users_mediboard", "operations.chir_id = users_mediboard.user_id");
$query->addWhereClause("users_mediboard.function_id", "= '{$func_id}'");
$func = new CFunctions();
$func->load($func_id);
$subtitle .= " - {$func->_view}";
}
// Filtre sur la discipline
if ($discipline_id) {
$discipline = new CDiscipline();
$discipline->load($discipline_id);
$query->addLJoinClause("users_mediboard", "operations.chir_id = users_mediboard.user_id");
$query->addWhereClause("users_mediboard.discipline_id", "= '{$discipline_id}'");
$subtitle .= " - {$discipline->_view}";
}
// Filtre sur les codes CCAM
if ($code_ccam) {
$query->addWhereClause("operations.codes_ccam", "LIKE '%{$code_ccam}%'");
$subtitle .= " - CCAM: {$code_ccam}";
}
// Filtre sur le type d'hospitalisation
if ($type_sejour) {
$query->addLJoinClause("sejour", "sejour.sejour_id = operations.sejour_id");
$query->addWhereClause("sejour.type", "= '{$type_sejour}'");
$subtitle .= " - " . CAppUI::tr("CSejour.type.{$type_sejour}");
}
// Query result
$ds = CSQLDataSource::get("std");
$all_values = $ds->loadHashAssoc($query->makeSelect());
// Build horizontal ticks
$months = array();
$ticks = array();
//.........这里部分代码省略.........
示例13: array
}
$patient->loadRefPhotoIdentite();
$where = array("patient_id" => " = '{$patient->_id}'");
// Construction d'une constante médicale
$constantes->patient_id = $patient->_id;
$constantes->loadRefPatient();
// Les constantes qui correspondent (dans le contexte ou non)
$where_context = $where;
$where_context["context_class"] = "IS NOT NULL";
$where_context["context_id"] = "IS NOT NULL";
$query = new CRequest();
$query->addTable($constantes->_spec->table);
$query->addColumn("context_class");
$query->addColumn("context_id");
$query->addWhere($where_context);
$query->addGroup(array("context_class", "context_id"));
$query = $query->makeSelect();
$list = $constantes->_spec->ds->loadList($query);
$list_contexts = array();
foreach ($list as $_context) {
/** @var CMbObject $c */
$c = new $_context["context_class"]();
$c = $c->getCached($_context["context_id"]);
// Cas d'un RPU
if ($c instanceof CConsultation && $c->sejour_id) {
$c->loadRefSejour();
if ($c->_ref_sejour->type == 'urg') {
continue;
}
}
$c->loadRefsFwd();
示例14: CRequest
* $Id$
*
* @package Mediboard
* @subpackage PlanningOp
* @author SARL OpenXtrem <dev@openxtrem.com>
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version $Revision$
*/
CCanDo::checkAdmin();
// Tous les libelllés
$query = new CRequest();
$query->addTable("sejour");
$query->addColumn("COUNT(libelle)", "libelle_count");
$query->addColumn("libelle");
$query->addWhereClause("type", "= 'ssr'");
$query->addOrder("libelle_count DESC");
$query->addGroup("libelle");
$sejour = new CSejour();
$ds = $sejour->_spec->ds;
$libelle_counts = array();
foreach ($ds->loadList($query->makeSelect()) as $row) {
$libelle_counts[$row["libelle"]] = $row["libelle_count"];
}
unset($libelle_counts[""]);
// Libellés disponibles
$colors = CColorLibelleSejour::loadAllFor(array_keys($libelle_counts));
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("libelle_counts", $libelle_counts);
$smarty->assign("colors", $colors);
$smarty->display("vw_idx_colors.tpl");
示例15: CPlageOp
* @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
* @version SVN: $Id:$
* @link http://www.mediboard.org
*/
CCanDo::checkAdmin();
$merge = CView::get("merge", "bool default|0");
$auto = CView::get("auto", "bool default|0");
$max = CView::get("max", "num default|10");
CView::checkin();
$group = CGroups::loadCurrent();
$plage = new CPlageOp();
$query = new CRequest();
$query->addColumn("GROUP_CONCAT( plageop_id SEPARATOR '-')", "plage_ids");
$query->addColumn("COUNT( plageop_id )", "plage_count");
$query->addColumn("date");
$query->addGroup("date");
$query->addColumn("debut");
$query->addGroup("debut");
$query->addColumn("fin");
$query->addGroup("fin");
$query->addColumn("chir_id");
$query->addGroup("chir_id");
$query->addColumn("spec_id");
$query->addGroup("spec_id");
$query->addColumn("plagesop.salle_id");
$query->addGroup("plagesop.salle_id");
$query->addLJoinClause("sallesbloc", "sallesbloc.salle_id = plagesop.salle_id");
$query->addLJoinClause("bloc_operatoire", "bloc_operatoire.bloc_operatoire_id = sallesbloc.bloc_id");
$query->addWhereClause("bloc_operatoire.group_id", "= '{$group->_id}'");
$query->addOrder("plagesop.date");
$query->addHaving("plage_count > 1");