|
|
@@ -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
|