InHospital.aspx.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. using System;
  2. using System.Collections.Generic;
  3. //using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using System.Text;
  8. using System.Data;
  9. namespace Com.Jpsoft.Hospital.Web.Module.FllowUp.MedicalQuality
  10. {
  11. public partial class InHospital : Com.Jpsoft.Hospital.Web.Common.BasePage
  12. {
  13. /// <summary>
  14. /// 获取或设置选中项的集合
  15. /// </summary>
  16. protected Dictionary<string, string> SelectedItems
  17. {
  18. get
  19. {
  20. return (ViewState["mySelectedItems"] != null) ? (Dictionary<string, string>)ViewState["mySelectedItems"] : null;
  21. }
  22. set
  23. {
  24. ViewState["mySelectedItems"] = value;
  25. }
  26. }
  27. #region 事件处理
  28. protected override void OnInit(EventArgs e)
  29. {
  30. if (!IsPostBack)
  31. {
  32. base.AutoCheckRight = false;
  33. base.CheckRightParam = Com.Jpsoft.Hospital.Web.Common.PageFuntionType.List;
  34. }
  35. base.OnInit(e);
  36. }
  37. protected void Page_Load(object sender, EventArgs e)
  38. {
  39. if (!IsPostBack)
  40. {
  41. if ((!string.IsNullOrEmpty(Request.QueryString["date"])) && (!string.IsNullOrEmpty(Request.QueryString["day"])))
  42. {
  43. StringBuilder strWhere = new StringBuilder(" where 1=1 and lxdh != '' ");
  44. DateTime date = DateTime.Parse(Request.QueryString["date"]);
  45. int day = int.Parse(Request.QueryString["day"]);
  46. DateTime date1 = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);
  47. DateTime date2;
  48. if (day == 0)
  49. {
  50. date2 = new DateTime(date.Year, date.Month, date.Day, 23, 59, 59);
  51. }
  52. else
  53. {
  54. date2 = date.AddDays(day);
  55. }
  56. strWhere.Append(" and xcsfrq>='" + date1.ToString() + "' ");
  57. strWhere.Append(" and xcsfrq<='" + date2.ToString() + "' ");
  58. ViewState["SearchTerms"] = strWhere.ToString();
  59. }
  60. if (Request.QueryString["curPage"] != null)
  61. {
  62. AspNetPager1.RecordCount = Convert.ToInt32(Request.QueryString["curPage"].ToString()) * AspNetPager1.PageSize;
  63. AspNetPager1.CurrentPageIndex = Convert.ToInt32(Request.QueryString["curPage"].ToString());
  64. }
  65. BindKS();
  66. BindData(0);
  67. }
  68. else
  69. {
  70. }
  71. }
  72. private void BindKS()
  73. {
  74. Com.Jpsoft.Hospital.BLL.Ex.ZY_BRSYKEx bll = new BLL.Ex.ZY_BRSYKEx();
  75. DataTable dt = bll.GetYY_KSBMKList(" (name NOT LIKE '%门诊%') AND (name NOT LIKE '%停用%') AND (kslb = 0) ");
  76. ddlKS.Items.Add(new ListItem("请选择", ""));
  77. foreach (DataRow dr in dt.Rows)
  78. {
  79. ddlKS.Items.Add(new ListItem(dr["name"].ToString(), dr["id"].ToString()));
  80. }
  81. }
  82. protected void txtQuery_Click(object sender, EventArgs e)
  83. {
  84. Query();
  85. }
  86. protected void btnSendSMS_Click(object sender, EventArgs e)
  87. {
  88. SendSMS();
  89. }
  90. protected void AspNetPager1_PageChanged(object sender, EventArgs e)
  91. {
  92. BindData(1);
  93. }
  94. protected void GvList_DataBinding(object sender, EventArgs e)
  95. {
  96. CollectSelected();
  97. }
  98. protected void GvList_RowDataBound(object sender, GridViewRowEventArgs e)
  99. {
  100. if (e.Row.RowIndex > -1 && this.SelectedItems != null)
  101. {
  102. DataRowView row = e.Row.DataItem as DataRowView;
  103. CheckBox cb = e.Row.FindControl("chbSelect") as CheckBox;
  104. HiddenField hdf = e.Row.FindControl("hdfLxdh") as HiddenField;
  105. HyperLink hyl = e.Row.FindControl("hylTel") as HyperLink;
  106. HyperLink hylSyList = e.Row.FindControl("hylSyList") as HyperLink;
  107. string name = e.Row.Cells[1].Text;
  108. string blh = GvList.DataKeys[e.Row.RowIndex].Value.ToString();
  109. if (this.SelectedItems.ContainsKey(blh))
  110. cb.Checked = true;
  111. else
  112. cb.Checked = false;
  113. string url = Page.ResolveClientUrl("~/Module/FllowUp/MedicalQuality/Call.aspx?customertypeR=1&type=1&blh=" + blh + "&customertype=1&curPage=" + AspNetPager1.CurrentPageIndex);
  114. //hyl.Attributes.Add("onclick", "javascript:openwin('" + url + "'); return false;");
  115. hyl.NavigateUrl = url;
  116. }
  117. }
  118. #endregion
  119. #region 事件方法
  120. /// <summary>
  121. /// 绑定数据
  122. /// </summary>
  123. private void BindData(int page)
  124. {
  125. string strWhere = " where 1=1 ";
  126. string orderby = " order by cqrq DESC";
  127. int recordCount = 0;
  128. if (!string.IsNullOrEmpty((string)ViewState["SearchTerms"]))
  129. {
  130. strWhere = ViewState["SearchTerms"].ToString();
  131. }
  132. if (!string.IsNullOrEmpty((string)ViewState["Order"]))
  133. {
  134. orderby = ViewState["Order"].ToString();
  135. }
  136. if (Request.QueryString["url"] != null)
  137. {
  138. if (page == 0 || page == 1)
  139. {
  140. if ((!string.IsNullOrEmpty((string)Session["Search_InHospital.aspx"]) || !string.IsNullOrEmpty((string)Session["Order_InHospital.aspx"])) && Request.QueryString["url"].ToString().IndexOf("FllowUp/MedicalQuality/Call.aspx") > 0)
  141. {
  142. if (!string.IsNullOrEmpty((string)Session["Search_InHospital.aspx"]))
  143. strWhere = Session["Search_InHospital.aspx"].ToString();
  144. if (!string.IsNullOrEmpty((string)Session["Order_InHospital.aspx"]))
  145. orderby = Session["Order_InHospital.aspx"].ToString();
  146. }
  147. }
  148. else
  149. {
  150. if ((!string.IsNullOrEmpty((string)Session["Search_InHospital.aspx"]) || !string.IsNullOrEmpty((string)Session["Order_InHospital.aspx"])) && Request.QueryString["url"].ToString().IndexOf("FllowUp/MedicalQuality/InHospital.aspx") > 0)
  151. {
  152. if (!string.IsNullOrEmpty((string)Session["Search_InHospital.aspx"]))
  153. strWhere = Session["Search_InHospital.aspx"].ToString();
  154. if (!string.IsNullOrEmpty((string)Session["Order_InHospital.aspx"]))
  155. orderby = Session["Order_InHospital.aspx"].ToString();
  156. }
  157. }
  158. }
  159. using (IDataReader idr = BLL.BaseClass.SelectPage("jp_view_brsyk_ks_zg", "*", "syxh", AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, strWhere, orderby))
  160. {
  161. if (idr.Read())
  162. {
  163. recordCount = int.Parse(idr["RecordCount"].ToString());
  164. }
  165. AspNetPager1.RecordCount = recordCount;
  166. idr.NextResult();
  167. this.GvList.DataSource = idr;
  168. this.GvList.DataBind();
  169. if (!string.IsNullOrEmpty(this.ddlKS.SelectedValue) && txtstart.Text != "" && txtEnd.Text != "")
  170. {
  171. this.labelSFL.Text = getSFL();
  172. }
  173. }
  174. }
  175. /// <summary>
  176. /// 查询数据
  177. /// </summary>
  178. private void Query()
  179. {
  180. StringBuilder strWhere = new StringBuilder(" where 1=1 ");
  181. if (ckbSW.Checked)
  182. {
  183. strWhere.Append(" and cyfs!='3' ");
  184. }
  185. if (ckbDH.Checked)
  186. {
  187. strWhere.Append(" and LEN(lxrdh) = 11 ");
  188. //strWhere.Append(" and (lxrdh not like '133%' and lxrdh not like '149%' and lxrdh not like '153%' and lxrdh not like '173%' and lxrdh not like '174%' and lxrdh not like '177%' and lxrdh not like '180%' and lxrdh not like '181%' and lxrdh not like '189%' and lxrdh not like '199%') ");
  189. }
  190. if (ckbST.Checked)
  191. {
  192. strWhere.Append(" and dateadd(d,3,Convert(datetime,substring(rqrq,1,8)+' '+substring(rqrq,9,8),120))<=Convert(datetime,substring(cqrq,1,8)+' '+substring(cqrq,9,8),120) ");
  193. }
  194. if (ckbFY.Checked)
  195. {
  196. strWhere.Append(" and name not like '西院%' and name not like '肿瘤%' ");
  197. }
  198. if (ckbNY.Checked)
  199. {
  200. strWhere.Append(" and name not like '北院%' ");
  201. }
  202. if (ckbBY.Checked)
  203. {
  204. strWhere.Append(" and (name like '西院%' or name like '肿瘤%' or name like '北院%') ");
  205. }
  206. if (!string.IsNullOrEmpty(this.ddlKS.SelectedValue))
  207. {
  208. strWhere.Append(" and ksdm='" + ddlKS.SelectedValue + "'");
  209. }
  210. if (!string.IsNullOrEmpty(this.txtCardno.Text))
  211. {
  212. strWhere.Append(" and blh='" + this.txtCardno.Text + "' ");
  213. }
  214. if (!string.IsNullOrEmpty(this.txtHzxm.Text))
  215. {
  216. strWhere.Append(" and hzxm like '%" + this.txtHzxm.Text + "%'");
  217. }
  218. if (!string.IsNullOrEmpty(this.txtQtkh.Text))
  219. {
  220. strWhere.Append(" and qtkh like '%" + this.txtQtkh.Text + "%'");
  221. }
  222. if (!string.IsNullOrEmpty(this.txtSbh.Text))
  223. {
  224. strWhere.Append(" and sbh like '%" + this.txtSbh.Text + "%'");
  225. }
  226. if (!string.IsNullOrEmpty(this.txtSfzh.Text))
  227. {
  228. strWhere.Append(" and sfzh like '%" + this.txtSfzh.Text + "%'");
  229. }
  230. if (this.ddlOpSex.SelectedIndex > 0)
  231. {
  232. strWhere.Append(" and sex ='" + this.ddlOpSex.SelectedValue.ToString() + "'");
  233. }
  234. if (txtstart.Text != "")
  235. {
  236. strWhere.Append(" and cqrq>='" + Convert.ToDateTime(txtstart.Text).ToString("yyyyMMdd00:00:00") + "' ");
  237. }
  238. if (txtEnd.Text != "")
  239. {
  240. strWhere.Append(" and cqrq<'" + Convert.ToDateTime(txtEnd.Text).AddDays(1).ToString("yyyyMMdd00:00:00") + "' ");
  241. }
  242. //入区日期
  243. //if (txtouts.Text == "" && txtoute.Text == "")
  244. //{
  245. // strWhere.Append(" and dateadd(d,3,Convert(datetime,substring(rqrq,1,8)+' '+substring(rqrq,9,8),120))<=Convert(datetime,substring(cqrq,1,8)+' '+substring(cqrq,9,8),120) ");
  246. //}
  247. //else
  248. //{
  249. if (txtouts.Text != "")
  250. {
  251. strWhere.Append(" and rqrq>='" + Convert.ToDateTime(txtouts.Text).ToString("yyyyMMdd00:00:00") + "' ");
  252. }
  253. if (txtoute.Text != "")
  254. {
  255. strWhere.Append(" and rqrq<='" + Convert.ToDateTime(txtoute.Text).ToString("yyyyMMdd00:00:00") + "' ");
  256. }
  257. //}
  258. if (txtYSXM.Text != "")
  259. {
  260. strWhere.Append(" and ygxm like '%" + txtYSXM.Text.ToString().Trim() + "%' ");
  261. }
  262. if (txtTel.Text != "")
  263. {
  264. strWhere.Append(" and lxrdh like '%" + txtTel.Text.ToString().Trim() + "%' ");
  265. }
  266. if (txtCYZD.Text != "")
  267. {
  268. strWhere.Append(" and cyzd like '%" + txtCYZD.Text.ToString().Trim() + "%' ");
  269. }
  270. if (txtPageSize.Text != "")
  271. {
  272. int i = 0;
  273. if (int.TryParse(txtPageSize.Text.Trim(), out i))
  274. AspNetPager1.PageSize = i;
  275. }
  276. ViewState["SearchTerms"] = strWhere.ToString();
  277. Session["Search_InHospital.aspx"] = strWhere.ToString();
  278. StringBuilder strOrder = new StringBuilder();
  279. if (!string.IsNullOrEmpty(ddlOrder.SelectedValue))
  280. strOrder.Append(" order by " + ddlOrder.SelectedValue);
  281. ViewState["Order"] = strOrder.ToString();
  282. Session["Order_InHospital.aspx"] = strOrder.ToString();
  283. BindData(0);
  284. }
  285. /// <summary>
  286. /// 统计随访率
  287. /// </summary>
  288. private string getSFL()
  289. {
  290. string str = "出院患者总数:{0}。护理随访人数:{1},护理随访率:{2},护理有效随访人数:{3},护理有效随访率:{4}。医生随访人数:{5},医生随访率:{6},医生有效随访人数:{7},医生有效随访率:{8}。科室随访人数:{9},科室有效随访率:{10}。";
  291. int total = 0;
  292. int hs = 0;
  293. int hsall = 0;
  294. int ys = 0;
  295. int ysall = 0;
  296. int ks = 0;
  297. string sql = "SELECT blh FROM jp_view_brsyk_ks_zg WHERE 1=1 ";
  298. sql += " and ksdm='" + ddlKS.SelectedValue + "'";
  299. if (txtstart.Text != "")
  300. {
  301. sql += " and cqrq>='" + Convert.ToDateTime(txtstart.Text).ToString("yyyyMM0100:00:00") + "' ";
  302. sql += " and cqrq<'" + Convert.ToDateTime(txtstart.Text).AddMonths(1).ToString("yyyyMM0100:00:00") + "' ";
  303. }
  304. if (ckbSW.Checked)
  305. {
  306. sql += " and cyfs!='3' ";
  307. }
  308. if (ckbST.Checked)
  309. {
  310. sql += " and dateadd(d,3,Convert(datetime,substring(rqrq,1,8)+' '+substring(rqrq,9,8),120))<=Convert(datetime,substring(cqrq,1,8)+' '+substring(cqrq,9,8),120) ";
  311. }
  312. if (ckbDH.Checked)
  313. {
  314. sql += " and LEN(lxrdh) = 11 ";
  315. //sql += " and (lxrdh not like '133%' and lxrdh not like '149%' and lxrdh not like '153%' and lxrdh not like '173%' and lxrdh not like '174%' and lxrdh not like '177%' and lxrdh not like '180%' and lxrdh not like '181%' and lxrdh not like '189%' and lxrdh not like '199%') ";
  316. }
  317. DataTable dtRY = BLL.BaseClass.GetTable(sql);
  318. total = dtRY.Rows.Count;
  319. foreach (DataRow drRY in dtRY.Rows)
  320. {
  321. Com.Jpsoft.Hospital.BLL.Ex.jp_followup_recordEx bllRY = new BLL.Ex.jp_followup_recordEx();
  322. string yshfsj = bllRY.GetScsfrq(int.Parse(drRY["blh"].ToString()), 2);
  323. string yshfsj1 = bllRY.GetScsfrq1(int.Parse(drRY["blh"].ToString()), 2);
  324. string hshfsj = bllRY.GetScsfrq(int.Parse(drRY["blh"].ToString()), 5);
  325. string hshfsj1 = bllRY.GetScsfrq1(int.Parse(drRY["blh"].ToString()), 5);
  326. if (yshfsj != "无")
  327. {
  328. ys++;
  329. }
  330. if (yshfsj1 != "无")
  331. {
  332. ysall++;
  333. }
  334. if (hshfsj != "无")
  335. {
  336. hs++;
  337. }
  338. if (hshfsj1 != "无")
  339. {
  340. hsall++;
  341. }
  342. if (yshfsj != "无" || hshfsj != "无")
  343. {
  344. ks++;
  345. }
  346. }
  347. if (total != 0)
  348. {
  349. str = String.Format(str, total, hsall, ((double)hsall / total).ToString("0.00%"), hs, ((double)hs / total).ToString("0.00%"), ysall, ((double)ysall / total).ToString("0.00%"), ys, ((double)ys / total).ToString("0.00%"), ks, ((double)ks / total).ToString("0.00%"));
  350. }
  351. return str;
  352. }
  353. /// <summary>
  354. /// 发送短信
  355. /// </summary>
  356. private void SendSMS()
  357. {
  358. CollectSelected();
  359. if (SelectedItems == null || SelectedItems.Count == 0)
  360. {
  361. Response.Write("<script>alert('请选择一个病人!');</script>");
  362. return;
  363. }
  364. string ids = string.Empty;
  365. foreach (KeyValuePair<string, string> kvp in SelectedItems)
  366. {
  367. ids += ",'" + kvp.Key + "'";
  368. }
  369. if (ids != string.Empty)
  370. {
  371. ids = ids.Substring(1);
  372. }
  373. if (txtNextFollowUpDate.Text != "")
  374. {
  375. DateTime.Parse(txtNextFollowUpDate.Text);
  376. }
  377. Response.Redirect("../SendMsg.aspx?ct=1&ids=" + ids + "&con=" + this.txtSMSContent.Text + "&next=" + txtNextFollowUpDate.Text);
  378. //string msgContent = this.txtSMSContent.Text;
  379. //BLL.jp_followup_record bll = new Com.Jpsoft.Hospital.BLL.jp_followup_record();
  380. //Model.jp_followup_record model;
  381. //foreach (KeyValuePair<string, string> kvp in SelectedItems)
  382. //{
  383. // string msgPhone = kvp.Value;
  384. // try
  385. // {
  386. // if (Common.SMS.SendSMG(msgPhone, msgContent))
  387. // {
  388. // model = new Com.Jpsoft.Hospital.Model.jp_followup_record();
  389. // model.visitway = 0;
  390. // model.visitcontent = msgContent;
  391. // model.date = DateTime.Now;
  392. // model.customerid = int.Parse(kvp.Key);
  393. // if (txtNextFollowUpDate.Text != "")
  394. // {
  395. // model.xcsfrq = DateTime.Parse(txtNextFollowUpDate.Text);
  396. // }
  397. // model.customertype = 1;
  398. // model.ksmc = txtks.Text;
  399. // model.kslxr = txtkslxr.Text;
  400. // model.zyh = txtzyh.Text;
  401. // bll.Add(model);
  402. // }
  403. // }
  404. // catch
  405. // {
  406. // Response.Write("<script>alert('出现错误,请检查!');</script>");
  407. // }
  408. //}
  409. ////if (!string.IsNullOrEmpty(this.txtNextFollowUpDate.Text))
  410. ////{
  411. //// SetNextFollowUpDate();
  412. ////}
  413. //Response.Write("<script>alert('短信发送成功!');</script>");
  414. }
  415. /// <summary>
  416. /// 收集选中项
  417. /// </summary>
  418. protected void CollectSelected()
  419. {
  420. Dictionary<string, string> selectedItems = null;
  421. if (this.SelectedItems == null)
  422. selectedItems = new Dictionary<string, string>();
  423. else
  424. selectedItems = this.SelectedItems;
  425. for (int i = 0; i < this.GvList.Rows.Count; i++)
  426. {
  427. string lxdh = this.GvList.Rows[i].Cells[5].Text;
  428. CheckBox cb = this.GvList.Rows[i].FindControl("chbSelect") as CheckBox;
  429. string patid = this.GvList.DataKeys[i].Value.ToString();
  430. if (selectedItems.ContainsKey(patid) && !cb.Checked)
  431. selectedItems.Remove(patid);
  432. if (!selectedItems.ContainsKey(patid) && cb.Checked)
  433. selectedItems.Add(patid, lxdh);
  434. }
  435. this.SelectedItems = selectedItems;
  436. }
  437. /// <summary>
  438. /// 设置下次随访日期
  439. /// </summary>
  440. protected void SetNextFollowUpDate()
  441. {
  442. CollectSelected();
  443. Jpsoft.Hospital.BLL.Ex.ZY_BRXXKEx zyBll = new Com.Jpsoft.Hospital.BLL.Ex.ZY_BRXXKEx();
  444. if (SelectedItems == null || SelectedItems.Keys.Count == 0)
  445. {
  446. //Response.Write("<script>alert('请选择一个病人!');</script>");
  447. return;
  448. }
  449. foreach (KeyValuePair<string, string> kvp in SelectedItems)
  450. //for (int i = 0; i < SelectedItems.Keys.Count; i++)
  451. {
  452. decimal patid = Convert.ToDecimal(kvp.Key);
  453. DateTime date = DateTime.Parse(this.txtNextFollowUpDate.Text);
  454. zyBll.UpdateFollowUpDate(date, patid);
  455. }
  456. //Response.Write("<script>alert('已成功设置下次随访日期!');</script>");
  457. }
  458. /// <summary>
  459. /// 回访数
  460. /// </summary>
  461. private string KSHF()
  462. {
  463. int total = 0;
  464. int hs = 0;
  465. int ys = 0;
  466. int ks = 0;
  467. string sql = "SELECT blh FROM jp_view_brsyk_ks_zg WHERE 1=1 ";
  468. sql += " and ksdm='" + ddlKS.SelectedValue + "'";
  469. if (txtstart.Text != "")
  470. {
  471. sql += " and cqrq>='" + Convert.ToDateTime(txtstart.Text).ToString("yyyyMMdd00:00:00") + "' ";
  472. sql += " and cqrq<'" + Convert.ToDateTime(txtEnd.Text).ToString("yyyyMMdd00:00:00") + "' ";
  473. }
  474. if (ckbSW.Checked)
  475. {
  476. sql += " and cyfs!='3' ";
  477. }
  478. if (ckbST.Checked)
  479. {
  480. sql += " and dateadd(d,3,Convert(datetime,substring(rqrq,1,8)+' '+substring(rqrq,9,8),120))<=Convert(datetime,substring(cqrq,1,8)+' '+substring(cqrq,9,8),120) ";
  481. }
  482. if (ckbDH.Checked)
  483. {
  484. sql += " and LEN(lxrdh) = 11 ";
  485. }
  486. DataTable dtRY = BLL.BaseClass.GetTable(sql);
  487. total = dtRY.Rows.Count;
  488. foreach (DataRow drRY in dtRY.Rows)
  489. {
  490. Com.Jpsoft.Hospital.BLL.Ex.jp_followup_recordEx bllRY = new BLL.Ex.jp_followup_recordEx();
  491. string yshfsj = bllRY.GetScsfrq(int.Parse(drRY["blh"].ToString()), 2);
  492. string hshfsj = bllRY.GetScsfrq(int.Parse(drRY["blh"].ToString()), 5);
  493. if (yshfsj != "无")
  494. {
  495. ys++;
  496. }
  497. if (hshfsj != "无")
  498. {
  499. hs++;
  500. }
  501. if (yshfsj != "无" || hshfsj != "无")
  502. {
  503. ks++;
  504. }
  505. }
  506. return string.Format("出院患者共{0}人。医师随访{1}人,护士随访{2}人,科室总随访{3}人。", total, ys, hs, ks);
  507. }
  508. #endregion
  509. protected void LinkButton1_Click(object sender, EventArgs e)
  510. {
  511. if (!string.IsNullOrEmpty(this.txtstart.Text) && !string.IsNullOrEmpty(this.txtstart.Text) && !string.IsNullOrEmpty(this.ddlKS.SelectedValue))
  512. {
  513. this.Label1.Text = KSHF();
  514. }
  515. else
  516. {
  517. Response.Write("<script>alert('出区时间及科室必选!');</script>");
  518. }
  519. }
  520. private void exportXls()
  521. {
  522. DataTable dt = new DataTable();
  523. //dt.Columns.Add("科室");
  524. dt.Columns.Add("病人姓名");
  525. dt.Columns.Add("住院号");
  526. dt.Columns.Add("电话号码");
  527. dt.Columns.Add("出院时间");
  528. dt.Columns.Add("护理有效随访");
  529. dt.Columns.Add("医师有效随访");
  530. dt.Columns.Add("科室随访");
  531. int total = 0;
  532. int hs = 0;
  533. int hsall = 0;
  534. int ys = 0;
  535. int ysall = 0;
  536. int ks = 0;
  537. string sql = "SELECT * FROM jp_view_brsyk_ks_zg WHERE 1=1 ";
  538. sql += " and ksdm='" + ddlKS.SelectedValue + "'";
  539. if (txtstart.Text != "")
  540. {
  541. sql += " and cqrq>='" + Convert.ToDateTime(txtstart.Text).ToString("yyyyMM0100:00:00") + "' ";
  542. sql += " and cqrq<'" + Convert.ToDateTime(txtstart.Text).AddMonths(1).ToString("yyyyMM0100:00:00") + "' ";
  543. }
  544. if (ckbSW.Checked)
  545. {
  546. sql += " and cyfs!='3' ";
  547. }
  548. if (ckbST.Checked)
  549. {
  550. sql += " and dateadd(d,3,Convert(datetime,substring(rqrq,1,8)+' '+substring(rqrq,9,8),120))<=Convert(datetime,substring(cqrq,1,8)+' '+substring(cqrq,9,8),120) ";
  551. }
  552. if (ckbDH.Checked)
  553. {
  554. sql += " and LEN(lxrdh) = 11 ";
  555. //sql += " and (lxrdh not like '133%' and lxrdh not like '149%' and lxrdh not like '153%' and lxrdh not like '173%' and lxrdh not like '174%' and lxrdh not like '177%' and lxrdh not like '180%' and lxrdh not like '181%' and lxrdh not like '189%' and lxrdh not like '199%') ";
  556. }
  557. DataTable dtRY = BLL.BaseClass.GetTable(sql);
  558. total = dtRY.Rows.Count;
  559. foreach (DataRow drRY in dtRY.Rows)
  560. {
  561. DataRow dr = dt.NewRow();
  562. //dr["科室"] = Com.Jpsoft.Hospital.BLL.Ex.ZY_BRSYKEx().GetYY_KSBMKName(Eval("ksdm").ToString());
  563. dr["病人姓名"] = drRY["hzxm"];
  564. dr["住院号"] = drRY["blh"];
  565. dr["电话号码"] = drRY["lxrdh"];
  566. dr["出院时间"] = drRY["cqrq"];
  567. Com.Jpsoft.Hospital.BLL.Ex.jp_followup_recordEx bllRY = new BLL.Ex.jp_followup_recordEx();
  568. string yshfsj = bllRY.GetScsfrq(int.Parse(drRY["blh"].ToString()), 2);
  569. string yshfsj1 = bllRY.GetScsfrq1(int.Parse(drRY["blh"].ToString()), 2);
  570. string hshfsj = bllRY.GetScsfrq(int.Parse(drRY["blh"].ToString()), 5);
  571. string hshfsj1 = bllRY.GetScsfrq1(int.Parse(drRY["blh"].ToString()), 5);
  572. if (yshfsj != "无")
  573. {
  574. ys++;
  575. dr["医师有效随访"] = "√";
  576. }
  577. if (yshfsj1 != "无")
  578. {
  579. ysall++;
  580. }
  581. if (hshfsj != "无")
  582. {
  583. hs++;
  584. dr["护理有效随访"] = "√";
  585. }
  586. if (hshfsj1 != "无")
  587. {
  588. hsall++;
  589. }
  590. if (yshfsj != "无" || hshfsj != "无")
  591. {
  592. ks++;
  593. dr["科室随访"] = "√";
  594. }
  595. dt.Rows.Add(dr);
  596. }
  597. if (total != 0)
  598. {
  599. string str = "出院患者总数:{0}。护理随访人数:{1},护理随访率:{2},护理有效随访人数:{3},护理有效随访率:{4}。医生随访人数:{5},医生随访率:{6},医生有效随访人数:{7},医生有效随访率:{8}。科室随访人数:{9},科室有效随访率:{10}。";
  600. str = String.Format(str, total, hsall, ((double)hsall / total).ToString("0.00%"), hs, ((double)hs / total).ToString("0.00%"), ysall, ((double)ysall / total).ToString("0.00%"), ys, ((double)ys / total).ToString("0.00%"), ks, ((double)ks / total).ToString("0.00%"));
  601. DataRow drLast = dt.NewRow();
  602. drLast["病人姓名"] = str;
  603. dt.Rows.Add(drLast);
  604. }
  605. if (dt != null)
  606. {
  607. Session["FileName"] = "医护人员电话随访率";
  608. Session["Report"] = dt;
  609. Response.Redirect("Export.ashx");
  610. }
  611. else
  612. {
  613. Response.Write("<script>alert('请检索,以确定数据存在!');location.href='ReportSFTJ.aspx';</script>");
  614. }
  615. }
  616. protected void btnXls_Click(object sender, EventArgs e)
  617. {
  618. if (!string.IsNullOrEmpty(this.ddlKS.SelectedValue) && txtstart.Text != "" && txtEnd.Text != "")
  619. {
  620. exportXls();
  621. }
  622. else
  623. {
  624. Response.Write("<script>alert('出区时间及科室必选!');</script>");
  625. }
  626. }
  627. }
  628. }