コード例 #1
0
        internal void CheckElementBugs(string fileType, ref List <ElementBugInfo> lstElementBugList)
        {
            List <MedDocSys.PadWrapper.ElementBugInfo> bugs = new List <MedDocSys.PadWrapper.ElementBugInfo>();

            if (fileType == "CHENPAD")
            {
                ChenPadEditor.Readonly = false;
                ChenPadEditor.CheckElementBugs(ref bugs);
            }
            else if (fileType == "BAODIAN")
            {
                BaodianEditor.CheckElementBugs(ref bugs);
            }
            else if (fileType == "HEREN")
            {
                lstElementBugList = HerenEditor.GetElementBugs();
            }
            foreach (var item in bugs)
            {
                ElementBugInfo bug = new ElementBugInfo();
                bug.BugDesc     = item.BugDesc;
                bug.ElementID   = item.ElementID;
                bug.ElementName = item.ElementName;
                bug.ElementType = ElementType.SimpleOption;
                bug.IsFatalBug  = item.IsFatalBug;
            }
        }
コード例 #2
0
        private void RefreshBugsList(List <ElementBugInfo> lstElementBugList, List <DocuemntBugInfo> lstDocuemntBugList)
        {
            string szDocTitle = string.Empty;

            if (this.m_documentForm != null && !this.m_documentForm.IsDisposed)
            {
                szDocTitle = this.m_documentForm.DockHandler.TabText;
            }

            for (int index = 0; lstDocuemntBugList != null && index < lstDocuemntBugList.Count; index++)
            {
                DocuemntBugInfo docuemntBugInfo = lstDocuemntBugList[index];
                ListViewItem    item            = new ListViewItem();
                item.Tag = docuemntBugInfo;
                item.SubItems.Add((this.listView1.Items.Count + 1).ToString());
                if (docuemntBugInfo.BugLevel == BugLevel.Warn)
                {
                    item.SubItems.Add("警告");
                    item.ImageIndex = 0;
                }
                else
                {
                    item.SubItems.Add("错误");
                    item.ImageIndex = 1;
                }

                item.SubItems.Add(szDocTitle);
                item.SubItems.Add(docuemntBugInfo.BugDesc);
                this.listView1.Items.Add(item);
            }

            for (int index = 0; lstElementBugList != null && index < lstElementBugList.Count; index++)
            {
                ElementBugInfo elementBugInfo = lstElementBugList[index];
                ListViewItem   item           = new ListViewItem();
                item.Tag = elementBugInfo;
                item.SubItems.Add((this.listView1.Items.Count + 1).ToString());
                item.SubItems.Add("错误");
                item.ImageIndex = 1;
                item.SubItems.Add(szDocTitle);
                item.SubItems.Add(elementBugInfo.BugDesc);
                this.listView1.Items.Add(item);
            }
        }
コード例 #3
0
ファイル: HerenDocForm.cs プロジェクト: zuifengke/MedQCSys
        /// <summary>
        /// 获取文档中所有与元素有关的缺陷信息
        /// </summary>
        /// <param name="lstElementBugInfos">元素缺陷信息列表</param>
        /// <returns>DataLayer.SystemData.ReturnValue</returns>
        public short CheckElementBugs(ref List <ElementBugInfo> elementBugInfos)
        {
            if (this.textEditor1 == null || this.textEditor1.IsDisposed)
            {
                return(EMRDBLib.SystemData.ReturnValue.PARAM_ERROR);
            }

            //检查内容为空的元素,这里会有个问题:
            //同一个元素文档里有多个时,用户双击错误列表就定位不准确

            if (elementBugInfos == null)
            {
                elementBugInfos = new List <ElementBugInfo>();
            }
            elementBugInfos.Clear();

            TextField[] textFileds = this.textEditor1.GetFields(null, MatchMode.Type);
            if (textFileds == null || textFileds.Length <= 0)
            {
                return(EMRDBLib.SystemData.ReturnValue.OK);
            }
            foreach (TextField field in textFileds)
            {
                string fieldText = string.Empty;
                this.textEditor1.GetFieldText(field, out fieldText);

                ElementBugInfo bugInfo = new ElementBugInfo();
                bugInfo.Tag         = field;
                bugInfo.ElementID   = field.ID;
                bugInfo.ElementName = field.Name;
                if (field.FieldType == FieldType.TextOption)
                {
                    bugInfo.ElementType = ElementType.SimpleOption;
                }
                else if (field.FieldType == FieldType.RichOption)
                {
                    bugInfo.ElementType = ElementType.ComplexOption;
                }
                else
                {
                    bugInfo.ElementType = ElementType.InputBox;
                }

                if (!field.AllowEmpty && string.IsNullOrEmpty(fieldText))
                {
                    bugInfo.IsFatalBug = true;
                    bugInfo.BugDesc    = string.Format("“{0}”内容为空!", bugInfo.ElementName);
                    elementBugInfos.Add(bugInfo);
                    continue;
                }

                if (field.HitForced && !field.AlreadyHitted)
                {
                    //用户必须点击,但是没有点击
                    bugInfo.BugDesc = string.Format("“{0}”是重点关注项,务必用鼠标点击一次!", field.Name);
                    elementBugInfos.Add(bugInfo);
                    continue;
                }

                //检查超出范围情况,MaxValue未null或者-1时,不用检查
                if (field.ValueType == FieldValueType.Numeric)
                {
                    decimal currValue = 0;
                    if (!decimal.TryParse(fieldText, out currValue))
                    {
                        bugInfo.IsFatalBug = true;
                        bugInfo.BugDesc    = string.Format("请在“{0}”内正确输入数值!", field.Name);
                        elementBugInfos.Add(bugInfo);
                        continue;
                    }

                    decimal minValue = 0;
                    decimal maxValue = 0;
                    bool    result1  = decimal.TryParse(field.MinValue, out minValue);
                    bool    result2  = decimal.TryParse(field.MaxValue, out maxValue);

                    //数值不在范围内
                    if (result1 && minValue > 0 && currValue < minValue)
                    {
                        bugInfo.BugDesc = string.Format("“{0}”不能小于{1}!", field.Name, field.MinValue);
                        elementBugInfos.Add(bugInfo);
                        continue;
                    }
                    if (result2 && maxValue > 0 && currValue > maxValue && maxValue >= 0)
                    {
                        bugInfo.BugDesc = string.Format("“{0}”不能大于{1}!", field.Name, field.MaxValue);
                        elementBugInfos.Add(bugInfo);
                        continue;
                    }
                }
                else if (field.ValueType == FieldValueType.DateTime)
                {
                    DateTime currValue = new DateTime();
                    if (!GlobalMethods.Convert.StringToDate(fieldText, ref currValue))
                    {
                        bugInfo.IsFatalBug = true;
                        bugInfo.BugDesc    = string.Format("请在“{0}”内正确输入日期!", field.Name);
                        elementBugInfos.Add(bugInfo);
                        continue;
                    }

                    //填入的内容确定为日期,再检查范围
                    DateTime minValue;
                    DateTime maxValue;
                    bool     result1 = DateTime.TryParse(field.MinValue, out minValue);
                    bool     result2 = DateTime.TryParse(field.MaxValue, out maxValue);

                    //时间不在范围内
                    if (result1 && currValue < minValue)
                    {
                        bugInfo.BugDesc = string.Format("“{0}”时间不能小于{1}!", field.Name, field.MinValue);
                        elementBugInfos.Add(bugInfo);
                        continue;
                    }
                    if (result2 && currValue > maxValue)
                    {
                        bugInfo.BugDesc = string.Format("“{0}”时间不能大于{1}!", field.Name, field.MaxValue);
                        elementBugInfos.Add(bugInfo);
                        continue;
                    }
                }
                else
                {
                    int  minValue = 0;
                    int  maxValue = 0;
                    bool result1  = int.TryParse(field.MinValue, out minValue);
                    bool result2  = int.TryParse(field.MaxValue, out maxValue);

                    //文本长度不在范围内
                    if (result1 && minValue > 0 && fieldText.Length < minValue)
                    {
                        bugInfo.BugDesc = string.Format("“{0}”文本长度不能小于{1}!", field.Name, field.MinValue);
                        elementBugInfos.Add(bugInfo);
                        continue;
                    }
                    if (result2 && maxValue > 0 && fieldText.Length > maxValue)
                    {
                        bugInfo.BugDesc = string.Format("“{0}”文本长度不能大于{1}!", field.Name, field.MaxValue);
                        elementBugInfos.Add(bugInfo);
                        continue;
                    }
                }
            }
            return(SystemData.ReturnValue.OK);
        }
コード例 #4
0
        private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (this.listView1.SelectedItems.Count <= 0)
            {
                return;
            }

            if (this.m_documentForm == null || this.m_documentForm.IsDisposed)
            {
                return;
            }

            this.m_documentForm.DockHandler.Activate();
            if (this.m_documentForm.MedEditor != null && !this.m_documentForm.MedEditor.Focused)
            {
                this.m_documentForm.MedEditor.Focus();
            }

            ListViewItem selectedItem = this.listView1.GetItemAt(e.X, e.Y);

            if (selectedItem == null)
            {
                return;
            }

            GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor);

            ElementBugInfo elementBugInfo = selectedItem.Tag as ElementBugInfo;

            if (elementBugInfo != null)
            {
                if (this.m_documentForm is HerenDocForm)
                {
                    TextField textField = elementBugInfo.Tag as TextField;
                    if (textField != null)
                    {
                        (this.m_documentForm as HerenDocForm).TextEditor.GotoField(textField);
                        (this.m_documentForm as HerenDocForm).TextEditor.SelectCurrentField();
                    }
                    else
                    {
                        (this.m_documentForm as HerenDocForm).GotoElement(elementBugInfo.ElementID, elementBugInfo.ElementName);
                    }
                }
                else
                {
                    MDSDBLib.ElementType type = MDSDBLib.ElementType.SimpleOption;
                    if (elementBugInfo.ElementType == ElementType.CheckBox)
                    {
                        type = MDSDBLib.ElementType.CheckBox;
                    }
                    else if (elementBugInfo.ElementType == ElementType.ComplexOption)
                    {
                        type = MDSDBLib.ElementType.ComplexOption;
                    }
                    else if (elementBugInfo.ElementType == ElementType.InputBox)
                    {
                        type = MDSDBLib.ElementType.InputBox;
                    }
                    else if (elementBugInfo.ElementType == ElementType.Outline)
                    {
                        type = MDSDBLib.ElementType.Outline;
                    }
                    else if (elementBugInfo.ElementType == ElementType.SimpleOption)
                    {
                        type = MDSDBLib.ElementType.SimpleOption;
                    }
                    this.m_documentForm.MedEditor.LocateToElement(type, elementBugInfo.ElementID
                                                                  , elementBugInfo.ElementName);
                }

                GlobalMethods.UI.SetCursor(this, Cursors.Default);
                return;
            }

            DocuemntBugInfo docuemntBugInfo = selectedItem.Tag as DocuemntBugInfo;

            if (docuemntBugInfo != null && !GlobalMethods.Misc.IsEmptyString(docuemntBugInfo.BugKey) &&
                docuemntBugInfo.Response == BUG_RESPONSE_LOCATE)
            {
                if (this.m_documentForm is HerenDocForm)
                {
                    (this.m_documentForm as HerenDocForm).GotoText(docuemntBugInfo.BugKey, docuemntBugInfo.BugIndex);
                }
                else
                {
                    this.m_documentForm.MedEditor.SetCursorPos(false);
                    this.m_documentForm.MedEditor.LocateToText(docuemntBugInfo.BugKey, docuemntBugInfo.BugIndex);
                }
            }
            GlobalMethods.UI.SetCursor(this, Cursors.Default);
        }
コード例 #5
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);
        }