MZList.aspx.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.Data;
  8. namespace Com.Jpsoft.Hospital.Web.Module.FllowUp.FollowUpRecord
  9. {
  10. public partial class MZList : Com.Jpsoft.Hospital.Web.Common.BasePage
  11. {
  12. public double zhjs = 0;//总呼叫
  13. public double yxhj = 0;//有效呼叫
  14. public double gjwj = 0;//关机未接
  15. public double tjkh = 0;//停机空号
  16. public double hmbf = 0;//号码不符
  17. public string yxl = string.Empty;//有效率
  18. protected override void OnInit(EventArgs e)
  19. {
  20. if (!IsPostBack)
  21. {
  22. base.AutoCheckRight = false;
  23. base.CheckRightParam = Com.Jpsoft.Hospital.Web.Common.PageFuntionType.List;
  24. }
  25. base.OnInit(e);
  26. }
  27. protected void Page_Load(object sender, EventArgs e)
  28. {
  29. if (!IsPostBack)
  30. {
  31. BindSFData();
  32. if (!base.CheckRightByFun(Common.PageFuntionType.Print))
  33. {
  34. ddlVisitType.SelectedIndex = 1;
  35. ddlVisitType.Visible = false;
  36. }
  37. BindKS();
  38. }
  39. //
  40. SumSF();
  41. }
  42. private void BindKS()
  43. {
  44. Com.Jpsoft.Hospital.BLL.Ex.ZY_BRSYKEx bll = new BLL.Ex.ZY_BRSYKEx();
  45. DataTable dt = bll.GetYY_KSBMKList(" (name NOT LIKE '%门诊%') AND (name NOT LIKE '%停用%') AND (kslb = 0) ");
  46. ddlks.Items.Add(new ListItem("请选择", ""));
  47. foreach (DataRow dr in dt.Rows)
  48. {
  49. ddlks.Items.Add(new ListItem(dr["name"].ToString(), dr["name"].ToString()));
  50. }
  51. }
  52. protected void btnQuery_Click(object sender, EventArgs e)
  53. {
  54. Query();
  55. }
  56. protected void AspNetPager1_PageChanged(object sender, EventArgs e)
  57. {
  58. BindSFData();
  59. }
  60. protected void btnsftj_Click(object sender, EventArgs e)
  61. {
  62. SFSumMZ();
  63. }
  64. /// <summary>
  65. /// 绑定门诊病人随访记录信息
  66. /// </summary>
  67. private void BindSFData()
  68. {
  69. string strWhere = " where 1=1 ";
  70. int recordCount = 0;
  71. if (!string.IsNullOrEmpty((string)ViewState["SearchTerms"]))
  72. {
  73. strWhere = ViewState["SearchTerms"].ToString();
  74. }
  75. string orderby = " order by mzfr_date DESC";
  76. using (IDataReader idr = BLL.BaseClass.SelectPage("jp_sf_followuprecord", "*", "mzfr_id", AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, strWhere, orderby))
  77. {
  78. if (idr.Read())
  79. {
  80. recordCount = int.Parse(idr["RecordCount"].ToString());
  81. }
  82. AspNetPager1.RecordCount = recordCount;
  83. idr.NextResult();
  84. this.GvList.DataSource = idr;
  85. this.GvList.DataBind();
  86. }
  87. }
  88. /// <summary>
  89. /// 随访统计
  90. /// </summary>
  91. private void SumSF()
  92. {
  93. string where = " 1=1 ";
  94. if (!string.IsNullOrEmpty((string)ViewState["SearchTerms"]))
  95. {
  96. where = ViewState["SearchTerms"].ToString();
  97. }
  98. //if (txtDate1.Text != "")
  99. //{
  100. // where = where + " and date>='" + txtDate1.Text + "' ";
  101. //}
  102. //if (txtDate2.Text != "")
  103. //{
  104. // where = where + " and date<='" + txtDate2.Text + "' ";
  105. //}
  106. //if (Request.QueryString["typeid"] != null)
  107. //{
  108. // where = where + " and type='" + Request.QueryString["typeid"] + "'";
  109. //}
  110. //else
  111. //{
  112. // where = where + " and (type=1 or type=2) ";
  113. //}
  114. //where = where + " and customertype='" + ddlCustomerType.SelectedValue + "' ";
  115. //where = where + " and mzfr_visitway=1 and mzfr_customertype='" + ddlCustomerType.SelectedValue + "'";
  116. where = where.Replace("where", "");
  117. Com.Jpsoft.Hospital.BLL.Ex.jp_followup_recordEx bll = new Com.Jpsoft.Hospital.BLL.Ex.jp_followup_recordEx();
  118. zhjs = bll.GetListMZ(where).Tables[0].Rows.Count;
  119. yxhj = bll.GetListMZ(where + " and mzfr_issuccess=0 ").Tables[0].Rows.Count;
  120. gjwj = bll.GetListMZ(where + " and mzfr_issuccess=1 ").Tables[0].Rows.Count;
  121. tjkh = bll.GetListMZ(where + " and mzfr_issuccess=2 ").Tables[0].Rows.Count;
  122. hmbf = bll.GetListMZ(where + " and mzfr_issuccess=3 ").Tables[0].Rows.Count;
  123. double xl = 0;//(yxhj / zhjs)*100;
  124. if (zhjs != 0)
  125. {
  126. xl = (yxhj / zhjs) * 100;
  127. }
  128. yxl = xl.ToString("F2") + "%";
  129. }
  130. /// <summary>
  131. /// 查询数据
  132. /// </summary>
  133. private void Query()
  134. {
  135. StringBuilder strWhere = new StringBuilder(" where 1=1 ");
  136. if (!string.IsNullOrEmpty(this.txtDate1.Text))
  137. {
  138. strWhere.Append(" and mzfr_date >='" + Convert.ToDateTime(this.txtDate1.Text).ToString("yyyy/MM/dd 00:00:00") + "'");
  139. }
  140. if (!string.IsNullOrEmpty(this.txtDate2.Text))
  141. {
  142. strWhere.Append(" and mzfr_date <='" + Convert.ToDateTime(this.txtDate2.Text).ToString("yyyy/MM/dd 00:00:00") + "'");
  143. }
  144. if (ddlVisitType.SelectedValue != "")
  145. {
  146. strWhere.Append(" and mzfr_type='" + ddlVisitType.SelectedValue + "' ");
  147. }
  148. if (ddlks.SelectedValue != "")
  149. {
  150. strWhere.Append(" and mzfr_ksmc='" + ddlks.SelectedValue + "'");
  151. }
  152. if (txtUserName.Text.Trim() != "")
  153. {
  154. strWhere.Append(" and mzfr_creator='"+txtUserName.Text.Trim()+"'");
  155. }
  156. ViewState["SearchTerms"] = strWhere.ToString();
  157. BindSFData();
  158. SumSF();
  159. //if (GvList.Rows.Count != 0)
  160. //{
  161. // this.btnExport.Enabled = true;
  162. //}
  163. //else
  164. //{
  165. // this.btnExport.Enabled = false;
  166. //}
  167. }
  168. public string GetVistType(int type)
  169. {
  170. string result = string.Empty;
  171. switch (type)
  172. {
  173. case 1:
  174. result = "客服";
  175. break;
  176. case 2:
  177. result = "质管";
  178. break;
  179. default:
  180. result = "未知";
  181. break;
  182. }
  183. return result;
  184. }
  185. public string GetVistWay(int vistWay)
  186. {
  187. string result = string.Empty;
  188. switch (vistWay)
  189. {
  190. case 0:
  191. result = "短信";
  192. break;
  193. case 1:
  194. result = "电话";
  195. break;
  196. default:
  197. result = "未知方式";
  198. break;
  199. }
  200. return result;
  201. }
  202. public string GetIsSuccess(int isSuccess)
  203. {
  204. string result = string.Empty;
  205. switch (isSuccess)
  206. {
  207. case 0:
  208. result = "是";
  209. break;
  210. case 1:
  211. result = "否";
  212. break;
  213. default:
  214. result = "未知方式";
  215. break;
  216. }
  217. return result;
  218. }
  219. //public string GetCustomerType(int customerType)
  220. //{
  221. // string result = string.Empty;
  222. // switch (customerType)
  223. // {
  224. // case 0:
  225. // result = "科研随访";
  226. // break;
  227. // case 1:
  228. // result = "住院病人";
  229. // break;
  230. // case 2:
  231. // result = "门诊病人";
  232. // break;
  233. // case 3:
  234. // result = "潜在客户";
  235. // break;
  236. // default:
  237. // result = "未知";
  238. // break;
  239. // }
  240. // return result;
  241. //}
  242. /// <summary>
  243. /// 门诊随访统计
  244. /// </summary>
  245. private void SFSumMZ()
  246. {
  247. base.AutoCheckRight = false;
  248. base.CheckRightParam = Com.Jpsoft.Hospital.Web.Common.PageFuntionType.Export;
  249. base.CheckRight();
  250. string where = " 1=1 ";
  251. if (!string.IsNullOrEmpty((string)ViewState["SearchTerms"]))
  252. {
  253. where = ViewState["SearchTerms"].ToString();
  254. }
  255. else
  256. {
  257. where += " and mzfr_customertype=1 ";
  258. }
  259. //if (txtDate1.Text != "")
  260. //{
  261. // where = where + " and date>='" + txtDate1.Text + "' ";
  262. //}
  263. //if (txtDate2.Text != "")
  264. //{
  265. // where = where + " and date<='" + txtDate2.Text + "' ";
  266. //}
  267. where = where + " and mzfr_visitway=1 and mzfr_customertype=1 ";
  268. where = where.Replace("where", "");
  269. //where += " order by date desc ";
  270. Com.Jpsoft.Hospital.BLL.Ex.jp_followup_recordEx bll = new Com.Jpsoft.Hospital.BLL.Ex.jp_followup_recordEx();
  271. double zhjs1 = bll.GetListMZ(where).Tables[0].Rows.Count;
  272. double yxhj1 = bll.GetListMZ(where + " and mzfr_issuccess=0 order by mzfr_date desc ").Tables[0].Rows.Count;
  273. double gjwj1 = bll.GetListMZ(where + " and mzfr_issuccess=1 order by mzfr_date desc ").Tables[0].Rows.Count;
  274. double tjkh1 = bll.GetListMZ(where + " and mzfr_issuccess=2 order by mzfr_date desc ").Tables[0].Rows.Count;
  275. double hmbf1 = bll.GetListMZ(where + " and mzfr_issuccess=3 order by mzfr_date desc ").Tables[0].Rows.Count;
  276. double xl = 0;//(yxhj / zhjs)*100;
  277. if (zhjs1 != 0)
  278. {
  279. xl = (yxhj1 / zhjs1) * 100;
  280. }
  281. string yxl1 = xl.ToString("F2") + "%";
  282. string str0 = "随访结果说明:0表示有效呼叫,1表示关机未接,2表示停机空号,3表示号码不符。";
  283. string str1 = "一、电话随访总呼" + zhjs1 + "位,其中有效呼" + yxhj1 + "位,关机未接" + gjwj1 + "位,停机空号" + tjkh1 + "位 号码不符" + hmbf1 + "位 ,有效率为" + yxl1 + ".";
  284. string str2 = "二、涉及科室有:";
  285. DataTable dt = bll.GetListMZR(where).Tables[0];
  286. DataTable dt1 = bll.GetListMZRR(where + " and mzfr_customeridea!='' ").Tables[0];
  287. for (int i = 0; i < dt1.Rows.Count; i++)
  288. {
  289. if (i < dt1.Rows.Count - 1)
  290. {
  291. str2 = str2 + dt1.Rows[i]["mzfr_ksmc"].ToString() + ",";
  292. }
  293. else
  294. {
  295. str2 = str2 + dt1.Rows[i]["mzfr_ksmc"].ToString() + "。";
  296. }
  297. }
  298. str2 = str2.Replace(" ", "");
  299. if (dt.Rows.Count > 0)
  300. {
  301. //初始化报表类
  302. Com.Jpsoft.Hospital.ReportClass.ExcelReports.zybrdhsftj sftjbll = new Com.Jpsoft.Hospital.ReportClass.ExcelReports.zybrdhsftj(txtDate1.Text, txtDate2.Text, str0, str1, str2);
  303. //生成并返回报表地址
  304. hysftj.NavigateUrl = Page.ResolveClientUrl(sftjbll.GetReportPath(dt, dt.Rows.Count, "mz"));
  305. switch (ddlCustomerType.SelectedValue.ToString())
  306. {
  307. case "0":
  308. hysftj.Text = "科研随访统计";
  309. break;
  310. case "2":
  311. hysftj.Text = "门诊病人随访统计";
  312. break;
  313. case "1":
  314. hysftj.Text = "住院病人随访统计";
  315. break;
  316. case "3":
  317. hysftj.Text = "潜在客户随访统计";
  318. break;
  319. }
  320. }
  321. else
  322. {
  323. Response.Write("<script>alert('提示:无随访记录!');</script>");
  324. }
  325. }
  326. }
  327. }