['doctor_id', 'period', 'status'], ]; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function lists(): array { $where = $this->searchWhere; // 处理日期范围搜索 if (!empty($this->params['start_date']) && !empty($this->params['end_date'])) { $where[] = ['date', 'between', [$this->params['start_date'], $this->params['end_date']]]; } $lists = Roster::where($where) ->field(['id', 'doctor_id', 'date', 'period', 'status', 'quota', 'max_patients', 'booked_count', 'remark', 'create_time', 'update_time']) ->order(['date' => 'asc', 'period' => 'asc']) ->limit($this->limitOffset, $this->limitLength) ->select() ->toArray(); return $lists; } /** * @notes 获取数量 * @return int */ public function count(): int { $where = $this->searchWhere; // 处理日期范围搜索 if (!empty($this->params['start_date']) && !empty($this->params['end_date'])) { $where[] = ['date', 'between', [$this->params['start_date'], $this->params['end_date']]]; } return Roster::where($where)->count(); } }