示例#1
0
        /// <summary>
        /// 画面检查
        /// edit by Yanqiao.Cai 2012-11-23
        /// 1、add try ... catch
        /// 2、优化提示
        /// </summary>
        private void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (m_AllDisplayDateTime.Contains(CommitDateTime.ToString("yyyy-MM-dd HH:mm:ss")))
                {
                    this.labelControl_Info.Text    = "该病程时间已存在,请选择其它时间。";
                    this.labelControl_Info.ToolTip = "该病程时间已存在,请选择其它时间。";
                    dateEdit_Date.Focus();
                    return;
                }

                if (m_labelControlInfoText != "" && (CommitDateTime - Convert.ToDateTime(m_labelControlInfoText)).TotalMinutes < 0)
                {
                    if (!string.IsNullOrEmpty(beginTime) && DateTime.Parse(beginTime) == DateTime.Parse(m_labelControlInfoText))
                    {
                        this.labelControl_Info.Text    = "病程时间应大于 " + m_labelControlInfoText;
                        this.labelControl_Info.ToolTip = "病程时间应大于 " + m_labelControlInfoText;
                    }
                    else
                    {
                        this.labelControl_Info.Text    = "病程时间应大于 " + m_labelControlInfoText;
                        this.labelControl_Info.ToolTip = "病程时间应大于 " + m_labelControlInfoText;
                    }
                    dateEdit_Date.Focus();
                    return;
                }
                //注释 by cyq 2013-01-04 修复历史病历导入后无法新增病历的bug
                //else if (CommitDateTime > DateTime.Now)
                //{
                //    this.labelControl_Info.Text = "病程时间不能大于当前时间";
                //    this.labelControl_Info.ToolTip = "病程时间不能大于当前时间";
                //    dateEdit_Date.Focus();
                //    return;
                //}
                else
                {
                    //查看数据库中是否存在该时间的有效病历
                    ///1、查找所有病人的有效病历
                    DataTable theRecords = DS_SqlService.GetRecordsByNoofinpat(noofInpat);
                    if (null != theRecords && theRecords.Rows.Count > 0 && theRecords.Select(" 1=1 ").Any(p => DateTime.Parse(p["captiondatetime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss") == CommitDateTime.ToString("yyyy-MM-dd HH:mm:ss")))
                    {
                        DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("数据库中已存在时间为 " + CommitDateTime.ToString("yyyy-MM-dd HH:mm:ss") + " 的病历,请选择其它的时间。");
                        return;
                    }
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                }
            }
            catch (Exception ex)
            {
                DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex);
            }
        }
示例#2
0
        /// <summary>
        /// 病历归档事件
        /// <auth>Yanqiao.Cai</auth>
        /// <date>2011-11-05</date>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_reback_Click(object sender, EventArgs e)
        {
            try
            {
                int fouceRowIndex = gridviewRecordNoOnFile.FocusedRowHandle;
                if (fouceRowIndex < 0)
                {
                    gridControlRecordNoOnFile.Focus();
                    SqlUtil.App.CustomMessageBox.MessageShow("请选择一条病人记录");
                    return;
                }
                DataRow foucesRow = gridviewRecordNoOnFile.GetDataRow(fouceRowIndex);
                if (null == foucesRow || null == foucesRow["NOOFINPAT"])
                {
                    return;
                }
                int noofinpat = int.Parse(foucesRow["NOOFINPAT"].ToString().Trim());

                DataTable dt = DS_SqlService.GetRecordsByNoofinpat(noofinpat);
                if (null == dt || dt.Rows.Count == 0)
                {
                    DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(foucesRow["NAME"] + " 没有病历,无法归档。");
                    return;
                }
                if (DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("您确定要归档 " + foucesRow["NAME"] + " 的病历吗?", "归档病历", DrectSoft.Common.Ctrs.DLG.MyMessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
                if (DS_BaseService.CheckRecordRebacked(noofinpat.ToString()))
                {
                    int num = DS_SqlService.SetRecordsRebacked(noofinpat.ToString());
                    if (num > 0)
                    {
                        DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("归档成功");
                        gridviewRecordNoOnFile.DeleteRow(gridviewRecordNoOnFile.FocusedRowHandle);
                        return;
                    }
                }
                DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("该病人已归档。");
            }
            catch (Exception ex)
            {
                DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex);
            }
        }