schedule_logic = new ScheduleLogic(); } /** * 获取科室列表 * @param Request $request * @return JsonResponse * @throws GeneralException */ public function dept(Request $request): JsonResponse { $validated = $request->validate([ 'date' => 'required|date_format:Y-m-d', ],[ 'date.required' => '请传入日期', 'date.date_format' => '日期格式错误', ]); $response = $this->schedule_logic->getDeptLists($validated['date']); return jsonResponse(Response::HTTP_OK, 'success', DeptListsResource::make($response)->toArray()); } /** * 获取医生排班列表 * @param Request $request * @return JsonResponse * @throws GeneralException */ public function doctor(Request $request): JsonResponse { $validated = $request->validate([ 'date' => 'required|date_format:Y-m-d', 'dept_id' => 'required|numeric' ], [ 'date.required' => '请传入日期', 'date.date_format' => '日期格式错误', 'dept_id.required' => '请传入科室ID', 'dept_id.numeric' => '科室ID格式错误', ]); $response = $this->schedule_logic->getDoctorLists($validated['date'], $validated['dept_id']); return jsonResponse(Response::HTTP_OK, 'success', DoctorListsResource::make($response)->toArray()); } }