/// <summary> /// 刷新下拉列表加载项 /// </summary> private void RefreshQCEventTypeColumn() { this.colQCEventType.Items.Clear(); List <EMRDBLib.QaEventTypeDict> lstQCEventTypes = null; short shRet = QaEventTypeDictAccess.Instance.GetQCEventTypeList(ref lstQCEventTypes); if (shRet == SystemData.ReturnValue.RES_NO_FOUND) { this.MainForm.ShowStatusMessage("未找到记录"); return; } if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.Show("获取病案质量问题分类字典失败!"); return; } if (lstQCEventTypes == null || lstQCEventTypes.Count <= 0) { return; } for (int index = 0; index < lstQCEventTypes.Count; index++) { if (!string.IsNullOrEmpty(lstQCEventTypes[index].PARENT_CODE)) { continue; } EMRDBLib.QaEventTypeDict qcEventType = lstQCEventTypes[index]; this.colQCEventType.Items.Add(qcEventType.QA_EVENT_TYPE); } this.colQCEventType.DisplayStyle = ComboBoxStyle.DropDownList; }
public override void OnRefreshView() { this.Update(); this.ShowStatusMessage("正在下载临床科室列表,请稍候..."); if (!InitControlData.InitCboDeptName(ref this.cboDeptName)) { MessageBoxEx.Show("下载科室列表失败"); } this.ShowStatusMessage(null); this.ShowStatusMessage("正在下载质量问题列表,请稍候..."); List <EMRDBLib.QaEventTypeDict> lstQCEventTypes = null; short shRet = QaEventTypeDictAccess.Instance.GetQCEventTypeList(ref lstQCEventTypes); if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.Show("病案质量问题分类字典下载失败!"); return; } if (lstQCEventTypes == null || lstQCEventTypes.Count <= 0) { this.ShowStatusMessage(null); return; } for (int index = 0; index < lstQCEventTypes.Count; index++) { EMRDBLib.QaEventTypeDict qcEventType = lstQCEventTypes[index]; this.cboEventType.Items.Add(qcEventType); } this.ShowStatusMessage(null); }
protected override void OnShown(EventArgs e) { this.treeView1.Nodes.Clear(); List <EMRDBLib.QaEventTypeDict> lstQCEventTypes = null; short shRet = QaEventTypeDictAccess.Instance.GetQCEventTypeList(ref lstQCEventTypes); if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.Show("问题分类字典下载失败!"); return; } if (lstQCEventTypes == null || lstQCEventTypes.Count <= 0) { return; } for (int index = 0; index < lstQCEventTypes.Count; index++) { if (!string.IsNullOrEmpty(lstQCEventTypes[index].PARENT_CODE)) { continue; } EMRDBLib.QaEventTypeDict qcEventType = lstQCEventTypes[index]; TreeNode treeNode = new TreeNode(); treeNode.Text = qcEventType.QA_EVENT_TYPE; treeNode.ImageIndex = 0; treeNode.SelectedImageIndex = 0; this.treeView1.Nodes.Add(treeNode); this.AppendChildNode(qcEventType.QA_EVENT_TYPE, treeNode); } InitCboQcMsgDict(); }
private void btnQuery_Click(object sender, EventArgs e) { EMRDBLib.QaEventTypeDict qcEventType = this.cboEventType.SelectedItem as EMRDBLib.QaEventTypeDict; string szTypeDesc = null; if (qcEventType != null) { szTypeDesc = qcEventType.QA_EVENT_TYPE; } UserInfo userInfo = this.cboDoctor.SelectedItem as UserInfo; string szUserID = null; if (userInfo != null) { szUserID = userInfo.USER_ID; } if (szTypeDesc == null && szUserID == null) { MessageBoxEx.Show("请指定质量问题分类或者医生!", MessageBoxIcon.Information); return; } string szDeptName = null; if (!string.IsNullOrEmpty(this.cboDeptName.Text)) { szDeptName = this.cboDeptName.Text.Trim(); } GlobalMethods.UI.SetCursor(this, Cursors.WaitCursor); this.ShowStatusMessage("正在统计质检问题,请稍候..."); this.dataGridView1.Rows.Clear(); List <EMRDBLib.MedicalQcMsg> lstQuestionInfo = null; short shRet = MedicalQcMsgAccess.Instance.GetQCQuestionListByQaEventType(szDeptName, szTypeDesc, szUserID, DateTime.Parse(dtpStatTimeBegin.Value.ToString("yyyy-M-d 00:00:00")), DateTime.Parse(dtpStatTimeEnd.Value.ToString("yyyy-M-d 23:59:59")), ref lstQuestionInfo); if (shRet != SystemData.ReturnValue.OK && shRet != SystemData.ReturnValue.RES_NO_FOUND) { GlobalMethods.UI.SetCursor(this, Cursors.Default); MessageBoxEx.Show("查询数据失败!"); this.ShowStatusMessage(null); return; } if (lstQuestionInfo == null || lstQuestionInfo.Count <= 0) { GlobalMethods.UI.SetCursor(this, Cursors.Default); MessageBoxEx.Show("没有符合条件的数据!", MessageBoxIcon.Information); this.ShowStatusMessage(null); return; } for (int index = 0; index < lstQuestionInfo.Count; index++) { EMRDBLib.MedicalQcMsg questionInfo = lstQuestionInfo[index]; int nRowIndex = this.dataGridView1.Rows.Add(); DataGridViewRow row = this.dataGridView1.Rows[nRowIndex]; this.SetRowData(row, questionInfo); } this.ShowStatusMessage(null); GlobalMethods.UI.SetCursor(this, Cursors.Default); }
/// <summary> /// 装载病案质量问题分类信息 /// </summary> private void LoadQCEventTypeList() { this.dataGridView1.Rows.Clear(); List <EMRDBLib.QaEventTypeDict> lstQCEventTypes = null; short shRet = QaEventTypeDictAccess.Instance.GetQCEventTypeList(ref lstQCEventTypes); if (shRet == SystemData.ReturnValue.RES_NO_FOUND) { this.MainForm.ShowStatusMessage("未找到记录"); return; } if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.Show("获取病案质量问题分类字典失败!"); return; } if (lstQCEventTypes == null || lstQCEventTypes.Count <= 0) { return; } System.Collections.Hashtable ht = new System.Collections.Hashtable(); for (int index = 0; index < lstQCEventTypes.Count; index++) { //跳过子类问题 if (!string.IsNullOrEmpty(lstQCEventTypes[index].PARENT_CODE)) { continue; } EMRDBLib.QaEventTypeDict qcEventType = lstQCEventTypes[index]; int nRowIndex = this.dataGridView1.Rows.Add(); DataTableViewRow row = this.dataGridView1.Rows[nRowIndex]; row.Tag = qcEventType; //将记录信息保存到该行 this.SetRowData(row, qcEventType); this.dataGridView1.SetRowState(row, RowState.Normal); //加载子类问题类型 if (!ht.Contains(qcEventType.INPUT_CODE)) { for (int index2 = 0; index2 < lstQCEventTypes.Count; index2++) { EMRDBLib.QaEventTypeDict secQcEventType = lstQCEventTypes[index2]; if (secQcEventType.PARENT_CODE != qcEventType.INPUT_CODE) { continue; } int nRowIndex2 = this.dataGridView1.Rows.Add(); DataTableViewRow secRow = this.dataGridView1.Rows[nRowIndex2]; secRow.Tag = qcEventType; //将记录信息保存到该行 this.SetRowData(secRow, secQcEventType); this.dataGridView1.SetRowState(secRow, RowState.Normal); } ht.Add(qcEventType.INPUT_CODE, qcEventType.QA_EVENT_TYPE); } } }
/// <summary> /// 获取指定行最新修改后的数据 /// </summary> /// <param name="row">指定行</param> /// <param name="qcEventType">最新修改后的数据</param> /// <returns>bool</returns> private bool MakeRowData(DataTableViewRow row, ref EMRDBLib.QaEventTypeDict qcEventType) { if (row == null || row.Index < 0) { return(false); } qcEventType = new EMRDBLib.QaEventTypeDict(); EMRDBLib.QaEventTypeDict oldQCEventType = row.Tag as EMRDBLib.QaEventTypeDict; if (!this.dataGridView1.IsNewRow(row)) { if (oldQCEventType == null) { MessageBoxEx.Show("质量问题分类字典行数据信息为空!"); return(false); } } if (this.dataGridView1.IsDeletedRow(row)) { qcEventType = oldQCEventType; return(true); } if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colSerialNO.Index].Value.ToString())) { this.dataGridView1.CurrentCell = row.Cells[this.colSerialNO.Index]; this.dataGridView1.BeginEdit(true); MessageBoxEx.Show("您必须设置序号!"); return(false); } if (GlobalMethods.Misc.IsEmptyString((string)row.Cells[this.colTypeDesc.Index].Value)) { this.dataGridView1.CurrentCell = row.Cells[this.colTypeDesc.Index]; this.dataGridView1.BeginEdit(true); MessageBoxEx.Show("您必须设置问题类型!"); return(false); } if (qcEventType == null) { qcEventType = new EMRDBLib.QaEventTypeDict(); } qcEventType.SERIAL_NO = int.Parse(row.Cells[this.colSerialNO.Index].Value.ToString()); qcEventType.QA_EVENT_TYPE = (string)row.Cells[this.colTypeDesc.Index].Value; qcEventType.INPUT_CODE = (string)row.Cells[this.colInputCode.Index].Value; qcEventType.MAX_SCORE = Convert.ToDouble(row.Cells[this.colMaxScore.Index].Value); qcEventType.PARENT_CODE = oldQCEventType.PARENT_CODE; return(true); }
/// <summary> /// 设置指定行显示的数据,以及绑定的数据 /// </summary> /// <param name="row">指定行</param> /// <param name="qcEventType">绑定的数据</param> /// <returns>bool</returns> private bool SetRowData(DataGridViewRow row, EMRDBLib.QaEventTypeDict qcEventType) { if (row == null || row.Index < 0 || qcEventType == null) { return(false); } row.Tag = qcEventType; row.Cells[this.colSerialNO.Index].Value = qcEventType.SERIAL_NO; row.Cells[this.colTypeDesc.Index].Value = qcEventType.QA_EVENT_TYPE; row.Cells[this.colInputCode.Index].Value = qcEventType.INPUT_CODE; row.Cells[this.colMaxScore.Index].Value = qcEventType.MAX_SCORE; if (!string.IsNullOrEmpty(qcEventType.PARENT_CODE)) { row.Cells[this.colSerialNO.Index].Style.Alignment = DataGridViewContentAlignment.MiddleRight; } return(true); }
/// <summary> /// 增加一行记录 /// </summary> private void AddNewItem() { if (SystemParam.Instance.UserRight == null) { return; } EMRDBLib.QaEventTypeDict qcEventInfo = null; DataTableViewRow currRow = this.dataGridView1.CurrentRow; if (currRow != null && currRow.Index >= 0) { qcEventInfo = currRow.Tag as EMRDBLib.QaEventTypeDict; } if (qcEventInfo == null) { qcEventInfo = new QaEventTypeDict(); } else { qcEventInfo = qcEventInfo.Clone() as QaEventTypeDict; } 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, qcEventInfo); this.dataGridView1.Focus(); this.dataGridView1.SelectRow(row); this.dataGridView1.SetRowState(row, RowState.New); }
/// <summary> /// 新增子类问题类型行 /// </summary> private void AddSecNewItem() { if (SystemParam.Instance.UserRight == null) { return; } //判断当前选中行是否是一级问题类型 DataTableViewRow selectedRow = this.dataGridView1.SelectedRows[0]; if (selectedRow == null) { MessageBoxEx.Show("添加子类问题前请选择问题分类!", MessageBoxIcon.Warning); return; } EMRDBLib.QaEventTypeDict selectedQCEventType = selectedRow.Tag as EMRDBLib.QaEventTypeDict; if (selectedQCEventType == null || !string.IsNullOrEmpty(selectedQCEventType.PARENT_CODE)) { MessageBoxEx.Show("子类问题下不再允许添加问题分类!", MessageBoxIcon.Warning); return; } //创建数据 EMRDBLib.QaEventTypeDict qcEventInfo = new EMRDBLib.QaEventTypeDict(); qcEventInfo.PARENT_CODE = selectedQCEventType.INPUT_CODE; //创建行 int index = selectedRow.Index + 1; DataTableViewRow row = new DataTableViewRow(); this.dataGridView1.Rows.Insert(index, row); row = dataGridView1.Rows[index]; row.Tag = qcEventInfo; row.Cells[this.colSerialNO.Index].Style.Alignment = DataGridViewContentAlignment.MiddleRight; this.dataGridView1.SetRowState(row, RowState.New); this.UpdateUIState(); this.dataGridView1.CurrentCell = row.Cells[this.colSerialNO.Index]; this.dataGridView1.BeginEdit(true); }
//刷新问题分类对应的子类问题字典 private void RefreshMessageTitleColumn(DataGridViewRow row) { string szQCEventType = row.Cells[this.colQCEventType.Index].Value.ToString(); this.colMessageTitle.Items.Clear(); List <EMRDBLib.QaEventTypeDict> lstQCEventTypes = null; short shRet = QaEventTypeDictAccess.Instance.GetQCEventTypeList(ref lstQCEventTypes); if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.Show("获取病案质量问题分类字典失败!"); return; } if (lstQCEventTypes == null || lstQCEventTypes.Count <= 0) { return; } EMRDBLib.QaEventTypeDict selectedQCEventType = lstQCEventTypes.Find(delegate(EMRDBLib.QaEventTypeDict item) { return(item.QA_EVENT_TYPE == szQCEventType); }); if (selectedQCEventType == null || !string.IsNullOrEmpty(selectedQCEventType.PARENT_CODE)) { return; } for (int index = 0; index < lstQCEventTypes.Count; index++) { if (selectedQCEventType.INPUT_CODE != lstQCEventTypes[index].PARENT_CODE) { continue; } EMRDBLib.QaEventTypeDict qcEventType = lstQCEventTypes[index]; this.colMessageTitle.Items.Add(qcEventType.QA_EVENT_TYPE); } if (this.colMessageTitle.Items.Count == 0) { this.colMessageTitle.Items.Add(string.Empty); } this.colMessageTitle.DisplayStyle = ComboBoxStyle.DropDownList; }
/// <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.QaEventTypeDict qcEventType = row.Tag as EMRDBLib.QaEventTypeDict; if (qcEventType == null) { return(SystemData.ReturnValue.FAILED); } string szInputCode = qcEventType.INPUT_CODE; qcEventType = null; if (!this.MakeRowData(row, ref qcEventType)) { return(SystemData.ReturnValue.FAILED); } short shRet = SystemData.ReturnValue.OK; if (this.dataGridView1.IsDeletedRow(row)) { if (!this.dataGridView1.IsNewRow(row)) { shRet = QaEventTypeDictAccess.Instance.Delete(szInputCode); } 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 = QaEventTypeDictAccess.Instance.Update(qcEventType, szInputCode); if (shRet != SystemData.ReturnValue.OK) { this.dataGridView1.SelectRow(row); MessageBoxEx.Show("无法更新当前记录,输入码可能重复!"); return(SystemData.ReturnValue.FAILED); } row.Tag = qcEventType; this.dataGridView1.SetRowState(row, RowState.Normal); } else if (this.dataGridView1.IsNewRow(row)) { shRet = QaEventTypeDictAccess.Instance.Insert(qcEventType); if (shRet != SystemData.ReturnValue.OK) { this.dataGridView1.SelectRow(row); MessageBoxEx.Show("无法保存当前记录,输入码可能重复!"); return(SystemData.ReturnValue.FAILED); } row.Tag = qcEventType; this.dataGridView1.SetRowState(row, RowState.Normal); } return(SystemData.ReturnValue.OK); }