AppointmentService.php 914 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace app\admin\service\statistics;
  3. use app\model\Appointment;
  4. use support\Db;
  5. class AppointmentService
  6. {
  7. public static function getAppointment()
  8. {
  9. // 待确认
  10. $data['waiting'] = Appointment::where('appointment_status', 'WAITING')->count('appointment_id');
  11. // 待服务
  12. $data['append'] = Appointment::where('appointment_status', 'PENDING')->count('appointment_id');
  13. // 今日预约
  14. $data['todayAppointment'] = Appointment::where('appointment_datetime', date('Y-m-d'))->count('appointment_id');
  15. // 今日服务
  16. $today = Db::select("select service_time,count(*) as total from (select left(appointment_doing_datetime,10) as service_time from app_appointment where appointment_status = 'DONE') as appointment where service_time ='".date('Y-m-d')."'");
  17. $data['todayService'] = $today[0]->total;
  18. return $data;
  19. }
  20. }