Ejemplo n.º 1
0
 public function search(Request $request)
 {
     $rfc = $request->rfc;
     $tipo = $request->tipo_id;
     $today = Carbon::today();
     $today = $today->year . '-' . $today->month . '-' . $today->day;
     $paciente = Paciente::where('rfc', '=', $rfc)->where('tipo_id', '=', $tipo)->first();
     $tipo = Tipo::find($tipo);
     if (isset($paciente)) {
         if ($paciente->count() > 1) {
             $citas = Cita::orderBy('fecha', 'desc')->where('paciente_id', '=', $paciente->id)->take(5)->get();
             $citas->each(function ($citas) {
                 $citas->paciente->tipo;
                 $citas->medico->especialidad;
                 $citas->fecha = fecha_dmy($citas->fecha);
             });
             if ($citas->count() >= 1) {
                 return Response::json($citas, 200);
             } else {
                 $response = array('error' => 'true');
                 return Response::json('No se encontro citas con paciente RFC: ' . $rfc . ' - ' . $tipo->code, 500);
             }
         }
     } else {
         $response = array('error' => 'true');
         return Response::json('No se encontro Paciente con RFC: ' . $rfc . ' - ' . $tipo->code, 500);
     }
 }
Ejemplo n.º 2
0
 public function index()
 {
     if (isset($_GET["date"])) {
         $date = $_GET["date"];
     } else {
         $date = Carbon::today();
         $date = $date->year . '-' . $date->month . '-' . $date->day;
     }
     $today = Carbon::today();
     $today = $today->year . '-' . $today->month . '-' . $today->day;
     $medico = Medico::find(\Auth::guard('doctors')->user()->doctor_id);
     $permiso = Permiso::where('medico_id', '=', $medico->id)->where('fecha_inicio', '>=', $today)->first();
     $citas = Cita::orderBy('id', 'ASC')->where('medico_id', '=', $medico->id)->where('fecha', '=', $date)->get();
     $citas->each(function ($citas) {
         $citas->paciente;
     });
     $citas = $citas->sortBy('horario');
     $todas_citas = Cita::getTotalCitas($medico->id, $date);
     $todaysrttotime = strtotime($today);
     $date2 = strtotime($date);
     $f_anterior = $date2 < $todaysrttotime ? 1 : 0;
     return view('admin.hojas.index')->with('medico', $medico)->with('citas', $citas)->with('date', $date)->with('date2', $date2)->with('todas_citas', $todas_citas)->with('permiso', $permiso)->with('f_anterior', $f_anterior);
 }
Ejemplo n.º 3
0
 public function getfecha()
 {
     $citas = Cita::orderBy('fecha', 'ASC')->where('fecha', '>', '2016-12-31')->get();
     $citas->each(function ($citas) {
         $citas->codigo;
         $citas->medico->especialidad;
         $citas->paciente->tipo;
     });
     return view('test.index')->with('citas', $citas);
 }