private void dataTableView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0) { return; } DataGridViewRow row = this.dataTableView1.Rows[e.RowIndex]; RecMrBatch recMrBatch = this.dataTableView1.Rows[e.RowIndex].Tag as RecMrBatch; if (e.ColumnIndex == this.colReceive.Index) { if (recMrBatch.RECEIVE_TIME != recMrBatch.DefaultTime) { if (MessageBoxEx.ShowConfirm("纸质病历批次已接收,是否重新接收") != DialogResult.OK) { return; } } else { if (MessageBoxEx.ShowConfirm("确认接收吗?") != DialogResult.OK) { return; } } recMrBatch.RECEIVE_DEPT_CODE = SystemParam.Instance.UserInfo.DEPT_CODE; recMrBatch.RECEIVE_DEPT_NAME = SystemParam.Instance.UserInfo.DEPT_NAME; recMrBatch.RECEIVE_DOCTOR_ID = SystemParam.Instance.UserInfo.USER_ID; recMrBatch.RECEIVE_DOCTOR_NAME = SystemParam.Instance.UserInfo.USER_NAME; recMrBatch.RECEIVE_TIME = SysTimeHelper.Instance.Now; short shRet = RecMrBatchAccess.Instance.Update(recMrBatch); if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.ShowMessage("操作失败"); return; } row.Cells[this.col_RECEIVE_DOCTOR_NAME.Index].Value = recMrBatch.RECEIVE_DOCTOR_NAME; row.Cells[this.col_RECEIVE_TIME.Index].Value = recMrBatch.RECEIVE_TIME.ToString("yyyy-MM-dd HH:mm"); MessageBoxEx.ShowMessage("操作成功"); } }
private void btnSend_Click(object sender, EventArgs e) { if (this.txt_BATCH_NO.Text.Trim() != string.Empty) { MessageBoxEx.ShowMessage("批次号已经生成,请刷新页面后重试"); return; } if (this.txt_WORKER_ID.Text.Trim() == string.Empty || this.txt_WORKER_NAME.Text.Trim() == string.Empty) { MessageBoxEx.ShowMessage("请输入工人信息"); return; } RecMrBatch recMrBatch = new RecMrBatch(); recMrBatch.BATCH_NO = recMrBatch.MakeBatchNo(SystemParam.Instance.UserInfo.DEPT_CODE); recMrBatch.INP_NOS = string.Join("|", m_lstPatVisit.Select(m => m.INP_NO).ToArray()); recMrBatch.MR_COUNT = this.m_lstPatVisit.Count; recMrBatch.PAPER_COUNT = this.m_paperCount++; recMrBatch.SEND_DEPT_CODE = SystemParam.Instance.UserInfo.DEPT_CODE; recMrBatch.SEND_DEPT_NAME = SystemParam.Instance.UserInfo.DEPT_NAME; recMrBatch.SEND_DOCTOR_ID = SystemParam.Instance.UserInfo.USER_ID; recMrBatch.SEND_DOCTOR_NAME = SystemParam.Instance.UserInfo.USER_NAME; recMrBatch.SEND_TIME = SysTimeHelper.Instance.Now; recMrBatch.VISIT_NOS = string.Join("|", m_lstPatVisit.Select(m => m.VISIT_NO).ToArray()); recMrBatch.WORKER_ID = this.txt_WORKER_ID.Text; recMrBatch.WORKER_NAME = this.txt_WORKER_NAME.Text; short shRet = RecMrBatchAccess.Instance.Insert(recMrBatch); if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.ShowError("无法正常发送"); return; } MessageBoxEx.ShowMessage("发送成功"); this.txt_BATCH_NO.Text = recMrBatch.BATCH_NO; }
/// <summary> /// 更新一条整改通知单 /// </summary> /// <param name="timeQCRule">自动核查规则配置信息</param> /// <returns>SystemData.ReturnValue</returns> public short Update(RecMrBatch recMrBatch) { if (recMrBatch == null) { LogManager.Instance.WriteLog("", new string[] { "" } , new object[] { recMrBatch }, "参数不能为空"); return(SystemData.ReturnValue.PARAM_ERROR); } if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } StringBuilder sbField = new StringBuilder(); sbField.AppendFormat("{0}='{1}'," , SystemData.RecMrBatchTable.INP_NOS, recMrBatch.INP_NOS); sbField.AppendFormat("{0}={1}," , SystemData.RecMrBatchTable.MR_COUNT, recMrBatch.MR_COUNT); sbField.AppendFormat("{0}={1}," , SystemData.RecMrBatchTable.PAPER_COUNT, recMrBatch.PAPER_COUNT); sbField.AppendFormat("{0}='{1}'," , SystemData.RecMrBatchTable.RECEIVE_DEPT_CODE, recMrBatch.RECEIVE_DEPT_CODE); sbField.AppendFormat("{0}='{1}'," , SystemData.RecMrBatchTable.RECEIVE_DEPT_NAME, recMrBatch.RECEIVE_DEPT_NAME); sbField.AppendFormat("{0}='{1}'," , SystemData.RecMrBatchTable.RECEIVE_DOCTOR_ID, recMrBatch.RECEIVE_DOCTOR_ID); sbField.AppendFormat("{0}='{1}'," , SystemData.RecMrBatchTable.RECEIVE_DOCTOR_NAME, recMrBatch.RECEIVE_DOCTOR_NAME); sbField.AppendFormat("{0}={1}," , SystemData.RecMrBatchTable.RECEIVE_TIME, base.MedQCAccess.GetSqlTimeFormat(recMrBatch.RECEIVE_TIME)); sbField.AppendFormat("{0}='{1}'," , SystemData.RecMrBatchTable.REMARK, recMrBatch.REMARK); sbField.AppendFormat("{0}={1}," , SystemData.RecMrBatchTable.SEND_DEPT_CODE, recMrBatch.SEND_DEPT_CODE); sbField.AppendFormat("{0}='{1}'," , SystemData.RecMrBatchTable.SEND_DEPT_NAME, recMrBatch.SEND_DEPT_NAME); sbField.AppendFormat("{0}='{1}'," , SystemData.RecMrBatchTable.SEND_DOCTOR_ID, recMrBatch.SEND_DOCTOR_ID); sbField.AppendFormat("{0}='{1}'," , SystemData.RecMrBatchTable.SEND_DOCTOR_NAME, recMrBatch.SEND_DOCTOR_NAME); sbField.AppendFormat("{0}={1}," , SystemData.RecMrBatchTable.SEND_TIME, base.MedQCAccess.GetSqlTimeFormat(recMrBatch.SEND_TIME)); sbField.AppendFormat("{0}='{1}'," , SystemData.RecMrBatchTable.VISIT_NOS, recMrBatch.VISIT_NOS); sbField.AppendFormat("{0}='{1}'," , SystemData.RecMrBatchTable.WORKER_ID, recMrBatch.WORKER_ID); sbField.AppendFormat("{0}='{1}'" , SystemData.RecMrBatchTable.WORKER_NAME, recMrBatch.WORKER_NAME); string szCondition = string.Format("{0}='{1}'", SystemData.RecMrBatchTable.BATCH_NO, recMrBatch.BATCH_NO); string szSQL = string.Format(SystemData.SQL.UPDATE, SystemData.DataTable.REC_MR_BATCH, sbField.ToString(), szCondition); int nCount = 0; try { nCount = base.MedQCAccess.ExecuteNonQuery(szSQL, CommandType.Text); } catch (Exception ex) { LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, ex); return(SystemData.ReturnValue.EXCEPTION); } if (nCount <= 0) { LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, "SQL语句执行后返回0!"); return(SystemData.ReturnValue.EXCEPTION); } return(SystemData.ReturnValue.OK); }
/// <summary> /// 获取所有自动核查结果信息列表 /// </summary> /// <param name="lstQcCheckResults"></param> /// <returns>SystemData.ReturnValue</returns> public short GetRecMrBatch(string szBatchNo, ref RecMrBatch RecMrBatch) { if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } StringBuilder sbField = new StringBuilder(); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.BATCH_NO); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.INP_NOS); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.MR_COUNT); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.PAPER_COUNT); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.RECEIVE_DEPT_CODE); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.RECEIVE_DEPT_NAME); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.RECEIVE_DOCTOR_ID); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.RECEIVE_DOCTOR_NAME); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.RECEIVE_TIME); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.REMARK); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.SEND_DEPT_CODE); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.SEND_DEPT_NAME); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.SEND_DOCTOR_ID); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.SEND_DOCTOR_NAME); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.SEND_TIME); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.VISIT_NOS); sbField.AppendFormat("{0},", SystemData.RecMrBatchTable.WORKER_ID); sbField.AppendFormat("{0}", SystemData.RecMrBatchTable.WORKER_NAME); string szCondition = string.Format("1=1"); if (!string.IsNullOrEmpty(szBatchNo)) { szCondition = string.Format("{0} AND {1} = '{2}'" , szCondition , SystemData.RecMrBatchTable.BATCH_NO , szBatchNo); } string szSQL = string.Format(SystemData.SQL.SELECT_WHERE , sbField.ToString(), SystemData.DataTable.REC_MR_BATCH, szCondition); IDataReader dataReader = null; try { dataReader = base.MedQCAccess.ExecuteReader(szSQL, CommandType.Text); if (dataReader == null || dataReader.IsClosed || !dataReader.Read()) { return(SystemData.ReturnValue.RES_NO_FOUND); } if (RecMrBatch == null) { RecMrBatch = new RecMrBatch(); } for (int i = 0; i < dataReader.FieldCount; i++) { if (dataReader.IsDBNull(i)) { continue; } switch (dataReader.GetName(i)) { case SystemData.RecMrBatchTable.BATCH_NO: RecMrBatch.BATCH_NO = dataReader.GetString(i); break; case SystemData.RecMrBatchTable.INP_NOS: RecMrBatch.INP_NOS = dataReader.GetString(i); break; case SystemData.RecMrBatchTable.MR_COUNT: RecMrBatch.MR_COUNT = int.Parse(dataReader.GetValue(i).ToString()); break; case SystemData.RecMrBatchTable.PAPER_COUNT: RecMrBatch.PAPER_COUNT = int.Parse(dataReader.GetValue(i).ToString()); break; case SystemData.RecMrBatchTable.RECEIVE_DEPT_CODE: RecMrBatch.RECEIVE_DEPT_CODE = dataReader.GetValue(i).ToString(); break; case SystemData.RecMrBatchTable.RECEIVE_DEPT_NAME: RecMrBatch.RECEIVE_DEPT_NAME = dataReader.GetString(i); break; case SystemData.RecMrBatchTable.RECEIVE_DOCTOR_ID: RecMrBatch.RECEIVE_DOCTOR_ID = dataReader.GetString(i); break; case SystemData.RecMrBatchTable.RECEIVE_DOCTOR_NAME: RecMrBatch.RECEIVE_DOCTOR_NAME = dataReader.GetString(i); break; case SystemData.RecMrBatchTable.RECEIVE_TIME: RecMrBatch.RECEIVE_TIME = dataReader.GetDateTime(i); break; case SystemData.RecMrBatchTable.REMARK: RecMrBatch.REMARK = dataReader.GetString(i); break; case SystemData.RecMrBatchTable.SEND_DEPT_CODE: RecMrBatch.SEND_DEPT_CODE = dataReader.GetString(i); break; case SystemData.RecMrBatchTable.SEND_DEPT_NAME: RecMrBatch.SEND_DEPT_NAME = dataReader.GetString(i); break; case SystemData.RecMrBatchTable.SEND_DOCTOR_ID: RecMrBatch.SEND_DOCTOR_ID = dataReader.GetString(i); break; case SystemData.RecMrBatchTable.SEND_DOCTOR_NAME: RecMrBatch.SEND_DOCTOR_NAME = dataReader.GetString(i); break; case SystemData.RecMrBatchTable.SEND_TIME: RecMrBatch.SEND_TIME = dataReader.GetDateTime(i); break; case SystemData.RecMrBatchTable.VISIT_NOS: RecMrBatch.VISIT_NOS = dataReader.GetString(i); break; case SystemData.RecMrBatchTable.WORKER_ID: RecMrBatch.WORKER_ID = dataReader.GetString(i); break; case SystemData.RecMrBatchTable.WORKER_NAME: RecMrBatch.WORKER_NAME = dataReader.GetString(i); break; } } return(SystemData.ReturnValue.OK); } catch (Exception ex) { LogManager.Instance.WriteLog("", new string[] { "szSQL" }, new object[] { szSQL }, ex); return(SystemData.ReturnValue.EXCEPTION); } finally { base.MedQCAccess.CloseConnnection(false); } }