瀏覽代碼

社区端统计

Swdz-WangHaiJun 4 年之前
父節點
當前提交
d816041d0a

+ 18 - 21
app/Admin/Actions/Community/Notice/sendNotice.php

xqd xqd
@@ -17,9 +17,9 @@ class sendNotice extends BatchAction
             $openid = User::where('id',$model->id)->value('openid');
             $content = request('content');
             $remark= request('remark');
-            $openid = 'oVxTzvgYlGktIDZXwfLMLQ01Tr5s';
+//            $openid = 'oVxTzvgYlGktIDZXwfLMLQ01Tr5s'; 自己
             if(empty($openid)) continue;
-            $this->send($openid,$content,$remark);
+//            $this->send($openid,$content,$remark);
         }
 
         return $this->response()->success('发送成功')->refresh();
@@ -28,40 +28,37 @@ class sendNotice extends BatchAction
     public function form()
     {
         $this->text('title','标题')->value('社区通知')->disable();
-        $this->textarea('content','内容')->value('社区通州')->rows(4);
-        $this->textarea('remark','备注')->value('社区通州')->rows(3);
+        $this->textarea('content','内容')->rows(4);
+        $this->textarea('remark','备注')->rows(3);
     }
 
     public function send($open_id,$cotent, $remark)
     {
-       if(empty($open_id)) return true;
-            $config = [
+        if(empty($open_id)) return true;
+        $config = [
                 'app_id' => 'wx1c2357232cd25f65',
                 'secret' => 'c8cab53e4e52234ed1bc2abbdeaba57d',
-//                'app_id' => 'wx1c2357232cd25f65',
-//                'secret' => 'c8cab53e4e52234ed1bc2abbdeaba57d',
 //            'app_id' => 'wx13bedfcc62e9bab0',
 //            'secret' => '175e5518b6426dd12d3096f24ca68fb8',
                 'response_type' => 'array'
             ];
-            $app = Factory::officialAccount($config);
-            $app->template_message->send([
-                'touser' => $open_id,
+        $app = Factory::officialAccount($config);
+        $user = $app->user->get('oVxTzvgYlGktIDZXwfLMLQ01Tr5sss');
+        if(!isset($user['openid'])) return true;
+        $app->template_message->send([
+                'touser' => 'oVxTzvgYlGktIDZXwfLMLQ01Tr5s',
                 'template_id' => '3LUhWGlyiljxrT3Jh8orwQZ2LSHjfRs9SIHaB40O6q0',
-                'url' => 'http://47.94.228.245',
-                'miniprogram' => [
-                    'appid' => 'wx1c2357232cd25f65',
-                    'pagepath' => 'pages/index/index',
-                ],
+            //            'url' => 'https://t5.9026.com',
                 'data' => [
                     'first'=>'社区通知',
-                    'key1' => $cotent,
-                    'key2' => 18719141830,
-                    'key3' => '开发工程师',
-                    'key4' => '思维定制',
-                    'key5' => '2020-12-12',
+                    'keyword1' => '王海军',
+                    'keyword2' => 18719141830,
+                    'keyword3' => '开发工程师',
+                    'keyword4' => '思维定制',
+                    'keyword5' => '2020-12-12',
                 ],
             ]);
+        return true;
     }
 
 

+ 28 - 20
app/Community/Controllers/ApiController.php

xqd
@@ -60,30 +60,38 @@ class ApiController extends Controller
 
 
 
-//        oVxTzvgYlGktIDZXwfLMLQ01Tr5s 自己
+//        oVxTzvgYlGktIDZXwfLMLQ01Tr5s 自己 oVxTzvhu4gs4RyCt4kJDRWOgsUXw周璐 oVxTzvgu4XnI5F2aF7DcrbJIp5fI 间行 oVxTzvl8DYQblYmLCIK3UXW_8jAY 落雨桐
         $renyuan = ['oVxTzvhu4gs4RyCt4kJDRWOgsUXw','oVxTzvgYlGktIDZXwfLMLQ01Tr5s']; //周璐
 //        $renyuan = ['oVxTzvvTnnbjEE9jsalOYj4mtp6U','oVxTzvgu4XnI5F2aF7DcrbJIp5fI']; //简行
         $app = Factory::officialAccount($config );
-//        $res = $app->template_message->send([
-//            'touser' => 'oVxTzvgYlGktIDZXwfLMLQ01Tr5s',
-//            'template_id' => '3LUhWGlyiljxrT3Jh8orwQZ2LSHjfRs9SIHaB40O6q0',
-//            'url' => 'http://47.94.228.245',
-//            'miniprogram' => [
-//                'appid' => 'wx1c2357232cd25f65',
-//                'pagepath' => 'pages/index/index',
-//            ],
-//            'data' => [
-//                'first'=>'社区通知',
-//                'key1' => '模板消息发送',
-//                'key2' => 18719141830,
-//                'key3' => '开发工程师',
-//                'key4' => '思维定制',
-//                'key5' => '2020-12-12',
-//            ],
-//        ]);
-        $res = $app->broadcasting->sendText("大家好!欢迎使用 EasyWeChat。",$renyuan);
-
+//        $res = $app->broadcasting->status(3147483751);
+//
+//  "errcode" => 0
+//  "errmsg" => "send job submission success"
+//  "msg_id" => 3147483751
+//  "msg_data_id" => 2247484953
+//        ^ array:2 [▼
+//  "errcode" => 40003
+//  "errmsg" => "invalid openid rid: 5fc35ef3-7f3b3ef9-14537bc7"
+//]
+        $user = $app->user->get('oVxTzvgYlGktIDZXwfLMLQ01Tr5s');
+        dd($user);
+        $res = $app->template_message->send([
+            'touser' => 'oVxTzvgYlGktIDZXwfLMLQ01Tr5s',
+            'template_id' => '3LUhWGlyiljxrT3Jh8orwQZ2LSHjfRs9SIHaB40O6q0',
+//            'url' => 'https://t5.9026.com',
+            'data' => [
+                'first'=>'社区通知',
+                'keyword1' => '王海军',
+                'keyword2' => 18719141830,
+                'keyword3' => '开发工程师',
+                'keyword4' => '思维定制',
+                'keyword5' => '2020-12-12',
+            ],
+        ]);
         dd($res);
+        $res = $app->broadcasting->sendText("测试发送,测试发送",$renyuan);
+
     }
 
 

+ 10 - 9
app/Community/Controllers/NoticeController.php

xqd xqd
@@ -5,6 +5,7 @@ namespace App\Community\Controllers;
 use App\Models\Notice;
 use App\Models\User;
 use Encore\Admin\Controllers\AdminController;
+use Encore\Admin\Facades\Admin;
 use Encore\Admin\Form;
 use Encore\Admin\Grid;
 use Encore\Admin\Layout\Content;
@@ -26,17 +27,17 @@ class NoticeController extends AdminController
      */
     protected function grid()
     {
-        $grid = new Grid(new Notice());
 
-        $grid->column('id', __('Id'));
-        $grid->column('org_id', __('Org id'));
-        $grid->column('title', __('Title'));
-        $grid->column('content', __('Content'));
-        $grid->column('remark', __('Remark'));
-        $grid->column('created_at', __('Created at'));
-        $grid->column('updated_at', __('Updated at'));
+        $content = new Content();
 
-        return $grid;
+    $content->title('通知公告')
+        ->description('公告列表');
+        $user = Admin::user();
+        $org_id = $user->org_id;
+        $docter_id = $user->docter_id;
+        $notice = Notice::get();
+        $content->view('cdms.notice',['notice'=>$notice]);
+        return $content;
     }
 
     /**

+ 17 - 6
app/Community/Controllers/StatController.php

xqd xqd xqd
@@ -6,6 +6,8 @@ namespace App\Community\Controllers;
 
 use App\Http\Controllers\Controller;
 use App\Models\Order;
+use App\Models\Schedule;
+use App\Models\SchedulePeriod;
 use App\Models\Vaccine;
 
 class StatController extends  Controller
@@ -14,10 +16,13 @@ class StatController extends  Controller
     //疫苗统计
     public function vaccine()
     {
-      $data ['count'] = Vaccine::count();
-      $data['have'] = Vaccine::sum('state');
-      $data['today_spend'] = Order::where(['']);
-      return $data;
+        $data ['count'] = Vaccine::count();
+        $data['have'] = Vaccine::sum('state');
+        $data['today_spend'] = Order::where(['state'=>0])->count();//取苗钟数
+        $data['success'] = Order::where(['order_status'=>1])->where('product_type',4)->where('created_at','>',date('Y-m-d H:i:s',time()))->count();
+        $data['today_vaccine'] = Order::where(['product_type'=>4])->with('orderPatient','appoint_start_time',strtotime('today'))->count();//接诊患者(人次)
+
+        return $data;
 
     }
 
@@ -27,18 +32,24 @@ class StatController extends  Controller
     public function service()
     {
         $data['success'] = Order::where(['order_status'=>1])->whereIn('product_type',[3,4,5])->where('created_at','>',date('Y-m-d H:i:s',time()))->count();
+        $data['success'] = SchedulePeriod::distinct()->where('schedule_data',date('Y-m-d H:i:s',time()))->count();
+//        $data['paitent_num'] = Order::where(['order_status'=>1])->distinct()->count()->BgroupBy('patient_id');
+        $data['paitent_num'] = Order::where(['product_type'=>4,'orderPatient.appoint_start_time'=>strtotime('today')])->count();//接诊患者(人次)
+
+
+
 
     }
 
     //儿保概况
     public function nurse()
     {
-
+     $nurse_num = Order::where('prdoduct_type',5)->where('created_at','>',strtotime('today'));
     }
 
     //排班统计
     public function schedule()
     {
-
+        SchedulePeriod::where('schedule_date',strtotime('today'))->distinct('docter_id')->get()->GroupBy('docter.type');
     }
 }

+ 1 - 1
app/Community/routes.php

xqd
@@ -15,7 +15,7 @@ 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('notices', NoticeController::class);
+Route::get('notices', 'NoticeController@grid');
 
 //群发通知
 Route::resource('user_notices', UserNoticeController::class);

+ 5 - 0
app/Models/SchedulePeriod.php

xqd
@@ -19,4 +19,9 @@ class SchedulePeriod extends BaseModel
     {
         return $this->belongsTo(TimePeriod::class)->select(['id', 'start_time_period', 'end_time_period']);
     }
+
+    public function docter()
+    {
+        return $this->hasOne(Docter::class,'id','docter_id');
+    }
 }

+ 8 - 0
resources/views/cdms/notice.blade.php

xqd
@@ -0,0 +1,8 @@
+
+@foreach($notice as $val)
+<div>
+    <div>{{$val->title}}</div>
+    <div>{{$val->content}}</div>
+</div>
+@endforeach
+