/** * Display the specified resource. * GET /patientappointment/{id} * * @param int $id * @return Response */ public function makeAppointment() { $patient = null; $rules = ['patient_id' => 'required', 'doctor_id' => 'required', 'date' => 'required', 'time' => 'required']; $data = Input::all(); $validator = Validator::make(Input::all(), $rules); $patient = DB::table('patients')->where('id', $data['patient_id'])->first(); if ($validator->fails()) { return View::make('PatientViews/appointment')->with('title', 'Appointment')->with('id', $data['patient_id'])->with('name', $patient->name)->withErrors($validator); } else { $doctor = DB::table('doctors')->where('id', $data['doctor_id'])->pluck('working_hourse'); $doctor_name = DB::table('doctors')->where('id', $data['doctor_id'])->pluck('name'); $appointmentCount = 0; $appointment = DB::table('appointments')->where('schedule', $data['date'])->get(); $appointmentCount = count($appointment); $hourse = $doctor; $appointment = new Appointment(); $appointment->patients_id = $data['patient_id']; $appointment->doctors_id = $data['doctor_id']; $appointment->schedule = $data['time']; if ($appointment->save()) { return View::make('PatientViews/appointmentComplete')->with('title', 'appointment_complete')->with('patient_name', $patient->name)->with('patient_id', $data['patient_id'])->with('doctor_name', $doctor_name)->with('appointment_date', $data['date'])->with('appointment_time', $data['time']); } else { return View::make('PatientViews/appointment')->with('title', 'Appointment')->with('id', $data['patient_id'])->with('name', $patient_name)->withErrors("Something Went Wrong, please try again"); } } }
public function executeQuery(sfWebRequest $request) { if ($request->isXmlHttpRequest()) { if ($request->isMethod(sfRequest::GET)) { $startDate = $request->getGetParameter('startDate'); $endDate = $request->getGetParameter('endDate'); $page = $request->getGetParameter('page'); $start = $request->getGetParameter('start'); $limit = $request->getGetParameter('limit'); $this->convertParamToDateTime($startDate); $this->convertParamToDateTime($endDate); $result = Doctrine_Core::getTable('Appointment')->getBetween($startDate, $endDate); $response = $this->buildResponse($result, "Loading Record"); } else { if ($request->isMethod(sfRequest::POST)) { $form_data = json_decode(file_get_contents('php://input')); $location = $form_data->loc; $title = $form_data->title; $notes = $form_data->notes; $url = $form_data->url; $reminder = $form_data->rem; $cid = $form_data->cid; $startDate = str_replace('T', ' ', $form_data->start); $endDate = str_replace('T', ' ', $form_data->end); $this->convertParamToDateTime($startDate, 'Y-m-d H:i:s'); $this->convertParamToDateTime($endDate, 'Y-m-d H:i:s'); $a = new Appointment(); $a->fromArray(array('coach_id' => 1, 'client_id' => 1, 'calendar_type_id' => $cid, 'scheduled' => $startDate, 'started_at' => $startDate, 'finished_at' => $endDate, 'title' => $title, 'location' => $location, 'notes' => $notes, 'web_link' => $url, 'reminder' => $reminder)); $a->save(); $response = $this->buildResponse($a, "Creating Record"); } else { if ($request->isMethod(sfRequest::PUT)) { $form_data = json_decode(file_get_contents('php://input')); $location = $form_data->loc; $title = $form_data->title; $notes = $form_data->notes; $url = $form_data->url; $reminder = $form_data->rem; $cid = $form_data->cid; $startDate = str_replace('T', ' ', $form_data->start); $endDate = str_replace('T', ' ', $form_data->end); $this->convertParamToDateTime($startDate, 'Y-m-d H:i:s'); $this->convertParamToDateTime($endDate, 'Y-m-d H:i:s'); $a = Doctrine_Core::getTable('Appointment')->find(array($request->getParameter('id'))); $a->fromArray(array('coach_id' => 1, 'client_id' => 1, 'calendar_type_id' => $cid, 'scheduled' => $startDate, 'started_at' => $startDate, 'finished_at' => $endDate, 'title' => $title, 'location' => $location, 'notes' => $notes, 'web_link' => $url, 'reminder' => $reminder)); $a->save(); $response = $this->buildResponse($a, "Updating Record"); } else { if ($request->isMethod(sfRequest::DELETE)) { $app = Doctrine_Core::getTable('Appointment')->find(array($request->getParameter('id'))); $app->delete(); $response = array('success' => true, 'message' => 'Destroyed Record', 'data' => array()); } } } } sfConfig::set('sf_web_debug', false); return $this->renderPartial('global/ajax', array('ajax' => json_encode($response))); } }
function deleteData($id) { $action = new Appointment($this->dbcon, $id); $result = parent::deleteData($id); if (!$action->getData('action_id')) { return $result; } $item = new ScheduleItem($this->dbcon, $action->getData('action_id')); return $result && $item->updateStatus(); }
public function ajaxMarkAppointmentAction() { $appointmentId = (int) $this->_getParam('appointmentId'); $mark = $this->_getParam('mark'); $app = new Appointment(); $app->appointmentId = $appointmentId; $app->populate(); //todo: compare provided mark against eligible in matching enumeration $app->appointmentCode = $mark; $app->persist(); $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct(true); }
/** * Show the form for creating a new diagonosticprocedure * * @return Response */ public function create() { $appointment = Appointment::find(Input::get('id')); $patient_id = $appointment->patient->id; $patient_id = Input::get('id'); return View::make('diagonosticprocedures.create', compact('appointment', 'patient_id')); }
/** * Update the specified appointment in storage. * * @param int $appointment_id * @return Response * */ public function update($appointment_id) { $appointment = Appointment::find($appointment_id); $input = Input::all(); if (isset($input['category_id'])) { $appointment->category_id = $input['category_id']; } if (isset($input['title'])) { $appointment->title = $input['title']; } if (isset($input['start'])) { $appointment->start = Carbon::parse($input['start'])->toDateTimeString(); } if (isset($input['end'])) { $appointment->end = Carbon::parse($input['end'])->toDateTimeString(); } $start = Carbon::parse($appointment->start); $end = Carbon::parse($appointment->end); // Check that start is before end if ($start->gt($end)) { return Response::json(array('message' => 'Start can not be after end'), 400); } $appointment->save(); return Response::json($appointment); }
public static function get_instance() { if (self::$appointment == NULL) { self::$appointment = new Appointment(); } return self::$appointment; }
/** * Show the form for creating a new prescription * * @return Response */ public function create() { $appointment = Appointment::find(Input::get('id')); $patient_id = $appointment->patient->id; $doctors = Employee::where('role', 'Doctor')->where('status', 'Active')->get(); $medicines = Medicine::all()->lists('name', 'id'); return View::make('prescriptions.create', compact('medicines', 'appointment', 'patient_id', 'doctors')); }
public function postDelete($id) { $event = Appointment::find($id); if ($event) { $event->delete(); return Response::json(array('status' => 'success')); } return Response::json(array('status' => 'error')); }
public function actionIndex() { $apps = Appointment::model()->DIT(Appointment::DIT_BOOKED)->passed()->findAll(); foreach ($apps as $app) { $this->log('Booking follow up for app id=' . $app->app_id); $followUp = $app->bookDITFollowUp(); $this->log('newly created follow up id=' . $followUp->app_id); } }
public function getPatientAppointmentsHistory($patient) { if (Payment::VeryPayment() == false) { return View::make('clinic.payment.renews-payment'); } $doctor = Doctor::doctorLogin(); $Agenda = Agenda::where('doctor_id', $doctor)->first(); $Appointment = Appointment::where('patient_id', $patient)->where('agenda_id', $Agenda->id)->get(); return View::make('clinic.doctor.patients.history')->with('Appointment', $Appointment); }
public function manage() { $expertId = Session::get('expert_id'); if (!isset($expertId)) { return Redirect::to('/'); } $appointment_count = Appointment::where('expert_id', '=', $expertId)->where('status', '=', 'booked')->where('appointment_date', '>=', date('Y-m-d H:i:s'))->count(); $availability_count = Appointment::where('expert_id', '=', $expertId)->where('status', '=', 'pending')->where('appointment_date', '>=', date('Y-m-d H:i:s'))->count(); return View::make('expert.dashboard')->with('appointment_count', $appointment_count)->with('availability_count', $availability_count); }
public function getAppointments() { $appointments = Appointment::all(); $calendarAppointments = array(); foreach ($appointments as $a) { $customer = Customer::find($a['customer_id']); $customer = $customer->first_name . ' ' . $customer->last_name; $event = array('title' => 'Appointment with ' . $customer, 'start' => $a['appointment_datetime']); array_push($calendarAppointments, $event); } return View::make('admin/appointments')->with('appointments', $calendarAppointments); }
public function verification() { $query = "SELECT `id` FROM `appoinment` WHERE `patient_user`='" . $this->getPatientUser() . "' AND `doctor`='" . $this->getDoctor() . "' AND `date`='" . $this->getDate() . "' AND `time`='" . $this->getTime() . "' AND `is_approved`='1'"; $result = $this->db->query(" SELECT * FROM `appointment` "); if ($result->num_rows >= 0) { self::$message = "Appointment registered you will inform soon"; return true; //is empty } else { self::$message = 'An appointment with this doctor of same time has been already registred!'; return false; } }
function __construct() { parent::__construct(); // Models $this->load->model('Doctor_model'); $this->load->model('User_model'); $this->load->library('calendar'); $this->load->model('Appointment_model'); // Initialize static variables Appointment::$user_id = $this->User_model->get_user_id(); $this->date = now(); $this->doctor_id = 1; }
public static function getObject($mxdFilters = array()) { $objApp = new Appointment(); $db = Zend_Registry::get('dbAdapter'); $objSelect = $db->select()->from('appointments'); if (is_string($mxdFilters)) { $objSelect->where($mxdFilters); } else { if (is_array($mxdFilters)) { foreach ($mxdFilters as $fieldName => $mxdValue) { // set the default operator to == $fieldOperator = '='; $fieldValue = ''; if (is_array($mxdValue)) { $ctr = count($mxdValue); // if empty array, just continue to the next item if ($ctr < 1) { continue; } else { switch ($ctr) { case 1: $fieldValue = array_pop($mxdValue); break; case 2: if (isset($mxdValue['operator'])) { $fieldOperator = $mxdValue['operator']; unset($mxdValue['operator']); $fieldValue = array_pop($mxdValue); } else { // use the first element of the array as its operator $fieldOperator = array_shift($mxdValue); // use the 2nd element of the array as its value $fieldValue = array_shift($mxdValue); } break; default: continue; break; } } } if ($fieldValue == '') { continue; } $objSelect->where("{$fieldName} {$fieldOperator} ?", $fieldValue); } } } $objIterator = $objApp->getIterator($objSelect); return $objIterator; }
public function verifyAppointment() { $otp = Input::get('otp'); $email = Input::get('email'); $phone = Input::get('phone'); try { $appointment = Appointment::where('otp', '=', $otp)->where('email', '=', $email)->where('phone', '=', $phone)->firstOrFail(); $appointment->verified = 1; $appointment->save(); return Response::data($appointment); } catch (ModelNotFoundException $e) { return Response::invalid(); } }
public function getdataAction() { $this->view->disable(); if ($this->request->isPost()) { $infos = $this->request->getPost(); $appointment = new Appointment(); $appointment->custName = $infos['res_custName']; $appointment->mobile = $infos['res_mobile']; $appointment->telephone = $infos['res_telephone']; $appointment->email = $infos['res_email']; $appointment->postcode = $infos['res_postcode']; $appointment->custsex = $infos['res_custSex']; $appointment->address = $infos['res_address']; $appointment->type = 0; $appointment->time = time(); if ($appointment->save()) { echo true; } else { echo false; } } else { $this->response->redirect("index/index"); } }
public function run() { User::create(['id' => 1, 'cedula' => '1014777780', 'name' => 'Administrador', 'password' => \Hash::make('1014777780'), 'email' => 'admin@mansion_mascota.com', 'phone' => '2621244', 'type' => 'admin']); User::create(['id' => 2, 'cedula' => '0812757578', 'name' => 'Usuario de pruebas', 'password' => \Hash::make('0812757578'), 'email' => 'test@mansion_mascota.com', 'phone' => '2621244', 'type' => 'admin']); $faker = Faker::create(); foreach (range(1, 10) as $index) { $user = User::create(['cedula' => $faker->randomNumber(10), 'name' => $faker->name, 'password' => \Hash::make('123456'), 'email' => $faker->email, 'phone' => $faker->phoneNumber, 'type' => 'user']); foreach (range(1, $faker->numberBetween(1, 2)) as $date) { $pet = Pet::create(['user_id' => $user->id, 'name' => $faker->firstName(), 'type' => $faker->randomElement(['perro', 'gato', 'pajaro', 'otro'])]); } foreach (range(1, $faker->numberBetween(1, 3)) as $date) { Appointment::create(['user_id' => $user->id, 'pet_id' => $pet->id, 'date' => $faker->dateTimeBetween('now', '+3 months'), 'note' => $faker->text(100 + $faker->numberBetween(10, 150))]); } } }
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')); }
private function getDataById($id) { $data = []; $client = Client::model()->findByPk($id); if ($client) { $data[] = ['label' => 'Client: ' . $client->getFullName(), 'value' => $client->getFullName(), 'url' => $this->createUrl('client/update', ['id' => $client->cli_id])]; } $instruction = Deal::model()->findByPk($id); if ($instruction) { $data[] = ['label' => 'Instruction: ' . $instruction->title, 'value' => $instruction->title, 'url' => $this->createUrl('instruction/summary', ['id' => $instruction->dea_id])]; } /** @var Appointment $appointment */ $appointment = Appointment::model()->with('user')->findByPk($id); if ($appointment) { $data[] = ['label' => $appointment->app_type . ': ' . Date::formatDate('d/m H:i', $appointment->app_start) . ' ' . $appointment->user->getFullName(), 'value' => $instruction->title, 'url' => $this->createUrl('instruction/update', ['id' => $instruction->dea_id])]; } return $data; }
public static function transactions($center, $member) { if ($centre_id == NULL) { $where = array("organization_id = ?" => $member->organization_id); } else { $where = array("organization_id = ?" => $member->organization_id, "centre_id = ?" => $center); } $appointments = \Appointment::all($where); $result = []; if ($member->designation == 'admin') { return $appointments; } if (!$center) { throw new \Exception("Invalid Arguments supplied", 1); } foreach ($appointments as $a) { if ($a->centre_id == $center) { $result[] = $a; } } return $result; }
/** * @before _secure */ public function index() { $this->seo(array("title" => "Appointments Scheduled", "view" => $this->getLayoutView())); $view = $this->getActionView(); $appointments = array(); $page = RequestMethods::get("page", 1); $limit = RequestMethods::get("limit", 10); $count = Appointment::count(array("user_id" => $this->user->id)); $as = Appointment::all(array("user_id =?" => $this->user->id, "live = ?" => 1), array("id", "service_id", "start", "end", "patient_id"), "start", "asc", $limit, $page); foreach ($as as $a) { $service = Service::first(array("id = ?" => $a->service_id), array("property", "property_id", "organization_id", "charge")); $organization = Organization::first(array("id = ?" => $service->organization_id), array("id", "name")); $model = ucfirst($service->property); $item = $model::first(array("id = ?" => $service->property_id), array("title")); $patient = User::first(array("id = ?" => $a->patient_id), array("name")); array_push($appointments, array("item" => $item->title, "organization_id" => $organization->id, "organization_name" => $organization->name, "patient" => $patient->name, "start" => $a->start, "end" => $a->end, "id" => $a->id, "charge" => $service->charge)); } $view->set("appointments", $appointments); $view->set("page", $page); $view->set("limit", $limit); $view->set("count", $count); }
protected function doJob($arg) { $tomorrow = strtotime("+ 12 day", strtotime(date('Y-m-d H:i:s'))); $mAppointment = Appointment::model()->findAll(array('condition' => 't.date_appointment < "' . date('Y-m-d H:i:s', $tomorrow) . '" AND t.date_appointment > "' . date('Y-m-d H:i:s') . '"', 'order' => 't.date_appointment ASC')); if (count($mAppointment) > 0) { foreach ($mAppointment as $eApp) { foreach ($eApp->bookings as $booking) { if ($booking->email_reminded == 0) { //send email notification to doctor $modelEmailTemplate = EmailTemplates::model()->findByPk(8); $dataEmail = array($booking->appointment->users->first_name . ' ' . $booking->appointment->users->last_name, $booking->user->first_name . ' ' . $booking->user->last_name, $booking->user->email, $booking->user->phone, date('l, d M Y, g:i A', strtotime($booking->appointment->date_appointment)), $booking->id, $booking->user->first_name . ' ' . $booking->user->last_name); $pattern = array('{DOCTOR_NAME}', '{PATIENT_NAME}', '{PATIENT_EMAIL}', '{PATIENT_PHONE}', '{DATE_APPOINTMENT}', '{BOOKING_ID}', '{BOOKING_NAME}'); $message = str_replace($pattern, $dataEmail, $modelEmailTemplate->email_body); $subject = $modelEmailTemplate->email_subject; $data = array('subject' => $subject, 'params' => array('message' => $message), 'view' => 'message', 'to' => $booking->appointment->users->email, 'from' => Yii::app()->params['autoEmail']); CmsEmail::mail($data); //send email notification to patient $modelEmailTemplate = EmailTemplates::model()->findByPk(7); $dataEmail = array($booking->appointment->users->first_name . ' ' . $booking->appointment->users->last_name, $booking->user->first_name . ' ' . $booking->user->last_name, $booking->appointment->users->doctors->main_specialty, date('l, d M Y, g:i A', strtotime($booking->appointment->date_appointment)), $booking->id, $booking->appointment->address->address); $pattern = array('{DOCTOR_NAME}', '{PATIENT_NAME}', '{DOCTOR_SPECIALTY}', '{DATE_APPOINTMENT}', '{BOOKING_ID}', '{DOCTOR_ADDRESS}'); $message = str_replace($pattern, $dataEmail, $modelEmailTemplate->email_body); $subject = $modelEmailTemplate->email_subject; $data = array('subject' => $subject, 'params' => array('message' => $message), 'view' => 'message', 'to' => $booking->user->email, 'from' => Yii::app()->params['autoEmail']); CmsEmail::mail($data); $booking->email_reminded = 1; $booking->update(array('email_reminded')); $this->index++; //count email is sent for current cron job if ($this->index >= $this->max) { break; } } } } } else { return; } }
public function actionView($id) { /** @var $model Appointment */ $model = Appointment::model()->findByPk($id); if (!$model) { throw new CHttpException(404, 'Appointment [id = ' . $id . '] is not found.'); } if (isset($_POST['delete'])) { $model->deactivate(); $this->redirect(['View', 'id' => $model->app_id]); } if (isset($_POST['restore'])) { $model->activate(); $this->redirect(['View', 'id' => $model->app_id]); } if (isset($_POST['Appointment']) && $_POST['Appointment']) { $model->attributes = $_POST['Appointment']; if ($_POST['startDay']) { $model->app_start = Date::formatDate("Y-m-d", $_POST['startDay']); } if ($_POST['startTime']) { $model->app_start = date("Y-m-d H:i:s", strtotime($model->app_start . " " . $_POST['startTime'])); } if ($_POST['endDay']) { $model->app_end = Date::formatDate("Y-m-d", $_POST['endDay']); } if ($_POST['endTime']) { $model->app_end = date("Y-m-d H:i:s", strtotime($model->app_end . " " . $_POST['endTime'])); } if ($model->save()) { Yii::app()->user->setFlash('appointment-success', 'Updated!'); $this->redirect(['View', 'id' => $model->app_id]); } } $this->render('view', compact('model')); }
public static function addAppointment($customerID) { $info = Session::get('appointmentInfo'); Appointment::create(array('customer_id' => $customerID, 'appointment_type' => $info['package_id'], 'appointment_datetime' => $info['datetime'])); }
include 'MembersCtrl.php'; include 'src/Appointment.php'; if (isset($_POST['submit'])) { $data = array('name' => $_POST['name'], 'address' => $_POST['address'], 'age' => $_POST['age'], 'gender' => $_POST['gender'], 'hospital' => $_POST['hospital'], 'speciality' => $_POST['speciality'], 'appointment' => $_POST['appointment'], 'date' => $_POST['date'], 'time' => $_POST['time'], 'phone' => $_POST['phone'], 'doctor' => $_POST['doctor'], 'age' => $_POST['age'], 'gender' => $_POST['gender'], 'address' => $_POST['address']); $pass = true; foreach ($data as $var => $value) { if (empty($value)) { echo $var . " is empty!"; $pass = false; break; } } if ($pass) { $dbo = new DBConnection(); $db = $dbo->connect(); $appointment = new Appointment(); $appointment->setDB($db); $appointment->setPatientUser($data['name']); $appointment->setDoctor($data['doctor']); $appointment->setDate($data['date']); $appointment->setTime($data['time']); $appointment->setSpeciality($data['speciality']); $appointment->setAppointmentType($data['appointment']); $appointment->setHospital($data['hospital']); $appointment->setMobile($data['phone']); $appointment->setAge($data['age']); $appointment->setGender($data['gender']); $appointment->setCurrentUser($members->getSessionUser()); $appointment->setCurrentAddress($data['address']); if ($appointment->verification()) { $appointment->insert();
/** * Show the form for creating a new labtest * * @return Response */ public function create() { $appointment = Appointment::find(Input::get('id')); return View::make('labtests.create', compact('appointment')); }
<?php ob_start(); ini_set('display_errors', 1); error_reporting(E_ALL); $path = $_SERVER['DOCUMENT_ROOT'] . "/path.php"; require_once $path; include 'header.php'; require_once $config; include '../classes/login-functions.php'; include 'includes/appointment.php'; //class file calling from attorney panel $functions = new Appointment(); if (loggedin()) { /*Class file to call the functions*/ ?> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <link href="<?php echo $sitepath; ?> /calend/jquery.datepick.css" rel="stylesheet"> <script src="<?php echo $sitepath; ?> /calend/jquery.plugin.js"></script> <script src="<?php echo $sitepath; ?> /calend/jquery.datepick.js"></script> <script> $(function() {
case "getAppointments": echo Appointment::getCalendarAllAppointmentsOnTerm($_GET["termId"]); break; case "getAppointmentsForTutor": echo Appointment::getCalendarSingleTutorAppointments($_GET["tutorId"], $_GET["termId"]); break; case "getAppointmentsWithCourse": echo Appointment::getCalendarAllAppointmentsForTutorsTeachingOnTerm($_GET["courseId"], $_GET["termId"]); break; case "getPendingAppointments": echo Appointment::getPendingAppointments($_GET["termId"]); break; case "getPendingAppointmentsWithCourse": echo Appointment::getPendingAppointmentsWithCourse($_GET["courseId"], $_GET["termId"]); break; case "getPendingAppointWithCourseAndTutor": echo Appointment::getPendingAppointmentsWithCourseAndTutor($_GET["tutorId"], $_GET["courseId"], $_GET["termId"]); break; case "getAppointmentWithCourseAndTutor": echo Appointment::getAppointmentsForCourseAndTutor($_GET["tutorId"], $_GET["courseId"], $_GET["termId"]); break; } } else { header("Location: /error-403"); exit; } //Function to check if the request is an AJAX request function is_ajax() { return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'; }