private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            if (e.ColumnIndex != this.col_1_Doctor.Index)
            {
                return;
            }
            this.dataGridView2.Rows.Clear();
            YunxingCheckResult yunxingCheckResult = this.dataGridView1.Rows[e.RowIndex].Tag as YunxingCheckResult;

            if (yunxingCheckResult == null)
            {
                return;
            }
            //过滤缺陷点,统计科室数量
            string szDeptCode       = string.Empty;
            string szDeptName       = string.Empty;
            string szMsgDictMessage = string.Empty;
            string szDoctor         = string.Empty;
            string szPatientID      = string.Empty;
            string szVisitID        = string.Empty;
            string szTotalPatientID = string.Empty;
            string szTotalVisitID   = string.Empty;
            List <DocCheckResult> lstDoctorCheckResult = new List <DocCheckResult>();
            var result = this.ListQcCheckResult.FindAll(m => m.DEPT_IN_CHARGE == yunxingCheckResult.DeptName && m.INCHARGE_DOCTOR == yunxingCheckResult.Doctor && m.QC_RESULT == 0);

            if (result != null && result.Count > 0)
            {
                foreach (var item in result)
                {
                    int             rowIndex = this.dataGridView2.Rows.Add();
                    DataGridViewRow row      = this.dataGridView2.Rows[rowIndex];
                    row.Tag = item;
                    if (szDeptName != item.DEPT_IN_CHARGE)
                    {
                        row.Cells[this.col_2_DeptName.Index].Value = item.DEPT_IN_CHARGE;
                        szDeptName = item.DEPT_IN_CHARGE;
                    }
                    if (szDoctor != item.INCHARGE_DOCTOR)
                    {
                        row.Cells[this.col_2_Doctor.Index].Value = item.INCHARGE_DOCTOR;
                        szDoctor = item.INCHARGE_DOCTOR;
                    }
                    if (szMsgDictMessage != item.MSG_DICT_MESSAGE)
                    {
                        row.Cells[this.col_2_MsgDictMessage.Index].Value = item.MSG_DICT_MESSAGE;
                        szMsgDictMessage = item.MSG_DICT_MESSAGE;
                    }
                    row.Cells[this.col_2_PatientName.Index].Value = item.PATIENT_NAME;
                    row.Cells[this.col_2_PatientID.Index].Value   = item.PATIENT_ID;
                    row.Cells[this.col_2_VisitID.Index].Value     = item.VISIT_ID;
                    row.Cells[this.col_2_VisitID.Index].Value     = "1";
                }
            }
        }
Ejemplo n.º 2
0
        private void dataGridView3_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            //if (e.ColumnIndex != this.col_3_PatientID.Index)
            //    return;
            this.dataGridView4.Rows.Clear();
            DocCheckResult docCheckResult = this.dataGridView3.Rows[e.RowIndex].Tag as DocCheckResult;

            if (docCheckResult == null)
            {
                return;
            }
            List <QcCheckResult> lstQcCheckResult = ListQcCheckResult.FindAll(m => m.PATIENT_ID == docCheckResult.PatientID && m.VISIT_ID == docCheckResult.VisitID);
            string             szQAEventType      = string.Empty;
            YunxingCheckResult yunxingCheckResult = this.dataGridView1.SelectedRows[0].Tag as YunxingCheckResult;

            foreach (var item in lstQcCheckResult)
            {
                int             rowIndex = this.dataGridView4.Rows.Add();
                DataGridViewRow row      = this.dataGridView4.Rows[rowIndex];
                if (string.IsNullOrEmpty(szQAEventType) || szQAEventType != item.QA_EVENT_TYPE)
                {
                    row.Cells[this.col_4_QAEventType.Index].Value = item.QA_EVENT_TYPE;
                    szQAEventType = item.QA_EVENT_TYPE;
                }
                row.Cells[this.col_4_CheckName.Index].Value      = string.IsNullOrEmpty(item.CHECKER_NAME) ? "系统" : "";
                row.Cells[this.col_4_Confirm.Index].Value        = item.QC_RESULT == 1 ? "" : "未确认";
                row.Cells[this.col_4_Modify.Index].Value         = item.QC_RESULT == 1 ? "" : "未修改";
                row.Cells[this.col_4_QcResult.Index].Value       = item.QC_RESULT == 0 ? "不通过" : "通过";
                row.Cells[this.col_4_MsgDictMessage.Index].Value = item.MSG_DICT_MESSAGE;
                row.Tag = item;
                if (yunxingCheckResult != null && yunxingCheckResult.MsgDictCode == item.MSG_DICT_CODE)
                {
                    row.Selected = true;
                    this.dataGridView4.CurrentCell = row.Cells[0];
                }
            }
        }
Ejemplo n.º 3
0
        private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            this.dataGridView2.Rows.Clear();
            this.dataGridView3.Rows.Clear();
            this.dataGridView4.Rows.Clear();
            YunxingCheckResult yunxingCheckResult = this.dataGridView1.Rows[e.RowIndex].Tag as YunxingCheckResult;

            if (yunxingCheckResult == null)
            {
                return;
            }
            //过滤缺陷点,统计科室数量
            string szDeptCode       = string.Empty;
            string szDeptName       = string.Empty;
            string szDoctor         = string.Empty;
            string szPatientID      = string.Empty;
            string szVisitID        = string.Empty;
            string szTotalPatientID = string.Empty;
            string szTotalVisitID   = string.Empty;
            int    nDocCount        = 0;
            int    nDocTotalCount   = 0;
            int    nDoctorCount     = 0;
            List <DeptCheckResult> lstDeptCheckResult = new List <DeptCheckResult>();
            List <QcCheckResult>   lstResult          = this.ListQcCheckResult.Where(m => m.MSG_DICT_CODE == yunxingCheckResult.MsgDictCode).ToList();

            foreach (var item in lstResult)
            {
                if (szDeptCode != item.DEPT_CODE && !string.IsNullOrEmpty(szDeptCode))
                {
                    DeptCheckResult deptCheckResult = new DeptCheckResult();
                    deptCheckResult.DeptCode      = szDeptCode;
                    deptCheckResult.DeptName      = szDeptName;
                    deptCheckResult.MsgDictCode   = yunxingCheckResult.MsgDictCode;
                    deptCheckResult.DocCount      = nDocCount;
                    deptCheckResult.DoctorCount   = nDoctorCount;
                    deptCheckResult.DocTotalCount = nDocTotalCount;
                    lstDeptCheckResult.Add(deptCheckResult);
                    nDocCount      = 0;
                    nDocTotalCount = 0;
                    nDoctorCount   = 0;
                }
                if (szDeptCode != item.DEPT_CODE)
                {
                    szDeptCode = item.DEPT_CODE;
                    szDeptName = item.DEPT_IN_CHARGE;
                }
                if (item.INCHARGE_DOCTOR != szDoctor)
                {
                    szDoctor = item.INCHARGE_DOCTOR;
                    nDoctorCount++;
                }
                if (item.PATIENT_ID != szPatientID && item.VISIT_ID != szVisitID && item.QC_RESULT == 0)
                {
                    szPatientID = item.PATIENT_ID;
                    szVisitID   = item.VISIT_ID;
                    nDocCount++;
                }
                if (item.PATIENT_ID != szTotalPatientID && item.VISIT_ID != szTotalVisitID)
                {
                    szTotalPatientID = item.PATIENT_ID;
                    szTotalVisitID   = item.VISIT_ID;
                    nDocTotalCount++;
                }

                if (lstResult.IndexOf(item) == lstResult.Count - 1)
                {
                    DeptCheckResult deptCheckResult = new DeptCheckResult();
                    deptCheckResult.DeptCode      = szDeptCode;
                    deptCheckResult.DeptName      = szDeptName;
                    deptCheckResult.MsgDictCode   = yunxingCheckResult.MsgDictCode;
                    deptCheckResult.DocCount      = nDocCount;
                    deptCheckResult.DoctorCount   = nDoctorCount;
                    deptCheckResult.DocTotalCount = nDocTotalCount;
                    lstDeptCheckResult.Add(deptCheckResult);
                }
            }
            if (lstDeptCheckResult != null && lstDeptCheckResult.Count > 0)
            {
                foreach (var item in lstDeptCheckResult)
                {
                    int             rowIndex = this.dataGridView2.Rows.Add();
                    DataGridViewRow row      = this.dataGridView2.Rows[rowIndex];
                    row.Tag = item;
                    row.Cells[this.col_2_DeptName.Index].Value      = item.DeptName;
                    row.Cells[this.col_2_DocCount.Index].Value      = item.DocCount;
                    row.Cells[this.col_2_DoctorCount.Index].Value   = item.DoctorCount;
                    row.Cells[this.col_2_DocTotalCount.Index].Value = item.DocTotalCount;
                }
            }
        }
Ejemplo n.º 4
0
        private void QcCheckResultStatistic()
        {
            DateTime dtBeginTime = DateTime.Parse(this.dtpBeginTime.Value.ToShortDateString());
            DateTime dtEndTime   = DateTime.Parse(this.dtpEndTime.Value.AddDays(1).ToShortDateString());

            if (this.ListQcCheckResult == null)
            {
                this.ListQcCheckResult = new List <QcCheckResult>();
            }
            this.ListQcCheckResult.Clear();

            WorkProcess.Instance.Initialize(this, 2
                                            , string.Format("正在加载,请稍候..."));
            string szOrderBy = string.Format("{0},{1},{2},{3},{4}"
                                             , SystemData.QcCheckResultTable.ORDER_VALUE
                                             , SystemData.QcCheckResultTable.DEPT_CODE
                                             , SystemData.QcCheckResultTable.INCHARGE_DOCTOR
                                             , SystemData.QcCheckResultTable.PATIENT_ID
                                             , SystemData.QcCheckResultTable.VISIT_ID);
            string szMrStatus = SystemData.MrStatus.GetMrStatusCode(this.cboQcMrStatus.Text);
            int    nStatType  = SystemData.StatType.GetCode(this.cboStatType.Text);
            short  shRet      = QcCheckResultAccess.Instance.GetQcCheckResults(dtBeginTime, dtEndTime, null, null, null, szOrderBy, szMrStatus, nStatType, ref ListQcCheckResult);

            this.dataGridView1.Rows.Clear();
            this.dataGridView2.Rows.Clear();
            this.dataGridView3.Rows.Clear();
            this.dataGridView4.Rows.Clear();
            if (shRet != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.ShowMessage("未查询到结果");
                this.ShowStatusMessage("未查询到结果");
                WorkProcess.Instance.Close();
                return;
            }
            List <YunxingCheckResult> lstYunxingCheckResult = new List <YunxingCheckResult>();
            string szQaEventType     = string.Empty;
            string szMsgDictMessag   = string.Empty;
            string szMsgDictCode     = string.Empty;
            string szDeptCode        = string.Empty;
            string szTotalDeptCode   = string.Empty;
            string szDoctor          = string.Empty;
            string szTotalDoctor     = string.Empty;
            string szPatientID       = string.Empty;
            string szTotalPatientID  = string.Empty;
            string szVisitID         = string.Empty;
            string szTotalVisitID    = string.Empty;
            int    nErrorCount       = 0;
            int    nDeptCount        = 0;
            int    nDeptTotalCount   = 0;
            int    nDoctorCount      = 0;
            int    nDoctorTotalCount = 0;
            int    nDocCount         = 0;
            int    nDocTotalCount    = 0;

            GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor);
            //计算结果
            WorkProcess.Instance.Show(string.Format("加载到计算,请稍候..."), 1);
            foreach (QcCheckResult item in ListQcCheckResult)
            {
                if (item.MSG_DICT_CODE != szMsgDictCode && !string.IsNullOrEmpty(szMsgDictCode))
                {
                    YunxingCheckResult yunxingCheckResult = new YunxingCheckResult();
                    yunxingCheckResult.QaEventType      = szQaEventType;
                    yunxingCheckResult.MsgDictCode      = szMsgDictCode;
                    yunxingCheckResult.MsgDictMessage   = szMsgDictMessag;
                    yunxingCheckResult.DeptCount        = nDeptCount;
                    yunxingCheckResult.DeptTotalCount   = nDeptTotalCount;
                    yunxingCheckResult.DeptPercent      = Math.Round((1.0 * nDeptCount / nDeptTotalCount), 4);
                    yunxingCheckResult.DocCount         = nDocCount;
                    yunxingCheckResult.DocTotalCount    = nDocTotalCount;
                    yunxingCheckResult.DocPercent       = Math.Round((1.0 * nDocCount / nDocTotalCount), 4);
                    yunxingCheckResult.DoctorCount      = nDoctorCount;
                    yunxingCheckResult.DoctorTotalCount = nDoctorTotalCount;
                    yunxingCheckResult.DoctorPercent    = Math.Round((1.0 * nDoctorCount / nDoctorTotalCount), 4);
                    yunxingCheckResult.ErrorCount       = nErrorCount;
                    lstYunxingCheckResult.Add(yunxingCheckResult);
                    szQaEventType   = string.Empty;
                    szMsgDictMessag = string.Empty;
                    //szMsgDictCode = string.Empty;
                    szDeptCode        = string.Empty;
                    szTotalDeptCode   = string.Empty;
                    szDoctor          = string.Empty;
                    szTotalDoctor     = string.Empty;
                    szPatientID       = string.Empty;
                    szTotalPatientID  = string.Empty;
                    szVisitID         = string.Empty;
                    szTotalVisitID    = string.Empty;
                    nErrorCount       = 0;
                    nDeptCount        = 0;
                    nDeptTotalCount   = 0;
                    nDoctorCount      = 0;
                    nDoctorTotalCount = 0;
                    nDocCount         = 0;
                    nDocTotalCount    = 0;
                }
                if (item.MSG_DICT_CODE != szMsgDictCode)
                {
                    szMsgDictMessag = item.MSG_DICT_MESSAGE;
                    szMsgDictCode   = item.MSG_DICT_CODE;
                    szQaEventType   = item.QA_EVENT_TYPE;
                }
                if (item.DEPT_CODE != szTotalDeptCode)
                {
                    szTotalDeptCode = item.DEPT_CODE;
                    nDeptTotalCount++;
                }
                if (item.DEPT_CODE != szDeptCode && item.QC_RESULT == 0)
                {
                    szDeptCode = item.DEPT_CODE;
                    nDeptCount++;
                }
                if (item.INCHARGE_DOCTOR != szTotalDoctor)
                {
                    szTotalDoctor = item.INCHARGE_DOCTOR;
                    nDoctorTotalCount++;
                }
                if (item.INCHARGE_DOCTOR != szDoctor && item.QC_RESULT == 0)
                {
                    szDoctor = item.INCHARGE_DOCTOR;
                    nDoctorCount++;
                }
                if (item.PATIENT_ID != szTotalPatientID && item.VISIT_ID != szTotalVisitID)
                {
                    szTotalPatientID = item.PATIENT_ID;
                    szTotalVisitID   = item.VISIT_ID;
                    nDocTotalCount++;
                }
                if (item.PATIENT_ID != szPatientID && item.VISIT_ID != szVisitID && item.QC_RESULT == 0)
                {
                    szPatientID = item.PATIENT_ID;
                    szVisitID   = item.VISIT_ID;
                    nDocCount++;
                }
                if (item.QC_RESULT == 0)
                {
                    nErrorCount = nErrorCount + item.ERROR_COUNT;
                }
                if (ListQcCheckResult.IndexOf(item) == ListQcCheckResult.Count - 1)
                {
                    //加载最后一个
                    YunxingCheckResult yunxingCheckResult = new YunxingCheckResult();
                    yunxingCheckResult.QaEventType      = szQaEventType;
                    yunxingCheckResult.MsgDictCode      = szMsgDictCode;
                    yunxingCheckResult.MsgDictMessage   = szMsgDictMessag;
                    yunxingCheckResult.DeptCount        = nDeptCount;
                    yunxingCheckResult.DeptTotalCount   = nDeptTotalCount;
                    yunxingCheckResult.DeptPercent      = Math.Round((1.0 * nDeptCount / nDeptTotalCount), 4);
                    yunxingCheckResult.DocCount         = nDocCount;
                    yunxingCheckResult.DocTotalCount    = nDocTotalCount;
                    yunxingCheckResult.DocPercent       = Math.Round((1.0 * nDocCount / nDocTotalCount), 4);
                    yunxingCheckResult.DoctorCount      = nDoctorCount;
                    yunxingCheckResult.DoctorTotalCount = nDoctorTotalCount;
                    yunxingCheckResult.DoctorPercent    = Math.Round((1.0 * nDoctorCount / nDoctorTotalCount), 4);
                    yunxingCheckResult.ErrorCount       = nErrorCount;
                    lstYunxingCheckResult.Add(yunxingCheckResult);
                }
            }
            //显示到列表中
            WorkProcess.Instance.Show(string.Format("加载到计算,请稍候..."), 2);

            if (lstYunxingCheckResult != null && lstYunxingCheckResult.Count > 0)
            {
                string szQaEventTypePre = string.Empty;
                int    rowIndex         = 0;
                foreach (var item in lstYunxingCheckResult)
                {
                    rowIndex = this.dataGridView1.Rows.Add();
                    DataGridViewRow row = this.dataGridView1.Rows[rowIndex];
                    row.Height = 27;
                    this.dataGridView1.Rows[rowIndex].Tag = item;
                    if (string.IsNullOrEmpty(szQaEventTypePre) || item.QaEventType != szQaEventTypePre)
                    {
                        row.Cells[this.col_1_QaEventType.Index].Value = item.QaEventType;
                        szQaEventTypePre = item.QaEventType;
                    }
                    row.Cells[this.col_1_MsgDictMessage.Index].Value   = item.MsgDictMessage;
                    row.Cells[this.col_1_ErrorCount.Index].Value       = item.ErrorCount;
                    row.Cells[this.col_1_DeptCount.Index].Value        = item.DeptCount;
                    row.Cells[this.col_1_DeptTotalCount.Index].Value   = item.DeptTotalCount;
                    row.Cells[this.col_1_DeptPercent.Index].Value      = (item.DeptPercent * 100).ToString();
                    row.Cells[this.col_1_DocCount.Index].Value         = item.DocCount;
                    row.Cells[this.col_1_DocTotalCount.Index].Value    = item.DocTotalCount;
                    row.Cells[this.col_1_DocPercent.Index].Value       = (item.DocPercent * 100).ToString();
                    row.Cells[this.col_1_DoctorCount.Index].Value      = item.DoctorCount;
                    row.Cells[this.col_1_DoctorTotalCount.Index].Value = item.DoctorTotalCount;
                    row.Cells[this.col_1_DoctorPercent.Index].Value    = (item.DoctorPercent * 100).ToString();
                }
            }
            WorkProcess.Instance.Close();
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
        }
Ejemplo n.º 5
0
        private void ClassifyQcCheckResult()
        {
            string szMsgCodeList = this.txtMsgDict.Tag as string;
            //加载字典
            List <QcMsgDict> lstQcMsgDict = null;
            short            shRet        = QcMsgDictAccess.Instance.GetQcMsgDictList(ref lstQcMsgDict);

            if (lstQcMsgDict == null)
            {
                MessageBoxEx.ShowMessage("数据加载失败");
                return;
            }
            if (!string.IsNullOrEmpty(szMsgCodeList))
            {
                lstQcMsgDict = lstQcMsgDict.Where(m => szMsgCodeList.Contains(m.QC_MSG_CODE)).ToList();
            }
            if (lstQcMsgDict.Count <= 0)
            {
                MessageBoxEx.ShowMessage("评分项目加载失败");
                return;
            }
            //加载缺陷结果项
            WorkProcess.Instance.Initialize(this, lstQcMsgDict.Count, "正在进行缺陷分类统计...");
            DateTime dtBeginTime = DateTime.Parse(this.dtpBeginTime.Value.ToShortDateString());
            DateTime dtEndTime   = DateTime.Parse(this.dtpEndTime.Value.AddDays(1).ToShortDateString());
            string   szOrderBy   = string.Format("{0},{1},{2},{3},{4}"
                                                 , SystemData.QcCheckResultTable.ORDER_VALUE
                                                 , SystemData.QcCheckResultTable.DEPT_CODE
                                                 , SystemData.QcCheckResultTable.INCHARGE_DOCTOR
                                                 , SystemData.QcCheckResultTable.PATIENT_ID
                                                 , SystemData.QcCheckResultTable.VISIT_ID);
            string szMrStatus = SystemData.MrStatus.GetMrStatusCode(this.cboQcMrStatus.Text);
            int    nStatType  = SystemData.StatType.GetCode(this.cboStatType.Text);

            WorkProcess.Instance.Show(1, true);
            shRet = QcCheckResultAccess.Instance.GetQcCheckResults(dtBeginTime, dtEndTime, null, null, null, szOrderBy, szMrStatus, nStatType, ref ListQcCheckResult);
            this.dataGridView1.Rows.Clear();
            this.dataGridView2.Rows.Clear();
            this.dataGridView3.Rows.Clear();
            this.dataGridView4.Rows.Clear();
            if (shRet != SystemData.ReturnValue.OK)
            {
                WorkProcess.Instance.Close();
                MessageBoxEx.ShowMessage("未查询到结果");
                this.ShowStatusMessage("未查询到结果");
                return;
            }
            if (WorkProcess.Instance.Canceled)
            {
                WorkProcess.Instance.Close();
                return;
            }
            List <YunxingCheckResult> lstYunxingCheckResult = new List <YunxingCheckResult>();
            int nErrorCount       = 0;
            int nDeptCount        = 0;
            int nDeptTotalCount   = 0;
            int nDoctorCount      = 0;
            int nDoctorTotalCount = 0;
            int nDocCount         = 0;
            int nDocTotalCount    = 0;

            foreach (var item in lstQcMsgDict)
            {
                if (WorkProcess.Instance.Canceled)
                {
                    WorkProcess.Instance.Close();
                    return;
                }
                WorkProcess.Instance.Show(lstQcMsgDict.IndexOf(item), true);
                List <QcCheckResult> lstQcCheckResult = this.ListQcCheckResult.Where(m => m.MSG_DICT_CODE == item.QC_MSG_CODE).ToList();
                nErrorCount       = lstQcCheckResult.Sum(m => m.ERROR_COUNT);
                nDeptCount        = lstQcCheckResult.Where(m => m.QC_RESULT == 0).Select(m => m.DEPT_CODE).Distinct().Count();
                nDeptTotalCount   = lstQcCheckResult.Select(m => m.DEPT_CODE).Distinct().Count();
                nDoctorCount      = lstQcCheckResult.Where(m => m.QC_RESULT == 0).Select(m => m.INCHARGE_DOCTOR).Distinct().Count();
                nDoctorTotalCount = lstQcCheckResult.Select(m => m.INCHARGE_DOCTOR).Distinct().Count();
                nDocCount         = lstQcCheckResult.Where(m => m.QC_RESULT == 0).Select(m => m.PATIENT_ID).Distinct().Count();
                nDocTotalCount    = lstQcCheckResult.Select(m => m.PATIENT_ID).Distinct().Count();
                YunxingCheckResult yunxingCheckResult = new YunxingCheckResult();
                yunxingCheckResult.QaEventType      = item.QA_EVENT_TYPE;
                yunxingCheckResult.MsgDictMessage   = item.MESSAGE;
                yunxingCheckResult.MsgDictCode      = item.QC_MSG_CODE;
                yunxingCheckResult.ErrorCount       = nErrorCount;
                yunxingCheckResult.DeptCount        = nDeptCount;
                yunxingCheckResult.DeptTotalCount   = nDeptTotalCount;
                yunxingCheckResult.DeptPercent      = nDeptTotalCount == 0?0:Math.Round((1.0 * nDeptCount / nDeptTotalCount), 4);
                yunxingCheckResult.DoctorCount      = nDoctorCount;
                yunxingCheckResult.DoctorTotalCount = nDoctorTotalCount;
                yunxingCheckResult.DoctorPercent    = nDoctorTotalCount == 0?0:Math.Round((1.0 * nDoctorCount / nDoctorTotalCount), 4);
                yunxingCheckResult.DocCount         = nDocCount;
                yunxingCheckResult.DocTotalCount    = nDocTotalCount;
                yunxingCheckResult.DocPercent       = nDocTotalCount == 0 ? 0 : Math.Round((1.0 * nDocCount / nDocTotalCount), 4);

                lstYunxingCheckResult.Add(yunxingCheckResult);
            }

            //显示到列表中
            WorkProcess.Instance.Show(string.Format("加载到列表中,请稍候..."), lstQcMsgDict.Count - 1);

            if (lstYunxingCheckResult != null && lstYunxingCheckResult.Count > 0)
            {
                string szQaEventTypePre = string.Empty;
                int    rowIndex         = 0;
                foreach (var item in lstYunxingCheckResult)
                {
                    rowIndex = this.dataGridView1.Rows.Add();
                    DataGridViewRow row = this.dataGridView1.Rows[rowIndex];
                    row.Height = 27;
                    this.dataGridView1.Rows[rowIndex].Tag = item;
                    if (string.IsNullOrEmpty(szQaEventTypePre) || item.QaEventType != szQaEventTypePre)
                    {
                        row.Cells[this.col_1_QaEventType.Index].Value = item.QaEventType;
                        szQaEventTypePre = item.QaEventType;
                    }
                    row.Cells[this.col_1_MsgDictMessage.Index].Value   = item.MsgDictMessage;
                    row.Cells[this.col_1_ErrorCount.Index].Value       = item.ErrorCount;
                    row.Cells[this.col_1_DeptCount.Index].Value        = item.DeptCount;
                    row.Cells[this.col_1_DeptTotalCount.Index].Value   = item.DeptTotalCount;
                    row.Cells[this.col_1_DeptPercent.Index].Value      = (item.DeptPercent * 100).ToString();
                    row.Cells[this.col_1_DocCount.Index].Value         = item.DocCount;
                    row.Cells[this.col_1_DocTotalCount.Index].Value    = item.DocTotalCount;
                    row.Cells[this.col_1_DocPercent.Index].Value       = (item.DocPercent * 100).ToString();
                    row.Cells[this.col_1_DoctorCount.Index].Value      = item.DoctorCount;
                    row.Cells[this.col_1_DoctorTotalCount.Index].Value = item.DoctorTotalCount;
                    row.Cells[this.col_1_DoctorPercent.Index].Value    = (item.DoctorPercent * 100).ToString();
                }
            }
            WorkProcess.Instance.Close();
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            DateTime dtBeginTime = DateTime.Parse(this.dtpBeginTime.Value.ToShortDateString());
            DateTime dtEndTime   = DateTime.Parse(this.dtpEndTime.Value.AddDays(1).ToShortDateString());

            if (this.ListQcCheckResult == null)
            {
                this.ListQcCheckResult = new List <QcCheckResult>();
            }
            this.ListQcCheckResult.Clear();
            string szMrStatus = SystemData.MrStatus.GetMrStatusCode(this.cboQcMrStatus.Text);
            int    nStatType  = SystemData.StatType.GetCode(this.cboStatType.Text);

            WorkProcess.Instance.Initialize(this, 2
                                            , string.Format("正在加载,请稍候..."));
            string szOrderBy = string.Format("{0},{1},{2},{3},{4}"
                                             , SystemData.QcCheckResultTable.DEPT_IN_CHARGE
                                             , SystemData.QcCheckResultTable.INCHARGE_DOCTOR
                                             , SystemData.QcCheckResultTable.ORDER_VALUE
                                             , SystemData.QcCheckResultTable.PATIENT_ID
                                             , SystemData.QcCheckResultTable.VISIT_ID);
            short shRet = QcCheckResultAccess.Instance.GetQcCheckResults(dtBeginTime, dtEndTime, null, null, null, szOrderBy, szMrStatus, nStatType, ref ListQcCheckResult);

            this.dataGridView1.Rows.Clear();
            this.dataGridView2.Rows.Clear();
            if (shRet != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.ShowMessage("未查询到结果");
                this.ShowStatusMessage("未查询到结果");
                WorkProcess.Instance.Close();
                return;
            }
            List <YunxingCheckResult> lstYunxingCheckResult = new List <YunxingCheckResult>();
            string szMsgDictMessag = string.Empty;
            string szMsgDictCode   = string.Empty;
            string szDeptName      = string.Empty;

            string szDoctor    = string.Empty;
            int    nErrorCount = 0;

            GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor);
            //计算结果
            WorkProcess.Instance.Show(string.Format("加载到计算,请稍候..."), 1);

            foreach (QcCheckResult item in ListQcCheckResult)
            {
                if (item.QC_RESULT == 1)
                {
                    continue;
                }
                if (item.MSG_DICT_CODE != szMsgDictCode && !string.IsNullOrEmpty(szMsgDictCode))
                {
                    YunxingCheckResult yunxingCheckResult = new YunxingCheckResult();
                    yunxingCheckResult.MsgDictCode    = szMsgDictCode;
                    yunxingCheckResult.MsgDictMessage = szMsgDictMessag;
                    yunxingCheckResult.DeptName       = item.DEPT_IN_CHARGE;
                    yunxingCheckResult.Doctor         = item.INCHARGE_DOCTOR;
                    yunxingCheckResult.ErrorCount     = nErrorCount;
                    lstYunxingCheckResult.Add(yunxingCheckResult);

                    szMsgDictMessag = string.Empty;
                    nErrorCount     = 0;
                }
                if (item.MSG_DICT_CODE != szMsgDictCode)
                {
                    szMsgDictMessag = item.MSG_DICT_MESSAGE;
                    szMsgDictCode   = item.MSG_DICT_CODE;
                }
                if (item.QC_RESULT == 0)
                {
                    nErrorCount = nErrorCount + item.ERROR_COUNT;
                }
            }
            //计算科室缺陷总数
            if (ListQcCheckResult != null && ListQcCheckResult.Count > 0)
            {
                int    nTotalErrorCount = 0;
                string szDeptNamePre    = string.Empty;
                foreach (var item in lstYunxingCheckResult)
                {
                    if (item.DeptName != szDeptNamePre && !string.IsNullOrEmpty(szDeptNamePre))
                    {
                        foreach (var item1 in lstYunxingCheckResult)
                        {
                            if (item1.DeptName == szDeptNamePre)
                            {
                                item1.TotalErrorCount = nTotalErrorCount;
                            }
                        }
                        szDeptNamePre    = item.DeptName;
                        nTotalErrorCount = 0;
                    }
                    if (string.IsNullOrEmpty(szDeptNamePre))
                    {
                        szDeptNamePre = item.DeptName;
                    }
                    nTotalErrorCount = nTotalErrorCount + item.ErrorCount;
                    if (lstYunxingCheckResult.IndexOf(item) == lstYunxingCheckResult.Count - 1)
                    {
                        foreach (var item1 in lstYunxingCheckResult)
                        {
                            if (item1.DeptName == szDeptNamePre)
                            {
                                item1.TotalErrorCount = nTotalErrorCount;
                            }
                        }
                    }
                }
            }
            //显示到列表中
            WorkProcess.Instance.Show(string.Format("加载到计算,请稍候..."), 2);

            if (lstYunxingCheckResult != null && lstYunxingCheckResult.Count > 0)
            {
                string szDeptNamePre = string.Empty;
                string szDoctorPre   = string.Empty;
                int    rowIndex      = 0;
                foreach (var item in lstYunxingCheckResult)
                {
                    rowIndex = this.dataGridView1.Rows.Add();
                    DataGridViewRow row = this.dataGridView1.Rows[rowIndex];
                    this.dataGridView1.Rows[rowIndex].Tag = item;
                    if (szDeptNamePre != item.DeptName)
                    {
                        row.Cells[this.col_1_DeptName.Index].Value        = item.DeptName;
                        row.Cells[this.col_1_TotalErrorCount.Index].Value = item.TotalErrorCount;
                        szDeptNamePre = item.DeptName;
                    }
                    if (szDoctorPre != item.Doctor)
                    {
                        row.Cells[this.col_1_Doctor.Index].Value = item.Doctor;
                        szDoctorPre = item.Doctor;
                    }
                    row.Cells[this.col_1_MsgDictMessage.Index].Value = item.MsgDictMessage;
                    row.Cells[this.col_1_ErrorCount.Index].Value     = item.ErrorCount;
                }
            }
            WorkProcess.Instance.Close();
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
        }