1550076451 3 年之前
父節點
當前提交
4ff48f2c2a
共有 2 個文件被更改,包括 236 次插入0 次删除
  1. 234 0
      RMYY_CallCenter_Api/Controllers/InfoController.cs
  2. 2 0
      RMYY_CallCenter_Api/RMYY_CallCenter_Api.csproj

+ 234 - 0
RMYY_CallCenter_Api/Controllers/InfoController.cs

@@ -0,0 +1,234 @@
1
+using RMYY_CallCenter_Api.DB;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.Data;
5
+using System.Linq;
6
+using System.Web;
7
+using System.Web.Mvc;
8
+
9
+namespace RMYY_CallCenter_Api.Controllers
10
+{
11
+    [AllowAnonymous]
12
+    public class InfoController : BaseController 
13
+    {
14
+        /// <summary>
15
+        /// 获取当日顶部数据
16
+        /// </summary>
17
+        /// <returns></returns>
18
+        public ActionResult GetTopCountByNow()
19
+        {
20
+            var date = DateTime.Now;
21
+
22
+         
23
+            string sqlhw = "   select (select count(1) from T_Call_CallRecords " +
24
+                " where datediff(day , BeginTime  , getdate())= 0)as hwcount" +
25
+                " , COALESCE(SUM( case a.F_Type when 1000 then 1 else 0 end), 0)  zxcount" +
26
+                "  , COALESCE(sum(case a.F_Type when 2000 then 1 else 0 end), 0) gzcount" +
27
+                "  ,  COALESCE(sum(case a.F_Type when 3000 then 1 else 0 end), 0) zhcount" +
28
+                "  , COALESCE(sum(case a.F_Type when 4000 then 1 else 0 end), 0) clcount" +
29
+                "from T_Wo_CommonBase a   where datediff(day , F_CreateTIme  , getdate())= 0 and F_IsDelete = 0";
30
+            DataTable dthw = DbHelperSQL.Query(sqlhw).Tables[0];
31
+          
32
+
33
+            var obj = new
34
+            {
35
+                data = dthw
36
+            };
37
+            return Success("加载成功", obj);
38
+        }
39
+        /// <summary>
40
+        /// 获取当日话务量数据
41
+        /// </summary>
42
+        /// <returns></returns>
43
+        public ActionResult GetConversationByNow()
44
+        {
45
+            var date = DateTime.Now;
46
+
47
+
48
+            string sqlhw = " select COALESCE(SUM( case a.CallType when 0 then 1 else 0 end),0) hrcount," +
49
+                "   COALESCE(SUM( case a.CallType when 1 then 1 else 0 end), 0) hccount," +
50
+                "    (case count(1) when 0 then '100.00%' else (CONVERT(varchar(10), CONVERT(decimal(18, 2)," +
51
+                "    COALESCE(SUM( case a.CallState when 1 then 1 else 0 end), 0) / COUNT(1) * 100)) + '%') end ) onrate" +
52
+                "           from T_Call_CallRecords a WITH(NOLOCK)   where datediff(day , BeginTime  , getdate())= 0   ";
53
+            DataTable dthw = DbHelperSQL.Query(sqlhw).Tables[0];
54
+            var obj = new
55
+            {
56
+                data = dthw
57
+            };
58
+            return Success("加载成功", obj);
59
+        }
60
+
61
+
62
+        /// <summary>
63
+        /// 获取当日24小时呼入呼出
64
+        /// </summary>
65
+        /// <returns></returns>
66
+        public ActionResult GetConversation24ByNow()
67
+        {
68
+            var date = DateTime.Now;
69
+            var hr = date.Hour + 1;
70
+            int[] hours = Enumerable.Range(0, hr).ToArray<int>();
71
+            var obj = new
72
+            {
73
+                hours,
74
+                hrcount = new List<int[]>(),
75
+                hccount = new List<int[]>()
76
+            };
77
+            string sql = $" and   BeginTime>='{date.ToString("yyyy-MM-dd")} 00:00:00'  ";
78
+            string sqlhw = " select datepart(hh, BeginTime ) hour,SUM(case CallType when 0 then 1 else 0 end ) hrcount ,SUM(case CallType when 1 then 1 else 0 end ) hccount  from T_Call_CallRecords where  1=1" + sql + " group by datepart(hh, BeginTime) order by datepart(hh, BeginTime)";
79
+            DataTable dthw = DbHelperSQL.Query(sqlhw).Tables[0];
80
+
81
+            int[] hrl = new int[hours.Length]; int[] hcl = new int[hours.Length];
82
+            for (int i = 0; i < hours.Length; i++)
83
+            {
84
+                var drs = dthw.Select("hour='" + hours[i] + "'");
85
+                int hrr = 0; int hc = 0;
86
+                if (drs.Length > 0)
87
+                {
88
+                    hrr = (from DataRow dr in drs select dr.Field<int>("hrcount")).FirstOrDefault();
89
+                    hc = (from DataRow dr in drs select dr.Field<int>("hccount")).FirstOrDefault();
90
+                }
91
+                hrl[i] = hrr;
92
+                hcl[i] = hc;
93
+            }
94
+            obj.hrcount.Add(hrl);
95
+            obj.hccount.Add(hcl);
96
+
97
+            return Success("加载成功", obj);
98
+        }
99
+
100
+        /// <summary>
101
+        /// 获取当日24小时工单
102
+        /// </summary>
103
+        /// <returns></returns>
104
+        public ActionResult GetWorkorder24ByNow()
105
+        {
106
+            var date = DateTime.Now;
107
+            var hr = date.Hour + 1;
108
+            int[] hours = Enumerable.Range(0, hr).ToArray<int>();
109
+            var obj = new
110
+            {
111
+                hours,
112
+                count=new List<int[]>()
113
+            };
114
+            string sql = $" and   F_CreateTIme>='{date.ToString("yyyy-MM-dd")} 00:00:00'  ";
115
+            string sqlhw = " select datepart(hh, F_CreateTIme ) hour,count(1) count  from T_Wo_CommonBase where" +
116
+                "   1 = 1  " + sql+
117
+                "  group by datepart(hh, F_CreateTIme) order by datepart(hh, F_CreateTIme) ";
118
+            DataTable dthw = DbHelperSQL.Query(sqlhw).Tables[0];
119
+
120
+            int[] hrl = new int[hours.Length]; int[] hcl = new int[hours.Length];
121
+            for (int i = 0; i < hours.Length; i++)
122
+            {
123
+                var drs = dthw.Select("hour='" + hours[i] + "'");
124
+                int hrr = 0; 
125
+                if (drs.Length > 0)
126
+                {
127
+                    hrr = (from DataRow dr in drs select dr.Field<int>("count")).FirstOrDefault();
128
+                }
129
+                hrl[i] = hrr;
130
+            }
131
+            obj.count.Add(hrl);
132
+            return Success("加载成功", obj);
133
+        }
134
+
135
+        /// <summary>
136
+        /// 获取当日IVR满意度统计
137
+        /// </summary>
138
+        /// <returns></returns>
139
+        public ActionResult GetIVRSatisfactionByNow()
140
+        {
141
+            var date = DateTime.Now;
142
+          
143
+            string sqlhw = "    select COALESCE(SUM( case a.MYD when 0 then 1 else 0 end),0) satisfied, " +
144
+                "       COALESCE(SUM( case a.MYD when 1 then 1 else 0 end), 0) basatisfied," +
145
+                "   COALESCE(SUM( case a.MYD when 2 then 1 else 0 end), 0) nosatisfied" +
146
+                "     from T_Call_CallRecords a WITH(NOLOCK)" +
147
+                "   where datediff(day , BeginTime  , getdate())= 0 ";
148
+            DataTable dthw = DbHelperSQL.Query(sqlhw).Tables[0];
149
+            var obj = new
150
+            {
151
+                data = dthw
152
+            };
153
+            return Success("加载成功", obj);
154
+        }
155
+
156
+        /// <summary>
157
+        /// 获取当日工单满意度统计
158
+        /// </summary>
159
+        /// <returns></returns>
160
+        public ActionResult GetOrderSatisfactionByNow()
161
+        {
162
+            var date = DateTime.Now;
163
+
164
+            string sqlhw = "    select COALESCE(SUM( case a.MYD when 0 then 1 else 0 end),0) satisfied, " +
165
+                "       COALESCE(SUM( case a.MYD when 1 then 1 else 0 end), 0) basatisfied," +
166
+                "   COALESCE(SUM( case a.MYD when 2 then 1 else 0 end), 0) nosatisfied" +
167
+                "     from T_Wo_CommonBase a WITH(NOLOCK)" +
168
+                "   where datediff(day , F_CreateTime  , getdate())= 0 ";
169
+            DataTable dthw = DbHelperSQL.Query(sqlhw).Tables[0];
170
+            var obj = new
171
+            {
172
+                data = dthw
173
+            };
174
+            return Success("加载成功", obj);
175
+        }
176
+
177
+        /// <summary>
178
+        /// 获取当日车辆调度工单统计
179
+        /// </summary>
180
+        /// <returns></returns>
181
+        public ActionResult GetCarTypeByNow()
182
+        {
183
+            var date = DateTime.Now;
184
+
185
+            string sqlhw = "       select a. F_GDID F_Type , a.F_Name,(SELECT COUNT(1) FROM T_Car_WorkOrder WHERE   F_IsDel=0 AND F_Type=a.F_GDID" +
186
+                "    AND datediff(day , F_CreateTime  , getdate())= 0) COUNT    from T_Sys_Gongdan a" +
187
+                "     where F_ParentID = 4000 AND F_IsDelete = 0   ";
188
+            DataTable dthw = DbHelperSQL.Query(sqlhw).Tables[0];
189
+            var obj = new
190
+            {
191
+                data = dthw
192
+            };
193
+            return Success("加载成功", obj);
194
+        }
195
+
196
+        /// <summary>
197
+        /// 获取当日故障报修工单统计
198
+        /// </summary>
199
+        /// <returns></returns>
200
+        public ActionResult GetFaultRepairTypeByNow()
201
+        {
202
+            var date = DateTime.Now;
203
+
204
+            string sqlhw = " select a. F_GDID F_Type , a.F_Name,(SELECT COUNT(1) FROM T_FaultRepair_Base WHERE   F_IsDelete=0 AND F_WorkOrderCategory=a.F_GDID" +
205
+                "    AND datediff(day , F_CreateTime  , getdate())= 0) COUNT    from T_Sys_Gongdan  a" +
206
+                "     where F_ParentID = 3000 AND F_IsDelete = 0  ";
207
+            DataTable dthw = DbHelperSQL.Query(sqlhw).Tables[0];
208
+            var obj = new
209
+            {
210
+                data = dthw
211
+            };
212
+            return Success("加载成功", obj);
213
+        }
214
+        /// <summary>
215
+        /// 获取当日综合调度工单统计
216
+        /// </summary>
217
+        /// <returns></returns>
218
+        public ActionResult GetSchedulingTypeByNow()
219
+        {
220
+            var date = DateTime.Now;
221
+
222
+            string sqlhw = "    select a. F_GDID F_Type, a.F_Name,(SELECT COUNT(1) FROM T_IntegratedScheduling_Base WHERE F_IsDelete = 0" +
223
+                " AND F_WorkOrderCategory = a.F_GDID" +
224
+                "    AND datediff(day , F_CreateTime  , getdate())= 0) COUNT    from T_Sys_Gongdan a" +
225
+                "     where F_ParentID = 2000 AND F_IsDelete = 0";
226
+            DataTable dthw = DbHelperSQL.Query(sqlhw).Tables[0];
227
+            var obj = new
228
+            {
229
+                data = dthw
230
+            };
231
+            return Success("加载成功", obj);
232
+        }
233
+    }
234
+}

+ 2 - 0
RMYY_CallCenter_Api/RMYY_CallCenter_Api.csproj

@@ -158,6 +158,7 @@
158 158
     <Compile Include="Controllers\FaultRepairController.cs" />
159 159
     <Compile Include="Controllers\GroupClassController.cs" />
160 160
     <Compile Include="Controllers\HospitalUserController.cs" />
161
+    <Compile Include="Controllers\InfoController.cs" />
161 162
     <Compile Include="Controllers\information\NoticeController.cs" />
162 163
     <Compile Include="Controllers\InternalMessagesController.cs" />
163 164
     <Compile Include="Controllers\PatientController.cs" />
@@ -252,6 +253,7 @@
252 253
     <Folder Include="App_Data\" />
253 254
     <Folder Include="Views\CustomFiled\" />
254 255
     <Folder Include="Views\HospitalUser\" />
256
+    <Folder Include="Views\Info\" />
255 257
     <Folder Include="Views\InternalMessages\" />
256 258
     <Folder Include="Views\Patient\" />
257 259
     <Folder Include="Views\Portal\" />