/**
  * Display the specified resource.
  *
  * @param  int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $doctor = Doctor::find($id);
     if (empty($doctor)) {
         return response()->json(['status' => 4, 'message' => '数据异常']);
     }
     return $doctor;
 }
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $doctor = \App\Doctor::find($this->route()->getParameter('doctor'));
     switch ($this->method()) {
         case 'GET':
         case 'DELETE':
             return [];
         case 'POST':
             return [];
         case 'PUT':
         case 'PATCH':
             return ['registration_number' => 'required|min:3', 'registration_year' => 'required', 'photo' => 'image', 'name' => 'required|min:5', 'email' => 'required|email|unique:users,email,' . $doctor->user_id, 'gender' => 'required', 'mobile' => 'required', 'address' => 'required|min:5'];
         default:
             break;
     }
 }
示例#3
0
 public function experience($id)
 {
     $doctor = \App\Doctor::find($id);
     return view('frontend.pages.clinic.doctor.experience', compact('doctor'));
 }
 public function show($id)
 {
     $data['content'] = \App\Doctor::find($id);
     return view('frontend.pages.clinic.show', compact('data'));
 }
示例#5
0
 public function getDoctorsInfoList(Request $request)
 {
     if (Auth::check()) {
         /*
          * Добавление врача в БД
          */
         if ($request->has("add_doctor")) {
             $newDoc = new Doctor();
             $newDoc->name = $request->input("new_doctor_name");
             $newDoc->spec_id = $request->input("new_spec_id");
             $newDoc->save();
         }
         /*
          * Удаление врача из БД
          */
         if ($request->has("del_doctor")) {
             $delDoc = Doctor::find($request->input("del_doctor_id"));
             $delDoc->delete();
         }
         /*
          * Добавление специализации в БД
          */
         if ($request->has("add_spec")) {
             $newSpec = new Specialization();
             $newSpec->name = $request->input("new_spec_name");
             //echo "true";
             //exit;
             $newSpec->save();
         }
         /*
          * Удаление специализации из БД
          */
         if ($request->has("del_spec")) {
             /*echo "id";
               echo $request->input("spec_list");
               exit;*/
             $delSpec = Specialization::find($request->input("spec_list"));
             $delSpec->delete();
         }
         //$doctors = Doctor::paginate(15);
         $doctors = Doctor::paginate(15);
         $spec = Specialization::all();
         $user = Auth::user();
         $data["user_id"] = $user->id;
         $data["user_fullname"] = $user->fullname;
         /* foreach ($doctors as $doc){
                print_r($doc->spec);
            }*/
         //print_r($doctors);
         //exit;
         return view("doctors-list", ["doctors" => $doctors, "spec" => $spec, "data" => $data]);
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $doctor = Doctor::find($id);
     $doctor->update($request->all());
     return redirect('doctors/' . $doctor->id);
 }
 /**
  * 打印预约单
  *
  * @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' => '未付款,不能打印']);
     }
 }
示例#8
0
 /**
  * Creates account and generates random password for a Formal Physician
  *
  * @return previous view
  */
 public function createDoctorCredentials()
 {
     $doctorID = Request::get('doctors');
     //$password = Str::random(10);
     $password = '******';
     $doctorInfo = Doctor::find($doctorID);
     Doctor::where('id', $doctorID)->update(['has_account' => 1]);
     $newUser = new User();
     $newUser->email = $doctorInfo->email;
     $newUser->name = $doctorInfo->first_name . ' ' . $doctorInfo->last_name;
     $newUser->password = md5($password);
     $newUser->tp = $doctorInfo->phone;
     $newUser->level = 2;
     $newUser->active = 1;
     $newUser->verified = 1;
     $newUser->save();
     Mail::send('mailtemplate/doctorPassword', ['name' => $newUser->name, 'password' => $password], function ($m) use($newUser) {
         $m->from('*****@*****.**', 'Daemon');
         $m->to($newUser->email, $newUser->name)->subject('Wedaduru Doctor Account');
     });
     return redirect()->back();
 }
 public function experience($id)
 {
     $doctor = \App\Doctor::find($id);
     return view('pages.admin.doctor.experience', compact('doctor'));
 }