| xqd
@@ -49,27 +49,27 @@ class OrderVaccinesController extends AdminController
|
|
|
// $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');
|
|
|
-
|
|
|
-// $grid->model()->whereHas('orderPatient',function($query){
|
|
|
-// $query->orderBy( OrderPatient::select('appoint_start_time')
|
|
|
-// ->whereColumn('order_id', 'orders.id')
|
|
|
-// ->orderBy('appoint_start_time', 'asc'));
|
|
|
-// });
|
|
|
-
|
|
|
-// $grid->model()->whereHas('orderPatient',function($query){
|
|
|
-// $query->orderBy( 'appoint_start_time','asc');
|
|
|
-// });
|
|
|
- } else {
|
|
|
-// $grid->model()->whereHas('orderPatient',function($query){
|
|
|
-// return $query->orderBy('appoint_start_time','desc')->groupBy('appoint_start_time');
|
|
|
-// });
|
|
|
-
|
|
|
- $grid->model()->leftJoin('order_patients','order_patients.order_id','=','orders.id')->orderBy('order_patients.appoint_start_time');
|
|
|
-
|
|
|
- }
|
|
|
+// 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');
|
|
|
+//
|
|
|
+//// $grid->model()->whereHas('orderPatient',function($query){
|
|
|
+//// $query->orderBy( OrderPatient::select('appoint_start_time')
|
|
|
+//// ->whereColumn('order_id', 'orders.id')
|
|
|
+//// ->orderBy('appoint_start_time', 'asc'));
|
|
|
+//// });
|
|
|
+//
|
|
|
+//// $grid->model()->whereHas('orderPatient',function($query){
|
|
|
+//// $query->orderBy( 'appoint_start_time','asc');
|
|
|
+//// });
|
|
|
+// } else {
|
|
|
+//// $grid->model()->whereHas('orderPatient',function($query){
|
|
|
+//// return $query->orderBy('appoint_start_time','desc')->groupBy('appoint_start_time');
|
|
|
+//// });
|
|
|
+//
|
|
|
+// $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;
|
| xqd
@@ -93,18 +93,20 @@ class OrderVaccinesController extends AdminController
|
|
|
// $where['docter_id'] = Docter::where(['id'=>$user->docter_id])->value('id');
|
|
|
// }
|
|
|
}
|
|
|
- $grid->model()->where($where);
|
|
|
+ $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('id', __('Id'));
|
|
|
+ $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('orderPatient.appoint_start_time', __('预约时间'))->display(function ($w){
|
|
|
- if(empty($this->orderPatient) || empty($this->orderPatient->appoint_start_time)) return '';
|
|
|
- return date('Y-m-d H:i',$w).'~'.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 '';
|
|
|
+ return date('Y-m-d H:i',$w).'~'.date('H:i',$this->appoint_end_time);
|
|
|
});
|
|
|
+
|
|
|
$grid->column('end_time', __('接种时间'))->display(function ($w){
|
|
|
if(empty($w)) return '';
|
|
|
return date('Y-m-d',$w);
|