|
|
@@ -1254,7 +1254,7 @@ namespace CallCenterApi.Interface.Controllers.Question
|
|
1254
|
1254
|
dr["buanquan"] = unsafenum;
|
|
1255
|
1255
|
//根据乡镇获取总数
|
|
1256
|
1256
|
int totalnum = 0;
|
|
1257
|
|
- object obj1 = DbHelperSQL.GetSingle("SELECT COUNT(*) from T_Call_OutAnswers where F_QID=101 and F_QIID=" + ItemID + "");
|
|
|
1257
|
+ object obj1 = DbHelperSQL.GetSingle("SELECT COUNT(*) from T_Call_OutAnswers where F_OptOn between '" + startdate + "' and '" + enddate + "' and F_QID=101 and F_QIID=" + ItemID + "");
|
|
1258
|
1258
|
if (obj1 != null && obj1.ToString() != "")
|
|
1259
|
1259
|
{
|
|
1260
|
1260
|
totalnum = Convert.ToInt32(obj1);
|
|
|
@@ -1375,6 +1375,90 @@ namespace CallCenterApi.Interface.Controllers.Question
|
|
1375
|
1375
|
}
|
|
1376
|
1376
|
#endregion
|
|
1377
|
1377
|
|
|
|
1378
|
+ #region 数据查询--获取不安全因素比例
|
|
|
1379
|
+ public ActionResult GetUnsafeRate()
|
|
|
1380
|
+ {
|
|
|
1381
|
+ DataTable dtnew = GetData();
|
|
|
1382
|
+
|
|
|
1383
|
+ return Success("获取不安全原因比例报表数据成功", dtnew);
|
|
|
1384
|
+ }
|
|
|
1385
|
+ public ActionResult GetUnsafeRateExpt()
|
|
|
1386
|
+ {
|
|
|
1387
|
+ DataTable dtnew = GetData();
|
|
|
1388
|
+ NPOIHelper npoi = new NPOIHelper();
|
|
|
1389
|
+ string[] col = { "不安全原因", "数量", "比例" };
|
|
|
1390
|
+ if (npoi.ExportToExcel("乡镇排名统计数据", dtnew, col) == "")
|
|
|
1391
|
+ {
|
|
|
1392
|
+ return Success("导出成功");
|
|
|
1393
|
+ }
|
|
|
1394
|
+ else
|
|
|
1395
|
+ {
|
|
|
1396
|
+ return Error("导出失败");
|
|
|
1397
|
+ }
|
|
|
1398
|
+ }
|
|
|
1399
|
+ private DataTable GetData()
|
|
|
1400
|
+ {
|
|
|
1401
|
+ string startdate = HttpUtility.UrlDecode(RequestString.GetQueryString("startdate")) + " 00:00:00";
|
|
|
1402
|
+ string enddate = HttpUtility.UrlDecode(RequestString.GetQueryString("enddate")) + " 23:59:59";
|
|
|
1403
|
+ if (HttpUtility.UrlDecode(RequestString.GetQueryString("startdate")) == null || HttpUtility.UrlDecode(RequestString.GetQueryString("startdate")) == "")
|
|
|
1404
|
+ {
|
|
|
1405
|
+ startdate = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00";
|
|
|
1406
|
+ }
|
|
|
1407
|
+ if (HttpUtility.UrlDecode(RequestString.GetQueryString("enddate")) == null || HttpUtility.UrlDecode(RequestString.GetQueryString("enddate")) == "")
|
|
|
1408
|
+ {
|
|
|
1409
|
+ enddate = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
|
|
|
1410
|
+ }
|
|
|
1411
|
+ DataTable dtnew = new DataTable();
|
|
|
1412
|
+ dtnew.Columns.Add("Reasons", Type.GetType("System.String"));
|
|
|
1413
|
+ dtnew.Columns.Add("Counts", Type.GetType("System.String"));
|
|
|
1414
|
+ dtnew.Columns.Add("Rates", Type.GetType("System.String"));
|
|
|
1415
|
+ int sumcount = 0;
|
|
|
1416
|
+ DataSet ds = DbHelperSQL.Query("SELECT * FROM T_Ask_QuestionItems where F_QuestionId='103'");
|
|
|
1417
|
+ DataSet dsc = DbHelperSQL.Query("select F_QIID,COUNT(*) c from T_Call_OutAnswers where F_OptOn between '" + startdate + "' and '" + enddate + "' and F_QID=103 group by F_QIID");
|
|
|
1418
|
+ if (ds != null && ds.Tables.Count > 0)
|
|
|
1419
|
+ {
|
|
|
1420
|
+ DataTable dt = ds.Tables[0];
|
|
|
1421
|
+ for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
1422
|
+ {
|
|
|
1423
|
+ DataRow dr = dtnew.NewRow();
|
|
|
1424
|
+ string content = dt.Rows[i]["F_ItemName"].ToString();
|
|
|
1425
|
+ string ItemID = dt.Rows[i]["F_ItemID"].ToString();
|
|
|
1426
|
+ dr["Reasons"] = content;
|
|
|
1427
|
+ int count = 0;
|
|
|
1428
|
+ if (dsc != null && dsc.Tables.Count > 0)
|
|
|
1429
|
+ {
|
|
|
1430
|
+ DataTable dtc = dsc.Tables[0];
|
|
|
1431
|
+ for (int j = 0; j < dtc.Rows.Count; j++)
|
|
|
1432
|
+ {
|
|
|
1433
|
+ if (dtc.Rows[j]["F_QIID"].ToString().Equals(dt.Rows[i]["F_ItemID"].ToString()))
|
|
|
1434
|
+ {
|
|
|
1435
|
+ count = int.Parse(dtc.Rows[j]["c"].ToString());
|
|
|
1436
|
+ sumcount += count;
|
|
|
1437
|
+ break;
|
|
|
1438
|
+ }
|
|
|
1439
|
+ }
|
|
|
1440
|
+ }
|
|
|
1441
|
+ dr["Counts"] = count;
|
|
|
1442
|
+ dr["Rates"] = 0;
|
|
|
1443
|
+
|
|
|
1444
|
+ dtnew.Rows.Add(dr);
|
|
|
1445
|
+ }
|
|
|
1446
|
+
|
|
|
1447
|
+ for (int z = 0; z < dtnew.Rows.Count; z++)
|
|
|
1448
|
+ {
|
|
|
1449
|
+ int count = 0;
|
|
|
1450
|
+ count = int.Parse(dtnew.Rows[z]["Counts"].ToString());
|
|
|
1451
|
+ if (sumcount > 0)
|
|
|
1452
|
+ {
|
|
|
1453
|
+ decimal perww = Math.Round(Convert.ToDecimal(Convert.ToDecimal(count) / sumcount * 100), 1);
|
|
|
1454
|
+ dtnew.Rows[z]["Rates"] = perww;
|
|
|
1455
|
+ }
|
|
|
1456
|
+ }
|
|
|
1457
|
+ }
|
|
|
1458
|
+ return dtnew;
|
|
|
1459
|
+ }
|
|
|
1460
|
+ #endregion
|
|
|
1461
|
+
|
|
1378
|
1462
|
#region 导出
|
|
1379
|
1463
|
#region 数据查询--获取排名
|
|
1380
|
1464
|
public ActionResult GetRankExpt()
|
|
|
@@ -1420,15 +1504,17 @@ namespace CallCenterApi.Interface.Controllers.Question
|
|
1420
|
1504
|
{
|
|
1421
|
1505
|
unsafenum = Convert.ToInt32(obj0);
|
|
1422
|
1506
|
}
|
|
|
1507
|
+ buanquanleiji += unsafenum;
|
|
1423
|
1508
|
dr["buanquan"] = unsafenum;
|
|
1424
|
1509
|
//根据乡镇获取总数
|
|
1425
|
1510
|
int totalnum = 0;
|
|
1426
|
|
- object obj1 = DbHelperSQL.GetSingle("SELECT COUNT(*) from T_Call_OutAnswers where F_QID=101 and F_QIID=" + ItemID + "");
|
|
|
1511
|
+ object obj1 = DbHelperSQL.GetSingle("SELECT COUNT(*) from T_Call_OutAnswers where F_OptOn between '" + startdate + "' and '" + enddate + "' and F_QID=101 and F_QIID=" + ItemID + "");
|
|
1427
|
1512
|
if (obj1 != null && obj1.ToString() != "")
|
|
1428
|
1513
|
{
|
|
1429
|
1514
|
totalnum = Convert.ToInt32(obj1);
|
|
1430
|
1515
|
}
|
|
1431
|
1516
|
dr["zongshu"] = totalnum;
|
|
|
1517
|
+ leiji += totalnum;
|
|
1432
|
1518
|
//计算比例
|
|
1433
|
1519
|
if (totalnum > 0)
|
|
1434
|
1520
|
{
|