瀏覽代碼

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

# Conflicts:
#	codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/ConversationController.cs
duhongyu 6 年之前
父節點
當前提交
bea2bc4e79

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

164
                 {
164
                 {
165
                     model.F_Type = int.Parse(row["F_Type"].ToString());
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
                 if (row["F_Telephone"] != null)
175
                 if (row["F_Telephone"] != null)
176
                 {
176
                 {

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

21
     public class ConversationController : BaseController
21
     public class ConversationController : BaseController
22
     {
22
     {
23
         BLL.T_Con_Conversation bll = new BLL.T_Con_Conversation();
23
         BLL.T_Con_Conversation bll = new BLL.T_Con_Conversation();
24
+        BLL.T_Sys_Department bll_Dep = new BLL.T_Sys_Department();
24
         /// <summary>
25
         /// <summary>
25
         /// 获取内外线列表
26
         /// 获取内外线列表
26
         /// </summary>
27
         /// </summary>
27
         /// <returns></returns>
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
             ActionResult res = NoToken("未知错误,请重新登录");
31
             ActionResult res = NoToken("未知错误,请重新登录");
32
             if (Request.IsAuthenticated)
32
             if (Request.IsAuthenticated)
33
             {
33
             {
34
                 string sql = " and F_IsDelete=0";
34
                 string sql = " and F_IsDelete=0";
35
                 DataTable dt = new DataTable();
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
                 int recordCount = 0;
86
                 int recordCount = 0;
58
                 dt = BLL.PagerBLL.GetListPager(
87
                 dt = BLL.PagerBLL.GetListPager(
59
                         "T_Con_Conversation",
88
                         "T_Con_Conversation",
60
                         "T_Con_Conversation.ID",
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
                         sql,
91
                         sql,
63
                        "ORDER BY T_Con_Conversation.ID desc",
92
                        "ORDER BY T_Con_Conversation.ID desc",
64
                         pagesize,
93
                         pagesize,
65
                         pageindex,
94
                         pageindex,
66
                         true,
95
                         true,
67
                         out recordCount);
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
                 var obj = new
98
                 var obj = new
70
                 {
99
                 {
71
                     state = "success",
100
                     state = "success",
72
                     message = "成功",
101
                     message = "成功",
73
-                    rows = modlelist,
102
+                    rows = dt,
74
                     total = recordCount
103
                     total = recordCount
75
                 };
104
                 };
76
                 res = Content(obj.ToJson());
105
                 res = Content(obj.ToJson());
114
         {
143
         {
115
             public int ID { get; set; }
144
             public int ID { get; set; }
116
             public int  F_Type { get; set; }// 1内线2外线
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
             public string F_Telephone { get; set; }//电话
148
             public string F_Telephone { get; set; }//电话
120
             public string F_Physician { get; set; }//医师
149
             public string F_Physician { get; set; }//医师
121
             public string F_Title { get; set; }//职称
150
             public string F_Title { get; set; }//职称
140
         /// <returns></returns>
169
         /// <returns></returns>
141
         public ActionResult Add(Conversation input)
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
             #region 添加验证判断
179
             #region 添加验证判断
144
             if (string.IsNullOrEmpty(input.F_Telephone))
180
             if (string.IsNullOrEmpty(input.F_Telephone))
145
                 return Error("电话不能为空!");
181
                 return Error("电话不能为空!");
150
             #endregion
186
             #endregion
151
             var model = new Model.T_Con_Conversation();
187
             var model = new Model.T_Con_Conversation();
152
             model.F_Type = input.F_Type;    //1内线2外线
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
             model.F_Telephone = input.F_Telephone;  // 电话
191
             model.F_Telephone = input.F_Telephone;  // 电话
156
             model.F_Physician = input.F_Physician;      //医师
192
             model.F_Physician = input.F_Physician;      //医师
157
             model.F_Title = input.F_Title;//职称
193
             model.F_Title = input.F_Title;//职称
170
         {
206
         {
171
             int userId = CurrentUser.UserData.F_UserId;
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
             #region 添加验证判断
216
             #region 添加验证判断
174
             if (input.ID <= 0)
217
             if (input.ID <= 0)
175
                 return Error("参数错误!");
218
                 return Error("参数错误!");
178
             if (input.F_Type <= 0)
221
             if (input.F_Type <= 0)
179
                 return Error("请选择电话类别");
222
                 return Error("请选择电话类别");
180
             #endregion
223
             #endregion
181
-            var model = bll.GetModel(input.ID );
224
+            var model = bll.GetModel(input.ID);
182
             model.F_Type = input.F_Type;    //1内线2外线
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
             model.F_Telephone = input.F_Telephone;  // 电话
228
             model.F_Telephone = input.F_Telephone;  // 电话
186
             model.F_Physician = input.F_Physician;      //医师
229
             model.F_Physician = input.F_Physician;      //医师
187
             model.F_Title = input.F_Title;//职称
230
             model.F_Title = input.F_Title;//职称
292
                         dModel.F_IsDelete  = 0;
335
                         dModel.F_IsDelete  = 0;
293
                         dModel.F_FileId = fid;
336
                         dModel.F_FileId = fid;
294
                         dModel.F_Type  = type ;
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
                         foreach (DataRow dr in dt.Rows)
341
                         foreach (DataRow dr in dt.Rows)
296
                         {
342
                         {
297
                           
343
                           
301
                             {
347
                             {
302
                                 if (!getunphone(0, dr["电话"].ToString()))
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
                                     dModel.F_Telephone = dr["电话"].ToString();
354
                                     dModel.F_Telephone = dr["电话"].ToString();
307
 
355
 
308
                                     if (type == 2)
356
                                     if (type == 2)
309
                                     {
357
                                     {
310
                                         dModel.F_Physician = dr["医师"].ToString();
358
                                         dModel.F_Physician = dr["医师"].ToString();
311
                                         dModel.F_Title = dr["职称"].ToString();
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
                                 else
367
                                 else

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

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