Call.aspx.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  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.Data;
  8. using System.Text.RegularExpressions;
  9. namespace Com.Jpsoft.Hospital.Web.Module.FllowUp.MedicalQuality
  10. {
  11. public partial class Call : Com.Jpsoft.Hospital.Web.Common.BasePage//System.Web.UI.Page
  12. {
  13. protected override void OnInit(EventArgs e)
  14. {
  15. if (!IsPostBack)
  16. {
  17. base.AutoCheckRight = false;
  18. base.CheckRightParam = Com.Jpsoft.Hospital.Web.Common.PageFuntionType.Insert;
  19. }
  20. base.OnInit(e);
  21. }
  22. protected void Page_Load(object sender, EventArgs e)
  23. {
  24. txtDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
  25. int uid = 0;
  26. Com.Jpsoft.Hospital.Web.Common.BasePage.GetSession(out uid);
  27. if (uid != 0)
  28. {
  29. Com.Jpsoft.Hospital.BLL.jp_sys_userEx bll = new Com.Jpsoft.Hospital.BLL.jp_sys_userEx();
  30. Com.Jpsoft.Hospital.Model.jp_sys_user model = bll.GetModel(uid);
  31. if (model != null)
  32. {
  33. txtCreater.Text = model.user_name;
  34. }
  35. }
  36. if (!IsPostBack)
  37. {
  38. if (!string.IsNullOrEmpty(Request.QueryString["lxdh"]))
  39. {
  40. this.txtTelPhone.Text = Request.QueryString["lxdh"];
  41. this.able1.Text = CheckPhoneIsAble(this.txtTelPhone.Text);
  42. }
  43. if (!string.IsNullOrEmpty(Request.QueryString["hzxm"]))
  44. {
  45. this.txtCustomerName.Text = Request.QueryString["hzxm"].ToString();
  46. }
  47. int blh = 0;
  48. if (!string.IsNullOrEmpty(Request.QueryString["blh"]))
  49. {
  50. blh = Convert.ToInt32(Request.QueryString["blh"]);
  51. }
  52. Com.Jpsoft.Hospital.BLL.ZY_BRSYK bll = new BLL.ZY_BRSYK();
  53. DataTable dt = bll.GetList(" blh ='" + blh + "' and brzt!='9'");
  54. if (dt.Rows.Count > 0)
  55. {
  56. txtks.Text = new Com.Jpsoft.Hospital.BLL.Ex.ZY_BRSYKEx().GetYY_KSBMKName(dt.Rows[0]["ksdm"].ToString());
  57. txtksdm.Text = dt.Rows[0]["ksdm"].ToString();
  58. txtzyh.Text = blh.ToString();
  59. this.txtTelPhone.Text = dt.Rows[0]["lxrdh"].ToString();
  60. this.able1.Text = CheckPhoneIsAble(this.txtTelPhone.Text);
  61. this.txtCustomerName.Text = dt.Rows[0]["hzxm"].ToString();
  62. }
  63. Com.Jpsoft.Hospital.BLL.Ex.jp_followup_recordEx recordBll = new BLL.Ex.jp_followup_recordEx();
  64. dt = recordBll.GetListZY(" zyh='" + blh + "' and type=1 order by id desc").Tables[0];
  65. if (dt.Rows.Count > 0)
  66. {
  67. lblCumVisitDate.Text = dt.Rows[0]["date"].ToString();
  68. }
  69. dt = recordBll.GetListZY(" zyh='" + blh + "' and type=2 order by id desc").Tables[0];
  70. if (dt.Rows.Count > 0)
  71. {
  72. lblDocVisitDate.Text = dt.Rows[0]["date"].ToString();
  73. }
  74. dt = recordBll.GetListZY(" zyh='" + blh + "' and type=3 order by id desc").Tables[0];
  75. if (dt.Rows.Count > 0)
  76. {
  77. lblMagVisitDate.Text = dt.Rows[0]["date"].ToString();
  78. }
  79. dt = recordBll.GetListZY(" zyh='" + blh + "' and type=4 order by id desc").Tables[0];
  80. if (dt.Rows.Count > 0)
  81. {
  82. lblTFVisitDate.Text = dt.Rows[0]["date"].ToString();
  83. }
  84. int iCurPage = 1;
  85. Com.Jpsoft.Hospital.Web.Common.BasePage.FetchQueryString("LCurPage", out iCurPage);
  86. AspNetPager1.RecordCount = iCurPage * AspNetPager1.PageSize;
  87. AspNetPager1.CurrentPageIndex = iCurPage;
  88. BindData();
  89. ShowList(blh);
  90. }
  91. }
  92. protected void btnReturn_Click(object sender, EventArgs e)
  93. {
  94. //if (!string.IsNullOrEmpty(Request.QueryString["ReturnUrl"]))
  95. //{
  96. // Response.Redirect(Request.QueryString["ReturnUrl"]);
  97. //}
  98. Response.Redirect("InHospital.aspx?curPage=" + Request.QueryString["curPage"].ToString() + "&url=" + Request.Url.LocalPath);
  99. }
  100. //分页
  101. protected void AspNetPager1_PageChanged(object sender, EventArgs e)
  102. {
  103. BindData();
  104. }
  105. /// <summary>
  106. /// 绑定住院就诊信息
  107. /// </summary>
  108. private void BindData()
  109. {
  110. int RecordCount = 0;
  111. string strWhere = " where 1=1 ";
  112. if (!string.IsNullOrEmpty(Request.QueryString["blh"]))
  113. {
  114. strWhere += " and blh = '" + Request.QueryString["blh"] + "' and brzt!='9'";
  115. }
  116. string strOrder = " order by syxh DESC";
  117. Com.Jpsoft.Hospital.BLL.Ex.ZY_BRSYKEx bll = new Com.Jpsoft.Hospital.BLL.Ex.ZY_BRSYKEx();
  118. using (IDataReader idr = bll.SelectPage(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, strWhere, strOrder))
  119. {
  120. if (idr.Read())
  121. {
  122. RecordCount = Convert.ToInt32(idr["RecordCount"]);
  123. }
  124. idr.NextResult();
  125. GridView1.DataSource = idr;
  126. GridView1.DataBind();
  127. }
  128. this.AspNetPager1.RecordCount = RecordCount;
  129. }
  130. protected void Button1_Click(object sender, EventArgs e)
  131. {
  132. Com.Jpsoft.Hospital.BLL.ZY_BRSYK bll = new Com.Jpsoft.Hospital.BLL.ZY_BRSYK();
  133. DataTable dt = bll.GetList("syxh=" + Request.QueryString["id"]);
  134. Response.Redirect("SYList.aspx?id=" + dt.Rows[0]["blh"].ToString());
  135. }
  136. /// <summary>
  137. /// 提交随访结果
  138. /// </summary>
  139. /// <param name="sender"></param>
  140. /// <param name="e"></param>
  141. protected void btnSure_Click(object sender, EventArgs e)
  142. {
  143. if (txtCreater.Text == "随访专员" && rbtnType.SelectedValue=="2")
  144. {
  145. Response.Write("<script>alert('请在随访人员中选择客服!');</script>");
  146. return;
  147. }
  148. if (txtCreater.Text == "护理部" && rbtnType.SelectedValue != "5")
  149. {
  150. Response.Write("<script>alert('请在随访人员中选择客服!');</script>");
  151. return;
  152. }
  153. int type = 0;
  154. string page = Request.QueryString["curPage"].ToString();
  155. string url = Request.Url.LocalPath;
  156. if (!string.IsNullOrEmpty(Request.QueryString["blh"]))
  157. {
  158. type = int.Parse(Request.QueryString["type"].ToString());
  159. this.Add(int.Parse(Request.QueryString["blh"].ToString()), int.Parse(Request.QueryString["type"].ToString()));
  160. if (type == 1)
  161. {
  162. Response.Write("<script>alert('保存成功!');window.location='InHospital.aspx?curPage=" + page + "&url=" + url + "';</script>");
  163. }
  164. else
  165. {
  166. Response.Write("<script>alert('保存成功!');window.location='Outpatient.aspx';</script>");
  167. }
  168. }
  169. else
  170. {
  171. if (type == 1)
  172. {
  173. Response.Write("<script>alert('保存失败!');window.navigate('InHospital.aspx?curPage=" + page + "&url=" + url + "';</script>");
  174. }
  175. else
  176. {
  177. Response.Write("<script>alert('保存成功!');window.location='Outpatient.aspx';</script>");
  178. }
  179. }
  180. }
  181. #region 方法
  182. /// <summary>
  183. /// 添加随访记录
  184. /// </summary>
  185. private void Add(int customerid, int type)
  186. {
  187. Com.Jpsoft.Hospital.BLL.jp_followup_record bll = new Com.Jpsoft.Hospital.BLL.jp_followup_record();
  188. Com.Jpsoft.Hospital.Model.jp_followup_record mode = new Com.Jpsoft.Hospital.Model.jp_followup_record();
  189. mode.customerid = customerid;
  190. mode.visitway = 1;
  191. mode.visitcontent = txtFollowUpContent.Text;
  192. mode.date = DateTime.Now;
  193. mode.customeridea = txtCustomeridea.Text;
  194. mode.customereval = int.Parse(ddlSatisfied.SelectedValue);
  195. mode.creater = txtCreater.Text.Trim();
  196. if (txtNextDate.Text != "")
  197. {
  198. mode.xcsfrq = DateTime.Parse(txtNextDate.Text);
  199. }
  200. mode.type = Convert.ToInt32(rbtnType.SelectedValue);
  201. mode.ksmc = txtksdm.Text;
  202. //mode.ksmc = txtks.Text;
  203. mode.kslxr = txtkslxr.Text;
  204. mode.zyh = txtzyh.Text;
  205. if (rbtnType.SelectedValue == "2")
  206. mode.isyssf = "是";
  207. else
  208. mode.isyssf = "否";
  209. mode.customertype = int.Parse(Request.QueryString["customertypeR"].ToString());
  210. mode.issuccess = int.Parse(RadioButtonList1.SelectedValue);
  211. bll.Add(mode);
  212. }
  213. /// <summary>
  214. /// 返回病人状态
  215. /// </summary>
  216. /// <param name="brzt"></param>
  217. /// <returns></returns>
  218. public string Getbrzt(string brzt)
  219. {
  220. string str = "";
  221. switch (brzt)
  222. {
  223. case "0":
  224. str = "入院登记";
  225. break;
  226. case "1":
  227. str = "病区分床";
  228. break;
  229. case "2":
  230. str = "病区出院";
  231. break;
  232. case "3":
  233. str = "病人出院";
  234. break;
  235. case "4":
  236. str = "取消结算";
  237. break;
  238. case "5":
  239. str = "进入ICU";
  240. break;
  241. case "6":
  242. str = "进入产房";
  243. break;
  244. case "7":
  245. str = "转科状态";
  246. break;
  247. case "8":
  248. str = "数据转出";
  249. break;
  250. case "9":
  251. str = "作废记录";
  252. break;
  253. }
  254. return str;
  255. }
  256. /// <summary>
  257. /// 区域状态
  258. /// </summary>
  259. /// <param name="ycqbz"></param>
  260. /// <returns></returns>
  261. public string Getycqbz(string ycqbz)
  262. {
  263. if (ycqbz == "1")
  264. {
  265. return "预出区";
  266. }
  267. else
  268. {
  269. return "正常";
  270. }
  271. }
  272. /// <summary>
  273. /// 住院状态
  274. /// </summary>
  275. /// <param name="jgbz"></param>
  276. /// <returns></returns>
  277. public string Getjgbz(string jgbz)
  278. {
  279. string str = "";
  280. switch (jgbz)
  281. {
  282. case "0":
  283. str = "住院";
  284. break;
  285. case "1":
  286. str = "在观";
  287. break;
  288. case "2":
  289. str = "出观";
  290. break;
  291. }
  292. return str;
  293. }
  294. public string GetVistWay(int vistWay)
  295. {
  296. string result = string.Empty;
  297. switch (vistWay)
  298. {
  299. case 0:
  300. result = "短信";
  301. break;
  302. case 1:
  303. result = "电话";
  304. break;
  305. default:
  306. result = "未知方式";
  307. break;
  308. }
  309. return result;
  310. }
  311. public string GetVistType(int type)
  312. {
  313. string result = string.Empty;
  314. switch (type)
  315. {
  316. case 0:
  317. result = "科研随访";
  318. break;
  319. case 1:
  320. result = "客服";
  321. break;
  322. case 2:
  323. result = "医生";
  324. break;
  325. case 3:
  326. result = "质管";
  327. break;
  328. case 4:
  329. result = "探访";
  330. break;
  331. case 5:
  332. result = "护理";
  333. break;
  334. default:
  335. result = "未知";
  336. break;
  337. }
  338. return result;
  339. }
  340. public string GetCustomerType(int customerType)
  341. {
  342. string result = string.Empty;
  343. switch (customerType)
  344. {
  345. case 0:
  346. result = "科研随访";
  347. break;
  348. case 1:
  349. result = "住院病人";
  350. break;
  351. case 2:
  352. result = "门诊病人";
  353. break;
  354. case 3:
  355. result = "潜在客户";
  356. break;
  357. default:
  358. result = "未知";
  359. break;
  360. }
  361. return result;
  362. }
  363. /// <summary>
  364. /// 住院状态
  365. /// </summary>
  366. /// <param name="jgbz"></param>
  367. /// <returns></returns>
  368. private void ShowList(int zyh)
  369. {
  370. //zyh = 1474062;
  371. string strWhere = " where zyh = " + zyh;
  372. int recordCount = 0;
  373. string orderby = " order by date DESC";
  374. using (IDataReader idr = BLL.BaseClass.SelectPage("jp_zy_followuprecord", "*", "id", 1, 100, strWhere, orderby))
  375. {
  376. if (idr.Read())
  377. {
  378. recordCount = int.Parse(idr["RecordCount"].ToString());
  379. }
  380. AspNetPager1.RecordCount = recordCount;
  381. idr.NextResult();
  382. this.GridView2.DataSource = idr;
  383. this.GridView2.DataBind();
  384. }
  385. }
  386. /// <summary>
  387. /// 电话号码运营商
  388. /// </summary>
  389. public string CheckPhoneIsAble(string phone)
  390. {
  391. phone = phone.Replace(" ", "").Replace("-", "");
  392. //电信手机号码
  393. string dianxin = @"^1(33|49|53|73|74|77|80|81|89|99)\d{8}";
  394. Regex regexDX = new Regex(dianxin);
  395. //联通手机号码
  396. string liantong = @"^1(30|31|32|45|46|55|56|66|71|75|76|85|86)\d{8}";
  397. Regex regexLT = new Regex(liantong);
  398. //移动手机号码
  399. string yidong = @"^1(34|35|36|37|38|39|47|48|50|51|52|57|58|59|72|78|82|83|84|87|88|98)\d{8}";
  400. Regex regexYD = new Regex(yidong);
  401. if (regexDX.IsMatch(phone))
  402. return "中国电信";
  403. else if (regexLT.IsMatch(phone))
  404. return "中国联通";
  405. else if (regexYD.IsMatch(phone))
  406. return "中国移动";
  407. else
  408. return "电话号码有误!";
  409. }
  410. public string GetIsSuccess(int isSuccess)
  411. {
  412. string result = string.Empty;
  413. switch (isSuccess)
  414. {
  415. case 0:
  416. result = "有效呼叫";
  417. break;
  418. case 1:
  419. result = "关机未接";
  420. break;
  421. case 2:
  422. result = "停机空号";
  423. break;
  424. case 3:
  425. result = "号码不符";
  426. break;
  427. default:
  428. result = "未知方式";
  429. break;
  430. }
  431. return result;
  432. }
  433. #endregion
  434. }
  435. }