ソースを参照

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

刘远航 4 年 前
コミット
b09dd69211

+ 55 - 22
app/Admin/Controllers/ServicePacksManagment/ServicePacksController.php

xqd xqd xqd
@@ -2,6 +2,7 @@
 
 namespace App\Admin\Controllers\ServicePacksManagment;
 
+use App\Models\Nurse;
 use App\Models\ServicePack;
 use App\Models\Team;
 use Encore\Admin\Controllers\AdminController;
@@ -47,7 +48,9 @@ class ServicePacksController extends AdminController
                     }
             return '无';
         })->label('info');
-        $grid->column('price', __('价格'));
+        $grid->column('price', __('价格'))->display(function ($money){
+            return $money/100;
+        });
         $grid->column('team_id', __('团队名称'))->display(function (){
             $modal = $this->team_id;
             if ($modal){
@@ -86,28 +89,58 @@ class ServicePacksController extends AdminController
         $form->text('intro', __('简介'))->rules('required' ,['required'=>'请填写简介!']);;
         $form->editor('desc', __('详情内容'))->rules('required' ,['required'=>'请填写内容!']);;
         $form->number('price', __('价钱'))->default(0);
-        $form->multipleSelect('team_id', __('团队选择'))->options(Team::all()->pluck('name','id'));
-        //$form->multipleSelect('label','服务类型')->options([1 => '图文',2 => '电话',3 => '门诊',4 => '计免',5 => '儿保']);
-        $form->checkbox('label','服务类型')
-            ->options([
-                1 => '图文',
-                2 => '电话',
-                3 => '门诊',
-                4 => '计免',
-                5 => '儿保'
-            ])->when('has',1,function (Form $form){
-                $form->number('chat_num', __('图文次数'))->default(0);
-            })->when('has',2,function (Form $form){
-                $form->number('phone_minutes', __('电话分钟数'))->default(0);
-            })->when('has',3,function (Form $form){
-                $form->number('appoint_num', __('门诊次数'))->default(0);
-            })->when('has',4,function (Form $form){
-                $form->number('vaccine_limit_amount', __('计免次数'))->default(0);
-            })->when('has',5,function (Form $form){
-                $form->number('nurses_limit_amount', __('儿保次数'))->default(0);
-            })->rules('required',['required'=>'请选择服务类型']);
+        $form->radio('has_team','是否包含团队')->options([
+           0=>'否',
+           1=>'是'
+        ])->default(1)->when(0,function (Form $form){
+            $form->checkbox('label','服务类型')
+                ->options([
+                    1 => '图文',
+                    2 => '电话',
+                    3 => '门诊',
+                    4 => '计免',
+                    5 => '儿保'
+                ])->when('has',1,function (Form $form){
+                    $form->number('chat_num', __('图文次数'))->default(0);
+                })->when('has',2,function (Form $form){
+                    $form->number('phone_minutes', __('电话分钟数'))->default(0);
+                })->when('has',3,function (Form $form){
+                    $form->number('appoint_num', __('门诊次数'))->default(0);
+                })->when('has',4,function (Form $form){
+                    $form->number('vaccine_limit_amount', __('计免次数'))->default(0);
+                })->when('has',5,function (Form $form){
+                    //暂未完成,这里展示所有的自费的儿保项目
+                    $form->select('product', __('儿保项目'))->options(Nurse::where('type',2)->pluck('name','id'));
+                })->rules('required',['required'=>'请选择服务类型']);
+        })->when(1,function (Form $form)
+        {
+            $form->multipleSelect('team_id', __('团队选择'))->options(Team::all()->pluck('name','id'));
+            $form->checkbox('label','服务类型')
+                ->options([
+                    1 => '图文',
+                    2 => '电话',
+                    3 => '门诊',
+                    4 => '计免',
+                    5 => '儿保'
+                ])->when('has',1,function (Form $form){
+                    $form->number('chat_num', __('图文次数'))->default(0);
+                })->when('has',2,function (Form $form){
+                    $form->number('phone_minutes', __('电话分钟数'))->default(0);
+                })->when('has',3,function (Form $form){
+                    $form->number('appoint_num', __('门诊次数'))->default(0);
+                })->when('has',4,function (Form $form){
+                    $form->number('vaccine_limit_amount', __('计免次数'))->default(0);
+                })->when('has',5,function (Form $form){
+                    $form->select('product', __('儿保项目'))->options(Nurse::where('type',$form->team_id)->pluck('name','id'));
+                })->rules('required',['required'=>'请选择服务类型']);
 
-        $form->text('effective_days', __('服务时长(秒)'))->default(0);
+        });
+        $form->ignore('has_team');
+        $form->text('effective_days', __('服务时长(天)'))->default(0);
+        $form->saving(function (Form $form){
+            $form->price = $form->price*100;
+//            dd($form->price);
+        });
         return $form;
     }
 }

+ 0 - 1
app/Http/Controllers/Api/V2/DoctorController.php

xqd
@@ -44,7 +44,6 @@ use App\Models\DocterServiceTimes;
 use App\Models\CallLog;
 use App\Models\ImMessage;
 use App\Models\DocterLable;
-use App\Models\SchedueFlags as Sflag;
 
 
 /**

+ 8 - 1
app/Models/Order.php

xqd
@@ -129,7 +129,14 @@ class Order extends BaseModel
         if ($order['product_type'] == 3) {
             $orderPatient = OrderPatient::select(['time_period_id', 'appoint_start_time'])->where('order_id', $order_id)->first();
             $schedule_date = date('Y-m-d', $orderPatient['appoint_start_time']);
-            SchedulePeriod::where('docter_id', $order['docter_id'])->where('organization_id', $order['organization_id'])->where('time_period_id', $orderPatient['time_period_id'])->where('schedule_date', $schedule_date)->increment('order_num');
+            SchedulePeriod::where('docter_id', $order['docter_id'])->where('organization_id', $order['organization_id'])->where('schedule_type', 1)->where('time_period_id', $orderPatient['time_period_id'])->where('schedule_date', $schedule_date)->increment('order_num');
+        }
+        //如果是儿保和疫苗预约,预约时间段的订单数要加1
+        if (in_array($order['product_type'], [4,5])) {
+            $orderPatient = OrderPatient::select(['time_period_id', 'appoint_start_time'])->where('order_id', $order_id)->first();
+            $schedule_date = date('Y-m-d', $orderPatient['appoint_start_time']);
+            $schedule_type = $order['product_type'] == 4 ? 2 : 3;
+            SchedulePeriod::where('organization_id', $order['organization_id'])->where('schedule_type', $schedule_type)->where('time_period_id', $orderPatient['time_period_id'])->where('schedule_date', $schedule_date)->increment('order_num');
         }
 
         //如果是疫苗就减少疫苗库存