Procházet zdrojové kódy

Merge branch 'master' of http://192.168.1.222:3000/duhongyu/YHSF_API

# Conflicts:
#	codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/ConversationController.cs
duhongyu %!s(int64=6) %!d(string=před) roky
rodič
revize
bea2bc4e79

+ 4 - 4
codegit/CallCenterApi/CallCenterApi.DAL/T_Con_Conversation.cs

@@ -164,13 +164,13 @@ namespace CallCenterApi.DAL
164 164
                 {
165 165
                     model.F_Type = int.Parse(row["F_Type"].ToString());
166 166
                 }
167
-                if (row["F_Department"] != null)
167
+                if (row["F_Department"] != null && row["F_Department"].ToString() != "")
168 168
                 {
169
-                    model.F_Department = row["F_Department"].ToString();
169
+                    model.F_Department = int.Parse(row["F_Department"].ToString());
170 170
                 }
171
-                if (row["F_Section"] != null)
171
+                if (row["F_Section"] != null && row["F_Section"].ToString() != "")
172 172
                 {
173
-                    model.F_Section = row["F_Section"].ToString();
173
+                    model.F_Section = int.Parse(row["F_Section"].ToString());
174 174
                 }
175 175
                 if (row["F_Telephone"] != null)
176 176
                 {

+ 78 - 30
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/ConversationController.cs

@@ -21,56 +21,85 @@ namespace CallCenterApi.Interface.Controllers
21 21
     public class ConversationController : BaseController
22 22
     {
23 23
         BLL.T_Con_Conversation bll = new BLL.T_Con_Conversation();
24
+        BLL.T_Sys_Department bll_Dep = new BLL.T_Sys_Department();
24 25
         /// <summary>
25 26
         /// 获取内外线列表
26 27
         /// </summary>
27 28
         /// <returns></returns>
28
-        public ActionResult GetList(string keyword, string tel, string department, string section, string physician
29
-            , int  type=1, int pageindex = 1, int pagesize = 10)
29
+        public ActionResult GetList()
30 30
         {
31 31
             ActionResult res = NoToken("未知错误,请重新登录");
32 32
             if (Request.IsAuthenticated)
33 33
             {
34 34
                 string sql = " and F_IsDelete=0";
35 35
                 DataTable dt = new DataTable();
36
-                if (!string .IsNullOrEmpty (keyword))
36
+
37
+                string keyword = RequestString.GetQueryString("keyword");
38
+                //电话
39
+                string strtel = RequestString.GetQueryString("tel");
40
+                //部门id
41
+                int department = RequestString.GetInt("department", 0);
42
+                //科室id
43
+                int section = RequestString.GetInt("section", 0);
44
+                //医师
45
+                string physician = RequestString.GetQueryString("physician");
46
+                string stringtype = RequestString.GetQueryString("type");
47
+                int type = 0;
48
+                string strpageindex = RequestString.GetQueryString("pageindex");
49
+                int pageindex = 1;
50
+                string strpagesize = RequestString.GetQueryString("pagesize");
51
+                int pagesize = 10;
52
+
53
+                if (keyword.Trim() != "" && keyword != "undefined")
54
+                {
55
+                    sql += $" and (F_Telephone like '%" + keyword.Trim() + "%' or F_Physician like '%" + keyword.Trim() + "%' or F_Title like '%" + keyword.Trim() + "%') ";
56
+                }
57
+                if (strtel.Trim() != "" && strtel != "undefined")
58
+                {
59
+                    sql += " and F_Telephone=" + strtel;
60
+                }
61
+                if (department > 0)
62
+                {
63
+                    sql += " and F_Department=" + department;
64
+                }
65
+                if (section > 0)
37 66
                 {
38
-                    sql += $"  and F_Telephone like '%" + keyword.Trim() + "%' or F_Department like '%" + keyword.Trim() + "%'or F_Section like '%" + keyword.Trim() + "%'  or F_Physician like '%" + keyword.Trim() + "%' or F_Title like '%" + keyword.Trim() + "%'";
67
+                    sql += " and F_Section=" + section;
39 68
                 }
40
-                if (!string.IsNullOrEmpty(tel))
69
+                if (physician.Trim() != "" && physician != "undefined")
41 70
                 {
42
-                    sql += "and  F_Telephone='" + tel+"'";
71
+                    sql += " and F_Physician=" + physician;
43 72
                 }
44
-                if (!string.IsNullOrEmpty(department))
73
+                if (strpageindex.Trim() != "")
45 74
                 {
46
-                    sql += "and  F_Department='" + department+"'";
75
+                    pageindex = Convert.ToInt32(strpageindex);
47 76
                 }
48
-                if (!string.IsNullOrEmpty(section))
77
+                if (strpagesize.Trim() != "")
49 78
                 {
50
-                    sql += "and  F_Section='" + section+"'";
79
+                    pagesize = Convert.ToInt32(strpagesize);
51 80
                 }
52
-                if (!string.IsNullOrEmpty(physician))
81
+                if (stringtype .Trim() != "")
53 82
                 {
54
-                    sql += "and  F_Physician='" + physician+"'";
83
+                    type  = Convert.ToInt32(stringtype);
84
+                    sql += " and F_Type=" + type;
55 85
                 }
56
-                sql += "and  F_Type=" + type;
57 86
                 int recordCount = 0;
58 87
                 dt = BLL.PagerBLL.GetListPager(
59 88
                         "T_Con_Conversation",
60 89
                         "T_Con_Conversation.ID",
61
-                        "*",
90
+                        "*,(SELECT F_DeptName FROM dbo.T_Sys_Department WHERE F_DeptId = dbo.T_Con_Conversation.F_Department) AS Department_Name,(SELECT F_DeptName FROM dbo.T_Sys_Department WHERE F_DeptId = dbo.T_Con_Conversation.F_Section) AS Section_Name ",
62 91
                         sql,
63 92
                        "ORDER BY T_Con_Conversation.ID desc",
64 93
                         pagesize,
65 94
                         pageindex,
66 95
                         true,
67 96
                         out recordCount);
68
-                List<Model.T_Con_Conversation> modlelist = new BLL.T_Con_Conversation().DataTableToList(dt);
97
+                //List<Model.T_Con_Conversation> modlelist = new BLL.T_Con_Conversation().DataTableToList(dt);
69 98
                 var obj = new
70 99
                 {
71 100
                     state = "success",
72 101
                     message = "成功",
73
-                    rows = modlelist,
102
+                    rows = dt,
74 103
                     total = recordCount
75 104
                 };
76 105
                 res = Content(obj.ToJson());
@@ -114,8 +143,8 @@ namespace CallCenterApi.Interface.Controllers
114 143
         {
115 144
             public int ID { get; set; }
116 145
             public int  F_Type { get; set; }// 1内线2外线
117
-            public string F_Department { get; set; }// 部门
118
-            public string F_Section { get; set; }//科室
146
+            public int F_Department { get; set; }// 部门
147
+            public int F_Section { get; set; }//科室
119 148
             public string F_Telephone { get; set; }//电话
120 149
             public string F_Physician { get; set; }//医师
121 150
             public string F_Title { get; set; }//职称
@@ -140,6 +169,13 @@ namespace CallCenterApi.Interface.Controllers
140 169
         /// <returns></returns>
141 170
         public ActionResult Add(Conversation input)
142 171
         {
172
+            #region 获取部门id by 科室id
173
+            var model_Dep = new Model.T_Sys_Department();
174
+            int dep_Sectionid = input.F_Section;
175
+            if (dep_Sectionid > 0)
176
+                model_Dep = bll_Dep.GetModel(dep_Sectionid);
177
+            #endregion
178
+
143 179
             #region 添加验证判断
144 180
             if (string.IsNullOrEmpty(input.F_Telephone))
145 181
                 return Error("电话不能为空!");
@@ -150,8 +186,8 @@ namespace CallCenterApi.Interface.Controllers
150 186
             #endregion
151 187
             var model = new Model.T_Con_Conversation();
152 188
             model.F_Type = input.F_Type;    //1内线2外线
153
-            model.F_Department = input.F_Department;    //部门
154
-            model.F_Section = input.F_Section;    // 科室
189
+            model.F_Department = model_Dep != null ? model_Dep.F_ParentId : input.F_Department;    //部门id
190
+            model.F_Section = input.F_Section;    // 科室id
155 191
             model.F_Telephone = input.F_Telephone;  // 电话
156 192
             model.F_Physician = input.F_Physician;      //医师
157 193
             model.F_Title = input.F_Title;//职称
@@ -170,6 +206,13 @@ namespace CallCenterApi.Interface.Controllers
170 206
         {
171 207
             int userId = CurrentUser.UserData.F_UserId;
172 208
 
209
+            #region 获取部门id by 科室id
210
+            var model_Dep = new Model.T_Sys_Department();
211
+            int dep_Sectionid = input.F_Section;
212
+            if(dep_Sectionid > 0)
213
+                model_Dep = bll_Dep.GetModel(dep_Sectionid);
214
+            #endregion
215
+
173 216
             #region 添加验证判断
174 217
             if (input.ID <= 0)
175 218
                 return Error("参数错误!");
@@ -178,10 +221,10 @@ namespace CallCenterApi.Interface.Controllers
178 221
             if (input.F_Type <= 0)
179 222
                 return Error("请选择电话类别");
180 223
             #endregion
181
-            var model = bll.GetModel(input.ID );
224
+            var model = bll.GetModel(input.ID);
182 225
             model.F_Type = input.F_Type;    //1内线2外线
183
-            model.F_Department = input.F_Department;    //部门
184
-            model.F_Section = input.F_Section;    // 科室
226
+            model.F_Department = model_Dep != null ? model_Dep.F_ParentId : input.F_Department;    //部门id
227
+            model.F_Section = input.F_Section;    // 科室id
185 228
             model.F_Telephone = input.F_Telephone;  // 电话
186 229
             model.F_Physician = input.F_Physician;      //医师
187 230
             model.F_Title = input.F_Title;//职称
@@ -292,6 +335,9 @@ namespace CallCenterApi.Interface.Controllers
292 335
                         dModel.F_IsDelete  = 0;
293 336
                         dModel.F_FileId = fid;
294 337
                         dModel.F_Type  = type ;
338
+
339
+                        //获取之前所有客户档案信息
340
+                        var list_Dep = bll_Dep.DataTableToList(bll_Dep.GetList(" 1=1 and F_DeleteFlag = 0 ").Tables[0]).ToList();
295 341
                         foreach (DataRow dr in dt.Rows)
296 342
                         {
297 343
                           
@@ -301,19 +347,21 @@ namespace CallCenterApi.Interface.Controllers
301 347
                             {
302 348
                                 if (!getunphone(0, dr["电话"].ToString()))
303 349
                                 {
304
-                                    dModel.F_Department = dr["部门"].ToString();
305
-                                    dModel.F_Section = dr["科室"].ToString();
350
+                                    var model_Dept = list_Dep.SingleOrDefault(x => x.F_DeptName.Equals(dr["部门"].ToString()));
351
+                                    var model_Sec = list_Dep.SingleOrDefault(x => x.F_DeptName.Equals(dr["科室"].ToString()));
352
+                                    dModel.F_Department = model_Dept != null ? model_Dept.F_DeptId : 0;     //dr["部门"].ToString();
353
+                                    dModel.F_Section = model_Sec != null ? model_Sec.F_DeptId : 0;    //dr["科室"].ToString();
306 354
                                     dModel.F_Telephone = dr["电话"].ToString();
307 355
 
308 356
                                     if (type == 2)
309 357
                                     {
310 358
                                         dModel.F_Physician = dr["医师"].ToString();
311 359
                                         dModel.F_Title = dr["职称"].ToString();
312
-                                    }
313
-                                    var res = bll.Add(dModel);
314
-                                    if (res <= 0)
315
-                                    {
316
-                                        msg = msg + "第" + headrow + "行,导入失败<br>";
360
+                                        var res = bll.Add(dModel);
361
+                                        if (res <= 0)
362
+                                        {
363
+                                            msg = msg + "第" + headrow + "行,导入失败<br>";
364
+                                        }
317 365
                                     }
318 366
                                 }
319 367
                                 else

+ 6 - 6
codegit/CallCenterApi/CallCenterApi.Model/T_Con_Conversation.cs

@@ -13,8 +13,8 @@ namespace CallCenterApi.Model
13 13
         #region Model
14 14
         private long? _id;
15 15
         private int? _f_type;
16
-        private string _f_department;
17
-        private string _f_section;
16
+        private int _f_department = 0;
17
+        private int _f_section = 0;
18 18
         private string _f_telephone;
19 19
         private string _f_physician;
20 20
         private string _f_title;
@@ -37,17 +37,17 @@ namespace CallCenterApi.Model
37 37
             get { return _f_type; }
38 38
         }
39 39
         /// <summary>
40
-        /// 部门
40
+        /// 部门id
41 41
         /// </summary>
42
-        public string F_Department
42
+        public int F_Department
43 43
         {
44 44
             set { _f_department = value; }
45 45
             get { return _f_department; }
46 46
         }
47 47
         /// <summary>
48
-        /// 科室
48
+        /// 科室id
49 49
         /// </summary>
50
-        public string F_Section
50
+        public int F_Section
51 51
         {
52 52
             set { _f_section = value; }
53 53
             get { return _f_section; }