Пример #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postStore(Request $request)
 {
     $record = new Record();
     $id = $request->input("patientID");
     $record->pt_id = $id;
     $record->diagnosis = $request->input("diagnosis");
     $record->treatment = $request->input("treatment");
     $presName = "";
     $presQty = "";
     $val = $request->input("xy");
     for ($count = 1; $count < $val + 1; $count++) {
         $presName .= $request->input("drug_" . $count);
         $presQty .= $request->input("drug_" . $count . "_qtt");
         $presName .= "#";
         $presQty .= "#";
     }
     $record->pres_med = $presName;
     $record->dispenseQuantity = $presQty;
     $record->save();
     $state = Queue::find($id);
     //retrieve whole row
     if (!is_null($state)) {
         $state->status = 'Payment';
         $state->save();
     }
     $todispense = new Dispensary();
     $todispense->case_ref = $record->id;
     $todispense->dispensed_drug_code = "{$presName}";
     $todispense->dispensed_quantity = "{$presQty}";
     $todispense->save();
     //other fields in this table is to be filled by nurse using DispensaryController
     return redirect()->action('DocController@index');
 }
Пример #2
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('auth/login');
         }
     } else {
         if ($this->auth->user()->doctor) {
             $queue = Queue::all();
             $patient = Patient::all();
             return view('doctor.dashboard')->with('queue', $queue)->with('patient', $patient);
         } else {
             if ($this->auth->user()->admin) {
                 $queue = Queue::all();
                 $patient = Patient::all();
                 return view('doctor.dashboard')->with('queue', $queue)->with('patient', $patient);
             } else {
                 $queue = Queue::all();
                 $patient = Patient::all();
                 return view('staff.dashboard')->with('queue', $queue)->with('patient', $patient);
             }
         }
     }
     return $next($request);
 }
Пример #3
0
 public function removeQueue(Request $request)
 {
     $queue = Queue::all();
     $patient = Patient::all();
     //insert delete from queue
     $queue = Queue::find($request->input('pt_id'));
     //$queue->delete();
     return redirect()->action('StaffController@index')->with('queue', $queue)->with('patient', $patient);
     //return view('staff.dashboard');
 }
Пример #4
0
 public function show($id)
 {
     $data = Queue::find($id);
     $data->status = 'Consulting';
     $data->save();
     $ic = $data->pt_ic;
     $data2 = Patient::where('pt_ic', $ic)->first();
     //$data3 = Record::where('pt_id', $data2);
     $inventory = Inventory::all();
     return view('doctor.newcase')->with('data', $data)->with('data2', $data2)->with('inventory', $inventory);
     //->with('history',$data3);
 }
Пример #5
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function getDay(Request $request)
 {
     $date = $request->input('date');
     $queueModel = new Queue();
     $queue = $queueModel->where('date', '=', $date)->get();
     $counts['all'] = $queue->count();
     $counts['real_queue'] = $queueModel->where('date', '=', $date)->where('is_real_queue', '=', 1)->get()->count();
     $counts['online_queue'] = $queueModel->where('date', '=', $date)->where('is_real_queue', '=', 0)->get()->count();
     $cur_settings = Current_setting::where('day_date', '=', $date)->get();
     $cur_settings->sortBy('period_start_time');
     $periods = array();
     foreach ($cur_settings as $c) {
         $check = Queue::where('start_time', '=', $c['period_start_time'])->where('date', '=', $c['day_date'])->get();
         $period['period_start_time'] = $c['period_start_time'];
         $period['period_end_time'] = $c['period_end_time'];
         $period['queue'] = $check;
         $period['count'] = $check->count();
         array_push($periods, $period);
     }
     $data['periods'] = $periods;
     $data['counts'] = $counts;
     return Response::json($data);
 }
Пример #6
0
 /**
  * отримання списку періодів і стану черги на день
  * @param Queue $queueModel
  * @param Current_setting $cur_setting
  * @param Request $request
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function getDay(Queue $queueModel, Current_setting $cur_setting, Request $request)
 {
     //todo Зробити функціонал для оновлення інформації про чергу відносно дня.
     $queueModel = new Queue();
     $today = $request->input('date');
     $res['cur_settings'] = Current_setting::where('day_date', '=', $today)->get();
     $res['res_array'] = array();
     foreach ($res['cur_settings'] as $c) {
         $check = Queue::where('start_time', '=', $c['period_start_time'])->where('date', '=', $c['day_date'])->get();
         if ($check->count() < 4) {
             array_push($res['res_array'], 1);
         } else {
             array_push($res['res_array'], 0);
         }
     }
     return Response::json($res);
 }
Пример #7
0
 public function addToQueue(Request $request)
 {
     $queue = new Queue();
     $queue->pt_ic = $request->input('pt_id');
     $data = Patient::where('pt_ic', $request->input('pt_id'))->first();
     $queue->name = $data->pt_name;
     $queue->status = 'Waiting';
     $queue->save();
     Alert::success('Added to queue!')->autoclose(2000);
     return redirect()->action('StaffController@index');
 }
Пример #8
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, Queue $queueModel)
 {
     $data = $request->all();
     $id = $data['id'];
     $queue = Queue::find($id);
     $queue->is_present = true;
     $queue->save();
     dd($queue);
 }