/**
  * Display a listing of diagonosticprocedures
  *
  * @return Response
  */
 public function index()
 {
     $patient_id = Input::get('id');
     $patient = Patient::find($patient_id);
     $appointments = $patient->appointments()->has('diagonosticprocedure')->get();
     return View::make('diagonosticprocedures.index', compact('appointments'));
 }
 /**
  * Display a listing of checkupfees
  *
  * @return Response
  */
 public function index()
 {
     $patient_id = Input::get('id');
     $patient = Patient::find($patient_id);
     $appointments = $patient->appointments()->has('checkupfee')->get();
     return View::make('checkupfees.index', compact('appointments'));
 }
 public function create()
 {
     $user = Confide::user();
     //throw new Exception($user);
     if (Request::isMethod('GET')) {
         $patient = Patient::find($user->id);
         return View::make('home/patient/create', compact('user', 'patient'));
     } elseif (Request::isMethod('POST')) {
         // Create a new Appointment with the given data
         $user = Confide::user();
         $user->fill(Input::all());
         $user->save();
         // If patient already exists in system
         $patient = Patient::find($user->id);
         if ($patient != null) {
             // Retreive Patient
         } else {
             // Create a new account for the Patient
             $account = new Account();
             $account->patient_id = $user->id;
             $account->save();
             // Create a new Patient
             $patient = new Patient();
             $patient->fill(Input::all());
             //$patient->dob = new Date();
             $patient->user_id = $user->id;
             $patient->save();
         }
         return Redirect::route('home.index');
     }
 }
 public function getIndex()
 {
     $user = Confide::user();
     if (!$user->isStaff() && Patient::find($user->id) == null) {
         return Redirect::route('patient.create');
     } else {
         return View::make('home/index', compact('user'));
     }
 }
 /**
  * Display a form for creating a new Test.
  *
  * @return Response
  */
 public function create($patientID = 0)
 {
     if ($patientID == 0) {
         $patientID = Input::get('patient_id');
     }
     $testTypes = TestType::where('orderable_test', 1)->orderBy('name', 'asc')->get();
     $patient = Patient::find($patientID);
     //Load Test Create View
     return View::make('test.create')->with('testtypes', $testTypes)->with('patient', $patient);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //
     $p = Patient::find($id);
     if ($p) {
         return Helpers::Show($p);
     } else {
         return Helpers::Mgs("Error {$id} Incorrecto");
     }
 }
 public function testGetGender()
 {
     $data = array(array('patient_number' => '6666', 'name' => 'Paul Mamboleo', 'dob' => '1930-07-05', 'gender' => '0', 'email' => '*****@*****.**', 'address' => 'Godric Hollows', 'phone_number' => '+189012402938', 'created_at' => '0000-00-00', 'updated_at' => '0000-00-00'), array('patient_number' => '5555', 'name' => 'Akellus Judith Pocos Black', 'dob' => '1900-07-05', 'gender' => '1', 'email' => '*****@*****.**', 'address' => '12 Grimmauld Place', 'phone_number' => '+18966602938', 'created_at' => '0000-00-00', 'updated_at' => '0000-00-00'));
     Patient::insert($data);
     $patientSaved = Patient::orderBy('id', 'desc')->take(2)->get()->toArray();
     $patientfemale = Patient::find($patientSaved[1]['id']);
     $patientmale = Patient::find($patientSaved[0]['id']);
     $this->assertEquals('F', $patientfemale->getGender());
     $this->assertEquals('M', $patientmale->getGender());
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     // $id= $_GET['id'];
     $id = Input::get('id');
     $patient = Patient::find($id);
     //echo $patient;
     $UpdateHs = $patient->UpdateHs()->get();
     //$UpdateHs = UpdateHs::all();
     return View::make('nurse.layouts.nursePmr', compact('UpdateHs'));
     //        return View::make('nurse.layouts.nursePmr');
 }
 public function listCons()
 {
     //        return Redirect::back();
     //        $id= Input::get('id');
     //        $patients = Patient::find($id);
     //   $Consumptions = $patients->Consumptions()->get();
     //   $id= $_GET['id'];
     $id = Input::get('id');
     $patients = Patient::find($id);
     //        return Redirect::back();
     $Consumptions = $patients->Consumptions()->get();
     return \Illuminate\Support\Facades\View::make('consumptions.listcons', compact('Consumptions'));
 }
 /**
  * Store a newly created resource in storage.
  * POST /search
  *
  * @return Response
  */
 public function editOldPatientindb()
 {
     $destinationPath = public_path('patient_image/');
     $link_address = "/view/patients_managment/appointment";
     $patient_id = null;
     $rules = ['field_id' => 'required', 'field_name' => 'required', 'field_dob' => 'required', 'field_gender' => 'required', 'field_religion' => 'required', 'field_visitNo' => 'required'];
     $data = Input::all();
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator);
     } else {
         if (!Input::hasFile('field_image')) {
             $patient = Patient::find($data['field_id']);
             $patient->name = $data['field_name'];
             $patient->dob = $data['field_dob'];
             $patient->gender = $data['field_gender'];
             $patient->religion = $data['field_religion'];
             $patient->no_of_visit = $data['field_visitNo'];
             if ($patient->save()) {
                 return View::make('SearchResult')->with('title', 'search result')->with('name', $data['field_name'])->with('dob', $data['field_dob'])->withSuccess('Update Successful');
             } else {
                 return Redirect::back()->withErrors("Something went wrong, please try again");
             }
         } else {
             $photo_fileName = null;
             if (Input::hasFile('field_image')) {
                 $photo = Input::file('field_image');
                 $photo_fileName = strtotime(date('Y-m-d H:i:s')) . md5($photo->getClientOriginalName()) . "." . $photo->getClientOriginalExtension();
                 $photo->move($destinationPath, $photo_fileName);
             }
             $patient = Patient::find($data['field_id']);
             $patient->name = $data['field_name'];
             $patient->dob = $data['field_dob'];
             $patient->gender = $data['field_gender'];
             $patient->religion = $data['field_religion'];
             $patient->no_of_visit = $data['field_visitNo'];
             $patient->image = $photo_fileName;
             if ($patient->save()) {
                 return View::make('SearchResult')->with('title', 'search result')->with('name', $data['field_name'])->with('dob', $data['field_dob'])->withSuccess('Update Successful');
             } else {
                 return Redirect::back()->withErrors("Something went wrong, please try again");
             }
         }
     }
 }
 public function showAll($requestID = null)
 {
     $user = Confide::user();
     $patient = Patient::find($requestID);
     $patient = Patient::join('user', 'user.id', '=', 'patient.user_id')->where('patient.user_id', '=', $user->id)->first();
     if ($user->isStaff() && $requestID !== null) {
         // If weare requesting a patient's appointments and we are Staff
         $appointments = Appointment::where('patient_id', '=', $requestID)->get();
         $patient = Patient::join('user', 'user.id', '=', 'patient.user_id')->where('patient.user_id', '=', $requestID)->first();
     } else {
         $appointments = Appointment::where('patient_id', '=', $user->id)->get();
     }
     foreach ($appointments as $appointment) {
         $doctor = User::find($appointment->staff_id);
         $appointment->doctor = $doctor->first_name . ' ' . $doctor->last_name;
     }
     return View::make('home/appointment/show-all', compact('user', 'appointments', 'patient'));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $bill = new bill();
     //        $bill->patient_id =\Illuminate\Support\Facades\Input::get('patient');
     $patient = Patient::find(Input::get('patient'));
     $bill->patient_id = $patient->id;
     $bill->save();
     if (Input::has('room')) {
         $bill->room_charges = Input::get('room');
         $bill->save();
     } else {
         $bill->room_charges = 'N/A';
         $bill->save();
     }
     if (Input::has('bed')) {
         $bill->bed_charges = Input::get('bed');
         $bill->save();
     } else {
         $bill->bed_charges = 'N/A';
         $bill->save();
     }
     $bill->operation_charges = Input::get('operation');
     $bill->save();
     $bill->meal_charges = Input::get('meal');
     $bill->save();
     $bill->medicine_charges = Input::get('medicine');
     $bill->save();
     $bill->total_charges = Input::get('total');
     $bill->save();
     if (Input::get('note') == '') {
         $bill->note = 'N/A';
     } else {
         $bill->note = Input::get('note');
     }
     $bill->save();
     $bill->bill_id = "B0" . $bill->id;
     $bill->save();
     return Redirect::route('bill.index');
 }
Exemple #13
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy()
 {
     $id = $_GET['id'];
     //        $patient->bed = Input::get('bed');
     $patient = Patient::find($id);
     //        echo $id;
     \Illuminate\Support\Facades\DB::update("update beds set status ='active' where id='{$patient->bed}'");
     \Illuminate\Support\Facades\DB::update("update rooms set status ='active' where id='{$patient->room}'");
     \Illuminate\Support\Facades\DB::table('bills')->where('patient_id', $id)->delete();
     \Illuminate\Support\Facades\DB::table('consumptions')->where('patient_id', $id)->delete();
     //        \Illuminate\Support\Facades\DB::table('bills')->where($patient,'id')
     //        $bill->delete();
     $patient->delete();
     return Redirect::route('ipd.index');
 }
 /**
  * Display a listing of previousdiseases
  *
  * @return Response
  */
 public function index()
 {
     $patient_id = Input::get('id');
     $patient = Patient::find($patient_id);
     return View::make('previousdiseases.index', compact('patient'));
 }
Exemple #15
0
        $id = Input::get('id');
        $appointment = Appointment::findOrFail($id);
        $tests = $appointment->labtests()->where('total_fee', '!=', 0)->get();
        $patient = $appointment->patient;
        $date = date('j F, Y', strtotime($appointment->date));
        $time = date('H:i:s', strtotime($appointment->time));
        $doctor_name = $appointment->employee->name;
        $sum = 0;
        foreach ($tests as $test) {
            $sum += $test->total_fee;
        }
        return View::make('printables.test_invoice_print', compact('sum', 'tests', 'date', 'time', 'doctor_name', 'patient'));
    });
    Route::get('pdf_record', function () {
        $id = Input::get('id');
        $patient = Patient::find($id);
        $appointments = $patient->appointments()->get();
        $flag = "pdf_record";
        return View::make('appointment_based_data.appointments', compact('appointments', 'flag'));
    });
    Route::get('pdf', 'HomeController@pdf_record');
    //    Ajax Requests
    Route::get('getSlots', 'TimeslotsController@getFreeSlots');
    //****************************************************************//
});
//Roles
// 1- Administrator
// 2- Doctor
// 3- Accountant
// 4- Receptionist
// 5- Lab Manager
Exemple #16
0
$dummy = new Patient();
$dummy->address = "lane";
$db->exec("insert into searchindex VALUES(null,'filler1',0) ");
$db->exec("insert into searchindex VALUES(null,'filler2',0) ");
$db->exec("insert into searchindex VALUES(null,'filler3',0) ");
$db->exec("insert into searchindex VALUES(null,'filler4',0) ");
$db->exec("insert into searchindex VALUES(null,'filler5',0) ");
$db->exec("insert into searchindex VALUES(null,'patient.address',0) ");
$db->exec("update searchindex set cnt=100 where ind='patient.address' ");
$db->exec("update searchindex set cnt=0 where ind!='patient.address' ");
if (count($db->get("SHOW INDEX FROM patient")) !== 1) {
    die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
} else {
    SmartTest::instance()->progress();
}
Patient::find($dummy, array("address" => "="));
if ($db->getCell("select cnt from searchindex where ind='patient.address'") != 101) {
    die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
} else {
    SmartTest::instance()->progress();
}
R::optimizeIndexes(true);
if (count($db->get("SHOW INDEX FROM patient")) !== 2) {
    die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
} else {
    SmartTest::instance()->progress();
}
$db->exec(" update patient set address='street same' ");
R::optimizeIndexes(true);
if (count($db->get("SHOW INDEX FROM patient")) !== 1) {
    die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
						<tr>
							<th></th>
							<th>{{Lang::choice('messages.patient-number',1)}}</th>
							<th>{{Lang::choice('messages.name',1)}}</th>
							<th>{{Lang::choice('messages.gender',1)}}</th>
							<th>{{Lang::choice('messages.age',1)}}</th>
							<th>{{Lang::choice('messages.registration-date',1)}}</th>
						</tr>
					</thead>
					<tbody>
						<?php 
$i = 1;
?>
						@forelse($reportData as $row)
							<?php 
$patient = Patient::find($row->id);
?>
							<tr>
								<td>{{$i++}}</td>
								<td>{{$patient->patient_number}}</td>
								<td>{{$patient->name}}</td>
								<td>{{$patient->getGender(false)}}</td>
								<td>{{$patient->getAge()}}</td>
								<td>{{$patient->created_at}}</td>
							</tr>
						@empty
							<tr>
								<td colspan='6'>{{Lang::choice('messages.no-data-found',1)}}</td>
							</tr>
						@endforelse
					</tbody>
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $response = null;
     $patient = Patient::find($id);
     // se valida que el metodo por el cual se hacer la petición sea el adecuado.
     if (Request::isMethod(self::PUT)) {
         // se valida que la información con la que se pretende actualizar sea válida.
         if ($this->isValidForUpdate()) {
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.IDENTIFICATION_TYPE_ID')))) {
                 $patient->identificationTypeId = Input::get(Config::get('constants.PATIENT.ATTRS.IDENTIFICATION_TYPE_ID'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.MARITAL_STATUS_ID')))) {
                 $patient->maritalStatusId = Input::get(Config::get('constants.PATIENT.ATTRS.MARITAL_STATUS_ID'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.NAME')))) {
                 $patient->name = Input::get(Config::get('constants.PATIENT.ATTRS.NAME'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.LASTNAME')))) {
                 $patient->lastname = Input::get(Config::get('constants.PATIENT.ATTRS.LASTNAME'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.IDENTIFICATION_NUMBER')))) {
                 $patient->identificationNumber = Input::get(Config::get('constants.PATIENT.ATTRS.IDENTIFICATION_NUMBER'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.PLACEBIRTH')))) {
                 $patient->placebirth = Input::get(Config::get('constants.PATIENT.ATTRS.PLACEBIRTH'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.BIRTHDATE')))) {
                 $patient->birthdate = Input::get(Config::get('constants.PATIENT.ATTRS.BIRTHDATE'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.GENDER')))) {
                 $patient->gender = Input::get(Config::get('constants.PATIENT.ATTRS.GENDER'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.OCCUPATION')))) {
                 $patient->occupation = Input::get(Config::get('constants.PATIENT.ATTRS.OCCUPATION'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.RESIDENCE_CITY')))) {
                 $patient->residenceCity = Input::get(Config::get('constants.PATIENT.ATTRS.RESIDENCE_CITY'));
             }
             if (!empty(Input::get(Config::get('constants.PATIENT.ATTRS.ADDRESS')))) {
                 $patient->address = Input::get(Config::get('constants.PATIENT.ATTRS.ADDRESS'));
             }
             // se guardan los datos del paciente
             $patient->save();
             // seguardan los datos de los responsables
             $custodians = Input::get(Config::get('constants.CUSTODIANS'));
             foreach ($custodians as $custodian) {
                 $this->storeCustodian($custodian, $patient->patientId);
             }
             // listado de responsables a aliminar
             $custodiansDelete = Input::get(Config::get('constants.CUSTODIANS_DELETE'));
             // se valida si el arreglo de responsables a aliminar tiene contenido
             if (!empty($custodiansDelete)) {
                 // existen responsables a eliminar
                 Custodian::destroy($custodiansDelete);
             }
             $response = $this->respondWithItem($patient, new PatientTransformer());
         } else {
             $response = $this->respondWithError($this->getErrors(), self::CODE_WRONG_ARGUMENTS);
         }
     } else {
         $response = $this->respondWithError(sprintf(self::NOT_ALLOWED_METHOD_MESSAGE, Request::method()), self::NOT_ALLOWED_METHOD_CODE);
     }
     return $response;
 }
 /**
  * Display data after applying the filters on the report uses patient ID
  *
  * @return Response
  */
 public function viewPatientReport($id, $visit = null)
 {
     $from = Input::get('start');
     $to = Input::get('end');
     $pending = Input::get('pending');
     $date = date('Y-m-d');
     $error = '';
     $visitId = Input::get('visit_id');
     //	Check checkbox if checked and assign the 'checked' value
     if (Input::get('tests') === '1') {
         $pending = 'checked';
     }
     //	Query to get tests of a particular patient
     if (($visit || $visitId) && $id) {
         $tests = Test::where('visit_id', '=', $visit ? $visit : $visitId);
     } else {
         $tests = Test::join('visits', 'visits.id', '=', 'tests.visit_id')->where('patient_id', '=', $id);
     }
     //	Begin filters - include/exclude pending tests
     if ($pending) {
         $tests = $tests->where('tests.test_status_id', '!=', Test::NOT_RECEIVED);
     } else {
         $tests = $tests->whereIn('tests.test_status_id', [Test::COMPLETED, Test::VERIFIED]);
     }
     //	Date filters
     if ($from || $to) {
         if (!$to) {
             $to = $date;
         }
         if (strtotime($from) > strtotime($to) || strtotime($from) > strtotime($date) || strtotime($to) > strtotime($date)) {
             $error = trans('messages.check-date-range');
         } else {
             $toPlusOne = date_add(new DateTime($to), date_interval_create_from_date_string('1 day'));
             $tests = $tests->whereBetween('time_created', array($from, $toPlusOne->format('Y-m-d H:i:s')));
         }
     }
     //	Get tests collection
     $tests = $tests->get(array('tests.*'));
     //	Get patient details
     $patient = Patient::find($id);
     //	Check if tests are accredited
     $accredited = array();
     $verified = array();
     foreach ($tests as $test) {
         if ($test->testType->isAccredited()) {
             array_push($accredited, $test->id);
         } else {
             continue;
         }
     }
     foreach ($tests as $test) {
         if ($test->isVerified()) {
             array_push($verified, $test->id);
         } else {
             continue;
         }
     }
     if (Input::has('word')) {
         $date = date("Ymdhi");
         $fileName = "blispatient_" . $id . "_" . $date . ".doc";
         $headers = array("Content-type" => "text/html", "Content-Disposition" => "attachment;Filename=" . $fileName);
         $content = View::make('reports.patient.export')->with('patient', $patient)->with('tests', $tests)->with('from', $from)->with('to', $to)->with('visit', $visit)->with('accredited', $accredited);
         return Response::make($content, 200, $headers);
     } else {
         return View::make('reports.patient.report')->with('patient', $patient)->with('tests', $tests)->with('pending', $pending)->with('error', $error)->with('visit', $visit)->with('accredited', $accredited)->with('verified', $verified)->withInput(Input::all());
     }
 }
 function dataGetPatient($id)
 {
     $patient = Patient::find($id);
     if (isset($patient)) {
         return json_encode(array('message' => 'found', 'patient' => $patient));
     } else {
         return json_encode(array('message' => 'empty'));
     }
 }
 function viewPatient($id)
 {
     $expertId = Session::get('expert_id');
     if (!isset($expertId)) {
         return json_encode(array('message' => 'not logged'));
     }
     $patientRequest = PatientRequest::find($id);
     if (isset($patientRequest)) {
         $patient = Patient::find($patientRequest->patient_id);
         if (isset($patient)) {
             return View::make('expert.view-patient')->with('found', true)->with('patient', $patient);
         } else {
             return View::make('expert.view-patient')->with('found', false);
         }
     } else {
         return View::make('expert.view-patient')->with('found', false);
     }
 }
 /**
  * a function to export data to excel
  */
 public function excelDownload()
 {
     if (isset($_POST['records'])) {
         /** Include PHPExcel */
         require_once dirname(__FILE__) . '/Classes/PHPExcel.php';
         // Create new PHPExcel object
         $objPHPExcel = new PHPExcel();
         $title = Input::get("vertical");
         $pat = false;
         $usequery = "";
         if (Input::get("horizontal") == "Year") {
             $from = Input::get('year') . "-01-01";
             $to = Input::get('year') . "-12-31";
             $patientquery = DB::table('patient');
             $visitquery = DB::table('visit');
             $query = $this->processQuery($patientquery, $visitquery);
             $title .= " " . $query[2] . " " . Input::get('Year');
             $usequery = $query[0]->whereBetween('created_at', array($from, $to))->get();
         } elseif (Input::get("horizontal") == "Years") {
             $from = Input::get('start') . "-01-01";
             $to = Input::get('end') . "-12-31";
             $patientquery = DB::table('patient');
             $visitquery = DB::table('visit');
             $query = $this->processQuery($patientquery, $visitquery);
             $title .= " " . $query[2] . " " . Input::get('Year');
             $usequery = $query[0]->whereBetween('created_at', array($from, $to))->get();
         } elseif (Input::get("horizontal") == "Age Range") {
             $patientquery = DB::table('patient');
             $visitquery = DB::table('visit');
             $query = $this->processQuery($patientquery, $visitquery);
             $usequery = $query[0]->get();
             $title .= " Age Range " . $query[2] . " ";
         }
         // Set document properties
         $objPHPExcel->getProperties()->setCreator("Cervical Cancer Prevention Program")->setLastModifiedBy(Auth::user()->first_name)->setTitle($title)->setSubject($title)->setDescription("Cervical Cancer Prevention Program Reports")->setKeywords("cancer cecap openxml php")->setCategory("Result file");
         // Tittle
         $objPHPExcel->setActiveSheetIndex(0)->mergeCells('A1:I1');
         $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', $title);
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A2', 'Name')->setCellValue('B2', 'Age')->setCellValue('C2', 'Region')->setCellValue('D2', 'District')->setCellValue('E2', 'Facility')->setCellValue('F2', 'Marital Status')->setCellValue('G2', 'HIV Status')->setCellValue('H2', 'Contraceptive Status')->setCellValue('I2', 'Last Visit');
         $k = 3;
         foreach ($usequery as $us) {
             $patient = Patient::find($us->id);
             $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$k}", $us->first_name . " " . $us->middle_name . " " . $us->last_name)->setCellValue("B{$k}", date('Y') - date('Y', strtotime($us->birth_date)))->setCellValue("C{$k}", $patient->report->regions->region)->setCellValue("D{$k}", $patient->report->districts->district)->setCellValue("E{$k}", Facility::find($us->facility_id)->facility_name)->setCellValue("F{$k}", $patient->report->marital_status)->setCellValue("G{$k}", $patient->report->HIV_status)->setCellValue("H{$k}", $patient->report->contraceptive_status)->setCellValue("I{$k}", date('j M Y', strtotime($patient->visit()->orderBy('created_at', 'DESC')->first()->visit_date)));
             $k++;
         }
         // Rename worksheet
         $objPHPExcel->getActiveSheet()->setTitle("Cervical Cancer Patient Report");
         // Set active sheet index to the first sheet, so Excel opens this as the first sheet
         $objPHPExcel->setActiveSheetIndex(0);
         // Redirect output to a client’s web browser (Excel2007)
         header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
         header('Content-Disposition: attachment;filename="records.xlsx"');
         header('Cache-Control: max-age=0');
         // If you're serving to IE 9, then the following may be needed
         header('Cache-Control: max-age=1');
         // If you're serving to IE over SSL, then the following may be needed
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         // Date in the past
         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
         // always modified
         header('Cache-Control: cache, must-revalidate');
         // HTTP/1.1
         header('Pragma: public');
         // HTTP/1.0
         $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
         $objWriter->save('php://output');
         exit;
     } elseif (isset($_POST['reports'])) {
         /** Include PHPExcel */
         require_once dirname(__FILE__) . '/Classes/PHPExcel.php';
         // Create new PHPExcel object
         $objPHPExcel = new PHPExcel();
         $title = Input::get("vertical");
         $pat = false;
         $row = array();
         $column = array();
         $columntype = $this->generateArray(Input::get("show"));
         if (Input::get("vertical") == "Patients") {
             $pat = true;
         }
         if (Input::get("horizontal") == "Year") {
             $row = array("01" => "jan", "02" => "feb", "03" => "mar", "04" => "apr", "05" => "may", "06" => "jun", "07" => "jul", "08" => "aug", "09" => "sep", "10" => "oct", "11" => "nov", "12" => "dec");
             foreach ($row as $key => $value) {
                 $from = Input::get('year') . "-" . $key . "-01";
                 $to = Input::get('year') . "-" . $key . "-31";
                 if (isset($columntype)) {
                     foreach ($columntype as $key1 => $value1) {
                         $patientquery = DB::table('patient');
                         $visitquery = DB::table('visit');
                         $query = $this->processQuery($patientquery, $visitquery);
                         $que = $this->checkCondition($query, $pat, $key1)->whereBetween('created_at', array($from, $to));
                         $column[$value1][] = $que->count();
                     }
                 }
             }
             $title .= " " . $query[2] . " " . Input::get('year');
         } elseif (Input::get("horizontal") == "Years") {
             $row = range(Input::get('start'), Input::get('end'));
             foreach ($row as $value) {
                 $from = $value . "-01-01";
                 $to = $value . "-12-31";
                 if (isset($columntype)) {
                     foreach ($columntype as $key1 => $value1) {
                         $patientquery = DB::table('patient');
                         $visitquery = DB::table('visit');
                         $query = $this->processQuery($patientquery, $visitquery);
                         $que = $this->checkCondition($query, $pat, $key1)->whereBetween('created_at', array($from, $to));
                         $column[$value1][] = $que->count();
                     }
                 }
             }
             $title .= " " . $query[2] . " " . Input::get('start') . " - " . Input::get('end');
         } elseif (Input::get("horizontal") == "Age Range") {
             //setting the limits
             $agetouse = Input::get('age') == 0 ? 3 : Input::get('age');
             if (parent::maxAge() % $agetouse == 0) {
                 $limit = parent::maxAge();
             } else {
                 $limit = parent::maxAge() - parent::maxAge() % $agetouse + $agetouse;
             }
             //making a loop for values
             //year iterator
             $k = 0;
             //getting age
             $range = Input::get('age');
             $yeardate = date("Y") + 1;
             $yaerdate1 = $yeardate . "-01-01";
             //creating title
             $data = array();
             for ($i = $range; $i <= $limit; $i += $range) {
                 $row[] = $k . " - " . $i;
                 //start year
                 $time = $k * 365 * 24 * 3600;
                 $today = date("Y-m-d");
                 $timerange = strtotime($today) - $time;
                 $start = date("Y", $timerange) + 1 . "-01-01";
                 //end year
                 $time1 = $i * 365 * 24 * 3600;
                 $timerange1 = strtotime($today) - $time1;
                 $end = date("Y", $timerange1) . "-01-01";
                 if (isset($columntype)) {
                     foreach ($columntype as $key1 => $value1) {
                         $patientquery = DB::table('patient');
                         $visitquery = DB::table('visit');
                         $query = $this->processQuery($patientquery, $visitquery);
                         $que = $this->checkCondition($query, true, $key1)->whereBetween('birth_date', array($end, $start));
                         $column[$value1][] = $que->count();
                     }
                 }
                 $k = $i;
             }
             $title .= " Age Range " . $query[2];
         }
         // Set document properties
         $objPHPExcel->getProperties()->setCreator("Cervical Cancer Prevention Program")->setLastModifiedBy(Auth::user()->first_name)->setTitle($title)->setSubject($title)->setDescription("Cervical Cancer Prevention Program Reports")->setKeywords("cancer cecap openxml php")->setCategory("Result file");
         $latterArr = array("A", "B", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "AB", "AC", "AD", "AE", "AF", "AG", "AH", "AI", "AJ", "AK", "AL", "AM", "AN", "AO", "AP", "AQ", "AR", "AS", "AT", "AU", "AV", "AW", "AX", "AY", "AZ", "BA", "BB", "BC", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BK", "BM", "BL", "BO", "BP", "BQ", "BR", "BS", "BT", "BU", "BV", "BW", "BX", "BY", "BZ");
         $ttlecont = 1;
         $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A2', Input::get("show"));
         foreach ($row as $header) {
             $objPHPExcel->setActiveSheetIndex(0)->setCellValue("{$latterArr[$ttlecont]}2", $header);
             $ttlecont++;
         }
         $objPHPExcel->setActiveSheetIndex(0)->mergeCells("A1:{$latterArr[$ttlecont - 1]}1");
         $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', $title);
         $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $k = 3;
         $colcount = 1;
         foreach ($column as $keys => $cols) {
             $objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$k}", $keys);
             foreach ($cols as $colsval) {
                 $objPHPExcel->setActiveSheetIndex(0)->setCellValue("{$latterArr[$colcount]}{$k}", $colsval);
                 $colcount++;
             }
             $colcount = 1;
             $k++;
         }
         // Rename worksheet
         $objPHPExcel->getActiveSheet()->setTitle("Cervical Cancer Patient Report");
         // Set active sheet index to the first sheet, so Excel opens this as the first sheet
         $objPHPExcel->setActiveSheetIndex(0);
         // Redirect output to a client’s web browser (Excel2007)
         header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
         header('Content-Disposition: attachment;filename="' . $title . '.xlsx"');
         header('Cache-Control: max-age=0');
         // If you're serving to IE 9, then the following may be needed
         header('Cache-Control: max-age=1');
         // If you're serving to IE over SSL, then the following may be needed
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         // Date in the past
         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
         // always modified
         header('Cache-Control: cache, must-revalidate');
         // HTTP/1.1
         header('Pragma: public');
         // HTTP/1.0
         $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
         $objWriter->save('php://output');
         exit;
     }
 }
 public function store_followup($id)
 {
     $patient = Patient::find($id);
     $patient->first_name = Input::get("firstname");
     $patient->middle_name = Input::get("middlename");
     $patient->last_name = Input::get("lastname");
     $patient->birth_date = Input::get("dob");
     $patient->hospital_id = Input::get("hosp_no");
     $patient->phone = Input::get("phone");
     $patient->facility_id = Input::get("facility");
     $patient->save();
     //adding patient visit info
     $visit = Visit::create(array("patient_id" => $patient->id, "visit_date" => date('Y-m-d'), "server_status" => 'not', "user" => Auth::user()->firstname . " " . Auth::user()->middlename . " " . Auth::user()->lastname));
     //adding address information
     PatientInfo::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "hospital_id" => "somenumber", "region" => Input::get("region"), "district" => Input::get("district"), "ward" => Input::get("ward"), "ten_cell_leader" => Input::get("t_cell_leadr")));
     //adding gynecological history inforamtion for a visit
     GynecologicalHistory::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "parity" => Input::get("parity"), "number_of_pregnancy" => Input::get("number_of_preg"), "menarche" => Input::get("menarche"), "age_at_sexual_debut" => Input::get("start_sex_age"), "marital_status" => Input::get("marital"), "age_at_first_marriage" => Input::get("first_marriage"), "sexual_partner" => Input::get("sexual_partner"), "partner_sexual_partner" => Input::get("partner_sexual_partner")));
     //adding contraceptive history
     ContraceptiveHistory::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "current_status" => Input::get("current_on_contra"), "current_contraceptive_id" => Input::has("current_contra") ? Input::get("current_contra") : ""));
     //adding HIV status
     HivStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "status" => Input::has("hiv_status") ? Input::get("hiv_status") : "", "test_status" => Input::has("hiv_test_status") ? Input::get("hiv_test_status") : "", "unknown_reason" => Input::has("unknown_reason") ? Input::get("unknown_reason") : "", "years_since_first_diagnosis" => Input::has("year_since_diagnosis") ? Input::get("year_since_diagnosis") : "", "year_of_last_test" => Input::has("last_test") ? Input::get("last_test") : "", "art_status" => Input::has("art_status") ? Input::get("art_status") : "", "current_art_status" => Input::has("current_art_status") ? Input::get("current_art_status") : "", "pitc_offered" => Input::get("test_again") == "yes" ? "yes" : "no", "pitc_agreed" => Input::has("test_again") ? Input::get("test_again") : "", "pitc_result" => Input::has("current_test_result") ? Input::get("current_test_result") : "", "pitc_cd4_count" => Input::has("current_cd4") ? Input::get("current_cd4") : "", "prev_cd4_count" => Input::has("prev_cd4") ? Input::get("prev_cd4") : ""));
     //adding VIA Status
     ViaStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "via_counselling_status" => Input::get("via_counceling"), "via_test_status" => Input::get("via_test"), "reject_reason" => Input::has("via_reason") ? Input::get("via_reason") : "", "via_result" => Input::has("via_results") ? Input::get("via_results") : ""));
     //adding colposcopy
     ColposcopyStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "status" => Input::get("colposcopy_status"), "result_id" => Input::has("colpo_result") ? Input::get("colpo_result") : ""));
     //adding Pap smear result
     PapsmearStatus::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "status" => Input::get("pap_status"), "result_id" => Input::has("pap_result") ? Input::get("pap_result") : ""));
     //adding intervetion status
     Intervention::create(array("patient_id" => $patient->id, "visit_id" => $visit->id, "type_id" => Input::has("intervention") ? Input::get("intervention") : "", "indicator_id" => Input::has("indicator") ? Input::get("indicator") : "", "histology_id" => Input::has("histology") ? Input::get("histology") : "", "cancer_id" => Input::has("cancer") ? Input::get("cancer") : "", "grade" => Input::has("hist_grade") ? Input::get("hist_grade") : "", "stages" => Input::has("stages") ? Input::get("stages") : "", "differentiation" => Input::has("differentiation") ? Input::get("differentiation") : ""));
     $report = PatientReport::where('patient_id', $patient->id)->first();
     $report->region = Input::get("region");
     $report->district = Input::get("district");
     $report->number_of_pregnancy = Input::get("number_of_preg");
     $report->marital_status = Input::get("marital");
     $report->first_marriage = Input::get("first_marriage");
     $report->partners = Input::get("sexual_partner");
     $report->partners_partner = Input::get("partner_sexual_partner");
     $report->contraceptive_status = Input::get("current_on_contra");
     $report->facility_id = Input::get("facility");
     if (Input::has("current_contra")) {
         $report->contraceptive_type = Input::get("current_contra");
     }
     if (Input::has("hiv_status")) {
         $report->HIV_status = Input::get("hiv_status");
     }
     if (Input::has("current_cd4")) {
         $report->cd4_count = Input::get("current_cd4");
     } elseif (Input::has("prev_cd4")) {
         $report->cd4_count = Input::has("prev_cd4");
     }
     $report->save();
     if (Input::get("next_visit") != "") {
         Notification::create(array("patient_id" => $patient->id, "message" => "Kumbuka Kwenda katika kituo ulichopimwa mara ya mwisho saratani ya shingo ya kizazi. Tafadhali fika bila kukosa tarehe  " . Input::get('next_visit'), "status" => "pending", "phone_number" => $patient->phone, "next_visit" => Input::get('next_visit')));
     }
     Logs::create(array("user_id" => Auth::user()->id, "action" => "Patient followup for " . $patient->first_name . " " . $patient->last_name));
     $msg = "Patient followup stored successfull";
     return View::make('visit.index', compact('patient', "msg"));
 }
					<div class="panel-body">
							<a class="btn btn-inverse" data-toggle="modal" href="#md-add-event"><i class="fa fa-filter"></i> Filtros</a>
							<table class="table table-striped" id="table-example">
								<thead>
									<tr>
										<th class="text-center">Imagen</th>
										<th class="text-center">Name</th>
										<th class="text-center">Email</th>
										<th class="text-center">Phone</th>
										<th class="text-center">Citas pendientes/Historia de citas</th>
									</tr>
								</thead>
								<tbody align="center"> 																				
									@foreach($patients as $d)
									<?php 
$patient = Patient::find($d->patient_id);
$user = User::find($patient->user_id);
$profile = Profile::where('user_id', $user->id)->first();
?>
									<tr class="odd gradeX">	
										<td><img class="circle profile-table" src="@if($profile->picture!="") {{url($profile->picture)}} @else http://agenda.dev/assets/doctor/images/profile_pic/default.png @endif" alt=""></td>
										<td>{{$user->getFullName()}}</td>																					
										<td>{{$user->email}}</td>
										<td>{{$profile->phone}}</td>
										<td><a href="{{url('doctor/patient/'.$d->patient_id.'/appointments-pending')}}" type="button" class="btn btn-info btn-transparent" data-toggle="tooltip" data-placement="left" title="Citas Pendientes"><i class="fa fa-clock-o"></i> Pendientes</a>
										    <a href="{{url('doctor/patient/'.$d->patient_id.'/appointments-history')}}" type="button" class="btn btn-info btn-transparent" data-toggle="tooltip" data-placement="left" title="Historia de citas"><i class="fa fa-clock-o"></i> Historia</a></td>
									</tr>
									@endforeach																				
								</tbody>
							</table>
					</div>
Exemple #25
0
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
/**
 * Register route bindings
 * FYI - Should be done in the service providers
 */
// Start a new visit
Route::bind('patient', function ($value, $route) {
    return $patient = Patient::find($value);
});
// Destroy a billing item
Route::bind('billing', function ($value, $route) {
    return Billing::where('id', $value)->first();
});
// Destroy a client
Route::bind('bima', function ($value, $route) {
    return Bima::find($value);
});
/**
 * Homepage
 */
Route::get('/', array('as' => 'home', 'uses' => 'HomeController@home'));
/**
 * Authenticated Users
 /**
  * Display a listing of surgicalhistories
  *
  * @return Response
  */
 public function index()
 {
     $patient_id = Input::get('id');
     $patient = Patient::find($patient_id);
     return View::make('surgicalhistories.index', compact('patient'));
 }
 /**
  * Remove the specified resource from storage (soft delete).
  *
  * @param  int  $id
  * @return Response
  */
 public function delete($id)
 {
     //Soft delete the patient
     $patient = Patient::find($id);
     $patient->delete();
     // redirect
     $url = Session::get('SOURCE_URL');
     return Redirect::to($url)->with('message', 'The commodity was successfully deleted!');
 }
 /**
  * Show the form for editing the specified patient.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $patient = Patient::find($id);
     return View::make('patients.edit', compact('patient'));
 }