public function isADoctor($idUSer) { $array = array(); $array['isLogin'] = false; if (Auth::check()) { $array['isDoctor'] = ""; $array['isLogin'] = true; $array['issetUser'] = ""; $array['role'] = ""; $array['datos'] = ""; $doctor = doctorModel::where('idtbluser', '=', $idUSer)->get(); if (count($doctor) > 0) { $array['isDoctor'] = true; $array['issetUser'] = true; $array['role'] = 'doctor'; $array['datos'] = $doctor; } else { $paciente = pacienteModel::where('idtblusers', '=', $idUSer)->get(); if (count($paciente) > 0) { $array['isDoctor'] = false; $array['issetUser'] = true; $array['role'] = 'paciente'; $array['datos'] = $paciente; } else { if ($admin = $this->isAdmin($idUSer)) { $array['isDoctor'] = false; $array['issetUser'] = true; $array['role'] = 'admin'; $array['datos'] = $admin; } else { if ($distributor = $this->isADistributor($idUSer)) { $array['isDoctor'] = false; $array['issetUser'] = true; $array['role'] = 'distributor'; $array['datos'] = $distributor; } else { $array['isDoctor'] = false; $array['issetUser'] = false; $array['role'] = false; $array['datos'] = false; } } } } // echo '<pre>';print_r($array);exit; return $array; } else { return $array; } }
public function isDoctor() { if (Auth::check()) { if ($this->datos['issetUser']) { if ($this->datos['isDoctor']) { $doctor = doctorModel::where('idtbluser', Auth::user()->id)->get(); $idUsuario = $doctor[0]['idtblDr']; $usuario = $doctor[0]['tblDoctorName'] . ' ' . $doctor[0]['tblDoctorPaterno']; $array['isDoctor'] = true; $array['datos'] = $doctor; $array['usuario'] = ['id_usuario' => $idUsuario, 'usuario' => $usuario]; $array['menu'] = 'template.header-doctor'; $array['sub-menu'] = 'template.sub-header-doctor'; $array['home'] = 'home-doctor'; return $array; } else { if ($this->datos['role'] == "paciente") { $paciente = pacienteModel::where('idtblusers', Auth::user()->id)->get(); $idUsuario = $paciente[0]['idtblpaciente']; $usuario = $paciente[0]['tblpacientename'] . ' ' . $paciente[0]['tblpacientepaterno']; $array['isDoctor'] = false; $array['datos'] = $paciente; $array['usuario'] = ['id_usuario' => $idUsuario, 'usuario' => $usuario]; $array['menu'] = 'template.header-paciente'; $array['sub-menu'] = 'template.sub-header-paciente'; $array['home'] = 'home-paciente'; return $array; } else { if ($this->datos['role'] == "admin") { $admin = User::where('id', Auth::user()->id)->get(); $idUsuario = $admin[0]['idtblpaciente']; $usuario = $admin[0]['name']; $array['isDoctor'] = false; $array['datos'] = $admin; $array['usuario'] = ['id_usuario' => $idUsuario, 'usuario' => $usuario]; $array['menu'] = 'template.header-admin'; $array['sub-menu'] = 'template.sub-header-paciente'; $array['home'] = 'home-admin'; return $array; } else { if ($this->datos['role'] == "distributor") { $admin = User::where('id', Auth::user()->id)->get(); $idUsuario = $admin[0]['idtblpaciente']; $usuario = $admin[0]['name']; $array['isDoctor'] = false; $array['datos'] = $admin; $array['usuario'] = ['id_usuario' => $idUsuario, 'usuario' => $usuario]; $array['menu'] = 'template.header-distributor'; $array['sub-menu'] = 'template.sub-header-paciente'; $array['home'] = 'home-distributor'; return $array; } else { //TODO si el usuario no existe } } } } } else { //TODO si el usuario no existe } } else { return redirect()->route('login'); } }
public function validarEmail(Request $request) { $doctor = new doctorModel(); $result = $doctor->validarEmail($request); echo $result; }
public function obtenerHospital($idHospital) { $doctorM = new doctorModel(); $servicioM = new servicioModel(); $hospital = $this->find($idHospital); $hospital->srcImage = $this->isImageHere($hospital); $hospital->services = $this->servicioByHospital($idHospital); // $hospital->doctors = json_decode($doctorM->directorioMedico($idHospital),2);//TODO $hospital->doctors = json_decode($doctorM->listarDoctoresLimit(50, 0, $hospital->catSiglas), 2); //TODO $request = (object) []; //declaro un objeto vacio $request->rows = 50; $request->limit = 0; $request->hospital = $idHospital; $hospital->servicios = json_decode($servicioM->listarServiciosLimit($request), 2); // echo '<pre>';print_r($hospital->servicios['disabled']);exit; $hospital->products = $this->productoByHospital($idHospital); $hospital->especialidades = $this->especialidadByHospital($idHospital); return $hospital; }