Beispiel #1
0
 /// <summary>
 /// 设置指定行显示的数据,以及绑定的数据
 /// </summary>
 /// <param name="row">指定行</param>
 /// <param name="qcMsgDict">绑定的数据</param>
 /// <returns>bool</returns>
 private bool SetRowData(DataGridViewRow row, EMRDBLib.QcMsgDict qcMsgDict)
 {
     if (row == null || row.Index < 0 || qcMsgDict == null)
     {
         return(false);
     }
     row.Tag = qcMsgDict;
     row.Cells[this.colSerialNO.Index].Value     = qcMsgDict.SERIAL_NO;
     row.Cells[this.colQCEventType.Index].Value  = qcMsgDict.QA_EVENT_TYPE;
     row.Cells[this.colQCMsgCode.Index].Value    = qcMsgDict.QC_MSG_CODE;
     row.Cells[this.colMessage.Index].Value      = qcMsgDict.MESSAGE;
     row.Cells[this.colMessageTitle.Index].Value = qcMsgDict.MESSAGE_TITLE;
     row.Cells[this.colScore.Index].Value        =
         Math.Round(new decimal(GlobalMethods.Convert.StringToValue(qcMsgDict.SCORE, 0f)), 1).ToString("F1");
     row.Cells[this.col_IS_VALID.Index].Value = qcMsgDict.IS_VALID == 1 ? true : false;
     row.Cells[this.colIsVeto.Index].Value    = qcMsgDict.ISVETO ? "是" : "否";
     if (m_lstQcCheckPoint == null)
     {
         m_lstQcCheckPoint = new List <QcCheckPoint>();
     }
     if (m_lstQcCheckPoint.Exists(m => m.MsgDictCode == qcMsgDict.QC_MSG_CODE))
     {
         row.Cells[this.colAuto.Index].Value       = Properties.Resources.auto;
         row.Cells[this.colAuto.Index].ToolTipText = "已支持自动质控";
     }
     else
     {
         row.Cells[this.colAuto.Index].Value = null;
     }
     return(true);
 }
Beispiel #2
0
        /// <summary>
        /// 装载反馈质控信息字典
        /// </summary>
        private void LoadQcMsgDictList()
        {
            this.dataGridView1.Rows.Clear();
            if (this.MainForm == null || this.MainForm.IsDisposed)
            {
                return;
            }
            List <QcMsgDict> lstQcMsgDicts = null;
            short            shRet         = QcMsgDictAccess.Instance.GetAllQcMsgDictList(ref lstQcMsgDicts);

            if (shRet == SystemData.ReturnValue.RES_NO_FOUND)
            {
                this.MainForm.ShowStatusMessage("未找到记录");
                return;
            }
            if (shRet != SystemData.ReturnValue.OK)
            {
                MessageBoxEx.Show("获取反馈质控信息字典失败!");
                return;
            }
            if (lstQcMsgDicts == null || lstQcMsgDicts.Count <= 0)
            {
                return;
            }
            this.RefreshQCEventTypeColumn();
            if (m_lstQcCheckPoint == null)
            {
                m_lstQcCheckPoint = new List <QcCheckPoint>();
            }
            shRet = QcCheckPointAccess.Instance.GetQcCheckPoints(ref m_lstQcCheckPoint);

            for (int index = 0; index < lstQcMsgDicts.Count; index++)
            {
                EMRDBLib.QcMsgDict qcMsgDict = lstQcMsgDicts[index];
                int nRowIndex        = this.dataGridView1.Rows.Add();
                DataTableViewRow row = this.dataGridView1.Rows[nRowIndex];
                row.Tag = qcMsgDict;
                this.SetRowData(row, qcMsgDict);
                this.dataGridView1.SetRowState(row, RowState.Normal);
            }
            this.MainForm.ShowStatusMessage(string.Format("共{0}条记录", lstQcMsgDicts.Count));
        }
Beispiel #3
0
        /// <summary>
        /// 增加一行记录
        /// </summary>
        private void AddRow()
        {
            if (SystemParam.Instance.UserRight == null)
            {
                return;
            }
            EMRDBLib.QcMsgDict qcMessageTemplet = null;
            DataTableViewRow   currRow          = this.dataGridView1.CurrentRow;

            if (currRow != null && currRow.Index >= 0)
            {
                qcMessageTemplet = currRow.Tag as EMRDBLib.QcMsgDict;
            }
            if (qcMessageTemplet == null)
            {
                qcMessageTemplet = new QcMsgDict();
            }
            else
            {
                qcMessageTemplet = qcMessageTemplet.Clone() as QcMsgDict;
            }
            int nRowIndex = 0;

            if (currRow != null)
            {
                nRowIndex = currRow.Index + 1;
                DataTableViewRow dataTableViewRow = new DataTableViewRow();
                this.dataGridView1.Rows.Insert(nRowIndex, dataTableViewRow);
            }
            else
            {
                nRowIndex = this.dataGridView1.Rows.Add();
            }
            DataTableViewRow row = this.dataGridView1.Rows[nRowIndex];

            this.SetRowData(row, qcMessageTemplet);
            this.dataGridView1.Focus();
            this.dataGridView1.SelectRow(row);
            this.dataGridView1.SetRowState(row, RowState.New);
            this.dataGridView1.CurrentCell = row.Cells[this.colSerialNO.Index];
            this.dataGridView1.BeginEdit(true);
        }
Beispiel #4
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     EMRDBLib.QcMsgDict qcMessage = null;
     if (cboQcMsgDict.SelectedItem != null && cboQcMsgDict.Text != string.Empty)
     {
         qcMessage = cboQcMsgDict.SelectedItem as QcMsgDict;
     }
     else
     {
         TreeNode selectNode = this.treeView1.SelectedNode;
         qcMessage = selectNode.Tag as EMRDBLib.QcMsgDict;
     }
     if (qcMessage == null)
     {
         MessageBoxEx.Show("选择一个问题项目!", MessageBoxIcon.Warning);
         return;
     }
     SetQcMessage(qcMessage);
     this.selectedQCMessageTemplet = qcMessage;
     this.DialogResult             = DialogResult.OK;
 }
        /// <summary>
        /// 绑定关联MSG_ID的质检问题
        /// </summary>
        private void SetQCMsg()
        {
            EMRDBLib.MedicalQcMsg qCQuestionInfo = null;
            short shRet = MedicalQcMsgAccess.Instance.GetMedicalQcMsg(this.MsgID, ref qCQuestionInfo);

            if (shRet != SystemData.ReturnValue.OK || qCQuestionInfo == null)
            {
                return;
            }

            this.txtDocTitle.Text     = qCQuestionInfo.TOPIC;
            this.txtQuestionType.Text = qCQuestionInfo.QA_EVENT_TYPE;
            EMRDBLib.QcMsgDict qcMessageTemplet = ListQCMessageTemplets.Find(
                delegate(EMRDBLib.QcMsgDict q)
            {
                return(q.QC_MSG_CODE == qCQuestionInfo.QC_MSG_CODE);
            }
                );
            this.txtMesssageTitle.Text = qcMessageTemplet != null ? qcMessageTemplet.MESSAGE : "";
            this.txtContent.Text       = qCQuestionInfo.MESSAGE;
            this.txtBoxScore.Text      = qCQuestionInfo.POINT.ToString();
            this.txtMessage.Focus();
        }
Beispiel #6
0
        private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            TreeNode selectedNode = this.treeView1.SelectedNode;

            if (selectedNode == null)
            {
                return;
            }
            if (selectedNode.Parent == null)
            {
                return;
            }

            EMRDBLib.QcMsgDict qcMessage = selectedNode.Tag as EMRDBLib.QcMsgDict;
            if (qcMessage == null)
            {
                return;
            }

            SetQcMessage(qcMessage);
            this.selectedQCMessageTemplet = qcMessage;
            this.DialogResult             = DialogResult.OK;
        }
Beispiel #7
0
        /// <summary>
        /// 保存指定行的数据到远程数据表,需要注意的是:行的删除状态会与其他状态共存
        /// </summary>
        /// <param name="row">指定行</param>
        /// <returns>SystemData.ReturnValue</returns>
        private short SaveRowData(DataTableViewRow row)
        {
            if (row == null || row.Index < 0)
            {
                return(SystemData.ReturnValue.FAILED);
            }
            if (this.dataGridView1.IsNormalRow(row) || this.dataGridView1.IsUnknownRow(row))
            {
                if (!this.dataGridView1.IsDeletedRow(row))
                {
                    return(SystemData.ReturnValue.CANCEL);
                }
            }

            EMRDBLib.QcMsgDict qcMsgDict = row.Tag as EMRDBLib.QcMsgDict;
            if (qcMsgDict == null)
            {
                return(SystemData.ReturnValue.FAILED);
            }
            string szQCMsgCode = qcMsgDict.QC_MSG_CODE;

            qcMsgDict = null;
            if (!this.MakeRowData(row, ref qcMsgDict))
            {
                return(SystemData.ReturnValue.FAILED);
            }

            short shRet = SystemData.ReturnValue.OK;

            if (this.dataGridView1.IsDeletedRow(row))
            {
                if (!this.dataGridView1.IsNewRow(row))
                {
                    shRet = QcMsgDictAccess.Instance.Delete(szQCMsgCode);
                }
                if (shRet != SystemData.ReturnValue.OK)
                {
                    this.dataGridView1.SelectRow(row);
                    MessageBoxEx.Show("无法删除当前记录!");
                    return(SystemData.ReturnValue.FAILED);
                }
                this.dataGridView1.Rows.Remove(row);
            }
            else if (this.dataGridView1.IsModifiedRow(row))
            {
                shRet = QcMsgDictAccess.Instance.Update(qcMsgDict, szQCMsgCode);
                if (shRet != SystemData.ReturnValue.OK)
                {
                    this.dataGridView1.SelectRow(row);
                    MessageBoxEx.Show("无法更新当前记录!");
                    return(SystemData.ReturnValue.FAILED);
                }
                row.Tag = qcMsgDict;
                this.dataGridView1.SetRowState(row, RowState.Normal);
            }
            else if (this.dataGridView1.IsNewRow(row))
            {
                shRet = QcMsgDictAccess.Instance.Insert(qcMsgDict);
                if (shRet != SystemData.ReturnValue.OK)
                {
                    this.dataGridView1.SelectRow(row);
                    MessageBoxEx.Show("无法保存当前记录!");
                    return(SystemData.ReturnValue.FAILED);
                }
                row.Tag = qcMsgDict;
                this.dataGridView1.SetRowState(row, RowState.Normal);
            }
            return(SystemData.ReturnValue.OK);
        }
Beispiel #8
0
        /// <summary>
        /// 获取指定行最新修改后的数据
        /// </summary>
        /// <param name="row">指定行</param>
        /// <param name="qcMsgDict">最新修改后的数据</param>
        /// <returns>bool</returns>
        private bool MakeRowData(DataTableViewRow row, ref EMRDBLib.QcMsgDict qcMsgDict)
        {
            if (row == null || row.Index < 0)
            {
                return(false);
            }
            qcMsgDict = new EMRDBLib.QcMsgDict();
            EMRDBLib.QcMsgDict oldQCMessageTemplet = row.Tag as EMRDBLib.QcMsgDict;
            if (!this.dataGridView1.IsNewRow(row))
            {
                if (oldQCMessageTemplet == null)
                {
                    MessageBoxEx.Show("质控质检问题字典行数据信息为空!");
                    return(false);
                }
            }

            if (this.dataGridView1.IsDeletedRow(row))
            {
                qcMsgDict = oldQCMessageTemplet;
                return(true);
            }
            object cellValue = row.Cells[this.colSerialNO.Index].Value;

            if (cellValue == null || GlobalMethods.Misc.IsEmptyString(cellValue.ToString()))
            {
                this.dataGridView1.CurrentCell = row.Cells[this.colSerialNO.Index];
                this.dataGridView1.BeginEdit(true);
                MessageBoxEx.Show("您必须设置序号!");
                return(false);
            }

            cellValue = row.Cells[this.colQCEventType.Index].Value;
            if (cellValue == null || GlobalMethods.Misc.IsEmptyString(cellValue.ToString()))
            {
                this.dataGridView1.CurrentCell = row.Cells[this.colQCEventType.Index];
                this.dataGridView1.BeginEdit(true);
                MessageBoxEx.Show("您必须设置问题类型!");
                return(false);
            }

            cellValue = row.Cells[this.colQCMsgCode.Index].Value;
            if (cellValue == null || GlobalMethods.Misc.IsEmptyString(cellValue.ToString()))
            {
                this.dataGridView1.CurrentCell = row.Cells[this.colQCEventType.Index];
                this.dataGridView1.BeginEdit(true);
                MessageBoxEx.Show("您必须设置问题代码!");
                return(false);
            }
            cellValue = row.Cells[this.colScore.Index].Value;

            if (cellValue == null)
            {
                this.dataGridView1.CurrentCell = row.Cells[this.colScore.Index];
                this.dataGridView1.BeginEdit(true);
                MessageBoxEx.Show("您必须设置分数!");
                return(false);
            }
            string szRegexString = "^[0-9]+(.[0-9]{0,2})?$";
            Match  m             = Regex.Match((string)cellValue, szRegexString);

            if (!m.Success)
            {
                this.dataGridView1.CurrentCell = row.Cells[this.colScore.Index];
                this.dataGridView1.BeginEdit(true);
                MessageBoxEx.Show("您输入的分数不正确!");
                return(false);
            }

            if (qcMsgDict == null)
            {
                qcMsgDict = new EMRDBLib.QcMsgDict();
            }
            qcMsgDict.SERIAL_NO     = int.Parse(row.Cells[this.colSerialNO.Index].Value.ToString());
            qcMsgDict.QA_EVENT_TYPE = (string)row.Cells[this.colQCEventType.Index].Value;
            qcMsgDict.QC_MSG_CODE   = (string)row.Cells[this.colQCMsgCode.Index].Value;
            qcMsgDict.MESSAGE       = (string)row.Cells[this.colMessage.Index].Value;
            qcMsgDict.MESSAGE_TITLE = row.Cells[this.colMessageTitle.Index].Value == null ?
                                      string.Empty : (string)row.Cells[this.colMessageTitle.Index].Value;
            qcMsgDict.SCORE     = float.Parse(row.Cells[this.colScore.Index].Value.ToString());
            qcMsgDict.ISVETO    = (string)row.Cells[this.colIsVeto.Index].Value == "是";
            qcMsgDict.APPLY_ENV = "MEDDOC";
            if (row.Cells[this.col_IS_VALID.Index].Value == null ||
                row.Cells[this.col_IS_VALID.Index].Value.ToString().ToLower() == "false")
            {
                qcMsgDict.IS_VALID = 0;
            }
            else
            {
                qcMsgDict.IS_VALID = 1;
            }
            return(true);
        }