| xqd
@@ -9,12 +9,14 @@ use App\Community\Actions\Vaccine\OrderCance;
|
|
|
use App\Community\Actions\Vaccine\Reserved;
|
|
|
use App\Models\Docter;
|
|
|
use App\Models\Order;
|
|
|
+use App\Models\OrderPatient;
|
|
|
use App\Models\OrderVaccine;
|
|
|
use Encore\Admin\Controllers\AdminController;
|
|
|
use Encore\Admin\Facades\Admin;
|
|
|
use Encore\Admin\Form;
|
|
|
use Encore\Admin\Grid;
|
|
|
use Encore\Admin\Show;
|
|
|
+use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
class OrderVaccinesController extends AdminController
|
|
|
{
|
| xqd
@@ -33,11 +35,27 @@ class OrderVaccinesController extends AdminController
|
|
|
protected function grid()
|
|
|
{
|
|
|
$grid = new Grid(new Order());
|
|
|
+
|
|
|
+ $res = request()->all();
|
|
|
+
|
|
|
$grid->model()->orderByDesc('id');
|
|
|
|
|
|
+ if(!empty($res['orderPatient']['appoint_start_time']['start']) || !empty($res['orderPatient']['appoint_start_time']['start']) ){
|
|
|
+
|
|
|
+ $grid->model()->whereHas('orderPatient',function($query){
|
|
|
+ $query->orderBy( OrderPatient::select('appoint_start_time')
|
|
|
+ ->whereColumn('order_id', 'orders.id')
|
|
|
+ ->orderBy('appoint_start_time', 'asc'));
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ $grid->model()->whereHas('orderPatient',function($query){
|
|
|
+ return $query->orderBy('appoint_start_time','desc')->groupBy('appoint_start_time');
|
|
|
+ });
|
|
|
+ }
|
|
|
$user = Admin::user();
|
|
|
$is_admin = Admin::user()->inRoles(['administrator','devloper']);
|
|
|
|
|
|
+
|
|
|
$is_docter = $user->docter_id;
|
|
|
if(!$is_admin){
|
|
|
$org_id = $user->org_id;
|
| xqd
@@ -52,7 +70,7 @@ class OrderVaccinesController extends AdminController
|
|
|
$grid->column('orderPatient.name', __('预约用户'));
|
|
|
// $grid->column('yuyue', __('预约时间'))->display(function ($w){
|
|
|
// if(empty($this->orderPatient) || empty($this->orderPatient->appoint_start_time)) return '';
|
|
|
-// return date('Y-m-d H:i:s',($this->orderPatient->appoint_start_time)) .'致' . date('Y-m-d H:i:s',($this->orderPatient->appoint_end_time));
|
|
|
+// 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 '';
|