/// <summary>
 /// genggaizhuangtai
 /// </summary>
 /// <param name="message"></param>
 /// <param name="state"></param>
 void updatestate(string message, string state)
 {
     try
     {
         int fouceRowIndex = dbGridView.FocusedRowHandle;
         if (fouceRowIndex < 0)
         {
             dbGrid.Focus();
             SqlUtil.App.CustomMessageBox.MessageShow("请选择一条病人记录");
             return;
         }
         DataRow foucesRow = dbGridView.GetDataRow(fouceRowIndex);
         if (null == foucesRow || null == foucesRow["NOOFINPAT"])
         {
             return;
         }
         int noofinpat = int.Parse(foucesRow["NOOFINPAT"].ToString().Trim());
         #region 注释验证是否有病例
         //DataTable dt = DS_SqlService.GetRecordsByNoofinpat(noofinpat);
         //if (null == dt || dt.Rows.Count == 0)
         //{
         //    Common.Ctrs.DLG.MessageBox.Show(foucesRow["NAME"] + " 没有病历,无法归档。");
         //    return;
         //}
         #endregion
         if (DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("您确定要" + message + foucesRow["NAME"] + " 的病历吗?", message + "病历", DrectSoft.Common.Ctrs.DLG.MyMessageBoxButtons.YesNo) == DialogResult.No)
         {
             return;
         }
         if (state == "1500")//add by Ukey 2016-11-12 Add to cancel discharge from hospital
         {
             string StrSelectPat = @"select * from inpatient where inpatient.noofinpat = '{0}';";
             string strStatus    = m_app.SqlHelper.ExecuteDataTable(string.Format(StrSelectPat, noofinpat), CommandType.Text).Rows[0]["status"].ToString().Trim();
             if (strStatus.Equals("1503"))
             {
                 string StrDisOutHos = @"update inpatient set status = '1500',outwarddate = '',outhosdate = '',emrouthos='' where noofinpat = '{0}';";
                 m_app.SqlHelper.ExecuteNoneQuery(string.Format(StrDisOutHos, noofinpat), CommandType.Text);
                 DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(message + "成功");
                 dbGridView.DeleteRow(dbGridView.FocusedRowHandle);
                 return;
             }
             else
             {
                 DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(message + "失败,病人不是在院状态!");
                 return;
             }
         }
         // DS_BaseService.CheckRecordRebacked(noofinpat.ToString())
         if (foucesRow["islock"].ToString() != "4701")
         {
             int num = DS_SqlService.SetRecordstate(noofinpat.ToString(), state);
             if (num > 0)
             {
                 if (message == "取消质控")
                 {
                     ArrayList al = new ArrayList();
                     al.Add("delete from emr_automark_record where noofinpat='" + noofinpat.ToString() + "'");
                     al.Add("delete from emr_point where noofinpat='" + noofinpat.ToString() + "'");
                     al.Add("delete from emr_automark_record_detail where noofinpat='" + noofinpat.ToString() + "'");
                     m_app.SqlHelper.ExecuteSqlTran2(al);
                 }
                 DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(message + "成功");
                 dbGridView.DeleteRow(dbGridView.FocusedRowHandle);
                 return;
             }
         }
         DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show("该病人已" + message);
     }
     catch (Exception ex)
     {
         DrectSoft.Common.Ctrs.DLG.MyMessageBox.Show(1, ex);
     }
 }