private void btnArchiveTime_Click(object sender, EventArgs e) { if (this.dataGridView1.SelectedRows.Count <= 0) { return; } PatVisitInfo patVisitInfo = this.dataGridView1.SelectedRows[0].Tag as PatVisitInfo; QcMrIndex qcMrIndex = this.dataGridView1.SelectedRows[0].Cells[this.col_ARCHIVE_TIME.Index].Tag as QcMrIndex; if (patVisitInfo == null) { MessageBoxEx.ShowMessage("取消催送失败"); return; } short shRet = SystemData.ReturnValue.OK; if (qcMrIndex == null) { qcMrIndex = new QcMrIndex(); qcMrIndex.ARCHIVE_DOCTOR = SystemParam.Instance.UserInfo.USER_NAME; qcMrIndex.ARCHIVE_DOCTOR_ID = SystemParam.Instance.UserInfo.USER_ID; qcMrIndex.ARCHIVE_TIME = SysTimeHelper.Instance.Now; qcMrIndex.PATIENT_ID = patVisitInfo.PATIENT_ID; qcMrIndex.VISIT_ID = patVisitInfo.VISIT_ID; qcMrIndex.VISIT_NO = patVisitInfo.VISIT_NO; shRet = QcMrIndexAccess.Instance.Insert(qcMrIndex); } else { qcMrIndex.ARCHIVE_TIME = SysTimeHelper.Instance.Now; shRet = QcMrIndexAccess.Instance.Update(qcMrIndex); } if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.ShowMessage("取消催送失败"); return; } //更新mrIndex表,将病案设为归档状态 MrIndex mrIndex = new MrIndex(); mrIndex.PATIENT_ID = qcMrIndex.PATIENT_ID; mrIndex.VISIT_ID = qcMrIndex.VISIT_ID; mrIndex.VISIT_NO = qcMrIndex.VISIT_NO; mrIndex.MR_STATUS = SystemData.MrStatus.Archive; shRet = MrIndexAccess.Instance.UpdateMrStatus(mrIndex); if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.ShowMessage("更新病案状态失败"); return; } this.dataGridView1.SelectedRows[0].Cells[this.col_ARCHIVE_TIME.Index].Value = qcMrIndex.ARCHIVE_TIME.ToString("yyyy-MM-dd HH:mm"); MessageBoxEx.ShowMessage("取消催送成功"); }
public short Update(QcMrIndex qcMrIndex) { if (qcMrIndex == null) { LogManager.Instance.WriteLog("", new string[] { "" } , new object[] { qcMrIndex }, "参数不能为空"); return(SystemData.ReturnValue.PARAM_ERROR); } if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } StringBuilder sbField = new StringBuilder(); sbField.AppendFormat("{0}='{1}'," , SystemData.QcMrIndexTable.ARCHIVE_DOCTOR, qcMrIndex.ARCHIVE_DOCTOR); sbField.AppendFormat("{0}='{1}'," , SystemData.QcMrIndexTable.ARCHIVE_DOCTOR_ID, qcMrIndex.ARCHIVE_DOCTOR_ID); sbField.AppendFormat("{0}={1}," , SystemData.QcMrIndexTable.ARCHIVE_TIME, base.MedQCAccess.GetSqlTimeFormat(qcMrIndex.ARCHIVE_TIME)); sbField.AppendFormat("{0}={1}," , SystemData.QcMrIndexTable.PAPER_RECEIVE, qcMrIndex.PAPER_RECEIVE); sbField.AppendFormat("{0}={1}," , SystemData.QcMrIndexTable.RETURN_COUNT, qcMrIndex.RETURN_COUNT); sbField.AppendFormat("{0}='{1}'," , SystemData.QcMrIndexTable.SUBMIT_DOCTOR, qcMrIndex.SUBMIT_DOCTOR); sbField.AppendFormat("{0}='{1}'," , SystemData.QcMrIndexTable.SUBMIT_DOCTOR_ID, qcMrIndex.SUBMIT_DOCTOR_ID); sbField.AppendFormat("{0}={1}" , SystemData.QcMrIndexTable.SUBMIT_TIME, base.MedQCAccess.GetSqlTimeFormat(qcMrIndex.SUBMIT_TIME)); string szCondition = string.Format("{0}='{1}' and {2}='{3}'" , SystemData.QcMrIndexTable.PATIENT_ID, qcMrIndex.PATIENT_ID , SystemData.QcMrIndexTable.VISIT_ID, qcMrIndex.VISIT_ID); string szSQL = string.Format(SystemData.SQL.UPDATE, SystemData.DataTable.QC_MR_INDEX, 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); }
private void btnArchive_Click(object sender, EventArgs e) { if (MessageBoxEx.ShowConfirm("确认归档选中的病案吗?") != DialogResult.OK) { return; } StringBuilder errorMessage = new StringBuilder(); foreach (DataGridViewRow row in this.dataTableView1.Rows) { if (row.Cells[this.col_CheckBox.Index].Value == null || row.Cells[this.col_CheckBox.Index].Value.ToString().ToLower() == "false") { continue; } MrArchive mrArchive = row.Tag as MrArchive; if (mrArchive == null) { continue; } //修改病案状态 MrIndex mrIndex = new MrIndex(); mrIndex.MR_STATUS = SystemData.MrStatus.Archive; mrIndex.PATIENT_ID = mrArchive.PATIENT_ID; mrIndex.VISIT_ID = mrArchive.VISIT_ID; mrIndex.VISIT_NO = mrArchive.VISIT_NO; short shRet = MrIndexAccess.Instance.UpdateMrStatus(mrIndex); if (shRet != SystemData.ReturnValue.OK) { errorMessage.AppendFormat("{0}\r\n", mrArchive.PATIENT_NAME); continue; } QcMrIndex qcMrIndex = null; shRet = QcMrIndexAccess.Instance.GetQcMrIndex(mrArchive.PATIENT_ID, mrArchive.VISIT_ID, ref qcMrIndex); if (qcMrIndex == null) { qcMrIndex = new QcMrIndex(mrArchive); } qcMrIndex.ARCHIVE_DOCTOR = SystemParam.Instance.UserInfo.USER_NAME; qcMrIndex.ARCHIVE_DOCTOR_ID = SystemParam.Instance.UserInfo.USER_ID; qcMrIndex.ARCHIVE_TIME = SysTimeHelper.Instance.Now; if (shRet == SystemData.ReturnValue.RES_NO_FOUND) { shRet = QcMrIndexAccess.Instance.Insert(qcMrIndex); } else if (shRet == SystemData.ReturnValue.OK) { shRet = QcMrIndexAccess.Instance.Update(qcMrIndex); } mrArchive.MR_STATUS = mrIndex.MR_STATUS; mrArchive.ARCHIVE_DOCTOR = qcMrIndex.ARCHIVE_DOCTOR; mrArchive.ARCHIVE_DOCTOR_ID = qcMrIndex.ARCHIVE_DOCTOR_ID; mrArchive.ARCHIVE_TIME = qcMrIndex.ARCHIVE_TIME; row.Cells[this.col_MR_STATUS.Index].Value = SystemData.MrStatus.GetMedMrStatusDesc(mrArchive.MR_STATUS); row.Cells[this.col_ARCHIVE_TIME.Index].Value = mrArchive.ARCHIVE_TIME.ToString("yyyy-MM-dd HH:mm"); } if (errorMessage.ToString() != string.Empty) { MessageBoxEx.ShowError("以下病案归档失败:\n" + errorMessage.ToString()); return; } MessageBoxEx.ShowMessage("归档成功"); }
private void dataTableView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0) { return; } DataGridViewRow row = this.dataTableView1.Rows[e.RowIndex]; MrArchive mrAchive = this.dataTableView1.Rows[e.RowIndex].Tag as MrArchive; if (e.ColumnIndex == this.colReject.Index) { if (MessageBoxEx.ShowConfirm("确认驳回吗?") != DialogResult.OK) { return; } //修改病案状态 MrIndex mrIndex = new MrIndex(); mrIndex.MR_STATUS = SystemData.MrStatus.Online; mrIndex.PATIENT_ID = mrAchive.PATIENT_ID; mrIndex.VISIT_ID = mrAchive.VISIT_ID; mrIndex.VISIT_NO = mrAchive.VISIT_NO; short shRet = MrIndexAccess.Instance.UpdateMrStatus(mrIndex); if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.ShowMessage("驳回失败"); return; } QcMrIndex qcMrIndex = new QcMrIndex(mrAchive); qcMrIndex.RETURN_COUNT = mrAchive.RETURN_COUNT + 1; shRet = QcMrIndexAccess.Instance.Update(qcMrIndex); MessageBoxEx.ShowMessage("驳回成功"); mrAchive.RETURN_COUNT = qcMrIndex.RETURN_COUNT; mrAchive.MR_STATUS = mrIndex.MR_STATUS; if (mrAchive.RETURN_COUNT != 0) { string szFlag = string.Empty; for (int i = 0; i < mrAchive.RETURN_COUNT; i++) { szFlag += "🏁 "; } row.Cells[this.col_RETURN_COUNT.Index].Value = szFlag; row.Cells[this.col_RETURN_COUNT.Index].Style.ForeColor = Color.Red; } this.dataTableView1.Rows[e.RowIndex].Cells[this.col_ARCHIVE_TIME.Index].Value = null; this.dataTableView1.Rows[e.RowIndex].Cells[this.col_MR_STATUS.Index].Value = SystemData.MrStatus.GetMedMrStatusDesc(mrAchive.MR_STATUS); } else if (e.ColumnIndex == this.colArchive.Index) { if (MessageBoxEx.ShowConfirm("确认归档吗?") != DialogResult.OK) { return; } //修改病案状态 MrIndex mrIndex = new MrIndex(); mrIndex.MR_STATUS = SystemData.MrStatus.Archive; mrIndex.PATIENT_ID = mrAchive.PATIENT_ID; mrIndex.VISIT_ID = mrAchive.VISIT_ID; mrIndex.VISIT_NO = mrAchive.VISIT_NO; short shRet = MrIndexAccess.Instance.UpdateMrStatus(mrIndex); if (shRet != SystemData.ReturnValue.OK) { MessageBoxEx.ShowMessage("归档失败"); return; } QcMrIndex qcMrIndex = null; shRet = QcMrIndexAccess.Instance.GetQcMrIndex(mrAchive.PATIENT_ID, mrAchive.VISIT_ID, ref qcMrIndex); if (qcMrIndex == null) { qcMrIndex = new QcMrIndex(mrAchive); } qcMrIndex.ARCHIVE_DOCTOR = SystemParam.Instance.UserInfo.USER_NAME; qcMrIndex.ARCHIVE_DOCTOR_ID = SystemParam.Instance.UserInfo.USER_ID; qcMrIndex.ARCHIVE_TIME = SysTimeHelper.Instance.Now; if (shRet == SystemData.ReturnValue.RES_NO_FOUND) { shRet = QcMrIndexAccess.Instance.Insert(qcMrIndex); } else if (shRet == SystemData.ReturnValue.OK) { shRet = QcMrIndexAccess.Instance.Update(qcMrIndex); } MessageBoxEx.ShowMessage("归档成功"); mrAchive.MR_STATUS = mrIndex.MR_STATUS; mrAchive.ARCHIVE_DOCTOR = qcMrIndex.ARCHIVE_DOCTOR; mrAchive.ARCHIVE_DOCTOR_ID = qcMrIndex.ARCHIVE_DOCTOR_ID; mrAchive.ARCHIVE_TIME = qcMrIndex.ARCHIVE_TIME; this.dataTableView1.Rows[e.RowIndex].Cells[this.col_ARCHIVE_TIME.Index].Value = mrAchive.ARCHIVE_TIME.ToString("yyyy-MM-dd HH:mm"); this.dataTableView1.Rows[e.RowIndex].Cells[this.col_MR_STATUS.Index].Value = SystemData.MrStatus.GetMedMrStatusDesc(mrAchive.MR_STATUS); } else if (e.ColumnIndex == this.col_CheckBox.Index) { if (row.Cells[this.col_CheckBox.Index].Value != null && row.Cells[this.col_CheckBox.Index].Value.ToString() == "True") { row.Cells[this.col_CheckBox.Index].Value = false; } else { row.Cells[this.col_CheckBox.Index].Value = true; } } }
public short GetQcMrIndex(string szPatientID, string szVisitID, ref QcMrIndex qcMrIndex) { if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } StringBuilder sbField = new StringBuilder(); sbField.AppendFormat("{0},", SystemData.QcMrIndexTable.ARCHIVE_DOCTOR); sbField.AppendFormat("{0},", SystemData.QcMrIndexTable.ARCHIVE_DOCTOR_ID); sbField.AppendFormat("{0},", SystemData.QcMrIndexTable.ARCHIVE_TIME); sbField.AppendFormat("{0},", SystemData.QcMrIndexTable.PAPER_RECEIVE); sbField.AppendFormat("{0},", SystemData.QcMrIndexTable.PATIENT_ID); sbField.AppendFormat("{0},", SystemData.QcMrIndexTable.RETURN_COUNT); sbField.AppendFormat("{0},", SystemData.QcMrIndexTable.SUBMIT_DOCTOR); sbField.AppendFormat("{0},", SystemData.QcMrIndexTable.SUBMIT_DOCTOR_ID); sbField.AppendFormat("{0},", SystemData.QcMrIndexTable.SUBMIT_TIME); sbField.AppendFormat("{0},", SystemData.QcMrIndexTable.VISIT_ID); sbField.AppendFormat("{0}", SystemData.QcMrIndexTable.VISIT_NO); string szCondition = string.Format("1=1"); szCondition = string.Format("{0} AND {1} = '{2}' AND {3} = '{4}'" , szCondition , SystemData.QcMrIndexTable.PATIENT_ID , szPatientID , SystemData.QcMrIndexTable.VISIT_ID , szVisitID); string szSQL = string.Format(SystemData.SQL.SELECT_WHERE , sbField.ToString(), SystemData.DataTable.QC_MR_INDEX, 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 (qcMrIndex == null) { qcMrIndex = new QcMrIndex(); } for (int i = 0; i < dataReader.FieldCount; i++) { if (dataReader.IsDBNull(i)) { continue; } switch (dataReader.GetName(i)) { case SystemData.QcMrIndexTable.ARCHIVE_DOCTOR: qcMrIndex.ARCHIVE_DOCTOR = dataReader.GetString(i); break; case SystemData.QcMrIndexTable.ARCHIVE_DOCTOR_ID: qcMrIndex.ARCHIVE_DOCTOR_ID = dataReader.GetString(i); break; case SystemData.QcMrIndexTable.ARCHIVE_TIME: qcMrIndex.ARCHIVE_TIME = dataReader.GetDateTime(i); break; case SystemData.QcMrIndexTable.PAPER_RECEIVE: qcMrIndex.PAPER_RECEIVE = int.Parse(dataReader.GetValue(i).ToString()); break; case SystemData.QcMrIndexTable.PATIENT_ID: qcMrIndex.PATIENT_ID = dataReader.GetString(i); break; case SystemData.QcMrIndexTable.RETURN_COUNT: qcMrIndex.RETURN_COUNT = int.Parse(dataReader.GetValue(i).ToString()); break; case SystemData.QcMrIndexTable.SUBMIT_DOCTOR: qcMrIndex.SUBMIT_DOCTOR = dataReader.GetString(i); break; case SystemData.QcMrIndexTable.SUBMIT_DOCTOR_ID: qcMrIndex.SUBMIT_DOCTOR_ID = dataReader.GetString(i); break; case SystemData.QcMrIndexTable.SUBMIT_TIME: qcMrIndex.SUBMIT_TIME = dataReader.GetDateTime(i); break; case SystemData.QcMrIndexTable.VISIT_ID: qcMrIndex.VISIT_ID = dataReader.GetString(i); break; case SystemData.QcMrIndexTable.VISIT_NO: qcMrIndex.VISIT_NO = dataReader.GetString(i); break; default: 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); } }
public short GetList(string szCondition, ref List <QcMrIndex> list) { if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } if (string.IsNullOrEmpty(szCondition)) { return(SystemData.ReturnValue.PARAM_ERROR); } StringBuilder sbField = new StringBuilder(); sbField.AppendFormat("*"); string szSQL = string.Format(SystemData.SQL.SELECT_WHERE_ORDER_ASC , sbField.ToString(), SystemData.DataTable.QC_MR_INDEX, szCondition, SystemData.QcMrIndexTable.ARCHIVE_TIME); 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 (list == null) { list = new List <QcMrIndex>(); } list.Clear(); do { QcMrIndex item = new QcMrIndex(); for (int i = 0; i < dataReader.FieldCount; i++) { if (dataReader.IsDBNull(i)) { continue; } switch (dataReader.GetName(i)) { case SystemData.QcMrIndexTable.ARCHIVE_DOCTOR: item.ARCHIVE_DOCTOR = dataReader.GetString(i); break; case SystemData.QcMrIndexTable.ARCHIVE_DOCTOR_ID: item.ARCHIVE_DOCTOR_ID = dataReader.GetString(i); break; case SystemData.QcMrIndexTable.ARCHIVE_TIME: item.ARCHIVE_TIME = dataReader.GetDateTime(i); break; case SystemData.QcMrIndexTable.PAPER_RECEIVE: item.PAPER_RECEIVE = int.Parse(dataReader.GetValue(i).ToString()); break; case SystemData.QcMrIndexTable.PATIENT_ID: item.PATIENT_ID = dataReader.GetString(i); break; case SystemData.QcMrIndexTable.RETURN_COUNT: item.RETURN_COUNT = int.Parse(dataReader.GetValue(i).ToString()); break; case SystemData.QcMrIndexTable.SUBMIT_DOCTOR: item.SUBMIT_DOCTOR = dataReader.GetString(i); break; case SystemData.QcMrIndexTable.SUBMIT_DOCTOR_ID: item.SUBMIT_DOCTOR_ID = dataReader.GetString(i); break; case SystemData.QcMrIndexTable.SUBMIT_TIME: item.SUBMIT_TIME = dataReader.GetDateTime(i); break; case SystemData.QcMrIndexTable.VISIT_ID: item.VISIT_ID = dataReader.GetString(i); break; case SystemData.QcMrIndexTable.VISIT_NO: item.VISIT_NO = dataReader.GetString(i); break; default: break; } } list.Add(item); } while (dataReader.Read()); 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); } }