|
@@ -46,49 +46,29 @@ class OrderVaccinesController extends AdminController
|
|
return $order_status_arr[intval($original)];
|
|
return $order_status_arr[intval($original)];
|
|
} );
|
|
} );
|
|
});
|
|
});
|
|
-// $grid->model()->orderByDesc('orders.id');
|
|
|
|
- DB::enableQueryLog();
|
|
|
|
-
|
|
|
|
- if(!empty($res['orderPatient']['appoint_start_time']['start']) || !empty($res['orderPatient']['appoint_start_time']['start']) ){
|
|
|
|
- $grid->model()->leftJoin('order_patients','order_patients.order_id','=','orders.id')->orderByDesc('order_patients.appoint_start_time');
|
|
|
|
- } else {
|
|
|
|
|
|
|
|
- $grid->model()->leftJoin('order_patients','order_patients.order_id','=','orders.id')->orderBy('order_patients.appoint_start_time');
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-// select bm_orders.*,bm_order_patients.appoint_end_time,bm_order_patients.appoint_start_time,bm_order_patients.name from `bm_orders`
|
|
|
|
-//left join `bm_order_patients` on `bm_order_patients`.`order_id` = `bm_orders`.`id` ORDER BY bm_order_patients.appoint_start_time asc;
|
|
|
|
-
|
|
|
|
-//
|
|
|
|
-// $grid->model()->leftJoin('order_patients','order_patients.order_id','=','orders.id')
|
|
|
|
-// ->orderByDesc('order_patients.appoint_start_time');
|
|
|
|
-// $grid->model()->orderByDesc('orders.idaa');
|
|
|
|
|
|
+ DB::enableQueryLog();
|
|
|
|
|
|
|
|
|
|
$user = Admin::user();
|
|
$user = Admin::user();
|
|
$is_admin = Admin::user()->inRoles(['administrator','devloper']);
|
|
$is_admin = Admin::user()->inRoles(['administrator','devloper']);
|
|
-
|
|
|
|
-
|
|
|
|
- $is_docter = $user->docter_id;
|
|
|
|
$where = ['product_type'=>4];
|
|
$where = ['product_type'=>4];
|
|
if(!$is_admin){
|
|
if(!$is_admin){
|
|
$org_id = $user->org_id;
|
|
$org_id = $user->org_id;
|
|
$where = ['product_type'=>4,'orders.organization_id'=>$org_id];
|
|
$where = ['product_type'=>4,'orders.organization_id'=>$org_id];
|
|
-// if($is_docter) {
|
|
|
|
-// $where['docter_id'] = Docter::where(['id'=>$user->docter_id])->value('id');
|
|
|
|
-// }
|
|
|
|
}
|
|
}
|
|
- $grid->model()->where($where)->leftJoin('order_patients','order_patients.order_id','=','orders.id')->where('product_type',4)->orderBy('order_patients.appoint_start_time','desc');
|
|
|
|
- // ->select(['order_id','appoint_start_time']);
|
|
|
|
|
|
+ $grid->model()->where($where)->leftJoin('order_patients','order_patients.order_id','=','orders.id');
|
|
|
|
+ if(!empty($res['orderPatient']['appoint_start_time']['start']) || !empty($res['orderPatient']['appoint_start_time']['start']) ){
|
|
|
|
+ $grid->model()->orderBy('order_patients.appoint_start_time','asc');
|
|
|
|
+ } else {
|
|
|
|
+ $grid->model()->orderBy('order_patients.appoint_start_time','desc');
|
|
|
|
+ }
|
|
|
|
|
|
$grid->column('order_id', __('Id'));
|
|
$grid->column('order_id', __('Id'));
|
|
$grid->column('user.nickname', __('预约用户'));
|
|
$grid->column('user.nickname', __('预约用户'));
|
|
-// $grid->column('yuyue', __('预约时间'))->display(function ($w){
|
|
|
|
-// if(empty($this->orderPatient) || empty($this->orderPatient->appoint_start_time)) return '';
|
|
|
|
-// return date('Y-m-d H:i',($this->orderPatient->appoint_start_time)) .'致' . date('H:i',($this->orderPatient->appoint_end_time));
|
|
|
|
-// });
|
|
|
|
|
|
+
|
|
$grid->column('appoint_start_time', __('预约时间'))->display(function ($w){
|
|
$grid->column('appoint_start_time', __('预约时间'))->display(function ($w){
|
|
- // if(empty($this->orderPatient) || empty($this->orderPatient->appoint_start_time)) return '';
|
|
|
|
|
|
+ if(empty($this->orderPatient) || empty($this->orderPatient->appoint_start_time)) return '';
|
|
return date('Y-m-d H:i',$w).'~'.date('H:i',$this->appoint_end_time);
|
|
return date('Y-m-d H:i',$w).'~'.date('H:i',$this->appoint_end_time);
|
|
});
|
|
});
|
|
|
|
|