public function view_profile($doc_name, $doc_id) { try { $doctor = Doctors::find($doc_id); $img = Images::where('user_id', $doctor->user_id)->first(); $main_doc_ob['image_data'] = $img; $main_doc_ob['doctor_data'] = $doctor; if ($doctor->doc_type == "FORMAL") { $main_doc_ob['doc_type'] = "FORMAL"; $formal = Formal_doctors::where('doctor_id', $doctor->id)->first(); $main_doc_ob['formal_data'] = $formal; } else { $main_doc_ob['doc_type'] = "NON_FORMAL"; $non_formal = Non_Formal_doctors::where('doctor_id', $doctor->id)->first(); $main_doc_ob['non_formal_data'] = $non_formal; } $spec = Specialization::where('doc_id', $doctor->id)->first(); $treat = Treatments::where('doc_id', $doctor->id)->first(); $main_doc_ob['spec_data'] = $spec; $main_doc_ob['treat_data'] = $treat; } catch (Exception $e) { $this->LogError('View Doctor Profile', $e); } /* Run Recently Viewed Profiles */ self::RecentlyViewedProfiles($doc_id); /* Add new hit to Profile View hit counter */ self::ProfileViewHitCounter($doc_id); return View::make('profile', array('doctor' => $main_doc_ob)); }
public function graph1Count() { try { //get the count af users accordig to registered dates $graph1 = DB::select(DB::raw('SELECT DATE(reg_date) AS y,COUNT(*) AS item1 FROM patients GROUP BY DATE(reg_date)')); //get the count af doctors accordig to registered dates $graph2 = DB::select(DB::raw('SELECT DATE(reg_date) AS y,COUNT(*) AS item1 FROM doctors GROUP BY DATE(reg_date)')); //get the count af doctors accordig to registered dates and doctor types $graph3 = DB::select(DB::raw('SELECT DATE(reg_date) AS y ,SUM(CASE WHEN doc_type = "FORMAL" THEN 1 ELSE 0 END) AS item1, SUM(CASE WHEN doc_type = "NON_FORMAL" THEN 1 ELSE 0 END) AS item2 FROM doctors GROUP BY DATE(reg_date)')); //get all user count $Patients = Patients::all(); //Get formal doctor count $Formal_doctors = Formal_doctors::all(); //Get non formal doctor count $Non_Formal_doctors = Non_Formal_doctors::all(); //get the number of results in each quary result $graph41 = sizeof($Patients); $graph42 = sizeof($Formal_doctors); $graph43 = sizeof($Non_Formal_doctors); //pass the values through json $res['graph_1'] = $graph1; $res['graph_2'] = $graph2; $res['graph_3'] = $graph3; $res['graph_41'] = $graph41; $res['graph_42'] = $graph42; $res['graph_43'] = $graph43; } catch (Exception $e) { $this->LogError('AdminController Register_Page Function', $e); } return response()->json($res); }