using System;
using System.Collections.Generic;
//using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text.RegularExpressions;
namespace Com.Jpsoft.Hospital.Web.Module.FllowUp.MedicalQuality
{
public partial class Call : Com.Jpsoft.Hospital.Web.Common.BasePage//System.Web.UI.Page
{
protected override void OnInit(EventArgs e)
{
if (!IsPostBack)
{
base.AutoCheckRight = false;
base.CheckRightParam = Com.Jpsoft.Hospital.Web.Common.PageFuntionType.Insert;
}
base.OnInit(e);
}
protected void Page_Load(object sender, EventArgs e)
{
txtDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
int uid = 0;
Com.Jpsoft.Hospital.Web.Common.BasePage.GetSession(out uid);
if (uid != 0)
{
Com.Jpsoft.Hospital.BLL.jp_sys_userEx bll = new Com.Jpsoft.Hospital.BLL.jp_sys_userEx();
Com.Jpsoft.Hospital.Model.jp_sys_user model = bll.GetModel(uid);
if (model != null)
{
txtCreater.Text = model.user_name;
}
}
if (!IsPostBack)
{
if (!string.IsNullOrEmpty(Request.QueryString["lxdh"]))
{
this.txtTelPhone.Text = Request.QueryString["lxdh"];
this.able1.Text = CheckPhoneIsAble(this.txtTelPhone.Text);
}
if (!string.IsNullOrEmpty(Request.QueryString["hzxm"]))
{
this.txtCustomerName.Text = Request.QueryString["hzxm"].ToString();
}
int blh = 0;
if (!string.IsNullOrEmpty(Request.QueryString["blh"]))
{
blh = Convert.ToInt32(Request.QueryString["blh"]);
}
Com.Jpsoft.Hospital.BLL.ZY_BRSYK bll = new BLL.ZY_BRSYK();
DataTable dt = bll.GetList(" blh ='" + blh + "' and brzt!='9'");
if (dt.Rows.Count > 0)
{
txtks.Text = new Com.Jpsoft.Hospital.BLL.Ex.ZY_BRSYKEx().GetYY_KSBMKName(dt.Rows[0]["ksdm"].ToString());
txtksdm.Text = dt.Rows[0]["ksdm"].ToString();
txtzyh.Text = blh.ToString();
this.txtTelPhone.Text = dt.Rows[0]["lxrdh"].ToString();
this.able1.Text = CheckPhoneIsAble(this.txtTelPhone.Text);
this.txtCustomerName.Text = dt.Rows[0]["hzxm"].ToString();
}
Com.Jpsoft.Hospital.BLL.Ex.jp_followup_recordEx recordBll = new BLL.Ex.jp_followup_recordEx();
dt = recordBll.GetListZY(" zyh='" + blh + "' and type=1 order by id desc").Tables[0];
if (dt.Rows.Count > 0)
{
lblCumVisitDate.Text = dt.Rows[0]["date"].ToString();
}
dt = recordBll.GetListZY(" zyh='" + blh + "' and type=2 order by id desc").Tables[0];
if (dt.Rows.Count > 0)
{
lblDocVisitDate.Text = dt.Rows[0]["date"].ToString();
}
dt = recordBll.GetListZY(" zyh='" + blh + "' and type=3 order by id desc").Tables[0];
if (dt.Rows.Count > 0)
{
lblMagVisitDate.Text = dt.Rows[0]["date"].ToString();
}
dt = recordBll.GetListZY(" zyh='" + blh + "' and type=4 order by id desc").Tables[0];
if (dt.Rows.Count > 0)
{
lblTFVisitDate.Text = dt.Rows[0]["date"].ToString();
}
int iCurPage = 1;
Com.Jpsoft.Hospital.Web.Common.BasePage.FetchQueryString("LCurPage", out iCurPage);
AspNetPager1.RecordCount = iCurPage * AspNetPager1.PageSize;
AspNetPager1.CurrentPageIndex = iCurPage;
BindData();
ShowList(blh);
}
}
protected void btnReturn_Click(object sender, EventArgs e)
{
//if (!string.IsNullOrEmpty(Request.QueryString["ReturnUrl"]))
//{
// Response.Redirect(Request.QueryString["ReturnUrl"]);
//}
Response.Redirect("InHospital.aspx?curPage=" + Request.QueryString["curPage"].ToString() + "&url=" + Request.Url.LocalPath);
}
//分页
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
BindData();
}
///
/// 绑定住院就诊信息
///
private void BindData()
{
int RecordCount = 0;
string strWhere = " where 1=1 ";
if (!string.IsNullOrEmpty(Request.QueryString["blh"]))
{
strWhere += " and blh = '" + Request.QueryString["blh"] + "' and brzt!='9'";
}
string strOrder = " order by syxh DESC";
Com.Jpsoft.Hospital.BLL.Ex.ZY_BRSYKEx bll = new Com.Jpsoft.Hospital.BLL.Ex.ZY_BRSYKEx();
using (IDataReader idr = bll.SelectPage(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, strWhere, strOrder))
{
if (idr.Read())
{
RecordCount = Convert.ToInt32(idr["RecordCount"]);
}
idr.NextResult();
GridView1.DataSource = idr;
GridView1.DataBind();
}
this.AspNetPager1.RecordCount = RecordCount;
}
protected void Button1_Click(object sender, EventArgs e)
{
Com.Jpsoft.Hospital.BLL.ZY_BRSYK bll = new Com.Jpsoft.Hospital.BLL.ZY_BRSYK();
DataTable dt = bll.GetList("syxh=" + Request.QueryString["id"]);
Response.Redirect("SYList.aspx?id=" + dt.Rows[0]["blh"].ToString());
}
///
/// 提交随访结果
///
///
///
protected void btnSure_Click(object sender, EventArgs e)
{
if (txtCreater.Text == "随访专员" && rbtnType.SelectedValue=="2")
{
Response.Write("");
return;
}
if (txtCreater.Text == "护理部" && rbtnType.SelectedValue != "5")
{
Response.Write("");
return;
}
int type = 0;
string page = Request.QueryString["curPage"].ToString();
string url = Request.Url.LocalPath;
if (!string.IsNullOrEmpty(Request.QueryString["blh"]))
{
type = int.Parse(Request.QueryString["type"].ToString());
this.Add(int.Parse(Request.QueryString["blh"].ToString()), int.Parse(Request.QueryString["type"].ToString()));
if (type == 1)
{
Response.Write("");
}
else
{
Response.Write("");
}
}
else
{
if (type == 1)
{
Response.Write("");
}
else
{
Response.Write("");
}
}
}
#region 方法
///
/// 添加随访记录
///
private void Add(int customerid, int type)
{
Com.Jpsoft.Hospital.BLL.jp_followup_record bll = new Com.Jpsoft.Hospital.BLL.jp_followup_record();
Com.Jpsoft.Hospital.Model.jp_followup_record mode = new Com.Jpsoft.Hospital.Model.jp_followup_record();
mode.customerid = customerid;
mode.visitway = 1;
mode.visitcontent = txtFollowUpContent.Text;
mode.date = DateTime.Now;
mode.customeridea = txtCustomeridea.Text;
mode.customereval = int.Parse(ddlSatisfied.SelectedValue);
mode.creater = txtCreater.Text.Trim();
if (txtNextDate.Text != "")
{
mode.xcsfrq = DateTime.Parse(txtNextDate.Text);
}
mode.type = Convert.ToInt32(rbtnType.SelectedValue);
mode.ksmc = txtksdm.Text;
//mode.ksmc = txtks.Text;
mode.kslxr = txtkslxr.Text;
mode.zyh = txtzyh.Text;
if (rbtnType.SelectedValue == "2")
mode.isyssf = "是";
else
mode.isyssf = "否";
mode.customertype = int.Parse(Request.QueryString["customertypeR"].ToString());
mode.issuccess = int.Parse(RadioButtonList1.SelectedValue);
bll.Add(mode);
}
///
/// 返回病人状态
///
///
///
public string Getbrzt(string brzt)
{
string str = "";
switch (brzt)
{
case "0":
str = "入院登记";
break;
case "1":
str = "病区分床";
break;
case "2":
str = "病区出院";
break;
case "3":
str = "病人出院";
break;
case "4":
str = "取消结算";
break;
case "5":
str = "进入ICU";
break;
case "6":
str = "进入产房";
break;
case "7":
str = "转科状态";
break;
case "8":
str = "数据转出";
break;
case "9":
str = "作废记录";
break;
}
return str;
}
///
/// 区域状态
///
///
///
public string Getycqbz(string ycqbz)
{
if (ycqbz == "1")
{
return "预出区";
}
else
{
return "正常";
}
}
///
/// 住院状态
///
///
///
public string Getjgbz(string jgbz)
{
string str = "";
switch (jgbz)
{
case "0":
str = "住院";
break;
case "1":
str = "在观";
break;
case "2":
str = "出观";
break;
}
return str;
}
public string GetVistWay(int vistWay)
{
string result = string.Empty;
switch (vistWay)
{
case 0:
result = "短信";
break;
case 1:
result = "电话";
break;
default:
result = "未知方式";
break;
}
return result;
}
public string GetVistType(int type)
{
string result = string.Empty;
switch (type)
{
case 0:
result = "科研随访";
break;
case 1:
result = "客服";
break;
case 2:
result = "医生";
break;
case 3:
result = "质管";
break;
case 4:
result = "探访";
break;
case 5:
result = "护理";
break;
default:
result = "未知";
break;
}
return result;
}
public string GetCustomerType(int customerType)
{
string result = string.Empty;
switch (customerType)
{
case 0:
result = "科研随访";
break;
case 1:
result = "住院病人";
break;
case 2:
result = "门诊病人";
break;
case 3:
result = "潜在客户";
break;
default:
result = "未知";
break;
}
return result;
}
///
/// 住院状态
///
///
///
private void ShowList(int zyh)
{
//zyh = 1474062;
string strWhere = " where zyh = " + zyh;
int recordCount = 0;
string orderby = " order by date DESC";
using (IDataReader idr = BLL.BaseClass.SelectPage("jp_zy_followuprecord", "*", "id", 1, 100, strWhere, orderby))
{
if (idr.Read())
{
recordCount = int.Parse(idr["RecordCount"].ToString());
}
AspNetPager1.RecordCount = recordCount;
idr.NextResult();
this.GridView2.DataSource = idr;
this.GridView2.DataBind();
}
}
///
/// 电话号码运营商
///
public string CheckPhoneIsAble(string phone)
{
phone = phone.Replace(" ", "").Replace("-", "");
//电信手机号码
string dianxin = @"^1(33|49|53|73|74|77|80|81|89|99)\d{8}";
Regex regexDX = new Regex(dianxin);
//联通手机号码
string liantong = @"^1(30|31|32|45|46|55|56|66|71|75|76|85|86)\d{8}";
Regex regexLT = new Regex(liantong);
//移动手机号码
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}";
Regex regexYD = new Regex(yidong);
if (regexDX.IsMatch(phone))
return "中国电信";
else if (regexLT.IsMatch(phone))
return "中国联通";
else if (regexYD.IsMatch(phone))
return "中国移动";
else
return "电话号码有误!";
}
public string GetIsSuccess(int isSuccess)
{
string result = string.Empty;
switch (isSuccess)
{
case 0:
result = "有效呼叫";
break;
case 1:
result = "关机未接";
break;
case 2:
result = "停机空号";
break;
case 3:
result = "号码不符";
break;
default:
result = "未知方式";
break;
}
return result;
}
#endregion
}
}