Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //查询文档
            string szDocID = this.txtDocID.Text;

            if (string.IsNullOrEmpty(szDocID))
            {
                MessageBox.Show("请输入文档ID号");
                return;
            }
            MedDocInfo medDocInfo = null;
            short      shRet      = EmrDocAccess.Instance.GetDocInfo(szDocID, ref medDocInfo);

            if (medDocInfo == null)
            {
                MessageBoxEx.ShowError("查找文档信息失败");
                return;
            }
            if (!string.IsNullOrEmpty(SystemParam.Instance.LocalConfigOption.IgnoreDocTypeIDs) &&
                SystemParam.Instance.LocalConfigOption.IgnoreDocTypeIDs.Contains(medDocInfo.DOC_TYPE))
            {
                MessageBoxEx.Show(string.Format("{0}已忽略分析,忽略DocTypeIDs有{1}"
                                                , medDocInfo.DOC_TITLE
                                                , SystemParam.Instance.LocalConfigOption.IgnoreDocTypeIDs));
                return;
            }
            Editor.Instance.ParentControl = this;
            string szTextData = Editor.Instance.GetDocText(medDocInfo);

            if (this.m_bugCheckEngine == null)
            {
                this.m_bugCheckEngine = new BugCheckEngine();
            }
            m_bugCheckEngine.PatientInfo = GetPatientInfo(medDocInfo.PATIENT_ID, medDocInfo.VISIT_ID);
            m_bugCheckEngine.VisitInfo   = GetVisitInfo(medDocInfo.PATIENT_ID, medDocInfo.VISIT_ID);
            m_bugCheckEngine.UserInfo    = GetUserInfo();
            m_bugCheckEngine.DocType     = medDocInfo.DOC_TITLE;
            m_bugCheckEngine.DocText     = szTextData;
            shRet = m_bugCheckEngine.InitializeEngine();
            if (shRet != SystemData.ReturnValue.OK)
            {
                LogManager.Instance.WriteLog(string.Format("{0} 病历质控引擎初始化失败,无法对病历进行自动质控!", DateTime.Now), null,
                                             LogType.Information);
            }
            //检查文档内容缺陷
            List <DocuemntBugInfo> lstDocuemntBugList = null;

            if (shRet == SystemData.ReturnValue.OK)
            {
                lstDocuemntBugList       = m_bugCheckEngine.PerformBugCheck();
                m_bugCheckEngine.DocText = null;
            }
            //检查文档元素缺陷
            List <ElementBugInfo> lstElementBugList = null;

            Editor.Instance.CheckElementBugs(medDocInfo.EMR_TYPE, ref lstElementBugList);
            LoadGridBugs(lstDocuemntBugList, lstElementBugList);
        }
        private void BugCheckGener()
        {
            if (!this.MainForm.ContentRecordRunning)
            {
                return;
            }
            int iCurrIndex = 0;

            LogManager.Instance.WriteLog(string.Format("{0} 执行内容检查记录生成", DateTime.Now), null, LogType.Information);
            List <EMRDBLib.MedDocInfo> lstDocInfos = null;
            int   nDays = m_parent.DocContentDay;
            short shRet = EmrDocAccess.Instance.GetDocInfoByModifyTime(DateTime.Now, nDays, SystemParam.Instance.LocalConfigOption.IgnoreDocTypeIDs, ref lstDocInfos);

            if (shRet != SystemData.ReturnValue.OK || lstDocInfos == null)
            {
                LogManager.Instance.WriteLog("未查询到昨天修改病历信息");
                m_BugState = RunState.Normal;
                return;
            }
            StartRun(lstDocInfos.Count, CheckType.BugCheck);
            //需设置父级控件
            Editor.Instance.ParentControl = Parent;
            for (int index = 0; index < lstDocInfos.Count; index++)
            {
                string szMessage = string.Format("内容质控病案生成 {0}/{1}"
                                                 , index + 1, lstDocInfos.Count);
                ShowMessage(szMessage, index + 1, CheckType.BugCheck);
                string szTextData = Editor.Instance.GetDocText(lstDocInfos[index]);
                if (string.IsNullOrEmpty(szTextData))
                {
                    continue;
                }
                //获取病人基本信息
                InitPatientInfo(lstDocInfos[index].PATIENT_ID, lstDocInfos[index].VISIT_ID);

                //初始化质控引擎
                if (m_bugCheckEngine == null)
                {
                    m_bugCheckEngine = new BugCheckEngine();
                }
                m_bugCheckEngine.UserInfo    = GetUserInfo();
                m_bugCheckEngine.PatientInfo = GetPatientInfo(lstDocInfos[index].PATIENT_ID, lstDocInfos[index].VISIT_ID);
                m_bugCheckEngine.VisitInfo   = GetVisitInfo(lstDocInfos[index].PATIENT_ID, lstDocInfos[index].VISIT_ID);
                m_bugCheckEngine.DocType     = lstDocInfos[index].DOC_TITLE;
                m_bugCheckEngine.DocText     = szTextData;
                //m_bugCheckEngine.SectionInfos = new List<DocumentSectionInfo>();
                shRet = m_bugCheckEngine.InitializeEngine();
                if (shRet != SystemData.ReturnValue.OK)
                {
                    LogManager.Instance.WriteLog(string.Format("{0} 病历质控引擎初始化失败,无法对病历进行自动质控!", DateTime.Now), null,
                                                 LogType.Information);
                    continue;
                }

                //检查文档内容缺陷
                List <DocuemntBugInfo> lstDocuemntBugList = null;
                if (shRet == SystemData.ReturnValue.OK)
                {
                    lstDocuemntBugList       = m_bugCheckEngine.PerformBugCheck();
                    m_bugCheckEngine.DocText = null;
                }

                //检查文档元素缺陷
                List <ElementBugInfo> lstElementBugList = null;
                Editor.Instance.CheckElementBugs(lstDocInfos[index].EMR_TYPE, ref lstElementBugList);
                if ((lstDocuemntBugList == null || lstDocuemntBugList.Count <= 0) &&
                    (lstElementBugList == null || lstElementBugList.Count <= 0))
                {
                    continue;
                }

                //如果存在DocID对应的则删除老数据
                QcContentRecordAccess.Instance.DeleteContentRecord(lstDocInfos[index].DOC_SETID);
                //保存Bug
                PatVisitInfo patVisitInfo =
                    m_ListPatVisitInfos.Find(
                        item =>
                        item.PATIENT_ID == lstDocInfos[index].PATIENT_ID && item.VISIT_ID == lstDocInfos[index].VISIT_ID);
                SaveContentRecord(patVisitInfo, lstDocInfos[index], lstDocuemntBugList, lstElementBugList);
            }

            m_BugState = RunState.Normal;
            EndRun(iCurrIndex, CheckType.BugCheck);
        }