private void btnQuery_Click(object sender, EventArgs e) { DeptInfo deptInfo = this.cboDeptName.SelectedItem as DeptInfo; string szDeptCode = null; if (deptInfo != null) { szDeptCode = deptInfo.DEPT_CODE; } if (string.IsNullOrEmpty(this.cboDeptName.Text)) { szDeptCode = null; } GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor); this.ShowStatusMessage("正在按问题类型统计质检问题,请稍候..."); this.dataGridView1.Rows.Clear(); List <EMRDBLib.QCTypeStatInfo> lstQCTypeStatInfos = null; short shRet = MedQCAccess.Instance.GetQCStatisticsByType(szDeptCode, DateTime.Parse(dtpStatTimeBegin.Value.ToString("yyyy-M-d 00:00:00")), DateTime.Parse(dtpStatTimeEnd.Value.ToString("yyyy-M-d 23:59:59")), ref lstQCTypeStatInfos); if (shRet != SystemData.ReturnValue.OK && shRet != SystemData.ReturnValue.RES_NO_FOUND) { GlobalMethods.UI.SetCursor(this, Cursors.Default); MessageBoxEx.Show("查询数据失败!"); return; } if (lstQCTypeStatInfos == null || lstQCTypeStatInfos.Count <= 0) { GlobalMethods.UI.SetCursor(this, Cursors.Default); MessageBoxEx.Show("没有符合条件的数据!", MessageBoxIcon.Information); return; } for (int index = 0; index < lstQCTypeStatInfos.Count; index++) { EMRDBLib.QCTypeStatInfo qcTypeStatInfo = lstQCTypeStatInfos[index]; int nRowIndex = this.dataGridView1.Rows.Add(); DataGridViewRow row = this.dataGridView1.Rows[nRowIndex]; this.SetRowData(row, qcTypeStatInfo); } if (!string.IsNullOrEmpty(this.cboDeptName.Text)) { this.dataGridView1.Tag = this.cboDeptName.Text; } else { this.dataGridView1.Tag = "全院"; } this.ShowStatusMessage(null); GlobalMethods.UI.SetCursor(this, Cursors.Default); }
/// <summary> /// 将数据信息加载到DataGridView中 /// </summary> /// <param name="row">当前行</param> /// <param name="qcTypeStatInfo">问题类型统计信息</param> private void SetRowData(DataGridViewRow row, EMRDBLib.QCTypeStatInfo qcTypeStatInfo) { if (row == null || qcTypeStatInfo == null) { return; } if (row.DataGridView == null) { return; } row.Cells[this.questionTypeDataGridViewTextBoxColumn.Index].Value = qcTypeStatInfo.QuestionType; row.Cells[this.questionMsgDataGridViewTextBoxColumn.Index].Value = qcTypeStatInfo.QuestionMsg; row.Cells[this.colDeptName.Index].Value = qcTypeStatInfo.DeptName; row.Cells[this.countDataGridViewTextBoxColumn.Index].Value = qcTypeStatInfo.Count; }