Exemplo n.º 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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 检查文档缺陷,并返回检查结果
        /// </summary>
        /// <param name="documentForm">被检查缺陷的文档窗口</param>
        /// <returns>Common.SystemData.ReturnValue</returns>
        public short CheckDocumentBugs(IDocumentForm documentForm)
        {
            if (this.DocumentForm != documentForm)
            {
                this.DocumentForm = documentForm;
            }
            this.listView1.Items.Clear();
            this.Update();

            if (documentForm == null || documentForm.IsDisposed)
            {
                return(SystemData.ReturnValue.FAILED);
            }
            if (this.MainForm == null || this.MainForm.IsDisposed)
            {
                return(SystemData.ReturnValue.FAILED);
            }

            //获取病历文本数据
            string szTextData = string.Empty;
            short  shRet      = SystemData.ReturnValue.OK;

            if (documentForm is HerenDocForm)
            {
                szTextData = (documentForm as HerenDocForm).TextEditor.Text;
            }
            else
            {
                documentForm.MedEditor.GetPureTextData(ref szTextData);
            }
            if (shRet != SystemData.ReturnValue.OK || GlobalMethods.Misc.IsEmptyString(szTextData))
            {
                return(SystemData.ReturnValue.OK);
            }

            //初始化质控引擎
            if (this.m_bugCheckEngine == null)
            {
                this.m_bugCheckEngine = new BugCheckEngine();
            }
            this.m_bugCheckEngine.UserInfo    = this.GetUserInfo();
            this.m_bugCheckEngine.PatientInfo = this.GetPatientInfo();
            this.m_bugCheckEngine.VisitInfo   = this.GetVisitInfo();
            this.m_bugCheckEngine.DocType     = this.Text;
            this.m_bugCheckEngine.DocText     = szTextData;
            //m_bugCheckEngine.SectionInfos = new List<DocumentSectionInfo>();
            shRet = this.m_bugCheckEngine.InitializeEngine();
            if (shRet != SystemData.ReturnValue.CANCEL && shRet != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.Show("病历质控引擎初始化失败,无法对病历进行自动质控!");
                return(SystemData.ReturnValue.OK);
            }

            //检查文档内容缺陷
            List <DocuemntBugInfo> lstDocuemntBugList = null;

            if (shRet == SystemData.ReturnValue.OK)
            {
                lstDocuemntBugList            = this.m_bugCheckEngine.PerformBugCheck();
                this.m_bugCheckEngine.DocText = null;
            }

            //检查文档元素缺陷
            List <ElementBugInfo> lstElementBugList         = null;
            List <MedDocSys.PadWrapper.ElementBugInfo> bugs = new List <MedDocSys.PadWrapper.ElementBugInfo>();

            if (documentForm is HerenDocForm)
            {
                (documentForm as HerenDocForm).CheckElementBugs(ref lstElementBugList);
            }
            else
            {
                documentForm.MedEditor.CheckElementBugs(ref bugs);
                foreach (var item in bugs)
                {
                    ElementBugInfo bug = new ElementBugInfo();
                    bug.BugDesc     = item.BugDesc;
                    bug.ElementID   = item.ElementID;
                    bug.ElementName = item.ElementName;
                    if (item.ElementType == MDSDBLib.ElementType.CheckBox)
                    {
                        bug.ElementType = ElementType.CheckBox;
                    }
                    else if (item.ElementType == MDSDBLib.ElementType.ComplexOption)
                    {
                        bug.ElementType = ElementType.ComplexOption;
                    }
                    else if (item.ElementType == MDSDBLib.ElementType.InputBox)
                    {
                        bug.ElementType = ElementType.InputBox;
                    }
                    else if (item.ElementType == MDSDBLib.ElementType.Outline)
                    {
                        bug.ElementType = ElementType.Outline;
                    }
                    else if (item.ElementType == MDSDBLib.ElementType.SimpleOption)
                    {
                        bug.ElementType = ElementType.SimpleOption;
                    }
                    bug.IsFatalBug = item.IsFatalBug;
                }
            }

            if ((lstDocuemntBugList == null || lstDocuemntBugList.Count <= 0) &&
                (lstElementBugList == null || lstElementBugList.Count <= 0))
            {
                MessageBoxEx.Show("系统已完成文档缺陷检查,没有检查到缺陷!", MessageBoxIcon.Information);
                //未检测到缺陷,则将窗口置后并最小化
                if (this.DockPanel == null)
                {
                    this.Owner = null;
                    this.SendToBack();
                    this.WindowState = FormWindowState.Minimized;
                }
                return(SystemData.ReturnValue.OK);
            }
            this.RefreshBugsList(lstElementBugList, lstDocuemntBugList);
            return(SystemData.ReturnValue.OK);
        }