goCheck('availableSlots'); $result = AppointmentLogic::getAvailableSlots($params); return $this->data($result); } /** * @notes 创建预约 * @return \think\response\Json */ public function create() { $params = (new AppointmentValidate())->post()->goCheck('create'); $params['assistant_id'] = $this->adminId; $result = AppointmentLogic::create($params, $this->adminId, $this->adminInfo); if ($result === false) { return $this->fail(AppointmentLogic::getError()); } return $this->success('预约成功', $result); } /** * @notes 取消预约 * @return \think\response\Json */ public function cancel() { $params = (new AppointmentValidate())->post()->goCheck('cancel'); $result = AppointmentLogic::cancel($params, $this->adminId, $this->adminInfo); if ($result === false) { return $this->fail(AppointmentLogic::getError()); } return $this->success('取消成功'); } /** * @notes 预约列表 * @return \think\response\Json */ public function lists() { return $this->dataLists(new AppointmentLists()); } /** * @notes 预约详情 * @return \think\response\Json */ public function detail() { $params = (new AppointmentValidate())->goCheck('detail'); $result = AppointmentLogic::detail($params); return $this->data($result); } /** * @notes 获取医生可用号源数 * @return \think\response\Json */ public function doctorAvailability() { $doctorId = $this->request->get('doctor_id'); $date = $this->request->get('date'); if (!$doctorId || !$date) { return $this->fail('参数错误'); } $availableCount = AppointmentLogic::getDoctorAvailability($doctorId, $date); return $this->data(['available_count' => $availableCount]); } /** * @notes 完成预约 * @return \think\response\Json */ public function complete() { $params = (new AppointmentValidate())->post()->goCheck('complete'); $result = AppointmentLogic::complete($params); if ($result === false) { return $this->fail(AppointmentLogic::getError()); } return $this->success('操作成功'); } }