private void gc_PatientManage_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } if (gc_PatientManage.RowCount > 0) { _rowIndex = e.RowIndex; DataRow dr = ((DataRowView)gc_PatientManage.Rows[e.RowIndex].DataBoundItem).Row; string patientId = string.Empty; if (null != dr) { patientId = dr["PatientID"].ToString(); qrCodePatientId.Text = @"YJL-" + patientId; qrCodePatientId.Visible = true; } #region 除 if (gc_PatientManage.Columns[e.ColumnIndex] == DeletePatient) { if (gc_EcgList.RowCount > 0) { bool status = Check_App_status(patientId); if (status) { XtraMessageBox.Show(@"此患者已有关联信息,不允许删除!", @"提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } if (XtraMessageBox.Show(@"是否确定删除选中的患者?", @"患者删除提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { var sqls = new string[6]; sqls[0] = "DELETE FROM data_packs WHERE ApplicationID in(select ApplicationID from tb_Application where patientID='" + patientId + "')"; sqls[1] = "DELETE FROM Tb_Snapshot WHERE ApplicationID in(select ApplicationID from tb_Application where patientID='" + patientId + "')"; sqls[2] = "DELETE FROM AutoDiagnosis WHERE ApplicationID in(select ApplicationID from tb_Application where patientID='" + patientId + "')"; sqls[3] = "delete from Tb_ReportTitle where ApplicationID in(select ApplicationID from tb_Application where patientID='" + patientId + "')"; sqls[4] = "DELETE FROM tb_Application WHERE PatientID='" + patientId + "'"; sqls[5] = "DELETE FROM Tb_PatientInfo WHERE PatientID='" + patientId + "'"; WatchDog.WriteMsg(DateTime.Now + "==删除数据:" + dr["PatientName"] + ",患者ID:" + patientId); DataTable tbl = _sqlite.ExcuteSqlite("SELECT * FROM data_packs WHERE ApplicationID in(select ApplicationID from tb_Application where patientID='" + patientId + "')"); bool isSuccess = _sqlite.SqliteExecuteNonQuery(sqls); if (isSuccess) { if (tbl != null && tbl.Rows.Count > 0) { string ednPathDir = Application.StartupPath + "\\ECG_DATA_NEW"; for (int j = 0; j < tbl.Rows.Count; j++) { if (tbl.Rows[j]["pureData"] == DBNull.Value) { try { File.Delete(ednPathDir + "\\" + tbl.Rows[j]["ApplicationID"].ToString() + "_" + tbl.Rows[j]["isLead"].ToString()); } catch { } } } } } var pIndex = (int)Math.Ceiling(Convert.ToDouble(_recordCount) / ConfigHelper.PAGE_SIZE); if (_recordCount % ConfigHelper.PAGE_SIZE == 0 && wp.PageIndex == pIndex) { if (wp.PageIndex > 1) { wp.PageIndex = wp.PageIndex - 1; } } gc_EcgList.DataSource = null; wp.Bind(); txtID.Text = string.Empty; //XtraMessageBox.Show("患者信息删除成功!"); qrCodePatientId.Visible = false; } if (gc_PatientManage.RowCount > 0) { gc_PatientManage.CurrentCell = gc_PatientManage.Rows[e.RowIndex].Cells[0]; } } #endregion #region 绑定右侧历史数据 if (gc_PatientManage.Columns[e.ColumnIndex] != EcgGather && gc_PatientManage.Columns[e.ColumnIndex] != EditPatient && gc_PatientManage.Columns[e.ColumnIndex] != DeletePatient) { SelEcgList(patientId); } #endregion #region 公共卫生信息 if (gc_PatientManage.Columns[e.ColumnIndex] == EditPatient) { if (dr != null) { string pId = dr["PatientID"].ToString(); var pif = new PatientInfoForm(pId) { WindowState = FormWindowState.Maximized }; pif.ShowDialog(); } gc_PatientManage.CurrentCell = gc_PatientManage.Rows[e.RowIndex].Cells[0]; } #endregion } else { gc_EcgList.DataSource = null; } }