/** * 获取疾病条数 * @param type $diseaseQuery * @return type */ public function getCounts($param) { $where = ''; $bound = []; foreach ($param as $k => $v) { if (!empty($v)) { $where .= ' and ' . $k . ' = :' . $k; $bound[':' . $k] = $v; } } $where = substr($where, 5); $where = !empty($where) ? $where : ''; return Department::find()->where($where, $bound)->count('id'); }