Пример #1
0
 public function getDiagStats($year, $month)
 {
     $schedules = schedule::diagDateInRange($year, $month)->join('scheduleLog', 'schedule.scheduleLogId', '=', 'scheduleLog.scheduleLogId')->join('doctor', 'scheduleLog.doctorId', '=', 'doctor.userId')->where('doctor.userId', '=', $this->userId)->where('schedule.diagDate', '<', Carbon::now())->orderBy('diagDate')->get();
     $i = -1;
     $lastDate = '';
     $results = array();
     foreach ($schedules as $s) {
         $schedule = schedule::where('scheduleId', $s['scheduleId'])->first();
         if ($s->diagDate != $lastDate) {
             $i++;
             $results[$i]['morning'] = '-';
             $results[$i]['afternoon'] = '-';
             $results[$i]['sum'] = 0;
             $results[$i]['date'] = $schedule['diagDate'];
             $lastDate = $s->diagDate;
         }
         $patientNo = $schedule->patientsAmount();
         $results[$i][$s->getOriginal('diagTime')] = $patientNo;
         $results[$i]['sum'] += $patientNo;
     }
     $results['sum']['date'] = 'รวม';
     $results['sum']['morning'] = 0;
     $results['sum']['afternoon'] = 0;
     foreach ($results as $date) {
         if ($date['morning'] != '-') {
             $results['sum']['morning'] += $date['morning'];
         }
         if ($date['afternoon'] != '-') {
             $results['sum']['afternoon'] += $date['afternoon'];
         }
     }
     $results['sum']['sum'] = $results['sum']['morning'] + $results['sum']['afternoon'];
     return $results;
 }
Пример #2
0
 public function testfunc()
 {
     echo '<!DOCTYPE html> <meta charset="utf-8">';
     $pp = patient::where('userId', 3)->first();
     $app = appointment::where('appointmentId', 1)->first();
     $doc = doctor::where('userId', 4)->first();
     $schedule = schedule::where('scheduleId', 1)->first();
     $dep = department::where('departmentId', 2)->first();
     // $doc->getScheduleInRange(2015, 12);
     $results = $doc->getDiagStats(2015, 12);
     foreach ($results as $date) {
         echo $date['date'] . ' ' . $date['morning'] . ' ' . $date['afternoon'] . ' ' . $date['sum'] . '<br>';
     }
     // return view('testSearch')->with('patient', $pp)->with('ap', $app)->with('doctor', $doc)->with('sc', $schedule)->with('idd', $schedule->scheduleId)->with('department', $dep);
 }
Пример #3
0
 public function confirmReappointmentByStaffShow(Request $request)
 {
     $input = $request->all();
     $appointment = appointment::where('appointmentId', $input['appointmentId'])->first();
     $schedule = schedule::where('scheduleId', $input['scheduleId'])->first();
     return view('staff.confirmReAppointmentByStaff')->with('appointment', $appointment)->with('schedule', $schedule);
 }