{
  "module": "m2",
  "flag": "vertical",
  "configs": [
    {
      "key": "query_sp",
      "desc":"汇总表",
      "config": {
        "parameters": [
          {
            "name": "p_en",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c0",
            "symbol":""
          }, {
            "name": "starttime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c1",
            "symbol":""
          }, {
            "name": "endtime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c2",
            "symbol":""
          }, {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          }
        ],
        "value": "SELECT     DestinationIP,     CategoryName,     App_Type,     PoorQualityType,     round(DLrate,2.0) dlrate,     round(responddelay,2.0) responddelay,    round( RequsetSuccessRate,4.0) RequsetSuccessRate,     usernumber,     round(TotalFlow/1024,2.0) as totalflow,     round(dlrate_500k,2.0) dlrate_500k,     requestcount_500k,     round(flow_500k/1024,2.0) as flow_500k,     round(flowrate_500,2.0) as flowrate_500 FROM     LTE_SYS.[@c0]_T_End_TO_End_Analysis_SP_PoorQuality order by DestinationIP"
      }
    },
    {
      "key": "query_sp_p_en",
      "desc":"按项目汇总表数据",
      "config": {
        "parameters": [
          {
            "name": "p_en",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c0",
            "symbol":""
          }, {
            "name": "starttime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c1",
            "symbol":""
          }, {
            "name": "endtime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c2",
            "symbol":""
          }, {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          },
          {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          },
          {
            "name": "Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          },
          {
            "name": "Threshold_data7",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t7",
            "symbol":""
          },
          {
            "name": "Threshold_data8",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t8",
            "symbol":""
          },
          {
            "name": "Threshold_data9",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t9",
            "symbol":""
          },
          {
            "name": "Threshold_data10",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t10",
            "symbol":""
          },
          {
            "name": "Threshold_data11",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t11",
            "symbol":""
          },
          {
            "name": "Threshold_data12",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t12",
            "symbol":""
          },
          {
            "name": "Threshold_data13",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t13",
            "symbol":""
          },
          {
            "name": "Threshold_data14",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t14",
            "symbol":""
          },
          {
            "name": "Threshold_data15",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t15",
            "symbol":""
          },
          {
            "name": "Threshold_data16",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t16",
            "symbol":""
          }
        ],
        "value": "SELECT     * FROM     (         SELECT             spc.DestinationIP,             spc.app_type,             type.categoryname,             type.appsubtypename,             spc.PoorQualityType,             spc.DLrate ,             spc.responddelay,             spc.RequsetSuccessRate,             spc.usernumber,             spc.DLData ,             CASE                 WHEN spc.dlrate_500k<2048                 AND spc.PoorQualityType='速率'                 THEN dlrate_500k                 WHEN spc.PoorQualityType='成功率'                 THEN dlrate_500k                 WHEN spc.PoorQualityType='时延'                 THEN dlrate_500k             END                              dlrate_500k,             ROUND(spc.requestcount_500k,4.0) requestcount_500k,             spc.flow_500k,             ROUND(spc.flowrate_500,4.0) flowrate_500         FROM             (                 SELECT                     c.DestinationIP,                       sp.app_type,                     App_Sub_Type,                     c.sp1                                                 AS PoorQualityType,                     ROUND(SUM(DLData)*8*1000/SUM(Businesshours)/1024,2.0)     DLrate,                     ROUND(SUM(responddelay)/SUM(responddelaycount),2.0)    AS responddelay,                     ROUND(SUM(RequestSuccsessCount)/SUM(RequestCount),4.0)    RequsetSuccessRate,                     SUM(RequestCount)                                         usernumber,                     SUM(DLData)                                               DLData,                     ROUND(                         CASE                             WHEN (SUM(DLData_500K) IS NULL                                 OR  SUM(DLData_500K)=0                                 OR  SUM(Businesshours_500K) IS NULL                                 OR  SUM(Businesshours_500K)=0)                             THEN 0                             ELSE SUM(DLData_500K)*8*1000/SUM(Businesshours_500K)/1024                         END,2.0) AS Dlrate_500k,                     CASE                         WHEN SUM(RequestCount_500) IS NULL                         THEN 0                         ELSE SUM(RequestCount_500)                     END AS requestcount_500k,                     SUM(                         CASE                             WHEN DLData_500K IS NULL                             THEN 0                             ELSE DLData_500K                         END) AS flow_500k,                     (                         CASE                             WHEN SUM(dldata) IS NULL                             OR  SUM(dldata)=0                             OR  SUM(DLData_500K) IS NULL                             OR  SUM(DLData_500K)=0                             THEN 0                             ELSE SUM(DLData_500K)/SUM(DLData)*100                         END) AS flowrate_500                 FROM                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP sp                 RIGHT JOIN                     (                         SELECT                             test4.DestinationIP,                             test4.app_type ,                             test4.sp1                         FROM                             ( SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (SELECT                                             DestinationIP,                                             app_type,                                             '速率' AS sp1,                                             ROUND(SUM(DLData_500K)*8*1000/SUM (Businesshours_500K)/                                             1024,2.0)             AS Serverspeedavg,                                             SUM(RequestCount_500) AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             DLData_500K>[@t11]                                         AND StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                             (SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     ROUND(SUM(DLData_500K)*8*1000/SUM                                                     (Businesshours_500K)/ 1024,2.0) AS                                                                              Serverspeedavg,                                                     SUM(RequestCount_500) AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     DLData_500K>[@t11]                                                 AND StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     ROUND(SUM(DLData_500K)*8*1000/SUM                                                     (Businesshours_500K)/ 1024,2.0) AS                                                     Serverspeedavg                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     DLData_500K>[@t11]                                                 AND StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t12]                                         AND a.Serverspeedavg<b.Serverspeedavg*[@t13]                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type)test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount_500) AS XDRcountb                                         FROM                                            lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             DLData_500K>[@t11]                                         AND StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t12]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type )test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t15]                         AND test5.count2>[@t14]                         AND test4.Serverspeedavg<[@t16]                         UNION ALL                         SELECT                             test4.DestinationIP,                             test4.app_type,                             test4.sp2                         FROM                             (                                 SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             app_type,                                             '时延'                                     AS sp2,                                             SUM(responddelay)/SUM(responddelaycount) AS repsdelay,                                             SUM(RequestCount)                        AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                          GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                             (                                                 SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     SUM(responddelay)/SUM(responddelaycount ) AS                                                                          repsdelay,                                                     SUM(RequestCount) AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                  GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     SUM(responddelay)/SUM(responddelaycount ) AS                                                     repsdelay                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t1]                                         AND a.repsdelay*[@t2]>b.repsdelay                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type)test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount) AS XDRcountb                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                          GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t1]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type)test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t4]                         AND test5.count2>[@t3]                         AND test4.repsdelay>[@t5]                         UNION ALL                         SELECT                             test4.DestinationIP,                             test4.app_type,                             test4.sp3                         FROM                              (                                 SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             app_type,                                             '成功率' AS sp3,                                             ROUND(SUM(RequestSuccsessCount)/SUM (RequestCount)*100                                             ,2.0)             AS Requestsucess ,                                             SUM(RequestCount) AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                              (                                                 SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     ROUND(SUM(RequestSuccsessCount)/SUM                                                     (RequestCount),2.0) AS Requestsucess,                                                     SUM(RequestCount)   AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                  GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     ROUND(SUM(RequestSuccsessCount)/SUM                                                     (RequestCount),2.0) AS Requestsucess                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t6]                                         AND b.Requestsucess-a.Requestsucess>[@t7]                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type )test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount) AS XDRcountb                                         FROM                                              lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t6]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type)test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t9]                         AND test5.count2>[@t8]                         AND test4.Requestsucess<=[@t10] )c                 ON                     c.DestinationIP=sp.DestinationIP                 AND c.app_type=sp.app_type                 AND sp.StartTime>=TIMESTAMP'[@c1]'                 AND sp.StartTime<=TIMESTAMP'[@c2]'                 GROUP BY                     c.DestinationIP,                      sp.app_type,                     App_Sub_Type,c.sp1)spc          inner join                              (select categoryid,categoryname,bussinessname as appsubtypename,bussinessid,city.cityname,city.city_no from lte_sys.[@c0]_t_base_categorytype t                             inner join lte_sys.t_base_city city on t.city_no=city.city_no                              )type on spc.App_Type=type.categoryid and spc.App_Type||'-'||spc.App_Sub_Type=type.bussinessid )t WHERE     t.dlrate_500k IS NOT NULL order by DestinationIP"
      }
    },
    {
      "key": "query_sp_poorqualit",
      "desc":"SP质差类型柱状图",
      "config": {
        "parameters": [
          {
            "name": "p_en",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c0",
            "symbol":""
          }, {
            "name": "starttime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c1",
            "symbol":""
          }, {
            "name": "endtime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c2",
            "symbol":""
          }, {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          }
        ],
        "value": "SELECT CategoryName , sum(case when PoorQualityType='时延' then 1 when PoorQualityType='速率' then 1 when PoorQualityType='成功率' then 1 end) poorcount FROM LTE_SYS.[@c0]_T_End_TO_End_Analysis_SP_PoorQuality group by CategoryName"
      }
    },
    {
      "key": "query_sp_poorqualit_p_en",
      "desc":"SP质差类型柱状图_p_en",
      "config": {
        "parameters": [
          {
            "name": "p_en",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c0",
            "symbol":""
          }, {
            "name": "starttime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c1",
            "symbol":""
          }, {
            "name": "endtime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c2",
            "symbol":""
          }, {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          },
          {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          },
          {
            "name": "Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          },
          {
            "name": "Threshold_data7",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t7",
            "symbol":""
          },
          {
            "name": "Threshold_data8",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t8",
            "symbol":""
          },
          {
            "name": "Threshold_data9",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t9",
            "symbol":""
          },
          {
            "name": "Threshold_data10",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t10",
            "symbol":""
          },
          {
            "name": "Threshold_data11",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t11",
            "symbol":""
          },
          {
            "name": "Threshold_data12",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t12",
            "symbol":""
          },
          {
            "name": "Threshold_data13",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t13",
            "symbol":""
          },
          {
            "name": "Threshold_data14",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t14",
            "symbol":""
          },
          {
            "name": "Threshold_data15",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t15",
            "symbol":""
          },
          {
            "name": "Threshold_data16",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t16",
            "symbol":""
          }
        ],
        "value": "WITH     tmp AS     (SELECT     * FROM     (         SELECT             spc.DestinationIP,             spc.app_type,             type.categoryname,             type.appsubtypename,             spc.PoorQualityType,             spc.DLrate ,             spc.responddelay,             spc.RequsetSuccessRate,             spc.usernumber,             spc.DLData ,             CASE                 WHEN spc.dlrate_500k<2048                 AND spc.PoorQualityType='速率'                 THEN dlrate_500k                 WHEN spc.PoorQualityType='成功率'                 THEN dlrate_500k                 WHEN spc.PoorQualityType='时延'                 THEN dlrate_500k             END                              dlrate_500k,             ROUND(spc.requestcount_500k,4.0) requestcount_500k,             spc.flow_500k,             ROUND(spc.flowrate_500,4.0) flowrate_500         FROM             (                 SELECT                     c.DestinationIP,                       sp.app_type,                     App_Sub_Type,                     c.sp1                                                 AS PoorQualityType,                     ROUND(SUM(DLData)*8*1000/SUM(Businesshours)/1024,2.0)     DLrate,                     ROUND(SUM(responddelay)/SUM(responddelaycount),2.0)    AS responddelay,                     ROUND(SUM(RequestSuccsessCount)/SUM(RequestCount),4.0)    RequsetSuccessRate,                     SUM(RequestCount)                                         usernumber,                     SUM(DLData)                                               DLData,                     ROUND(                         CASE                             WHEN (SUM(DLData_500K) IS NULL                                 OR  SUM(DLData_500K)=0                                 OR  SUM(Businesshours_500K) IS NULL                                 OR  SUM(Businesshours_500K)=0)                             THEN 0                             ELSE SUM(DLData_500K)*8*1000/SUM(Businesshours_500K)/1024                         END,2.0) AS Dlrate_500k,                     CASE                         WHEN SUM(RequestCount_500) IS NULL                         THEN 0                         ELSE SUM(RequestCount_500)                     END AS requestcount_500k,                     SUM(                         CASE                             WHEN DLData_500K IS NULL                             THEN 0                             ELSE DLData_500K                         END) AS flow_500k,                     (                         CASE                             WHEN SUM(dldata) IS NULL                             OR  SUM(dldata)=0                             OR  SUM(DLData_500K) IS NULL                             OR  SUM(DLData_500K)=0                             THEN 0                             ELSE SUM(DLData_500K)/SUM(DLData)*100                         END) AS flowrate_500                 FROM                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP sp                 RIGHT JOIN                     (                         SELECT                             test4.DestinationIP,                             test4.app_type ,                             test4.sp1                         FROM                             ( SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (SELECT                                             DestinationIP,                                             app_type,                                             '速率' AS sp1,                                             ROUND(SUM(DLData_500K)*8*1000/SUM (Businesshours_500K)/                                             1024,2.0)             AS Serverspeedavg,                                             SUM(RequestCount_500) AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             DLData_500K>[@t11]                                         AND StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                             (SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     ROUND(SUM(DLData_500K)*8*1000/SUM                                                     (Businesshours_500K)/ 1024,2.0) AS                                                                              Serverspeedavg,                                                     SUM(RequestCount_500) AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     DLData_500K>[@t11]                                                 AND StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     ROUND(SUM(DLData_500K)*8*1000/SUM                                                     (Businesshours_500K)/ 1024,2.0) AS                                                     Serverspeedavg                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     DLData_500K>[@t11]                                                 AND StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t12]                                         AND a.Serverspeedavg<b.Serverspeedavg*[@t13]                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type)test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount_500) AS XDRcountb                                         FROM                                            lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             DLData_500K>[@t11]                                         AND StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t12]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type )test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t15]                         AND test5.count2>[@t14]                         AND test4.Serverspeedavg<[@t16]                         UNION ALL                         SELECT                             test4.DestinationIP,                             test4.app_type,                             test4.sp2                         FROM                             (                                 SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             app_type,                                             '时延'                                     AS sp2,                                             SUM(responddelay)/SUM(responddelaycount) AS repsdelay,                                             SUM(RequestCount)                        AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                          GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                             (                                                 SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     SUM(responddelay)/SUM(responddelaycount ) AS                                                                          repsdelay,                                                     SUM(RequestCount) AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                  GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     SUM(responddelay)/SUM(responddelaycount ) AS                                                     repsdelay                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t1]                                         AND a.repsdelay*[@t2]>b.repsdelay                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type)test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount) AS XDRcountb                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                          GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t1]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type)test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t4]                         AND test5.count2>[@t3]                         AND test4.repsdelay>[@t5]                         UNION ALL                         SELECT                             test4.DestinationIP,                             test4.app_type,                             test4.sp3                         FROM                              (                                 SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             app_type,                                             '成功率' AS sp3,                                             ROUND(SUM(RequestSuccsessCount)/SUM (RequestCount)*100                                             ,2.0)             AS Requestsucess ,                                             SUM(RequestCount) AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                              (                                                 SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     ROUND(SUM(RequestSuccsessCount)/SUM                                                     (RequestCount),2.0) AS Requestsucess,                                                     SUM(RequestCount)   AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                  GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     ROUND(SUM(RequestSuccsessCount)/SUM                                                     (RequestCount),2.0) AS Requestsucess                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t6]                                         AND b.Requestsucess-a.Requestsucess>[@t7]                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type )test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount) AS XDRcountb                                         FROM                                              lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t6]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type)test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t9]                         AND test5.count2>[@t8]                         AND test4.Requestsucess<=[@t10] )c                 ON                     c.DestinationIP=sp.DestinationIP                 AND c.app_type=sp.app_type                 AND sp.StartTime>=TIMESTAMP'[@c1]'                 AND sp.StartTime<=TIMESTAMP'[@c2]'                 GROUP BY                     c.DestinationIP,                      sp.app_type,                     App_Sub_Type,c.sp1)spc          inner join                              (select categoryid,categoryname,bussinessname as appsubtypename,bussinessid,city.cityname,city.city_no from lte_sys.[@c0]_t_base_categorytype t                             inner join lte_sys.t_base_city city on t.city_no=city.city_no                              )type on spc.App_Type=type.categoryid and spc.App_Type||'-'||spc.App_Sub_Type=type.bussinessid )t WHERE     t.dlrate_500k IS NOT NULL order by DestinationIP) SELECT     CategoryName ,     SUM(         CASE             WHEN PoorQualityType='时延'             THEN 1             WHEN PoorQualityType='速率'             THEN 1             WHEN PoorQualityType='成功率'             THEN 1         END) poorcount FROM     tmp GROUP BY     CategoryName"
      }
    },
    {
      "key": "query_sp_poorqualit_details",
      "desc":"SP质差类型柱状图_详细_默认",
      "config": {
        "parameters": [
          {
            "name": "p_en",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c0",
            "symbol":""
          }, {
            "name": "starttime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c1",
            "symbol":""
          }, {
            "name": "endtime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c2",
            "symbol":""
          }, {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          }
        ],
        "value": "SELECT     b.categoryname categoryname,     a.spcount             spcount,     b.poorcount           poorcount,     round(b.poorcount/a.spcount*100,2.0) as poorsprate FROM     (         SELECT             App_Type,             COUNT(DISTINCT DestinationIP) spcount         FROM             lte_sys.[@c0]_T_End_TO_End_Analysis_SP sp             where sp.StartTime>=TIMESTAMP'[@c1]' and sp.StartTime<=TIMESTAMP'[@c2]'         GROUP BY             App_Type)a LEFT JOIN     (         SELECT             typeid,             CategoryName,             COUNT(0) poorcount         FROM             lte_sys.[@c0]_T_End_TO_End_Analysis_SP_PoorQuality         GROUP BY             CategoryName,             typeid)b ON     a.App_Type=b.typeid  where b.categoryname is not null order by spcount desc"
      }
    },
    {
      "key": "query_sp_poorqualit_details_p_en",
      "desc":"SP质差类型柱状图_详细_按条件",
      "config": {
        "parameters": [
          {
            "name": "p_en",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c0",
            "symbol":""
          }, {
            "name": "starttime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c1",
            "symbol":""
          }, {
            "name": "endtime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c2",
            "symbol":""
          },
          {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          },
          {
            "name": "Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          },
          {
            "name": "Threshold_data7",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t7",
            "symbol":""
          },
          {
            "name": "Threshold_data8",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t8",
            "symbol":""
          },
          {
            "name": "Threshold_data9",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t9",
            "symbol":""
          },
          {
            "name": "Threshold_data10",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t10",
            "symbol":""
          },
          {
            "name": "Threshold_data11",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t11",
            "symbol":""
          },
          {
            "name": "Threshold_data12",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t12",
            "symbol":""
          },
          {
            "name": "Threshold_data13",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t13",
            "symbol":""
          },
          {
            "name": "Threshold_data14",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t14",
            "symbol":""
          },
          {
            "name": "Threshold_data15",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t15",
            "symbol":""
          },
          {
            "name": "Threshold_data16",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t16",
            "symbol":""
          }
        ],
        "value": "WITH     tmp AS     (SELECT     * FROM     (         SELECT             spc.DestinationIP,             spc.app_type,             type.categoryname,             type.appsubtypename,             spc.PoorQualityType,             spc.DLrate ,             spc.responddelay,             spc.RequsetSuccessRate,             spc.usernumber,             spc.DLData ,             CASE                 WHEN spc.dlrate_500k<2048                 AND spc.PoorQualityType='速率'                 THEN dlrate_500k                 WHEN spc.PoorQualityType='成功率'                 THEN dlrate_500k                 WHEN spc.PoorQualityType='时延'                 THEN dlrate_500k             END                              dlrate_500k,             ROUND(spc.requestcount_500k,4.0) requestcount_500k,             spc.flow_500k,             ROUND(spc.flowrate_500,4.0) flowrate_500         FROM             (                 SELECT                     c.DestinationIP,                       sp.app_type,                     App_Sub_Type,                     c.sp1                                                 AS PoorQualityType,                     ROUND(SUM(DLData)*8*1000/SUM(Businesshours)/1024,2.0)     DLrate,                     ROUND(SUM(responddelay)/SUM(responddelaycount),2.0)    AS responddelay,                     ROUND(SUM(RequestSuccsessCount)/SUM(RequestCount),4.0)    RequsetSuccessRate,                     SUM(RequestCount)                                         usernumber,                     SUM(DLData)                                               DLData,                     ROUND(                         CASE                             WHEN (SUM(DLData_500K) IS NULL                                 OR  SUM(DLData_500K)=0                                 OR  SUM(Businesshours_500K) IS NULL                                 OR  SUM(Businesshours_500K)=0)                             THEN 0                             ELSE SUM(DLData_500K)*8*1000/SUM(Businesshours_500K)/1024                         END,2.0) AS Dlrate_500k,                     CASE                         WHEN SUM(RequestCount_500) IS NULL                         THEN 0                         ELSE SUM(RequestCount_500)                     END AS requestcount_500k,                     SUM(                         CASE                             WHEN DLData_500K IS NULL                             THEN 0                             ELSE DLData_500K                         END) AS flow_500k,                     (                         CASE                             WHEN SUM(dldata) IS NULL                             OR  SUM(dldata)=0                             OR  SUM(DLData_500K) IS NULL                             OR  SUM(DLData_500K)=0                             THEN 0                             ELSE SUM(DLData_500K)/SUM(DLData)*100                         END) AS flowrate_500                 FROM                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP sp                 RIGHT JOIN                     (                         SELECT                             test4.DestinationIP,                             test4.app_type ,                             test4.sp1                         FROM                             ( SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (SELECT                                             DestinationIP,                                             app_type,                                             '速率' AS sp1,                                             ROUND(SUM(DLData_500K)*8*1000/SUM (Businesshours_500K)/                                             1024,2.0)             AS Serverspeedavg,                                             SUM(RequestCount_500) AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             DLData_500K>[@t11]                                         AND StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                             (SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     ROUND(SUM(DLData_500K)*8*1000/SUM                                                     (Businesshours_500K)/ 1024,2.0) AS                                                                              Serverspeedavg,                                                     SUM(RequestCount_500) AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     DLData_500K>[@t11]                                                 AND StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     ROUND(SUM(DLData_500K)*8*1000/SUM                                                     (Businesshours_500K)/ 1024,2.0) AS                                                     Serverspeedavg                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     DLData_500K>[@t11]                                                 AND StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t12]                                         AND a.Serverspeedavg<b.Serverspeedavg*[@t13]                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type)test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount_500) AS XDRcountb                                         FROM                                            lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             DLData_500K>[@t11]                                         AND StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t12]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type )test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t15]                         AND test5.count2>[@t14]                         AND test4.Serverspeedavg<[@t16]                         UNION ALL                         SELECT                             test4.DestinationIP,                             test4.app_type,                             test4.sp2                         FROM                             (                                 SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             app_type,                                             '时延'                                     AS sp2,                                             SUM(responddelay)/SUM(responddelaycount) AS repsdelay,                                             SUM(RequestCount)                        AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                          GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                             (                                                 SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     SUM(responddelay)/SUM(responddelaycount ) AS                                                                          repsdelay,                                                     SUM(RequestCount) AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                  GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     SUM(responddelay)/SUM(responddelaycount ) AS                                                     repsdelay                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t1]                                         AND a.repsdelay*[@t2]>b.repsdelay                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type)test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount) AS XDRcountb                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                          GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t1]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type)test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t4]                         AND test5.count2>[@t3]                         AND test4.repsdelay>[@t5]                         UNION ALL                         SELECT                             test4.DestinationIP,                             test4.app_type,                             test4.sp3                         FROM                              (                                 SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             app_type,                                             '成功率' AS sp3,                                             ROUND(SUM(RequestSuccsessCount)/SUM (RequestCount)*100                                             ,2.0)             AS Requestsucess ,                                             SUM(RequestCount) AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                              (                                                 SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     ROUND(SUM(RequestSuccsessCount)/SUM                                                     (RequestCount),2.0) AS Requestsucess,                                                     SUM(RequestCount)   AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                  GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     ROUND(SUM(RequestSuccsessCount)/SUM                                                     (RequestCount),2.0) AS Requestsucess                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t6]                                         AND b.Requestsucess-a.Requestsucess>[@t7]                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type )test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount) AS XDRcountb                                         FROM                                              lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t6]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type)test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t9]                         AND test5.count2>[@t8]                         AND test4.Requestsucess<=[@t10] )c                 ON                     c.DestinationIP=sp.DestinationIP                 AND c.app_type=sp.app_type                 AND sp.StartTime>=TIMESTAMP'[@c1]'                 AND sp.StartTime<=TIMESTAMP'[@c2]'                 GROUP BY                     c.DestinationIP,                      sp.app_type,                     App_Sub_Type,c.sp1)spc          inner join                              (select categoryid,categoryname,bussinessname as appsubtypename,bussinessid,city.cityname,city.city_no from lte_sys.[@c0]_t_base_categorytype t                             inner join lte_sys.t_base_city city on t.city_no=city.city_no                              )type on spc.App_Type=type.categoryid and spc.App_Type||'-'||spc.App_Sub_Type=type.bussinessid )t WHERE     t.dlrate_500k IS NOT NULL order by DestinationIP) SELECT     b.categoryname                          categoryname,     a.spcount                               spcount,     b.poorcount                             poorcount,     ROUND(b.poorcount/a.spcount*100,2.0) AS poorsprate FROM     (         SELECT             App_Type,             COUNT(DISTINCT DestinationIP) spcount         FROM             lte_sys.[@c0]_T_End_TO_End_Analysis_SP sp         WHERE             sp.StartTime>=TIMESTAMP'[@c1]'         AND sp.StartTime<=TIMESTAMP'[@c2]'         GROUP BY             App_Type)a LEFT JOIN     (         SELECT             app_type AS typeid,             CategoryName,             COUNT(0) poorcount         FROM             tmp         GROUP BY             CategoryName,             app_type)b ON     a.App_Type=b.typeid WHERE     b.categoryname IS NOT NULL order by spcount desc"
      }
    },
    {
      "key": "query_sp_poorqualit_left",
      "desc":"SP质差类型",
      "config": {
        "parameters": [
          {
            "name": "categoryname",
            "columnname": "categoryname",
            "type":"string",
            "format": "",
            "conditionid": "s0",
            "symbol":"="
          },
          {
            "name": "p_en",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c0",
            "symbol":""
          }, {
            "name": "starttime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c1",
            "symbol":""
          }, {
            "name": "endtime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c2",
            "symbol":""
          }, {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          }
        ],
        "value": "SELECT CategoryName ,round(sum(case when PoorQualityType='时延' then 1 end)/sum(case when PoorQualityType='时延' then 1 when PoorQualityType='速率' then 1 when PoorQualityType='成功率' then 1 end)*100,2.0)   delay,round(sum (case  when PoorQualityType='速率' then 1 end)/sum(case when PoorQualityType='时延' then 1 when PoorQualityType='速率' then 1  when PoorQualityType='成功率' then 1 end)*100,2.0) DLdata, round(sum(case  when PoorQualityType='成功率' then 1 end)/sum(case when PoorQualityType='时延' then 1 when PoorQualityType='速率' then 1  when PoorQualityType='成功率' then 1 end)*100,2.0) successrate FROM LTE_SYS.[@c0]_T_End_TO_End_Analysis_SP_PoorQuality  where  ([@s0]) group by CategoryName "
      }
    },
    {
      "key": "query_sp_poorqualit_left_p_en",
      "desc":"SP质差类型饼图",
      "config": {
        "parameters": [
          {
            "name": "categoryname",
            "columnname": "categoryname",
            "type":"string",
            "format": "",
            "conditionid": "s0",
            "symbol":"="
          },
          {
            "name": "p_en",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c0",
            "symbol":""
          }, {
            "name": "starttime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c1",
            "symbol":""
          }, {
            "name": "endtime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c2",
            "symbol":""
          }, {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          },
          {
            "name": "Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          },
          {
            "name": "Threshold_data7",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t7",
            "symbol":""
          },
          {
            "name": "Threshold_data8",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t8",
            "symbol":""
          },
          {
            "name": "Threshold_data9",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t9",
            "symbol":""
          },
          {
            "name": "Threshold_data10",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t10",
            "symbol":""
          },
          {
            "name": "Threshold_data11",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t11",
            "symbol":""
          },
          {
            "name": "Threshold_data12",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t12",
            "symbol":""
          },
          {
            "name": "Threshold_data13",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t13",
            "symbol":""
          },
          {
            "name": "Threshold_data14",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t14",
            "symbol":""
          },
          {
            "name": "Threshold_data15",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t15",
            "symbol":""
          },
          {
            "name": "Threshold_data16",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t16",
            "symbol":""
          }
        ],
        "value": "with tmp as  (SELECT     * FROM     (         SELECT             spc.DestinationIP,             spc.app_type,             type.categoryname,             type.appsubtypename,             spc.PoorQualityType,             spc.DLrate ,             spc.responddelay,             spc.RequsetSuccessRate,             spc.usernumber,             spc.DLData ,             CASE                 WHEN spc.dlrate_500k<2048                 AND spc.PoorQualityType='速率'                 THEN dlrate_500k                 WHEN spc.PoorQualityType='成功率'                 THEN dlrate_500k                 WHEN spc.PoorQualityType='时延'                 THEN dlrate_500k             END                              dlrate_500k,             ROUND(spc.requestcount_500k,4.0) requestcount_500k,             spc.flow_500k,             ROUND(spc.flowrate_500,4.0) flowrate_500         FROM             (                 SELECT                     c.DestinationIP,                       sp.app_type,                     App_Sub_Type,                     c.sp1                                                 AS PoorQualityType,                     ROUND(SUM(DLData)*8*1000/SUM(Businesshours)/1024,2.0)     DLrate,                     ROUND(SUM(responddelay)/SUM(responddelaycount),2.0)    AS responddelay,                     ROUND(SUM(RequestSuccsessCount)/SUM(RequestCount),4.0)    RequsetSuccessRate,                     SUM(RequestCount)                                         usernumber,                     SUM(DLData)                                               DLData,                     ROUND(                         CASE                             WHEN (SUM(DLData_500K) IS NULL                                 OR  SUM(DLData_500K)=0                                 OR  SUM(Businesshours_500K) IS NULL                                 OR  SUM(Businesshours_500K)=0)                             THEN 0                             ELSE SUM(DLData_500K)*8*1000/SUM(Businesshours_500K)/1024                         END,2.0) AS Dlrate_500k,                     CASE                         WHEN SUM(RequestCount_500) IS NULL                         THEN 0                         ELSE SUM(RequestCount_500)                     END AS requestcount_500k,                     SUM(                         CASE                             WHEN DLData_500K IS NULL                             THEN 0                             ELSE DLData_500K                         END) AS flow_500k,                     (                         CASE                             WHEN SUM(dldata) IS NULL                             OR  SUM(dldata)=0                             OR  SUM(DLData_500K) IS NULL                             OR  SUM(DLData_500K)=0                             THEN 0                             ELSE SUM(DLData_500K)/SUM(DLData)*100                         END) AS flowrate_500                 FROM                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP sp                 RIGHT JOIN                     (                         SELECT                             test4.DestinationIP,                             test4.app_type ,                             test4.sp1                         FROM                             ( SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (SELECT                                             DestinationIP,                                             app_type,                                             '速率' AS sp1,                                             ROUND(SUM(DLData_500K)*8*1000/SUM (Businesshours_500K)/                                             1024,2.0)             AS Serverspeedavg,                                             SUM(RequestCount_500) AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             DLData_500K>[@t11]                                         AND StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                             (SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     ROUND(SUM(DLData_500K)*8*1000/SUM                                                     (Businesshours_500K)/ 1024,2.0) AS                                                                              Serverspeedavg,                                                     SUM(RequestCount_500) AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     DLData_500K>[@t11]                                                 AND StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     ROUND(SUM(DLData_500K)*8*1000/SUM                                                     (Businesshours_500K)/ 1024,2.0) AS                                                     Serverspeedavg                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     DLData_500K>[@t11]                                                 AND StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t12]                                         AND a.Serverspeedavg<b.Serverspeedavg*[@t13]                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type)test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount_500) AS XDRcountb                                         FROM                                            lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             DLData_500K>[@t11]                                         AND StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t12]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type )test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t15]                         AND test5.count2>[@t14]                         AND test4.Serverspeedavg<[@t16]                         UNION ALL                         SELECT                             test4.DestinationIP,                             test4.app_type,                             test4.sp2                         FROM                             (                                 SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             app_type,                                             '时延'                                     AS sp2,                                             SUM(responddelay)/SUM(responddelaycount) AS repsdelay,                                             SUM(RequestCount)                        AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                          GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                             (                                                 SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     SUM(responddelay)/SUM(responddelaycount ) AS                                                                          repsdelay,                                                     SUM(RequestCount) AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                  GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     SUM(responddelay)/SUM(responddelaycount ) AS                                                     repsdelay                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t1]                                         AND a.repsdelay*[@t2]>b.repsdelay                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type)test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount) AS XDRcountb                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                          GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t1]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type)test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t4]                         AND test5.count2>[@t3]                         AND test4.repsdelay>[@t5]                         UNION ALL                         SELECT                             test4.DestinationIP,                             test4.app_type,                             test4.sp3                         FROM                              (                                 SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             app_type,                                             '成功率' AS sp3,                                             ROUND(SUM(RequestSuccsessCount)/SUM (RequestCount)*100                                             ,2.0)             AS Requestsucess ,                                             SUM(RequestCount) AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                              (                                                 SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     ROUND(SUM(RequestSuccsessCount)/SUM                                                     (RequestCount),2.0) AS Requestsucess,                                                     SUM(RequestCount)   AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                  GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     ROUND(SUM(RequestSuccsessCount)/SUM                                                     (RequestCount),2.0) AS Requestsucess                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t6]                                         AND b.Requestsucess-a.Requestsucess>[@t7]                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type )test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount) AS XDRcountb                                         FROM                                              lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t6]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type)test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t9]                         AND test5.count2>[@t8]                         AND test4.Requestsucess<=[@t10] )c                 ON                     c.DestinationIP=sp.DestinationIP                 AND c.app_type=sp.app_type                 AND sp.StartTime>=TIMESTAMP'[@c1]'                 AND sp.StartTime<=TIMESTAMP'[@c2]'                 GROUP BY                     c.DestinationIP,                      sp.app_type,                     App_Sub_Type,c.sp1)spc          inner join                              (select categoryid,categoryname,bussinessname as appsubtypename,bussinessid,city.cityname,city.city_no from lte_sys.[@c0]_t_base_categorytype t                             inner join lte_sys.t_base_city city on t.city_no=city.city_no                              )type on spc.App_Type=type.categoryid and spc.App_Type||'-'||spc.App_Sub_Type=type.bussinessid )t WHERE     t.dlrate_500k IS NOT NULL order by DestinationIP) SELECT CategoryName ,round(sum(case when PoorQualityType='时延' then 1 end)/sum(case when PoorQualityType='时延' then 1 when PoorQualityType='速率' then 1 when PoorQualityType='成功率' then 1 end)*100,2.0)   delay,round(sum (case  when PoorQualityType='速率' then 1 end)/sum(case when PoorQualityType='时延' then 1 when PoorQualityType='速率' then 1  when PoorQualityType='成功率' then 1 end)*100,2.0) DLdata, round(sum(case  when PoorQualityType='成功率' then 1 end)/sum(case when PoorQualityType='时延' then 1 when PoorQualityType='速率' then 1  when PoorQualityType='成功率' then 1 end)*100,2.0) successrate FROM tmp  where  ([@s0]) group by CategoryName "
      }
    },
    {
        "key": "query_sp_poorqualit_left_details",
      "desc":"SP质差类型_默认",
      "config": {
        "parameters": [
          {
            "name": "categoryname",
            "columnname": "categoryname",
            "type":"string",
            "format": "",
            "conditionid": "s0",
            "symbol":"="
          },
          {
            "name": "p_en",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c0",
            "symbol":""
          }, {
            "name": "starttime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c1",
            "symbol":""
          }, {
            "name": "endtime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c2",
            "symbol":""
          }, {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          }
        ],
        "value": "select a.PoorQualityType,a.poorcount,sum(a.poorcount) over() sptotal,round(a.poorcount/sum(a.poorcount) over()*100,2.0) as poorrate from  (select PoorQualityType,count(0) poorcount,sum(0) over() from LTE_SYS.[@c0]_T_End_TO_End_Analysis_SP_PoorQuality where ([@s0]) group by PoorQualityType)a"
      }
    },
    {
      "key": "query_sp_poorqualit_left_details_p_en",
      "desc":"SP质差类型饼图_按条件",
      "config": {
        "parameters": [
          {
            "name": "categoryname",
            "columnname": "categoryname",
            "type":"string",
            "format": "",
            "conditionid": "s0",
            "symbol":"="
          },
          {
            "name": "p_en",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c0",
            "symbol":""
          }, {
            "name": "starttime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c1",
            "symbol":""
          }, {
            "name": "endtime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c2",
            "symbol":""
          }, {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          },
          {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          },
          {
            "name": "Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          },
          {
            "name": "Threshold_data7",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t7",
            "symbol":""
          },
          {
            "name": "Threshold_data8",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t8",
            "symbol":""
          },
          {
            "name": "Threshold_data9",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t9",
            "symbol":""
          },
          {
            "name": "Threshold_data10",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t10",
            "symbol":""
          },
          {
            "name": "Threshold_data11",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t11",
            "symbol":""
          },
          {
            "name": "Threshold_data12",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t12",
            "symbol":""
          },
          {
            "name": "Threshold_data13",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t13",
            "symbol":""
          },
          {
            "name": "Threshold_data14",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t14",
            "symbol":""
          },
          {
            "name": "Threshold_data15",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t15",
            "symbol":""
          },
          {
            "name": "Threshold_data16",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t16",
            "symbol":""
          }
        ],
        "value": "WITH     tmp AS     (SELECT     * FROM     (         SELECT             spc.DestinationIP,             spc.app_type,             type.categoryname,             type.appsubtypename,             spc.PoorQualityType,             spc.DLrate ,             spc.responddelay,             spc.RequsetSuccessRate,             spc.usernumber,             spc.DLData ,             CASE                 WHEN spc.dlrate_500k<2048                 AND spc.PoorQualityType='速率'                 THEN dlrate_500k                 WHEN spc.PoorQualityType='成功率'                 THEN dlrate_500k                 WHEN spc.PoorQualityType='时延'                 THEN dlrate_500k             END                              dlrate_500k,             ROUND(spc.requestcount_500k,4.0) requestcount_500k,             spc.flow_500k,             ROUND(spc.flowrate_500,4.0) flowrate_500         FROM             (                 SELECT                     c.DestinationIP,                       sp.app_type,                     App_Sub_Type,                     c.sp1                                                 AS PoorQualityType,                     ROUND(SUM(DLData)*8*1000/SUM(Businesshours)/1024,2.0)     DLrate,                     ROUND(SUM(responddelay)/SUM(responddelaycount),2.0)    AS responddelay,                     ROUND(SUM(RequestSuccsessCount)/SUM(RequestCount),4.0)    RequsetSuccessRate,                     SUM(RequestCount)                                         usernumber,                     SUM(DLData)                                               DLData,                     ROUND(                         CASE                             WHEN (SUM(DLData_500K) IS NULL                                 OR  SUM(DLData_500K)=0                                 OR  SUM(Businesshours_500K) IS NULL                                 OR  SUM(Businesshours_500K)=0)                             THEN 0                             ELSE SUM(DLData_500K)*8*1000/SUM(Businesshours_500K)/1024                         END,2.0) AS Dlrate_500k,                     CASE                         WHEN SUM(RequestCount_500) IS NULL                         THEN 0                         ELSE SUM(RequestCount_500)                     END AS requestcount_500k,                     SUM(                         CASE                             WHEN DLData_500K IS NULL                             THEN 0                             ELSE DLData_500K                         END) AS flow_500k,                     (                         CASE                             WHEN SUM(dldata) IS NULL                             OR  SUM(dldata)=0                             OR  SUM(DLData_500K) IS NULL                             OR  SUM(DLData_500K)=0                             THEN 0                             ELSE SUM(DLData_500K)/SUM(DLData)*100                         END) AS flowrate_500                 FROM                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP sp                 RIGHT JOIN                     (                         SELECT                             test4.DestinationIP,                             test4.app_type ,                             test4.sp1                         FROM                             ( SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (SELECT                                             DestinationIP,                                             app_type,                                             '速率' AS sp1,                                             ROUND(SUM(DLData_500K)*8*1000/SUM (Businesshours_500K)/                                             1024,2.0)             AS Serverspeedavg,                                             SUM(RequestCount_500) AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             DLData_500K>[@t11]                                         AND StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                             (SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     ROUND(SUM(DLData_500K)*8*1000/SUM                                                     (Businesshours_500K)/ 1024,2.0) AS                                                                              Serverspeedavg,                                                     SUM(RequestCount_500) AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     DLData_500K>[@t11]                                                 AND StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     ROUND(SUM(DLData_500K)*8*1000/SUM                                                     (Businesshours_500K)/ 1024,2.0) AS                                                     Serverspeedavg                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     DLData_500K>[@t11]                                                 AND StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t12]                                         AND a.Serverspeedavg<b.Serverspeedavg*[@t13]                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type)test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount_500) AS XDRcountb                                         FROM                                            lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             DLData_500K>[@t11]                                         AND StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t12]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type )test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t15]                         AND test5.count2>[@t14]                         AND test4.Serverspeedavg<[@t16]                         UNION ALL                         SELECT                             test4.DestinationIP,                             test4.app_type,                             test4.sp2                         FROM                             (                                 SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             app_type,                                             '时延'                                     AS sp2,                                             SUM(responddelay)/SUM(responddelaycount) AS repsdelay,                                             SUM(RequestCount)                        AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                          GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                             (                                                 SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     SUM(responddelay)/SUM(responddelaycount ) AS                                                                          repsdelay,                                                     SUM(RequestCount) AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                  GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     SUM(responddelay)/SUM(responddelaycount ) AS                                                     repsdelay                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t1]                                         AND a.repsdelay*[@t2]>b.repsdelay                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type)test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount) AS XDRcountb                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                          GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t1]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type)test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t4]                         AND test5.count2>[@t3]                         AND test4.repsdelay>[@t5]                         UNION ALL                         SELECT                             test4.DestinationIP,                             test4.app_type,                             test4.sp3                         FROM                              (                                 SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             app_type,                                             '成功率' AS sp3,                                             ROUND(SUM(RequestSuccsessCount)/SUM (RequestCount)*100                                             ,2.0)             AS Requestsucess ,                                             SUM(RequestCount) AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                              (                                                 SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     ROUND(SUM(RequestSuccsessCount)/SUM                                                     (RequestCount),2.0) AS Requestsucess,                                                     SUM(RequestCount)   AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                  GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     ROUND(SUM(RequestSuccsessCount)/SUM                                                     (RequestCount),2.0) AS Requestsucess                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t6]                                         AND b.Requestsucess-a.Requestsucess>[@t7]                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type )test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount) AS XDRcountb                                         FROM                                              lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t6]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type)test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t9]                         AND test5.count2>[@t8]                         AND test4.Requestsucess<=[@t10] )c                 ON                     c.DestinationIP=sp.DestinationIP                 AND c.app_type=sp.app_type                 AND sp.StartTime>=TIMESTAMP'[@c1]'                 AND sp.StartTime<=TIMESTAMP'[@c2]'                 GROUP BY                     c.DestinationIP,                      sp.app_type,                     App_Sub_Type,c.sp1)spc          inner join                              (select categoryid,categoryname,bussinessname as appsubtypename,bussinessid,city.cityname,city.city_no from lte_sys.[@c0]_t_base_categorytype t                             inner join lte_sys.t_base_city city on t.city_no=city.city_no                              )type on spc.App_Type=type.categoryid and spc.App_Type||'-'||spc.App_Sub_Type=type.bussinessid )t WHERE     t.dlrate_500k IS NOT NULL order by DestinationIP) select a.PoorQualityType,a.poorcount,sum(a.poorcount) over() sptotal,round(a.poorcount/sum(a.poorcount) over()*100,2.0) as poorrate from  (select PoorQualityType,count(0) poorcount,sum(0) over() from tmp where ([@s0]) group by PoorQualityType)a"
      }
    },
    {
      "key": "query_sp_poorqualit_right",
      "desc":"SP质差类型_散点图",
      "config": {
        "parameters": [
          {
            "name": "cloum",
            "columnname": "",
            "type":"",
            "format": "",
            "conditionid": "s0",
            "symbol":""
          },
          {
            "name": "category",
            "columnname": "categoryname",
            "type":"string",
            "format": "",
            "conditionid": "s1",
            "symbol":"="
          },{
            "name": "columname",
            "columnname": "PoorQualityType",
            "type":"string",
            "format": "",
            "conditionid": "s2",
            "symbol":"="
          },
          {
            "name": "p_en",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c0",
            "symbol":""
          }, {
            "name": "starttime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c1",
            "symbol":""
          }, {
            "name": "endtime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c2",
            "symbol":""
          }, {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          }
        ],
        "value": "  select DestinationIP,round((case when  '[@s0]'='requsetsuccessrate' then  ([@s0]*100)  when  '[@s0]'='responddelay' then  ([@s0])   when   '[@s0]'='dlrate' then  ([@s0])  end),2.0)  [@s0],usernumber from LTE_SYS.[@c0]_T_End_TO_End_Analysis_SP_PoorQuality   where  ([@s1]) [@and] [@s2]"
      }
    },
    {
      "key": "query_sp_poorqualit_right_p_en",
      "desc":"SP质差类型",
      "config": {
        "parameters": [
          {
            "name": "cloum",
            "columnname": "",
            "type":"",
            "format": "",
            "conditionid": "s0",
            "symbol":""
          },
          {
            "name": "category",
            "columnname": "categoryname",
            "type":"string",
            "format": "",
            "conditionid": "s1",
            "symbol":"="
          },{
            "name": "columname",
            "columnname": "PoorQualityType",
            "type":"string",
            "format": "",
            "conditionid": "s2",
            "symbol":"="
          },
          {
            "name": "p_en",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c0",
            "symbol":""
          }, {
            "name": "starttime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c1",
            "symbol":""
          }, {
            "name": "endtime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c2",
            "symbol":""
          }, {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          },
          {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          },
          {
            "name": "Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          },
          {
            "name": "Threshold_data7",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t7",
            "symbol":""
          },
          {
            "name": "Threshold_data8",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t8",
            "symbol":""
          },
          {
            "name": "Threshold_data9",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t9",
            "symbol":""
          },
          {
            "name": "Threshold_data10",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t10",
            "symbol":""
          },
          {
            "name": "Threshold_data11",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t11",
            "symbol":""
          },
          {
            "name": "Threshold_data12",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t12",
            "symbol":""
          },
          {
            "name": "Threshold_data13",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t13",
            "symbol":""
          },
          {
            "name": "Threshold_data14",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t14",
            "symbol":""
          },
          {
            "name": "Threshold_data15",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t15",
            "symbol":""
          },
          {
            "name": "Threshold_data16",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t16",
            "symbol":""
          }
        ],
        "value": "with tmp as (SELECT     * FROM     (         SELECT             spc.DestinationIP,             spc.app_type,             type.categoryname,             type.appsubtypename,             spc.PoorQualityType,             spc.DLrate ,             spc.responddelay,             spc.RequsetSuccessRate,             spc.usernumber,             spc.DLData ,             CASE                 WHEN spc.dlrate_500k<2048                 AND spc.PoorQualityType='速率'                 THEN dlrate_500k                 WHEN spc.PoorQualityType='成功率'                 THEN dlrate_500k                 WHEN spc.PoorQualityType='时延'                 THEN dlrate_500k             END                              dlrate_500k,             ROUND(spc.requestcount_500k,4.0) requestcount_500k,             spc.flow_500k,             ROUND(spc.flowrate_500,4.0) flowrate_500         FROM             (                 SELECT                     c.DestinationIP,                       sp.app_type,                     App_Sub_Type,                     c.sp1                                                 AS PoorQualityType,                     ROUND(SUM(DLData)*8*1000/SUM(Businesshours)/1024,2.0)     DLrate,                     ROUND(SUM(responddelay)/SUM(responddelaycount),2.0)    AS responddelay,                     ROUND(SUM(RequestSuccsessCount)/SUM(RequestCount),4.0)    RequsetSuccessRate,                     SUM(RequestCount)                                         usernumber,                     SUM(DLData)                                               DLData,                     ROUND(                         CASE                             WHEN (SUM(DLData_500K) IS NULL                                 OR  SUM(DLData_500K)=0                                 OR  SUM(Businesshours_500K) IS NULL                                 OR  SUM(Businesshours_500K)=0)                             THEN 0                             ELSE SUM(DLData_500K)*8*1000/SUM(Businesshours_500K)/1024                         END,2.0) AS Dlrate_500k,                     CASE                         WHEN SUM(RequestCount_500) IS NULL                         THEN 0                         ELSE SUM(RequestCount_500)                     END AS requestcount_500k,                     SUM(                         CASE                             WHEN DLData_500K IS NULL                             THEN 0                             ELSE DLData_500K                         END) AS flow_500k,                     (                         CASE                             WHEN SUM(dldata) IS NULL                             OR  SUM(dldata)=0                             OR  SUM(DLData_500K) IS NULL                             OR  SUM(DLData_500K)=0                             THEN 0                             ELSE SUM(DLData_500K)/SUM(DLData)*100                         END) AS flowrate_500                 FROM                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP sp                 RIGHT JOIN                     (                         SELECT                             test4.DestinationIP,                             test4.app_type ,                             test4.sp1                         FROM                             ( SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (SELECT                                             DestinationIP,                                             app_type,                                             '速率' AS sp1,                                             ROUND(SUM(DLData_500K)*8*1000/SUM (Businesshours_500K)/                                             1024,2.0)             AS Serverspeedavg,                                             SUM(RequestCount_500) AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             DLData_500K>[@t11]                                         AND StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                             (SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     ROUND(SUM(DLData_500K)*8*1000/SUM                                                     (Businesshours_500K)/ 1024,2.0) AS                                                                              Serverspeedavg,                                                     SUM(RequestCount_500) AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     DLData_500K>[@t11]                                                 AND StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     ROUND(SUM(DLData_500K)*8*1000/SUM                                                     (Businesshours_500K)/ 1024,2.0) AS                                                     Serverspeedavg                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     DLData_500K>[@t11]                                                 AND StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t12]                                         AND a.Serverspeedavg<b.Serverspeedavg*[@t13]                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type)test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount_500) AS XDRcountb                                         FROM                                            lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             DLData_500K>[@t11]                                         AND StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t12]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type )test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t15]                         AND test5.count2>[@t14]                         AND test4.Serverspeedavg<[@t16]                         UNION ALL                         SELECT                             test4.DestinationIP,                             test4.app_type,                             test4.sp2                         FROM                             (                                 SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             app_type,                                             '时延'                                     AS sp2,                                             SUM(responddelay)/SUM(responddelaycount) AS repsdelay,                                             SUM(RequestCount)                        AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                          GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                             (                                                 SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     SUM(responddelay)/SUM(responddelaycount ) AS                                                                          repsdelay,                                                     SUM(RequestCount) AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                  GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     SUM(responddelay)/SUM(responddelaycount ) AS                                                     repsdelay                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t1]                                         AND a.repsdelay*[@t2]>b.repsdelay                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type)test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount) AS XDRcountb                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                          GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t1]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type)test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t4]                         AND test5.count2>[@t3]                         AND test4.repsdelay>[@t5]                         UNION ALL                         SELECT                             test4.DestinationIP,                             test4.app_type,                             test4.sp3                         FROM                              (                                 SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             app_type,                                             '成功率' AS sp3,                                             ROUND(SUM(RequestSuccsessCount)/SUM (RequestCount)*100                                             ,2.0)             AS Requestsucess ,                                             SUM(RequestCount) AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                              (                                                 SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     ROUND(SUM(RequestSuccsessCount)/SUM                                                     (RequestCount),2.0) AS Requestsucess,                                                     SUM(RequestCount)   AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                  GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     ROUND(SUM(RequestSuccsessCount)/SUM                                                     (RequestCount),2.0) AS Requestsucess                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t6]                                         AND b.Requestsucess-a.Requestsucess>[@t7]                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type )test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount) AS XDRcountb                                         FROM                                              lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t6]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type)test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t9]                         AND test5.count2>[@t8]                         AND test4.Requestsucess<=[@t10] )c                 ON                     c.DestinationIP=sp.DestinationIP                 AND c.app_type=sp.app_type                 AND sp.StartTime>=TIMESTAMP'[@c1]'                 AND sp.StartTime<=TIMESTAMP'[@c2]'                 GROUP BY                     c.DestinationIP,                      sp.app_type,                     App_Sub_Type,c.sp1)spc          inner join                              (select categoryid,categoryname,bussinessname as appsubtypename,bussinessid,city.cityname,city.city_no from lte_sys.[@c0]_t_base_categorytype t                             inner join lte_sys.t_base_city city on t.city_no=city.city_no                              )type on spc.App_Type=type.categoryid and spc.App_Type||'-'||spc.App_Sub_Type=type.bussinessid )t WHERE     t.dlrate_500k IS NOT NULL order by DestinationIP) select DestinationIP,round((case when  '[@s0]'='requsetsuccessrate' then  ([@s0]*100)  when  '[@s0]'='responddelay' then  ([@s0])   when   '[@s0]'='dlrate' then  ([@s0])  end),2.0)  [@s0],usernumber from tmp   where  ([@s1]) [@and] [@s2]"
      }
    },
    {
      "key": "query_sp_poorqualit_right_details",
      "desc":"SP质差类型_散点图",
      "config": {
        "parameters": [
          {
            "name": "cloum",
            "columnname": "",
            "type":"",
            "format": "",
            "conditionid": "s0",
            "symbol":""
          },
          {
            "name": "category",
            "columnname": "categoryname",
            "type":"string",
            "format": "",
            "conditionid": "s1",
            "symbol":"="
          },{
            "name": "columname",
            "columnname": "PoorQualityType",
            "type":"string",
            "format": "",
            "conditionid": "s2",
            "symbol":"="
          },
          {
            "name": "p_en",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c0",
            "symbol":""
          }, {
            "name": "starttime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c1",
            "symbol":""
          }, {
            "name": "endtime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c2",
            "symbol":""
          }, {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          }
        ],
        "value": "SELECT DestinationIP,TypeID,CategoryName,App_Type,PoorQualityType,round(DLrate,2.0) DLrate,round(responddelay,2.0) responddelay,round(RequsetSuccessRate*100,4.0) as RequsetSuccessRate,usernumber,round(TotalFlow/1024,2.0) TotalFlow,round(dlrate_500k,2.0) dlrate_500k,requestcount_500k,round(flow_500k/1024,2.0) as flow_500k,round(flowrate_500,2.0) flowrate_500 FROM LTE_SYS.[@c0]_T_End_TO_End_Analysis_SP_PoorQuality where ([@s1]) [@and] [@s2]"
      }
    },
    {
      "key": "query_sp_poorqualit_right_details_p_en",
      "desc":"SP质差类型",
      "config": {
        "parameters": [
          {
            "name": "cloum",
            "columnname": "",
            "type":"",
            "format": "",
            "conditionid": "s0",
            "symbol":""
          },
          {
            "name": "category",
            "columnname": "categoryname",
            "type":"string",
            "format": "",
            "conditionid": "s1",
            "symbol":"="
          },{
            "name": "columname",
            "columnname": "PoorQualityType",
            "type":"string",
            "format": "",
            "conditionid": "s2",
            "symbol":"="
          },
          {
            "name": "p_en",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c0",
            "symbol":""
          }, {
            "name": "starttime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c1",
            "symbol":""
          }, {
            "name": "endtime",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c2",
            "symbol":""
          }, {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          },
          {
            "name": "province",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "c3",
            "symbol":""
          },
          {
            "name": "Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          },
          {
            "name": "Threshold_data7",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t7",
            "symbol":""
          },
          {
            "name": "Threshold_data8",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t8",
            "symbol":""
          },
          {
            "name": "Threshold_data9",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t9",
            "symbol":""
          },
          {
            "name": "Threshold_data10",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t10",
            "symbol":""
          },
          {
            "name": "Threshold_data11",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t11",
            "symbol":""
          },
          {
            "name": "Threshold_data12",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t12",
            "symbol":""
          },
          {
            "name": "Threshold_data13",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t13",
            "symbol":""
          },
          {
            "name": "Threshold_data14",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t14",
            "symbol":""
          },
          {
            "name": "Threshold_data15",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t15",
            "symbol":""
          },
          {
            "name": "Threshold_data16",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t16",
            "symbol":""
          }
        ],
        "value": "WITH     tmp AS     (SELECT     * FROM     (         SELECT             spc.DestinationIP,             spc.app_type,             type.categoryname,             type.appsubtypename,             spc.PoorQualityType,             spc.DLrate ,             spc.responddelay,             spc.RequsetSuccessRate,             spc.usernumber,             spc.DLData ,             CASE                 WHEN spc.dlrate_500k<2048                 AND spc.PoorQualityType='速率'                 THEN dlrate_500k                 WHEN spc.PoorQualityType='成功率'                 THEN dlrate_500k                 WHEN spc.PoorQualityType='时延'                 THEN dlrate_500k             END                              dlrate_500k,             ROUND(spc.requestcount_500k,4.0) requestcount_500k,             spc.flow_500k,             ROUND(spc.flowrate_500,4.0) flowrate_500         FROM             (                 SELECT                     c.DestinationIP,                       sp.app_type,                     App_Sub_Type,                     c.sp1                                                 AS PoorQualityType,                     ROUND(SUM(DLData)*8*1000/SUM(Businesshours)/1024,2.0)     DLrate,                     ROUND(SUM(responddelay)/SUM(responddelaycount),2.0)    AS responddelay,                     ROUND(SUM(RequestSuccsessCount)/SUM(RequestCount),4.0)    RequsetSuccessRate,                     SUM(RequestCount)                                         usernumber,                     SUM(DLData)                                               DLData,                     ROUND(                         CASE                             WHEN (SUM(DLData_500K) IS NULL                                 OR  SUM(DLData_500K)=0                                 OR  SUM(Businesshours_500K) IS NULL                                 OR  SUM(Businesshours_500K)=0)                             THEN 0                             ELSE SUM(DLData_500K)*8*1000/SUM(Businesshours_500K)/1024                         END,2.0) AS Dlrate_500k,                     CASE                         WHEN SUM(RequestCount_500) IS NULL                         THEN 0                         ELSE SUM(RequestCount_500)                     END AS requestcount_500k,                     SUM(                         CASE                             WHEN DLData_500K IS NULL                             THEN 0                             ELSE DLData_500K                         END) AS flow_500k,                     (                         CASE                             WHEN SUM(dldata) IS NULL                             OR  SUM(dldata)=0                             OR  SUM(DLData_500K) IS NULL                             OR  SUM(DLData_500K)=0                             THEN 0                             ELSE SUM(DLData_500K)/SUM(DLData)*100                         END) AS flowrate_500                 FROM                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP sp                 RIGHT JOIN                     (                         SELECT                             test4.DestinationIP,                             test4.app_type ,                             test4.sp1                         FROM                             ( SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (SELECT                                             DestinationIP,                                             app_type,                                             '速率' AS sp1,                                             ROUND(SUM(DLData_500K)*8*1000/SUM (Businesshours_500K)/                                             1024,2.0)             AS Serverspeedavg,                                             SUM(RequestCount_500) AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             DLData_500K>[@t11]                                         AND StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                             (SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     ROUND(SUM(DLData_500K)*8*1000/SUM                                                     (Businesshours_500K)/ 1024,2.0) AS                                                                              Serverspeedavg,                                                     SUM(RequestCount_500) AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     DLData_500K>[@t11]                                                 AND StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     ROUND(SUM(DLData_500K)*8*1000/SUM                                                     (Businesshours_500K)/ 1024,2.0) AS                                                     Serverspeedavg                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     DLData_500K>[@t11]                                                 AND StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t12]                                         AND a.Serverspeedavg<b.Serverspeedavg*[@t13]                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type)test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount_500) AS XDRcountb                                         FROM                                            lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             DLData_500K>[@t11]                                         AND StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t12]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type )test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t15]                         AND test5.count2>[@t14]                         AND test4.Serverspeedavg<[@t16]                         UNION ALL                         SELECT                             test4.DestinationIP,                             test4.app_type,                             test4.sp2                         FROM                             (                                 SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             app_type,                                             '时延'                                     AS sp2,                                             SUM(responddelay)/SUM(responddelaycount) AS repsdelay,                                             SUM(RequestCount)                        AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                          GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                             (                                                 SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     SUM(responddelay)/SUM(responddelaycount ) AS                                                                          repsdelay,                                                     SUM(RequestCount) AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                  GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     SUM(responddelay)/SUM(responddelaycount ) AS                                                     repsdelay                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t1]                                         AND a.repsdelay*[@t2]>b.repsdelay                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type)test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount) AS XDRcountb                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                          GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t1]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type)test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t4]                         AND test5.count2>[@t3]                         AND test4.repsdelay>[@t5]                         UNION ALL                         SELECT                             test4.DestinationIP,                             test4.app_type,                             test4.sp3                         FROM                              (                                 SELECT                                     test1.*,                                     test2.count1                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             app_type,                                             '成功率' AS sp3,                                             ROUND(SUM(RequestSuccsessCount)/SUM (RequestCount)*100                                             ,2.0)             AS Requestsucess ,                                             SUM(RequestCount) AS XDRcount                                         FROM                                             lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             app_type) test1                                 LEFT JOIN                                     (                                         SELECT                                             DestinationIP,                                             a.App_Type,                                             COUNT (*) AS count1                                         FROM                                              (                                                 SELECT                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add,                                                     ROUND(SUM(RequestSuccsessCount)/SUM                                                     (RequestCount),2.0) AS Requestsucess,                                                     SUM(RequestCount)   AS XDRcounta                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                  GROUP BY                                                     DestinationIP,                                                     App_Type,                                                     SGW_IP_Add ) a                                         LEFT JOIN                                             (                                                 SELECT                                                     SGW_IP_Add,                                                     App_Type,                                                     ROUND(SUM(RequestSuccsessCount)/SUM                                                     (RequestCount),2.0) AS Requestsucess                                                 FROM                                                     lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                                 WHERE                                                     StartTime>=TIMESTAMP'[@c1]'                                                 AND StartTime<=TIMESTAMP'[@c2]'                                                 GROUP BY                                                     SGW_IP_Add,                                                     App_Type) b                                         ON                                             a.SGW_IP_Add = b.SGW_IP_Add                                         AND a.App_Type = b.App_Type                                         WHERE                                             a.XDRcounta>[@t6]                                         AND b.Requestsucess-a.Requestsucess>[@t7]                                         GROUP BY                                             DestinationIP,                                             a.App_Type) test2                                 ON                                     test1.DestinationIP=test2.DestinationIP                                 AND test1.app_type=test2.app_type )test4                         LEFT JOIN                             (                                 SELECT                                     test3.DestinationIP,                                     App_Type,                                     COUNT(*) AS count2                                 FROM                                     (                                         SELECT                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add,                                             SUM(RequestCount) AS XDRcountb                                         FROM                                              lte_sys.[@c0]_T_End_TO_End_Analysis_SP                                         WHERE                                             StartTime>=TIMESTAMP'[@c1]'                                         AND StartTime<=TIMESTAMP'[@c2]'                                         GROUP BY                                             DestinationIP,                                             App_Type,                                             SGW_IP_Add) test3                                 WHERE                                     test3.XDRcountb>[@t6]                                 GROUP BY                                     test3.DestinationIP,                                     App_Type)test5                         ON                             test4.DestinationIP=test5.DestinationIP                         AND test4.App_Type=test5.App_Type                         WHERE (test4.count1/test5.count2)>[@t9]                         AND test5.count2>[@t8]                         AND test4.Requestsucess<=[@t10] )c                 ON                     c.DestinationIP=sp.DestinationIP                 AND c.app_type=sp.app_type                 AND sp.StartTime>=TIMESTAMP'[@c1]'                 AND sp.StartTime<=TIMESTAMP'[@c2]'                 GROUP BY                     c.DestinationIP,                      sp.app_type,                     App_Sub_Type,c.sp1)spc          inner join                              (select categoryid,categoryname,bussinessname as appsubtypename,bussinessid,city.cityname,city.city_no from lte_sys.[@c0]_t_base_categorytype t                             inner join lte_sys.t_base_city city on t.city_no=city.city_no                              )type on spc.App_Type=type.categoryid and spc.App_Type||'-'||spc.App_Sub_Type=type.bussinessid )t WHERE     t.dlrate_500k IS NOT NULL order by DestinationIP) SELECT     DestinationIP,        CategoryName,     App_Type,     PoorQualityType,     ROUND(DLrate,2.0)                    DLrate,     ROUND(responddelay,2.0)              responddelay,     ROUND(RequsetSuccessRate*100,4.0) AS RequsetSuccessRate,     usernumber,     ROUND(DLData/1024,2.0) TotalFlow,     ROUND(dlrate_500k,2.0)    dlrate_500k,     requestcount_500k,     ROUND(flow_500k/1024,2.0) AS flow_500k,     ROUND(flowrate_500,2.0)      flowrate_500 FROM     tmp WHERE     (         [@s1]) [@and] [@s2]"
      }
    }
  ]
}