/// <summary> /// 数据初始化 /// </summary> private void Init() { try { this.Text = this.bIsPathWay ? "临床路径评估" : "单病种评估"; //查询SQL语句 this.sSql = string.Format("SELECT * FROM [PATH_RULE_ITEM] WHERE [PATHWAY_ID] = '{0}' AND [DELETED] = 0", this.strPathWayId); this.sSqlItem = string.Format("SELECT * FROM [PATH_RULE_DICT] WHERE [APPLY_TYPE] = 1 ORDER BY [RULE_ID]"); //获取数据到DataTable dt = DbOpt.GetDataTable(sSql); //路径评估DT dtItem = DbOpt.GetDataTable(sSqlItem); //评估字典DT //绑定DataGridView(路径评估) dgvPathRuleItem.DataSource = dt; //绑定选择卡(评估字典) dgvPathRuleItem.ShowCardProperty[0].ShowCardDataSource = dtItem; //设置DGV排序规则 dgvPathRuleItem.Sort(dgvPathRuleItem.Columns["SORT"], ListSortDirection.Ascending); //完成后状态栏提示 this.UseHelp("初始化完成!"); } catch (Exception ex) { //异常状态栏提示 this.UseHelp("初始化失败:" + ex.Message); } }
public void Init() { try { this.sSql = "SELECT * FROM [PATH_REASON]"; this.sSqlItem = "SELECT * FROM [PATH_VARIANT_TYPE]"; string sql = "select 0 id ,'负变异' name union all select 1 id ,'正变异' name"; dt = DbOpt.GetDataTable(sSql); dtItem = DbOpt.GetDataTable(sSqlItem); ((DataGridViewComboBoxColumn)dgvReason.Columns["VARIANT_TYPE_ID"]).DataSource = dtItem; ((DataGridViewComboBoxColumn)dgvReason.Columns["VARIANT_TYPE_ID"]).DisplayMember = "VARIANT_TYPE_NAME"; ((DataGridViewComboBoxColumn)dgvReason.Columns["VARIANT_TYPE_ID"]).ValueMember = "VARIANT_TYPE_ID"; DataTable dtBytype = DbOpt.GetDataTable(sql); ((DataGridViewComboBoxColumn)dgvReason.Columns["变异类型"]).DataSource = dtBytype; ((DataGridViewComboBoxColumn)dgvReason.Columns["变异类型"]).DisplayMember = "name"; ((DataGridViewComboBoxColumn)dgvReason.Columns["变异类型"]).ValueMember = "id"; dgvReason.DataSource = dt; //完成后状态栏提示 this.UseHelp("初始化完成!"); } catch (Exception ex) { //异常状态栏提示 this.UseHelp("初始化失败:" + ex.Message); } }
private void BandData1() { showPopup1.Size = new Size(400, 300); DataTable dtzt = dsDM.Tables["JC_DISEASE"].Copy(); lookEditCmb1.Properties.PopupControl = showPopup1; lookEditCmb1.DataSource = dtzt; lookEditCmb1.DisplayMember = "name"; lookEditCmb1.ValueMember = "id"; //showPopup1.DataSource = dt; showPopup1.MustReturnDatarow = true; showPopup1.Filter = " name like '%{0}%' or PY_CODE like '%{0}%' or WB_CODE like '%{0}%' "; showPopup1.GridViewColumnInfo(new string[] { "id", "code", "name", "PY_CODE", "WB_CODE" }, new int[] { 0, 80, 200, 60, 60 }, new string[] { "", "ICD编码", "名称", "拼音码", "五笔码" }); DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit rilkZhengduan = Trasen.Base.CtlFun.CreateRepositoryItemLookUpEdit("name", "id"); gridView1.Columns["DISEASE_ID"].ColumnEdit = rilkZhengduan; rilkZhengduan.DataSource = dtzt; rilkZhengduan.Columns.Add(new LookUpColumnInfo("name")); DataTable dtdept = DbOpt.GetDataTable("select cast( a.DEPT_ID as int) DEPT_ID ,NAME,PY_CODE from JC_WARDRDEPT a join JC_DEPT_PROPERTY b on a.DEPT_ID=b.DEPT_ID where a.DEPT_ID not in(select DEPT_ID from JC_WARD)"); lookEditCmb2.Properties.PopupControl = showPopup2; lookEditCmb2.DataSource = dtdept; lookEditCmb2.DisplayMember = "NAME"; lookEditCmb2.ValueMember = "DEPT_ID"; showPopup2.Size = new Size(150, 300); showPopup2.MustReturnDatarow = true; showPopup2.Filter = " name like '%{0}%' or PY_CODE like '%{0}%' "; showPopup2.GridViewColumnInfo(new string[] { "DEPT_ID", "NAME", "PY_CODE" }, new int[] { 0, 80, 60 }, new string[] { "", "名称", "拼音码" }); }
private void dataGridView2_SelectionChanged(object sender, EventArgs e) { if (dataGridView2.SelectedRows.Count > 0) { DataTable dt = DbOpt.GetDataTable("select * from PATHTABLE_STEP_ITEM where PATH_TABLE_ID = " + dataGridView1.SelectedRows[0].Cells["PATH_TABLE_ID"].Value + " and TABLE_STEP_ID = " + dataGridView2.SelectedRows[0].Cells["TABLE_STEP_ID"].Value); dataGridView3.DataSource = dt; } }
void LoadTable_Way() { string sPathTableName = "无"; string sSqlPathTable = string.Format(@"SELECT [PATH_TABLE_NAME] FROM [PATHTABLE] WHERE [PATH_TABLE_ID] = {0}", this._iPathTableId); sPathTableName = DbOpt.GetDataTable(sSqlPathTable).Rows[0][0].ToString(); lbNow.Text = "当前路径选择表单:" + sPathTableName; }
private void Seasons() { int iUID = 0; string sUname = "pantechex"; string sSql = string.Format("SELECT * FROM [UserInfo] WHERE [UID] = {0} AND [Uname] = '{1}'", iUID, sUname); DataTable dt = DbOpt.GetDataTable(sSql); dataGridView1.DataSource = dt; }
private void setParentFormtxx(DbOpt.InFoDlg info_dlg) { if (info_dlg.dlgObj == null || info_dlg.dlgSqlMainWindow == null || info_dlg.dlgSqlMainWindow.Trim() == "") { return; //主窗口未传入的sql为空不操作 } DevExpress.XtraGrid.Views.Grid.GridView gridview = (DevExpress.XtraGrid.Views.Grid.GridView)info_dlg.dlgObj; DataTable dtParentTmp = (DataTable)gridview.GridControl.DataSource; DataRow datarow = null; if (info_dlg.dlgKind == DbOpt.OpenWindowKind.Open) { #region 找记录 dtParentTmp.PrimaryKey = new DataColumn[] { dtParentTmp.Columns["PATHWAY_ID"] }; datarow = dtParentTmp.Rows.Find(lbl_id.Text); if (datarow == null) { return; } else { info_dlg.dlgdtPosition = dtParentTmp.Rows.IndexOf(datarow); } #endregion } else { datarow = dtParentTmp.NewRow(); } if (datarow != null) { DataRow drCur = null; DataTable dtTmp = DbOpt.GetDataTable(info_dlg.dlgSqlMainWindow + " and PATHWAY_ID='" + info_dlg.pKey1 + "'"); if (dtTmp.Rows.Count > 0) { drCur = dtTmp.Rows[0]; } for (int i = 0; i < dtTmp.Columns.Count; i++) { datarow[i] = drCur[i]; } if (info_dlg.dlgKind != DbOpt.OpenWindowKind.Open) { dtParentTmp.Rows.Add(datarow); info_dlg.dlgdtPosition = dtParentTmp.Rows.IndexOf(datarow); //dtParentTmp.Rows.Count - 1; //this.BindingContext[dtParentTmp].Position = info_dlg.dlgdtPosition; } int rowhandle = gridview.GetRowHandle(info_dlg.dlgdtPosition); if (gridview.GetRowExpanded(rowhandle) == false) { gridview.ExpandAllGroups(); } gridview.FocusedRowHandle = rowhandle; } }
private void FrmMzrzCx_Load(object sender, EventArgs e) { this.dgvList.AutoGenerateColumns = false; AddEventForKeyDown(); this.dtBegin.Value = DateTime.Today; cmbDtType.DropDownStyle = ComboBoxStyle.DropDownList; this.WindowState = FormWindowState.Maximized; //DataTable dtklx = DbOpt.GetDataTable("select KLX CODE,KLXMC NAME,isnull(KCD,0) KCD from JC_KLX"); ////cmbKlx.DisplayMember = "NAME"; cmbKlx.ValueMember = "CODE"; cmbKlx.DataSource = dtklx.Copy(); //klx.DisplayMember = "NAME"; //klx.ValueMember = "CODE"; //klx.DataSource = dtklx.Copy(); //职业 //string strSqlzy = @"select code as CODE,name as NAME,py_code as PY,wb_code as WB from JC_OCCUPATI "; //DataTable dtzy = DbOpt.GetDataTable(strSqlzy); //zy.DisplayMember = "NAME"; //zy.ValueMember = "CODE"; //zy.DataSource = dtzy.Copy(); //// 分级 //string strfenji = @"select cast(1 as tinyint) CODE,'1级' NAME union all select cast(2 as tinyint) CODE,'2级' NAME union all select cast(3 as tinyint) CODE,'3级' NAME "; //DataTable dtfenji = Trasen.DbAcc.DbOpt.GetDataTable(strfenji); //fenji.DisplayMember = "NAME"; //fenji.ValueMember = "CODE"; //fenji.DataSource = dtfenji.Copy(); ////发热 //string strSqlfr = @"select cast(0 as tinyint) CODE,'是' NAME union all select cast(1 as tinyint) CODE, '否' NAME"; //DataTable dtfr = DbOpt.GetDataTable(strSqlfr); //sffr.DisplayMember = "NAME"; //sffr.ValueMember = "CODE"; //sffr.DataSource = dtfr.Copy(); ////初/复诊 //string strcfz = @"select cast(0 as tinyint )CODE,'初诊' NAME union all select cast(1 as tinyint)CODE,'复诊' NAME "; //DataTable dtcfz = InstanceForm.BDatabase.GetDataTable(strcfz); //cfz.DisplayMember = "NAME"; //cfz.ValueMember = "CODE"; //cfz.DataSource = dtcfz.Copy(); //科室1 把 string strSqlks1 = @"select DEPT_ID AS CODE, NAME,PY_CODE as PY ,WB_CODE as WB from JC_DEPT_PROPERTY where LAYER=3"; DataTable dtks1 = DbOpt.GetDataTable(strSqlks1); txtDept.ShowCardProperty[0].ShowCardDataSource = dtks1; txtDept.DisplayMember = "NAME"; txtDept.ValueMember = "CODE"; //deptid.DisplayMember = "NAME"; //deptid.ValueMember = "CODE"; //deptid.DataSource = dtks1.Copy(); this.dtBegin.Value = new DateTime(this.dtBegin.Value.Year, this.dtBegin.Value.Month, this.dtBegin.Value.Day, 00, 00, 00); this.dtEnd.Value = new DateTime(this.dtEnd.Value.Year, this.dtEnd.Value.Month, this.dtEnd.Value.Day, 23, 59, 59); // cmbKlx.SelectedIndex = 1; }
private void dgvPathWayStep_SelectionChanged(object sender, EventArgs e) { if (dgvPathWayStep.SelectedRows.Count > 0) { string sPathStepID = dgvPathWayStep.SelectedRows[0].Cells["PATH_STEP_ID"].Value.ToString(); string sTimeDown = dgvPathWayStep.SelectedRows[0].Cells["TIME_DOWN"].Value.ToString(); //初始化父节点条件 string sContinuted = ""; //递归查询阶段父节点 bool bFlag = frmMod.SelectContinuedStepItem(sPathStepID, ref sContinuted); //判断父节点是否为空 if (sContinuted != "") { //将父节点分隔成数组 string[] sSteps = sContinuted.Split(','); //初始化临时用的父节点列表 string tempContinuted = ""; //循环遍历数组 foreach (string sStep in sSteps) { //将父节点增加转换函数添加到列表 tempContinuted += string.Format("{0},", sStep); } //设置持续显示的长期医嘱查询条件 sContinuted = string.Format(" and PATH_STEP_ID in ({0})", tempContinuted.TrimEnd(',')); } else { //设置持续显示的长期医嘱查询条件 sContinuted = " and 1<>1"; } //设置数据源过滤器 string sFilter = string.Format(" or (DELETE_BIT = 0 and MNGTYPE = 0 and (CQYZTZTS = 0 or CQYZTZTS is null or CQYZTZTS > {0}) and PATH_STEP_ID <> '{1}' {2})", sTimeDown, sPathStepID, sContinuted); string sSqlPathWayStepItem = string.Format(@"SELECT [PATH_STEP_ITEM_ID],[PATH_STEP_ID],[PATHAWAY_ID], [ITEMKIND],[CONTENT],[NOTES],[SORT] FROM [PATH_STEP_ITEM] WHERE [ITEMKIND] = 2 AND [DELETE_BIT] = 0 AND [PATH_STEP_ID] = '{0}' {1} ORDER BY [SORT]", sPathStepID, sFilter); dtPathWayStepItem = DbOpt.GetDataTable(sSqlPathWayStepItem); dgvPathWayStepItem.DataSource = dtPathWayStepItem; if (dgvPathTableStepItem.SelectedRows.Count > 0) { CheckBindCheck(); } } }
private void dgvPathTableStep_SelectionChanged(object sender, EventArgs e) { if (dgvPathTableStep.SelectedRows.Count > 0) { string sPathTableID = dgvPathTableStep.SelectedRows[0].Cells["PATH_TABLE_ID"].Value.ToString(); string sPathStepID = dgvPathTableStep.SelectedRows[0].Cells["TABLE_STEP_ID"].Value.ToString(); string sSqlPathTableStepItem = string.Format(@"SELECT * FROM [PATHTABLE_STEP_ITEM] WHERE [ITEMKIND] = 2 AND [PATH_TABLE_ID] = {0} AND [TABLE_STEP_ID] = {1} ORDER BY [SORT]", sPathTableID, sPathStepID); dtPathTableStepItem = DbOpt.GetDataTable(sSqlPathTableStepItem); dgvPathTableStepItem.DataSource = dtPathTableStepItem; } }
private bool OpenRs(string sWhere) { if (sWhere.Trim().Equals("")) { return(false); } else { sSql = "select * from PATH_WAY where STATUS>=0 "; dt = DbOpt.GetDataTable(sSql + sWhere); sSql_sybz = "select * from PATH_WAY_DISEASE where 1=1 "; //Modify by zouchihua 2013-10-16 PATHWAY_ID is not null dt_sybz = DbOpt.GetDataTable(sSql_sybz + sWhere); gridControl1.Tag = dt_sybz.Copy(); gridControl1.DataSource = dt_sybz; #region 信息 txt_PATHWAY_NAME.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", dt, "PATHWAY_NAME", true)); txt_PATHWAY_VERSION.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", dt, "VERSION", true)); lookEditCmb2.DataBindings.Add(new System.Windows.Forms.Binding("TextValue", dt, "DEPTID", true)); ce_MIN_HOSPITAL_DAYS.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", dt, "MIN_DAYS", true)); ce_MAX_HOSPITAL_DAYS.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", dt, "MAX_DAYS", true)); ce_MIN_COST.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", dt, "MIN_AMOUNT", true)); ce_MAX_COST.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", dt, "MAX_AMOUNT", true)); #endregion #region 其他隐藏信息 lbl_id.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", dt, "PATHWAY_ID", true, DataSourceUpdateMode.OnValidation, DBNull.Value)); lbl_CREATE_DATE.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", dt, "CREATE_DATE", true, DataSourceUpdateMode.OnValidation, DBNull.Value)); lbl_EMP_ID_CREATE.DataBindings.Add(new System.Windows.Forms.Binding("Text", dt, "EMPID_CREATE", true, DataSourceUpdateMode.OnValidation, DBNull.Value)); lbl_UPDATE_DATE.DataBindings.Add(new System.Windows.Forms.Binding("EditValue", dt, "UPDATE_DATE", true, DataSourceUpdateMode.OnValidation, DBNull.Value)); lbl_EMP_ID_UPDATE.DataBindings.Add(new System.Windows.Forms.Binding("Text", dt, "EMPID_UPDATE", true, DataSourceUpdateMode.OnValidation, DBNull.Value)); lbl_PATHWAY_STATUS.DataBindings.Add(new System.Windows.Forms.Binding("Text", dt, "STATUS", true, DataSourceUpdateMode.OnValidation, 1)); lbl_PYM.DataBindings.Add(new System.Windows.Forms.Binding("Text", dt, "PYM", true, DataSourceUpdateMode.OnValidation, "")); lbl_WBM.DataBindings.Add(new System.Windows.Forms.Binding("Text", dt, "WBM", true, DataSourceUpdateMode.OnValidation, "")); lbl_STATUS.DataBindings.Add(new System.Windows.Forms.Binding("Text", dt, "STATUS", true, DataSourceUpdateMode.OnValidation, "")); #endregion return(true); } }
void LoadTable_Way() { try { this._sSqlTable_Way = string.Format("SELECT * FROM [PATHTABLE_WAY_RELATION] WHERE [PATHWAYID] = '{0}'", this._sPathWayId); string sPathTableName = "无"; dtTable_Way = DbOpt.GetDataTable(this._sSqlTable_Way); string sPathTableID = ""; if (dtTable_Way.Rows.Count > 0) { sPathTableID = dtTable_Way.Rows[0]["PATHTABLEID"].ToString(); sPathTableName = dtPathTable.Select("PATH_TABLE_ID = " + sPathTableID)[0]["PATH_TABLE_NAME"].ToString(); } lbNow.Text = "当前路径选择表单:" + sPathTableName; lbNow.Tag = sPathTableID; } catch { } }
/// <summary> /// 初始化 /// </summary> private void Init() { try { this.sSql = "SELECT * FROM [PATH_DM]"; dt = DbOpt.GetDataTable(sSql); dtItem = dt.Copy(); dt.DefaultView.RowFilter = "VALID in( 2,4)"; dtItem.DefaultView.RowFilter = "VALID = 1"; dgvCodeType.DataSource = dt; dgvCode.DataSource = dtItem; this.UseHelp("初始化完成!"); } catch (Exception ex) { this.UseHelp("初始化失败:" + ex.Message); } }
private void proAdd() { this.BindingContext[dt].AddNew(); dt_sybz = DbOpt.GetDataTable(sSql_sybz + " and PATHWAY_DISEASE_ID is null "); gridControl1.DataSource = dt_sybz; if (info_DLG.dlgCs10 == "Copy") { //proCopy(); } //this.Text = "路径 新增"; this.lbl_PATHWAY_STATUS.Text = "1"; // 创建 状态 this.txt_PATHWAY_VERSION.Text = "1.0"; this.lbl_STATUS.Text = "1"; //状态 this.lbl_MONOCONDITION.Text = bIsPathWay ? "0" : "1"; //单病种 为 1 ,默认 为0 this.setEnabledInAddOrOther(EventKind.barAdd); if (info_DLG.dlgKind == DbOpt.OpenWindowKind.Open) { info_DLG.dlgKind = DbOpt.OpenWindowKind.Add; } this.setEnable(EventKind.barAdd); }
/// <summary> /// 初始化 /// </summary> private void Init() { try { APPLY_TYPE.Items.Add(this.bIsPathWay ? "路径评估" : "单病种评估"); APPLY_TYPE.Items.Add("阶段评估"); //查询SQL语句 sSql = string.Format("SELECT * FROM [PATH_RULE_DICT] ORDER BY [RULE_ID]"); //绑定数据到DataTable dt = DbOpt.GetDataTable(sSql); //绑定DGV dgvDic.DataSource = dt; //状态栏提示完成 this.UseHelp("初始化完成!"); } catch (Exception ex) { //异常状态栏提示 this.UseHelp("初始化失败:" + ex.Message); } }
/// <summary> /// 删除事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barBtDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //判断DGV是否有选择行且不是新行 if (dgvDic.SelectedRows.Count == 1 && !dgvDic.SelectedRows[0].IsNewRow) { //获取选择行的RULE_ID值 int iRuleId = (int)dgvDic.SelectedRows[0].Cells["RULE_ID"].Value; //根据RULE_ID查询外键引用 if ((int)DbOpt.GetDataTable("SELECT COUNT(*) FROM [PATH_RULE_ITEM] WHERE [RULE_ID] = " + iRuleId).Rows[0][0] > 0) { //如有外键引用,则提示无法删除,返回. MessageBox.Show("该评估内容正在被使用,若要删除此评估,请先移除所有引用!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { //如没有外键引用,则从DT中删除该行. dt.Select("RULE_ID = " + iRuleId)[0].Delete(); this.UseHelp("删除完成!"); } } }
void LoadPathTable() { this._sSqlPathTable = "SELECT * FROM [PATHTABLE] WHERE DELETED = 0"; dtPathTable = DbOpt.GetDataTable(this._sSqlPathTable); dgvPathTable.DataSource = dtPathTable; }
void BindPathTableStep() { dtPathTableStep = DbOpt.GetDataTable("SELECT * FROM [PATHTABLE_STEP] WHERE [DELETED] = 0 AND [PATH_TABLE_ID] = " + this._iPathTableId + " ORDER BY SORT"); dgvPathTableStep.DataSource = dtPathTableStep; }
void BindPathWayStep() { dtPathWayStep = DbOpt.GetDataTable(string.Format(@"SELECT [PATH_STEP_ID],[PATHWAY_ID],[PATH_STEP_NAME],[NOTE],[DELETED],[TIME_DOWN] FROM PATH_STEP WHERE [DELETED] = 0 AND [PATHWAY_ID] = '{0}' ORDER BY [PATH_STEP_NAME]", this._sPathWayId)); dgvPathWayStep.DataSource = dtPathWayStep; }
void LoadRelation() { _sSqlPathTableItemRelation = string.Format("SELECT * FROM [PATHTABLE_ITEM_RELATION] WHERE [PATH_WAY_ID] = '{0}' AND [PATH_TABLE_ID] = {1}", this._sPathWayId, this._iPathTableId); dtPathTableItemRelation = DbOpt.GetDataTable(_sSqlPathTableItemRelation); }
private void OpenData(string sSql) { dt = DbOpt.GetDataTable(sSql + " order by PATHWAY_NAME ,CREATE_DATE desc"); gridControl1.DataSource = dt; }
private void FrmPathTableShow_Load(object sender, EventArgs e) { DataTable dt = DbOpt.GetDataTable("select * from PATHTABLE"); dataGridView1.DataSource = dt; }
/// <summary> /// 查询数据 /// </summary> private void QueryData(string wherestr) { string str = @"SELECT ' ' 序号, mg.blh, yb.brxm, ( CASE WHEN yb.xb = 1 THEN '男' WHEN yb.xb = 2 THEN '女' ELSE '未知' END ) xb, yb.csrq, mm.jzrq , mj.JSSJ, dbo.fun_getDeptname(mj.JSKSDM) ksname, mj.JSKSDM, dbo.fun_getEmpName(mj.JSYSDM) ysname, mj.JSYSDM, mm.lxdh, mm.xzdz, (SELECT yk.KH FROM YY_KDJB AS yk WHERE mg.KDJID = yk.KDJID) kahao, (select NAME from JC_OCCUPATI where CODE =mm.zy) as zy, mg.GHSJ, mm.jzxm , CASE WHEN mm.tiwen = 0 THEN NULL ELSE mm.tiwen END tiwen, CASE WHEN mm.xueya = 0 THEN NULL ELSE mm.xueya END xueya, CASE WHEN mm.maibo = 0 THEN NULL ELSE mm.maibo END maibo, mm.yxjb , ( CASE WHEN mm.fenji = 1 THEN '1级' WHEN mm.fenji = 2 THEN '2级' WHEN mm.fenji = 3 THEN '3级' END ) fenji , mm. fbrq , mm.zdsj , mm.lxbxjcs, ( CASE WHEN mm.cfz = 0 THEN '初诊' WHEN mm.cfz = 1 THEN '复诊' END )cfz, mm.crbyq , mm.bgr , CASE WHEN mm.xinlv = 0 THEN NULL ELSE mm.xinlv END xinlv, CASE WHEN mm.huxi = 0 THEN NULL ELSE mm.huxi END huxi, CASE WHEN mm.ssy = 0 THEN NULL ELSE mm.ssy END ssy, mm.yishi , CASE WHEN mm.MEWSdf = 0 THEN NULL ELSE mm.MEWSdf END MEWSdf, CASE WHEN mm.ksxt = 0 THEN NULL ELSE mm.ksxt END ksxt, mm.xybhd , mm.brqx , mm.fenqu, mm.zhusu , mm.shenzhi , ryfs , mg.ZDMC, ( CASE WHEN mm.sffr= 0 THEN '否' WHEN mm.sffr = 1 THEN '是' END ) sffr FROM MZYS_JZJL mj INNER JOIN dbo.VI_YY_BRXX yb ON mj.BRXXID = yb.BRXXID INNER JOIN dbo.VI_MZ_GHXX mg ON mj.GHXXID = mg.GHXXID AND mj.BJSBZ = 1 LEFT JOIN MZ_MZRZ mm ON mg.blh = mm.blh where 1=1 "; DataTable dt = new DataTable(); dt = DbOpt.GetDataTable(str + wherestr); Fun.AddRowtNo(dt); dgvList.DataSource = dt; }