Browse Source

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

Swdz-WangHaiJun 4 years ago
parent
commit
c959c9305d

+ 1 - 1
app/Admin/Controllers/ServicePacksManagment/ServicePacksController.php

xqd
@@ -45,7 +45,7 @@ class ServicePacksController extends AdminController
                 }
                 return $label;
                     }
-            return 0;
+            return '无';
         })->label('info');
         $grid->column('price', __('价格'));
         $grid->column('team_id', __('团队名称'))->display(function (){

+ 22 - 3
app/Admin/Controllers/UserManagement/BmUser/UserServiceController.php

xqd xqd xqd
@@ -6,6 +6,7 @@ use App\Models\Order;
 use App\Models\OrderPack;
 use App\Models\Patient;
 use App\Admin\Actions\backstage\User\Insurance ;
+use App\Models\Team;
 use Encore\Admin\Controllers\AdminController;
 use Encore\Admin\Form;
 use Encore\Admin\Grid;
@@ -42,8 +43,6 @@ class UserServiceController extends AdminController
 
             // 去掉编辑
             $actions->disableEdit();
-            //保险单链接
-            $actions->add(new Insurance());
         });
         $grid->model()->orderBy('id','desc');
         $grid->column('orderPack.id', __('Id'));
@@ -57,7 +56,27 @@ class UserServiceController extends AdminController
         $grid->column('orderPack.pack_price', __('服务包价格'))->display(function ($price){
             return $price/100;
         });
-        $grid->column('orderPack.team_id', __('医生团队ID'));
+        $grid->column('orderPack.team_id', __('医生团队'))->display(function ($team)
+        {
+            $team = json_decode($team);
+            if (empty($team))
+            {
+                return '无';
+            }else
+            {
+                $team1 =[];
+//                if (is_array($team))
+//                {
+//                    foreach ($team as $value)
+//                    {
+//                        $value = (int)$value;
+//                        array_push($team1,$value);
+//                    }
+                    $res = Team::whereIn('id',$team)->pluck('name')->toArray();
+                    return $res;
+//                }
+            }
+        })->label('info');
 
         $grid->column('orderPack.effective_days', __('有效天数'));
         $grid->column('orderPack.start_time', __('开始时间'))->display(function ($start_time){

+ 15 - 0
app/Admin/Controllers/UserManagement/DocterManagement/ApproveController.php

xqd
@@ -46,6 +46,21 @@ class ApproveController extends AdminController
         $grid->column('office.name', __('科室'));
         $grid->column('qualification.name', __('医生资质'));
         $grid->column('remarks', __('备注'));
+        $grid->column('docter.practice','医生照片和执业证书')->display(function ($img) {
+            $arr = explode(',',$img);
+            return $arr;
+        })->lightbox(['width' =>'', 'height' => 30]);
+
+        $grid->column('docter.card_photo','	身份证正反面')->display(function ($img) {
+            $arr = explode(',',$img);
+            return $arr;
+        })->lightbox(['width' =>'', 'height' => 30]);
+
+        $grid->column('docter.is_quail','照片和资格证书')->display(function ($img) {
+            $arr = explode(',',$img);
+            return $arr;
+        })->lightbox(['width' =>'', 'height' => 30]);
+
         $grid->column('state', __('认证状态'))->using([1=>'已认证',2=>'审核驳回',3=>'待审核'])->label('info');
         $grid->column('authentication_time', __('签约时间'))->display(function ($time){
             if ($time == 0){

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

xqd
@@ -113,11 +113,12 @@ class DoctorManagementController extends AdminController
             return $type_arr;
         })->label('info');
         $grid->column('label', __('标签'))->display(function ($label){
+//            dd($label);
             if($label==null)
             {
                 return '无';
             }
-            if($label = '无'){
+            if($label == '无'){
                 return '无';
             }
             $label_value = DocterLabel::whereIn('id',$label)->where('status',1)->pluck('label_name')->toArray();

+ 1 - 15
app/Admin/Controllers/VaccinesManagement/VaccinesController.php

xqd
@@ -74,21 +74,7 @@ class VaccinesController extends AdminController
             });
             $filter->column(1/2, function ($filter) {
                $filter->equal('name','疫苗名称');
-//               $filter->in('organizations','机构名称')->select(Organization::all()->pluck('name','id'));
-                $filter->where(function ($query) {
-                    $query->join('organization_vaccines', 'organization_vaccines.vaccine_id', '=', 'vaccines.id')
-                        ->where('organization_vaccines.org_id',$this->input);
-                },'机构名称')->select(Organization::all()->pluck('name','id'));
-
-//                $filter->where(function ($model){
-//                    $model->whereHas('organizationvaccines',function ($model) {
-//                    $model->join('vaccines', 'organization_vaccines.vaccine_id', '=', 'vaccines.id')
-//                        ->where('vaccines.id',$this->input)
-//                        ->get();
-//                    });
-//
-//                },'机构名称1')->select(Organization::all()->pluck('name','id'));
-
+                $filter->equal('organizationvaccines.org_id','机构')->select(Organization::pluck('name','id'));
             });
         });
         //按关键字查询

+ 25 - 15
app/Http/Controllers/Api/V1/DocterController.php

xqd xqd
@@ -186,9 +186,7 @@ class DocterController extends AuthController
             'latitude' => 'numeric',
             'longitude' => 'numeric',
         ]);
-        $user = $this->user;
-        //todo Schedule表 考虑是否有必要性,日期可以通过timePeriod取到。
-        $builder = Schedule::with(['schedulePeriod.timePeriod', 'schedulePeriod.organization'])->where('docter_id', $req['docter_id'])->where('schedule_day', '>=', date('Ymd'));
+        $builder = Schedule::with(['schedulePeriod.timePeriod', 'schedulePeriod.organization'])->where('docter_id', $req['docter_id'])->where('schedule_type',1)->where('schedule_day', '>=', date('Ymd'));
         if (!empty($req['organization_id'])) {
             $builder->where('organization_id', $req['organization_id']);
         }
@@ -271,21 +269,33 @@ class DocterController extends AuthController
 
     public function timePeriodList()
     {
+
         $req = request()->post();
         $this->validate(request(), [
-            'organization_id' => 'required|integer',
+            'docter_id' => 'required|integer',
+            'organization_id' => 'integer',
+            'schedule_type' => 'integer',
+            'per_page' => 'integer',
+            'latitude' => 'numeric',
+            'longitude' => 'numeric',
         ]);
-
-        $data = [];
-        //todo 门诊排班诊与医生相关
-        $data['list'] = TimePeriod::select(['id', 'start_time_period', 'end_time_period'])->where('org_id', $req['organization_id'])->get()->toArray();
-
-        for ($i = 0; $i < 7; $i++) {
-            if ($i > 0) {
-                $data['dates'][] = date('Y-m-d', strtotime("+$i days"));
-            }
-            else {
-                $data['dates'][] = date('Y-m-d');
+        $builder = Schedule::with(['schedulePeriod.timePeriod', 'schedulePeriod.organization'])->where('docter_id', $req['docter_id'])->where('schedule_type', $req['schedule_type'])->where('schedule_day', '>=', date('Ymd'));
+        if (!empty($req['organization_id'])) {
+            $builder->where('organization_id', $req['organization_id']);
+        }
+        $data = $builder->paginate($req['per_page']??15)->toArray();
+        if (!empty($data)) {
+            foreach ($data['data'] as $k => &$v) {
+                foreach ($v['schedule_period'] as $k1 => &$v1) {
+                    $docterSettings = DocterSetting::select(['service_num'])->where('docter_id', $req['docter_id'])->where('type', 1)->where('org_id', $v1['organization_id'])->first();
+                    if (empty($docterSettings)) {
+                        $v1['can_appoint_num'] = 0;
+                    }
+                    else {
+                        $can_appoint_num = $docterSettings['service_num'] - $v1['order_num'];
+                        $v1['can_appoint_num'] = $can_appoint_num < 0 ? 0 : $can_appoint_num;
+                    }
+                }
             }
         }
 

+ 17 - 0
app/Models/DocterTime.php

xqd
@@ -0,0 +1,17 @@
+<?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');
+    }
+}

+ 2 - 3
app/Models/Doctertimes.php

xqd
@@ -10,9 +10,8 @@ namespace App\Models;
 
 class DocterTimes extends BaseModel
 {
-
-
-    public function docter(){
+  	public function docter(){
         return $this->hasOne(Docter::class,'id','docter_id');
     }
+
 }