/// <summary> /// 检索事件 /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2013-02-01</date> /// <param name="sender"></param> /// <param name="e"></param> private void txtQuery_EditValueChanged(object sender, EventArgs e) { try { //string searchStr = txtQuery.Text.Trim().Replace("'", "''").Replace("*", "[*]").Replace("%", "[%]").Replace("[", "[[]"); string searchStr = DS_Common.FilterSpecialCharacter(txtQuery.Text); string filter = string.Format(" configkey like '%{0}%' or name like '%{0}%' or value like '%{0}%' or descript like '%{0}%' ", searchStr); DataTable dv = gridControl1.DataSource as DataTable; if (null != dv && dv.Rows.Count > 0) { dv.DefaultView.RowFilter = filter; } //重新绑定数据 add by wangj 2013 2 26 DataRow dataRow = gridView1.GetDataRow(gridView1.FocusedRowHandle); if (null == dataRow) { ClearPage(); } else { SetApp(dataRow); AddControlToMyPanel(dataRow); } } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
private void textEditName_TextChanged(object sender, EventArgs e) { try { string rowFilter = " D_NAME like '%{0}%' or INPUT like '%{0}%'"; m_SourceTable.DefaultView.RowFilter = string.Format(rowFilter, DS_Common.FilterSpecialCharacter(textEditName.Text)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public string userid_check(string userid, ref string user_name) { if (string.IsNullOrEmpty(userid)) { return("用户id为空"); } //IAccount acnt = bizbus.BuildUp<IAccount>(); try { if (userid.Contains("用户已过期")) { m_TempUserID = userid; throw new InvalidUserIdException("用户已过期"); } bool available = true; { if (userid.Trim() != "00") { string extraCodeLong = userid.Trim().Insert(0, "000000"); string strLoginCode = extraCodeLong.Substring(extraCodeLong.Length - 6, 6); // textBoxUserID.Text = strLoginCode; } string username = m_Acnt.GetAUserName(DS_Common.FilterSpecialCharacter(userid), out available); m_TempUserID = userid; if (IsUserPwdNull(userid.Trim()))//允许登录则切换到密码框 { ShowInitPwd(userid.Trim()); } //Add By wwj 2011-06-07 在初始化登录人的Account之后初始化带教老师的Account string masterID = m_Acnt.User.MasterID;//得到带教老师的ID if (!string.IsNullOrEmpty(masterID)) { m_MasterAcnt.InitMaster(masterID);//得到带教老师的帐户信息 } user_name = username; //textBoxUserID.Text = username; } if (!available) { throw new Exception("不存在当前用户"); } return("不存在当前用户"); } catch (Exception ex) { m_Log.Error(ex.Message); return(ex.ToString()); } }
void textBoxUserID_Leave(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBoxUserID.Text)) { return; } try { if (textBoxUserID.Text.Contains("用户已过期")) { m_TempUserID = textBoxUserID.Text; throw new InvalidUserIdException("用户已过期"); } bool available = true; { if (textBoxUserID.Text.Trim() != "00") { string extraCodeLong = textBoxUserID.Text.Trim().Insert(0, "000000"); string strLoginCode = extraCodeLong.Substring(extraCodeLong.Length - 6, 6); textBoxUserID.Text = strLoginCode; } string username = m_Acnt.GetAUserName(DS_Common.FilterSpecialCharacter(textBoxUserID.Text), out available); m_TempUserID = textBoxUserID.Text; if (IsUserPwdNull(textBoxUserID.Text.Trim()))//允许登录则切换到密码框 { ShowInitPwd(textBoxUserID.Text.Trim()); } //Add By wwj 2011-06-07 在初始化登录人的Account之后初始化带教老师的Account string masterID = m_Acnt.User.MasterID;//得到带教老师的ID if (!string.IsNullOrEmpty(masterID)) { m_MasterAcnt.InitMaster(masterID);//得到带教老师的帐户信息 } textBoxUserID.Text = username; } if (!available) { throw new Exception("不存在当前用户"); } } catch (Exception ex) { m_Log.Error(ex.Message); textBoxUserID.Text = ex.Message; textBoxUserID.Focus(); } }
/// <summary> /// 关键字查找 /// 王冀 2012 10 23 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnQurey_Click(object sender, EventArgs e) { try { string key = this.txtQuery.Text.Trim(); string sql; if (key == null || key.Trim() == string.Empty) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("请输入关键字!"); this.txtQuery.Focus(); return; } if (CheckKey(key)) { this.txtQuery.Focus(); return; } //过滤特殊字符串 add by ywk 2013年4月26日11:25:03 string keyStr = DS_Common.FilterSpecialCharacter(key); sql = string.Format(@"select * from DEPTREP where id = {0} AND valid ='1' and title like '%{1}%' ORDER BY NODE ", m_DiagID, keyStr); m_MyTreeNode = null; m_MyTreeNode = m_App.SqlHelper.ExecuteDataTable(sql, CommandType.Text); treeListDiagRep.ClearNodes(); m_HaveBindNode.Clear(); foreach (DataRow dr in m_MyTreeNode.Rows) { if (!m_HaveBindNode.Contains(dr["NODE"].ToString())) { if (m_LeafNode.Contains(dr["node"].ToString())) { LoadLeafList(dr["NODE"].ToString(), dr, null); } else { LoadTreeList(dr["NODE"].ToString(), dr, null); } } } m_HaveBindNode.Clear(); txtQuery.Text = ""; } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
/// <summary> /// 检索方法 /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2013-02-22</date> private void FilterDataSource() { try { DataTable dt = (DataTable)gridControl1.DataSource; if (null == dt || dt.Rows.Count == 0) { return; } string searchStr = DS_Common.FilterSpecialCharacter(this.txt_seach.Text); string filterStr = string.Format(" id like '%{0}%' or mapid like '%{0}%' or name like '%{0}%' or py like '%{0}%' or wb like '%{0}%' or sslbname like '%{0}%' or validName like '%{0}%' or memo like '%{0}%' ", searchStr); dt.DefaultView.RowFilter = filterStr; } catch (Exception ex) { throw ex; } }
/// <summary> /// 检索方法 /// </summary> /// <auth>Yanqiao.Cai</auth> /// <date>2013-02-22</date> private void FilterDataSource() { try { DataTable dt = (DataTable)gridControl1.DataSource; if (null == dt || dt.Rows.Count == 0) { return; } string searchStr = DS_Common.FilterSpecialCharacter(this.txt_search.Text); string filterStr = string.Format(" MARKID like '%{0}%' or ICD like '%{0}%' or MAPID like '%{0}%' or STANDARDCODE like '%{0}%' or NAME like '%{0}%' or py like '%{0}%' or wb like '%{0}%' or TUMORNAME like '%{0}%' or OTHERCATEGROYNAME like '%{0}%' or STATISTNAME like '%{0}%' or INNERCATEGORYNAME like '%{0}%' or CATEGORYNAME like '%{0}%' ", searchStr); dt.DefaultView.RowFilter = filterStr; } catch (Exception ex) { throw ex; } }
/// <summary> /// 搜索 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txt_search_EditValueChanged(object sender, EventArgs e) { try { DataTable dt = (DataTable)gridControl1.DataSource; if (dt != null) { string searchStr = DS_Common.FilterSpecialCharacter(this.txt_search.Text); string filterStr = @" Code like '%" + searchStr + "%' or Name like '%" + searchStr + "%' or PY like '%" + searchStr + "%' or WB like '%" + searchStr + "%'" + " or Valid like '%" + searchStr + "%' or Memo like '%" + searchStr + "%' "; if (!string.IsNullOrEmpty(searchStr) && Tools.IsInt(searchStr)) { filterStr += @" or SortIndex = " + int.Parse(searchStr) + " "; } dt.DefaultView.RowFilter = filterStr; } } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
/// <summary> /// 确定事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButton1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtITEMNAME.Text)) { MyMessageBox.Show("节点名称不能为空", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); txtITEMNAME.Focus(); return; } if (string.IsNullOrEmpty(ContentEdit.Text)) { MyMessageBox.Show("诊断内容不能为空", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); ContentEdit.Focus(); return; } if (Tool.GetByteLength(txtITEMNAME.Text) > 200) { MyMessageBox.Show("节点名称字符长度不能大于200,请重新输入。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); txtITEMNAME.Focus(); return; } if (Tool.GetByteLength(ContentEdit.Text) > 4000) { MyMessageBox.Show("内容字符长度不能大于4000,请重新输入。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); ContentEdit.Focus(); return; } PatRecUtil prUtil = new PatRecUtil(m_App, m_App.CurrentPatientInfo); prUtil.UpdateNodeContent(NID, NodeID, ParentNode, DS_Common.FilterSpecialCharacter(ContentEdit.EditValue.ToString()), DS_Common.FilterSpecialCharacter(txtITEMNAME.Text)); NodeTitle = this.txtITEMNAME.Text; NodeContent = this.ContentEdit.EditValue.ToString(); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }
/// <summary> /// 确定操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButton1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtITEMNAME.Text)) { MyMessageBox.Show("节点名称不能为空", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); txtITEMNAME.Focus(); return; } if (string.IsNullOrEmpty(ContentEdit.Text)) { MyMessageBox.Show("诊断内容不能为空", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); ContentEdit.Focus(); return; } if (Tool.GetByteLength(txtITEMNAME.Text) > 200) { MyMessageBox.Show("子类名称字符长度不能大于200,请重新输入。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); txtITEMNAME.Focus(); return; } if (Tool.GetByteLength(ContentEdit.Text) > 4000) { MyMessageBox.Show("子类名称字符长度不能大于4000,请重新输入。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); ContentEdit.Focus(); return; } PatRecUtil prUtil = new PatRecUtil(m_App, m_App.CurrentPatientInfo); string m_node; string m_parentnode; prUtil.InsertChildNode(DiagID, "node", NodeID, DS_Common.FilterSpecialCharacter(this.txtITEMNAME.Text), DS_Common.FilterSpecialCharacter(this.ContentEdit.Text), "indexid", "1", out m_node, out m_parentnode); this.DialogResult = DialogResult.OK; string m_title; string m_content; SetTitleContent(out m_title, out m_content); SetNodeAndPNode(m_node, m_parentnode); this.Close(); }
/// <summary> /// 确定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButton1_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtITEMNAME.Text)) { return; } if (Tool.GetByteLength(txtITEMNAME.Text) > 200) { MyMessageBox.Show("备注最大字符长度为200,请重新输入。", "提示", MyMessageBoxButtons.Ok, DrectSoft.Common.Ctrs.DLG.MessageBoxIcon.WarningIcon); return; } string m_title; //string m_content; string m_node; string m_parentnode; PatRecUtil prUtil = new PatRecUtil(m_App, m_App.CurrentPatientInfo); if (m_EditState != EditState.Edit) {///新增 prUtil.InsertParentNode(DiagID, NodeID.ToString(), ParentNodeID.ToString(), DS_Common.FilterSpecialCharacter(this.txtITEMNAME.Text), string.Empty, string.Empty, "1", out m_node, out m_parentnode); SetTitleContent(out m_title); SetNodeAndPNode(m_node, m_parentnode); } else {///编辑 prUtil.UpdateParentNode(DiagID, NodeID, ParentNodeID, DS_Common.FilterSpecialCharacter(this.txtITEMNAME.Text), string.Empty); Title = this.txtITEMNAME.Text; } this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
/// <summary> /// 新增大分类 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItemNewRoot_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //新增大分类的时候清空上次的值 ywk m_ItemCatalog = new ItemCatalog(m_app); m_ItemCatalog.BigOrSmallItem = "big"; m_ItemCatalog.CreateUser = m_app.User.Id; m_ItemCatalog.CanChangeFlag = true; m_ItemCatalog.SetContainerCodeEditFlag(true); m_ItemCatalog.SetIsPersonEditFlag(true); if (m_ItemCatalog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { try { string id = Guid.NewGuid().ToString(); //string createuser = ""; //if (m_ItemCatalog.IsPerson == "1")无论新增的是科室小模板还是个人小模板,都往数据库插入创建人 string createuser = m_app.User.Id; sqlHelper.ExecuteNoneQuery(string.Format(sql_insertCatalog, id, DS_Common.FilterSpecialCharacter(m_ItemCatalog.ITEMNAME), string.Empty, 1, DS_Common.FilterSpecialCharacter(m_ItemCatalog.Memo), m_app.User.CurrentDeptId, m_ItemCatalog.ContainerCode, m_ItemCatalog.IsPerson, DS_Common.FilterSpecialCharacter(createuser))); TreeListNode leafnode = treeList1.AppendNode(new object[] { id, m_ItemCatalog.ITEMNAME, "Folder", m_ItemCatalog.IsPerson, m_ItemCatalog.CreateUser, m_ItemCatalog.Memo, m_ItemCatalog.ContainerCode }, null); DataTable dt = sqlHelper.ExecuteDataTable("select * from emrtemplet_item_person_catalog where ID='" + id + "'"); if (null != dt && dt.Rows.Count > 0) { leafnode.Tag = dt.Rows[0]; } //if (treeList1.FocusedNode != null) // treeList1.FocusedNode.ExpandAll(); m_app.CustomMessageBox.MessageShow("新增成功"); treeList1.FocusedNode = leafnode; } catch (Exception EX) { m_app.CustomMessageBox.MessageShow(EX.Message); } } }
/// <summary> /// 绑定数据源 /// edit by ywk 2012年10月9日 15:36:28 /// </summary> public void BindDataSouce(string deptid) { try { if (deptid == null || deptid == "") { deptid = ""; } //只做了2012版本的,没做中医版本的 add by ywk 2013年8月15日 19:58:03 string tablename = DrectSoft.Service.DS_SqlService.GetConfigValueByKey("AutoScoreMainpage"); string[] mainpage = tablename.Split(','); string patname = this.lookUpEditorName.Text.Trim(); //病人姓名 string recordid = this.lookUpEditorRecordID.CodeValue; //住院号 string sexid = radioSex.SelectedIndex == 0 ? "" : radioSex.SelectedIndex.ToString(); string RYtimebegin = dateEditRYbegin.DateTime.Date.ToString("yyyy-MM-dd"); string RYtimeend = dateEditRYend.DateTime.Date.AddDays(1).ToString("yyyy-MM-dd"); string timebegin = dateEditBegin.DateTime.Date.ToString("yyyy-MM-dd"); string timeend = dateEditEnd.DateTime.Date.AddDays(1).ToString("yyyy-MM-dd"); string patid = this.lookUpWindowRecordID.CodeValue;//原来的是 sql_QueryOutHospitalNOSubmit???原来的是错的吧 edit by ywk string LockState = GetLockStatusValue(this.cbxLockStatus.Text).ToString(); DataTable dt = m_app.SqlHelper.ExecuteDataTable(string.Format(SQLUtil.sql_QueryOutHospitalNOLock, mainpage[0], mainpage[2], deptid, sexid, timebegin, timeend, DS_Common.FilterSpecialCharacter(patname), patid, RYtimebegin, RYtimeend, LockState)); //SqlParameter p_result = new SqlParameter("@result", SqlDbType.Structured); //注销 BY JXH 原因是调用存储过程无法使用wmsys.wm_concat(distinct XXX)函数,以致诊断无法串联上,所以SQL语句写程序里 //p_result.Direction = ParameterDirection.Output; //SqlParameter[] sps = //{ //new SqlParameter("@deptId",deptid), //new SqlParameter("@sex",sexid), //new SqlParameter("@dateBegin",timebegin), //new SqlParameter("@dateEnd",timeend), //new SqlParameter("@patName",patname), //new SqlParameter("@PatId",patid), //p_result //}; //SqlHelper.DS_SqlHelper.CreateSqlHelper(); //DataTable dt = SqlHelper.DS_SqlHelper.ExecuteDataTable("emrproc.usp_GetOutHosButNotLocks", sps, CommandType.StoredProcedure); gridControl1.DataSource = dt; labPatCount.Text = dt.Rows.Count.ToString(); } catch (Exception) { throw; } }
/// <summary> /// 绑定数据源 /// add by ywk 2012年10月9日 16:42:54 /// </summary> public void BindDataSouce(string deptid) { if (deptid == null || deptid == "") { deptid = "*"; } //只做了2012版本的,没做中医版本的 add by ywk 2013年8月15日 19:58:03 string tablename = DrectSoft.Service.DS_SqlService.GetConfigValueByKey("AutoScoreMainpage"); string[] mainpage = tablename.Split(','); string patname = this.lookUpEditorName.Text.Trim(); //病人姓名 string patId = this.lookUpEditorRecordID.CodeValue; //住院号 string sexid = radioSex.SelectedIndex == 0 ? "" : radioSex.SelectedIndex.ToString(); string timebegin = dateEditBegin.DateTime.Date.ToString("yyyy-MM-dd"); string timeend = dateEditEnd.DateTime.Date.AddDays(1).ToString("yyyy-MM-dd"); //string patid = this.lookUpWindowRecordID.CodeValue; //DataTable dt = m_app.SqlHelper.ExecuteDataTable(string.Format(SQLUtil.sql_QueryOutHospitalNOSubmit, deptid)); DataTable dt = m_app.SqlHelper.ExecuteDataTable(string.Format(SQLUtil.sql_QueryOutHospitalNOSubmit, mainpage[0], mainpage[2], deptid, sexid, timebegin, timeend, DS_Common.FilterSpecialCharacter(patname), DS_Common.FilterSpecialCharacter(patId))); gridControl1.DataSource = dt; this.labelControlCount.Text = dt.Rows.Count.ToString(); }
/// <summary> /// 新增子分类 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItemNew2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //新增子分类的时候清空上次的值 ywk m_ItemCatalog = new ItemCatalog(m_app); if (treeList1.FocusedNode == null) { m_app.CustomMessageBox.MessageShow("请选择父节点"); return; } if (!treeList1.FocusedNode.GetValue("NODETYPE").ToString().Equals("Folder")) { m_app.CustomMessageBox.MessageShow("请选择分类节点"); return; } string parentID = treeList1.FocusedNode.GetValue("ID").ToString(); string isPerson = treeList1.FocusedNode.GetValue("ISPERSON").ToString(); //分类权限控制 string msg = GetMsgIfNotCreateUser(parentID, null == treeList1.FocusedNode.GetValue("createusers") ? "" : treeList1.FocusedNode.GetValue("createusers").ToString(), 0, 2, int.Parse(isPerson)); if (!string.IsNullOrEmpty(msg)) { m_app.CustomMessageBox.MessageShow(msg); return; } m_ItemCatalog.IsPerson = isPerson; m_ItemCatalog.CreateUser = m_app.User.Id; //treeList1.FocusedNode.GetValue("CREATEUSER").ToString(); m_ItemCatalog.BigOrSmallItem = "small"; string containerCode = null == treeList1.FocusedNode.GetValue("CONTAINER") ? "" : treeList1.FocusedNode.GetValue("CONTAINER").ToString(); if (string.IsNullOrEmpty(containerCode)) { DataRow drow = (DataRow)treeList1.FocusedNode.Tag; containerCode = null == drow ? "" : (null == drow["CONTAINER"] ? "" : drow["CONTAINER"].ToString()); if (string.IsNullOrEmpty(containerCode)) { DataTable dt = m_app.SqlHelper.ExecuteDataTable(" select * from emrtemplet_item_person_catalog where id='" + parentID + "'"); if (null != dt && dt.Rows.Count > 0) { containerCode = null == dt.Rows[0]["CONTAINER"] ? "" : dt.Rows[0]["CONTAINER"].ToString(); } } } m_ItemCatalog.ContainerCode = containerCode; m_ItemCatalog.SetContainerCodeEditFlag(false); m_ItemCatalog.SetIsPersonEditFlag(false); if (m_ItemCatalog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { try { string id = Guid.NewGuid().ToString(); //string createuser = ""; //if (m_ItemCatalog.IsPerson == "1") // createuser = m_app.User.Id; //无论科室小模板还是个人小模板都插入创建人 string createuser = m_app.User.Id; sqlHelper.ExecuteNoneQuery(string.Format(sql_insertCatalog, id, DS_Common.FilterSpecialCharacter(m_ItemCatalog.ITEMNAME), parentID, 1, DS_Common.FilterSpecialCharacter(m_ItemCatalog.Memo), m_app.User.CurrentDeptId, m_ItemCatalog.ContainerCode, m_ItemCatalog.IsPerson, DS_Common.FilterSpecialCharacter(createuser))); TreeListNode leafnode = treeList1.AppendNode(new object[] { id, m_ItemCatalog.ITEMNAME, "Folder", m_ItemCatalog.IsPerson, m_ItemCatalog.CreateUser, m_ItemCatalog.Memo, m_ItemCatalog.ContainerCode }, treeList1.FocusedNode); DataTable dt = sqlHelper.ExecuteDataTable("select * from emrtemplet_item_person_catalog where ID='" + id + "'"); if (null != dt && dt.Rows.Count > 0) { leafnode.Tag = dt.Rows[0]; } m_app.CustomMessageBox.MessageShow("新增成功"); //if (treeList1.FocusedNode != null) // treeList1.FocusedNode.ExpandAll(); treeList1.FocusedNode = leafnode; } catch (Exception EX) { m_app.CustomMessageBox.MessageShow(EX.Message); } } }
/// <summary> /// 刷新数据 - 疾病索引卡 /// Add by wwj 2013-07-29 /// </summary> private void RefreshDiseaseCardData() { try { string sqlStr = @"select distinct i.noofinpat,i.patid,i.name,i.py,i.wb,i.sexid,i.age,i.agestr,i.outbed, case when i.status in(1502,1503) then '出院' else '在院' end as statusname, i.admitdate,i.inwarddate,i.admitdept,d1.name as admitdeptname,i.outhosdate,i.outwarddate,i.outhosdept, (sp.provincename || sc.cityname || sd.districtname || i.xzzdetailaddress) as xzzaddressunion, i.xzzaddress,d2.name as outhosdeptname, imd.diagnosis_code, diag.name DIAGNOSIS_NAME, i.status from inpatient i left join department d1 on i.admitdept=d1.id left join department d2 on i.outhosdept=d2.id left join iem_mainpage_basicinfo_2012 bas on i.noofinpat=bas.noofinpat and bas.valide = '1' left join iem_mainpage_diagnosis_2012 imd on bas.iem_mainpage_no = imd.iem_mainpage_no and imd.valide = '1' left join diagnosis diag on imd.diagnosis_code = diag.icd left join s_province sp on i.xzzproviceid=sp.provinceid left join s_city sc on i.xzzcityid=sc.cityid left join s_district sd on i.xzzdistrictid=sd.districtid where 1=1 "; List <OracleParameter> paramList = new List <OracleParameter>(); if (!string.IsNullOrEmpty(date_InHosBegin.Text)) {///入院开始时间 sqlStr += " and i.inwarddate >= @inwarddatebegin "; OracleParameter param1 = new OracleParameter("inwarddatebegin", OracleType.VarChar); param1.Value = date_InHosBegin.DateTime.ToString("yyyy-MM-dd 00:00:00"); paramList.Add(param1); } if (!string.IsNullOrEmpty(date_InHosEnd.Text)) {///入院结束时间 sqlStr += " and i.inwarddate <= @inwarddateend "; OracleParameter param2 = new OracleParameter("inwarddateend", OracleType.VarChar); param2.Value = date_InHosEnd.DateTime.ToString("yyyy-MM-dd 23:59:59"); paramList.Add(param2); } if (radio_HosState.SelectedIndex == 1) {///在院状态 sqlStr += " and i.status not in(1502,1503) "; } else { string outHosSql = string.Empty; if (!string.IsNullOrEmpty(date_OutHosBegin.Text)) {///出院开始时间 outHosSql += " and i.outwarddate >= @outwarddatebegin "; OracleParameter param3 = new OracleParameter("outwarddatebegin", OracleType.VarChar); param3.Value = date_OutHosBegin.DateTime.ToString("yyyy-MM-dd 00:00:00"); paramList.Add(param3); } if (!string.IsNullOrEmpty(date_OutHosEnd.Text)) {///出院结束时间 outHosSql += " and i.outwarddate <= @outwarddateend "; OracleParameter param4 = new OracleParameter("outwarddateend", OracleType.VarChar); param4.Value = date_OutHosEnd.DateTime.ToString("yyyy-MM-dd 23:59:59"); paramList.Add(param4); } if (!string.IsNullOrEmpty(outHosSql)) { if (radio_HosState.SelectedIndex == 0) {///全部 sqlStr += " and (i.status not in(1502,1503) or (i.status in(1502,1503) " + outHosSql + ") ) "; } else if (radio_HosState.SelectedIndex == 2) {///出院状态 Modified By wwj 2013-08-07 sqlStr += outHosSql + " and i.status in(1502,1503) "; } } } if (!string.IsNullOrEmpty(lookUpEditorDepartment.CodeValue.ToString()) && lookUpEditorDepartment.CodeValue.ToString() != "0000") {///科室 sqlStr += " and i.outhosdept = @outhosdept "; OracleParameter param5 = new OracleParameter("outhosdept", OracleType.VarChar); param5.Value = lookUpEditorDepartment.CodeValue.ToString(); paramList.Add(param5); } if (!string.IsNullOrEmpty(txt_Patid.Text.Trim())) {///住院号 string patid = DS_Common.FilterSpecialCharacter(txt_Patid.Text.Trim()); sqlStr += " and i.patid like '%" + patid + "%' "; } sqlStr += " and imd.diagnosis_code is not null and imd.diagnosis_type_id = '7' order by i.name,i.outwarddate"; DS_Common.InitializeImage_XB(repositoryItemImageXB, imageListBrxb); DataTable dt = DS_SqlHelper.ExecuteDataTable(sqlStr, paramList, CommandType.Text); SetDataTableAllNotSelect(dt); if (null != dt && dt.Rows.Count > 0) { //var rowList = dt.AsEnumerable().GroupBy(p => p["noofinpat"]); //List<DataRow> resultList = new List<DataRow>(); //foreach (var keyAndValue in rowList) //{ // resultList.Add(keyAndValue.FirstOrDefault()); //} //gridControlMain.DataSource = resultList.CopyToDataTable(); //lbl_TotalCount.Text = "共" + resultList.Count() + "条记录"; gridControlMain.DataSource = dt; lbl_TotalCount.Text = "共" + dt.Rows.Count + "条记录"; } else { gridControlMain.DataSource = dt.Clone(); lbl_TotalCount.Text = "共0条记录"; } } catch (Exception) { throw; } }
/// <summary> /// 刷新数据 - 姓名索引卡 /// </summary> private void RefreshNameCardData() { try { string sqlStr = @" select i.noofinpat,i.patid,i.name,i.py,i.wb,i.sexid,i.age,i.agestr,i.outbed, case when i.status in(1502,1503) then '出院' else '在院' end as statusname, i.admitdate,i.inwarddate,i.admitdept,d1.name as admitdeptname,i.outhosdate, i.outwarddate,i.outhosdept, (sp.provincename || sc.cityname || sd.districtname || i.xzzdetailaddress) as xzzaddressunion, i.xzzaddress,d2.name as outhosdeptname,dia.diagnosis_code,dia.diagnosis_name,bas.zg_flag, case bas.zg_flag when '1' then '治愈' when '2' then '好转' when '3' then '未愈' when '4' then '死亡' end zg_name,i.status from inpatient i left join department d1 on i.admitdept=d1.id left join department d2 on i.outhosdept=d2.id left join iem_mainpage_basicinfo_2012 bas on i.noofinpat=bas.noofinpat left join iem_mainpage_diagnosis_2012 dia on bas.iem_mainpage_no=dia.iem_mainpage_no left join s_province sp on i.xzzproviceid=sp.provinceid left join s_city sc on i.xzzcityid=sc.cityid left join s_district sd on i.xzzdistrictid=sd.districtid where 1=1 "; List <OracleParameter> paramList = new List <OracleParameter>(); if (!string.IsNullOrEmpty(date_InHosBegin.Text)) {///入院开始时间 sqlStr += " and i.inwarddate >= @inwarddatebegin "; OracleParameter param1 = new OracleParameter("inwarddatebegin", OracleType.VarChar); param1.Value = date_InHosBegin.DateTime.ToString("yyyy-MM-dd 00:00:00"); paramList.Add(param1); } if (!string.IsNullOrEmpty(date_InHosEnd.Text)) {///入院结束时间 sqlStr += " and i.inwarddate <= @inwarddateend "; OracleParameter param2 = new OracleParameter("inwarddateend", OracleType.VarChar); param2.Value = date_InHosEnd.DateTime.ToString("yyyy-MM-dd 23:59:59"); paramList.Add(param2); } if (radio_HosState.SelectedIndex == 1) {///在院状态 sqlStr += " and i.status not in(1502,1503) "; } else { string outHosSql = string.Empty; if (!string.IsNullOrEmpty(date_OutHosBegin.Text)) {///出院开始时间 outHosSql += " and i.outwarddate >= @outwarddatebegin "; OracleParameter param3 = new OracleParameter("outwarddatebegin", OracleType.VarChar); param3.Value = date_OutHosBegin.DateTime.ToString("yyyy-MM-dd 00:00:00"); paramList.Add(param3); } if (!string.IsNullOrEmpty(date_OutHosEnd.Text)) {///出院结束时间 outHosSql += " and i.outwarddate <= @outwarddateend "; OracleParameter param4 = new OracleParameter("outwarddateend", OracleType.VarChar); param4.Value = date_OutHosEnd.DateTime.ToString("yyyy-MM-dd 23:59:59"); paramList.Add(param4); } if (!string.IsNullOrEmpty(outHosSql)) { if (radio_HosState.SelectedIndex == 0) {///全部 sqlStr += " and (i.status not in(1502,1503) or (i.status in(1502,1503) " + outHosSql + ") ) "; } else if (radio_HosState.SelectedIndex == 2) {///出院状态 Modified By wwj 2013-08-07 sqlStr += outHosSql + " and i.status in(1502,1503) "; } } } if (!string.IsNullOrEmpty(lookUpEditorDepartment.CodeValue.ToString()) && lookUpEditorDepartment.CodeValue.ToString() != "0000") {///科室 sqlStr += " and i.outhosdept = @outhosdept "; OracleParameter param5 = new OracleParameter("outhosdept", OracleType.VarChar); param5.Value = lookUpEditorDepartment.CodeValue.ToString(); paramList.Add(param5); } if (!string.IsNullOrEmpty(txt_Patid.Text.Trim())) {///住院号 string patid = DS_Common.FilterSpecialCharacter(txt_Patid.Text.Trim()); sqlStr += " and i.patid like '%" + patid + "%' "; } sqlStr += " and dia.diagnosis_type_id=7 and dia.valide=1 and bas.valide=1 order by i.name,i.outwarddate,dia.order_value"; DS_Common.InitializeImage_XB(repositoryItemImageXB, imageListBrxb); DataTable dt = DS_SqlHelper.ExecuteDataTable(sqlStr, paramList, CommandType.Text); //在此dt中将姓名拼音码产生更新到PY列 add by ywk 2013年8月30日 11:18:01 for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["PY"] = ChinessConverter.GetPYResultStr(dt.Rows[i]["NAME"].ToString().Trim()); } DataView dv = dt.DefaultView; dv.Sort = "py asc"; dt = dv.ToTable(); SetDataTableAllNotSelect(dt); if (null != dt && dt.Rows.Count > 0) { var rowList = dt.AsEnumerable().GroupBy(p => p["patid"]); List <DataRow> resultList = new List <DataRow>(); foreach (var keyAndValue in rowList) { resultList.Add(keyAndValue.FirstOrDefault()); } gridControlMain.DataSource = resultList.CopyToDataTable(); lbl_TotalCount.Text = "共" + resultList.Count() + "条记录"; } else { gridControlMain.DataSource = dt.Clone(); lbl_TotalCount.Text = "共0条记录"; } } catch (Exception ex) { throw ex; } }