using System; using System.Collections.Generic; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; namespace Com.Jpsoft.Hospital.Web.Module.FllowUp.FollowUpRecord { public partial class MZList : Com.Jpsoft.Hospital.Web.Common.BasePage { public double zhjs = 0;//总呼叫 public double yxhj = 0;//有效呼叫 public double gjwj = 0;//关机未接 public double tjkh = 0;//停机空号 public double hmbf = 0;//号码不符 public string yxl = string.Empty;//有效率 protected override void OnInit(EventArgs e) { if (!IsPostBack) { base.AutoCheckRight = false; base.CheckRightParam = Com.Jpsoft.Hospital.Web.Common.PageFuntionType.List; } base.OnInit(e); } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindSFData(); if (!base.CheckRightByFun(Common.PageFuntionType.Print)) { ddlVisitType.SelectedIndex = 1; ddlVisitType.Visible = false; } BindKS(); } // SumSF(); } private void BindKS() { Com.Jpsoft.Hospital.BLL.Ex.ZY_BRSYKEx bll = new BLL.Ex.ZY_BRSYKEx(); DataTable dt = bll.GetYY_KSBMKList(" (name NOT LIKE '%门诊%') AND (name NOT LIKE '%停用%') AND (kslb = 0) "); ddlks.Items.Add(new ListItem("请选择", "")); foreach (DataRow dr in dt.Rows) { ddlks.Items.Add(new ListItem(dr["name"].ToString(), dr["name"].ToString())); } } protected void btnQuery_Click(object sender, EventArgs e) { Query(); } protected void AspNetPager1_PageChanged(object sender, EventArgs e) { BindSFData(); } protected void btnsftj_Click(object sender, EventArgs e) { SFSumMZ(); } /// /// 绑定门诊病人随访记录信息 /// private void BindSFData() { string strWhere = " where 1=1 "; int recordCount = 0; if (!string.IsNullOrEmpty((string)ViewState["SearchTerms"])) { strWhere = ViewState["SearchTerms"].ToString(); } string orderby = " order by mzfr_date DESC"; using (IDataReader idr = BLL.BaseClass.SelectPage("jp_sf_followuprecord", "*", "mzfr_id", AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, strWhere, orderby)) { if (idr.Read()) { recordCount = int.Parse(idr["RecordCount"].ToString()); } AspNetPager1.RecordCount = recordCount; idr.NextResult(); this.GvList.DataSource = idr; this.GvList.DataBind(); } } /// /// 随访统计 /// private void SumSF() { string where = " 1=1 "; if (!string.IsNullOrEmpty((string)ViewState["SearchTerms"])) { where = ViewState["SearchTerms"].ToString(); } //if (txtDate1.Text != "") //{ // where = where + " and date>='" + txtDate1.Text + "' "; //} //if (txtDate2.Text != "") //{ // where = where + " and date<='" + txtDate2.Text + "' "; //} //if (Request.QueryString["typeid"] != null) //{ // where = where + " and type='" + Request.QueryString["typeid"] + "'"; //} //else //{ // where = where + " and (type=1 or type=2) "; //} //where = where + " and customertype='" + ddlCustomerType.SelectedValue + "' "; //where = where + " and mzfr_visitway=1 and mzfr_customertype='" + ddlCustomerType.SelectedValue + "'"; where = where.Replace("where", ""); Com.Jpsoft.Hospital.BLL.Ex.jp_followup_recordEx bll = new Com.Jpsoft.Hospital.BLL.Ex.jp_followup_recordEx(); zhjs = bll.GetListMZ(where).Tables[0].Rows.Count; yxhj = bll.GetListMZ(where + " and mzfr_issuccess=0 ").Tables[0].Rows.Count; gjwj = bll.GetListMZ(where + " and mzfr_issuccess=1 ").Tables[0].Rows.Count; tjkh = bll.GetListMZ(where + " and mzfr_issuccess=2 ").Tables[0].Rows.Count; hmbf = bll.GetListMZ(where + " and mzfr_issuccess=3 ").Tables[0].Rows.Count; double xl = 0;//(yxhj / zhjs)*100; if (zhjs != 0) { xl = (yxhj / zhjs) * 100; } yxl = xl.ToString("F2") + "%"; } /// /// 查询数据 /// private void Query() { StringBuilder strWhere = new StringBuilder(" where 1=1 "); if (!string.IsNullOrEmpty(this.txtDate1.Text)) { strWhere.Append(" and mzfr_date >='" + Convert.ToDateTime(this.txtDate1.Text).ToString("yyyy/MM/dd 00:00:00") + "'"); } if (!string.IsNullOrEmpty(this.txtDate2.Text)) { strWhere.Append(" and mzfr_date <='" + Convert.ToDateTime(this.txtDate2.Text).ToString("yyyy/MM/dd 00:00:00") + "'"); } if (ddlVisitType.SelectedValue != "") { strWhere.Append(" and mzfr_type='" + ddlVisitType.SelectedValue + "' "); } if (ddlks.SelectedValue != "") { strWhere.Append(" and mzfr_ksmc='" + ddlks.SelectedValue + "'"); } if (txtUserName.Text.Trim() != "") { strWhere.Append(" and mzfr_creator='"+txtUserName.Text.Trim()+"'"); } ViewState["SearchTerms"] = strWhere.ToString(); BindSFData(); SumSF(); //if (GvList.Rows.Count != 0) //{ // this.btnExport.Enabled = true; //} //else //{ // this.btnExport.Enabled = false; //} } public string GetVistType(int type) { string result = string.Empty; switch (type) { case 1: result = "客服"; break; case 2: result = "质管"; break; default: result = "未知"; break; } return result; } 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 GetIsSuccess(int isSuccess) { string result = string.Empty; switch (isSuccess) { case 0: result = "是"; break; case 1: 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 SFSumMZ() { base.AutoCheckRight = false; base.CheckRightParam = Com.Jpsoft.Hospital.Web.Common.PageFuntionType.Export; base.CheckRight(); string where = " 1=1 "; if (!string.IsNullOrEmpty((string)ViewState["SearchTerms"])) { where = ViewState["SearchTerms"].ToString(); } else { where += " and mzfr_customertype=1 "; } //if (txtDate1.Text != "") //{ // where = where + " and date>='" + txtDate1.Text + "' "; //} //if (txtDate2.Text != "") //{ // where = where + " and date<='" + txtDate2.Text + "' "; //} where = where + " and mzfr_visitway=1 and mzfr_customertype=1 "; where = where.Replace("where", ""); //where += " order by date desc "; Com.Jpsoft.Hospital.BLL.Ex.jp_followup_recordEx bll = new Com.Jpsoft.Hospital.BLL.Ex.jp_followup_recordEx(); double zhjs1 = bll.GetListMZ(where).Tables[0].Rows.Count; double yxhj1 = bll.GetListMZ(where + " and mzfr_issuccess=0 order by mzfr_date desc ").Tables[0].Rows.Count; double gjwj1 = bll.GetListMZ(where + " and mzfr_issuccess=1 order by mzfr_date desc ").Tables[0].Rows.Count; double tjkh1 = bll.GetListMZ(where + " and mzfr_issuccess=2 order by mzfr_date desc ").Tables[0].Rows.Count; double hmbf1 = bll.GetListMZ(where + " and mzfr_issuccess=3 order by mzfr_date desc ").Tables[0].Rows.Count; double xl = 0;//(yxhj / zhjs)*100; if (zhjs1 != 0) { xl = (yxhj1 / zhjs1) * 100; } string yxl1 = xl.ToString("F2") + "%"; string str0 = "随访结果说明:0表示有效呼叫,1表示关机未接,2表示停机空号,3表示号码不符。"; string str1 = "一、电话随访总呼" + zhjs1 + "位,其中有效呼" + yxhj1 + "位,关机未接" + gjwj1 + "位,停机空号" + tjkh1 + "位 号码不符" + hmbf1 + "位 ,有效率为" + yxl1 + "."; string str2 = "二、涉及科室有:"; DataTable dt = bll.GetListMZR(where).Tables[0]; DataTable dt1 = bll.GetListMZRR(where + " and mzfr_customeridea!='' ").Tables[0]; for (int i = 0; i < dt1.Rows.Count; i++) { if (i < dt1.Rows.Count - 1) { str2 = str2 + dt1.Rows[i]["mzfr_ksmc"].ToString() + ","; } else { str2 = str2 + dt1.Rows[i]["mzfr_ksmc"].ToString() + "。"; } } str2 = str2.Replace(" ", ""); if (dt.Rows.Count > 0) { //初始化报表类 Com.Jpsoft.Hospital.ReportClass.ExcelReports.zybrdhsftj sftjbll = new Com.Jpsoft.Hospital.ReportClass.ExcelReports.zybrdhsftj(txtDate1.Text, txtDate2.Text, str0, str1, str2); //生成并返回报表地址 hysftj.NavigateUrl = Page.ResolveClientUrl(sftjbll.GetReportPath(dt, dt.Rows.Count, "mz")); switch (ddlCustomerType.SelectedValue.ToString()) { case "0": hysftj.Text = "科研随访统计"; break; case "2": hysftj.Text = "门诊病人随访统计"; break; case "1": hysftj.Text = "住院病人随访统计"; break; case "3": hysftj.Text = "潜在客户随访统计"; break; } } else { Response.Write(""); } } } }