| xqd
@@ -46,50 +46,31 @@ class OrderVaccinesController extends AdminController
|
|
|
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')->orderBy('order_patients.appoint_start_time');
|
|
|
- } else {
|
|
|
-
|
|
|
- $grid->model()->leftJoin('order_patients','order_patients.order_id','=','orders.id')->orderByDesc('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();
|
|
|
$is_admin = Admin::user()->inRoles(['administrator','devloper']);
|
|
|
-
|
|
|
-
|
|
|
- $is_docter = $user->docter_id;
|
|
|
$where = ['product_type'=>4];
|
|
|
if(!$is_admin){
|
|
|
$org_id = $user->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');
|
|
|
-// }
|
|
|
+ $where = ['product_type'=>4,'organization_id'=>$org_id];
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!empty($res['orderPatient']['appoint_start_time']['start']) || !empty($res['orderPatient']['appoint_start_time']['start']) ){
|
|
|
+ $grid->model()->where($where)->leftJoin('order_patients','order_patients.order_id','=','orders.id')
|
|
|
+ ->where('product_type',4)->orderBy('order_patients.appoint_start_time','asc');
|
|
|
+ } else {
|
|
|
+ $grid->model()->where($where)->leftJoin('order_patients','order_patients.order_id','=','orders.id')
|
|
|
+ ->where('product_type',4)->orderBy('order_patients.appoint_start_time','desc');
|
|
|
}
|
|
|
- $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->column('order_id', __('Id'));
|
|
|
$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){
|
|
|
- // 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);
|
|
|
});
|
|
|
|
| xqd
@@ -110,7 +91,6 @@ class OrderVaccinesController extends AdminController
|
|
|
return implode(',',$vaccine_name);
|
|
|
|
|
|
});
|
|
|
-// $grid->column('docter.name', __('排班医生'));
|
|
|
$status_arr = Order::getStatus();
|
|
|
$grid->column('order_status', __('订单状态'))->display(function ($w) use ($status_arr) {
|
|
|
$info = $status_arr[intval($w)];
|
| xqd
@@ -126,12 +106,9 @@ class OrderVaccinesController extends AdminController
|
|
|
return '<span class="label label-default">'.$info.'</span>';
|
|
|
}
|
|
|
});
|
|
|
-// $grid->column('payment_status', __('支付状态'))->using(Order::getPayStatus())->label([1=>'warring',2=>'success',3=>'info',4=>'danger']);
|
|
|
-
|
|
|
|
|
|
$grid->filter(function ($filter) {
|
|
|
$filter->column(1/2, function ($filter) {
|
|
|
-// $filter->equal('docter.id','排班医生')->select('/cdms/api/getDocter');
|
|
|
$filter->equal('order_status','订单状态')->select(Order::$_order_status);
|
|
|
$filter->timestampBetween('orderPatient.appoint_start_time','预约时间')->datetime();
|
|
|
});
|
| xqd
@@ -140,16 +117,11 @@ class OrderVaccinesController extends AdminController
|
|
|
$tools->append(new FasteOrder());
|
|
|
});
|
|
|
$grid->actions(function ($actions) {
|
|
|
-// if( $actions->row->order_status<= 2){
|
|
|
-// $actions->add(new Reserved());
|
|
|
-// }
|
|
|
-
|
|
|
if(!empty($actions->row->order_status) && ($actions->row->order_status<= 3 || $actions->row->order_status == 7 ) ){
|
|
|
$actions->add(new Finished());
|
|
|
$actions->add(new OrderCance());
|
|
|
$actions->add(new AddVaccine());
|
|
|
}
|
|
|
-
|
|
|
$actions->disableEdit();
|
|
|
// $actions->disableView();
|
|
|
$actions->disableDelete();
|