Ejemplo n.º 1
0
 public function editInfo(Request $request)
 {
     $hid = $request->get('id');
     $hosp = Hospital::find($hid);
     if (is_null($hosp)) {
         return "Hospital id not found";
     }
     $n_name = $request->get('hospital_name');
     $n_city = $request->get('city');
     $n_image = $request->get('image');
     $n_hlevel = $request->get('hospital_level');
     $n_ownership = $request->get('ownership');
     $n_desc = $request->get('description');
     if (!is_null($n_name)) {
         $hosp->hospital_name = $n_name;
     }
     if (!is_null($n_city)) {
         $hosp->city = $n_city;
     }
     if (!is_null($n_image)) {
         $hosp->image = $n_image;
     }
     if (!is_null($n_hlevel)) {
         $hosp->ownership = $n_ownership;
     }
     if (!is_null($n_desc)) {
         $hosp->description = $n_desc;
     }
     $success = $hosp->save();
     return $success ? "true" : "false";
 }
 /**
  * 打印预约单
  *
  * @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' => '未付款,不能打印']);
     }
 }