private void ExecuteCommand(int flag, string msg = "") { try { DialogResult dR = MyMessageBox.Show("您确认要" + msg + "?", "信息提示", MyMessageBoxButtons.OkCancel); if (dR == DialogResult.OK) { for (int i = 0; i < selection.SelectedCount; i++) { DataRowView dataRow = (DataRowView)Selection.selection[i]; string id = dataRow["ID"].ToString(); if (string.IsNullOrEmpty(id)) { return; } if (flag == 2) { CApplyObject.Approve(id, m_sUser); } else if (flag == 3) { CApplyObject.ApproveRef(id, m_sUser, memoReason.Text.Trim()); } } //Common.Ctrs.DLG.MessageBox.Show("审核成功!", "信息提示"); //刷新数据 selection.ClearSelection(); LoadData(); } } catch (Exception ex) { throw ex; } }
/// <summary> /// /// </summary> private void InitializeApplyList() { try { m_listObject.Clear(); int[] rows = dbGridView.GetSelectedRows(); for (int i = 0; i < rows.Length; i++) { CApplyObject m_applyObject = new CApplyObject(); m_applyObject.Clear(); m_applyObject.m_sNoOfInpat = dbGridView.GetRowCellValue(rows[i], "NOOFINPAT").ToString(); m_applyObject.m_sName = dbGridView.GetRowCellValue(rows[i], "NAME").ToString(); m_applyObject.m_sDepartmentName = dbGridView.GetRowCellValue(rows[i], "CYKS").ToString(); m_applyObject.m_iApplyTimes = int.Parse(dbGridView.GetRowCellValue(rows[i], "APPLYTIMES").ToString()); m_applyObject.m_sApplyContent = dbGridView.GetRowCellValue(rows[i], "APPLYCONTENT").ToString(); m_applyObject.m_sApply = dbGridView.GetRowCellValue(rows[i], "ID").ToString(); m_applyObject.m_sApplyDocId = this.m_sUser; m_applyObject.m_sApproveContent = dbGridView.GetRowCellValue(rows[i], "APPROVECONTENT").ToString(); m_applyObject.m_sApproveDate = dbGridView.GetRowCellValue(rows[i], "APPROVEDATE").ToString(); m_applyObject.m_sApproveDocId = dbGridView.GetRowCellValue(rows[i], "APPROVEDOCID").ToString(); m_listObject.Add(m_applyObject); } } catch (Exception) { throw; } }
/* * //是编辑页面还是延期页面 * public MedicalRecordEditAndDelay(IEmrHost app, object obj, int type) * { * m_app = app; * InitializeComponent(); * CApplyObject tempobj = (CApplyObject)obj; * m_sApplyId = tempobj.m_sApply; * m_sApplyDocId = tempobj.m_sApplyDocId; * this.txtDept.Text = tempobj.m_sDepartmentName; * this.txtName.Text = tempobj.m_sName; * this.txtNumber.Text = tempobj.m_sNoOfInpat; * this.txtTimes.Text = tempobj.m_iApplyTimes.ToString(); * this.memoReason.Text = tempobj.m_sApplyContent; * m_dealyMaxTime = ComponentCommand.GetDealyMaxTime(); * //最大延迟次数 * m_delaymaxTimes = ComponentCommand.GetDealyTimes(); * //最大时间 * m_readMaxTime = ComponentCommand.GetReadTime(); * m_iType = type; * if (type == 1) * { * this.labelMessage.Text = "延期原因"; * this.labelSubMessage.Text = "延期时间"; * this.Text = "申请延期"; * labelDay.Text = "天(*)最大不超过:" + m_dealyMaxTime + "天"; * } * else if (type == 0) * { * this.labelMessage.Text = "借阅目的"; * this.labelSubMessage.Text = "借阅期限"; * this.Text = "借阅编辑"; * labelDay.Text = "天(*)最大不超过:" + m_readMaxTime + "天"; * } * else if (type == 2) * { * this.btnSave.Enabled = false; * this.btnSubmit.Enabled = false; * this.txtTimes.Enabled = false; * this.memoReason.Enabled = false; * this.labelMessage.Text = "审核信息"; * this.labelSubMessage.Text = "审核日期"; * labelDay.Visible = false; * this.txtTimes.Text = tempobj.m_sApproveDate; * this.memoReason.Text = tempobj.m_sApproveContent; * this.Text = "查看原因"; * } * } */ #endregion /// <summary> /// 是编辑页面还是延期页面 /// </summary> /// <param name="obj"></param> /// <param name="type"></param> public MedicalRecordEditAndDelay(object obj, int type) { try { InitializeComponent(); CApplyObject tempobj = (CApplyObject)obj; m_sNoOfInpat = tempobj.m_sNoOfInpat; m_sApplyId = tempobj.m_sApply; m_sApplyDocId = tempobj.m_sApplyDocId; this.txtDept.Text = tempobj.m_sDepartmentName; this.txtName.Text = tempobj.m_sName; //this.txtNumber.Text = tempobj.m_sNoOfInpat;主键 this.txtNumber.Text = tempobj.m_sPatid;//add by zjy 2013-6-16 修改成住院号 m_dealyMaxTime = ComponentCommand.GetDealyMaxTime(); //最大延迟次数 m_delaymaxTimes = ComponentCommand.GetDealyTimes(); //最大时间 m_readMaxTime = ComponentCommand.GetReadTime(); m_iType = type; if (type == 1) { this.labelMessage.Text = "延期原因:"; this.labelSubMessage.Text = "延期天数:"; this.Text = "申请延期"; labelDay.Text = "天(*)最大不超过:" + m_dealyMaxTime + "天;" + "延期次数不超过:" + m_delaymaxTimes + "次"; this.txtTimes.Properties.MaxValue = m_dealyMaxTime; } else if (type == 0) { this.labelMessage.Text = "借阅目的:"; this.labelSubMessage.Text = "借阅期限:"; this.Text = "借阅编辑"; labelDay.Text = "天(*)最大不超过:" + m_readMaxTime + "天"; this.txtTimes.Text = tempobj.m_iApplyTimes.ToString(); this.txtTimes.Properties.MaxValue = m_readMaxTime; this.memoReason.Text = tempobj.m_sApplyContent; } else if (type == 2) { this.btnSave.Enabled = false; this.btnSubmit.Enabled = false; this.txtTimes.Visible = false; this.txtApproveDate.Visible = true; this.txtApproveDate.Enabled = false; this.memoReason.Enabled = false; this.labelMessage.Text = "审核信息:"; this.labelSubMessage.Text = "审核日期:"; labelDay.Visible = false; this.txtApproveDate.Text = tempobj.m_sApproveDate; this.memoReason.Text = tempobj.m_sApproveContent; this.Text = "查看原因"; } } catch (Exception ex) { throw ex; } }
/// <summary> /// 自动归还处理到期申请 /// </summary> private void AutoDealFeedMedicalRecord() { try { CApplyObject.AutoFeed(m_sUser); } catch (Exception ex) { throw ex; } }
/// <summary> /// /// </summary> /// <param name="flag"></param> private void OpenCommandDialog(int flag) { try { int refresh = 0; int tabIndex = 0; if (flag < 0) { MedicalRecordApply medicalRecordApply = new MedicalRecordApply(); medicalRecordApply.ShowDialog(); refresh = medicalRecordApply.m_iCommandFlag; tabIndex = medicalRecordApply.m_iTabIndex; } else { InitializeApplyList(); if (this.m_listObject.Count > 0) { CApplyObject obj = (CApplyObject)m_listObject[0]; MedicalRecordEditAndDelay medicalRecordApply = new MedicalRecordEditAndDelay(obj, flag); medicalRecordApply.ShowDialog(); refresh = medicalRecordApply.m_iCommandFlag; tabIndex = medicalRecordApply.m_iTabIndex; } } //刷新数据 if (refresh > 0) { MedicalRecordBrowseForm info = this.FindForm() as MedicalRecordBrowseForm; foreach (RecordModel rd in info.listAll) { if (rd.Index == tabIndex) { if (rd.MyControl == null) { info.UserControlDB(tabIndex); } rd.MyControl.GetInitDB(true); rd.MyDataTable = rd.MyControl.User_Table; rd.Count = rd.MyControl.User_Table.Rows.Count; info.RefreshInformation(rd.Index, rd.Count); } } } } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
// private bool CheckIsExistDelayApply(CApplyObject applyObject) { try { if (this.m_iType == 1) { return(CApplyObject.IsExistApply(applyObject) > 0); } else { return(false); } } catch (Exception) { throw; } }
//验证延期次数是否合法 private bool CheckDelayTimes(int type, CApplyObject applyObject) { try { if (type > 0) { return(CApplyObject.IsCanDelay(applyObject, m_delaymaxTimes) > 0); } else //申请新的不需要验证延期次数判断 { return(true); } } catch (Exception) { throw; } }
private void Save(CApplyObject applyObject) { //Status = 0;m_sApplyId try { if (this.m_iType == 0)//编辑,更新记录 { CApplyObject.Edit(applyObject); } else //延期新增记录 { //生成新的申请记录 CApplyObject.Delay(applyObject); } } catch (Exception) { throw; } }
private bool IsExistApply(string noofinpat) { try { CApplyObject applyObject = new CApplyObject(); applyObject.m_sApplyDocId = m_sUser; applyObject.m_sNoOfInpat = noofinpat; if (CApplyObject.IsExistApply(applyObject) > 0) { return(true); } else { return(false); } } catch (Exception) { throw; } }
//验证是否还允许延期申请 private bool CanDoDelay() { try { //InitializeApplyList(); if (this.m_listObject.Count > 0) { CApplyObject obj = (CApplyObject)m_listObject[0]; int times = ComponentCommand.GetDealyTimes(); return(CApplyObject.IsCanDelay(obj, times) > 0); } else { return(false); } } catch (Exception) { throw; } }
/// <summary> /// /// </summary> /// <param name="status"></param> /// <param name="info"></param> private void ExecuteCommand(int status, string info) { try { foreach (RecordModel re in listAll) { if (re.Index == this.tabControl.SelectedTabPageIndex) { DevExpress.XtraGrid.Views.Grid.GridView dbGridView = re.MyControl.dbGridView; if (dbGridView.RowCount > 0) { if (dbGridView.SelectedRowsCount > 0) { /* * string name = dbGridView.GetRowCellValue(dbGridView.GetSelectedRows()[0], "NAME").ToString(); * string number = dbGridView.GetRowCellValue(dbGridView.GetSelectedRows()[0], "NOOFINPAT").ToString(); * info = info + " 病历:" + name + "(" + number + ")"; */ DialogResult dR = DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("您确认要" + info + "吗?", "信息提示", MyMessageBoxButtons.OkCancel); if (dR == System.Windows.Forms.DialogResult.OK) { int[] list = dbGridView.GetSelectedRows(); int StatusCount = 0; for (int i = 0; i < list.Length; i++) { string id = dbGridView.GetRowCellValue(list[i], "ID").ToString(); if (status > 0) { dbGridView.SetRowCellValue(list[i], "STATUSDES", status); CApplyObject.UpdateStatus(id, status); dbGridView.DeleteRow(list[i]); StatusCount++; } else { dbGridView.DeleteRow(list[i]); CApplyObject.Delete(id); StatusCount++; } } switch (status) { case 1: foreach (RecordModel rd in listAll) { if (rd.Index == 2) { if (rd.MyControl == null) { UserControlDB(rd.Index); } rd.MyControl.GetInitDB(true); rd.MyDataTable = rd.MyControl.User_Table; rd.Count = rd.MyControl.User_Table.Rows.Count; RefreshInformation(rd.Index, rd.Count); } } break; //提交申请 case -1: break; //删除申请 case 5: foreach (RecordModel rd in listAll) { if (rd.Index == 4) { if (rd.MyControl == null) { UserControlDB(rd.Index); } rd.MyControl.GetInitDB(true); rd.MyDataTable = rd.MyControl.User_Table; rd.Count = rd.MyControl.User_Table.Rows.Count; RefreshInformation(rd.Index, rd.Count); } } break; //归还病历 case 4: foreach (RecordModel rd in listAll) { if (rd.Index == 5) { if (rd.MyControl == null) { UserControlDB(rd.Index); } rd.MyControl.GetInitDB(true); rd.MyDataTable = rd.MyControl.User_Table; rd.Count = rd.MyControl.User_Table.Rows.Count; RefreshInformation(rd.Index, rd.Count); } } break; //撤销申请 } re.Count = re.Count - StatusCount; re.MyControl.dbGridView = dbGridView; RefreshInformation(re.Index, re.Count); break; } } else { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(info + "请选择需要操作的记录", "信息提示"); } } } } //提交m_Apply } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }
/// <summary> /// /// </summary> /// <param name="flag"></param> private void OpenCommandDialog(int flag) { try { foreach (RecordModel re in listAll) { if (re.Index == this.tabControl.SelectedTabPageIndex) { MedicalRecordBrowse mf = re.MyControl; DevExpress.XtraGrid.Views.Grid.GridView dbGridView = mf.dbGridView; if (dbGridView.RowCount > 0) { int refresh = 0; int tabIndex = 0; int StatusCount = 0; if (flag < 0) { MedicalRecordApply medicalRecordApply = new MedicalRecordApply(); medicalRecordApply.ShowDialog(); refresh = medicalRecordApply.m_iCommandFlag; tabIndex = medicalRecordApply.m_iTabIndex; //2是提交,0是草稿 } else { InitializeApplyList(dbGridView); if (this.m_listObject.Count > 0) { CApplyObject obj = (CApplyObject)m_listObject[0]; MedicalRecordEditAndDelay medicalRecordApply = new MedicalRecordEditAndDelay(obj, flag); medicalRecordApply.ShowDialog(); refresh = medicalRecordApply.m_iCommandFlag; tabIndex = medicalRecordApply.m_iTabIndex; } } //刷新数据 if (refresh > 0) { if (tabIndex == 2) { int[] list = dbGridView.GetSelectedRows(); dbGridView.DeleteRow(list[0]); StatusCount++; } switch (flag) { case -1: //申请 foreach (RecordModel rd in listAll) { if (rd.Index == 2) { if (rd.MyControl == null) { UserControlDB(rd.Index); } rd.MyControl.GetInitDB(true); rd.MyDataTable = rd.MyControl.User_Table; rd.Count = rd.MyControl.User_Table.Rows.Count; RefreshInformation(rd.Index, rd.Count); } } break; case 0: //编辑 foreach (RecordModel rd in listAll) { if (rd.Index == 2) { if (rd.MyControl == null) { UserControlDB(rd.Index); } rd.MyControl.GetInitDB(true); rd.MyDataTable = rd.MyControl.User_Table; rd.Count = rd.MyControl.User_Table.Rows.Count; RefreshInformation(rd.Index, rd.Count); } } break; case 1: foreach (RecordModel rd in listAll) { if (rd.Index == 0) { if (rd.MyControl == null) { UserControlDB(rd.Index); } rd.MyControl.GetInitDB(true); rd.MyDataTable = rd.MyControl.User_Table; rd.Count = rd.MyControl.User_Table.Rows.Count; RefreshInformation(rd.Index, rd.Count); } else if (rd.Index == 3) { if (rd.MyControl == null) { UserControlDB(rd.Index); } rd.MyControl.GetInitDB(true); rd.MyDataTable = rd.MyControl.User_Table; rd.Count = rd.MyControl.User_Table.Rows.Count; RefreshInformation(rd.Index, rd.Count); } } break; //申请延期事件 } re.MyControl.GetInitDB(true); re.Count = re.Count - StatusCount; re.MyControl.dbGridView = dbGridView; RefreshInformation(re.Index, re.Count); break; } } break; } } } catch (Exception ex) { MyMessageBox.Show(1, ex); } }
private void Commit(int type, string info) { try { string message = ""; if (!CheckApplyTimes(ref message)) { MessageBox.Show(message); return; } CApplyObject applyObject = new CApplyObject(); applyObject.m_sApply = this.m_sApplyId; applyObject.m_sNoOfInpat = this.m_sNoOfInpat; applyObject.m_sApplyDocId = this.m_sApplyDocId; applyObject.m_sApplyContent = this.memoReason.Text.Trim(); applyObject.m_iStatus = type; applyObject.m_sYanqiflag = this.m_sApplyId; applyObject.m_iApplyTimes = int.Parse(this.txtTimes.Text.Trim()); if (type == 1) { this.m_iTabIndex = 2; } if (!CheckIsExistDelayApply(applyObject)) { if (CheckDelayTimes(m_iType, applyObject)) { Save(applyObject); DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(info + "操作成功", "信息提示"); m_iCommandFlag = 1; this.Close(); } else { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("延期次数已超过限制,不能再延期", "信息提示"); this.btnCancel.Focus(); } } else { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("借阅申请已存在延期记录", "信息提示"); this.btnCancel.Focus(); } //} //else //{ // string msg = ""; // if (m_iType == 1) // { // msg = "请输入不超过" + this.m_dealyMaxTime + "的天数"; // } // else // { // msg = "请输入不超过" + this.m_readMaxTime + "的天数"; // } // Common.Ctrs.DLG.MessageBox.Show(msg, "信息提示"); // this.txtTimes.Focus(); //} } catch (Exception ex) { DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex); } }