<?php

namespace App\Http\Controllers;

use SoapFault;
use SoapClient;
use App\Models\InfoItem;
use Illuminate\Http\Request;
use App\Models\RoadObserved;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Auth;

class TotalRahdariProjectsReportController extends Controller
{
    // M.D.
    // public function index()
    // {
    //     $url = "https://riws.rmto.ir/WebServices/NRPTrafficStatus.asmx?wsdl";
    //     try {
    //         $array = array('strUserName' => 'vaytelrop',
    //                            'strPassword' => 'VaYtelROP*2024',
    //                            'strAutoID' => '67655',
    //                            'strStateID' => '2',
    //                            'strDescription' => 'test',
    //                            'strPreviousImageLink' => 'testlink',
    //                            'strNextImageLink' => 'test link',
    //                            'strRMSDateAndTime' => 'alan'
    //                       );
    //         $soap_client = new SoapClient($url);
    //         $result = $soap_client->UpdateInfo_RoadObservedProblems($array);
    //     } catch (SoapFault $e) {
    //         echo $e->getMessage();
    //         $msg = 'rms: error in get road observation webservice babe!!!!'."\n";
    //         $msg .= $e->getMessage();
    //         // self::sms_sender('09398586633',$msg);
    //         // self::sms_sender('09367487107',$msg);
    //         return 0;
    //     }
    //     dd($result);
    //     return $result;
    //     $result = serialize($result);
    // }
    public function get_sub_items(Request $request)
    {
        $data = InfoItem::all();
        $items = InfoItem::groupBy('item')->get();
        return response()->json([
            'status' => 'succeed',
            'message' => '',
            'data' => $data,
            'items' => $items
        ], 200);
    }
    public function get_items(Request $request)
    {
        if ($request->from_date && $request->date_to) {
            $from_date = $request->from_date;
            $date_to = $request->date_to;
            $from_date = $from_date.' 00:00:00';
            $date_to = $date_to.' 23:59:59';
        } else {
            $from_date = Date('Y-m-d');
            $from_date = $from_date.' 00:00:00';
            $date_to = Date('Y-m-d');
            $date_to = $date_to.' 23:59:59';
        }
        $item = $request->item;
        $all = array();
        $all = DB::select(DB::raw(
            'SELECT sub_item AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN sub_item_data>0 THEN sub_item_data ELSE ABS(sub_item_data) END) AS UNSIGNED) AS s,province_id AS p FROM road_items_projects WHERE item = '.$item.' AND activity_date_time BETWEEN "'.$from_date.'" AND "'.$date_to.'" and status = 1 GROUP BY p, sub_item'));
        $country =DB::select(DB::raw(
            'SELECT sub_item AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN sub_item_data>0 THEN sub_item_data ELSE ABS(sub_item_data) END) AS UNSIGNED) AS s, -1 AS p FROM road_items_projects WHERE item = '.$item.' AND activity_date_time BETWEEN "'.$from_date.'" AND "'.$date_to.'" and status = 1 GROUP BY sub_item'));

        // switch ($item) {
        //     case 1:
        //         $all = DB::select(DB::raw(
        //             'SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'" )t )d GROUP BY p
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'" )t  )d GROUP BY p
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'" )t  )d GROUP BY p
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'" )t  )d GROUP BY p
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction8-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction9-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 10 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction10-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction10-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 11 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction11-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction11-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 12 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction12-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction12-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 13 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction13-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction13-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'
        //         ));
        //     $country = DB::select(DB::raw(
        //         'SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t )d 
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'" )t )d 
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'" )t  )d 
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'" )t  )d 
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'" )t  )d 
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //         UNION 
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction8-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //         UNION 
        //         SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction9-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //         UNION 
        //         SELECT 10 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction10-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction10-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //         UNION 
        //         SELECT 11 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction11-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction11-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //         UNION 
        //         SELECT 12 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction12-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction12-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //         UNION 
        //         SELECT 13 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction13-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction13-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d '
        //     ));
        //         break;
        //     case 2:
        //         $all = DB::select(DB::raw(
        //             'SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning8-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning9-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 10 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning10-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning10-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 11 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning11-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning11-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 12 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning12-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning12-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 13 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning13-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning13-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 14 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning14-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning14-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 15 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning15-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning15-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 16 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning16-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning16-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 17 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning17-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning17-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 18 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning18-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning18-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 19 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning19-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning19-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'
        //         ));

        //         $country = DB::select(DB::raw(
        //             'SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning1-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning2-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning3-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning4-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning5-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning6-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning7-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning8-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning9-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 10 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning10-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning10-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 11 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning11-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning11-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 12 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning12-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning12-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 13 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning13-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning13-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 14 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning14-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning14-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 15 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning15-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning15-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 16 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning16-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning16-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 17 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning17-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning17-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 18 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning18-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning18-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d 
        //             UNION 
        //             SELECT 19 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //                 AS UNSIGNED)AS s,-1 AS p FROM 
        //             (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning19-1")) AS reconstruction1,
        //             item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //             WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning19-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d '
        //         ));

        //         break;
        //     case 3:
        //         $all = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs8-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'));

        //         $country = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs8-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d'));
        //         break;
        //     case 4:
        //         $all = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield1-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 4 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield1-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield2-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 4 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield2-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield3-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 4 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield3-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'));
                
        //         $country = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield1-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 4 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield1-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield2-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 4 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield2-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield3-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 4 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield3-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d'));

        //         break;
        //     case 5:
        //         $all = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting1-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting1-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting2-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining2-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting3-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting3-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting4-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting4-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting5-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting5-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting6-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting6-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting7-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting7-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting8-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting8-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting9-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting9-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 10 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting10-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting10-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 11 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting11-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting11-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'));

        //         $country = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting1-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting1-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting2-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining2-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting3-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting3-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting4-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting4-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting5-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting5-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting6-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting6-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting7-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting7-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting8-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting8-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting9-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting9-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 10 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting10-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting10-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 11 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting11-2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting11-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d'));

        //         break;
        //     case 6:
        //         $all = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'));

        //         $country = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d'));

        //         break;
        //     case 7:
        //         $all = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring8-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring9-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'));

        //         $country = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring8-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring9-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d'));

        //         break;
        //     case 8:
        //         $all = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'));

        //         $country = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d'));

        //         break;
        //     case 9:
        //         $all = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing8-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing9-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 10 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing10-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing10-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 11 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing11-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing11-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 12 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing12-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing12-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 13 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing13-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing13-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 14 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing14-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing14-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 15 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing15-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing15-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'));

        //         $country = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing8-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing9-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 10 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing10-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing10-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 11 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing11-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing11-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 12 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing12-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing12-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 13 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing13-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing13-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 14 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing14-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing14-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 15 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing15-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing15-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d'));

        //         break;
        //     case 10:
        //         $all = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'));


        //         $country = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d'));

        //         break;
        //     case 11:
        //         $all = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'));

        //         $country = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d'));

        //         break;
        //     case 12:
        //         $all = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'));

        //         $country = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d'));

        //         break;
        //     case 13:
        //         $all = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 13 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 13 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 13 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 13 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation8-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 13 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'));

        //         $country = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 13 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 13 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 13 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 13 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation8-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 13 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d'));
                
        //         break;
        //     case 14:
        //         $all = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery8-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery9-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION
        //         SELECT 10 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery10-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery10-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'));

        //         $country = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery8-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery9-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION
        //         SELECT 10 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery10-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery10-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d'));

        //         break;
        //     case 15:
        //         $all = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tollhouse4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 15 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tollhouse4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,0 AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tollhouse3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 15 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tollhouse3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'));

        //         $country = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tollhouse4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 15 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tollhouse4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,0 AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tollhouse3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 15 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tollhouse3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d'));

        //         break;
        //     case 16:
        //         $all = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency8-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p
        //         UNION 
        //         SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency9-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'));



        //         $country = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //         AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency1-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency2-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency3-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency4-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency5-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency6-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency7-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency8-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d
        //         UNION 
        //         SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
        //             AS UNSIGNED)AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency9-1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d'));

        //         break;
        //     case 20:
        //         $all = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,0 AS s,province_id AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.snowWatch1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 20 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.snowWatch1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d GROUP BY p'));

        //         $country = DB::select(DB::raw('
        //         SELECT 1 AS t,COUNT(*) AS c,0 AS s,-1 AS p FROM 
        //         (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.snowWatch1")) AS reconstruction1,
        //         item,sub_items_data,created_at AS submited_at,province_id FROM road_items_projects 
        //         WHERE item = 20 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.snowWatch1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d'));

        //         break;
        //     default:
        //         break;
        // }
        $items_fa = InfoItem::where('item', $item)->get();
        // dd($items_fa);
        foreach ($all as $value) {
            foreach ($items_fa as $val) {
                if ($value->t == $val->sub_item) {
                    $value->u = $val->sub_item_unit;
                }
            }
        }
        return response()->json([
            'status' => 'succeed',
            'message' => '',
            'data' => $all,
            'country' =>$country,
            'items_fa' => $items_fa
        ], 200);
    }
    public function get_items_city(Request $request)
    {
        $item = $request->item;
        if ($request->from_date && $request->date_to) {
            $from_date = $request->from_date.' 00:00:00';
            $date_to = $request->date_to.' 23:59:59';
        } else {
            $from_date = Date('Y-m-d');
            $date_to = Date('Y-m-d');
            $date_to = $date_to.' 23:59:59';
        }
        $item = $request->item;
        $province = $request->province_id;
        $all = array();
        switch ($item) {
            case 1:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction1-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction3-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction4-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction5-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction6-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction8-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction9-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 10 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction10-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction10-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 11 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction11-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction11-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 12 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction12-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction12-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 13 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction13-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 1 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.reconstruction13-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 2:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning1-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning3-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning4-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning5-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning6-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning7-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning8-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning9-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 10 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning10-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning10-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 11 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning11-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning11-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 12 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning12-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning12-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 13 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning13-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning13-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 14 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning14-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning14-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 15 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning15-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning15-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 16 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning16-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning16-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 17 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning17-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning17-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 18 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning18-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning18-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 19 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning19-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 2 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.cleaning19-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 3:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs1-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs3-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs4-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs5-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs6-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs7-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs8-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 3 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.signs8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 4:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield1-2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 4 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield1-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield2-2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 4 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield2-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield3-2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 4 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.shield3-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 5:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting1-2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting1-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting2-2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining2-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting3-2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting3-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting4-2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting4-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting5-2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting5-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting6-2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting6-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting7-2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting7-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting8-2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting8-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting9-2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting9-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 10 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting10-2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting10-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 11 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting11-2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 5 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lighting11-2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 6:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining1-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining3-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining4-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining5-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining6-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 6 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.lining6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 7:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring1-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring3-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring4-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring5-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring6-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring7-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring8-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring9-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 7 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.coloring9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 8:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing1-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing3-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing4-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing5-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing6-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing7-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 8 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.washing7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 9:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing1-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing3-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing4-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing5-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing6-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing7-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing8-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing9-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 10 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing10-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing10-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 11 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing11-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing11-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 12 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing12-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing12-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 13 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing13-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing13-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 14 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing14-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing14-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 15 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing15-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 9 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.securing15-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 10:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy1-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy3-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy4-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy5-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy6-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 10 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.privacy6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 11:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge1-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge3-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge4-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge5-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge6-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION
                SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge7-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 11 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.bridge7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 12:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel1-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel3-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel4-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel5-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel6-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION
                SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel7-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 12 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tunnel7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 13:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation1-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 13 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 13 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation5-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 13 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation7-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 13 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION
                SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation8-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 13 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.winterOperation8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 14:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery1-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery3-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery4-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery8-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery9-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION
                SELECT 10 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery10-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 14 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.machinery10-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 15:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tollhouse4-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 15 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tollhouse4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,0 AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tollhouse3-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 15 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.tollhouse3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 16:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency1-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency1-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 2 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency2-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency2-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 3 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency3-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency3-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 4 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency4-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency4-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 5 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency5-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency5-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 6 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency6-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency6-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 7 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency7-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency7-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 8 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency8-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency8-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci
                UNION 
                SELECT 9 AS t,COUNT(*) AS c,CAST(SUM(CASE WHEN reconstruction1>0 THEN reconstruction1 ELSE ABS(reconstruction1) END)
                    AS UNSIGNED)AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency9-1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 16 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.emergency9-1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            case 20:
                $all = DB::select(DB::raw('SELECT 1 AS t,COUNT(*) AS c,0 AS s,province_id AS p,city_id AS ci FROM 
                (SELECT * FROM (SELECT user_id,JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.snowWatch1")) AS reconstruction1,
                item,sub_items_data,created_at AS submited_at,province_id, city_id FROM road_items_projects 
                WHERE item = 20 AND JSON_UNQUOTE(JSON_EXTRACT(sub_items_data,"$.snowWatch1")) IS NOT NULL AND created_at BETWEEN "'.$from_date.'" AND "'.$date_to.'"  )t  )d WHERE province_id = '.$province.' GROUP BY ci'));
                break;
            default:
                break;
        }
        $items_fa = InfoItem::where('item', $item)->get();
        // dd($items_fa);
        foreach ($all as $value) {
            foreach ($items_fa as $val) {
                if ($value->t == $val->sub_item) {
                    $value->u = $val->sub_item_unit;
                }
            }
        }
        return response()->json([
            'status' => 'succeed',
            'message' => '',
            'data' => $all,
            'items_fa' => $items_fa
        ], 200);
    }
    public function excel1(Request $request)
    {
        if (auth()->user()) {
            auth()->user()->addActivityComplete(1033);
        }
        if ($request->from_date && $request->date_to) {
            $from_date = $request->from_date;
            $date_to = $request->date_to;
        } else {
            $from_date = Date('Y-m-d');
            $date_to = Date('Y-m-d');
        }

        if (Auth::user()->username == 'witel' || Auth::user()->username == 'drdanesh') {
            $sql = "SELECT COUNT(*) AS s,province_id AS p,item AS i
            FROM road_items_projects WHERE
            road_items_projects.status = 1 and road_items_projects.activity_date_time BETWEEN '".$from_date." 00:00:00' and '".$date_to." 23:59:59' GROUP BY province_id,item
            UNION 
            SELECT COUNT(*) AS s,province_id AS p,77 AS i FROM road_patrols 
            WHERE
            start_time BETWEEN '".$from_date." 00:00:00' and '".$date_to." 23:59:59' GROUP BY province_id
            UNION
            SELECT COUNT(*) AS s,-1 AS p,item AS i FROM road_items_projects
            WHERE road_items_projects.status = 1 and road_items_projects.activity_date_time BETWEEN '".$from_date." 00:00:00' and '".$date_to." 23:59:59'
            GROUP BY item
            UNION
            SELECT COUNT(*) AS s,-1 AS p,77 AS i FROM road_patrols 
            WHERE start_time BETWEEN '".$from_date." 00:00:00' and '".$date_to." 23:59:59'";
        } else {

            $province_id = Auth::user()->province_id;
            $sql = "SELECT COUNT(*) AS s,province_id AS p,item AS i
            FROM road_items_projects WHERE road_items_projects.status = 1 and road_items_projects.province_id = ".$province_id." and 
            road_items_projects.activity_date_time BETWEEN '".$from_date." 00:00:00' and '".$date_to." 23:59:59' GROUP BY province_id,item
            UNION 
            SELECT COUNT(*) AS s,province_id AS p,77 AS i FROM road_patrols 
            WHERE road_patrols.province_id = ".$province_id." and
            road_patrols.start_time BETWEEN '".$from_date." 00:00:00' and '".$date_to." 23:59:59' GROUP BY province_id
            UNION
            SELECT COUNT(*) AS s,-1 AS p,item AS i FROM road_items_projects
            WHERE road_items_projects.status = 1 and road_items_projects.province_id = ".$province_id." and road_items_projects.activity_date_time BETWEEN '".$from_date." 00:00:00' and '".$date_to." 23:59:59'
            GROUP BY item
            UNION
            SELECT COUNT(*) AS s,-1 AS p,77 AS i FROM road_patrols 
            WHERE  road_patrols.province_id = ".$province_id." and road_patrols.start_time BETWEEN '".$from_date." 00:00:00' and '".$date_to." 23:59:59'";
        }
        // dd($sql);
        $data = DB::select(DB::raw($sql));

        return response()->json([
            'status' => 'succeed',
            'message' => '',
            'data' => $data,
        ], 200);
    }


    public function excel1_city(Request $request)
    {
        $p = $request->province_id;
        if ($request->from_date && $request->date_to) {
            $from_date = $request->from_date;
            $date_to = $request->date_to;
        } else {
            $from_date = Date('Y-m-d');
            $date_to = Date('Y-m-d');
        }

        $sql = "SELECT COUNT(*) AS s,city_id AS c,item AS i
        FROM road_items_projects where
        status = 1 and road_items_projects.activity_date_time between '".$from_date." 00:00:00' and '".$date_to." 23:59:59'
        and province_id= '".$p."' GROUP BY item,city_id
        UNION 
        SELECT COUNT(*) AS s,city_id AS c,77 AS i FROM road_patrols 
        where
        road_patrols.start_time between '".$from_date." 00:00:00' and '".$date_to." 23:59:59' 
        and province_id= '".$p."' GROUP BY city_id";

        $data = DB::select(DB::raw($sql));
        return response()->json([
            'status' => 'succeed',
            'message' => '',
            'data' => $data,
        ], 200);
    }
}