inspect_logic = new InspectLogic(); } /** * 获取报告提示 * @return JsonResponse */ public function tips() { if (Redis::exists('report.tips')) { $tips_lists = Redis::get('report.tips'); $tips_lists = json_decode($tips_lists, true); } else { $tips_lists = DB::connection('mysql_admin')->table('department_tips') ->select(DB::raw('ABS(dept_id) as type_id'), 'title', 'message') ->whereIn('dept_id', [-2, -3]) ->where('is_enable', 1) ->get() ->toArray(); Redis::setex('report.tips', 4 * 3600, json_encode($tips_lists, JSON_UNESCAPED_UNICODE)); } return jsonResponse(Response::HTTP_OK, 'success', $tips_lists); } /** * 获取检查报告列表 * @param Request $request * @param string $patient_id * @return JsonResponse * @throws GeneralException */ public function lists(Request $request, string $patient_id): JsonResponse { $validated = $request->validate([ 'start_date' => 'required|date_format:Y-m-d', 'end_date' => 'required|date_format:Y-m-d|after:start_date', ], [ 'start_date.required' => '请选择查询开始日期', 'end_date.required' => '请选择查询结束日期', 'start_date.date_format' => '日期格式错误', 'end_date.date_format' => '日期格式错误', 'end_date.after' => '查询日期错误', ]); // 日期必须在3个月之内 $response = $this->inspect_logic->lists($patient_id, $validated['start_date'], $validated['end_date']); return jsonResponse(Response::HTTP_OK, 'success', ListsResource::make($response)->toArray()); } /** * 获取缴费记录详情 * @param Request $request * @param string $patient_id * @param string $serial_no * @return JsonResponse * @throws GeneralException */ public function details(Request $request, string $patient_id, string $serial_no): JsonResponse { $response = $this->inspect_logic->details($patient_id, $serial_no); return jsonResponse(Response::HTTP_OK, 'success.', DetailsResource::make($response)->toArray()); } }