{
  "module": "m2",
  "flag": "vertical",
  "configs": [
    {
      "key": "query_tac_tabledata",
      "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     factory,     mobiletype,     mobilecategory,     taccount,     round(totaldata/1024,2.0) totaldata,     sessionrequest,     round(allscore,2.0) allscore,      round(attachsusscesrate,2.0) attachsusscesrate,     round(attachscore,2.0) attachscore,     round(httprequestrate,2.0) httprequestrate,     round(httpscore,2.0) httpscore,     round(ruofugairate,2.0) ruofugairate,     round(ruofugaiscore,2.0) ruofugaiscore,          round(downdelayrate,2.0) downdelayrate,     round(downdelaycore,2.0) downdelaycore,     round(delay23G,2.0) delay23G,     round(delay23gcore,2.0) delay23gcore FROM     LTE_SYS.[@c0]_T_END_TO_END_ANALYSIS_TAC_PoorQuality where  taccount>20 and allscore<80"
      }
    },
    {
      "key": "query_tac_tabledata_p_en",
      "desc": "汇总表_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": "tac_Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          }
        ],
        "value": "WITH     tmp AS     (         SELECT             t.tac,             t.factory,             t.mobiletype,             t.mobilecategory,             t.usernumber AS taccount,             t.dldata     AS totaldata,             t.sessionrequest,             t.allscore,             t.attachsusscesrate,             t.attachscore,             t.httprequestrate,             t.httpscore,             t.ruofugairate,             t.ruofugaiscore,             0,             0,             t.downdelayrate,             t.downdelaycore,             t.delay23G,             t.delay23gcore         FROM             (                 SELECT                     a.tac,                     a.Factory,                     a.MobileType,                     a.MobileCategory,                     a.usernumber,                     a.dldata,                     a.SessionRequest,                     ROUND( ( ((                                     CASE                                         WHEN a.AttachSuccessScore<0                                         THEN 100                                         WHEN a.AttachSuccessScore>=0                                         AND a.AttachSuccessScore<10                                         THEN (100-a.AttachSuccessScore/10*40)                                         WHEN a.AttachSuccessScore>=10                                         AND a.AttachSuccessScore<20                                         THEN (60-(a.AttachSuccessScore-10)/10*60)                                         WHEN a.AttachSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t5])+ ((                                     CASE                                         WHEN a.RequestSuccessScore<0                                         THEN 100                                         WHEN a.RequestSuccessScore>=0                                         AND a.RequestSuccessScore<10                                         THEN (100-a.RequestSuccessScore/10*40)                                         WHEN a.RequestSuccessScore>=10                                         AND a.RequestSuccessScore<20                                         THEN (60-(a.RequestSuccessScore-10)/10*60)                                         WHEN a.RequestSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t6])+ ((                                     CASE                                         WHEN a.RuoFugaiScore<0                                         THEN 100                                         WHEN a.RuoFugaiScore>=0                                         AND a.RuoFugaiScore<10                                         THEN (100-a.RuoFugaiScore/10*40)                                         WHEN a.RuoFugaiScore>=10                                         AND a.RuoFugaiScore<20                                         THEN (60-(a.RuoFugaiScore-10)/10*60)                                         WHEN a.RuoFugaiScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t2])+ ((                                     CASE                                         WHEN a.DLAvgDelayScore<0                                         THEN 100                                         WHEN a.DLAvgDelayScore>=0                                         AND a.DLAvgDelayScore<1000                                         THEN (100-a.DLAvgDelayScore/1000*40)                                         WHEN a.DLAvgDelayScore>=1000                                         AND a.DLAvgDelayScore<2000                                         THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                         WHEN a.DLAvgDelayScore>=2000                                         THEN 0                                         ELSE 0                                     END )*[@t1])+ ((                                     CASE                                         WHEN a.Delay23GScore<0                                         THEN 100                                         WHEN a.Delay23GScore>=0                                         AND a.Delay23GScore<10                                         THEN (100-a.Delay23GScore/10*40)                                         WHEN a.Delay23GScore>=10                                         AND a.Delay23GScore<20                                         THEN (60-(a.Delay23GScore-10)/10*60)                                         WHEN a.Delay23GScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t3])),2.0) AS allscore,                     ROUND((                             CASE                                 WHEN a.attachsusscesrate IS NULL                                 THEN 1                                 ELSE a.attachsusscesrate                             END)*100 ,2.0) attachsusscesrate,                     ROUND((                             CASE                                 WHEN a.AttachSuccessScore<0                                 THEN 100                                 WHEN a.AttachSuccessScore>=0                                 AND a.AttachSuccessScore<10                                 THEN (100-a.AttachSuccessScore/10*40)                                 WHEN a.AttachSuccessScore>=10                                 AND a.AttachSuccessScore<20                                 THEN (60-(a.AttachSuccessScore-10)/10*60)                                 WHEN a.AttachSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS attachscore,                     ROUND((                             CASE                                 WHEN a.httprequestrate IS NOT NULL                                 THEN a.httprequestrate                                 ELSE 0                             END)*100,2.0) httprequestrate,                     ROUND((                             CASE                                 WHEN a.RequestSuccessScore<0                                 THEN 100                                 WHEN a.RequestSuccessScore>=0                                 AND a.RequestSuccessScore<10                                 THEN (100-a.RequestSuccessScore/10*40)                                 WHEN a.RequestSuccessScore>=10                                 AND a.RequestSuccessScore<20                                 THEN (60-(a.RequestSuccessScore-10)/10*60)                                 WHEN a.RequestSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS httpscore,                     ROUND( (                             CASE                                 WHEN a.ruofugairate IS NOT NULL                                 THEN a.ruofugairate                                 ELSE 1                             END)*100,2.0) ruofugairate,                     ROUND((                             CASE                                 WHEN a.RuoFugaiScore<0                                 THEN 100                                 WHEN a.RuoFugaiScore>=0                                 AND a.RuoFugaiScore<10                                 THEN (100-a.RuoFugaiScore/10*40)                                 WHEN a.RuoFugaiScore>=10                                 AND a.RuoFugaiScore<20                                 THEN (60-(a.RuoFugaiScore-10)/10*60)                                 WHEN a.RuoFugaiScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0)AS ruofugaiscore,                     ROUND((                             CASE                                 WHEN a.downdelayrate IS NOT NULL                                 THEN a.downdelayrate                                 ELSE 0                             END ),2.0) downdelayrate ,                     ROUND((                             CASE                                 WHEN a.DLAvgDelayScore<0                                 THEN 100                                 WHEN a.DLAvgDelayScore>=0                                 AND a.DLAvgDelayScore<1000                                 THEN (100-a.DLAvgDelayScore/1000*40)                                 WHEN a.DLAvgDelayScore>=1000                                 AND a.DLAvgDelayScore<2000                                 THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                 WHEN a.DLAvgDelayScore>=2000                                 THEN 0                                 ELSE 0                             END ),2.0) AS downdelaycore,                     ROUND((                             CASE                                 WHEN a.delay23G IS NOT NULL                                 THEN a.delay23G                                 ELSE 0                             END )*100,2.0) delay23G,                     ROUND((                             CASE                                 WHEN a.Delay23GScore<0                                 THEN 100                                 WHEN a.Delay23GScore>=0                                 AND a.Delay23GScore<10                                 THEN (100-a.Delay23GScore/10*40)                                 WHEN a.Delay23GScore>=10                                 AND a.Delay23GScore<20                                 THEN (60-(a.Delay23GScore-10)/10*60)                                 WHEN a.Delay23GScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS delay23gcore                 FROM                     (                         SELECT                             a.tac,                             d.factory,                             d.mobiletype,                             d.mobilecategory,                             d.dldata,                             d.usernumber,                             d.SessionRequest,                             a.downdelayrate,                             (b.alldowndelayrate-a.downdelayrate) AS dlavgdelayscore,                             a.ruofugairate,                             (a.ruofugairate-b.allruouugairate)*100 AS ruofugaiscore,                             a.delay23G,                             (a.delay23G-b.alldelay23g)*100 AS delay23gscore,                             a.attachsusscesrate,                             (b.allattachsusscesrate-a.attachsusscesrate)*100 AS attachsuccessscore,                             a.httprequestrate,                             (b.allhttpsuccessrate-a.httprequestrate)*100 AS requestsuccessscore                         FROM                             (                                 SELECT                                     c.tac,                                     (                                         CASE                                             WHEN SUM(Businesshours)>0                                             THEN SUM(DLData)*8*1000/SUM(Businesshours)/1024                                         END) AS downdelayrate,                                     (                                         CASE                                             WHEN SUM(MRcount)>0                                             THEN SUM(WEAKMRCount)/SUM(MRcount)                                             ELSE 0                                         END) AS ruofugairate,                                     (                                         CASE                                             WHEN (SUM(GNBusinesshours)+SUM(Businesshours))>0                                             THEN SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM                                                 (Businesshours))                                         END) AS delay23G,                                     (                                         CASE                                             WHEN SUM(AttachRequest)>0                                             THEN SUM(AttachSuccess)/SUM(AttachRequest)                                             ELSE 1                                         END) AS attachsusscesrate,                                     (                                         CASE                                             WHEN SUM(SessionRequest)>0                                             THEN SUM(SessionSuccess)/SUM(SessionRequest)                                         END) AS httprequestrate                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0                                 GROUP BY                                     c.tac )a,                             (                                 SELECT                                     SUM(AttachSuccess)/SUM(AttachRequest)   AS allattachsusscesrate,                                     SUM(SessionSuccess)/SUM(SessionRequest)   AS allhttpsuccessrate,                                     SUM(DLData)*8*1000/SUM(Businesshours)/1024 AS alldowndelayrate,                                     SUM(WEAKMRCount)/SUM(MRcount)              AS allruouugairate,                                     SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM(Businesshours))                                     AS alldelay23g                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0 )b,                             (                                 SELECT                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     CASE                                         WHEN base.NETTYPE IN ('LTE-数据卡',                                                               'TD上网卡')                                         THEN '数据卡'                                         WHEN base.nettype IN ('TD手机',                                                               'LTE PHONE',                                                               '非定制机',                                                               '联通定制机')                                         THEN 'LTE手机'                                         ELSE base.nettype                                     END                   AS mobilecategory,                                     SUM(t.dldata)            dldata,                                     SUM(t.usernumber)        usernumber,                                     SUM(t.SessionRequest)    SessionRequest                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC t,                                     lte_sys.T_Base_Terminal_D base                                 WHERE                                     TO_CHAR(t.tac)=base.IMEI                                 AND t.starttime>=TIMESTAMP'[@c1]'                                 AND t.starttime<=TIMESTAMP'[@c2]'                                 AND t.dldata>0                                 GROUP BY                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     base.NETTYPE) d                         WHERE                             a.tac=d.tac)a )t     ) SELECT     factory,     mobiletype,     mobilecategory,     taccount,     ROUND(totaldata/1024,2.0) totaldata,     sessionrequest,     ROUND(allscore,2.0)          allscore,     ROUND(attachsusscesrate,2.0) attachsusscesrate,     ROUND(attachscore,2.0)       attachscore,     ROUND(httprequestrate,2.0)   httprequestrate,     ROUND(httpscore,2.0)         httpscore,     ROUND(ruofugairate,2.0)      ruofugairate,     ROUND(ruofugaiscore,2.0)     ruofugaiscore,     ROUND(downdelayrate,2.0)     downdelayrate,     ROUND(downdelaycore,4.0)     downdelaycore,     ROUND(delay23G,2.0)          delay23G,     ROUND(delay23gcore,2.0)      delay23gcore FROM     tmp WHERE     taccount>20 AND allscore<80"
      }
    },
    {
      "key": "query_tac_topchar",
      "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 a.mobilecategory,a.taccount,round(a.categorycount/b.count2,4.0)*100 categoryrate,a.totaldata,round(a.totaldata/b.totaldatacount,4.0)*100 datarate,a.poorcount,round(a.poorcount/b.tcount,4.0)*100 poorrate,a.poordata,round(a.poordata/b.poortotalcount,4.0)*100 poordatarate from (select mobilecategory,sum(taccount) taccount,sum(case when mobilecategory='LTE MIFI' then 1   when mobilecategory='LTE手机' then 1   when mobilecategory='LTE CPE' then 1   when mobilecategory='数据卡'  then 1 else 0 end) categorycount,sum(totaldata) totaldata ,sum(case when allscore<80 then taccount else 0 end) poorcount,sum(case when allscore<80 then totaldata else 0 end) poordata  from lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC_PoorQuality t   group by mobilecategory)a ,(select count(0) count2,sum(totaldata) totaldatacount,sum(case when allscore<80 then taccount else 0 end) tcount,sum(case when allscore<80 then totaldata else 0 end ) poortotalcount from lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC_PoorQuality  )b   order by taccount desc"
      }
    },
    {
      "key": "query_tac_topchar_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": "tac_Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          }
        ],
        "value": "  WITH     tmp AS     (         SELECT             t.tac,             t.factory,             t.mobiletype,             t.mobilecategory,             t.usernumber AS taccount,             t.dldata     AS totaldata,             t.sessionrequest,             t.allscore,             t.attachsusscesrate,             t.attachscore,             t.httprequestrate,             t.httpscore,             t.ruofugairate,             t.ruofugaiscore,             0,             0,             t.downdelayrate,             t.downdelaycore,             t.delay23G,             t.delay23gcore         FROM             (                 SELECT                     a.tac,                     a.Factory,                     a.MobileType,                     a.MobileCategory,                     a.usernumber,                     a.dldata,                     a.SessionRequest,                     ROUND( ( ((                                     CASE                                         WHEN a.AttachSuccessScore<0                                         THEN 100                                         WHEN a.AttachSuccessScore>=0                                         AND a.AttachSuccessScore<10                                         THEN (100-a.AttachSuccessScore/10*40)                                         WHEN a.AttachSuccessScore>=10                                         AND a.AttachSuccessScore<20                                         THEN (60-(a.AttachSuccessScore-10)/10*60)                                         WHEN a.AttachSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t5])+ ((                                     CASE                                         WHEN a.RequestSuccessScore<0                                         THEN 100                                         WHEN a.RequestSuccessScore>=0                                         AND a.RequestSuccessScore<10                                         THEN (100-a.RequestSuccessScore/10*40)                                         WHEN a.RequestSuccessScore>=10                                         AND a.RequestSuccessScore<20                                         THEN (60-(a.RequestSuccessScore-10)/10*60)                                         WHEN a.RequestSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t6])+ ((                                     CASE                                         WHEN a.RuoFugaiScore<0                                         THEN 100                                         WHEN a.RuoFugaiScore>=0                                         AND a.RuoFugaiScore<10                                         THEN (100-a.RuoFugaiScore/10*40)                                         WHEN a.RuoFugaiScore>=10                                         AND a.RuoFugaiScore<20                                         THEN (60-(a.RuoFugaiScore-10)/10*60)                                         WHEN a.RuoFugaiScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t2])+ ((                                     CASE                                         WHEN a.DLAvgDelayScore<0                                         THEN 100                                         WHEN a.DLAvgDelayScore>=0                                         AND a.DLAvgDelayScore<1000                                         THEN (100-a.DLAvgDelayScore/1000*40)                                         WHEN a.DLAvgDelayScore>=1000                                         AND a.DLAvgDelayScore<2000                                         THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                         WHEN a.DLAvgDelayScore>=2000                                         THEN 0                                         ELSE 0                                     END )*[@t1])+ ((                                     CASE                                         WHEN a.Delay23GScore<0                                         THEN 100                                         WHEN a.Delay23GScore>=0                                         AND a.Delay23GScore<10                                         THEN (100-a.Delay23GScore/10*40)                                         WHEN a.Delay23GScore>=10                                         AND a.Delay23GScore<20                                         THEN (60-(a.Delay23GScore-10)/10*60)                                         WHEN a.Delay23GScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t3])),2.0) AS allscore,                     ROUND((                             CASE                                 WHEN a.attachsusscesrate IS NULL                                 THEN 1                                 ELSE a.attachsusscesrate                             END)*100 ,2.0) attachsusscesrate,                     ROUND((                             CASE                                 WHEN a.AttachSuccessScore<0                                 THEN 100                                 WHEN a.AttachSuccessScore>=0                                 AND a.AttachSuccessScore<10                                 THEN (100-a.AttachSuccessScore/10*40)                                 WHEN a.AttachSuccessScore>=10                                 AND a.AttachSuccessScore<20                                 THEN (60-(a.AttachSuccessScore-10)/10*60)                                 WHEN a.AttachSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS attachscore,                     ROUND((                             CASE                                 WHEN a.httprequestrate IS NOT NULL                                 THEN a.httprequestrate                                 ELSE 0                             END)*100,2.0) httprequestrate,                     ROUND((                             CASE                                 WHEN a.RequestSuccessScore<0                                 THEN 100                                 WHEN a.RequestSuccessScore>=0                                 AND a.RequestSuccessScore<10                                 THEN (100-a.RequestSuccessScore/10*40)                                 WHEN a.RequestSuccessScore>=10                                 AND a.RequestSuccessScore<20                                 THEN (60-(a.RequestSuccessScore-10)/10*60)                                 WHEN a.RequestSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS httpscore,                     ROUND( (                             CASE                                 WHEN a.ruofugairate IS NOT NULL                                 THEN a.ruofugairate                                 ELSE 1                             END)*100,2.0) ruofugairate,                     ROUND((                             CASE                                 WHEN a.RuoFugaiScore<0                                 THEN 100                                 WHEN a.RuoFugaiScore>=0                                 AND a.RuoFugaiScore<10                                 THEN (100-a.RuoFugaiScore/10*40)                                 WHEN a.RuoFugaiScore>=10                                 AND a.RuoFugaiScore<20                                 THEN (60-(a.RuoFugaiScore-10)/10*60)                                 WHEN a.RuoFugaiScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0)AS ruofugaiscore,                     ROUND((                             CASE                                 WHEN a.downdelayrate IS NOT NULL                                 THEN a.downdelayrate                                 ELSE 0                             END ),2.0) downdelayrate ,                     ROUND((                             CASE                                 WHEN a.DLAvgDelayScore<0                                 THEN 100                                 WHEN a.DLAvgDelayScore>=0                                 AND a.DLAvgDelayScore<1000                                 THEN (100-a.DLAvgDelayScore/1000*40)                                 WHEN a.DLAvgDelayScore>=1000                                 AND a.DLAvgDelayScore<2000                                 THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                 WHEN a.DLAvgDelayScore>=2000                                 THEN 0                                 ELSE 0                             END ),2.0) AS downdelaycore,                     ROUND((                             CASE                                 WHEN a.delay23G IS NOT NULL                                 THEN a.delay23G                                 ELSE 0                             END )*100,2.0) delay23G,                     ROUND((                             CASE                                 WHEN a.Delay23GScore<0                                 THEN 100                                 WHEN a.Delay23GScore>=0                                 AND a.Delay23GScore<10                                 THEN (100-a.Delay23GScore/10*40)                                 WHEN a.Delay23GScore>=10                                 AND a.Delay23GScore<20                                 THEN (60-(a.Delay23GScore-10)/10*60)                                 WHEN a.Delay23GScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS delay23gcore                 FROM                     (                         SELECT                             a.tac,                             d.factory,                             d.mobiletype,                             d.mobilecategory,                             d.dldata,                             d.usernumber,                             d.SessionRequest,                             a.downdelayrate,                             (b.alldowndelayrate-a.downdelayrate) AS dlavgdelayscore,                             a.ruofugairate,                             (a.ruofugairate-b.allruouugairate)*100 AS ruofugaiscore,                             a.delay23G,                             (a.delay23G-b.alldelay23g)*100 AS delay23gscore,                             a.attachsusscesrate,                             (b.allattachsusscesrate-a.attachsusscesrate)*100 AS attachsuccessscore,                             a.httprequestrate,                             (b.allhttpsuccessrate-a.httprequestrate)*100 AS requestsuccessscore                         FROM                             (                                 SELECT                                     c.tac,                                     (                                         CASE                                             WHEN SUM(Businesshours)>0                                             THEN SUM(DLData)*8*1000/SUM(Businesshours)/1024                                         END) AS downdelayrate,                                     (                                         CASE                                             WHEN SUM(MRcount)>0                                             THEN SUM(WEAKMRCount)/SUM(MRcount)                                             ELSE 0                                         END) AS ruofugairate,                                     (                                         CASE                                             WHEN (SUM(GNBusinesshours)+SUM(Businesshours))>0                                             THEN SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM                                                 (Businesshours))                                         END) AS delay23G,                                     (                                         CASE                                             WHEN SUM(AttachRequest)>0                                             THEN SUM(AttachSuccess)/SUM(AttachRequest)                                             ELSE 1                                         END) AS attachsusscesrate,                                     (                                         CASE                                             WHEN SUM(SessionRequest)>0                                             THEN SUM(SessionSuccess)/SUM(SessionRequest)                                         END) AS httprequestrate                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0                                 GROUP BY                                     c.tac )a,                             (                                 SELECT                                     SUM(AttachSuccess)/SUM(AttachRequest)   AS allattachsusscesrate,                                     SUM(SessionSuccess)/SUM(SessionRequest)   AS allhttpsuccessrate,                                     SUM(DLData)*8*1000/SUM(Businesshours)/1024 AS alldowndelayrate,                                     SUM(WEAKMRCount)/SUM(MRcount)              AS allruouugairate,                                     SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM(Businesshours))                                     AS alldelay23g                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0 )b,                             (                                 SELECT                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     CASE                                         WHEN base.NETTYPE IN ('LTE-数据卡',                                                               'TD上网卡')                                         THEN '数据卡'                                         WHEN base.nettype IN ('TD手机',                                                               'LTE PHONE',                                                               '非定制机',                                                               '联通定制机')                                         THEN 'LTE手机'                                         ELSE base.nettype                                     END                   AS mobilecategory,                                     SUM(t.dldata)            dldata,                                     SUM(t.usernumber)        usernumber,                                     SUM(t.SessionRequest)    SessionRequest                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC t,                                     lte_sys.T_Base_Terminal_D base                                 WHERE                                     TO_CHAR(t.tac)=base.IMEI                                 AND t.starttime>=TIMESTAMP'[@c1]'                                 AND t.starttime<=TIMESTAMP'[@c2]'                                 AND t.dldata>0                                 GROUP BY                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     base.NETTYPE) d                         WHERE                             a.tac=d.tac)a )t     ) SELECT     a.mobilecategory,     a.taccount,     ROUND(a.categorycount/b.count2,4.0)*100 categoryrate,     a.totaldata,     ROUND(a.totaldata/b.totaldatacount,4.0)*100 datarate,     a.poorcount,     ROUND(a.poorcount/b.tcount,4.0)*100 poorrate,     a.poordata,     ROUND(a.poordata/b.poortotalcount,4.0)*100 poordatarate FROM     (         SELECT             tmp.mobilecategory,             SUM(tmp.taccount) taccount,             SUM(                 CASE                     WHEN tmp.mobilecategory='LTE MIFI'                     THEN 1                     WHEN tmp.mobilecategory='LTE手机'                     THEN 1                     WHEN tmp.mobilecategory='LTE CPE'                     THEN 1                     WHEN tmp.mobilecategory='数据卡'                     THEN 1  else 0                END)           categorycount,             SUM(tmp.totaldata) totaldata ,             SUM(                 CASE                     WHEN tmp.allscore<80                     THEN tmp.taccount    else 0             END) poorcount,             SUM(                 CASE                     WHEN tmp.allscore<80                     THEN tmp.totaldata      else 0           END) poordata         FROM             tmp        GROUP BY             tmp.mobilecategory)a ,     (         SELECT             COUNT(0)           count2,             SUM(tmp.totaldata) totaldatacount,             SUM(                 CASE                     WHEN tmp.allscore<80                     THEN tmp.taccount     else 0            END) tcount,             SUM(                 CASE                     WHEN tmp.allscore<80                     THEN tmp.totaldata           else 0      END ) poortotalcount         FROM             tmp    )b ORDER BY     a.taccount DESC"
      }
    },
    {
      "key": "query_tac_leftchar",
      "desc": "饼图",
      "config": {
        "parameters": [
          {
            "name": "category",
            "columnname": "mobilecategory",
            "type": "string",
            "format": "",
            "conditionid": "s0",
            "symbol": "="
          },
          {
            "name": "poor",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s1",
            "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": "strorder",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c4",
            "symbol": ""
          },
          {
            "name": "subapp",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c5",
            "symbol": ""
          }
        ],
        "value": " select factory,taccount,round(tacrate,2.0) tacrate,round(flow,2) flow,round(flowrate,2.0) flowrate,id from (  select * from ( select a.factory,a.taccount, a.taccount/sum(a.taccount) over() tacrate,  a.flow/1024   flow,   a.flow/sum(a.flow) over()  flowrate,1 id from ( select factory,sum(taccount) taccount,sum(totaldata) flow from lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC_PoorQuality  where ([@s0]) [@and]  [@s1]   group by factory)a   order by ([@c4])  desc offset 0 limit 10  )a  union     select '其他' factory,sum(t.taccount) taccount, sum(t.tacrate)  tacrate, sum(t.flow)  flow, sum(t.flowrate)   flowrate ,2 id from ( select a.factory,a.taccount, a.taccount/sum(a.taccount) over()  tacrate,  a.flow/1024   flow,   a.flow/sum(a.flow) over()  flowrate from ( select factory,sum(taccount) taccount,sum(totaldata) flow from lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC_PoorQuality   where ([@s0]) [@and]  [@s1]   group by factory)a   order by ([@c4])  desc offset 10 )t   )m order by m.id  "
      }
    },
    {
      "key": "query_tac_leftchar_subapp",
      "desc": "饼图",
      "config": {
        "parameters": [
          {
            "name": "category",
            "columnname": "mobilecategory",
            "type": "string",
            "format": "",
            "conditionid": "s0",
            "symbol": "="
          },
          {
            "name": "poor",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s1",
            "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": "strorder",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c4",
            "symbol": ""
          },
          {
            "name": "subapp",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c5",
            "symbol": ""
          }
        ],
        "value": " SELECT     factory,     mobiletype,     taccount,     ROUND(tacrate,2.0)  tacrate,     ROUND(flow,2)       flow,     ROUND(flowrate,2.0) flowrate,     id FROM     (         SELECT             *         FROM             (                 SELECT                     a.factory,                     a.mobiletype,                     a.taccount,                     a.taccount/SUM(a.taccount) over() tacrate,                     a.flow/1024                           flow,                     a.flow/SUM(a.flow) over()        flowrate,                     1                                     id                 FROM                     (                         SELECT                             factory,                             mobiletype,                             SUM(taccount)  taccount,                             SUM(totaldata) flow                         FROM                             lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC_PoorQuality                         WHERE                             (                                 [@s0]) [@and] [@s1] [@and] [@c5]                         GROUP BY                             factory,mobiletype)a                 ORDER BY                     ([@c4]) DESC offset 0 limit 10 )a         UNION         SELECT             '其他'            factory,             '其他' mobiletype,             SUM(t.taccount) taccount,             SUM(t.tacrate)  tacrate,             SUM(t.flow)     flow,             SUM(t.flowrate) flowrate ,             2               id         FROM             (                 SELECT                     a.factory,                     a.taccount,                     a.taccount/SUM(a.taccount) over() tacrate,                     a.flow/1024                           flow,                     a.flow/SUM(a.flow) over()         flowrate                 FROM                     (                         SELECT                             factory,mobiletype,                             SUM(taccount)  taccount,                             SUM(totaldata) flow                         FROM                             lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC_PoorQuality                         WHERE                             (                                 [@s0]) [@and] [@s1] [@and] [@c5]                         GROUP BY                             factory,mobiletype)a                 ORDER BY                     ([@c4]) DESC offset 10 )t )m ORDER BY     m.id"
      }
    },
    {
      "key": "query_tac_leftchar_p_en",
      "desc": "饼图",
      "config": {
        "parameters": [
          {
            "name": "category",
            "columnname": "mobilecategory",
            "type": "string",
            "format": "",
            "conditionid": "s0",
            "symbol": "="
          },
          {
            "name": "poor",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s1",
            "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": "strorder",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c4",
            "symbol": ""
          },
          {
            "name": "subapp",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c5",
            "symbol": ""
          },
          {
            "name": "tac_Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          }
        ],
        "value": "WITH     tmp AS     (          SELECT             t.tac,             t.factory,             t.mobiletype,             t.mobilecategory,             t.usernumber AS taccount,             t.dldata     AS totaldata,             t.sessionrequest,             t.allscore,             t.attachsusscesrate,             t.attachscore,             t.httprequestrate,             t.httpscore,             t.ruofugairate,             t.ruofugaiscore,             0,             0,             t.downdelayrate,             t.downdelaycore,             t.delay23G,             t.delay23gcore         FROM             (                 SELECT                     a.tac,                     a.Factory,                     a.MobileType,                     a.MobileCategory,                     a.usernumber,                     a.dldata,                     a.SessionRequest,                     ROUND( ( ((                                     CASE                                         WHEN a.AttachSuccessScore<0                                         THEN 100                                         WHEN a.AttachSuccessScore>=0                                         AND a.AttachSuccessScore<10                                         THEN (100-a.AttachSuccessScore/10*40)                                         WHEN a.AttachSuccessScore>=10                                         AND a.AttachSuccessScore<20                                         THEN (60-(a.AttachSuccessScore-10)/10*60)                                         WHEN a.AttachSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t5])+ ((                                     CASE                                         WHEN a.RequestSuccessScore<0                                         THEN 100                                         WHEN a.RequestSuccessScore>=0                                         AND a.RequestSuccessScore<10                                         THEN (100-a.RequestSuccessScore/10*40)                                         WHEN a.RequestSuccessScore>=10                                         AND a.RequestSuccessScore<20                                         THEN (60-(a.RequestSuccessScore-10)/10*60)                                         WHEN a.RequestSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t6])+ ((                                     CASE                                         WHEN a.RuoFugaiScore<0                                         THEN 100                                         WHEN a.RuoFugaiScore>=0                                         AND a.RuoFugaiScore<10                                         THEN (100-a.RuoFugaiScore/10*40)                                         WHEN a.RuoFugaiScore>=10                                         AND a.RuoFugaiScore<20                                         THEN (60-(a.RuoFugaiScore-10)/10*60)                                         WHEN a.RuoFugaiScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t2])+ ((                                     CASE                                         WHEN a.DLAvgDelayScore<0                                         THEN 100                                         WHEN a.DLAvgDelayScore>=0                                         AND a.DLAvgDelayScore<1000                                         THEN (100-a.DLAvgDelayScore/1000*40)                                         WHEN a.DLAvgDelayScore>=1000                                         AND a.DLAvgDelayScore<2000                                         THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                         WHEN a.DLAvgDelayScore>=2000                                         THEN 0                                         ELSE 0                                     END )*[@t1])+ ((                                     CASE                                         WHEN a.Delay23GScore<0                                         THEN 100                                         WHEN a.Delay23GScore>=0                                         AND a.Delay23GScore<10                                         THEN (100-a.Delay23GScore/10*40)                                         WHEN a.Delay23GScore>=10                                         AND a.Delay23GScore<20                                         THEN (60-(a.Delay23GScore-10)/10*60)                                         WHEN a.Delay23GScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t3])),2.0) AS allscore,                     ROUND((                             CASE                                 WHEN a.attachsusscesrate IS NULL                                 THEN 1                                 ELSE a.attachsusscesrate                             END)*100 ,2.0) attachsusscesrate,                     ROUND((                             CASE                                 WHEN a.AttachSuccessScore<0                                 THEN 100                                 WHEN a.AttachSuccessScore>=0                                 AND a.AttachSuccessScore<10                                 THEN (100-a.AttachSuccessScore/10*40)                                 WHEN a.AttachSuccessScore>=10                                 AND a.AttachSuccessScore<20                                 THEN (60-(a.AttachSuccessScore-10)/10*60)                                 WHEN a.AttachSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS attachscore,                     ROUND((                             CASE                                 WHEN a.httprequestrate IS NOT NULL                                 THEN a.httprequestrate                                 ELSE 0                             END)*100,2.0) httprequestrate,                     ROUND((                             CASE                                 WHEN a.RequestSuccessScore<0                                 THEN 100                                 WHEN a.RequestSuccessScore>=0                                 AND a.RequestSuccessScore<10                                 THEN (100-a.RequestSuccessScore/10*40)                                 WHEN a.RequestSuccessScore>=10                                 AND a.RequestSuccessScore<20                                 THEN (60-(a.RequestSuccessScore-10)/10*60)                                 WHEN a.RequestSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS httpscore,                     ROUND( (                             CASE                                 WHEN a.ruofugairate IS NOT NULL                                 THEN a.ruofugairate                                 ELSE 1                             END)*100,2.0) ruofugairate,                     ROUND((                             CASE                                 WHEN a.RuoFugaiScore<0                                 THEN 100                                 WHEN a.RuoFugaiScore>=0                                 AND a.RuoFugaiScore<10                                 THEN (100-a.RuoFugaiScore/10*40)                                 WHEN a.RuoFugaiScore>=10                                 AND a.RuoFugaiScore<20                                 THEN (60-(a.RuoFugaiScore-10)/10*60)                                 WHEN a.RuoFugaiScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0)AS ruofugaiscore,                     ROUND((                             CASE                                 WHEN a.downdelayrate IS NOT NULL                                 THEN a.downdelayrate                                 ELSE 0                             END ),2.0) downdelayrate ,                     ROUND((                             CASE                                 WHEN a.DLAvgDelayScore<0                                 THEN 100                                 WHEN a.DLAvgDelayScore>=0                                 AND a.DLAvgDelayScore<1000                                 THEN (100-a.DLAvgDelayScore/1000*40)                                 WHEN a.DLAvgDelayScore>=1000                                 AND a.DLAvgDelayScore<2000                                 THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                 WHEN a.DLAvgDelayScore>=2000                                 THEN 0                                 ELSE 0                             END ),2.0) AS downdelaycore,                     ROUND((                             CASE                                 WHEN a.delay23G IS NOT NULL                                 THEN a.delay23G                                 ELSE 0                             END )*100,2.0) delay23G,                     ROUND((                             CASE                                 WHEN a.Delay23GScore<0                                 THEN 100                                 WHEN a.Delay23GScore>=0                                 AND a.Delay23GScore<10                                 THEN (100-a.Delay23GScore/10*40)                                 WHEN a.Delay23GScore>=10                                 AND a.Delay23GScore<20                                 THEN (60-(a.Delay23GScore-10)/10*60)                                 WHEN a.Delay23GScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS delay23gcore                 FROM                     (                         SELECT                             a.tac,                             d.factory,                             d.mobiletype,                             d.mobilecategory,                             d.dldata,                             d.usernumber,                             d.SessionRequest,                             a.downdelayrate,                             (b.alldowndelayrate-a.downdelayrate) AS dlavgdelayscore,                             a.ruofugairate,                             (a.ruofugairate-b.allruouugairate)*100 AS ruofugaiscore,                             a.delay23G,                             (a.delay23G-b.alldelay23g)*100 AS delay23gscore,                             a.attachsusscesrate,                             (b.allattachsusscesrate-a.attachsusscesrate)*100 AS attachsuccessscore,                             a.httprequestrate,                             (b.allhttpsuccessrate-a.httprequestrate)*100 AS requestsuccessscore                         FROM                             (                                 SELECT                                     c.tac,                                     (                                         CASE                                             WHEN SUM(Businesshours)>0                                             THEN SUM(DLData)*8*1000/SUM(Businesshours)/1024                                         END) AS downdelayrate,                                     (                                         CASE                                             WHEN SUM(MRcount)>0                                             THEN SUM(WEAKMRCount)/SUM(MRcount)                                             ELSE 0                                         END) AS ruofugairate,                                     (                                         CASE                                             WHEN (SUM(GNBusinesshours)+SUM(Businesshours))>0                                             THEN SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM                                                 (Businesshours))                                         END) AS delay23G,                                     (                                         CASE                                             WHEN SUM(AttachRequest)>0                                             THEN SUM(AttachSuccess)/SUM(AttachRequest)                                             ELSE 1                                         END) AS attachsusscesrate,                                     (                                         CASE                                             WHEN SUM(SessionRequest)>0                                             THEN SUM(SessionSuccess)/SUM(SessionRequest)                                         END) AS httprequestrate                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0                                 GROUP BY                                     c.tac )a,                             (                                 SELECT                                     SUM(AttachSuccess)/SUM(AttachRequest)   AS allattachsusscesrate,                                     SUM(SessionSuccess)/SUM(SessionRequest)   AS allhttpsuccessrate,                                     SUM(DLData)*8*1000/SUM(Businesshours)/1024 AS alldowndelayrate,                                     SUM(WEAKMRCount)/SUM(MRcount)              AS allruouugairate,                                     SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM(Businesshours))                                     AS alldelay23g                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0 )b,                             (                                 SELECT                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     CASE                                         WHEN base.NETTYPE IN ('LTE-数据卡',                                                               'TD上网卡')                                         THEN '数据卡'                                         WHEN base.nettype IN ('TD手机',                                                               'LTE PHONE',                                                               '非定制机',                                                               '联通定制机')                                         THEN 'LTE手机'                                         ELSE base.nettype                                     END                   AS mobilecategory,                                     SUM(t.dldata)            dldata,                                     SUM(t.usernumber)        usernumber,                                     SUM(t.SessionRequest)    SessionRequest                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC t,                                     lte_sys.T_Base_Terminal_D base                                 WHERE                                     TO_CHAR(t.tac)=base.IMEI                                 AND t.starttime>=TIMESTAMP'[@c1]'                                 AND t.starttime<=TIMESTAMP'[@c2]'                                 AND t.dldata>0                                 GROUP BY                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     base.NETTYPE) d                         WHERE                             a.tac=d.tac)a )t     ) SELECT     factory,     taccount,     ROUND(tacrate,2.0)  tacrate,     ROUND(flow,2)       flow,     ROUND(flowrate,2.0) flowrate,     id FROM     (         SELECT             *         FROM             (                 SELECT                     a.factory,                     a.taccount,                     a.taccount/SUM(a.taccount) over() tacrate,                     a.flow/1024                       flow,                     a.flow/SUM(a.flow) over()         flowrate,                     1                                 id                 FROM                     (                         SELECT                             factory,                             SUM(taccount)  taccount,                             SUM(totaldata) flow                         FROM                             tmp                         WHERE                             (                                 [@s0]) [@and] [@s1]                         GROUP BY                             factory)a                 ORDER BY                     ([@c4]) DESC offset 0 limit 10 )a         UNION         SELECT             '其他'            factory,             SUM(t.taccount) taccount,             SUM(t.tacrate)  tacrate,             SUM(t.flow)     flow,             SUM(t.flowrate) flowrate ,             2               id         FROM             (                 SELECT                     a.factory,                     a.taccount,                     a.taccount/SUM(a.taccount) over() tacrate,                     a.flow/1024                       flow,                     a.flow/SUM(a.flow) over()         flowrate                 FROM                     (                         SELECT                             factory,                             SUM(taccount)  taccount,                             SUM(totaldata) flow                         FROM                            tmp                         WHERE                             (                                 [@s0]) [@and] [@s1]                         GROUP BY                             factory)a                 ORDER BY                     ([@c4]) DESC offset 10 )t )m ORDER BY     m.id"
      }
    },
    {
      "key": "query_tac_leftchar_subapp_p_en",
      "desc": "饼图",
      "config": {
        "parameters": [
          {
            "name": "category",
            "columnname": "mobilecategory",
            "type": "string",
            "format": "",
            "conditionid": "s0",
            "symbol": "="
          },
          {
            "name": "poor",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s1",
            "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": "strorder",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c4",
            "symbol": ""
          },
          {
            "name": "subapp",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c5",
            "symbol": ""
          },
          {
            "name": "tac_Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          }
        ],
        "value": "WITH     tmp AS     (         SELECT             t.tac,             t.factory,             t.mobiletype,             t.mobilecategory,             t.usernumber AS taccount,             t.dldata     AS totaldata,             t.sessionrequest,             t.allscore,             t.attachsusscesrate,             t.attachscore,             t.httprequestrate,             t.httpscore,             t.ruofugairate,             t.ruofugaiscore,             0,             0,             t.downdelayrate,             t.downdelaycore,             t.delay23G,             t.delay23gcore         FROM             (                 SELECT                     a.tac,                     a.Factory,                     a.MobileType,                     a.MobileCategory,                     a.usernumber,                     a.dldata,                     a.SessionRequest,                     ROUND( ( ((                                     CASE                                         WHEN a.AttachSuccessScore<0                                         THEN 100                                         WHEN a.AttachSuccessScore>=0                                         AND a.AttachSuccessScore<10                                         THEN (100-a.AttachSuccessScore/10*40)                                         WHEN a.AttachSuccessScore>=10                                         AND a.AttachSuccessScore<20                                         THEN (60-(a.AttachSuccessScore-10)/10*60)                                         WHEN a.AttachSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t5])+ ((                                     CASE                                         WHEN a.RequestSuccessScore<0                                         THEN 100                                         WHEN a.RequestSuccessScore>=0                                         AND a.RequestSuccessScore<10                                         THEN (100-a.RequestSuccessScore/10*40)                                         WHEN a.RequestSuccessScore>=10                                         AND a.RequestSuccessScore<20                                         THEN (60-(a.RequestSuccessScore-10)/10*60)                                         WHEN a.RequestSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t6])+ ((                                     CASE                                         WHEN a.RuoFugaiScore<0                                         THEN 100                                         WHEN a.RuoFugaiScore>=0                                         AND a.RuoFugaiScore<10                                         THEN (100-a.RuoFugaiScore/10*40)                                         WHEN a.RuoFugaiScore>=10                                         AND a.RuoFugaiScore<20                                         THEN (60-(a.RuoFugaiScore-10)/10*60)                                         WHEN a.RuoFugaiScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t2])+ ((                                     CASE                                         WHEN a.DLAvgDelayScore<0                                         THEN 100                                         WHEN a.DLAvgDelayScore>=0                                         AND a.DLAvgDelayScore<1000                                         THEN (100-a.DLAvgDelayScore/1000*40)                                         WHEN a.DLAvgDelayScore>=1000                                         AND a.DLAvgDelayScore<2000                                         THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                         WHEN a.DLAvgDelayScore>=2000                                         THEN 0                                         ELSE 0                                     END )*[@t1])+ ((                                     CASE                                         WHEN a.Delay23GScore<0                                         THEN 100                                         WHEN a.Delay23GScore>=0                                         AND a.Delay23GScore<10                                         THEN (100-a.Delay23GScore/10*40)                                         WHEN a.Delay23GScore>=10                                         AND a.Delay23GScore<20                                         THEN (60-(a.Delay23GScore-10)/10*60)                                         WHEN a.Delay23GScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t3])),2.0) AS allscore,                     ROUND((                             CASE                                 WHEN a.attachsusscesrate IS NULL                                 THEN 1                                 ELSE a.attachsusscesrate                             END)*100 ,2.0) attachsusscesrate,                     ROUND((                             CASE                                 WHEN a.AttachSuccessScore<0                                 THEN 100                                 WHEN a.AttachSuccessScore>=0                                 AND a.AttachSuccessScore<10                                 THEN (100-a.AttachSuccessScore/10*40)                                 WHEN a.AttachSuccessScore>=10                                 AND a.AttachSuccessScore<20                                 THEN (60-(a.AttachSuccessScore-10)/10*60)                                 WHEN a.AttachSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS attachscore,                     ROUND((                             CASE                                 WHEN a.httprequestrate IS NOT NULL                                 THEN a.httprequestrate                                 ELSE 0                             END)*100,2.0) httprequestrate,                     ROUND((                             CASE                                 WHEN a.RequestSuccessScore<0                                 THEN 100                                 WHEN a.RequestSuccessScore>=0                                 AND a.RequestSuccessScore<10                                 THEN (100-a.RequestSuccessScore/10*40)                                 WHEN a.RequestSuccessScore>=10                                 AND a.RequestSuccessScore<20                                 THEN (60-(a.RequestSuccessScore-10)/10*60)                                 WHEN a.RequestSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS httpscore,                     ROUND( (                             CASE                                 WHEN a.ruofugairate IS NOT NULL                                 THEN a.ruofugairate                                 ELSE 1                             END)*100,2.0) ruofugairate,                     ROUND((                             CASE                                 WHEN a.RuoFugaiScore<0                                 THEN 100                                 WHEN a.RuoFugaiScore>=0                                 AND a.RuoFugaiScore<10                                 THEN (100-a.RuoFugaiScore/10*40)                                 WHEN a.RuoFugaiScore>=10                                 AND a.RuoFugaiScore<20                                 THEN (60-(a.RuoFugaiScore-10)/10*60)                                 WHEN a.RuoFugaiScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0)AS ruofugaiscore,                     ROUND((                             CASE                                 WHEN a.downdelayrate IS NOT NULL                                 THEN a.downdelayrate                                 ELSE 0                             END ),2.0) downdelayrate ,                     ROUND((                             CASE                                 WHEN a.DLAvgDelayScore<0                                 THEN 100                                 WHEN a.DLAvgDelayScore>=0                                 AND a.DLAvgDelayScore<1000                                 THEN (100-a.DLAvgDelayScore/1000*40)                                 WHEN a.DLAvgDelayScore>=1000                                 AND a.DLAvgDelayScore<2000                                 THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                 WHEN a.DLAvgDelayScore>=2000                                 THEN 0                                 ELSE 0                             END ),2.0) AS downdelaycore,                     ROUND((                             CASE                                 WHEN a.delay23G IS NOT NULL                                 THEN a.delay23G                                 ELSE 0                             END )*100,2.0) delay23G,                     ROUND((                             CASE                                 WHEN a.Delay23GScore<0                                 THEN 100                                 WHEN a.Delay23GScore>=0                                 AND a.Delay23GScore<10                                 THEN (100-a.Delay23GScore/10*40)                                 WHEN a.Delay23GScore>=10                                 AND a.Delay23GScore<20                                 THEN (60-(a.Delay23GScore-10)/10*60)                                 WHEN a.Delay23GScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS delay23gcore                 FROM                     (                         SELECT                             a.tac,                             d.factory,                             d.mobiletype,                             d.mobilecategory,                             d.dldata,                             d.usernumber,                             d.SessionRequest,                             a.downdelayrate,                             (b.alldowndelayrate-a.downdelayrate) AS dlavgdelayscore,                             a.ruofugairate,                             (a.ruofugairate-b.allruouugairate)*100 AS ruofugaiscore,                             a.delay23G,                             (a.delay23G-b.alldelay23g)*100 AS delay23gscore,                             a.attachsusscesrate,                             (b.allattachsusscesrate-a.attachsusscesrate)*100 AS attachsuccessscore,                             a.httprequestrate,                             (b.allhttpsuccessrate-a.httprequestrate)*100 AS requestsuccessscore                         FROM                             (                                 SELECT                                     c.tac,                                     (                                         CASE                                             WHEN SUM(Businesshours)>0                                             THEN SUM(DLData)*8*1000/SUM(Businesshours)/1024                                         END) AS downdelayrate,                                     (                                         CASE                                             WHEN SUM(MRcount)>0                                             THEN SUM(WEAKMRCount)/SUM(MRcount)                                             ELSE 0                                         END) AS ruofugairate,                                     (                                         CASE                                             WHEN (SUM(GNBusinesshours)+SUM(Businesshours))>0                                             THEN SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM                                                 (Businesshours))                                         END) AS delay23G,                                     (                                         CASE                                             WHEN SUM(AttachRequest)>0                                             THEN SUM(AttachSuccess)/SUM(AttachRequest)                                             ELSE 1                                         END) AS attachsusscesrate,                                     (                                         CASE                                             WHEN SUM(SessionRequest)>0                                             THEN SUM(SessionSuccess)/SUM(SessionRequest)                                         END) AS httprequestrate                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0                                 GROUP BY                                     c.tac )a,                             (                                 SELECT                                     SUM(AttachSuccess)/SUM(AttachRequest)   AS allattachsusscesrate,                                     SUM(SessionSuccess)/SUM(SessionRequest)   AS allhttpsuccessrate,                                     SUM(DLData)*8*1000/SUM(Businesshours)/1024 AS alldowndelayrate,                                     SUM(WEAKMRCount)/SUM(MRcount)              AS allruouugairate,                                     SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM(Businesshours))                                     AS alldelay23g                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0 )b,                             (                                 SELECT                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     CASE                                         WHEN base.NETTYPE IN ('LTE-数据卡',                                                               'TD上网卡')                                         THEN '数据卡'                                         WHEN base.nettype IN ('TD手机',                                                               'LTE PHONE',                                                               '非定制机',                                                               '联通定制机')                                         THEN 'LTE手机'                                         ELSE base.nettype                                     END                   AS mobilecategory,                                     SUM(t.dldata)            dldata,                                     SUM(t.usernumber)        usernumber,                                     SUM(t.SessionRequest)    SessionRequest                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC t,                                     lte_sys.T_Base_Terminal_D base                                 WHERE                                     TO_CHAR(t.tac)=base.IMEI                                 AND t.starttime>=TIMESTAMP'[@c1]'                                 AND t.starttime<=TIMESTAMP'[@c2]'                                 AND t.dldata>0                                 GROUP BY                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     base.NETTYPE) d                         WHERE                             a.tac=d.tac)a )t     ) SELECT     factory,     mobiletype,     taccount,     ROUND(tacrate,2.0)  tacrate,     ROUND(flow,2)       flow,     ROUND(flowrate,2.0) flowrate,     id FROM     (         SELECT             *         FROM             (                 SELECT                     a.factory,                     a.mobiletype,                     a.taccount,                     a.taccount/SUM(a.taccount) over() tacrate,                     a.flow/1024                       flow,                     a.flow/SUM(a.flow) over()         flowrate,                     1                                 id                 FROM                     (                         SELECT                             factory,                             mobiletype,                             SUM(taccount)  taccount,                             SUM(totaldata) flow                         FROM                             tmp                         WHERE                             (                                 [@s0]) [@and] [@s1] [@and] [@c5]                         GROUP BY                             factory,                             mobiletype)a                 ORDER BY                     ([@c4]) DESC offset 0 limit 10 )a         UNION         SELECT             '其他'            factory,             '其他'            mobiletype,             SUM(t.taccount) taccount,             SUM(t.tacrate)  tacrate,             SUM(t.flow)     flow,             SUM(t.flowrate) flowrate ,             2               id         FROM             (                 SELECT                     a.factory,                     a.taccount,                     a.taccount/SUM(a.taccount) over() tacrate,                     a.flow/1024                       flow,                     a.flow/SUM(a.flow) over()         flowrate                 FROM                     (                         SELECT                             factory,                             mobiletype,                             SUM(taccount)  taccount,                             SUM(totaldata) flow                         FROM                            tmp                         WHERE                             (                                 [@s0]) [@and] [@s1] [@and] [@c5]                         GROUP BY                             factory,                             mobiletype)a                 ORDER BY                     ([@c4]) DESC offset 10 )t )m ORDER BY     m.id"
      }
    },
    {
      "key": "query_tac_rightchar_1",
      "desc": "雷达图",
      "config": {
        "parameters": [
          {
            "name": "poor",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s1",
            "symbol": ""
          },
          {
            "name": "mobiletype",
            "columnname": "mobiletype",
            "type": "string",
            "format": "",
            "conditionid": "c1",
            "symbol": "="
          },
          {
            "name": "mobilecategory",
            "columnname": "mobilecategory",
            "type": "string",
            "format": "",
            "conditionid": "c0",
            "symbol": "="
          },
          {
            "name": "factory",
            "columnname": "factory",
            "type": "string",
            "format": "",
            "conditionid": "c2",
            "symbol": "="
          },
          {
            "name": "p_en",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c3",
            "symbol": ""
          }
        ],
        "value": "select * from (select factory,mobiletype,round(sum(allscore)/count(0),4.0) as allscore,round(sum(attachscore)/count(0),4.0) as attachscore,round(sum(httpscore)/count(0),4.0) as httpscore,round(sum(ruofugaiscore)/count(0),4.0) as  ruofugaiscore,round(sum(downdelaycore)/count(0),4.0) as downdelaycore, round(sum(delay23gcore)/count(0),4.0) as delay23gcore from lte_sys.[@c3]_T_END_TO_END_ANALYSIS_TAC_PoorQuality where  factory=(select a.factory  from (select factory, count(*) count2 from lte_sys.[@c3]_T_END_TO_END_ANALYSIS_TAC_PoorQuality t where   ([@c0]) [@and] [@c2] [@and] [@s1]   group by factory  order by count2 desc limit 1)a)  [@and] [@s1]      group by factory,mobiletype )a order by a.allscore "
      }
    },
    {
      "key": "query_tac_rightchar_1_p_en",
      "desc": "雷达图",
      "config": {
        "parameters": [
          {
            "name": "poor",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s1",
            "symbol": ""
          },
          {
            "name": "mobiletype",
            "columnname": "mobiletype",
            "type": "string",
            "format": "",
            "conditionid": "c1",
            "symbol": "="
          },
          {
            "name": "mobilecategory",
            "columnname": "mobilecategory",
            "type": "string",
            "format": "",
            "conditionid": "c0",
            "symbol": "="
          },
          {
            "name": "factory",
            "columnname": "factory",
            "type": "string",
            "format": "",
            "conditionid": "c2",
            "symbol": "="
          },
          {
            "name": "p_en",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c3",
            "symbol": ""
          },
          {
            "name": "starttime",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c4",
            "symbol": ""
          },
          {
            "name": "endtime",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c5",
            "symbol": ""
          },
          {
            "name": "province",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c6",
            "symbol": ""
          },
          {
            "name": "tac_Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          }
        ],
        "value": "WITH     tmp AS     (         SELECT             t.tac,             t.factory,             t.mobiletype,             t.mobilecategory,             t.usernumber AS taccount,             t.dldata     AS totaldata,             t.sessionrequest,             t.allscore,             t.attachsusscesrate,             t.attachscore,             t.httprequestrate,             t.httpscore,             t.ruofugairate,             t.ruofugaiscore,             0,             0,             t.downdelayrate,             t.downdelaycore,             t.delay23G,             t.delay23gcore         FROM             (                 SELECT                     a.tac,                     a.Factory,                     a.MobileType,                     a.MobileCategory,                     a.usernumber,                     a.dldata,                     a.SessionRequest,                     ROUND( ( ((                                     CASE                                         WHEN a.AttachSuccessScore<0                                         THEN 100                                         WHEN a.AttachSuccessScore>=0                                         AND a.AttachSuccessScore<10                                         THEN (100-a.AttachSuccessScore/10*40)                                         WHEN a.AttachSuccessScore>=10                                         AND a.AttachSuccessScore<20                                         THEN (60-(a.AttachSuccessScore-10)/10*60)                                         WHEN a.AttachSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t5])+ ((                                     CASE                                         WHEN a.RequestSuccessScore<0                                         THEN 100                                         WHEN a.RequestSuccessScore>=0                                         AND a.RequestSuccessScore<10                                         THEN (100-a.RequestSuccessScore/10*40)                                         WHEN a.RequestSuccessScore>=10                                         AND a.RequestSuccessScore<20                                         THEN (60-(a.RequestSuccessScore-10)/10*60)                                         WHEN a.RequestSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t6])+ ((                                     CASE                                         WHEN a.RuoFugaiScore<0                                         THEN 100                                         WHEN a.RuoFugaiScore>=0                                         AND a.RuoFugaiScore<10                                         THEN (100-a.RuoFugaiScore/10*40)                                         WHEN a.RuoFugaiScore>=10                                         AND a.RuoFugaiScore<20                                         THEN (60-(a.RuoFugaiScore-10)/10*60)                                         WHEN a.RuoFugaiScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t2])+ ((                                     CASE                                         WHEN a.DLAvgDelayScore<0                                         THEN 100                                         WHEN a.DLAvgDelayScore>=0                                         AND a.DLAvgDelayScore<1000                                         THEN (100-a.DLAvgDelayScore/1000*40)                                         WHEN a.DLAvgDelayScore>=1000                                         AND a.DLAvgDelayScore<2000                                         THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                         WHEN a.DLAvgDelayScore>=2000                                         THEN 0                                         ELSE 0                                     END )*[@t1])+ ((                                     CASE                                         WHEN a.Delay23GScore<0                                         THEN 100                                         WHEN a.Delay23GScore>=0                                         AND a.Delay23GScore<10                                         THEN (100-a.Delay23GScore/10*40)                                         WHEN a.Delay23GScore>=10                                         AND a.Delay23GScore<20                                         THEN (60-(a.Delay23GScore-10)/10*60)                                         WHEN a.Delay23GScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t3])),2.0) AS allscore,                     ROUND((                             CASE                                 WHEN a.attachsusscesrate IS NULL                                 THEN 1                                 ELSE a.attachsusscesrate                             END)*100 ,2.0) attachsusscesrate,                     ROUND((                             CASE                                 WHEN a.AttachSuccessScore<0                                 THEN 100                                 WHEN a.AttachSuccessScore>=0                                 AND a.AttachSuccessScore<10                                 THEN (100-a.AttachSuccessScore/10*40)                                 WHEN a.AttachSuccessScore>=10                                 AND a.AttachSuccessScore<20                                 THEN (60-(a.AttachSuccessScore-10)/10*60)                                 WHEN a.AttachSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS attachscore,                     ROUND((                             CASE                                 WHEN a.httprequestrate IS NOT NULL                                 THEN a.httprequestrate                                 ELSE 0                             END)*100,2.0) httprequestrate,                     ROUND((                             CASE                                 WHEN a.RequestSuccessScore<0                                 THEN 100                                 WHEN a.RequestSuccessScore>=0                                 AND a.RequestSuccessScore<10                                 THEN (100-a.RequestSuccessScore/10*40)                                 WHEN a.RequestSuccessScore>=10                                 AND a.RequestSuccessScore<20                                 THEN (60-(a.RequestSuccessScore-10)/10*60)                                 WHEN a.RequestSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS httpscore,                     ROUND( (                             CASE                                 WHEN a.ruofugairate IS NOT NULL                                 THEN a.ruofugairate                                 ELSE 1                             END)*100,2.0) ruofugairate,                     ROUND((                             CASE                                 WHEN a.RuoFugaiScore<0                                 THEN 100                                 WHEN a.RuoFugaiScore>=0                                 AND a.RuoFugaiScore<10                                 THEN (100-a.RuoFugaiScore/10*40)                                 WHEN a.RuoFugaiScore>=10                                 AND a.RuoFugaiScore<20                                 THEN (60-(a.RuoFugaiScore-10)/10*60)                                 WHEN a.RuoFugaiScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0)AS ruofugaiscore,                     ROUND((                             CASE                                 WHEN a.downdelayrate IS NOT NULL                                 THEN a.downdelayrate                                 ELSE 0                             END ),2.0) downdelayrate ,                     ROUND((                             CASE                                 WHEN a.DLAvgDelayScore<0                                 THEN 100                                 WHEN a.DLAvgDelayScore>=0                                 AND a.DLAvgDelayScore<1000                                 THEN (100-a.DLAvgDelayScore/1000*40)                                 WHEN a.DLAvgDelayScore>=1000                                 AND a.DLAvgDelayScore<2000                                 THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                 WHEN a.DLAvgDelayScore>=2000                                 THEN 0                                 ELSE 0                             END ),2.0) AS downdelaycore,                     ROUND((                             CASE                                 WHEN a.delay23G IS NOT NULL                                 THEN a.delay23G                                 ELSE 0                             END )*100,2.0) delay23G,                     ROUND((                             CASE                                 WHEN a.Delay23GScore<0                                 THEN 100                                 WHEN a.Delay23GScore>=0                                 AND a.Delay23GScore<10                                 THEN (100-a.Delay23GScore/10*40)                                 WHEN a.Delay23GScore>=10                                 AND a.Delay23GScore<20                                 THEN (60-(a.Delay23GScore-10)/10*60)                                 WHEN a.Delay23GScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS delay23gcore                 FROM                     (                         SELECT                             a.tac,                             d.factory,                             d.mobiletype,                             d.mobilecategory,                             d.dldata,                             d.usernumber,                             d.SessionRequest,                             a.downdelayrate,                             (b.alldowndelayrate-a.downdelayrate) AS dlavgdelayscore,                             a.ruofugairate,                             (a.ruofugairate-b.allruouugairate)*100 AS ruofugaiscore,                             a.delay23G,                             (a.delay23G-b.alldelay23g)*100 AS delay23gscore,                             a.attachsusscesrate,                             (b.allattachsusscesrate-a.attachsusscesrate)*100 AS attachsuccessscore,                             a.httprequestrate,                             (b.allhttpsuccessrate-a.httprequestrate)*100 AS requestsuccessscore                         FROM                             (                                 SELECT                                     c.tac,                                     (                                         CASE                                             WHEN SUM(Businesshours)>0                                             THEN SUM(DLData)*8*1000/SUM(Businesshours)/1024                                         END) AS downdelayrate,                                     (                                         CASE                                             WHEN SUM(MRcount)>0                                             THEN SUM(WEAKMRCount)/SUM(MRcount)                                             ELSE 0                                         END) AS ruofugairate,                                     (                                         CASE                                             WHEN (SUM(GNBusinesshours)+SUM(Businesshours))>0                                             THEN SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM                                                 (Businesshours))                                         END) AS delay23G,                                     (                                         CASE                                             WHEN SUM(AttachRequest)>0                                             THEN SUM(AttachSuccess)/SUM(AttachRequest)                                             ELSE 1                                         END) AS attachsusscesrate,                                     (                                         CASE                                             WHEN SUM(SessionRequest)>0                                             THEN SUM(SessionSuccess)/SUM(SessionRequest)                                         END) AS httprequestrate                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0                                 GROUP BY                                     c.tac )a,                             (                                 SELECT                                     SUM(AttachSuccess)/SUM(AttachRequest)   AS allattachsusscesrate,                                     SUM(SessionSuccess)/SUM(SessionRequest)   AS allhttpsuccessrate,                                     SUM(DLData)*8*1000/SUM(Businesshours)/1024 AS alldowndelayrate,                                     SUM(WEAKMRCount)/SUM(MRcount)              AS allruouugairate,                                     SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM(Businesshours))                                     AS alldelay23g                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0 )b,                             (                                 SELECT                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     CASE                                         WHEN base.NETTYPE IN ('LTE-数据卡',                                                               'TD上网卡')                                         THEN '数据卡'                                         WHEN base.nettype IN ('TD手机',                                                               'LTE PHONE',                                                               '非定制机',                                                               '联通定制机')                                         THEN 'LTE手机'                                         ELSE base.nettype                                     END                   AS mobilecategory,                                     SUM(t.dldata)            dldata,                                     SUM(t.usernumber)        usernumber,                                     SUM(t.SessionRequest)    SessionRequest                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC t,                                     lte_sys.T_Base_Terminal_D base                                 WHERE                                     TO_CHAR(t.tac)=base.IMEI                                 AND t.starttime>=TIMESTAMP'[@c1]'                                 AND t.starttime<=TIMESTAMP'[@c2]'                                 AND t.dldata>0                                 GROUP BY                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     base.NETTYPE) d                         WHERE                             a.tac=d.tac)a )t     ) SELECT     * FROM     (         SELECT             tmp.factory,             tmp.                                     mobiletype,             ROUND(SUM(tmp.allscore)/COUNT(0),4.0)      AS allscore,             ROUND(SUM(tmp.attachscore)/COUNT(0),4.0)   AS attachscore,             ROUND(SUM(tmp.httpscore)/COUNT(0),4.0)     AS httpscore,             ROUND(SUM(tmp.ruofugaiscore)/COUNT(0),4.0) AS ruofugaiscore,                         ROUND(SUM(tmp.downdelaycore)/COUNT(0),4.0) AS downdelaycore,             ROUND(SUM(tmp.delay23gcore)/COUNT(0),4.0)  AS delay23gcore         FROM             tmp         WHERE          tmp.factory=             (                 SELECT                     a.factory                 FROM                     (                         SELECT                             tmp.factory,                             COUNT(*) count2                         FROM                             tmp                         WHERE       (                                 tmp.[@c0])                         AND tmp.[@c2]        [@and] [@s1]                 GROUP BY                             tmp.factory                         ORDER BY                             count2 DESC limit 1)a)  [@and] [@s1]       GROUP BY             tmp.factory,             tmp.mobiletype )a ORDER BY     a.allscore"
      }
    },
    {
      "key": "query_tac_rightchar_2",
      "desc": "雷达图_某一终端平均评分",
      "config": {
        "parameters": [
          {
            "name": "poor",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s1",
            "symbol": ""
          },
          {
            "name": "mobiletype",
            "columnname": "mobiletype",
            "type": "string",
            "format": "",
            "conditionid": "c1",
            "symbol": "="
          },
          {
            "name": "mobilecategory",
            "columnname": "mobilecategory",
            "type": "string",
            "format": "",
            "conditionid": "c0",
            "symbol": "="
          },
          {
            "name": "factory",
            "columnname": "factory",
            "type": "string",
            "format": "",
            "conditionid": "c2",
            "symbol": "="
          },
          {
            "name": "p_en",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c3",
            "symbol": ""
          },
          {
            "name": "starttime",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c4",
            "symbol": ""
          },
          {
            "name": "endtime",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c5",
            "symbol": ""
          },
          {
            "name": "province",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c6",
            "symbol": ""
          }
        ],
        "value": "          SELECT             factory,                         ROUND(SUM(allscore)/COUNT(0),4.0)      AS allscore,             ROUND(SUM(attachscore)/COUNT(0),4.0)   AS attachscore,             ROUND(SUM(httpscore)/COUNT(0),4.0)     AS httpscore,             ROUND(SUM(ruofugaiscore)/COUNT(0),4.0) AS ruofugaiscore,                          ROUND(SUM(downdelaycore)/COUNT(0),4.0) AS downdelaycore,             ROUND(SUM(delay23gcore)/COUNT(0),4.0)  AS delay23gcore         FROM             lte_sys.[@c3]_T_END_TO_END_ANALYSIS_TAC_PoorQuality t where   ([@c2]) [@and] [@s1] group by factory       "
      }
    },
    {
      "key": "query_tac_rightchar_2_p_en",
      "desc": "雷达图_某一型号平均评分",
      "config": {
        "parameters": [
          {
            "name": "poor",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s1",
            "symbol": ""
          },
          {
            "name": "mobiletype",
            "columnname": "mobiletype",
            "type": "string",
            "format": "",
            "conditionid": "c1",
            "symbol": "="
          },
          {
            "name": "mobilecategory",
            "columnname": "mobilecategory",
            "type": "string",
            "format": "",
            "conditionid": "c0",
            "symbol": "="
          },
          {
            "name": "factory",
            "columnname": "factory",
            "type": "string",
            "format": "",
            "conditionid": "c2",
            "symbol": "="
          },
          {
            "name": "p_en",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c3",
            "symbol": ""
          },
          {
            "name": "starttime",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c4",
            "symbol": ""
          },
          {
            "name": "endtime",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c5",
            "symbol": ""
          },
          {
            "name": "province",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c6",
            "symbol": ""
          },
          {
            "name": "tac_Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          }
        ],
        "value": " WITH     tmp AS     (         SELECT             t.tac,             t.factory,             t.mobiletype,             t.mobilecategory,             t.usernumber AS taccount,             t.dldata     AS totaldata,             t.sessionrequest,             t.allscore,             t.attachsusscesrate,             t.attachscore,             t.httprequestrate,             t.httpscore,             t.ruofugairate,             t.ruofugaiscore,             0,             0,             t.downdelayrate,             t.downdelaycore,             t.delay23G,             t.delay23gcore         FROM             (                 SELECT                     a.tac,                     a.Factory,                     a.MobileType,                     a.MobileCategory,                     a.usernumber,                     a.dldata,                     a.SessionRequest,                     ROUND( ( ((                                     CASE                                         WHEN a.AttachSuccessScore<0                                         THEN 100                                         WHEN a.AttachSuccessScore>=0                                         AND a.AttachSuccessScore<10                                         THEN (100-a.AttachSuccessScore/10*40)                                         WHEN a.AttachSuccessScore>=10                                         AND a.AttachSuccessScore<20                                         THEN (60-(a.AttachSuccessScore-10)/10*60)                                         WHEN a.AttachSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t5])+ ((                                     CASE                                         WHEN a.RequestSuccessScore<0                                         THEN 100                                         WHEN a.RequestSuccessScore>=0                                         AND a.RequestSuccessScore<10                                         THEN (100-a.RequestSuccessScore/10*40)                                         WHEN a.RequestSuccessScore>=10                                         AND a.RequestSuccessScore<20                                         THEN (60-(a.RequestSuccessScore-10)/10*60)                                         WHEN a.RequestSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t6])+ ((                                     CASE                                         WHEN a.RuoFugaiScore<0                                         THEN 100                                         WHEN a.RuoFugaiScore>=0                                         AND a.RuoFugaiScore<10                                         THEN (100-a.RuoFugaiScore/10*40)                                         WHEN a.RuoFugaiScore>=10                                         AND a.RuoFugaiScore<20                                         THEN (60-(a.RuoFugaiScore-10)/10*60)                                         WHEN a.RuoFugaiScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t2])+ ((                                     CASE                                         WHEN a.DLAvgDelayScore<0                                         THEN 100                                         WHEN a.DLAvgDelayScore>=0                                         AND a.DLAvgDelayScore<1000                                         THEN (100-a.DLAvgDelayScore/1000*40)                                         WHEN a.DLAvgDelayScore>=1000                                         AND a.DLAvgDelayScore<2000                                         THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                         WHEN a.DLAvgDelayScore>=2000                                         THEN 0                                         ELSE 0                                     END )*[@t1])+ ((                                     CASE                                         WHEN a.Delay23GScore<0                                         THEN 100                                         WHEN a.Delay23GScore>=0                                         AND a.Delay23GScore<10                                         THEN (100-a.Delay23GScore/10*40)                                         WHEN a.Delay23GScore>=10                                         AND a.Delay23GScore<20                                         THEN (60-(a.Delay23GScore-10)/10*60)                                         WHEN a.Delay23GScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t3])),2.0) AS allscore,                     ROUND((                             CASE                                 WHEN a.attachsusscesrate IS NULL                                 THEN 1                                 ELSE a.attachsusscesrate                             END)*100 ,2.0) attachsusscesrate,                     ROUND((                             CASE                                 WHEN a.AttachSuccessScore<0                                 THEN 100                                 WHEN a.AttachSuccessScore>=0                                 AND a.AttachSuccessScore<10                                 THEN (100-a.AttachSuccessScore/10*40)                                 WHEN a.AttachSuccessScore>=10                                 AND a.AttachSuccessScore<20                                 THEN (60-(a.AttachSuccessScore-10)/10*60)                                 WHEN a.AttachSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS attachscore,                     ROUND((                             CASE                                 WHEN a.httprequestrate IS NOT NULL                                 THEN a.httprequestrate                                 ELSE 0                             END)*100,2.0) httprequestrate,                     ROUND((                             CASE                                 WHEN a.RequestSuccessScore<0                                 THEN 100                                 WHEN a.RequestSuccessScore>=0                                 AND a.RequestSuccessScore<10                                 THEN (100-a.RequestSuccessScore/10*40)                                 WHEN a.RequestSuccessScore>=10                                 AND a.RequestSuccessScore<20                                 THEN (60-(a.RequestSuccessScore-10)/10*60)                                 WHEN a.RequestSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS httpscore,                     ROUND( (                             CASE                                 WHEN a.ruofugairate IS NOT NULL                                 THEN a.ruofugairate                                 ELSE 1                             END)*100,2.0) ruofugairate,                     ROUND((                             CASE                                 WHEN a.RuoFugaiScore<0                                 THEN 100                                 WHEN a.RuoFugaiScore>=0                                 AND a.RuoFugaiScore<10                                 THEN (100-a.RuoFugaiScore/10*40)                                 WHEN a.RuoFugaiScore>=10                                 AND a.RuoFugaiScore<20                                 THEN (60-(a.RuoFugaiScore-10)/10*60)                                 WHEN a.RuoFugaiScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0)AS ruofugaiscore,                     ROUND((                             CASE                                 WHEN a.downdelayrate IS NOT NULL                                 THEN a.downdelayrate                                 ELSE 0                             END ),2.0) downdelayrate ,                     ROUND((                             CASE                                 WHEN a.DLAvgDelayScore<0                                 THEN 100                                 WHEN a.DLAvgDelayScore>=0                                 AND a.DLAvgDelayScore<1000                                 THEN (100-a.DLAvgDelayScore/1000*40)                                 WHEN a.DLAvgDelayScore>=1000                                 AND a.DLAvgDelayScore<2000                                 THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                 WHEN a.DLAvgDelayScore>=2000                                 THEN 0                                 ELSE 0                             END ),2.0) AS downdelaycore,                     ROUND((                             CASE                                 WHEN a.delay23G IS NOT NULL                                 THEN a.delay23G                                 ELSE 0                             END )*100,2.0) delay23G,                     ROUND((                             CASE                                 WHEN a.Delay23GScore<0                                 THEN 100                                 WHEN a.Delay23GScore>=0                                 AND a.Delay23GScore<10                                 THEN (100-a.Delay23GScore/10*40)                                 WHEN a.Delay23GScore>=10                                 AND a.Delay23GScore<20                                 THEN (60-(a.Delay23GScore-10)/10*60)                                 WHEN a.Delay23GScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS delay23gcore                 FROM                     (                         SELECT                             a.tac,                             d.factory,                             d.mobiletype,                             d.mobilecategory,                             d.dldata,                             d.usernumber,                             d.SessionRequest,                             a.downdelayrate,                             (b.alldowndelayrate-a.downdelayrate) AS dlavgdelayscore,                             a.ruofugairate,                             (a.ruofugairate-b.allruouugairate)*100 AS ruofugaiscore,                             a.delay23G,                             (a.delay23G-b.alldelay23g)*100 AS delay23gscore,                             a.attachsusscesrate,                             (b.allattachsusscesrate-a.attachsusscesrate)*100 AS attachsuccessscore,                             a.httprequestrate,                             (b.allhttpsuccessrate-a.httprequestrate)*100 AS requestsuccessscore                         FROM                             (                                 SELECT                                     c.tac,                                     (                                         CASE                                             WHEN SUM(Businesshours)>0                                             THEN SUM(DLData)*8*1000/SUM(Businesshours)/1024                                         END) AS downdelayrate,                                     (                                         CASE                                             WHEN SUM(MRcount)>0                                             THEN SUM(WEAKMRCount)/SUM(MRcount)                                             ELSE 0                                         END) AS ruofugairate,                                     (                                         CASE                                             WHEN (SUM(GNBusinesshours)+SUM(Businesshours))>0                                             THEN SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM                                                 (Businesshours))                                         END) AS delay23G,                                     (                                         CASE                                             WHEN SUM(AttachRequest)>0                                             THEN SUM(AttachSuccess)/SUM(AttachRequest)                                             ELSE 1                                         END) AS attachsusscesrate,                                     (                                         CASE                                             WHEN SUM(SessionRequest)>0                                             THEN SUM(SessionSuccess)/SUM(SessionRequest)                                         END) AS httprequestrate                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0                                 GROUP BY                                     c.tac )a,                             (                                 SELECT                                     SUM(AttachSuccess)/SUM(AttachRequest)   AS allattachsusscesrate,                                     SUM(SessionSuccess)/SUM(SessionRequest)   AS allhttpsuccessrate,                                     SUM(DLData)*8*1000/SUM(Businesshours)/1024 AS alldowndelayrate,                                     SUM(WEAKMRCount)/SUM(MRcount)              AS allruouugairate,                                     SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM(Businesshours))                                     AS alldelay23g                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0 )b,                             (                                 SELECT                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     CASE                                         WHEN base.NETTYPE IN ('LTE-数据卡',                                                               'TD上网卡')                                         THEN '数据卡'                                         WHEN base.nettype IN ('TD手机',                                                               'LTE PHONE',                                                               '非定制机',                                                               '联通定制机')                                         THEN 'LTE手机'                                         ELSE base.nettype                                     END                   AS mobilecategory,                                     SUM(t.dldata)            dldata,                                     SUM(t.usernumber)        usernumber,                                     SUM(t.SessionRequest)    SessionRequest                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC t,                                     lte_sys.T_Base_Terminal_D base                                 WHERE                                     TO_CHAR(t.tac)=base.IMEI                                 AND t.starttime>=TIMESTAMP'[@c1]'                                 AND t.starttime<=TIMESTAMP'[@c2]'                                 AND t.dldata>0                                 GROUP BY                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     base.NETTYPE) d                         WHERE                             a.tac=d.tac)a )t     ) SELECT     a.factory,     a.mobiletype,     a.allscore,     ROUND((a.allscore/SUM(a.allscore) over())*100,4.0) AS categoryavg,     a.attachscore,     a.httpscore,     a.ruofugaiscore,         a.downdelaycore,     a.delay23gcore FROM     (         SELECT             tmp.factory,             tmp.                                     mobiletype,             ROUND(SUM(tmp.allscore)/COUNT(0),4.0)      AS allscore,             ROUND(SUM(tmp.attachscore)/COUNT(0),4.0)   AS attachscore,             ROUND(SUM(tmp.httpscore)/COUNT(0),4.0)     AS httpscore,             ROUND(SUM(tmp.ruofugaiscore)/COUNT(0),4.0) AS ruofugaiscore,                         ROUND(SUM(tmp.downdelaycore)/COUNT(0),4.0) AS downdelaycore,             ROUND(SUM(tmp.delay23gcore)/COUNT(0),4.0)  AS delay23gcore         FROM             tmp         WHERE            tmp.factory=             (                 SELECT                     a.factory                 FROM                     (                         SELECT                             tmp.factory,                             COUNT(*) count2                         FROM                             tmp                         WHERE                     (                                 tmp.[@c0])                         AND tmp.[@c2]         [@and] [@s1]                GROUP BY                             tmp.factory                         ORDER BY                             count2 DESC limit 1)a)    [@and] [@s1]     GROUP BY             tmp.factory,             tmp.mobiletype )a  ORDER BY     a.allscore"
      }
    },
    {
      "key": "query_tac_rightchar_3",
      "desc": "雷达图_全网平均评分",
      "config": {
        "parameters": [
          {
            "name": "poor",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s1",
            "symbol": ""
          },
          {
            "name": "p_en",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c3",
            "symbol": ""
          },
          {
            "name": "starttime",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c4",
            "symbol": ""
          },
          {
            "name": "endtime",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c5",
            "symbol": ""
          },
          {
            "name": "province",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "c6",
            "symbol": ""
          }
        ],
        "value": "SELECT ROUND(SUM(allscore)/COUNT(0),4.0)      AS allscore,ROUND(SUM(attachscore)/COUNT(0),4.0)   AS attachscore,ROUND(SUM(httpscore)/COUNT(0),4.0)     AS httpscore,ROUND(SUM(ruofugaiscore)/COUNT(0),4.0) AS ruofugaiscore,ROUND(SUM(downdelaycore)/COUNT(0),4.0) AS downdelaycore,ROUND(SUM(delay23gcore)/COUNT(0),4.0)  AS delay23gcore FROM lte_sys.[@c3]_T_END_TO_END_ANALYSIS_TAC_PoorQuality t where 1=1 [@and] [@s1]"
      }
    },
    {
      "key": "query_tac_rightchar_3_p_en",
      "desc": "雷达图_按项目全网平均评分",
      "config": {
        "parameters": [
          {
            "name": "poor",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s1",
            "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": "c6",
            "symbol": ""
          },
          {
            "name": "tac_Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          }
        ],
        "value": "WITH     tmp AS     (         SELECT             t.tac,             t.factory,             t.mobiletype,             t.mobilecategory,             t.usernumber AS taccount,             t.dldata     AS totaldata,             t.sessionrequest,             t.allscore,             t.attachsusscesrate,             t.attachscore,             t.httprequestrate,             t.httpscore,             t.ruofugairate,             t.ruofugaiscore,             0,             0,             t.downdelayrate,             t.downdelaycore,             t.delay23G,             t.delay23gcore         FROM             (                 SELECT                     a.tac,                     a.Factory,                     a.MobileType,                     a.MobileCategory,                     a.usernumber,                     a.dldata,                     a.SessionRequest,                     ROUND( ( ((                                     CASE                                         WHEN a.AttachSuccessScore<0                                         THEN 100                                         WHEN a.AttachSuccessScore>=0                                         AND a.AttachSuccessScore<10                                         THEN (100-a.AttachSuccessScore/10*40)                                         WHEN a.AttachSuccessScore>=10                                         AND a.AttachSuccessScore<20                                         THEN (60-(a.AttachSuccessScore-10)/10*60)                                         WHEN a.AttachSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t5])+ ((                                     CASE                                         WHEN a.RequestSuccessScore<0                                         THEN 100                                         WHEN a.RequestSuccessScore>=0                                         AND a.RequestSuccessScore<10                                         THEN (100-a.RequestSuccessScore/10*40)                                         WHEN a.RequestSuccessScore>=10                                         AND a.RequestSuccessScore<20                                         THEN (60-(a.RequestSuccessScore-10)/10*60)                                         WHEN a.RequestSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t6])+ ((                                     CASE                                         WHEN a.RuoFugaiScore<0                                         THEN 100                                         WHEN a.RuoFugaiScore>=0                                         AND a.RuoFugaiScore<10                                         THEN (100-a.RuoFugaiScore/10*40)                                         WHEN a.RuoFugaiScore>=10                                         AND a.RuoFugaiScore<20                                         THEN (60-(a.RuoFugaiScore-10)/10*60)                                         WHEN a.RuoFugaiScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t2])+ ((                                     CASE                                         WHEN a.DLAvgDelayScore<0                                         THEN 100                                         WHEN a.DLAvgDelayScore>=0                                         AND a.DLAvgDelayScore<1000                                         THEN (100-a.DLAvgDelayScore/1000*40)                                         WHEN a.DLAvgDelayScore>=1000                                         AND a.DLAvgDelayScore<2000                                         THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                         WHEN a.DLAvgDelayScore>=2000                                         THEN 0                                         ELSE 0                                     END )*[@t1])+ ((                                     CASE                                         WHEN a.Delay23GScore<0                                         THEN 100                                         WHEN a.Delay23GScore>=0                                         AND a.Delay23GScore<10                                         THEN (100-a.Delay23GScore/10*40)                                         WHEN a.Delay23GScore>=10                                         AND a.Delay23GScore<20                                         THEN (60-(a.Delay23GScore-10)/10*60)                                         WHEN a.Delay23GScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t3])),2.0) AS allscore,                     ROUND((                             CASE                                 WHEN a.attachsusscesrate IS NULL                                 THEN 1                                 ELSE a.attachsusscesrate                             END)*100 ,2.0) attachsusscesrate,                     ROUND((                             CASE                                 WHEN a.AttachSuccessScore<0                                 THEN 100                                 WHEN a.AttachSuccessScore>=0                                 AND a.AttachSuccessScore<10                                 THEN (100-a.AttachSuccessScore/10*40)                                 WHEN a.AttachSuccessScore>=10                                 AND a.AttachSuccessScore<20                                 THEN (60-(a.AttachSuccessScore-10)/10*60)                                 WHEN a.AttachSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS attachscore,                     ROUND((                             CASE                                 WHEN a.httprequestrate IS NOT NULL                                 THEN a.httprequestrate                                 ELSE 0                             END)*100,2.0) httprequestrate,                     ROUND((                             CASE                                 WHEN a.RequestSuccessScore<0                                 THEN 100                                 WHEN a.RequestSuccessScore>=0                                 AND a.RequestSuccessScore<10                                 THEN (100-a.RequestSuccessScore/10*40)                                 WHEN a.RequestSuccessScore>=10                                 AND a.RequestSuccessScore<20                                 THEN (60-(a.RequestSuccessScore-10)/10*60)                                 WHEN a.RequestSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS httpscore,                     ROUND( (                             CASE                                 WHEN a.ruofugairate IS NOT NULL                                 THEN a.ruofugairate                                 ELSE 1                             END)*100,2.0) ruofugairate,                     ROUND((                             CASE                                 WHEN a.RuoFugaiScore<0                                 THEN 100                                 WHEN a.RuoFugaiScore>=0                                 AND a.RuoFugaiScore<10                                 THEN (100-a.RuoFugaiScore/10*40)                                 WHEN a.RuoFugaiScore>=10                                 AND a.RuoFugaiScore<20                                 THEN (60-(a.RuoFugaiScore-10)/10*60)                                 WHEN a.RuoFugaiScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0)AS ruofugaiscore,                     ROUND((                             CASE                                 WHEN a.downdelayrate IS NOT NULL                                 THEN a.downdelayrate                                 ELSE 0                             END ),2.0) downdelayrate ,                     ROUND((                             CASE                                 WHEN a.DLAvgDelayScore<0                                 THEN 100                                 WHEN a.DLAvgDelayScore>=0                                 AND a.DLAvgDelayScore<1000                                 THEN (100-a.DLAvgDelayScore/1000*40)                                 WHEN a.DLAvgDelayScore>=1000                                 AND a.DLAvgDelayScore<2000                                 THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                 WHEN a.DLAvgDelayScore>=2000                                 THEN 0                                 ELSE 0                             END ),2.0) AS downdelaycore,                     ROUND((                             CASE                                 WHEN a.delay23G IS NOT NULL                                 THEN a.delay23G                                 ELSE 0                             END )*100,2.0) delay23G,                     ROUND((                             CASE                                 WHEN a.Delay23GScore<0                                 THEN 100                                 WHEN a.Delay23GScore>=0                                 AND a.Delay23GScore<10                                 THEN (100-a.Delay23GScore/10*40)                                 WHEN a.Delay23GScore>=10                                 AND a.Delay23GScore<20                                 THEN (60-(a.Delay23GScore-10)/10*60)                                 WHEN a.Delay23GScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS delay23gcore                 FROM                     (                         SELECT                             a.tac,                             d.factory,                             d.mobiletype,                             d.mobilecategory,                             d.dldata,                             d.usernumber,                             d.SessionRequest,                             a.downdelayrate,                             (b.alldowndelayrate-a.downdelayrate) AS dlavgdelayscore,                             a.ruofugairate,                             (a.ruofugairate-b.allruouugairate)*100 AS ruofugaiscore,                             a.delay23G,                             (a.delay23G-b.alldelay23g)*100 AS delay23gscore,                             a.attachsusscesrate,                             (b.allattachsusscesrate-a.attachsusscesrate)*100 AS attachsuccessscore,                             a.httprequestrate,                             (b.allhttpsuccessrate-a.httprequestrate)*100 AS requestsuccessscore                         FROM                             (                                 SELECT                                     c.tac,                                     (                                         CASE                                             WHEN SUM(Businesshours)>0                                             THEN SUM(DLData)*8*1000/SUM(Businesshours)/1024                                         END) AS downdelayrate,                                     (                                         CASE                                             WHEN SUM(MRcount)>0                                             THEN SUM(WEAKMRCount)/SUM(MRcount)                                             ELSE 0                                         END) AS ruofugairate,                                     (                                         CASE                                             WHEN (SUM(GNBusinesshours)+SUM(Businesshours))>0                                             THEN SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM                                                 (Businesshours))                                         END) AS delay23G,                                     (                                         CASE                                             WHEN SUM(AttachRequest)>0                                             THEN SUM(AttachSuccess)/SUM(AttachRequest)                                             ELSE 1                                         END) AS attachsusscesrate,                                     (                                         CASE                                             WHEN SUM(SessionRequest)>0                                             THEN SUM(SessionSuccess)/SUM(SessionRequest)                                         END) AS httprequestrate                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0                                 GROUP BY                                     c.tac )a,                             (                                 SELECT                                     SUM(AttachSuccess)/SUM(AttachRequest)   AS allattachsusscesrate,                                     SUM(SessionSuccess)/SUM(SessionRequest)   AS allhttpsuccessrate,                                     SUM(DLData)*8*1000/SUM(Businesshours)/1024 AS alldowndelayrate,                                     SUM(WEAKMRCount)/SUM(MRcount)              AS allruouugairate,                                     SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM(Businesshours))                                     AS alldelay23g                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0 )b,                             (                                 SELECT                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     CASE                                         WHEN base.NETTYPE IN ('LTE-数据卡',                                                               'TD上网卡')                                         THEN '数据卡'                                         WHEN base.nettype IN ('TD手机',                                                               'LTE PHONE',                                                               '非定制机',                                                               '联通定制机')                                         THEN 'LTE手机'                                         ELSE base.nettype                                     END                   AS mobilecategory,                                     SUM(t.dldata)            dldata,                                     SUM(t.usernumber)        usernumber,                                     SUM(t.SessionRequest)    SessionRequest                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC t,                                     lte_sys.T_Base_Terminal_D base                                 WHERE                                     TO_CHAR(t.tac)=base.IMEI                                 AND t.starttime>=TIMESTAMP'[@c1]'                                 AND t.starttime<=TIMESTAMP'[@c2]'                                 AND t.dldata>0                                 GROUP BY                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     base.NETTYPE) d                         WHERE                             a.tac=d.tac)a )t     ) SELECT     ROUND(SUM(allscore)/COUNT(0),4.0)      AS allscore,     ROUND(SUM(attachscore)/COUNT(0),4.0)   AS attachscore,     ROUND(SUM(httpscore)/COUNT(0),4.0)     AS httpscore,     ROUND(SUM(ruofugaiscore)/COUNT(0),4.0) AS ruofugaiscore,         ROUND(SUM(downdelaycore)/COUNT(0),4.0) AS downdelaycore,     ROUND(SUM(delay23gcore)/COUNT(0),4.0)  AS delay23gcore FROM     tmp where 1=1 [@and] [@s1]"
      }
    },
    {
      "key": "query_tac_rightchar",
      "desc": "雷达图_按项目全网平均评分及单个品牌评分",
      "config": {
        "parameters": [
          {
            "name": "poor",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s1",
            "symbol": ""
          },
          {
            "name": "mobilecategory",
            "columnname": "mobilecategory",
            "type": "string",
            "format": "",
            "conditionid": "s2",
            "symbol": "="
          },
          {
            "name": "factory",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s3",
            "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": "c6",
            "symbol": ""
          }
        ],
        "value": "select * from ( SELECT '全网' factory,     ROUND(SUM(allscore)/COUNT(0),4.0)      AS allscore,     ROUND(SUM(attachscore)/COUNT(0),4.0)   AS attachscore,     ROUND(SUM(httpscore)/COUNT(0),4.0)     AS httpscore,     ROUND(SUM(ruofugaiscore)/COUNT(0),4.0) AS ruofugaiscore,     ROUND(SUM(downdelaycore)/COUNT(0),4.0) AS downdelaycore,     ROUND(SUM(delay23gcore)/COUNT(0),4.0)  AS delay23gcore,     1 id FROM     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC_PoorQuality t WHERE     1=1  [@and] [@s1]     union SELECT     *,2 id FROM     (         SELECT             factory,             ROUND(SUM(allscore)/COUNT(0),4.0)      AS allscore,             ROUND(SUM(attachscore)/COUNT(0),4.0)   AS attachscore,             ROUND(SUM(httpscore)/COUNT(0),4.0)     AS httpscore,             ROUND(SUM(ruofugaiscore)/COUNT(0),4.0) AS ruofugaiscore,             ROUND(SUM(downdelaycore)/COUNT(0),4.0) AS downdelaycore,             ROUND(SUM(delay23gcore)/COUNT(0),4.0)  AS delay23gcore         FROM             lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC_PoorQuality         WHERE             1=1 [@and] [@s2] [@and] [@s3] [@and] [@s1]                   GROUP BY             factory )a)t order by t.id "
      }
    },
    {
      "key": "query_tac_rightchar_p_en",
      "desc": "雷达图_按项目全网平均评分及单个品牌评分",
      "config": {
        "parameters": [
          {
            "name": "poor",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s1",
            "symbol": ""
          },
          {
            "name": "mobilecategory",
            "columnname": "mobilecategory",
            "type": "string",
            "format": "",
            "conditionid": "s2",
            "symbol": "="
          },
          {
            "name": "factory",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s3",
            "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": "c6",
            "symbol": ""
          },
          {
            "name": "tac_Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          }
        ],
        "value": "WITH     tmp AS     (         SELECT             t.tac,             t.factory,             t.mobiletype,             t.mobilecategory,             t.usernumber AS taccount,             t.dldata     AS totaldata,             t.sessionrequest,             t.allscore,             t.attachsusscesrate,             t.attachscore,             t.httprequestrate,             t.httpscore,             t.ruofugairate,             t.ruofugaiscore,             0,             0,             t.downdelayrate,             t.downdelaycore,             t.delay23G,             t.delay23gcore         FROM             (                 SELECT                     a.tac,                     a.Factory,                     a.MobileType,                     a.MobileCategory,                     a.usernumber,                     a.dldata,                     a.SessionRequest,                     ROUND( ( ((                                     CASE                                         WHEN a.AttachSuccessScore<0                                         THEN 100                                         WHEN a.AttachSuccessScore>=0                                         AND a.AttachSuccessScore<10                                         THEN (100-a.AttachSuccessScore/10*40)                                         WHEN a.AttachSuccessScore>=10                                         AND a.AttachSuccessScore<20                                         THEN (60-(a.AttachSuccessScore-10)/10*60)                                         WHEN a.AttachSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t5])+ ((                                     CASE                                         WHEN a.RequestSuccessScore<0                                         THEN 100                                         WHEN a.RequestSuccessScore>=0                                         AND a.RequestSuccessScore<10                                         THEN (100-a.RequestSuccessScore/10*40)                                         WHEN a.RequestSuccessScore>=10                                         AND a.RequestSuccessScore<20                                         THEN (60-(a.RequestSuccessScore-10)/10*60)                                         WHEN a.RequestSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t6])+ ((                                     CASE                                         WHEN a.RuoFugaiScore<0                                         THEN 100                                         WHEN a.RuoFugaiScore>=0                                         AND a.RuoFugaiScore<10                                         THEN (100-a.RuoFugaiScore/10*40)                                         WHEN a.RuoFugaiScore>=10                                         AND a.RuoFugaiScore<20                                         THEN (60-(a.RuoFugaiScore-10)/10*60)                                         WHEN a.RuoFugaiScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t2])+ ((                                     CASE                                         WHEN a.DLAvgDelayScore<0                                         THEN 100                                         WHEN a.DLAvgDelayScore>=0                                         AND a.DLAvgDelayScore<1000                                         THEN (100-a.DLAvgDelayScore/1000*40)                                         WHEN a.DLAvgDelayScore>=1000                                         AND a.DLAvgDelayScore<2000                                         THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                         WHEN a.DLAvgDelayScore>=2000                                         THEN 0                                         ELSE 0                                     END )*[@t1])+ ((                                     CASE                                         WHEN a.Delay23GScore<0                                         THEN 100                                         WHEN a.Delay23GScore>=0                                         AND a.Delay23GScore<10                                         THEN (100-a.Delay23GScore/10*40)                                         WHEN a.Delay23GScore>=10                                         AND a.Delay23GScore<20                                         THEN (60-(a.Delay23GScore-10)/10*60)                                         WHEN a.Delay23GScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t3])),2.0) AS allscore,                     ROUND((                             CASE                                 WHEN a.attachsusscesrate IS NULL                                 THEN 1                                 ELSE a.attachsusscesrate                             END)*100 ,2.0) attachsusscesrate,                     ROUND((                             CASE                                 WHEN a.AttachSuccessScore<0                                 THEN 100                                 WHEN a.AttachSuccessScore>=0                                 AND a.AttachSuccessScore<10                                 THEN (100-a.AttachSuccessScore/10*40)                                 WHEN a.AttachSuccessScore>=10                                 AND a.AttachSuccessScore<20                                 THEN (60-(a.AttachSuccessScore-10)/10*60)                                 WHEN a.AttachSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS attachscore,                     ROUND((                             CASE                                 WHEN a.httprequestrate IS NOT NULL                                 THEN a.httprequestrate                                 ELSE 0                             END)*100,2.0) httprequestrate,                     ROUND((                             CASE                                 WHEN a.RequestSuccessScore<0                                 THEN 100                                 WHEN a.RequestSuccessScore>=0                                 AND a.RequestSuccessScore<10                                 THEN (100-a.RequestSuccessScore/10*40)                                 WHEN a.RequestSuccessScore>=10                                 AND a.RequestSuccessScore<20                                 THEN (60-(a.RequestSuccessScore-10)/10*60)                                 WHEN a.RequestSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS httpscore,                     ROUND( (                             CASE                                 WHEN a.ruofugairate IS NOT NULL                                 THEN a.ruofugairate                                 ELSE 1                             END)*100,2.0) ruofugairate,                     ROUND((                             CASE                                 WHEN a.RuoFugaiScore<0                                 THEN 100                                 WHEN a.RuoFugaiScore>=0                                 AND a.RuoFugaiScore<10                                 THEN (100-a.RuoFugaiScore/10*40)                                 WHEN a.RuoFugaiScore>=10                                 AND a.RuoFugaiScore<20                                 THEN (60-(a.RuoFugaiScore-10)/10*60)                                 WHEN a.RuoFugaiScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0)AS ruofugaiscore,                     ROUND((                             CASE                                 WHEN a.downdelayrate IS NOT NULL                                 THEN a.downdelayrate                                 ELSE 0                             END ),2.0) downdelayrate ,                     ROUND((                             CASE                                 WHEN a.DLAvgDelayScore<0                                 THEN 100                                 WHEN a.DLAvgDelayScore>=0                                 AND a.DLAvgDelayScore<1000                                 THEN (100-a.DLAvgDelayScore/1000*40)                                 WHEN a.DLAvgDelayScore>=1000                                 AND a.DLAvgDelayScore<2000                                 THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                 WHEN a.DLAvgDelayScore>=2000                                 THEN 0                                 ELSE 0                             END ),2.0) AS downdelaycore,                     ROUND((                             CASE                                 WHEN a.delay23G IS NOT NULL                                 THEN a.delay23G                                 ELSE 0                             END )*100,2.0) delay23G,                     ROUND((                             CASE                                 WHEN a.Delay23GScore<0                                 THEN 100                                 WHEN a.Delay23GScore>=0                                 AND a.Delay23GScore<10                                 THEN (100-a.Delay23GScore/10*40)                                 WHEN a.Delay23GScore>=10                                 AND a.Delay23GScore<20                                 THEN (60-(a.Delay23GScore-10)/10*60)                                 WHEN a.Delay23GScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS delay23gcore                 FROM                     (                         SELECT                             a.tac,                             d.factory,                             d.mobiletype,                             d.mobilecategory,                             d.dldata,                             d.usernumber,                             d.SessionRequest,                             a.downdelayrate,                             (b.alldowndelayrate-a.downdelayrate) AS dlavgdelayscore,                             a.ruofugairate,                             (a.ruofugairate-b.allruouugairate)*100 AS ruofugaiscore,                             a.delay23G,                             (a.delay23G-b.alldelay23g)*100 AS delay23gscore,                             a.attachsusscesrate,                             (b.allattachsusscesrate-a.attachsusscesrate)*100 AS attachsuccessscore,                             a.httprequestrate,                             (b.allhttpsuccessrate-a.httprequestrate)*100 AS requestsuccessscore                         FROM                             (                                 SELECT                                     c.tac,                                     (                                         CASE                                             WHEN SUM(Businesshours)>0                                             THEN SUM(DLData)*8*1000/SUM(Businesshours)/1024                                         END) AS downdelayrate,                                     (                                         CASE                                             WHEN SUM(MRcount)>0                                             THEN SUM(WEAKMRCount)/SUM(MRcount)                                             ELSE 0                                         END) AS ruofugairate,                                     (                                         CASE                                             WHEN (SUM(GNBusinesshours)+SUM(Businesshours))>0                                             THEN SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM                                                 (Businesshours))                                         END) AS delay23G,                                     (                                         CASE                                             WHEN SUM(AttachRequest)>0                                             THEN SUM(AttachSuccess)/SUM(AttachRequest)                                             ELSE 1                                         END) AS attachsusscesrate,                                     (                                         CASE                                             WHEN SUM(SessionRequest)>0                                             THEN SUM(SessionSuccess)/SUM(SessionRequest)                                         END) AS httprequestrate                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0                                 GROUP BY                                     c.tac )a,                             (                                 SELECT                                     SUM(AttachSuccess)/SUM(AttachRequest)   AS allattachsusscesrate,                                     SUM(SessionSuccess)/SUM(SessionRequest)   AS allhttpsuccessrate,                                     SUM(DLData)*8*1000/SUM(Businesshours)/1024 AS alldowndelayrate,                                     SUM(WEAKMRCount)/SUM(MRcount)              AS allruouugairate,                                     SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM(Businesshours))                                     AS alldelay23g                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0 )b,                             (                                 SELECT                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     CASE                                         WHEN base.NETTYPE IN ('LTE-数据卡',                                                               'TD上网卡')                                         THEN '数据卡'                                         WHEN base.nettype IN ('TD手机',                                                               'LTE PHONE',                                                               '非定制机',                                                               '联通定制机')                                         THEN 'LTE手机'                                         ELSE base.nettype                                     END                   AS mobilecategory,                                     SUM(t.dldata)            dldata,                                     SUM(t.usernumber)        usernumber,                                     SUM(t.SessionRequest)    SessionRequest                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC t,                                     lte_sys.T_Base_Terminal_D base                                 WHERE                                     TO_CHAR(t.tac)=base.IMEI                                 AND t.starttime>=TIMESTAMP'[@c1]'                                 AND t.starttime<=TIMESTAMP'[@c2]'                                 AND t.dldata>0                                 GROUP BY                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     base.NETTYPE) d                         WHERE                             a.tac=d.tac)a )t     ) select * from ( SELECT '全网' factory,     ROUND(SUM(allscore)/COUNT(0),4.0)      AS allscore,     ROUND(SUM(attachscore)/COUNT(0),4.0)   AS attachscore,     ROUND(SUM(httpscore)/COUNT(0),4.0)     AS httpscore,     ROUND(SUM(ruofugaiscore)/COUNT(0),4.0) AS ruofugaiscore,     ROUND(SUM(downdelaycore)/COUNT(0),4.0) AS downdelaycore,     ROUND(SUM(delay23gcore)/COUNT(0),4.0)  AS delay23gcore,     1 id FROM     tmp t WHERE     1=1  [@and] [@s1]     union SELECT     *,2 id FROM     (         SELECT             factory,             ROUND(SUM(allscore)/COUNT(0),4.0)      AS allscore,             ROUND(SUM(attachscore)/COUNT(0),4.0)   AS attachscore,             ROUND(SUM(httpscore)/COUNT(0),4.0)     AS httpscore,             ROUND(SUM(ruofugaiscore)/COUNT(0),4.0) AS ruofugaiscore,             ROUND(SUM(downdelaycore)/COUNT(0),4.0) AS downdelaycore,             ROUND(SUM(delay23gcore)/COUNT(0),4.0)  AS delay23gcore         FROM              tmp         WHERE             1=1 [@and] [@s2] [@and] [@s3] [@and] [@s1]                   GROUP BY             factory )a)t order by t.id "
      }
    },
    {
      "key": "query_tac_rightchar_app",
      "desc": "雷达图_按项目全网平均评分及单个品牌评分",
      "config": {
        "parameters": [
          {
            "name": "poor",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s1",
            "symbol": ""
          },
          {
            "name": "mobilecategory",
            "columnname": "mobilecategory",
            "type": "string",
            "format": "",
            "conditionid": "s2",
            "symbol": "="
          },
          {
            "name": "factory",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s3",
            "symbol": ""
          },
          {
            "name": "mobiletype",
            "columnname": "mobiletype",
            "type": "string",
            "format": "",
            "conditionid": "s4",
            "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": "c6",
            "symbol": ""
          }
        ],
        "value": "SELECT     * FROM     (         SELECT            factory,                       ROUND(SUM(allscore)/COUNT(0),4.0)      AS allscore,             ROUND(SUM(attachscore)/COUNT(0),4.0)   AS attachscore,             ROUND(SUM(httpscore)/COUNT(0),4.0)     AS httpscore,             ROUND(SUM(ruofugaiscore)/COUNT(0),4.0) AS ruofugaiscore,             ROUND(SUM(downdelaycore)/COUNT(0),4.0) AS downdelaycore,             ROUND(SUM(delay23gcore)/COUNT(0),4.0)  AS delay23gcore,             1                                         id         FROM             lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC_PoorQuality t         WHERE             1=1 [@and] [@s3] [@and] [@s1] group by factory         UNION         SELECT             *,             2 id         FROM             (                 SELECT                     mobiletype,                     ROUND(SUM(allscore)/COUNT(0),4.0)      AS allscore,                     ROUND(SUM(attachscore)/COUNT(0),4.0)   AS attachscore,                     ROUND(SUM(httpscore)/COUNT(0),4.0)     AS httpscore,                     ROUND(SUM(ruofugaiscore)/COUNT(0),4.0) AS ruofugaiscore,                     ROUND(SUM(downdelaycore)/COUNT(0),4.0) AS downdelaycore,                     ROUND(SUM(delay23gcore)/COUNT(0),4.0)  AS delay23gcore                 FROM                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC_PoorQuality                 WHERE                     1=1  [@and] [@s2] [@and] [@s3] [@and] [@s1] [@and] [@s4]                 GROUP BY                     mobiletype )a)t ORDER BY     t.id"
      }
    },
    {
      "key": "query_tac_rightchar_app_p_en",
      "desc": "雷达图_按项目全网平均评分及单个品牌评分",
      "config": {
        "parameters": [
          {
            "name": "poor",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s1",
            "symbol": ""
          },
          {
            "name": "mobilecategory",
            "columnname": "mobilecategory",
            "type": "string",
            "format": "",
            "conditionid": "s2",
            "symbol": "="
          },
          {
            "name": "factory",
            "columnname": "",
            "type": "string",
            "format": "",
            "conditionid": "s3",
            "symbol": ""
          },
          {
            "name": "mobiletype",
            "columnname": "mobiletype",
            "type": "string",
            "format": "",
            "conditionid": "s4",
            "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": "c6",
            "symbol": ""
          },
          {
            "name": "tac_Threshold_data1",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t1",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data2",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t2",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data3",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t3",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data4",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t4",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data5",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t5",
            "symbol":""
          },
          {
            "name": "tac_Threshold_data6",
            "columnname": "",
            "type":"string",
            "format": "",
            "conditionid": "t6",
            "symbol":""
          }
        ],
        "value": "WITH     tmp AS     (         SELECT             t.tac,             t.factory,             t.mobiletype,             t.mobilecategory,             t.usernumber AS taccount,             t.dldata     AS totaldata,             t.sessionrequest,             t.allscore,             t.attachsusscesrate,             t.attachscore,             t.httprequestrate,             t.httpscore,             t.ruofugairate,             t.ruofugaiscore,             0,             0,             t.downdelayrate,             t.downdelaycore,             t.delay23G,             t.delay23gcore         FROM             (                 SELECT                     a.tac,                     a.Factory,                     a.MobileType,                     a.MobileCategory,                     a.usernumber,                     a.dldata,                     a.SessionRequest,                     ROUND( ( ((                                     CASE                                         WHEN a.AttachSuccessScore<0                                         THEN 100                                         WHEN a.AttachSuccessScore>=0                                         AND a.AttachSuccessScore<10                                         THEN (100-a.AttachSuccessScore/10*40)                                         WHEN a.AttachSuccessScore>=10                                         AND a.AttachSuccessScore<20                                         THEN (60-(a.AttachSuccessScore-10)/10*60)                                         WHEN a.AttachSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t5])+ ((                                     CASE                                         WHEN a.RequestSuccessScore<0                                         THEN 100                                         WHEN a.RequestSuccessScore>=0                                         AND a.RequestSuccessScore<10                                         THEN (100-a.RequestSuccessScore/10*40)                                         WHEN a.RequestSuccessScore>=10                                         AND a.RequestSuccessScore<20                                         THEN (60-(a.RequestSuccessScore-10)/10*60)                                         WHEN a.RequestSuccessScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t6])+ ((                                     CASE                                         WHEN a.RuoFugaiScore<0                                         THEN 100                                         WHEN a.RuoFugaiScore>=0                                         AND a.RuoFugaiScore<10                                         THEN (100-a.RuoFugaiScore/10*40)                                         WHEN a.RuoFugaiScore>=10                                         AND a.RuoFugaiScore<20                                         THEN (60-(a.RuoFugaiScore-10)/10*60)                                         WHEN a.RuoFugaiScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t2])+ ((                                     CASE                                         WHEN a.DLAvgDelayScore<0                                         THEN 100                                         WHEN a.DLAvgDelayScore>=0                                         AND a.DLAvgDelayScore<1000                                         THEN (100-a.DLAvgDelayScore/1000*40)                                         WHEN a.DLAvgDelayScore>=1000                                         AND a.DLAvgDelayScore<2000                                         THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                         WHEN a.DLAvgDelayScore>=2000                                         THEN 0                                         ELSE 0                                     END )*[@t1])+ ((                                     CASE                                         WHEN a.Delay23GScore<0                                         THEN 100                                         WHEN a.Delay23GScore>=0                                         AND a.Delay23GScore<10                                         THEN (100-a.Delay23GScore/10*40)                                         WHEN a.Delay23GScore>=10                                         AND a.Delay23GScore<20                                         THEN (60-(a.Delay23GScore-10)/10*60)                                         WHEN a.Delay23GScore>=20                                         THEN 0                                         ELSE 0                                     END )*[@t3])),2.0) AS allscore,                     ROUND((                             CASE                                 WHEN a.attachsusscesrate IS NULL                                 THEN 1                                 ELSE a.attachsusscesrate                             END)*100 ,2.0) attachsusscesrate,                     ROUND((                             CASE                                 WHEN a.AttachSuccessScore<0                                 THEN 100                                 WHEN a.AttachSuccessScore>=0                                 AND a.AttachSuccessScore<10                                 THEN (100-a.AttachSuccessScore/10*40)                                 WHEN a.AttachSuccessScore>=10                                 AND a.AttachSuccessScore<20                                 THEN (60-(a.AttachSuccessScore-10)/10*60)                                 WHEN a.AttachSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS attachscore,                     ROUND((                             CASE                                 WHEN a.httprequestrate IS NOT NULL                                 THEN a.httprequestrate                                 ELSE 0                             END)*100,2.0) httprequestrate,                     ROUND((                             CASE                                 WHEN a.RequestSuccessScore<0                                 THEN 100                                 WHEN a.RequestSuccessScore>=0                                 AND a.RequestSuccessScore<10                                 THEN (100-a.RequestSuccessScore/10*40)                                 WHEN a.RequestSuccessScore>=10                                 AND a.RequestSuccessScore<20                                 THEN (60-(a.RequestSuccessScore-10)/10*60)                                 WHEN a.RequestSuccessScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS httpscore,                     ROUND( (                             CASE                                 WHEN a.ruofugairate IS NOT NULL                                 THEN a.ruofugairate                                 ELSE 1                             END)*100,2.0) ruofugairate,                     ROUND((                             CASE                                 WHEN a.RuoFugaiScore<0                                 THEN 100                                 WHEN a.RuoFugaiScore>=0                                 AND a.RuoFugaiScore<10                                 THEN (100-a.RuoFugaiScore/10*40)                                 WHEN a.RuoFugaiScore>=10                                 AND a.RuoFugaiScore<20                                 THEN (60-(a.RuoFugaiScore-10)/10*60)                                 WHEN a.RuoFugaiScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0)AS ruofugaiscore,                     ROUND((                             CASE                                 WHEN a.downdelayrate IS NOT NULL                                 THEN a.downdelayrate                                 ELSE 0                             END ),2.0) downdelayrate ,                     ROUND((                             CASE                                 WHEN a.DLAvgDelayScore<0                                 THEN 100                                 WHEN a.DLAvgDelayScore>=0                                 AND a.DLAvgDelayScore<1000                                 THEN (100-a.DLAvgDelayScore/1000*40)                                 WHEN a.DLAvgDelayScore>=1000                                 AND a.DLAvgDelayScore<2000                                 THEN (60-(a.DLAvgDelayScore-1000)/1000*60)                                 WHEN a.DLAvgDelayScore>=2000                                 THEN 0                                 ELSE 0                             END ),2.0) AS downdelaycore,                     ROUND((                             CASE                                 WHEN a.delay23G IS NOT NULL                                 THEN a.delay23G                                 ELSE 0                             END )*100,2.0) delay23G,                     ROUND((                             CASE                                 WHEN a.Delay23GScore<0                                 THEN 100                                 WHEN a.Delay23GScore>=0                                 AND a.Delay23GScore<10                                 THEN (100-a.Delay23GScore/10*40)                                 WHEN a.Delay23GScore>=10                                 AND a.Delay23GScore<20                                 THEN (60-(a.Delay23GScore-10)/10*60)                                 WHEN a.Delay23GScore>=20                                 THEN 0                                 ELSE 0                             END ),2.0) AS delay23gcore                 FROM                     (                         SELECT                             a.tac,                             d.factory,                             d.mobiletype,                             d.mobilecategory,                             d.dldata,                             d.usernumber,                             d.SessionRequest,                             a.downdelayrate,                             (b.alldowndelayrate-a.downdelayrate) AS dlavgdelayscore,                             a.ruofugairate,                             (a.ruofugairate-b.allruouugairate)*100 AS ruofugaiscore,                             a.delay23G,                             (a.delay23G-b.alldelay23g)*100 AS delay23gscore,                             a.attachsusscesrate,                             (b.allattachsusscesrate-a.attachsusscesrate)*100 AS attachsuccessscore,                             a.httprequestrate,                             (b.allhttpsuccessrate-a.httprequestrate)*100 AS requestsuccessscore                         FROM                             (                                 SELECT                                     c.tac,                                     (                                         CASE                                             WHEN SUM(Businesshours)>0                                             THEN SUM(DLData)*8*1000/SUM(Businesshours)/1024                                         END) AS downdelayrate,                                     (                                         CASE                                             WHEN SUM(MRcount)>0                                             THEN SUM(WEAKMRCount)/SUM(MRcount)                                             ELSE 0                                         END) AS ruofugairate,                                     (                                         CASE                                             WHEN (SUM(GNBusinesshours)+SUM(Businesshours))>0                                             THEN SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM                                                 (Businesshours))                                         END) AS delay23G,                                     (                                         CASE                                             WHEN SUM(AttachRequest)>0                                             THEN SUM(AttachSuccess)/SUM(AttachRequest)                                             ELSE 1                                         END) AS attachsusscesrate,                                     (                                         CASE                                             WHEN SUM(SessionRequest)>0                                             THEN SUM(SessionSuccess)/SUM(SessionRequest)                                         END) AS httprequestrate                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0                                 GROUP BY                                     c.tac )a,                             (                                 SELECT                                     SUM(AttachSuccess)/SUM(AttachRequest)   AS allattachsusscesrate,                                     SUM(SessionSuccess)/SUM(SessionRequest)   AS allhttpsuccessrate,                                     SUM(DLData)*8*1000/SUM(Businesshours)/1024 AS alldowndelayrate,                                     SUM(WEAKMRCount)/SUM(MRcount)              AS allruouugairate,                                     SUM(GNBusinesshours)/(SUM(GNBusinesshours)+SUM(Businesshours))                                     AS alldelay23g                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC c                                 WHERE                                     c.starttime>=TIMESTAMP'[@c1]'                                 AND c.starttime<=TIMESTAMP'[@c2]'                                 AND c.dldata>0 )b,                             (                                 SELECT                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     CASE                                         WHEN base.NETTYPE IN ('LTE-数据卡',                                                               'TD上网卡')                                         THEN '数据卡'                                         WHEN base.nettype IN ('TD手机',                                                               'LTE PHONE',                                                               '非定制机',                                                               '联通定制机')                                         THEN 'LTE手机'                                         ELSE base.nettype                                     END                   AS mobilecategory,                                     SUM(t.dldata)            dldata,                                     SUM(t.usernumber)        usernumber,                                     SUM(t.SessionRequest)    SessionRequest                                 FROM                                     lte_sys.[@c0]_T_END_TO_END_ANALYSIS_TAC t,                                     lte_sys.T_Base_Terminal_D base                                 WHERE                                     TO_CHAR(t.tac)=base.IMEI                                 AND t.starttime>=TIMESTAMP'[@c1]'                                 AND t.starttime<=TIMESTAMP'[@c2]'                                 AND t.dldata>0                                 GROUP BY                                     t.tac,                                     base.Factory,                                     base.MobileType,                                     base.NETTYPE) d                         WHERE                             a.tac=d.tac)a )t     ) SELECT     * FROM     (         SELECT            factory,                       ROUND(SUM(allscore)/COUNT(0),4.0)      AS allscore,             ROUND(SUM(attachscore)/COUNT(0),4.0)   AS attachscore,             ROUND(SUM(httpscore)/COUNT(0),4.0)     AS httpscore,             ROUND(SUM(ruofugaiscore)/COUNT(0),4.0) AS ruofugaiscore,             ROUND(SUM(downdelaycore)/COUNT(0),4.0) AS downdelaycore,             ROUND(SUM(delay23gcore)/COUNT(0),4.0)  AS delay23gcore,             1                                         id         FROM             tmp t         WHERE             1=1 [@and] [@s3] [@and] [@s1]  group by factory         UNION         SELECT             *,             2 id         FROM             (                 SELECT                     mobiletype,                     ROUND(SUM(allscore)/COUNT(0),4.0)      AS allscore,                     ROUND(SUM(attachscore)/COUNT(0),4.0)   AS attachscore,                     ROUND(SUM(httpscore)/COUNT(0),4.0)     AS httpscore,                     ROUND(SUM(ruofugaiscore)/COUNT(0),4.0) AS ruofugaiscore,                     ROUND(SUM(downdelaycore)/COUNT(0),4.0) AS downdelaycore,                     ROUND(SUM(delay23gcore)/COUNT(0),4.0)  AS delay23gcore                 FROM                     tmp                 WHERE                     1=1  [@and] [@s2] [@and] [@s3] [@and] [@s1] [@and] [@s4]                 GROUP BY                     mobiletype )a)t ORDER BY     t.id "
      }
    }
  ]
}