直接上代码 单独模糊查询某一个
if (!empty($param['nameA'])) {
$where['patientName'] = ['like', '%'.trim($param['nameA']).'%'];
}
整体的代码
$param = Request::instance()->param();
$start = ($param['page'] - 1 ) * $param['limit'];
$limit = $param['limit'];
$where['isDel'] = 0;
if (!empty($param['nameA'])) {
$where['patientName'] = ['like', '%'.trim($param['nameA']).'%'];
}
if (!empty($param['nameB'])) {
$where['doctor'] = ['like', '%'.trim($param['nameB']).'%'];
}
if (!empty($param['phone'])) {
$where['patientPhone'] = $param['phone'];
}
if (!empty($param['hospital']) && $param['hospital'] != 999) {
$where['hospitalId'] = $param['hospital'];
}
$res2 = Db::table("888_submitlist")->where($where)->order(['lid' => 'desc'])->limit($start , $limit)->select();
foreach ($res2 as $key => &$val){
$val['time'] = date("Y-m-d H:i:s" , $val['time']);
}
unset($val);
$count = Db::table("888_submitlist")->where($where)->count();
return array( 'code' => 0, 'msg' => '', 'count' => $count, 'data' => $res2 );
|