/** * 打印预约单 * * @param Request $request * @param Registration $registration */ public function printInfo(Request $request, Registration $registration) { $user = $request->user(); if ($user->id != $registration->user_id) { return response()->json(['status' => 1, 'message' => '无权限']); } if ($registration->is_paid == 1) { if ($registration->deals()->count() != 1) { return response()->json(['status' => 4, 'message' => '数据异常']); } $schedule = Schedule::find($registration->schedule_id); $doctor = Doctor::find($schedule->doctor_id); $department = Department::find($doctor->department_id); $hospital = Hospital::find($department->hospital_id); $data = array('user_name' => $user->name, 'sex' => $user->sex, 'age' => $user->age, 'doctor' => $doctor->doctor_name, 'doctor_time' => $schedule->doctoring_time, 'doctor_data' => $schedule->doctoring_data, 'department' => $department->department_nam, 'hospital' => $hospital->hospital_name, 'fee' => $registration->fee, 'registration_time' => $registration->created_at); return $data; } else { return response()->json(['status' => 8, 'message' => '未付款,不能打印']); } }