/// <summary> /// 将数据信息加载到DataGridView中 /// </summary> /// <param name="row"></param> /// <param name="deptDocScoreInfo"></param> private void SetRowData(DataGridViewRow row, EMRDBLib.DeptDocScoreInfo deptDocScoreInfo) { if (row == null || deptDocScoreInfo == null) { return; } if (row.DataGridView == null) { return; } row.Cells[this.colDeptName.Index].Value = deptDocScoreInfo.DeptName; row.Cells[this.colScoreANum.Index].Value = deptDocScoreInfo.ScoreANum; row.Cells[this.colScoreBNum.Index].Value = deptDocScoreInfo.ScoreBNum; row.Cells[this.colScoreCNum.Index].Value = deptDocScoreInfo.ScoreCNum; float fTotalScoreNum = deptDocScoreInfo.ScoreANum + deptDocScoreInfo.ScoreBNum + deptDocScoreInfo.ScoreCNum; row.Cells[this.colScoreARate.Index].Value = fTotalScoreNum > 0 ? (deptDocScoreInfo.ScoreANum / fTotalScoreNum * 100).ToString("F2") + "%" : "0%"; row.Cells[this.colScoreBRate.Index].Value = fTotalScoreNum > 0 ? (deptDocScoreInfo.ScoreBNum / fTotalScoreNum * 100).ToString("F2") + "%" : "0%"; row.Cells[this.colScoreCRate.Index].Value = fTotalScoreNum > 0 ? (deptDocScoreInfo.ScoreCNum / fTotalScoreNum * 100).ToString("F2") + "%" : "0%"; row.Tag = deptDocScoreInfo; }
private void btnQuery_Click(object sender, EventArgs e) { string szDeptCode = null; if (!string.IsNullOrEmpty(this.cboDeptName.Text)) { DeptInfo deptInfo = this.cboDeptName.SelectedItem as DeptInfo; szDeptCode = deptInfo.DEPT_CODE; } string szCheckerName = null; if (!string.IsNullOrEmpty(this.cboUserList.Text)) { UserInfo userInfo = this.cboUserList.SelectedItem as UserInfo; if (userInfo != null) { szCheckerName = userInfo.USER_NAME; } } GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor); this.ShowStatusMessage("正在统计病案等级,请稍候..."); this.dataGridView1.Rows.Clear(); bool bDischareTime = true; if (this.cboDate.SelectedIndex > 0) { bDischareTime = false; } short shRet = SystemData.ReturnValue.OK; List <EMRDBLib.DeptDocScoreInfo> lstDeptDocScoreInfo = null; List <EMRDBLib.QCScore> lstQCScore = null; shRet = MedQCAccess.Instance.GetPatQCScores(szDeptCode, szCheckerName, DateTime.Parse(dtpStatTimeBegin.Value.ToString("yyyy-M-d 00:00:00")), DateTime.Parse(dtpStatTimeEnd.Value.ToString("yyyy-M-d 23:59:59")) , bDischareTime, ref lstQCScore); if (shRet != SystemData.ReturnValue.OK && shRet != SystemData.ReturnValue.RES_NO_FOUND) { GlobalMethods.UI.SetCursor(this, Cursors.Default); MessageBoxEx.Show("查询数据失败!"); this.ShowStatusMessage(null); return; } if (lstQCScore == null || lstQCScore.Count <= 0) { GlobalMethods.UI.SetCursor(this, Cursors.Default); MessageBoxEx.Show("没有符合条件的数据!", MessageBoxIcon.Information); this.ShowStatusMessage(null); return; } Hashtable hsDeptTable = new Hashtable(); lstDeptDocScoreInfo = new List <DeptDocScoreInfo>(); for (int index = 0; index < lstQCScore.Count; index++) { this.ShowStatusMessage(string.Format("正在统计第{0}/{1}病案质量,请稍候...", index + 1, lstQCScore.Count)); //加入科室表 if (!hsDeptTable.ContainsKey(lstQCScore[index].DeptCode)) { hsDeptTable.Add(lstQCScore[index].DeptCode, lstQCScore[index].DEPT_NAME); EMRDBLib.DeptDocScoreInfo deptDocScoreInfo = new EMRDBLib.DeptDocScoreInfo(); deptDocScoreInfo.DeptCode = lstQCScore[index].DeptCode; deptDocScoreInfo.DeptName = lstQCScore[index].DEPT_NAME; deptDocScoreInfo.ScoreANum = 0; deptDocScoreInfo.ScoreBNum = 0; deptDocScoreInfo.ScoreCNum = 0; lstDeptDocScoreInfo.Add(deptDocScoreInfo); } if (lstQCScore[index].DOC_LEVEL == "甲") { this.SetDeptScoreNum(lstDeptDocScoreInfo, lstQCScore[index].DeptCode, "A"); } else if (lstQCScore[index].DOC_LEVEL == "乙") { this.SetDeptScoreNum(lstDeptDocScoreInfo, lstQCScore[index].DeptCode, "B"); } else if (lstQCScore[index].DOC_LEVEL == "丙") { this.SetDeptScoreNum(lstDeptDocScoreInfo, lstQCScore[index].DeptCode, "C"); } } float fTotalANum = 0f; float fTotalBNum = 0f; float fTotalCNum = 0f; for (int index = 0; index < lstDeptDocScoreInfo.Count; index++) { EMRDBLib.DeptDocScoreInfo deptDocScoreInfo = lstDeptDocScoreInfo[index]; int nRowIndex = this.dataGridView1.Rows.Add(); DataGridViewRow row = this.dataGridView1.Rows[nRowIndex]; this.SetRowData(row, deptDocScoreInfo); fTotalANum += deptDocScoreInfo.ScoreANum; fTotalBNum += deptDocScoreInfo.ScoreBNum; fTotalCNum += deptDocScoreInfo.ScoreCNum; } int nIndex = this.dataGridView1.Rows.Add(); DataGridViewRow currRow = this.dataGridView1.Rows[nIndex]; currRow.Cells[this.colDeptName.Index].Value = "合计"; currRow.Cells[this.colScoreANum.Index].Value = fTotalANum; currRow.Cells[this.colScoreBNum.Index].Value = fTotalBNum; currRow.Cells[this.colScoreCNum.Index].Value = fTotalCNum; float fTotalNum = fTotalANum + fTotalBNum + fTotalCNum; float fScoreARate = fTotalANum / fTotalNum; currRow.Cells[this.colScoreARate.Index].Value = fTotalNum > 0 ? (fTotalANum / fTotalNum * 100).ToString("F2") + "%" : "0%"; currRow.Cells[this.colScoreBRate.Index].Value = fTotalNum > 0 ? (fTotalBNum / fTotalNum * 100).ToString("F2") + "%" : "0%"; currRow.Cells[this.colScoreCRate.Index].Value = fTotalNum > 0 ? (fTotalCNum / fTotalNum * 100).ToString("F2") + "%" : "0%"; if (!string.IsNullOrEmpty(szDeptCode)) { this.dataGridView1.Tag = string.Format("各科病历质量比较清单 科室:{0} 统计区间: {1} 至 {2} ", this.cboDeptName.Text , this.dtpStatTimeBegin.Value.ToString("yyyy-MM-dd"), this.dtpStatTimeEnd.Value.ToString("yyyy-MM-dd")); } else { this.dataGridView1.Tag = string.Format("各科病历质量比较清单 统计区间: {0} 至 {1} ", this.dtpStatTimeBegin.Value.ToString("yyyy-MM-dd") , this.dtpStatTimeEnd.Value.ToString("yyyy-MM-dd")); } currRow.DefaultCellStyle.BackColor = Color.FromArgb(235, 235, 235); this.ShowStatusMessage(null); GlobalMethods.UI.SetCursor(this, Cursors.Default); }