jingyuzhi 4 gadi atpakaļ
vecāks
revīzija
a837e45768
39 mainītis faili ar 1057 papildinājumiem un 97 dzēšanām
  1. 1 1
      app/Admin/Actions/Service/ApplysAction.php
  2. 83 0
      app/Admin/Actions/backstage/Coupon/CouponBatchGrant.php
  3. 19 0
      app/Admin/Actions/backstage/Coupon/CouponDetails.php
  4. 19 0
      app/Admin/Actions/backstage/Coupon/CouponDistribution.php
  5. 103 0
      app/Admin/Controllers/CouponManagement/CouponDetailsController.php
  6. 140 0
      app/Admin/Controllers/CouponManagement/CouponDistributionUserList.php
  7. 142 0
      app/Admin/Controllers/CouponManagement/CouponManagementController.php
  8. 0 1
      app/Admin/Controllers/UserCouponsController.php
  9. 6 0
      app/Admin/routes.php
  10. 67 0
      app/Community/Controllers/ApplyServiceController.php
  11. 11 8
      app/Community/Controllers/DocterChatController.php
  12. 39 4
      app/Community/Controllers/HomeController.php
  13. 56 0
      app/Community/Controllers/NurseServiceController.php
  14. 60 0
      app/Community/Controllers/OrganizationController.php
  15. 104 0
      app/Community/Controllers/ServiceController.php
  16. 4 0
      app/Community/Controllers/UserNoticeController.php
  17. 14 6
      app/Community/Controllers/VaccineController.php
  18. 5 3
      app/Community/Controllers/VaccineUserController.php
  19. 3 0
      app/Community/bootstrap.php
  20. 3 0
      app/Community/routes.php
  21. 3 1
      app/Http/Controllers/Api/V1/CommonController.php
  22. 137 62
      app/Http/Controllers/ScheDuleController.php
  23. 5 0
      app/Models/Serviceapplys.php
  24. 0 0
      public/cdms/assets/css/app.435c7432.css
  25. 0 0
      public/cdms/assets/css/app.6871d772.css
  26. 8 0
      public/cdms/assets/css/chunk-vendors.c9bf45fc.css
  27. 0 0
      public/cdms/assets/js/app.45ed2073.js
  28. 0 0
      public/cdms/assets/js/app.45ed2073.js.map
  29. 0 0
      public/cdms/assets/js/app.df98bf87.js
  30. 0 0
      public/cdms/assets/js/app.df98bf87.js.map
  31. 0 0
      public/cdms/assets/js/chunk-vendors.3a131eeb.js
  32. 0 0
      public/cdms/assets/js/chunk-vendors.3a131eeb.js.map
  33. BIN
      public/cdms/favicon.ico
  34. BIN
      public/img/banner1.png
  35. BIN
      public/img/banner2.png
  36. BIN
      public/img/banner3.png
  37. 1 1
      resources/views/cdms/chat.blade.php
  38. 21 9
      resources/views/cdms/order_detail.blade.php
  39. 3 1
      routes/web.php

+ 1 - 1
app/Admin/Actions/Service/ApplysAction.php

xqd
@@ -18,7 +18,7 @@ class ApplysAction extends RowAction
         Serviceapplys::where('id',$model->id)->update(['status'=>2]);
         $filter = [1=>'is_chat',2=>'is_phone',3=>'is_appoint'];
 
-        Docter::where('id',$model->docter_id)->upd3ate([$filter[$model->service_type]=>1]);
+        Docter::where('id',$model->docter_id)->update([$filter[$model->service_type]=>1]);
 
         return $this->response()->success('审核通过')->refresh();
     }

+ 83 - 0
app/Admin/Actions/backstage/Coupon/CouponBatchGrant.php

xqd
@@ -0,0 +1,83 @@
+<?php
+
+namespace App\Admin\Actions\backstage\Coupon;
+
+use App\Models\Coupon;
+use App\Models\User;
+use App\Models\UserCoupon;
+use Encore\Admin\Actions\BatchAction;
+use Illuminate\Database\Eloquent\Collection;
+use Illuminate\Http\Request;
+
+class CouponBatchGrant extends BatchAction
+{
+    public $name = '优惠券批量发放';
+    public function handle(Collection $collection,Request $request)
+    {
+        $coupon_id = request('id');
+        $user_arr = $collection->toArray();
+        $user_num = count($user_arr);
+        $coupon = Coupon::where('id',$coupon_id)->first();
+        if ($coupon->num < $user_num)
+        {
+            return $this->response()->error('优惠券数量不足')->refresh();
+        }
+        //获取过期类型是指定几天过期
+        if ($coupon->expire_type == 1){
+            $effective_days = $coupon->effective_days;
+            $expire_time = date("Y-m-d H:i:s", strtotime('+'.$effective_days.'day'));
+            $expire_time_num = strtotime($expire_time);
+            $arr = [
+                'user_id' => 0,
+                'coupon_id'=>$coupon_id,
+                'name' => $coupon->name,
+                'title' => $coupon->title,
+                'desc' => $coupon->desc,
+                'rules' => $coupon->rules,
+                'icon' => $coupon->icon,
+                'type' => $coupon->type,
+                'usable_type' => $coupon->usable_type,
+                'money' => $coupon->money,
+                'discount' => $coupon->discount,
+                'min_consume_amount' => $coupon->min_consume_amount,
+                'max_reduce_amount' => $coupon->max_reduce_amount,
+                'expire_type' => $coupon->expire_type,
+                'effective_days' => $coupon->effective_days,
+                'expire_time' => $expire_time_num,
+                'coupons_num'=>0
+            ];
+        }else{
+            $arr = [
+                'user_id' => 0,
+                'coupon_id'=>$coupon_id,
+                'name' => $coupon->name,
+                'title' => $coupon->title,
+                'desc' => $coupon->desc,
+                'rules' => $coupon->rules,
+                'icon' => $coupon->icon,
+                'type' => $coupon->type,
+                'usable_type' => $coupon->usable_type,
+                'money' => $coupon->money,
+                'discount' => $coupon->discount,
+                'min_consume_amount' => $coupon->min_consume_amount,
+                'max_reduce_amount' => $coupon->max_reduce_amount,
+                'expire_type' => $coupon->expire_type,
+                'start_time' => $coupon->start_time,
+                'end_time' => $coupon->end_time,
+                'coupons_num'=>0
+            ];
+        }
+        foreach ($collection as $model) {
+            $arr['user_id'] = $model->id;
+            UserCoupon::insert($arr);
+            $coupon = Coupon::where('id',$coupon_id)->first();
+            Coupon::where('id',$coupon_id)->update(['num'=>$coupon->num-1]);
+        }
+        return $this->response()->success('优惠券发放成功')->refresh();
+    }
+    public function form()
+    {
+        $name = Coupon::pluck('name','id');
+        $this->select('id', '优惠券名称')->options($name);
+    }
+}

+ 19 - 0
app/Admin/Actions/backstage/Coupon/CouponDetails.php

xqd
@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Admin\Actions\backstage\Coupon;
+
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class CouponDetails extends RowAction
+{
+    public $name = '优惠券详情';
+
+    public function handle(Model $model)
+    {
+        // $model ...
+
+        return $this->response()->success('跳转订单详情成功')->redirect('/admin/coupons_details?id='.$this->row->id.'');
+    }
+
+}

+ 19 - 0
app/Admin/Actions/backstage/Coupon/CouponDistribution.php

xqd
@@ -0,0 +1,19 @@
+<?php
+
+namespace App\Admin\Actions\backstage\Coupon;
+
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class CouponDistribution extends RowAction
+{
+    public $name = '优惠券发放';
+
+    public function handle(Model $model)
+    {
+        // $model ...
+
+        return $this->response()->success('跳转订单详情成功')->redirect('/admin/coupon_distribution_user_list?coupon_id='.$this->row->id.'');
+    }
+
+}

+ 103 - 0
app/Admin/Controllers/CouponManagement/CouponDetailsController.php

xqd
@@ -0,0 +1,103 @@
+<?php
+
+namespace App\Admin\Controllers\CouponManagement;
+
+use App\Models\Coupon;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class CouponDetailsController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '优惠券详情';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Coupon());
+
+        $grid->column('id', __('Id'));
+        $grid->column('name', __('券名称'));
+        $grid->column('title', __('券标题'));
+        $grid->column('desc', __('使用说明'))->limit(20,'...');
+        $grid->column('rules', __('使用规则'))->limit(20,'...');
+        $grid->column('min_consume_amount', __('最低消费金额'))->display(function ($money){
+            return $money/100;
+        });
+        $grid->column('max_reduce_amount', __('折扣券的最大抵扣金额'))->display(function ($money){
+            return $money/100;
+        });
+
+        return $grid;
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        $show = new Show(Coupon::findOrFail($id));
+
+        $show->field('id', __('Id'));
+        $show->field('name', __('Name'));
+        $show->field('title', __('Title'));
+        $show->field('desc', __('Desc'));
+        $show->field('rules', __('Rules'));
+        $show->field('icon', __('Icon'));
+        $show->field('type', __('Type'));
+        $show->field('usable_type', __('Usable type'));
+        $show->field('money', __('Money'));
+        $show->field('discount', __('Discount'));
+        $show->field('min_consume_amount', __('Min consume amount'));
+        $show->field('max_reduce_amount', __('Max reduce amount'));
+        $show->field('expire_type', __('Expire type'));
+        $show->field('effective_days', __('Effective days'));
+        $show->field('start_time', __('Start time'));
+        $show->field('end_time', __('End time'));
+        $show->field('created_at', __('Created at'));
+        $show->field('updated_at', __('Updated at'));
+
+        return $show;
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        $form = new Form(new Coupon());
+
+        $form->text('name', __('Name'));
+        $form->text('title', __('Title'));
+        $form->text('desc', __('Desc'));
+        $form->text('rules', __('Rules'));
+        $form->text('icon', __('Icon'));
+        $form->switch('type', __('Type'));
+        $form->switch('usable_type', __('Usable type'));
+        $form->number('money', __('Money'));
+        $form->decimal('discount', __('Discount'))->default(0.00);
+        $form->number('min_consume_amount', __('Min consume amount'));
+        $form->number('max_reduce_amount', __('Max reduce amount'));
+        $form->switch('expire_type', __('Expire type'));
+        $form->number('effective_days', __('Effective days'));
+        $form->number('start_time', __('Start time'));
+        $form->number('end_time', __('End time'));
+
+        return $form;
+    }
+}

+ 140 - 0
app/Admin/Controllers/CouponManagement/CouponDistributionUserList.php

xqd
@@ -0,0 +1,140 @@
+<?php
+
+namespace App\Admin\Controllers\CouponManagement;
+
+use App\Admin\Actions\backstage\Coupon\CouponBatchGrant;
+use App\Models\User;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class CouponDistributionUserList extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '优惠券发放用户列表';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new User());
+        $coupon_id = request('coupon_id');
+        $grid->filter(function($filter){
+            // 去掉默认的id过滤器
+            $filter->disableIdFilter();
+            $filter->equal('phone','手机')->mobile()->placeholder("请输入手机");
+            $filter->like('patient.name','患者姓名')->placeholder("请输入患者姓名");
+            $filter->like('nickname','昵称');
+            $filter->equal('status','用户状态')->radio([
+                ''   => '不限',
+                0    => '黑名单',
+                1    => '正常',
+            ]);
+            $filter->equal('is_pack','用户状态')->radio([
+                ''   => '全部用户',
+                0    => '普通用户',
+                1    => '服务包用户',
+            ]);
+        });
+        $grid->batchActions(function ($batch) {
+            $batch->add(new CouponBatchGrant($_GET['coupon_id']));
+        });
+        $grid->actions(function ($actions) {
+            // 去掉删除
+            $actions->disableDelete();
+            // 去掉编辑
+            $actions->disableEdit();
+            // 去掉查看
+            $actions->disableView();
+        });
+        $grid ->model()->where('status','>=','0');
+        $grid->column('id', __('用户id'))->sortable();
+        $grid->column('nickname', __('用户名'));
+        $grid->column('sex', __('性别'))->using([0=>'未知',1=>'男',2=>'女']);
+        $grid->column('age', __('年龄'));
+        $grid->column('status', __('状态'))->using([0=>'黑名单',1=>'正常',]);
+        $grid->column('is_pack', __('用户身份'))->using([0=>'普通用户',1=>'付费用户']);
+        $grid->column('balance', __('当前余额'))->display(function ($price){
+            return $price/100;
+        });
+        $grid->column('created_at', __('注册时间'));
+        $grid->column('last_login_time', __('最后登录时间'))->display(function ($time){
+            return date("Y-m-d H:i",$time);
+        });
+//            $grid->column('patient', __('患者姓名'))->pluck('name')->map('ucwords')->implode(',');
+        $grid->column('patient', __('患者姓名'))->pluck('name')->label('default');
+        return $grid;
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        $show = new Show(User::findOrFail($id));
+
+        $show->field('id', __('Id'));
+        $show->field('nickname', __('Nickname'));
+        $show->field('phone', __('Phone'));
+        $show->field('sex', __('Sex'));
+        $show->field('avatar', __('Avatar'));
+        $show->field('openid', __('Openid'));
+        $show->field('remark', __('Remark'));
+        $show->field('birthday', __('Birthday'));
+        $show->field('status', __('Status'));
+        $show->field('balance', __('Balance'));
+        $show->field('giving_balance', __('Giving balance'));
+        $show->field('topup_balance', __('Topup balance'));
+        $show->field('session_key', __('Session key'));
+        $show->field('pay_password', __('Pay password'));
+        $show->field('latitude', __('Latitude'));
+        $show->field('longitude', __('Longitude'));
+        $show->field('is_pack', __('Is pack'));
+        $show->field('last_login_time', __('Last login time'));
+        $show->field('created_at', __('Created at'));
+        $show->field('updated_at', __('Updated at'));
+
+        return $show;
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        $form = new Form(new User());
+
+        $form->text('nickname', __('Nickname'));
+        $form->mobile('phone', __('Phone'));
+        $form->switch('sex', __('Sex'));
+        $form->image('avatar', __('Avatar'));
+        $form->text('openid', __('Openid'));
+        $form->text('remark', __('Remark'));
+        $form->text('birthday', __('Birthday'));
+        $form->switch('status', __('Status'))->default(1);
+        $form->number('balance', __('Balance'));
+        $form->number('giving_balance', __('Giving balance'));
+        $form->number('topup_balance', __('Topup balance'));
+        $form->text('session_key', __('Session key'));
+        $form->text('pay_password', __('Pay password'));
+        $form->decimal('latitude', __('Latitude'))->default(0.0000000);
+        $form->decimal('longitude', __('Longitude'))->default(0.0000000);
+        $form->switch('is_pack', __('Is pack'));
+        $form->number('last_login_time', __('Last login time'));
+
+        return $form;
+    }
+}

+ 142 - 0
app/Admin/Controllers/CouponManagement/CouponManagementController.php

xqd
@@ -0,0 +1,142 @@
+<?php
+
+namespace App\Admin\Controllers\CouponManagement;
+
+use App\Admin\Actions\backstage\Coupon\CouponDetails;
+use App\Admin\Actions\backstage\Coupon\CouponDistribution;
+use App\Models\Coupon;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class CouponManagementController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '优惠券管理';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Coupon());
+
+        $grid->actions(function ($actions) {
+            $actions->disableView();
+            $actions->add(new CouponDetails());
+            if($actions->row->position_type == 2 )
+            {
+                $actions->add(new CouponDistribution());
+            }
+        });
+
+        $grid->column('id', __('Id'));
+        $grid->column('name', __('劵名称'));
+        $grid->column('title', __('劵标题'));
+        $grid->column('icon', __('券图标'))->image();
+        $grid->column('type', __('类型'))->using([1=>'满减券',2=>'折扣券']);
+        $grid->column('usable_type', __('可用类型'))->using([1=>'全部产品通用',2=>'部分产品可用']);
+        $grid->column('money', __('满减券的优惠钱数'))->display(function ($money){
+            return $money/100;
+        });
+        $grid->column('discount', __('折扣'));
+        $grid->column('position_type', __('发放平台'))->using([1=>'领券中心',2=>'后台发放']);
+        $grid->column('num', __('数量'));
+        $grid->column('effective_days', __('有效天数'));
+        $grid->column('start_time', __('有效期开始时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
+        $grid->column('end_time', __('有效期结束时间'))->display(function ($time){
+            return date('Y-m-d H:i:s',$time);
+        });
+        return $grid;
+    }
+
+    /**
+     * Make a show builder.
+     *
+     * @param mixed $id
+     * @return Show
+     */
+    protected function detail($id)
+    {
+        $show = new Show(Coupon::findOrFail($id));
+
+        $show->field('id', __('Id'));
+        $show->field('name', __('Name'));
+        $show->field('title', __('Title'));
+        $show->field('desc', __('Desc'));
+        $show->field('rules', __('Rules'));
+        $show->field('icon', __('Icon'));
+        $show->field('type', __('Type'));
+        $show->field('usable_type', __('Usable type'));
+        $show->field('money', __('Money'));
+        $show->field('discount', __('Discount'));
+        $show->field('min_consume_amount', __('Min consume amount'));
+        $show->field('max_reduce_amount', __('Max reduce amount'));
+        $show->field('expire_type', __('Expire type'));
+        $show->field('effective_days', __('Effective days'));
+        $show->field('start_time', __('Start time'));
+        $show->field('end_time', __('End time'));
+        $show->field('created_at', __('Created at'));
+        $show->field('updated_at', __('Updated at'));
+
+        return $show;
+    }
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        $form = new Form(new Coupon());
+
+        $form->text('name', __('优惠券名称'));
+        $form->text('title', __('券标题'));
+        $form->text('desc', __('使用说明'));
+        $form->text('rules', __('使用规则'));
+        $form->image('icon', __('券图标'));
+        $form->select('type', '类型')
+            ->options([
+                1 => '满减券',
+                2 => '折扣券',
+            ])->when(1, function (Form $form) {
+                $form->text('money', '满减券的优惠钱数');
+                $form->text('min_consume_amount', '最低消费金额');
+            })->when(2, function (Form $form) {
+                $form->text('discount', '折扣');
+                $form->text('max_reduce_amount', '折扣券的最大抵扣金额');
+            });
+        $form->select('position_type',__('发放平台'))->options([1=>'领券中心',2=>'后台发放']);
+        $form->number('num', __('数量'));
+        $form->select('usable_type',__('可用类型'))->options([1=>'全部产品通用',2=>'部分产品可用']);
+        $form->select('expire_type', '过期类型')
+            ->options([
+                1 => '领取N天过期',
+                2 => '设置固定过期时间',
+            ])->when(1, function (Form $form) {
+                $form->text('effective_days', __('有效天数'));
+            })->when(2, function (Form $form) {
+                $form->date('start_time', __('有效期开始时间'))->required();
+                $form->date('end_time', __('有效期结束时间'))->required()->rules(
+                    'date|after:start_time',['after' => '结束时间小于开始时间']
+                );
+                $form->saving(function ($form){
+                    $form->start_time = strtotime($form->start_time);
+                    $form->end_time = strtotime($form->end_time);
+                });
+
+
+            });
+        return $form;
+    }
+}

+ 0 - 1
app/Admin/Controllers/UserCouponsController.php

xqd
@@ -65,7 +65,6 @@ class UserCouponsController extends AdminController
             return date("Y-m-d H:i",$time);
         });
         $grid->column('use_time', __('使用时间'));
-        $grid->column('coupons_num', __('优惠券数'));
         $grid->column('created_at', __('创建时间'));
         $grid->column('updated_at', __('更新时间'));
 

+ 6 - 0
app/Admin/routes.php

xqd
@@ -84,5 +84,11 @@ Route::group([
     $router->resource('recharge_order', RechargeOrderController::class);
     //优惠券管理->优惠券列表
     $router->resource('coupons', CouponManagement\CouponManagementController::class);
+    //优惠券管理->优惠券详情
+    $router->resource('coupons_details', CouponManagement\CouponDetailsController::class);
+    //优惠券管理->优惠券发放->用户列表
+    $router->resource('coupon_distribution_user_list', CouponManagement\CouponDistributionUserList::class);
+    //社区端通告
+    $router->resource('community_notices', CommunityNotice\CommunityNotices::class);
 });
 

+ 67 - 0
app/Community/Controllers/ApplyServiceController.php

xqd
@@ -0,0 +1,67 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+use App\Admin\Actions\Service\ApplysAction;
+use App\Admin\Actions\Service\RefuseAction;
+use App\Models\Serviceapplys;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class ApplyServiceController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '图文咨询认证';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Serviceapplys());
+
+        $grid->column('id', __('Id'));
+        $grid->column('docter.avatar', __('头像'))->image('',50,50);
+        $grid->column('docter.id', __('医生ID'));
+        $grid->column('docter.name','医生名称');
+        $grid->column('docter.sex','性别')->using([1=>'男',2=>'女']);
+        $grid->column('docter.DocterOrganization', __('所属机构'));
+//        $grid->column('docter.label', __('标签'))->map('ucwords')->implode('-');
+        $grid->column('docter.label', __('标签'))->label('info');
+
+        //$grid->column('service_type', __('服务类型'));
+
+        $grid->column('status', __('状态'))->using([1=>'审核',2=>'已通过',3=>'已拒绝'])->label([
+            1 => 'warning',
+            2 => 'success',
+            3 => 'default'
+        ]);
+        $grid->column('created_at', __('创建时间'));
+        $grid->column('updated_at', __('更新时间'));
+
+        $grid->actions(function ($actions) {
+            // 去掉删除
+            $actions->disableDelete();
+            // 去掉编辑
+            $actions->disableEdit();
+            // 去掉查看
+            $actions->disableView();
+
+
+            $actions->add(new ApplysAction());
+            $actions->add(new RefuseAction());
+        });
+
+
+
+        return $grid;
+    }
+}

+ 11 - 8
app/Community/Controllers/DocterChatController.php

xqd xqd
@@ -41,13 +41,14 @@ class DocterChatController extends AdminController
             $batch->add(new sendNotice());
         });
         if(!$is_admin){
-            $grid->model()->whereHas('orders',function ($query) use ($org_id,$docter_id) {
-                $where['organization_id']=$org_id;
-                if($docter_id){
-                    $where['docter_id'] = $docter_id;
-                }
-                $query->where($where);
-            });
+            $where['organization_id']=$org_id;
+            if($docter_id){
+                $where['docter_id'] = $docter_id;
+            }
+            $grid->model()->where($where);
+//            $grid->model()->whereHas('orders',function ($query) use ($org_id,$docter_id) {
+//                $query->where($where);
+//            });
         }
 
         $grid->column('order_sn', __('订单号'));
@@ -102,7 +103,9 @@ class DocterChatController extends AdminController
         $user = Admin::user();
         $org_id = $user->org_id;
         $docter_id = $user->docter_id;
-        $content->body('<iframe src="/cdms/chat_view" style="width: 100%;height:800px;border: none"></iframe>');
+        $url = '/cdms/chat_view?docter_id='.$docter_id;
+//        $content->body('<iframe src="/cdms/chat_view?docter_id='.$docter_id.'" style="width: 100%;height:800px;border: none"></iframe>');
+        $content->body('<iframe src="/cdms/chat_view?docter_id='.$docter_id.'" style="width: 100%;height:800px;border: none"></iframe>');
         return $content;
     }
 

+ 39 - 4
app/Community/Controllers/HomeController.php

xqd
@@ -21,10 +21,45 @@ class HomeController extends Controller
         return $content
             ->title('数据概况')
             ->description('社区段实时数据')
-            ->row($this->real_data())
-            ->row($this->vaccine_data())
-            ->row($this->nurse_data())
-            ->row($this->schedule_data());
+            ->row(function (Row $row){
+                   return $row->column(12,'<p style="font-family:Arial,Helvetica,sans-serif; font-size:1.2em; margin-top20px;vertical-align:middle; font-weight:normal ">实时概况</p>');
+            })->row(function (Row $row){
+                $data = StatController::service();
+                $row->column(3,new InfoBox('今日预约(人)', 'users', 'aqua', '/cdms/home', $data['schedule_paitent']));
+                $row->column(3,new InfoBox('今日排班(人)', 'users', 'aqua', '/cdms/home', $data['schedule_docter']));
+                $row->column(3,new InfoBox('接诊患者(人次)', 'users', 'aqua', '/cdms/home', $data['paitent_num']));
+            })
+            ->row(function (Row $row){
+                return $row->column(12,'<p style="font-family:Arial,Helvetica,sans-serif; font-size:1.2em; margin-top20px;vertical-align:middle; font-weight:normal ">疫苗概况</p>');
+            })->row(function (Row $row){
+                $data = StatController::vaccine();
+                $row->column(3,new InfoBox('疫苗种类(种)', 'users', 'aqua', '/cdms/home', $data['sum_num']));
+                $row->column(3,new InfoBox('库存剩余(支)', 'users', 'aqua', '/cdms/home', $data['have_num']));
+                $row->column(3,new InfoBox('疫苗缺苗(种)', 'users', 'aqua', '/cdms/home', $data['less_num']));
+            })
+            ->row(function (Row $row){
+                $data = StatController::vaccine();
+                $row->column(3,new InfoBox('今日预约(人支)', 'users', 'aqua', '/cdms/home', $data['today_schedule']));
+                $row->column(3,new InfoBox('预计今日消耗(支)', 'users', 'aqua', '/cdms/home', $data['today_vaccine']));
+            })
+            ->row(function (Row $row){
+                return $row->column(12,'<p style="font-family:Arial,Helvetica,sans-serif; font-size:1.2em; margin-top20px;vertical-align:middle; font-weight:normal ">儿保概况</p>');
+            })->row(function (Row $row){
+                $data = StatController::nurse();
+                $row->column(3,new InfoBox('疫苗种类(种)', 'users', 'aqua', '/cdms/home', $data));
+            })
+            ->row(function (Row $row){
+                return $row->column(12,'<p style="font-family:Arial,Helvetica,sans-serif; font-size:1.2em; margin-top20px;vertical-align:middle; font-weight:normal ">今日排班         </p>');
+            })->row(function (Row $row){
+                $data = StatController::schedule();
+                $row->column(3,new InfoBox('计免医生(人)', 'users', 'aqua', '/cdms/home', $data['vaccine_num']));
+                $row->column(3,new InfoBox('儿保医生(人)', 'users', 'aqua', '/cdms/home', $data['nurse_num']));
+                $row->column(3,new InfoBox('门诊医生(人)', 'users', 'aqua', '/cdms/home', $data['clinic_num']));
+            });
+//            ->row($this->real_data())
+//            ->row($this->vaccine_data())
+//            ->row($this->nurse_data())
+//            ->row($this->schedule_data());
     }
 
     public function real_data()

+ 56 - 0
app/Community/Controllers/NurseServiceController.php

xqd
@@ -0,0 +1,56 @@
+<?php
+
+
+namespace App\Community\Controllers;
+
+
+use App\Models\Order;
+use App\Models\Organization;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Grid;
+
+class NurseServiceController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '儿保服务';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Organization());
+        $grid->column('name', __('社区医院'));
+        $type = request('product_type',5);
+        $grid->column('orders', __('总订单数'))->display(function () use ($type) {
+            return Order::where('organization_id',$this->id)->where('product_type',$type)->count();
+        });
+        $grid->column('ordering', __('进行中订单'))->where('product_type',$type)->display(function () use ($type) {
+            return Order::where(['organization_id'=>$this->id,'order_status'=>3])->count();
+        });
+        $grid->column('is_ok', __('完成数量'))->display(function () use ($type) {
+            return Order::where(['organization_id'=>$this->id,'order_status'=>4])->where('product_type',$type)->count();
+        });
+        $grid->column('anomaly', __('异常数量'))->display(function () use ($type) {
+            return Order::where(['organization_id'=>$this->id])->where('product_type',$type)->orWhere('order_status',5)->orWhere('payment_status','>',2)->count();
+        });
+        $grid->filter(function ($filter){
+            $filter->disableIdFilter();
+            $filter->equal('id','机构')->select(Organization::pluck('name','id'));
+        });
+
+        $grid->actions(function ($actions) {
+            $actions->disableEdit();
+            $actions->disableView();
+            $actions->disableDelete();
+        });
+
+        return $grid;
+    }
+}

+ 60 - 0
app/Community/Controllers/OrganizationController.php

xqd
@@ -0,0 +1,60 @@
+<?php
+
+namespace App\Community\Controllers;
+
+use App\Admin\Actions\Cdmuser;
+use App\Admin\Actions\UpdateCdms;
+use App\Models\Area;
+use App\Models\Order;
+use App\Models\Organization;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class OrganizationController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '计免服务';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Organization());
+
+        $grid->column('name', __('社区医院'));
+        $type = request('product_type',4);
+        $grid->column('orders', __('总订单数'))->display(function () use ($type) {
+            return Order::where('organization_id',$this->id)->where('product_type',$type)->count();
+        });
+        $grid->column('ordering', __('进行中订单'))->where('product_type',$type)->display(function () use ($type) {
+            return Order::where(['organization_id'=>$this->id,'order_status'=>3])->count();
+        });
+        $grid->column('is_ok', __('完成数量'))->display(function () use ($type) {
+            return Order::where(['organization_id'=>$this->id,'order_status'=>4])->where('product_type',$type)->count();
+        });
+        $grid->column('anomaly', __('异常数量'))->display(function () use ($type) {
+            return Order::where(['organization_id'=>$this->id])->where('product_type',$type)->orWhere('order_status',5)->orWhere('payment_status','>',2)->count();
+        });
+        $grid->filter(function ($filter){
+            $filter->disableIdFilter();
+            $filter->equal('id','机构')->select(Organization::pluck('name','id'));
+        });
+
+        $grid->actions(function ($actions) {
+            $actions->disableEdit();
+            $actions->disableView();
+            $actions->disableDelete();
+        });
+
+        return $grid;
+    }
+}

+ 104 - 0
app/Community/Controllers/ServiceController.php

xqd
@@ -0,0 +1,104 @@
+<?php
+
+namespace App\Community\Controllers;
+
+use App\Admin\Actions\Service\ApplysAction;
+use App\Admin\Actions\Service\RefuseAction;
+use App\Models\Docter;
+use App\Models\Order;
+use App\Models\Doctertimes;
+use App\Models\Serviceapplys;
+use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+use Encore\Admin\Show;
+
+class ServiceController extends AdminController
+{
+    /**
+     * Title for current resource.
+     *
+     * @var string
+     */
+    protected $title = '服务';
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        $grid = new Grid(new Serviceapplys());
+
+        $status = request('status',2);
+
+        $grid->tools(function ($tools) {
+            $tools->batch(function ($batch) {
+                $batch->disableDelete();
+            });
+        });
+
+        if($status == 2){
+            $grid->column('ondocter.name','医生姓名');
+            $grid->column('ondocter.phone_price','咨询价格');
+            $grid->column('step_price','步进价格')->display(function (){
+                $step = Doctertimes::where(['docter_id'=>$this->id])->value('step_price');
+                return $step;
+            });
+
+            $grid->column('orders','总订单数')->display(function (){
+
+                $order_type = Order::where(['docter_id'=>$this->id,'product_type'=>1])->count();
+                return $order_type;
+            });
+            $grid->column('orders_actions','进行中数')->display(function (){
+                $action = Order::where(['docter_id'=>$this->id,'product_type'=>1,'order_status'=>3])->count();
+                return $action;
+            });
+            $grid->column('orders_inishs','完成数')->display(function (){
+                $finish = Order::where(['docter_id'=>$this->id,'product_type'=>1,'order_status'=>4])->count();
+                return $finish;
+            });
+            $grid->column('orders_anomaly','异常数')->display(function (){
+                $anomaly = Order::where(['docter_id'=>$this->id,'product_type'=>1])->whereIn('order_status',[1,2,5])->count();
+                return $anomaly;
+            });
+        } else {
+
+            $grid->column('id', __('Id'));
+            $grid->column('ondocter.avatar', __('头像'))->image('',50,50);
+            $grid->column('ondocter.id', __('医生ID'));
+            $grid->column('ondocter.name','医生名称');
+            $grid->column('ondocter.sex','性别')->using([1=>'男',2=>'女']);
+            $grid->column('ondocter.DocterOrganization', __('所属机构'));
+            $grid->column('ondocter.label', __('标签'))->label('info');
+
+            $grid->column('status', __('状态'))->using([1=>'审核',2=>'已通过',3=>'已拒绝'])->label([
+                1 => 'warning',
+                2 => 'success',
+                3 => 'default'
+            ]);
+            $grid->column('created_at', __('创建时间'));
+            $grid->column('updated_at', __('更新时间'));
+        }
+
+        $grid->filter(function ($filter){
+            $filter->equal('service_type','服务类型')->select([1 => '图文', 2 => '电话', 3 => '问诊']);
+            $filter->equal('status','服务类型')->select([1=>'待审核',2 =>'已通过 ',3=>'已拒绝']);
+        });
+        $grid->actions(function ($actions) {
+            $actions->disableEdit();
+            $actions->disableView();
+            $actions->disableDelete();
+            if($actions->row->status == 1){
+                $actions->add(new ApplysAction());
+                $actions->add(new RefuseAction());
+            }
+        });
+
+
+        return $grid;
+    }
+
+}

+ 4 - 0
app/Community/Controllers/UserNoticeController.php

xqd
@@ -34,8 +34,12 @@ class UserNoticeController extends AdminController
             $user_ids = Order::whereIn('product_type',[4,5])->distinct()->pluck('user_id');
             $grid->model()->whereIn('user_id',$user_ids)->distinct();
         }
+        $grid->addColumn('ssss','id')->display(function (){
+            return 22;
+        })->hide();
 
         $grid->column('orderUser.nickname', __('用户'));
+        $grid->column('sid','优惠卷')->hide();
         $grid->column('orderPatient.name', __('患者'));
         $grid->column('orderPatient.relationship_type', __('关系'))->using([1=>'父亲',2=>'母亲',3=>'祖父',4=>'祖母',5=>'外祖父',6=>'外祖母',7=>'叔侄',8=>'其他']);
         $grid->column('orderPatient.phone', __('用户手机号'));

+ 14 - 6
app/Community/Controllers/VaccineController.php

xqd xqd xqd xqd
@@ -3,8 +3,10 @@
 namespace App\Community\Controllers;
 
 use App\Models\Order;
+use App\Models\Organization;
 use App\Models\Vaccine;
 use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Facades\Admin;
 use Encore\Admin\Form;
 use Encore\Admin\Grid;
 use Encore\Admin\Show;
@@ -27,17 +29,22 @@ class VaccineController extends AdminController
     {
         $grid = new Grid(new Vaccine());
 
+        $org_id = Admin::user()->org_id;
         $grid->disableCreateButton(false);
         $grid->column('id', __('ID'));
         $grid->column('name', __('疫苗名称'));
         $grid->column('type', __('类别'))->editable('select',[1=>'一类',2=>'二类']);
         $grid->column('stock', __('剩余库存'))->editable();
-        $grid->column('used_num', __('已使用量'))->display(function (){
-            Order::where(['product_type'=>4,'organization_id'=>$org_id])->wherehas('orderVaccine',function ($query){
-
-            });
+        $grid->column('org_id', __('已使用量'))->display(function () use ($org_id) {
+           return Order::where(['product_type'=>4,'organization_id'=>$org_id])->wherehas('orderVaccine',function ($query){
+                $query->where('vaccine_id',$this->id);
+            })->count();
         });
-        $grid->column('today_num', __('今日预约'));
+        $grid->column('today_num', __('今日预约'))->display(function () use ($org_id) {
+            return Order::where(['product_type'=>4,'organization_id'=>$org_id])->wherehas('orderVaccine',function ($query){
+                $query->where('vaccine_id',$this->id);
+            })->count();
+        });;
         $grid->column('price', __('价格'))->editable();
         $grid->column('remark', __('备注'))->editable('textarea');
         $grid->column('supplier', __('厂家'));
@@ -45,7 +52,6 @@ class VaccineController extends AdminController
 //        $grid->column('updated_at', __('Updated at'));
         $grid->filter(function ($fliter){
             $fliter->equal('type','类别')->select([1=>'一类',2=>'二类']);
-//            $fliter->equal('type','类别')->select([1=>'一类',2=>'二类']);
         });
         $grid->actions(function ($actions) {
 
@@ -90,9 +96,11 @@ class VaccineController extends AdminController
         $form = new Form(new Vaccine());
 
         $form->select('type', __('类型'))->options([1=>'一类',2=>'二类']);
+        $form->select('org_id','机构')->options(Organization::pluck('name','id'));
         $form->text('name', __('疫苗名称'));
         $form->text('supplier', __('厂家'));
         $form->number('price', __('价格'));
+        $form->number('stock', __('库存'));
         $form->textarea('remark', __('备注'));
 
         return $form;

+ 5 - 3
app/Community/Controllers/VaccineUserController.php

xqd xqd
@@ -28,8 +28,10 @@ class VaccineUserController extends AdminController
     {
         $grid = new Grid(new Order());
         $is_amdin = Admin::user()->isRole('administrator');
+        $user = Admin::user();
+        dd($user);
         if(!$is_amdin){
-            $grid->model()->where(['organization_id'=>Admin::user()->org_id,'product_type'=>4]);
+            $grid->model()->where(['organization_id'=>$user->org_id,'product_type'=>4]);
         }
 
         $grid->model()->GroupBy('patient_id');
@@ -37,8 +39,8 @@ class VaccineUserController extends AdminController
         $grid->column('orderUser.nickname', __('监护人'));
         $grid->column('orderPatient.phone', __('监护人手机号'));
         $grid->column('orderPatient.birthday', __('出生日期'));
-        $grid->column('patient_id', __('备注'))->display(function ($w){
-            return PatientRemark::where(['org_id'=>intval(Admin::user()->org_id),'patient_id'=>$w,'type'=>2])->value('remark');
+        $grid->column('patient_id', __('备注'))->display(function ($w) use($user) {
+            return PatientRemark::where(['org_id'=>intval($user->org_id),'patient_id'=>$w,'type'=>2])->value('remark');
         });
 
         $grid->filter(function ($flter){

+ 3 - 0
app/Community/bootstrap.php

xqd xqd
@@ -20,6 +20,7 @@
 
 use Encore\Admin\Form;
 use Encore\Admin\Grid;
+use Encore\Admin\Show;
 Form::extend('week', \App\Admin\Extensions\Week::class);
 Grid::init(function (Grid $grid) {
 
@@ -49,3 +50,5 @@ Form::init(function (Form $form){
 
     });
 });
+
+

+ 3 - 0
app/Community/routes.php

xqd
@@ -16,6 +16,9 @@ Route::resource('docter_verifies', DocterVerifyController::class);
 Route::resource('cdms_roles', PermissionController::class);
 Route::resource('docter_account', DocterAccountController::class);
 Route::resource('docter_chats', DocterChatController::class);
+Route::resource('services', ServiceController::class);
+Route::resource('orgservice', OrganizationController::class);
+Route::resource('nurse_ervice', NurseServiceController::class);
 
 
 //社区通告

+ 3 - 1
app/Http/Controllers/Api/V1/CommonController.php

xqd
@@ -294,7 +294,9 @@ class CommonController extends Controller
     {
         $data = [
             'banners' => [
-                'https://t5.9026.com/img/banner1.jpg',
+                'https://t5.9026.com/img/banner1.png',
+                'https://t5.9026.com/img/banner2.png',
+                'https://t5.9026.com/img/banner3.png',
             ],
             'notices' => [
                 '宝妈小程序正式公测上线啦!',

+ 137 - 62
app/Http/Controllers/ScheDuleController.php

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
 
 
 
+use App\Models\CdmsUsers;
 use App\Models\CommunitySchedule;
 use App\Models\Docter;
 use App\Models\DocterOrganization;
@@ -24,23 +25,45 @@ use phpDocumentor\Reflection\DocBlock\Description;
 class ScheDuleController  extends Controller
 {
 
+    public function __construct()
+    {
+
+        // 允许 $originarr 数组内的 域名跨域访问
+
+        header('Access-Control-Allow-Origin:*');
+
+        // 响应类型
+
+        header('Access-Control-Allow-Methods:POST,GET');
+
+        // 带 cookie 的跨域访问
+
+        header('Access-Control-Allow-Credentials: true');
+
+        // 响应头设置
+
+        header('Access-Control-Allow-Headers:x-requested-with,Content-Type,X-CSRF-Token');
+
+    }
+
+    //获取排班页面
     public function getComSchedule()
     {
 
-        $set_time = request('Schedulingtime');//时间
-        $org_id = request('mechanism');//机构
+        $set_time = request('time');//时间
+        $org_id = request('org_id');//机构
         $docter_id = request('docter_id');//医生
 
 
-        $set_time = '2020-11-30至2020-12-06';
-        $org_id = 1;
-        $docter_id = 47;
+//        $set_time = '2020-11-30至2020-12-06';
+//        $org_id = 1;
+//        $docter_id = 47;
         $role = 1;
 
         if(empty($set_time) || empty($org_id) || empty($docter_id)){
             return json_encode(['status'=>601,'msg'=>'缺少必要参数','data'=>'']);
         } else{
-            echo 'what happend';
+//            echo 'what happend';
         }
 
 
@@ -61,36 +84,36 @@ class ScheDuleController  extends Controller
 //        echo '</pre>';
         //dd($sche_dule);
 
-        $sche_dule_arr = [
+        $sche_dule_arr =[
             [
                 'date'=>"上午",
-                'mondy'=>true,
-                'tuesday'=>true,
-                'wednesday'=>true,
-                'thursday'=>true,
-                'friday'=>true,
-                'saturday'=>true,
-                'sunday'=>true,
+                'mondy'=>false,
+                'tuesday'=>false,
+                'wednesday'=>false,
+                'thursday'=>false,
+                'friday'=>false,
+                'saturday'=>false,
+                'sunday'=>false,
             ],
             [
                 'date'=>"下午",
-                'mondy'=>true,
-                'tuesday'=>true,
-                'wednesday'=>true,
-                'thursday'=>true,
-                'friday'=>true,
-                'saturday'=>true,
-                'sunday'=>true,
+                'mondy'=>false,
+                'tuesday'=>false,
+                'wednesday'=>false,
+                'thursday'=>false,
+                'friday'=>false,
+                'saturday'=>false,
+                'sunday'=>false,
             ],
             [
                 'date'=>"晚上",
-                'mondy'=>true,
-                'tuesday'=>true,
-                'wednesday'=>true,
-                'thursday'=>true,
-                'friday'=>true,
-                'saturday'=>true,
-                'sunday'=>true,
+                'mondy'=>false,
+                'tuesday'=>false,
+                'wednesday'=>false,
+                'thursday'=>false,
+                'friday'=>false,
+                'saturday'=>false,
+                'sunday'=>false,
             ]
         ];
 
@@ -109,7 +132,9 @@ class ScheDuleController  extends Controller
         $role = 2;
         if($role == 1){
             $ids = DocterOrganization::where(['organization_id'=>$org_id])->pluck('docter_id');
-            $list = Docter::whereIn('id',$ids)->get(['id','name'])->toArray();
+            $list = Docter::whereIn('id',$ids)->get(['id as value','name as label'])->toArray();
+            $name = Organization::where('id',$docter_id)->value('name');
+
             $user_id = $org_id;
 
             for ($i = $start_time; $i<=$end_time; $i++){
@@ -119,12 +144,22 @@ class ScheDuleController  extends Controller
                 //检测上午
                 $is_mo_have = SchedulePeriod::whereIn('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$mo)
                     ->where('organization_id','!=',$org_id)->count();
+                $is_self = SchedulePeriod::where('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$mo)
+                    ->where('organization_id',$org_id)->count();
+                if($is_self){
+                    $sche_dule_arr[0][$week_arr[$j]] = true;
+                }
                 if($is_mo_have){
                     $sche_dule_arr[0][$week_arr[$j]] = 'other';
                 }
                 //检测下午
                 $is_af_have = SchedulePeriod::whereIn('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$af)
                     ->where('organization_id','!=',$org_id)->count();
+                $is_af_self = SchedulePeriod::where('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$af)
+                    ->where('organization_id',$org_id)->count();
+                if($is_af_self){
+                    $sche_dule_arr[1][$week_arr[$j]] = true;
+                }
                 if($is_af_have){
                     $sche_dule_arr[1][$week_arr[$j]] = 'other';
                 }
@@ -132,6 +167,11 @@ class ScheDuleController  extends Controller
                 //检测晚上
                 $is_ev_have = SchedulePeriod::whereIn('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$ev)
                     ->where('organization_id','!=',$org_id)->count();
+                $is_ev_self = SchedulePeriod::where('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$ev)
+                    ->where('organization_id',$org_id)->count();
+                if($is_ev_self){
+                    $sche_dule_arr[2][$week_arr[$j]] = true;
+                }
                 if($is_ev_have){
                     $sche_dule_arr[2][$week_arr[$j]] = 'other';
                 }
@@ -140,7 +180,8 @@ class ScheDuleController  extends Controller
 
         } else {
             $ids = DocterOrganization::where(['docter_id'=>$docter_id])->pluck('organization_id');
-            $list = Organization::whereIn('id',$ids)->get(['id','name'])->toArray();
+            $list = Organization::whereIn('id',$ids)->get(['id as value','name as label'])->toArray();
+            $name = Docter::where('id',$docter_id)->value('name');
             $user_id = $docter_id;
 
             for ($i = $start_time; $i<=$end_time; $i++){
@@ -150,12 +191,22 @@ class ScheDuleController  extends Controller
                 //检测上午
                 $is_mo_have = SchedulePeriod::whereIn('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$mo)
                     ->where('organization_id','!=',$org_id)->where('docter_id','!=',$docter_id)->count();
+                $is_mo_self = SchedulePeriod::whereIn('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$mo)
+                    ->where('organization_id','!=',$org_id)->where('docter_id',$docter_id)->count();
+                if($is_mo_self){
+                    $sche_dule_arr[0][$week_arr[$j]] = true;
+                }
                 if($is_mo_have){
                     $sche_dule_arr[0][$week_arr[$j]] = 'other';
                 }
                 //检测下午
                 $is_af_have = SchedulePeriod::whereIn('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$af)
                     ->where('organization_id','!=',$org_id)->where('docter_id','!=',$docter_id)->count();
+                $is_af_self = SchedulePeriod::whereIn('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$af)
+                    ->where('organization_id','!=',$org_id)->where('docter_id',$docter_id)->count();
+                if($is_af_self){
+                    $sche_dule_arr[1][$week_arr[$j]] = true;
+                }
                 if($is_af_have){
                     $sche_dule_arr[1][$week_arr[$j]] = 'other';
                 }
@@ -163,6 +214,11 @@ class ScheDuleController  extends Controller
                 //检测晚上
                 $is_ev_have = SchedulePeriod::whereIn('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$ev)
                     ->where('organization_id','!=',$org_id)->where('docter_id','!=',$docter_id)->count();
+                $is_ev_self = SchedulePeriod::whereIn('schedule_id',$sche_dule)->where('schedule_date',$str_time)->whereIn('time_period_id',$ev)
+                    ->where('organization_id','!=',$org_id)->where('docter_id',$docter_id)->count();
+                if($is_ev_self){
+                    $sche_dule_arr[2][$week_arr[$j]] = true;
+                }
                 if($is_ev_have){
                     $sche_dule_arr[2][$week_arr[$j]] = 'other';
                 }
@@ -179,13 +235,15 @@ class ScheDuleController  extends Controller
 
 
         $data['docter'] = $sche_dule_arr;
-        $data['list'] = array_column($list,'name','id');
+        $data['name'] = $name;
+        $data['list'] = $list;
+
         $data['role'] = $role;
         $data['user_id'] = $user_id;
         return  (json_encode(['code'=>200,'msg'=>'ok','data'=>$data]));
     }
 
-
+    //编辑排班
     public function setDocChedule()
     {
         $docter_id = request('docter_id');
@@ -208,33 +266,33 @@ class ScheDuleController  extends Controller
         $data = [
             [
                 'date'=>"上午",
-                'mondy'=>true,
-                'tuesday'=>true,
-                'wednesday'=>true,
-                'thursday'=>true,
-                'friday'=>true,
-                'saturday'=>true,
-                'sunday'=>true,
+                'mondy'=>false,
+                'tuesday'=>false,
+                'wednesday'=>false,
+                'thursday'=>false,
+                'friday'=>false,
+                'saturday'=>false,
+                'sunday'=>false,
             ],
             [
                 'date'=>"下午",
-                'mondy'=>true,
-                'tuesday'=>true,
-                'wednesday'=>true,
-                'thursday'=>true,
-                'friday'=>true,
-                'saturday'=>true,
-                'sunday'=>true,
+                'mondy'=>false,
+                'tuesday'=>false,
+                'wednesday'=>false,
+                'thursday'=>false,
+                'friday'=>false,
+                'saturday'=>false,
+                'sunday'=>false,
             ],
             [
                 'date'=>"晚上",
-                'mondy'=>true,
-                'tuesday'=>true,
-                'wednesday'=>true,
-                'thursday'=>true,
-                'friday'=>true,
-                'saturday'=>true,
-                'sunday'=>true,
+                'mondy'=>false,
+                'tuesday'=>false,
+                'wednesday'=>false,
+                'thursday'=>false,
+                'friday'=>false,
+                'saturday'=>false,
+                'sunday'=>false,
             ]
         ];
 
@@ -309,42 +367,59 @@ class ScheDuleController  extends Controller
         return json_encode(['status'=>200,'msg'=>'插入成功','data'=>count($info)]);
     }
 
-    public function getScheduleInfo ()
+    //获取用户信息
+    public function getScheduleInfo()
     {
         $docter_id = request('docter_id');
         $org_id = request('org_id');
-        $docter_id = 47;
-        $org_id = 1;
+//        dd(request()->toArray());
+        $is_docter = CdmsUsers::where('docter_id',$docter_id);
         $role = 1;
+        if(empty($org_id) && empty($docter_id)){
+            return json_encode(['status'=>601,'msg'=>'缺少必要参数','data'=>'']);
+        }
+        if($is_docter){
+            $role = 2;
+        }
         if($role == 1){
             $ids = DocterOrganization::where(['docter_id'=>$docter_id])->pluck('organization_id');
-            $list = Organization::whereIn('id',$ids)->get(['id','name'])->toArray();
+            $list = Organization::whereIn('id',$ids)->get(['id as value','name as label'])->toArray();
+            $name = Organization::where('id',$org_id)->value('name');
             $user_id = $org_id;
         } else {
             $ids = DocterOrganization::where(['docter_id'=>$docter_id])->pluck('organization_id');
-            $list = Organization::whereIn('id',$ids)->get(['id','name'])->toArray();
+            $list = Organization::whereIn('id',$ids)->get(['id as value','name as label'])->toArray();
+            $name = Docter::where('id',$docter_id)->value('name');
             $user_id = $docter_id;
-
         }
         $data['user_id'] = $user_id;
+        $data['name'] = $name;
         $data['role'] = $role;
         $data['list'] = $list;
         return (json_encode(['code'=>200,'msg'=>'ok','data'=>$data]));
     }
 
+    //获取图文订单
     public function get_chat_order()
     {
         $org_id = 1;
-        $docter_id = 1;
+//        $docter_id = 1;
+        $docter_id = request('docter_id');
+        if(empty($docter_id)){
+            return json_encode(['status'=>601,'msg'=>'缺少必要参数','data'=>'']);
+
+        }
+
         $list = Order::where(['organization_id'=>$org_id,'docter_id'=>$docter_id,'order_status'=>3])->with('orderUser')->distinct('user_id')->get('user_id');
+        $user_list = [];
         foreach ($list as $val){
             $user_list[] = [
-                'user_id'=>$val->user_id,
+                'id'=>$val->user_id,
                 'avatar'=>$val->orderUser->avatar,
                 'name'=>$val->orderUser->nickname,
             ];
         }
-        $data['docter_id'] = $docter_id;
+        $data['docter'] =  Docter::where('id',$docter_id)->first(['id','avatar','name']);
         $data['order_list'] = $user_list;
         return  (json_encode(['code'=>200,'msg'=>'ok','data'=>$data]));
     }

+ 5 - 0
app/Models/Serviceapplys.php

xqd
@@ -12,6 +12,11 @@ class Serviceapplys extends Model
     public function docter(){
         return $this->belongsTo(Docter::class);
     }
+
+    public function ondocter()
+    {
+        return $this->hasOne(Docter::class,'id','docter_id');
+    }
 //    private static $_post_type =[
 //        1 => '图文',
 //        2 => '电话',

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
public/cdms/assets/css/app.435c7432.css


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
public/cdms/assets/css/app.6871d772.css


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 8 - 0
public/cdms/assets/css/chunk-vendors.c9bf45fc.css


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
public/cdms/assets/js/app.45ed2073.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
public/cdms/assets/js/app.45ed2073.js.map


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
public/cdms/assets/js/app.df98bf87.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
public/cdms/assets/js/app.df98bf87.js.map


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
public/cdms/assets/js/chunk-vendors.3a131eeb.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
public/cdms/assets/js/chunk-vendors.3a131eeb.js.map


BIN
public/cdms/favicon.ico


BIN
public/img/banner1.png


BIN
public/img/banner2.png


BIN
public/img/banner3.png


+ 1 - 1
resources/views/cdms/chat.blade.php

xqd
@@ -1 +1 @@
-<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>mabaochat</title><link href="/assets/css/app.1ef7a076.css" rel="preload" as="style"><link href="/assets/js/app.a700b62e.js" rel="preload" as="script"><link href="/assets/js/chunk-vendors.95e2f2c7.js" rel="preload" as="script"><link href="/assets/css/app.1ef7a076.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but mabaochat doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/assets/js/chunk-vendors.95e2f2c7.js"></script><script src="/assets/js/app.a700b62e.js"></script></body></html>
+<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>mabaochat</title><link href="assets/css/app.435c7432.css" rel="preload" as="style"><link href="assets/css/chunk-vendors.c9bf45fc.css" rel="preload" as="style"><link href="assets/js/app.df98bf87.js" rel="preload" as="script"><link href="assets/js/chunk-vendors.3a131eeb.js" rel="preload" as="script"><link href="assets/css/chunk-vendors.c9bf45fc.css" rel="stylesheet"><link href="assets/css/app.435c7432.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but mabaochat doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="assets/js/chunk-vendors.3a131eeb.js"></script><script src="assets/js/app.df98bf87.js"></script></body></html>

+ 21 - 9
resources/views/cdms/order_detail.blade.php

xqd
@@ -32,18 +32,30 @@
 <div class="contet">
     <div class="center">
         <h2 style="display: inline-block">订单详情</h2>
-        <a class = "a_btn m-l-30" href="/cdms/chats">会话</a>
-        <a class = "a_btn m-l-30" href="javascript:void(0)">完成</a>
+        @if($data->orderPatient)
+            <a class = "a_btn m-l-30" href="/cdms/chats">会话</a>
+            <a class = "a_btn m-l-30" href="javascript:void(0)">完成</a>
+        @endif
     </div>
     <div class="center">
         <span>订单号:{{$data->order_sn}}</span>
-        <span>患者:{{$data->orderPatient->name}}</span>
-        <span>年龄:{{birthday_to_age($data->orderPatient->birthday)}}</span>
-        <span>身份证号:{{$data->orderPatient->card_number}}</span>
-        <span>下单时间:{{$data->orderPatient->created_at}}</span>
-        <span>订单状态:{{$status[$data->order_status]}}接单</span>
-        <span>病情描述:{{$data->orderPatient->symptoms}}</span>
-        <span>图片:{{$data->orderPatient->medical_imgs}}</span>
+        @if(!empty($data->orderPatient))
+            <span>患者:{{$data->orderPatient->name}}</span>
+            <span>年龄:{{birthday_to_age($data->orderPatient->birthday)}}</span>
+            <span>身份证号:{{$data->orderPatient->card_number}}</span>
+            <span>下单时间:{{$data->orderPatient->created_at}}</span>
+            <span>订单状态:{{$status[$data->order_status]}}接单</span>
+            <span>病情描述:{{$data->orderPatient->symptoms}}</span>
+            <span>图片:{{$data->orderPatient->medical_imgs}}</span>
+        @else
+            <span>患者:</span>
+            <span>年龄:</span>
+            <span>身份证号:</span>
+            <span>下单时间:</span>
+            <span>订单状态:</span>
+            <span>病情描述:</span>
+            <span>图片:</span>
+        @endif
     </div>
 </div>
 

+ 3 - 1
routes/web.php

xqd
@@ -17,6 +17,8 @@ Route::get('/', function () {
 
 
 Route::get('/api/getComSchedule', 'ScheDuleController@getComSchedule');
-Route::get('/api/getChatOrder', 'ScheDuleController@get_chat_order');
+Route::get('/getChatOrder', 'ScheDuleController@get_chat_order');
 Route::get('/api/setDocChedule', 'ScheDuleController@setDocChedule');
+//用户信息
+Route::get('/api/getScheduleInfo', 'ScheDuleController@getScheduleInfo');
 

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels