当前位置: 首页>>代码示例>>PHP>>正文


PHP CRequest::addHaving方法代码示例

本文整理汇总了PHP中CRequest::addHaving方法的典型用法代码示例。如果您正苦于以下问题:PHP CRequest::addHaving方法的具体用法?PHP CRequest::addHaving怎么用?PHP CRequest::addHaving使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRequest的用法示例。


在下文中一共展示了CRequest::addHaving方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: max

    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);
    $count = 0;
    foreach ($ids as $_id) {
        if ($dry_run) {
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:do_cleanup_correspondant_patient.php

示例2: 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();
    $sejour->loadNDA();
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:ajax_doublon_rpu.php

示例3: count

$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");
$ds = $plage->_spec->ds;
$duplicates = $ds->loadColumn($query->makeSelect($plage));
$count = count($duplicates);
$success_count = 0;
$failures = array();
$i = $max;
if ($merge) {
    foreach ($duplicates as $_plage_ids) {
        if (!$i--) {
            break;
        }
        $plage_ids = explode("-", $_plage_ids);
        $plages = $plage->loadAll($plage_ids);
        /** @var CPlageOp $first */
        $first = array_shift($plages);
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:merge_duplicate_plagesop.php

示例4: CSejour

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;
        }
        $consultations = $sejour_reliquat->loadRefsConsultations();
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:facturer_codable.php


注:本文中的CRequest::addHaving方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。