| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421 |
- using CallCenter.Utility;
- using CallCenterApi.Common;
- using CallCenterApi.DB;
- using CallCenterApi.Interface.Controllers.Base;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Web;
- using System.Web.Mvc;
- namespace CallCenterApi.Interface.Controllers.MedicalFollowup
- {
- public class FollowUpController : BaseController
- {
- //private readonly BLL.T_Call_OutTaskTelNum otnBLL = new BLL.T_Call_OutTaskTelNum();
- private readonly BLL.T_Call_OutAnswers ansBLL = new BLL.T_Call_OutAnswers();
- private readonly BLL.SF_TaskAnswers ansnewBLL = new BLL.SF_TaskAnswers();
- private readonly BLL.T_Med_FollowUp mfBLL = new BLL.T_Med_FollowUp();
- private readonly BLL.T_Ask_Question questionBLL = new BLL.T_Ask_Question();
- private readonly BLL.T_Ask_QuestionItems questionItemBLL = new BLL.T_Ask_QuestionItems();
- private readonly BLL.T_Ask_PagerInfo pagerInfoBLL = new BLL.T_Ask_PagerInfo();
- private readonly BLL.SF_Task taskBLL = new BLL.SF_Task();
- private readonly BLL.SF_TaskDetail taskDetailBLL = new BLL.SF_TaskDetail();
- BLL.SF_BINGRENQK busSF_BINGRENQK = new BLL.SF_BINGRENQK();
- // GET: FollowUp
- public ActionResult Index()
- {
- return View();
- }
- #region 获取随访列表
- /// <summary>
- /// 获取随访列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetListAll()
- {
- //BAH not LIKE '%[_]11' 是客户要求列表中去掉xxx之子,xxx之女 的随访,这种是母亲 BAH_11
- // string sql = " datediff(day,T1.CYRQ,'2020-11-01')<=0 and BAH not LIKE '%[_]11' ";
- string sql = " BAH not LIKE '%[_]11' ";
- DataTable dt = new DataTable();
- string dischargedept = HttpUtility.UrlDecode(RequestString.GetQueryString("dischargedept"));//出院科室
- string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));//状态
- string strcode = HttpUtility.UrlDecode(RequestString.GetQueryString("code"));//病案号
- string stropename = HttpUtility.UrlDecode(RequestString.GetQueryString("opename"));//手术名称
- //来电号码
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("phone"));//联系人电话
- string BRXM = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));//姓名
- string strdoctor = "";// HttpUtility.UrlDecode(RequestString.GetQueryString("tubedoctor"));//管床医生 adminken
- //诊断名称
- string strzdmc = HttpUtility.UrlDecode(RequestString.GetQueryString("zdmc"));//诊断名称
- //出院日期
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));//查询起始时间
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));//查询截止时间
- //总费用
- string strcosts = HttpUtility.UrlDecode(RequestString.GetQueryString("costs"));
- string strcoste = HttpUtility.UrlDecode(RequestString.GetQueryString("coste"));
- //随访日期 adminken
- string strtime = "";// HttpUtility.UrlDecode(RequestString.GetQueryString("sftime"));
- //仅包含随访结束的
- string strsfend = "";// HttpUtility.UrlDecode(RequestString.GetQueryString("sfend"));
- string strResult = "";// HttpUtility.UrlDecode(RequestString.GetQueryString("sresult"));
- //仅二级随访未完成
- string strejwwc = "";//HttpUtility.UrlDecode(RequestString.GetQueryString("secondlevel"));
- //满意度
- string strsatisfy = ""; HttpUtility.UrlDecode(RequestString.GetQueryString("satisfied"));
- //类型
- string strtype = "";// HttpUtility.UrlDecode(RequestString.GetQueryString("type"));
- //建档日期
- string strjdrq = "";
- //病例分类
- string blfl = RequestString.GetQueryString("blfl");
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- if (dischargedept.Trim() != "" && dischargedept != "undefined")
- {
- sql += " and T1.CYKS like '%" + dischargedept.Trim() + "%' ";
- }
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- if (strstate == "2")
- {
- sql += " and T4.F_Id IS NOT NULL and T4.F_Result in ('正常接通','拒访','不是本人','停机','空号','免回访','电话错误','死亡')";
- }
- else if (strstate == "1")
- {
- //'心胸外科','肿瘤科','肿瘤科病区',
- sql += " and T4.F_Id IS NULL AND T1.CYKS NOT IN ('肾病内科','感染性疾病科','肾病内科病区','肾病内科1','感染性疾病科病区','重症医学科(ICU)病区') AND T1.RYKS NOT IN ('肾病内科','感染性疾病科','肾病内科病区','肾病内科1','感染性疾病科病区','重症医学科(ICU)病区') ";//'心胸外科','肿瘤科','肿瘤科病区',
- }
- else if (strstate == "3")
- {
- sql += " and T4.F_Id IS NOT NULL and (T4.F_Result = '无人接听' OR t4.F_Result='关机' )";
- }
- else if (strstate == "4")
- {
- sql += " and T4.F_Id IS NOT NULL and T4.F_Result = '无人接听(二次)' ";
- }
- }
- else
- {
- sql += " and T4.F_Id IS NULL ";
- }
- if (strcode.Trim() != "" && strcode != "undefined")
- {
- sql += " and T1.BAH = '" + strcode.Trim() + "' ";
- }
- if (stropename.Trim() != "" && stropename != "undefined")
- {
- sql += " and ssmc like '%" + stropename.Trim() + "%' ";
- }
- if (BRXM.Trim() != "" && BRXM != "undefined")
- {
- sql += " and T1.BRXM = '" + BRXM.Trim() + "' ";
- }
- if (strdoctor.Trim() != "" && strdoctor != "undefined")
- {
- sql += " and F_TubeDoctor like '%" + strdoctor.Trim() + "%' ";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and T1.XZZDH like '%" + strtel + "%' ";
- }
- if (strstarttime != null && strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,T1.CYRQ,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,T1.CYRQ,'" + strendtime + "')>=0 ";
- }
- if (strzdmc.Trim() != "" && strzdmc != "undefined")
- {
- sql += " and T3.ZZDMC = '" + strzdmc.Trim() + "' ";
- }
- if (strcosts.Trim() != "" && strcosts != "undefined")
- {
- sql += " and T1.ZFY >= '" + strzdmc.Trim() + "' ";
- }
- if (strcoste.Trim() != "" && strcoste != "undefined")
- {
- sql += " and T1.ZFY <= '" + strzdmc.Trim() + "' ";
- }
- if (strtime.Trim() != "" && strtime != "undefined")
- {
- sql += " and datediff(day,F_SFDate,'" + strtime + "')=0 ";
- }
- //if (strsfend.Trim() != "" && strsfend != "undefined")
- //{
- // sql += " and F_State = 3 ";//随访完成状态
- //}
- if (strejwwc.Trim() != "" && strejwwc != "undefined")
- {
- sql += " and F_State = 2 ";//随访完成状态
- }
- if (strsatisfy.Trim() != "" && strsatisfy != "undefined")
- {
- sql += " and F_Satisfied = '" + strsatisfy + "' ";//随访完成状态
- }
- if (strtype.Trim() != "" && strtype != "undefined")
- {
- sql += " and F_Type = '" + strtype.Trim() + "' ";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strjdrq.Trim() != "")
- {
- sql += "and T1.JDRQ='" + strjdrq.Trim() + "'";
- }
- if (blfl.Trim() != "")
- {
- sql += "and T1.BLFL='" + blfl.Trim() + "'";
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- int count = 0;
- //排序慢 先去掉
- string orderby = "";
- if (strstate == "2")
- {
- orderby = "F_SFTime desc";
- }
- if (strstate == "3")
- {
- orderby = "F_SFTime ";
- }
- dt = busSF_BINGRENQK.GetALLListByPage(sql, orderby, (pageindex - 1) * pagesize, pagesize * pageindex, out count);
- //dt = BLL.PagerBLL.GetListPager(
- // "T_Med_FollowUp",
- // "T_Med_FollowUp.F_Id",
- // "*",
- // sql,
- // "ORDER BY T_Med_FollowUp.F_Id desc",
- // pagesize,
- // pageindex,
- // true,
- // out recordCount);
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = count
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 根据id获取信息
- /// </summary>
- /// <returns></returns>
- public ActionResult GetListById(string id)
- {
- //int idint = Convert.ToInt32(id);
-
- DataTable dt = new DataTable();
- dt = busSF_BINGRENQK.GetALLListById(" T1.BINGRENZYID='" + id+"'", "", 0, 1);
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = 1
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取随访单条结果
- /// </summary>
- /// <returns></returns>
- public ActionResult Getdetail()
- {
- DataTable dt = new DataTable();
- int F_Id = Convert.ToInt32(HttpUtility.UrlDecode(RequestString.GetQueryString("F_Id")));
- BLL.T_Med_FollowUp busfollowUp = new BLL.T_Med_FollowUp();
- Model.T_Med_FollowUp model = busfollowUp.GetModel(F_Id);
- return Content(model.ToJson());
- }
- /// <summary>
- /// 获取随访列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetListAllOld()
- {
- string sql = " and F_IsDel=0 ";
- DataTable dt = new DataTable();
- string dischargedept = HttpUtility.UrlDecode(RequestString.GetQueryString("dischargedept"));//出院科室
- string strstate = HttpUtility.UrlDecode(RequestString.GetQueryString("state"));//状态
- string strcode = HttpUtility.UrlDecode(RequestString.GetQueryString("code"));//病案号
- string stropename = HttpUtility.UrlDecode(RequestString.GetQueryString("opename"));//手术名称
- //来电号码
- string strtel = HttpUtility.UrlDecode(RequestString.GetQueryString("phone"));//联系人电话
- string strname = HttpUtility.UrlDecode(RequestString.GetQueryString("name"));//姓名
- string strdoctor = HttpUtility.UrlDecode(RequestString.GetQueryString("tubedoctor"));//管床医生
- //诊断名称
- string strzdmc = HttpUtility.UrlDecode(RequestString.GetQueryString("zdmc"));//诊断名称
- //出院日期
- string strstarttime = HttpUtility.UrlDecode(RequestString.GetQueryString("starttime"));//查询起始时间
- string strendtime = HttpUtility.UrlDecode(RequestString.GetQueryString("endtime"));//查询截止时间
- //总费用
- string strcosts = HttpUtility.UrlDecode(RequestString.GetQueryString("costs"));
- string strcoste = HttpUtility.UrlDecode(RequestString.GetQueryString("coste"));
- //随访日期
- string strtime = HttpUtility.UrlDecode(RequestString.GetQueryString("sftime"));
- //仅包含随访结束的
- string strsfend = HttpUtility.UrlDecode(RequestString.GetQueryString("sfend"));
- //仅二级随访未完成
- string strejwwc = HttpUtility.UrlDecode(RequestString.GetQueryString("secondlevel"));
- //满意度
- string strsatisfy = HttpUtility.UrlDecode(RequestString.GetQueryString("satisfied"));
- //类型
- string strtype = HttpUtility.UrlDecode(RequestString.GetQueryString("type"));
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- if (dischargedept.Trim() != "" && dischargedept != "undefined")
- {
- sql += " and F_DischargeDept like '%" + dischargedept.Trim() + "%' ";
- }
- if (strstate.Trim() != "" && strstate != "undefined")
- {
- sql += " and F_State = '" + strstate.Trim() + "' ";
- }
- if (strcode.Trim() != "" && strcode != "undefined")
- {
- sql += " and F_Code = '" + strcode.Trim() + "' ";
- }
- if (stropename.Trim() != "" && stropename != "undefined")
- {
- sql += " and F_OpeName like '%" + stropename.Trim() + "%' ";
- }
- if (strname.Trim() != "" && strname != "undefined")
- {
- sql += " and F_Name = '" + strname.Trim() + "' ";
- }
- if (strdoctor.Trim() != "" && strdoctor != "undefined")
- {
- sql += " and F_TubeDoctor like '%" + strdoctor.Trim() + "%' ";
- }
- if (strtel.Trim() != "" && strtel != "undefined")
- {
- sql += " and F_Phone like '%" + strtel + "%' ";
- }
- if (strstarttime.Trim() != "" && strstarttime != "undefined")
- {
- sql += " and datediff(day,F_OutDate,'" + strstarttime + "')<=0 ";
- }
- if (strendtime.Trim() != "" && strendtime != "undefined")
- {
- sql += " and datediff(day,F_OutDate,'" + strendtime + "')>=0 ";
- }
- if (strzdmc.Trim() != "" && strzdmc != "undefined")
- {
- sql += " and F_ZDMC = '" + strzdmc.Trim() + "' ";
- }
- if (strcosts.Trim() != "" && strcosts != "undefined")
- {
- sql += " and F_TotalCosts >= '" + strzdmc.Trim() + "' ";
- }
- if (strcoste.Trim() != "" && strcoste != "undefined")
- {
- sql += " and F_TotalCosts <= '" + strzdmc.Trim() + "' ";
- }
- if (strtime.Trim() != "" && strtime != "undefined")
- {
- sql += " and datediff(day,F_SFDate,'" + strtime + "')=0 ";
- }
- if (strsfend.Trim() != "" && strsfend != "undefined")
- {
- sql += " and F_State = 3 ";//随访完成状态
- }
- if (strejwwc.Trim() != "" && strejwwc != "undefined")
- {
- sql += " and F_State = 2 ";//随访完成状态
- }
- if (strsatisfy.Trim() != "" && strsatisfy != "undefined")
- {
- sql += " and F_Satisfied = '" + strsatisfy + "' ";//随访完成状态
- }
- if (strtype.Trim() != "" && strtype != "undefined")
- {
- sql += " and F_Type = '" + strtype.Trim() + "' ";
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Med_FollowUp",
- "T_Med_FollowUp.F_Id",
- "*",
- sql,
- "ORDER BY T_Med_FollowUp.F_SFTime desc",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 病例信息
- /// </summary>
- /// <param name="dal">电话</param>
- /// <returns></returns>
- public ActionResult GetxinxiList(string dal,DateTime? sdate, DateTime? edate,string ryks)
- {
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- string sql = "";
- if (dal != null &&dal.Trim() != "" && dal != "undefined")
- {
- sql += " and XZZDH = '" + dal + "'";
- }
- if (sdate!=null && edate != null)
- {
- sql += " and RYRQ BETWEEN '"+sdate+ "' and '"+edate+"' ";
- }
- if (ryks != null &&ryks.Trim() != "" && ryks != "undefined")
- {
- sql += " and RYKS = '" + ryks + "'";
- }
-
- int recordCount = 0;
- DataTable dt = new DataTable();
- // dt = mfBLL.GetBLList(" XZZDH='" + dal + "'").Tables[0];
- dt = BLL.PagerBLL.GetListPager(
- "SF_BINGRENQK",
- "BAH",
- "*",
- sql,
- "ORDER BY RYRQ",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- #endregion
- #region 问卷回答
- /// <summary>
- ///
- /// </summary>
- /// <param name="taskid">任务ID</param>
- /// <param name="custelid">BINGRENZYID</param>
- /// <param name="ans">答案,数组形式["15_20_单选选项内容","17_25|36|58_复选选项内容1|选项内容2|选项内容3","30_0_问答题"]</param>
- /// <param name="hjjgid">呼叫结果</param>
- /// <param name="telphone">电话号码</param>
- /// <param name="name">姓名</param>
- /// <param name="phone">固定号码</param>
- /// <param name="countryid">乡镇id</param>
- /// <param name="address">地址</param>
- /// <returns></returns>
- public ActionResult Answers(int? taskid, string custelid, string[] ans, int hjjgid,
- string name, string phone, string address, string advise, string satisfied, string praise, string criticism,string blfl, int pagerid = 0, int countryid = 0)
- {
- taskid = 0;
- int cc = 0;
- var hjconfig = new BLL.T_Sys_DictionaryValue().GetModel(hjjgid);
- if (hjconfig == null)
- {
- return Error("提交结果配置不正常");
- }
- if (!string.IsNullOrEmpty(custelid))
- {
- var otnModel = busSF_BINGRENQK.GetModel(custelid);
- if (otnModel != null)
- {
- if (!string.IsNullOrEmpty(blfl))
- {
- otnModel.BLFL = blfl;
- busSF_BINGRENQK.Update(otnModel);
- }
- //物业系统,客户档案信息是存储业主信息的,外呼不需要存储
- //int cusid = saveCus(otnModel.F_Phone, name, phone, countryid, address);
- int cusid = 0;
- #region 保存答案
- var ansModel = new Model.T_Call_OutAnswers();
- string askqids = "";
- string ansids = "";
- if (ans != null)
- {
- //先删除 后添加
- ansBLL.DeleteByTelid(custelid, taskid);
- ansModel.F_TaskID = taskid;
- ansModel.F_CusTelID = custelid;
- ansModel.F_CusID = cusid;
- ansModel.F_OptBy = CurrentUser.UserData.F_UserId;
- ansModel.F_OptByName = CurrentUser.UserData.F_UserName;
- ansModel.F_OptOn = DateTime.Now;
- ansModel.F_Expand1 = countryid.ToString();
- ansModel.F_Expand3 = DateTime.Now.ToString("yyyyMMddHHmmssfff");
- #region 循环保存
- foreach (var item in ans)
- {
- var nn = 0;
- var ii = item.Split('_');
- ansModel.F_QID = int.Parse(ii[0]);
- askqids += ii[0] + ",";
- ansids += ii[1] + ",";
- if (ii[1].IndexOf('|') > 0)
- {
- var iii = ii[1].Trim('|').Split('|');
- var iia = ii[2].Trim('|').Split('|');
- for (int i = 0; i < iii.Length; i++)
- {
- ansModel.F_QIID = int.Parse(iii[i]);
- ansModel.F_Answer = iia[i];
- if (ansBLL.Add(ansModel) > 0)
- nn++;
- }
- if (nn == iii.Length)
- cc++;
- }
- else
- {
- ansModel.F_QIID = int.Parse(ii[1]);
- ansModel.F_Answer = ii[2];
- if (ansBLL.Add(ansModel) > 0)
- cc++;
- }
- }
- #endregion
- }
- #endregion
- #region 保存日志
- BLL.SF_Result busResult = new BLL.SF_Result();
- Model.SF_Result modelResult = busResult.GetModel(custelid.ToString());
- if (modelResult != null)
- {
- busResult.Delete(modelResult.F_Id);
- modelResult.F_SFNum += 1;
- modelResult.F_Remark += "<br/>上次满意度:" + modelResult.F_MYD;
- modelResult.F_Remark += "<br/>上次建议:" + modelResult.F_Advise;
- modelResult.F_Remark += "<br/>上次回访结果" + modelResult.F_Result;
- }
- else
- {
- modelResult = new Model.SF_Result();
- modelResult.F_SFNum = 1;
- }
- modelResult.F_Result = hjconfig.F_Name;
- modelResult.F_Id = custelid.ToString();
- modelResult.F_SFPersion = CurrentUser.UserData.F_UserName;
- modelResult.F_SFPersionId = CurrentUser.UserData.F_UserCode;
- modelResult.F_SFTime = DateTime.Now;
- modelResult.F_Advise = advise;
- modelResult.F_MYD = satisfied;
- modelResult.F_PagerID = pagerid.ToString();
- modelResult.F_Praise = praise;
- modelResult.F_Criticism = criticism;
- modelResult.F_State = 2;
- busResult.Add(modelResult);
- //planrecord(otnModel);
- #endregion
- }
- }
- if (ans != null)
- {
- if (cc == ans.Length)
- {
- //return Success("问卷答案提交成功!taskid=" + taskid + ",custelid=" + custelid + ",操作人:" + CurrentUser.UserData.F_UserCode);
- return Success("问卷答案提交成功!custelid=" + custelid + ",操作人:" + CurrentUser.UserData.F_UserCode);
- }
- else
- {
- ansBLL.DeleteByTelid(custelid, taskid);
- return Error("问卷答案提交失败!custelid=" + custelid + ",操作人:" + CurrentUser.UserData.F_UserCode);
- }
- }
- else if (hjconfig.F_Name.Contains("正常"))
- {
- return Error("没有问卷答案提交");
- }
- else
- {
- return Success("提交成功!custelid=" + custelid + ",操作人:" + CurrentUser.UserData.F_UserCode);
- }
- }
- #endregion
- #region 导出
- #endregion
- #region 获取随访结果详情
- //获取任务结果详情
- public ActionResult GetTaskTelInfo(int id = 0)
- {
- if (id <= 0)
- return Error("参数不正确");
- var model = mfBLL.GetModel(id);
- var paperid = 0;
- if (model != null)
- {
- var taskmodel = new Model.T_Med_FollowUp();
- #region 绑定任务和客户信息
- taskmodel.F_Id = model.F_Id;//号码id
- //taskmodel.F_TaskId = model.F_TaskId.Value;//任务id
- //taskmodel.F_HJJGId = model.F_HJJGId != null ? model.F_HJJGId.Value : 0;//呼叫结果id
- taskmodel.F_Satisfied = model.F_Satisfied;
- taskmodel.F_SFResult = model.F_SFResult;
- if (!string.IsNullOrWhiteSpace(model.F_Name))
- taskmodel.F_Name = model.F_Name;//客户姓名
- if (!string.IsNullOrWhiteSpace(model.F_Phone))
- taskmodel.F_Phone = model.F_Phone;//号码
- if (!string.IsNullOrWhiteSpace(model.F_Addr))
- taskmodel.F_Addr = model.F_Addr;//住址
- #endregion
- var anslist = ansBLL.GetModelList(" F_CusTelID=" + id + " ");//ansBLL.GetModelList(" F_TaskID=" + model.F_TaskId.Value + " and F_CusTelID=" + id + " ");
- //var tmodel = otBLL.GetModel(model.F_TaskId.Value);
- //if (tmodel != null)
- //{
- paperid = model.F_PagerID;
- #region 获取问卷试题信息以及答案
- var pmodel = pagerInfoBLL.GetModel(paperid);
- var qlist = questionBLL.GetModelList(" F_DeleteFlag=0 and F_QuestionId in (select F_QuestionId from T_Ask_PagerItems where F_PagerId=" + paperid + ") order by F_QuestionId ");
- var qilist = questionItemBLL.GetModelList(" F_QuestionId in (select F_QuestionId from T_Ask_PagerItems where F_PagerId=" + paperid + ") order by F_ItemId ");
- var newmodel = new
- {
- F_Title = pmodel.F_Title,
- F_Remark = pmodel.F_Remark,
- F_StartText = pmodel.F_StartText,
- F_EndText = pmodel.F_EndText,
- F_Questions = qlist.Select(q =>
- {
- var answers = "";
- var qalist = anslist.Where(al => al.F_QID.Value == q.F_QuestionId).ToList<Model.T_Call_OutAnswers>();
- if (qalist.Count > 0)
- {
- if (q.F_Type > 1)
- {
- foreach (var item in qalist)
- {
- answers += item.F_QIID + "|";
- }
- }
- else
- {
- answers = qalist[0].F_Answer;
- }
- }
- return new
- {
- quesid = q.F_QuestionId,
- questitle = q.F_Title,
- questype = q.F_Type,
- quescontent = q.F_Content,
- quesremark = q.F_Remark,
- quesanswers = answers.Trim('|'),
- quesitems = qilist.Where(qq => qq.F_QuestionId == q.F_QuestionId).Select(qi =>
- {
- return new
- {
- itemid = qi.F_ItemId,
- itemname = qi.F_ItemName,
- itemremark = qi.F_Remark,
- };
- })
- };
- })
- };
- #endregion
- //taskmodel.F_TaskName = tmodel.F_TaskName;//任务名称
- //taskmodel.F_TaskRemark = tmodel.F_TaskRemark;//任务备注
- var objy = new
- {
- taskModel = taskmodel,
- paperModel = newmodel
- };
- return Success("获取详情成功", objy);
- //}
- }
- return Error("获取详情失败");
- }
- #endregion
- #region 科室随访率统计
- //获取数据
- public ActionResult GetSFList(string stime,string etime)
- {
- if (Request.IsAuthenticated)
-
- {
- return Success("获取随访率成功", GetSFData(stime,etime));
- }
- return NoToken("未知错误,请重新登录");
- }
- private DataTable GetSFData(string stime, string etime)
- {
- string sql = "";
- if (stime != null && stime.Trim() != "")
- {
- sql += " and CONVERT(varchar ,CYRQ, 120)>=CONVERT(varchar , '" + stime.Trim() + " 00:00:01', 120) ";
- }
- if (etime != null && etime.Trim() != "")
- {
- sql += " and CONVERT(varchar ,CYRQ, 120)<=CONVERT(varchar , '" + etime.Trim() + " 23:59:59', 120) ";
- }
- DataTable dt = new DataTable();
- dt.Columns.Add("科室");
- dt.Columns.Add("总量");
- dt.Columns.Add("随访量");
- dt.Columns.Add("随访率");
- dt.Columns.Add("rate", typeof(double));
- int zltotal = 0;
- int sfltotal = 0;
- var kslist = DbHelperSQL.Query("select distinct CYKS FROM SF_BINGRENQK").Tables[0];
- var tlist = DbHelperSQL.Query("select count(1) Num,CYKS FROM SF_BINGRENQK where BAH NOT LIKE '%[_]11' "+sql+" group by CYKS").Tables[0];
- var sflist = DbHelperSQL.Query("select CYKS,COUNT(1) Num from SF_BINGRENQK a,SF_Result b where a.BINGRENZYID=b.F_Id and b.F_Result='正常接通' and a.BAH NOT LIKE '%[_]11'" + sql + " group by CYKS").Tables[0];
- foreach (DataRow dr in kslist.Rows)
- {
- var drnew = dt.NewRow();
- var cyks = dr["CYKS"].ToString();
- //心胸外科,肿瘤科,肿瘤科病区,
- string paichuks = "肾病内科,感染性疾病科,肾病内科病区,肾病内科1,感染性疾病科病区,重症医学科(ICU)病区";
- if (paichuks.Contains(cyks))
- {
- //排除这几个科室
- continue;
- }
- drnew["科室"] = cyks;
- var zl = tlist.Select("CYKS='" + cyks + "'").FirstOrDefault()?.ItemArray[0].ToString() ?? "0";
- if (zl != "")
- {
- drnew["总量"] = zl;
- zltotal += Convert.ToInt32(zl);
- var sfl = sflist.Select("CYKS='" + cyks + "'").FirstOrDefault()?.ItemArray[1].ToString() ?? "0";
- drnew["随访量"] = sfl;
- sfltotal += Convert.ToInt32(sfl);
- if (zl == "0" && sfl == "0")
- {
- drnew["rate"] = 0.000001;
- drnew["随访率"] = "0%";
- }
- else
- {
- var Rate = Math.Round(double.Parse(sfl) * 100 / double.Parse(zl), 2);
- drnew["rate"] = Rate;
- drnew["随访率"] = Rate + "%";
- }
- }
- if (zl!= "0")
- {
- dt.Rows.Add(drnew);
- }
-
- }
- DataRow drlast = dt.NewRow();
-
- drlast["科室"] = "总计";
- drlast["总量"] = zltotal;
- drlast["随访量"] = sfltotal;
- drlast["随访率"] = "";
- drlast["rate"] = 0;
- dt.Rows.Add(drlast);
- var dtnew = dt.Select("1=1", "rate desc").CopyToDataTable();
- dtnew.Columns.Remove("rate");
-
- return dtnew;
- }
- /// <summary>
- /// 导出数据
- /// </summary>
- /// <returns></returns>
- public ActionResult ExportExcel(string stime,string etime)
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (Request.IsAuthenticated)
- {
- NPOIHelper npoi = new NPOIHelper();
- DataTable dt = GetSFData(stime,etime);
- dt.Columns.Add("序号").SetOrdinal(0);
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- dt.Rows[i]["序号"] = i + 1;
- }
- if (npoi.ExportToExcel("科室随访率数据", dt) == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- return res;
- }
- //获取图形数据
- public ActionResult GetSFChartData()
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (Request.IsAuthenticated)
- {
- var kslist = DbHelperSQL.Query("select distinct CYKS FROM SF_BINGRENQK").Tables[0];
- var tlist = DbHelperSQL.Query("select count(1) Num,CYKS FROM SF_BINGRENQK group by CYKS").Tables[0];
- var sflist = DbHelperSQL.Query("select CYKS,COUNT(1) Num from SF_BINGRENQK a,SF_Result b where a.BINGRENZYID=b.F_Id and b.F_Result='正常接通' group by CYKS").Tables[0];
- var ksc = kslist.Rows.Count;
- Dictionary<string, double> dics = new Dictionary<string, double>();
- for (int i = 0; i < ksc; i++)
- {
- var cyks = kslist.Rows[i]["CYKS"].ToString();
- var zl = tlist.Select("CYKS='" + cyks + "'").FirstOrDefault()?.ItemArray[0].ToString() ?? "";
- if (zl != "")
- {
- var sfl = sflist.Select("CYKS='" + cyks + "'").FirstOrDefault()?.ItemArray[1].ToString() ?? "0";
- var Rate = Math.Round(double.Parse(sfl) * 100 / double.Parse(zl), 2);
- dics.Add(cyks, Rate);
- }
- }
- dics = dics.OrderByDescending(p => p.Value).ToDictionary(p => p.Key, p => p.Value);
- var obj = new
- {
- ks = dics.Keys,
- rate = dics.Values
- };
- res = Success("获取科室随访数据成功", obj);
- }
- return res;
- }
- #endregion
- #region 满意度
- public ActionResult GetMYDList(string stime,string etime)
- {
- if (Request.IsAuthenticated)
- {
- return Success("获取满意度成功", GetDataMYD(stime,etime));
- }
- return NoToken("未知错误,请重新登录");
- }
- private DataTable GetDataMYD(string stime, string etime)
- {
- DataTable dt = new DataTable();
- dt.Columns.Add("科室");
- dt.Columns.Add("随访量");
- dt.Columns.Add("满意量");
- dt.Columns.Add("满意度");
- dt.Columns.Add("rate", typeof(double));
- string sql = "";
- if (stime != null && stime.Trim() != "")
- {
- sql += " and CONVERT(varchar ,CYRQ, 120)>=CONVERT(varchar , '" + stime.Trim() + " 00:00:01', 120) ";
- }
- if (etime != null && etime.Trim() != "")
- {
- sql += " and CONVERT(varchar ,CYRQ, 120)<=CONVERT(varchar , '" + etime.Trim() + " 23:59:59', 120) ";
- }
- var kslist = DbHelperSQL.Query("select distinct CYKS FROM SF_BINGRENQK").Tables[0];
- var myd = DbHelperSQL.Query("select distinct a.CYKS,COUNT(b.F_MYD) from SF_BINGRENQK a,SF_Result b where a.BINGRENZYID=b.F_Id and b.F_Result='正常接通' and b.F_MYD='满意' and a.BAH NOT LIKE '%[_]11' " + sql +" group by a.CYKS ").Tables[0];
- var sflist = DbHelperSQL.Query("select CYKS,COUNT(1) Num from SF_BINGRENQK a,SF_Result b where a.BINGRENZYID=b.F_Id and b.F_Result='正常接通' and a.BAH NOT LIKE '%[_]11' " + sql + "group by CYKS").Tables[0];
- int sfltotal = 0;
- int myltotal = 0;
- foreach (DataRow dr in kslist.Rows)
- {
- var drnew = dt.NewRow();
- var cyks = dr["CYKS"].ToString();
- //心胸外科,肿瘤科,肿瘤科病区,
- string paichuks = "肾病内科,感染性疾病科,肾病内科病区,肾病内科1,感染性疾病科病区,重症医学科(ICU)病区";
- if (paichuks.Contains(cyks))
- {
- //排除这几个科室
- continue;
- }
- drnew["科室"] = cyks;
- var zl = sflist.Select("CYKS='" + cyks + "'").FirstOrDefault()?.ItemArray[1].ToString() ?? "0";
- if (zl != "")
- {
- drnew["随访量"] = zl;
- sfltotal += Convert.ToInt32(zl);
- var sfl = sflist.Select("CYKS='" + cyks + "'").FirstOrDefault()?.ItemArray[1].ToString() ?? "0";
- var my = myd.Select("CYKS='" + cyks + "'").FirstOrDefault()?.ItemArray[1].ToString() ?? "0";
- drnew["满意量"] = my;
- myltotal += Convert.ToInt32(my);
- if (my == "0" && sfl == "0")
- {
- drnew["rate"] = 0.0000001;
- drnew["满意度"] = "0%";
- }
- else
- {
- var Rate = Math.Round(double.Parse(my) * 100 / double.Parse(sfl), 2);
- drnew["rate"] = Rate;
- drnew["满意度"] = Rate + "%";
- }
- }
- if (zl != "0")
- {
- dt.Rows.Add(drnew);
- }
-
- }
- var drlast= dt.NewRow();
- drlast["科室"] = "总计";
- drlast["随访量"] = sfltotal;
- drlast["满意量"] = myltotal;
- drlast["rate"] = 0;
- drlast["满意度"] = "";
- dt.Rows.Add(drlast);
- var dtnew = dt.Select("1=1", "rate desc").CopyToDataTable();
- dtnew.Columns.Remove("rate");
- return dtnew;
- }
- /// <summary>
- /// 导出
- /// </summary>
- public ActionResult ExportExcelMYD(string stime,string etime)
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (Request.IsAuthenticated)
- {
- NPOIHelper npoi = new NPOIHelper();
- DataTable dt = GetDataMYD(stime,etime);
- dt.Columns.Add("序号").SetOrdinal(0);
- for (int i = 0; i < dt.Rows.Count; i++)
- {
- dt.Rows[i]["序号"] = i + 1;
- }
- if (npoi.ExportToExcel("满意度数据", dt) == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- return res;
- }
- //获取图形数据
- public ActionResult GetMYDData(string mydys)
- {
- ActionResult res = NoToken("未知错误,请重新登录");
- if (Request.IsAuthenticated)
- {
- var kslist = DbHelperSQL.Query("select distinct CYKS FROM SF_BINGRENQK").Tables[0];
- var myd = DbHelperSQL.Query("select distinct a.CYKS,COUNT(b.F_MYD) from SF_BINGRENQK a,SF_Result b where a.BINGRENZYID=b.F_Id and b.F_Result='正常接通' and b.F_MYD='满意' group by a.CYKS ").Tables[0];
- var sflist = DbHelperSQL.Query("select CYKS,COUNT(1) Num from SF_BINGRENQK a,SF_Result b where a.BINGRENZYID=b.F_Id and b.F_Result='正常接通' group by CYKS").Tables[0];
- Dictionary<string, double> dics = new Dictionary<string, double>();
- for (int i = 0; i < kslist.Rows.Count; i++)
- {
- var cyks = kslist.Rows[i]["CYKS"].ToString();
- var sfl = sflist.Select("CYKS='" + cyks + "'").FirstOrDefault()?.ItemArray[1].ToString() ?? "";
- if (sfl != "")
- {
- var my = myd.Select("CYKS='" + cyks + "'").FirstOrDefault()?.ItemArray[1].ToString() ?? "0";
- var Rate = Math.Round(double.Parse(my) * 100 / double.Parse(sfl), 2);
- dics.Add(cyks, Rate);
- }
- }
- dics = dics.OrderByDescending(p => p.Value).ToDictionary(p => p.Key, p => p.Value);
- var obj = new
- {
- ks = dics.Keys,
- rate = dics.Values
- };
- res = Success("获取满意度数据成功", obj);
- }
- return res;
- }
- #endregion
- #region
- // 病人信息加随访登记相关内容
- public ActionResult CreateTask(string taskname,string sdate,string edate,string ryks)
- {
- int userId = CurrentUser.UserData.F_UserId;
-
- string sql = "";
- if (sdate != null && edate != null)
- {
- sql += " RYRQ BETWEEN '" + sdate + "' and '" + edate + "' ";
- }
- if (ryks.Trim() != "" && ryks != "undefined")
- {
- sql += " and RYKS = '" + ryks + "'";
- }
- DataTable dt = DbHelperSQL.Query(" select BINGRENZYID from SF_BINGRENQK where" + sql).Tables[0] ;
- // var modellist = new BLL.SF_BINGRENQK().DataTableToList(ds.Tables[0]);
-
- if (dt.Rows.Count == 0) {
- return Error("创建任务失败,没有符合条件的数据");
- }
- //创建一个task
- var sfTaskModel = new Model.SF_Task();
- sfTaskModel.taskName = taskname;
- sfTaskModel.createTime = DateTime.Now;
- sfTaskModel.createBy = userId;
- int n= taskBLL.Add(sfTaskModel);
-
-
- foreach (DataRow item in dt.Rows)
- {
- var sftaskdetailModel = new Model.SF_TaskDetail();
- sftaskdetailModel.taskID = n;
- sftaskdetailModel.BINGRENZYID = item["BINGRENZYID"].ToString();
- sftaskdetailModel.sfstate = "未随访";
- taskDetailBLL.Add(sftaskdetailModel);
- }
- return Success("创建成功");
- }
- #endregion
- /// <summary>
- /// 获取任务列表
- /// </summary>
- /// <returns></returns>
- public ActionResult GetTaskList(string taskname,string sdate,string edate)
- {
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- string sql = "";
- if (taskname.Trim() != "" && taskname != "undefined")
- {
- sql += " and taskname like '%" + taskname + "%'";
- }
-
- int recordCount = 0;
- DataTable dt = new DataTable();
-
- dt = BLL.PagerBLL.GetListPager(
- "SF_Task",
- "SF_Task.ID",
- "*",
- sql,
- "ORDER BY createTime desc",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 根据taskid 读任务中的病人id 与病人信息表连接查询
- /// </summary>
- /// <param name="taskID"></param>
- /// <returns></returns>
- public ActionResult GetDetailListByTaskID(int taskID,string sfstate)
- {
- string sql = "";
- if (!string.IsNullOrEmpty(sfstate))
- {
- sql += " sfstate='"+ sfstate + "'";
- }
- if (taskID!=0)
- {
- sql += " and taskID='" + taskID + "'";
- }
- var task = new BLL.SF_Task().GetModel(taskID);
- if (task == null)
- {
- return Error("任务ID不存在");
- }
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- int count = 0;
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- DataTable dt = new BLL.SF_TaskDetail().GetALLList(sql, "", (pageindex - 1) * pagesize +1, pagesize * pageindex, out count);
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = count
- };
- return Content(obj.ToJson());
-
-
- }
- #region 病人信息中的问卷回答
- /// <summary>
- ///
- /// </summary>
- /// <param name="taskid">任务ID</param>
- /// <param name="custelid">客户电话ID</param> bingrenzyid
- /// <param name="ans">答案,数组形式["15_20_单选选项内容","17_25|36|58_复选选项内容1|选项内容2|选项内容3","30_0_问答题"]</param>
- /// <param name="hjjgid">呼叫结果</param>
- /// <param name="telphone">电话号码</param>
- /// <param name="name">姓名</param>
- /// <param name="phone">固定号码</param>
- /// <param name="countryid">乡镇id</param>
- /// <param name="address">地址</param>
- /// <returns></returns>
- public ActionResult Answersnew(int taskid, string custelid, string[] ans, int hjjgid,
- string name, string phone, string address, string advise, string satisfied, string praise, string criticism, string blfl, int pagerid = 0, int countryid = 0)
- {
-
- int cc = 0;
- var hjconfig = new BLL.T_Sys_DictionaryValue().GetModel(hjjgid);
- if (hjconfig == null)
- {
- return Error("提交结果配置不正常");
- }
- if (!string.IsNullOrEmpty(custelid))
- {
- var otnModel = busSF_BINGRENQK.GetModel(custelid);
- if (otnModel != null)
- {
- if (!string.IsNullOrEmpty(blfl))
- {
- otnModel.BLFL = blfl;
- // busSF_BINGRENQK.Update(otnModel);
- }
- //物业系统,客户档案信息是存储业主信息的,外呼不需要存储
- //int cusid = saveCus(otnModel.F_Phone, name, phone, countryid, address);
- int cusid = 0;
- #region 保存答案
- var ansModel = new Model.SF_TaskAnswers();
- string askqids = "";
- string ansids = "";
- if (ans != null)
- {
- //先删除 后添加
- // ansnewBLL.DeleteByTelid(custelid, taskid);
- ansModel.F_TaskID = taskid;
- ansModel.F_CusTelID = custelid;
- ansModel.F_CusID = cusid;
- ansModel.F_OptBy = CurrentUser.UserData.F_UserId;
- ansModel.F_OptByName = CurrentUser.UserData.F_UserName;
- ansModel.F_OptOn = DateTime.Now;
- ansModel.F_Expand1 = countryid.ToString();
- ansModel.F_Expand3 = DateTime.Now.ToString("yyyyMMddHHmmssfff");
- #region 循环保存
- foreach (var item in ans)
- {
- var nn = 0;
- var ii = item.Split('_');
- ansModel.F_QID = int.Parse(ii[0]);
- askqids += ii[0] + ",";
- ansids += ii[1] + ",";
- if (ii[1].IndexOf('|') > 0)
- {
- var iii = ii[1].Trim('|').Split('|');
- var iia = ii[2].Trim('|').Split('|');
- for (int i = 0; i < iii.Length; i++)
- {
- ansModel.F_QIID = int.Parse(iii[i]);
- ansModel.F_Answer = iia[i];
- if (ansnewBLL.Add(ansModel) > 0)
- nn++;
- }
- if (nn == iii.Length)
- cc++;
- }
- else
- {
- ansModel.F_QIID = int.Parse(ii[1]);
- ansModel.F_Answer = ii[2];
- if (ansnewBLL.Add(ansModel) > 0)
- cc++;
- }
- }
- #endregion
- }
- #endregion
- #region 保存日志
- BLL.SF_TaskResult busResult = new BLL.SF_TaskResult();
- Model.SF_TaskResult modelResult = busResult.GetModel(custelid.ToString());
- if (modelResult != null)
- {
- busResult.Delete(modelResult.F_Id);
- modelResult.F_SFNum += 1;
- modelResult.F_Remark += "<br/>上次满意度:" + modelResult.F_MYD;
- modelResult.F_Remark += "<br/>上次建议:" + modelResult.F_Advise;
- modelResult.F_Remark += "<br/>上次回访结果" + modelResult.F_Result;
- }
- else
- {
- modelResult = new Model.SF_TaskResult();
- modelResult.F_SFNum = 1;
- }
- modelResult.F_Result = hjconfig.F_Name;
- modelResult.F_Id = custelid.ToString();
- modelResult.F_SFPersion = CurrentUser.UserData.F_UserName;
- modelResult.F_SFPersionId = CurrentUser.UserData.F_UserCode;
- modelResult.F_SFTime = DateTime.Now;
- modelResult.F_Advise = advise;
- modelResult.F_MYD = satisfied;
- modelResult.F_PagerID = pagerid.ToString();
- modelResult.F_Praise = praise;
- modelResult.F_Criticism = criticism;
- modelResult.F_State = 2;
- modelResult.F_TaskID = taskid;
- busResult.Add(modelResult);
- //planrecord(otnModel);
- //修改taskdetail的值
- Model.SF_TaskDetail model = taskDetailBLL.GetModelByTaskIdAndBingrenzyID(taskid, custelid);
- if (model != null)
- {
- model.sfstate = "已随访";
- taskDetailBLL.Update(model);
- }
- #endregion
- }
- }
- if (ans != null)
- {
- if (cc == ans.Length)
- {
- //return Success("问卷答案提交成功!taskid=" + taskid + ",custelid=" + custelid + ",操作人:" + CurrentUser.UserData.F_UserCode);
- return Success("问卷答案提交成功!custelid=" + custelid + ",操作人:" + CurrentUser.UserData.F_UserCode);
- }
- else
- {
- ansBLL.DeleteByTelid(custelid, taskid);
- return Error("问卷答案提交失败!custelid=" + custelid + ",操作人:" + CurrentUser.UserData.F_UserCode);
- }
- }
- else if (hjconfig.F_Name.Contains("正常"))
- {
- return Error("没有问卷答案提交");
- }
- else
- {
- return Success("提交成功!custelid=" + custelid + ",操作人:" + CurrentUser.UserData.F_UserCode);
- }
- }
- #endregion
- public ActionResult GetListByIdNew(string id)
- {
- // int idint = Convert.ToInt32(id);
- DataTable dt = new DataTable();
- dt = taskDetailBLL.GetALLListById(" T1.BINGRENZYID='" + id+"'", "", 0, 1);
- var obj = new
- {
- state = "success",
- message = "成功",
- rows = dt,
- total = 1
- };
- return Content(obj.ToJson());
- }
- }
- }
-
|