فهرست منبع

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

zilong 4 سال پیش
والد
کامیت
eaec02e7d2

+ 16 - 11
app/Admin/Actions/backstage/Pass.php

xqd
@@ -49,18 +49,23 @@ class Pass extends RowAction
                                                             );
         Docter::where('id',$model->docter_id)->update(['is_then'=>1,'office_id'=>$model->offices_id,'qualification_id'=>$model->qualifications_id]);
         //生成默认的图文、电话、门诊的记录
-        $service_type_arr = [1,2,3];
-        foreach ($service_type_arr as $value)
+        //判断数据表里是否有存在的记录了,如果有存在的记录就不会在继续创建
+        $service = Serviceapplys::where('docter_id',$model->docter_id)->get();
+        $service = $service->toArray();
+        if (empty($service))
         {
-            $total_arr = [
-                'docter_id' => $model->docter_id,
-                'service_type' => $value,
-                'status' => 3,
-                'created_at' =>date('Y-m-d H;i;s'),
-                'updated_at' =>date('Y-m-d H;i;s'),
-            ];
-//            dd($total_arr);
-            Serviceapplys::insert($total_arr);
+            $service_type_arr = [1,2,3];
+            foreach ($service_type_arr as $value)
+            {
+                $total_arr = [
+                    'docter_id' => $model->docter_id,
+                    'service_type' => $value,
+                    'status' => 3,
+                    'created_at' =>date('Y-m-d H;i;s'),
+                    'updated_at' =>date('Y-m-d H;i;s'),
+                ];
+                Serviceapplys::insert($total_arr);
+            }
         }
         return $this->response()->success('审核通过')->refresh();
     }

+ 2 - 2
app/Admin/Controllers/PhoneServiceController.php

xqd xqd
@@ -4,7 +4,7 @@ namespace App\Admin\Controllers;
 
 use App\Models\Docter;
 use App\Models\Order;
-use App\Models\Doctertimes;
+use App\Models\DocterTimes;
 use Encore\Admin\Controllers\AdminController;
 use Encore\Admin\Form;
 use Encore\Admin\Grid;
@@ -32,7 +32,7 @@ class PhoneServiceController extends AdminController
         $grid->column('name','医生姓名');
         $grid->column('phone_price','咨询价格');
         $grid->column('step_price','步进价格')->display(function (){
-            $step = Doctertimes::where(['docter_id'=>$this->id])->value('step_price');
+            $step = DocterTimes::where(['docter_id'=>$this->id])->value('step_price');
             return $step;
         });
 

+ 1 - 1
app/Admin/Controllers/ServiceManagement/ServiceController.php

xqd
@@ -10,7 +10,7 @@ use App\Admin\Actions\Service\RevokeAction;
 use App\Models\Docter;
 use App\Models\DocterLabel;
 use App\Models\Order;
-use App\Models\Doctertimes;
+use App\Models\DocterTimes;
 use App\Models\Organization;
 use App\Models\Serviceapplys;
 use Encore\Admin\Controllers\AdminController;

+ 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;
     }
 }

+ 7 - 7
app/Admin/Controllers/UserManagement/DocterManagement/ChatController.php

xqd xqd xqd xqd xqd xqd xqd
@@ -3,7 +3,7 @@
 namespace App\Admin\Controllers\UserManagement\DocterManagement;
 
 use App\Models\Docter;
-use App\Models\Doctertimes;
+use App\Models\DocterTimes;
 use Encore\Admin\Controllers\AdminController;
 use Encore\Admin\Form;
 use Encore\Admin\Grid;
@@ -25,7 +25,7 @@ class ChatController extends AdminController
      */
     protected function grid()
     {
-        $grid = new Grid(new Doctertimes());
+        $grid = new Grid(new DocterTimes());
         $grid->disableCreateButton();
         $grid->disableActions();
         $grid->disableBatchActions();
@@ -38,7 +38,7 @@ class ChatController extends AdminController
         $grid->column('type', __('类型'))->using([1=>'电话咨询',2=>'图文咨询',3=>'门诊咨询',4=>'疫苗预约接种',5=>'儿保预约',6=>'服务包',7=>'充值']);
         $grid->column('base_price', __('基础价格'));
         $grid->column('am', __('上午服务时间'))->display(function (){
-            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $service_time = DocterTimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
             $arr = json_decode($service_time);
             $obj_arr = object_array($arr);
             if (empty($obj_arr[1]))
@@ -51,7 +51,7 @@ class ChatController extends AdminController
             }
         });
         $grid->column('pm', __('下午服务时间'))->display(function (){
-            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $service_time = DocterTimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
             $arr = json_decode($service_time);
             $obj_arr = object_array($arr);
             if (empty($obj_arr[2]))
@@ -64,7 +64,7 @@ class ChatController extends AdminController
             }
         });
         $grid->column('night', __('晚上服务时间'))->display(function (){
-            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $service_time = DocterTimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
             $arr = json_decode($service_time);
             $obj_arr = object_array($arr);
             if (empty($obj_arr[3]))
@@ -90,7 +90,7 @@ class ChatController extends AdminController
      */
     protected function detail($id)
     {
-        $show = new Show(Doctertimes::findOrFail($id));
+        $show = new Show(DocterTimes::findOrFail($id));
 
         $show->field('id', __('Id'));
         $show->field('docter_id', __('Docter id'));
@@ -113,7 +113,7 @@ class ChatController extends AdminController
      */
     protected function form()
     {
-        $form = new Form(new Doctertimes());
+        $form = new Form(new DocterTimes());
 
         $form->number('docter_id', __('Docter id'));
         $form->decimal('base_price', __('Base price'));

+ 2 - 2
app/Admin/Controllers/UserManagement/DocterManagement/DoctorManagementController.php

xqd
@@ -94,8 +94,8 @@ class DoctorManagementController extends AdminController
                 return $name;
             }
         })->label('info');
-        $grid->column('serviceapply', __('开通服务'))->where('status',2)->pluck('service_type')->display(function ($type){
-//            dd($type);
+        $grid->column('serviceapply', __('开通服务'))->where('status',2)->pluck('service_type')->toArray()->display(function ($type){
+            $type = array_unique($type);
             $type_arr = [];
             foreach ($type as $value)
             {

+ 7 - 7
app/Admin/Controllers/UserManagement/DocterManagement/PhoneController.php

xqd xqd xqd xqd xqd xqd xqd
@@ -2,7 +2,7 @@
 
 namespace App\Admin\Controllers\UserManagement\DocterManagement;
 
-use App\Models\Doctertimes;
+use App\Models\DocterTimes;
 use Encore\Admin\Controllers\AdminController;
 use Encore\Admin\Form;
 use Encore\Admin\Grid;
@@ -24,7 +24,7 @@ class PhoneController extends AdminController
      */
     protected function grid()
     {
-        $grid = new Grid(new Doctertimes());
+        $grid = new Grid(new DocterTimes());
         $grid->disableCreateButton();
         $grid->disableActions();
         $grid->disableBatchActions();
@@ -39,7 +39,7 @@ class PhoneController extends AdminController
         $grid->column('base_price', __('基础价格'));
         $grid->column('base_price', __('步进价格'));
         $grid->column('am', __('上午服务时间'))->display(function (){
-            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $service_time = DocterTimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
             $arr = json_decode($service_time);
             $obj_arr = object_array($arr);
             if (empty($obj_arr[1]))
@@ -52,7 +52,7 @@ class PhoneController extends AdminController
             }
         });
         $grid->column('pm', __('下午服务时间'))->display(function (){
-            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $service_time = DocterTimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
             $arr = json_decode($service_time);
             $obj_arr = object_array($arr);
             if (empty($obj_arr[2]))
@@ -65,7 +65,7 @@ class PhoneController extends AdminController
             }
         });
         $grid->column('night', __('晚上服务时间'))->display(function (){
-            $service_time = Doctertimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
+            $service_time = DocterTimes::where('docter_id',$this->docter_id)->where('id',$this->id)->value('service_time');
             $arr = json_decode($service_time);
             $obj_arr = object_array($arr);
             if (empty($obj_arr[3]))
@@ -91,7 +91,7 @@ class PhoneController extends AdminController
      */
     protected function detail($id)
     {
-        $show = new Show(Doctertimes::findOrFail($id));
+        $show = new Show(DocterTimes::findOrFail($id));
 
         $show->field('id', __('Id'));
         $show->field('docter_id', __('Docter id'));
@@ -114,7 +114,7 @@ class PhoneController extends AdminController
      */
     protected function form()
     {
-        $form = new Form(new Doctertimes());
+        $form = new Form(new DocterTimes());
 
         $form->number('docter_id', __('Docter id'));
         $form->decimal('base_price', __('Base price'));

+ 2 - 2
app/Community/Controllers/ServiceController.php

xqd xqd
@@ -6,7 +6,7 @@ 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\DocterTimes;
 use App\Models\Serviceapplys;
 use Encore\Admin\Controllers\AdminController;
 use Encore\Admin\Form;
@@ -43,7 +43,7 @@ class ServiceController extends AdminController
         $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');
+            $step = DocterTimes::where(['docter_id'=>$this->id])->value('step_price');
             return $step;
         });
 

+ 1 - 1
app/Http/Controllers/Api/V1/OrganizationController.php

xqd
@@ -26,7 +26,7 @@ class OrganizationController extends AuthController
 
         $distance_field = get_user_distance_field($user);
 
-        $builder = Organization::with('docter')->select(['id', 'type', 'name', 'province_id', 'city_id', 'area_id', 'address', 'latitude', 'longitude', DB::raw($distance_field)]);
+        $builder = Organization::with('docter')->select(['id', 'type', 'name', 'province_id', 'city_id', 'area_id', 'address', 'latitude', 'longitude','nurse_notice','vaccine_notice', DB::raw($distance_field)]);
         if (!empty($req['city_id'])) {
             $builder->where('city_id', $req['city_id']);
         }

+ 12 - 4
app/Http/Controllers/Api/V2/DoctorController.php

xqd xqd xqd xqd xqd xqd xqd 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;
 
 
 /**
@@ -398,6 +397,8 @@ class DoctorController extends AuthController
             // 修改更多信息
             if ($finds['is_chat'] == 0) {
                 if (isset($data['is_chat']) && !empty($data['is_chat'])) {
+                    return out('', 500, '您未开启图文');
+
                     unset($data['is_chat']);
                 }
             } else {
@@ -473,9 +474,12 @@ class DoctorController extends AuthController
         $finds = Docter::select(['is_chat', 'is_phone', 'is_appoint'])->where('id', $doctor_id)->first();
         Db::beginTransaction();
         try {
+
             if ($finds['is_phone'] == 0) {
                 if (isset($data['is_phone']) && !empty($data['is_phone'])) {
+                    return out('', 500, '您未开启电话');
                     unset($data['is_phone']);
+
                 }
             } else {
                 if (isset($data['is_phone']) && !empty($data['is_phone'])) {
@@ -483,6 +487,8 @@ class DoctorController extends AuthController
                     DocterServiceTimes::where(['docter_id'=>$doctor_id,'type'=>1])->delete();
 
                     $save_data = $data['is_phone'];
+
+
                     $newData = [];
                     $serviceData = [];
 
@@ -559,6 +565,8 @@ class DoctorController extends AuthController
         try {
             if ($finds['is_appoint'] == 0) {
                 if (isset($data['is_appoint']) && !empty($data['is_appoint'])) {
+                    return out('', 500, '您未开启门诊');
+
                     unset($data['is_appoint']);
                 }
             } else {
@@ -2028,7 +2036,7 @@ class DoctorController extends AuthController
                             if (!$times) {
                                 return out('', 500, "请先在排班设置中填写本机构的早上时间段");
                             }
-                            $maf = $this->getMaf($vv, $times, ['organization_id' => $v['identifi']['zao'], 'schedule_date' => $schedule[$kk]['schedule_date'], 'type' => 1], $doctor_id);
+                            $maf = $this->getMaf($vv, $times, ['organization_id' => $v['identifi']['zao'],'me_sure'=>0, 'schedule_date' => $schedule[$kk]['schedule_date'], 'type' => 1], $doctor_id);
                             if ($maf) {
                                 foreach ($maf as $os) {
                                     $scheduleLists[] = $os;
@@ -2040,7 +2048,7 @@ class DoctorController extends AuthController
                             if (!$times) {
                                 return out('', 500, "请先在排班设置中填写本机构的下午时间段");
                             }
-                            $maf = $this->getMaf($vv, $times, ['organization_id' => $v['identifi']['zhong'], 'schedule_date' => $schedule[$kk]['schedule_date'], 'type' => 2], $doctor_id);
+                            $maf = $this->getMaf($vv, $times, ['organization_id' => $v['identifi']['zhong'],'me_sure'=>0, 'schedule_date' => $schedule[$kk]['schedule_date'], 'type' => 2], $doctor_id);
                             if ($maf) {
                                 foreach ($maf as $os) {
                                     $scheduleLists[] = $os;
@@ -2052,7 +2060,7 @@ class DoctorController extends AuthController
                             if (!$times) {
                                 return out('', 500, "请先在排班设置中填写本机构的晚上时间段");
                             }
-                            $maf = $this->getMaf($vv, $times, ['organization_id' => $v['identifi']['wan'], 'schedule_date' => $schedule[$kk]['schedule_date'], 'type' => 3], $doctor_id);
+                            $maf = $this->getMaf($vv, $times, ['organization_id' => $v['identifi']['wan'],'me_sure'=>0, 'schedule_date' => $schedule[$kk]['schedule_date'], 'type' => 3], $doctor_id);
                             if ($maf) {
                                 foreach ($maf as $os) {
                                     $scheduleLists[] = $os;

+ 4 - 4
app/Models/Docter.php

xqd xqd
@@ -45,8 +45,8 @@ class Docter extends BaseModel
         return $this->hasMany(Order::class,'docter_id','id');
     }
 
-    public function doctertimes(){
-        return $this->belongsTo(Doctertimes::class);
+    public function DocterTimes(){
+        return $this->belongsTo(DocterTimes::class);
     }
     public function getIsCollectAttribute()
     {
@@ -86,13 +86,13 @@ class Docter extends BaseModel
 
     public function getChatPriceAttribute()
     {
-        $base_price = Doctertimes::where('docter_id', $this->id)->where('type', 2)->value('base_price');
+        $base_price = DocterTimes::where('docter_id', $this->id)->where('type', 2)->value('base_price');
         return $base_price*100;
     }
 
     public function getPhonePriceAttribute()
     {
-        $base_price = Doctertimes::where('docter_id', $this->id)->where('type', 1)->value('base_price');
+        $base_price = DocterTimes::where('docter_id', $this->id)->where('type', 1)->value('base_price');
         return $base_price*100;
     }
 }

+ 0 - 17
app/Models/DocterTime.php

xqd
@@ -1,17 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: zilongs
- * Date: 20-9-29
- * Time: 上午11:12
- */
-
-namespace App\Models;
-
-class DocterTime extends BaseModel
-{
-  	public function docter()
-    {
-        return $this->hasOne(Docter::class, 'id', 'docter_id');
-    }
-}

+ 0 - 0
app/Models/Doctertimes.php → app/Models/DocterTimes.php