コード例 #1
0
ファイル: scheduleLog.php プロジェクト: princemaw/iHospital
 public function createSchedule()
 {
     $date = $this->startDate;
     $morning = scheduleLog::getCheckedArray(substr($this->diagDateList, 0, 7));
     $afternoon = scheduleLog::getCheckedArray(substr($this->diagDateList, 7, 7));
     while (strtotime($date) <= strtotime($this->endDate)) {
         $dayOfWeek = date("w", strtotime($date));
         if ($morning[$dayOfWeek]) {
             schedule::storeSchedule($this->scheduleLogId, $date, 'morning');
         }
         if ($afternoon[$dayOfWeek]) {
             schedule::storeSchedule($this->scheduleLogId, $date, 'afternoon');
         }
         // next date
         $date = date("Y-m-d", strtotime("+1 day", strtotime($date)));
     }
 }
コード例 #2
0
ファイル: appointment.php プロジェクト: princemaw/iHospital
 public static function newAppointmentByDoctor($input, $doctorId, $patientId)
 {
     $newDiagDate = scheduleLog::changeDateFormat($input['nextAppDate']);
     $schedule = schedule::join('scheduleLog', 'schedule.scheduleLogId', '=', 'scheduleLog.scheduleLogId')->where('scheduleLog.doctorId', $doctorId)->where('schedule.diagDate', $newDiagDate)->where('schedule.diagTime', $input['nextAppTime'])->first();
     if ($schedule != null) {
         $appointment = new appointment();
         $appointment->patientId = $patientId;
         $appointment->scheduleId = $schedule->scheduleId;
         $appointment->symptom = $input['nextAppDetail'];
         $appointment->save();
     }
     return $schedule;
 }
コード例 #3
0
 public function importScheduleStore(Request $request)
 {
     $input = $request->all();
     $input['staffId'] = Auth::user()->userId;
     $scheduleLog = scheduleLog::importSchedule($input);
 }
コード例 #4
0
ファイル: schedule.php プロジェクト: princemaw/iHospital
 public static function requestDate($input)
 {
     // get appointment from a department or a doctor
     if ($input['doctorId'] != '0') {
         $doctor = doctor::where('userId', $input['doctorId'])->first();
         $schedule = $doctor->schedules()->join('users', 'scheduleLog.doctorId', '=', 'users.userId');
     } else {
         if ($input['departmentId'] != '0') {
             $schedule = schedule::join('scheduleLog', 'schedule.scheduleLogId', '=', 'scheduleLog.scheduleLogId')->join('doctor', 'scheduleLog.doctorId', '=', 'doctor.userId')->join('hospitalStaff', 'doctor.userId', '=', 'hospitalStaff.userId')->join('users', 'hospitalStaff.userId', '=', 'users.userId')->join('department', 'hospitalStaff.departmentId', '=', 'department.departmentId')->where('department.departmentId', $input['departmentId']);
         }
     }
     // get appointment from specific date or choose only the fastest appointment
     if ($input['date'] == '') {
         $appointments = $schedule->where('diagDate', '>', Carbon::now())->orderBy('diagDate', 'asc')->orderBy('diagTime', 'asc')->orderBy('name', 'asc')->orderBy('surname', 'asc')->take(10)->get();
     } else {
         $input['date'] = scheduleLog::changeDateFormat($input['date']);
         $appointments = $schedule->where('diagDate', $input['date'])->orderBy('diagTime', 'asc')->orderBy('name', 'asc')->orderBy('surname', 'asc')->get();
     }
     return $appointments;
 }