whereRaw("DATE_FORMAT(`service_date`,'%Y-%m') = '{$month}'") // ->where("total", ">", 0)->get(); // $order_items_count = $order_items->count(); // $total = $order_items->sum("total"); // $orders_count = $order_items->groupBy("order_id")->count(); // // foreach ($order_items as &$item) { // $item = $item->calculateFee(); // } // $total_paramedic = $order_items->sum("paramedic_total"); // $fee = $total - $total_paramedic; // $laravel_duration = microtime(true) - LARAVEL_START; return view($this->bladePath . ".home"); } /** * 统计 */ public function statistic() { // 护工陪护 $paramedic = [ 'total' => Paramedic::count(), 'has_accompany' => '', 'no_accompany' => '', 'accompany_order' => '', 'rate' => '' ]; // 床位陪护 $bed = [ 'total' => Bed::count(), 'has_accompany' => '', 'no_accompany' => '', 'rate' => '' ]; // 陪护统计表 $project = Project::get(); foreach ($project as $item) { } // 最新陪护单 $lastOrder = Orders::with('project') ->where('status', 0) ->orderBy('id', 'desc') ->limit(8) ->get(); // 最新出院信息 $outOrder = Orders::with('project') ->where('status', 100) ->orderBy('id', 'desc') ->limit(8) ->get(); // 最新投诉信息 $tip = []; // 上月满意度评价分析 $satisfied = []; // 本月营收分析 $income = []; // 本月陪护订单 $monthAccompany = []; return $this->ajaxSuccess('获取成功', compact('paramedic', 'bed', 'project', 'lastOrder', 'outOrder', 'tip', 'satisfied', 'income', 'monthAccompany')); } }