Pārlūkot izejas kodu

Merge branch 'master' of ssh://git.9026.com:2212/swdz-WangHaijun/BaoMa into develop

Mike 4 gadi atpakaļ
vecāks
revīzija
bdc7b3dfa3

+ 2 - 2
app/Admin/Controllers/CouponManagement/CouponDistributionUserList.php

xqd xqd
@@ -29,9 +29,8 @@ class CouponDistributionUserList extends AdminController
         $grid = new Grid(new User());
         $grid->filter(function($filter){
             $filter->disableIdFilter();
-            $filter->equal('phone','手机')->mobile()->placeholder("请输入手机");
-            $filter->like('patient.name','患者姓名')->placeholder("请输入患者姓名");
             $filter->like('nickname','昵称');
+            $filter->equal('phone','手机')->mobile()->placeholder("请输入手机");
             $filter->equal('status','用户状态')->radio([
                 ''   => '不限',
                 0    => '黑名单',
@@ -51,6 +50,7 @@ class CouponDistributionUserList extends AdminController
         $grid ->model()->where('status','>=','0')->where('is_docter',0);
         $grid->column('id', __('用户id'))->sortable();
         $grid->column('nickname', __('用户名'));
+        $grid->column('phone', __('用户手机号'));
         $grid->column('sex', __('性别'))->using([0=>'未知',1=>'男',2=>'女']);
         $grid->column('age', __('年龄'));
         $grid->column('status', __('状态'))->using([0=>'黑名单',1=>'正常',]);

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

xqd xqd
@@ -145,6 +145,16 @@ class CouponManagementController extends AdminController
     {
         $form = new Form(new Coupon());
         $form->hidden('id', __('id'));
+        $form->editing(function ($f){
+            $f->model()->max_reduce_amount /=100;
+            $f->model()->min_consume_amount /=100;
+            $f->model()->money /=100;
+        });
+        $type = request('type');
+        if (isset($type))
+        {
+            admin_toastr('最低消费金额不能小于满减的优惠钱数', 'error');
+        }
         $form->text('name', __('优惠券名称'));
         $form->text('title', __('券标题'));
         $form->text('desc', __('使用说明'));
@@ -205,7 +215,20 @@ class CouponManagementController extends AdminController
                     $form->start_time = strtotime($form->start_time);
                     $form->end_time = strtotime($form->end_time);
                     $form->money = $form->money*100;
+                    $form->min_consume_amount = $form->min_consume_amount*100;
                     $form->max_reduce_amount = $form->max_reduce_amount*100;
+                    if ($form->money >$form->min_consume_amount)
+                    {
+                        if ($form->isEditing)
+                        {
+                            $arr = request()->route()->parameters;
+                            return redirect('admin/coupons/'.$arr['coupon'].'/edit?type=1');
+                        }else
+                        {
+                            return redirect('admin/coupons/create?type=1');
+                        }
+
+                    }
                 });
             });
         return $form;

+ 25 - 9
app/Admin/Controllers/OrdersManagement/BookingOrderController.php

xqd xqd xqd
@@ -7,6 +7,7 @@ use App\Models\Order;
 use App\Admin\Actions\backstage\Orders\OrderDetails;
 use App\Models\OrderPack;
 use App\Models\ServicePack;
+use Encore\Admin\Widgets\Table;
 use Encore\Admin\Controllers\AdminController;
 use App\Admin\Actions\backstage\User\MapDepot;
 use App\Admin\Actions\backstage\User\Suggests;
@@ -72,15 +73,7 @@ class BookingOrderController extends AdminController
             });
         });
 
-        $grid->actions(function ($actions) {
-            // 去掉删除
-            $actions->disableDelete();
-            // 去掉编辑
-            $actions->disableEdit();
-//            $actions->add(new MapDepot());
-            $actions->add(new Evaluate());
-//            $actions->add(new Suggests());
-        });
+        $grid->disableActions();
         $grid->model()->orderBy('id','desc');
         $grid->column('id', __('Id'))->sortable();
         $grid->column('user.nickname', __('用户姓名'));
@@ -93,6 +86,29 @@ class BookingOrderController extends AdminController
         $grid->column('orderPatient.appoint_end_time', __('就诊日期'))->display(function ($time){
             return date('Y-m-d H:i:s',$time);
         });
+        $grid->column('is_evaluates', __('评价详情'))->expand(function ($model){
+            $infos = $model->evaluate()->get()->map(function ($info){
+                return $info->only(['order_id','content','status']);
+            });
+            $infos = $infos->toArray();
+            foreach ($infos as $key => $value)
+            {
+                if (!empty($infos[$key]))
+                {
+                    if ($infos[$key]['status'] == 1)
+                    {
+                        $infos[$key]['status'] = '待审核';
+                    }else if ($infos[$key]['status'] == 2)
+                    {
+                        $infos[$key]['status'] = '审核成功';
+                    }else{
+                        $infos[$key]['status'] = '审核拒绝';
+                    }
+                }
+            }
+            return new Table(['订单id','评价内容','评价状态'],$infos);
+        });
+        $grid->column('evaluate.score', __('订单评分'));
         $grid->column('product_type', __('产品类型'))->using([3=>'门诊预约',4=>'疫苗接种预约',5=>'儿保预约']);
         $grid->column('payment_type', __('支付方式'))->display(function ($payment_type){
             if ($payment_type == 1)

+ 24 - 11
app/Admin/Controllers/OrdersManagement/ConsultingOrdersController.php

xqd xqd xqd
@@ -9,6 +9,7 @@ use App\Admin\Actions\backstage\User\Suggests;
 use App\Models\Order;
 use App\Models\OrderPack;
 use App\Models\ServicePack;
+use Encore\Admin\Widgets\Table;
 use Encore\Admin\Controllers\AdminController;
 use Encore\Admin\Form;
 use Encore\Admin\Grid;
@@ -77,16 +78,7 @@ class ConsultingOrdersController extends AdminController
             });
         });
         //操作
-        $grid->actions(function ($actions) {
-            // 去掉删除
-            $actions->disableDelete();
-            // 去掉编辑
-            $actions->disableEdit();
-//            $actions->add(new MapDepot());
-            $actions->add(new Evaluate());
-//            $actions->add(new Suggests());
-
-        });
+        $grid->disableActions();
         $grid->model()->orderBy('id','desc');
         $grid->column('id', __('Id'))->sortable();
         $grid->column('user.nickname', __('用户姓名'));
@@ -120,8 +112,29 @@ class ConsultingOrdersController extends AdminController
         $grid->column('discount_amount', __('折扣金额'))->display(function ($money){
             return $money/100;
         });
+        $grid->column('is_evaluates', __('评价详情'))->expand(function ($model){
+            $infos = $model->evaluate()->get()->map(function ($info){
+                return $info->only(['order_id','content','status']);
+            });
+            $infos = $infos->toArray();
+            foreach ($infos as $key => $value)
+            {
+                if (!empty($infos[$key]))
+                {
+                    if ($infos[$key]['status'] == 1)
+                    {
+                        $infos[$key]['status'] = '待审核';
+                    }else if ($infos[$key]['status'] == 2)
+                    {
+                        $infos[$key]['status'] = '审核成功';
+                    }else{
+                        $infos[$key]['status'] = '审核拒绝';
+                    }
+                }
+            }
+            return new Table(['订单id','评价内容','评价状态'],$infos);
+        });
         $grid->column('evaluate.score', __('订单评分'));
-        $grid->column('evaluate.status', __('评分状态'))->using([1=>'待审核',2=>'审核通过',3=>'审核拒绝']);
         $grid->column('payment_time', __('支付时间'))->display(function ($time){
             return date('Y-m-d H:i:s',$time);
         });

+ 14 - 1
app/Community/Controllers/OrderController.php

xqd xqd
@@ -2,6 +2,9 @@
 
 namespace App\Community\Controllers;
 
+use App\Community\Actions\Nurse\Finished;
+use App\Community\Actions\Nurse\OrderCance;
+use App\Community\Actions\Nurse\Reserved;
 use App\Models\Docter;
 use App\Models\Order;
 use Encore\Admin\Controllers\AdminController;
@@ -69,7 +72,17 @@ class OrderController extends AdminController
                 $model->where('name', 'like', "{$query}%");
             });
         })->placeholder('请输入用户姓名');
-
+        $grid->actions(function ($actions) {
+            if(!empty($actions->row->order_status) && $actions->row->order_status < 2){
+                $actions->add(new Reserved());
+            }
+            if(!empty($actions->row->order_status) && $actions->row->order_status<= 3){
+                $actions->add(new OrderCance());
+                $actions->add(new Finished());
+            }
+            $actions->disableView();
+            $actions->disableDelete();
+        });
         $grid->filter(function (Grid\Filter $filter)  {
             $filter->disableIdFilter();
             $filter->column(1/2, function ($filter)   {

+ 1 - 1
app/Community/Controllers/OrderNurseController.php

xqd
@@ -104,7 +104,7 @@ class OrderNurseController extends AdminController
                 $actions->add(new Finished());
             }
 
-            $actions->add(new DelNurse());
+//            $actions->add(new DelNurse());
             $actions->disableView();
             $actions->disableDelete();
         });

+ 4 - 2
app/Community/Controllers/ScheduleStatController.php

xqd
@@ -30,10 +30,12 @@ class ScheduleStatController extends Admin
         }
 
         $data['week'] = $week;
+        $data['timeType'] = ['上午','下午','晚上'];
         $data['name'] = Organization::where(['id'=>$org_id])->value('name');
         $content = new Content();
-        $content->title('医生排班统计');
-        $content->description('填写页面描述小标题');
+        $types = [1=>'门诊',2=>'计免','3'=>'儿保'];
+        $content->title($data['name']);
+        $content->description($types[$scheduleType].'排班统计');
         $content->view('cdms.totalSchedule',['data'=>$data]);
 
         return $content;

+ 14 - 14
app/Http/Controllers/Api/V1/DocterController.php

xqd xqd xqd xqd
@@ -44,13 +44,19 @@ class DocterController extends AuthController
             $docter_ids5 = DocterServiceTime::where('type', 1)->where('start_time_line', '<=', $now_line)->where('end_time_line', '>', $now_line)->pluck('docter_id')->toArray();
             $builder->where('is_phone', 1)->whereIn('id', $docter_ids5);
         }
-        if ($list_type == 2) {
+        elseif ($list_type == 2) {
             $docter_ids6 = DocterServiceTime::where('type', 2)->where('start_time_line', '<=', $now_line)->where('end_time_line', '>', $now_line)->pluck('docter_id')->toArray();
             $builder->where('is_chat', 1)->whereIn('id', $docter_ids6);
         }
-        if ($list_type == 3) {
+        elseif ($list_type == 3) {
             $builder->where('is_appoint', 1);
         }
+        else {
+            $builder->where(function ($query) {
+                $query->where('is_phone', 1)->orWhere('is_chat', 1)->orWhere('is_appoint', 1);
+            });
+        }
+
         if (!empty($req['name'])) {
             $name = $req['name'];
             $organizations = Organization::with('docter')->select(['id'])->where('name', 'like', '%'.$name.'%')->get()->toArray();
@@ -156,7 +162,6 @@ class DocterController extends AuthController
         $req = request()->post();
         $this->validate(request(), [
             'docter_id' => 'required|integer',
-            'list_type' => 'in:0,1,2,3',
             'latitude' => 'numeric',
             'longitude' => 'numeric',
         ]);
@@ -164,12 +169,12 @@ class DocterController extends AuthController
 
         $distance_field = get_user_distance_field($user);
 
-        $data = Docter::with('office', 'qualification', 'evaluate.user')->select(['id', 'type', 'name', 'phone', 'sex', 'birthday', 'avatar', 'status', 'label', 'sign', 'intro', 'office_id', 'qualification_id', 'score', 'service_persons', 'eva_num', 'service_days', 'phone_minutes', 'chat_price', 'phone_price', 'appoint_price', 'is_chat', 'is_phone', 'is_appoint', 'latitude', 'longitude', DB::raw($distance_field)])->where('id', $req['docter_id'])->where('status', 1)->first()->toArray();
+        $data = Docter::with(['office', 'qualification', 'evaluate.user'])->select(['id', 'type', 'name', 'phone', 'sex', 'birthday', 'avatar', 'status', 'label', 'sign', 'intro', 'office_id', 'qualification_id', 'score', 'service_persons', 'eva_num', 'service_days', 'phone_minutes', 'chat_price', 'phone_price', 'appoint_price', 'is_chat', 'is_phone', 'is_appoint', 'latitude', 'longitude', DB::raw($distance_field)])->where('id', $req['docter_id'])->where('status', 1)->first()->toArray();
 
-        $data['organization'] = null;
-        if (!empty($req['list_type']) && $req['list_type'] == 3) {
-            $schedulePeriod = SchedulePeriod::with('organization')->select(['organization_id'])->where('docter_id', $req['docter_id'])->where('schedule_date', date('Y-m-d'))->first()->toArray();
-            $data['organization'] = $schedulePeriod['organization'];
+        $organization_ids = SchedulePeriod::where('docter_id', $req['docter_id'])->groupBy('organization_id')->pluck('organization_id')->toArray();
+        $data['organization'] = [];
+        if (!empty($organization_ids)) {
+            $data['organization'] = Organization::select(['id', 'name', 'address', 'latitude', 'longitude', DB::raw($distance_field)])->whereIn('id', $organization_ids)->get()->toArray();
         }
 
         return ($data);
@@ -180,17 +185,12 @@ class DocterController extends AuthController
         $req = request()->post();
         $this->validate(request(), [
             'docter_id' => 'required|integer',
-            'organization_id' => 'integer',
             'per_page' => 'integer',
             'latitude' => 'numeric',
             'longitude' => 'numeric',
         ]);
         $user = $this->user;
-        $builder = Schedule::with(['schedulePeriod.timePeriod', 'schedulePeriod.organization'])->where('docter_id', $req['docter_id'])->where('schedule_type', 1)->where('schedule_day', '>=', date('Ymd'))->orderBy('schedule_day', 'asc');
-        if (!empty($req['organization_id'])) {
-            $builder->where('organization_id', $req['organization_id']);
-        }
-        $data = $builder->paginate($req['per_page']??15)->toArray();
+        $data = Schedule::with(['schedulePeriod.timePeriod', 'schedulePeriod.organization'])->where('docter_id', $req['docter_id'])->where('schedule_type', 1)->where('schedule_day', '>=', date('Ymd'))->orderBy('schedule_day', 'asc')->paginate($req['per_page']??15)->toArray();
         if (!empty($data)) {
             foreach ($data['data'] as $k => &$v) {
                 foreach ($v['schedule_period'] as $k1 => &$v1) {

+ 7 - 2
app/Models/DocterMessage.php

xqd
@@ -18,14 +18,19 @@ class DocterMessage extends BaseModel
             $content = config('config.docter_message_map')[$type] ?? '';
             $content = vsprintf($content, $param);
         }
-        DocterMessage::create([
+        $add = [
             'docter_id' => $docter_id,
             'status' => 1,
             'user_id' => $user_id,
             'type' => $type,
             'relation_id' => $relation_id,
             'content' => $content,
-        ]);
+        ];
+        if (in_array($type, [1,4])) {
+            $product_type = Order::where('id', $relation_id)->value('product_type');
+            $add['order_type'] = $product_type;
+        }
+        DocterMessage::create($add);
 
         return true;
     }

+ 58 - 38
resources/views/cdms/totalSchedule.blade.php

xqd
@@ -1,48 +1,68 @@
-<div class="box">
+<style>
+    table,th{
+        text-align: center;
+    }
+
+</style>
+<div class="box col-sm-6">
     <div class="box-header">
-        <h3 class="box-title">机构{{$data['name']}}排班页面</h3>
+        <h3 class="box-title">{{$data['name']}}  排班人次数统计</h3>
     </div>
-    <!-- /.box-header -->
     <div class="box-body">
-        <div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap"><div class="row"><div class="col-sm-6"></div><div class="col-sm-6"></div></div><div class="row"><div class="col-sm-12"><table id="example2" class="table table-bordered table-hover dataTable" role="grid" aria-describedby="example2_info">
+        <div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
+            <div class="row">
+                <div class="col-sm-6"></div>
+                <div class="col-sm-6"></div>
+            </div>
+            <div class="row">
+                <div class="col-sm-12">
+                    <table id="example2" class="table table-bordered table-hover dataTable" role="grid" aria-describedby="example2_info">
                         <thead>
-                        <tr role="row">
-                            <th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Rendering engine: activate to sort column ascending">Rendering engine</th>
-                            <th class="sorting_desc" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending" aria-sort="descending">Browser</th>
-                            <th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending">Platform(s)</th>
-                            <th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending">Engine version</th>
-                            <th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending">CSS grade</th>
-                        </tr>
+                            <tr role="row">
+                                <th  tabindex="0"  rowspan="1" colspan="1" >时间</th>
+                                <th  tabindex="0"  rowspan="1" colspan="1" >星期一</th>
+                                <th class="sorting_desc" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending" aria-sort="descending">星期二</th>
+                                <th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending">星期三</th>
+                                <th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="Engine version: activate to sort column ascending">星期四</th>
+                                <th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending">星期五</th>
+                                <th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending">星期六</th>
+                                <th class="sorting" tabindex="0" aria-controls="example2" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending">星期天</th>
+                            </tr>
                         </thead>
                         <tbody>
-                        <tr role="row" class="odd">
-                            <td class="">Presto</td>
-                            <td class="sorting_1">Opera 9.0</td>
-                            <td>Win 95+ / OSX.3+</td>
-                            <td>-</td>
-                            <td>A</td>
-                        </tr>
+                        @for($i=0;$i<=2;$i++)
                         <tr role="row" class="even">
-                            <td class="">Presto</td>
-                            <td class="sorting_1">Opera 8.5</td>
-                            <td>Win 95+ / OSX.2+</td>
-                            <td>-</td>
-                            <td>A</td>
-                        </tr><tr role="row" class="odd">
-                            <td class="">Presto</td>
-                            <td class="sorting_1">Opera 8.0</td>
-                            <td>Win 95+ / OSX.2+</td>
-                            <td>-</td>
-                            <td>A</td>
-                        </tr><tr role="row" class="even">
-                            <td class="">Presto</td>
-                            <td class="sorting_1">Opera 7.5</td>
-                            <td>Win 95+ / OSX.2+</td>
-                            <td>-</td>
-                            <td>A</td>
+                            <td class="">{{$data['timeType'][$i]}}</td>
+                        @foreach($data['week'] as $k=>$v)
+                                <td class="">({{$v[$i]}}人次)</td>
+                            @endforeach
                         </tr>
-                        <tfoot>
-                        <tr><th rowspan="1" colspan="1">Rendering engine</th><th rowspan="1" colspan="1">Browser</th><th rowspan="1" colspan="1">Platform(s)</th><th rowspan="1" colspan="1">Engine version</th><th rowspan="1" colspan="1">CSS grade</th></tr>
-                        </tfoot>
+                        @endfor
                     </table>
+
+{{--                    <table class="table table-condensed">--}}
+{{--                        <tr>--}}
+{{--                            <th>星期一</th>--}}
+{{--                            <th>星期二</th>--}}
+{{--                            <th>星期三</th>--}}
+{{--                            <th>星期四</th>--}}
+{{--                            <th>星期五</th>--}}
+{{--                            <th>星期六</th>--}}
+{{--                            <th>星期天</th>--}}
+{{--                        </tr>--}}
+
+{{--                        <tr>--}}
+{{--                            <td class="active">...</td>--}}
+{{--                            <td class="success">...</td>--}}
+{{--                            <td class="warning">...</td>--}}
+{{--                            <td class="danger">...</td>--}}
+{{--                            <td class="info">...</td>--}}
+{{--                            <td class="info">...</td>--}}
+{{--                            <td class="info">...</td>--}}
+{{--                        </tr>--}}
+{{--                    </table>--}}
+                </div>
+            </div>
+        </div>
+    </div>
 </div>