private void button2_Click(object sender, EventArgs e) { WorkProcess.Instance.Initialize(this, this.dataTableView1.Rows.Count, "正在自动对照"); foreach (DataGridViewRow item in this.dataTableView1.Rows) { RecCodeCompasion recCodeCompasion = item.Tag as RecCodeCompasion; if (recCodeCompasion != null && !string.IsNullOrEmpty(recCodeCompasion.CODE_NAME)) { continue; } WorkProcess.Instance.Show(item.Index); string codeName = item.Cells[this.col_CODE_NAME.Index].Value.ToString(); var result = m_lstGyGydm.Find(m => m.MC == codeName); if (result == null) { result = m_lstGyGydm.FindAll(m => m.MC.IndexOf(codeName) >= 0 || codeName.IndexOf(m.MC) >= 0).LastOrDefault(); } if (result != null) { item.Cells[this.col_DM.Index].Value = result.DM; item.Cells[this.col_MC.Index].Value = result.MC; } } WorkProcess.Instance.Close(); }
public short GetLists(bool bIsConfig, ref List <RecCodeCompasion> lstRecCodeCompasions) { if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } StringBuilder sbField = new StringBuilder(); sbField.AppendFormat("*"); string szCondition = string.Format("1=1"); szCondition = string.Format("{0} AND {1} = {2}" , szCondition , SystemData.RecCodeCompasionTable.IS_CONFIG , bIsConfig ? 1 : 0); string szSQL = string.Format(SystemData.SQL.SELECT_WHERE , sbField.ToString(), TableName, 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 (lstRecCodeCompasions == null) { lstRecCodeCompasions = new List <RecCodeCompasion>(); } lstRecCodeCompasions.Clear(); do { RecCodeCompasion item = new RecCodeCompasion(); for (int i = 0; i < dataReader.FieldCount; i++) { if (dataReader.IsDBNull(i)) { continue; } PropertyInfo property = Reflect.GetPropertyInfo(typeof(RecCodeCompasion), dataReader.GetName(i)); bool result = Reflect.SetPropertyValue(item, property, dataReader.GetValue(i)); } lstRecCodeCompasions.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); } }
private void LoadBaseCodeDict(RecCodeCompasion recCodeCompasion, string codeName) { if (recCodeCompasion == null) { MessageBoxEx.ShowMessage("请先选择分类"); return; } this.Text = string.Format("病案上传编码对照-{0}", recCodeCompasion.CONFIG_NAME); this.dataTableView1.Rows.Clear(); string codeTypeName = recCodeCompasion.CODETYPE_NAME; if (string.IsNullOrEmpty(codeTypeName)) { MessageBoxEx.ShowError("字典类型代码为空"); return; } if (this.m_lstBaseCodeDicts == null) { this.m_lstBaseCodeDicts = new List <BaseCodeDict>(); } this.m_lstBaseCodeDicts.Clear(); this.col_MC.Items.Clear(); DataSet ds = null; short shRet = HerenHisCommonAccess.Instance.ExecuteQuery(recCodeCompasion.FORM_SQL, out ds); if (ds != null && ds.Tables[0].Rows.Count > 0) { if (this.m_lstBaseCodeDicts == null) { this.m_lstBaseCodeDicts = new List <BaseCodeDict>(); } this.m_lstBaseCodeDicts.Clear(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { BaseCodeDict item = new BaseCodeDict(); item.CODETYPE_NAME = ds.Tables[0].Rows[i]["CODETYPE_NAME"].ToString(); item.CODE_NAME = ds.Tables[0].Rows[i]["CODE_NAME"].ToString(); item.CODE_ID = ds.Tables[0].Rows[i]["CODE_ID"].ToString(); this.m_lstBaseCodeDicts.Add(item); } } if (this.m_lstBaseCodeDicts != null && !string.IsNullOrEmpty(codeName)) { this.m_lstBaseCodeDicts = this.m_lstBaseCodeDicts.Where(m => m.CODE_NAME.Contains(codeName)).ToList(); } if (this.m_lstBaseCodeDicts != null && m_lstBaseCodeDicts.Count > 0) { Pagination(1); } }
/// <summary> /// 设置指定行显示的数据,以及绑定的数据 /// </summary> /// <param name="row">指定行</param> /// <param name="configInfo">绑定的数据</param> private bool SetRowData(DataTableViewRow row, RecCodeCompasion parameter) { if (row == null || row.Index < 0 || parameter == null) { return(false); } row.Tag = parameter; row.Cells[this.col_CODE_TYPE_NAME.Index].Value = parameter.CODETYPE_NAME; row.Cells[this.col_CONFIG_NAME.Index].Value = parameter.CONFIG_NAME; row.Cells[this.col_dmlb.Index].Value = parameter.DMLB; row.Cells[this.col_FORM_SQL.Index].Value = parameter.FORM_SQL; row.Cells[this.col_TO_SQL.Index].Value = parameter.TO_SQL; return(true); }
private short SaveRowData(DataTableViewRow row) { if (row == null || row.Index < 0) { return(SystemData.ReturnValue.FAILED); } if (this.dataTableView1.IsNormalRow(row) || this.dataTableView1.IsUnknownRow(row)) { if (!this.dataTableView1.IsDeletedRow(row)) { return(SystemData.ReturnValue.CANCEL); } } RecCodeCompasion recCodeCompasion = null; if (!this.MakeRowData(row, ref recCodeCompasion)) { return(SystemData.ReturnValue.FAILED); } short shRet = SystemData.ReturnValue.OK; if (this.dataTableView1.IsModifiedRow(row)) { shRet = RecCodeCompasionAccess.Instance.Update(recCodeCompasion); if (shRet != SystemData.ReturnValue.OK) { this.dataTableView1.SelectRow(row); MessageBoxEx.Show("无法更新当前记录!"); return(SystemData.ReturnValue.FAILED); } row.Tag = recCodeCompasion; this.dataTableView1.SetRowState(row, RowState.Normal); } else if (this.dataTableView1.IsNewRow(row)) { shRet = RecCodeCompasionAccess.Instance.Insert(recCodeCompasion); if (shRet != SystemData.ReturnValue.OK) { this.dataTableView1.SelectRow(row); MessageBoxEx.Show("无法保存当前记录!"); return(SystemData.ReturnValue.FAILED); } row.Tag = recCodeCompasion; this.dataTableView1.SetRowState(row, RowState.Normal); } return(SystemData.ReturnValue.OK); }
private void LoadParameterList() { this.dataGridView1.Rows.Clear(); List <RecCodeCompasion> lstHdpParameter = null; short shRet = RecCodeCompasionAccess.Instance.GetLists(true, ref lstHdpParameter); if (shRet == SystemData.ReturnValue.RES_NO_FOUND) { return; } if (shRet != SystemData.ReturnValue.OK) { GlobalMethods.UI.SetCursor(this, Cursors.Default); MessageBoxEx.Show("配置字典表加载失败!"); } if (lstHdpParameter == null) { GlobalMethods.UI.SetCursor(this, Cursors.Default); return; } for (int index = 0; index < lstHdpParameter.Count; index++) { RecCodeCompasion recCodeCompasion = lstHdpParameter[index]; if (recCodeCompasion == null) { continue; } int nRowIndex = this.dataGridView1.Rows.Add(); DataTableViewRow row = this.dataGridView1.Rows[nRowIndex]; this.SetRowData(row, recCodeCompasion); this.dataGridView1.SetRowState(row, RowState.Normal); if (nRowIndex <= 0) { continue; } } }
/// <summary> /// 获取指定行最新修改后的数据 /// </summary> /// <param name="row">指定行</param> /// <param name="configInfo">最新修改后的数据</param> /// <returns>bool</returns> private bool MakeRowData(DataTableViewRow row, ref RecCodeCompasion recCodeCompasion) { if (row == null || row.Index < 0) { return(false); } recCodeCompasion = new RecCodeCompasion(); object cellValue = row.Cells[this.col_CONFIG_NAME.Index].Value; if (GlobalMethods.Misc.IsEmptyString(cellValue)) { this.dataGridView1.SelectRow(row); MessageBoxEx.Show("您必须输入类别名称!"); return(false); } recCodeCompasion.CONFIG_NAME = cellValue.ToString(); cellValue = row.Cells[this.col_CODE_TYPE_NAME.Index].Value; if (!GlobalMethods.Misc.IsEmptyString(cellValue)) { recCodeCompasion.CODETYPE_NAME = cellValue.ToString(); } cellValue = row.Cells[this.col_dmlb.Index].Value; if (!GlobalMethods.Misc.IsEmptyString(cellValue)) { recCodeCompasion.DMLB = cellValue.ToString(); } cellValue = row.Cells[this.col_FORM_SQL.Index].Value; if (!GlobalMethods.Misc.IsEmptyString(cellValue)) { recCodeCompasion.FORM_SQL = cellValue.ToString(); } cellValue = row.Cells[this.col_TO_SQL.Index].Value; if (!GlobalMethods.Misc.IsEmptyString(cellValue)) { recCodeCompasion.TO_SQL = cellValue.ToString(); } recCodeCompasion.IS_CONFIG = 1; return(true); }
/// <summary> /// 获取指定行最新修改后的数据 /// </summary> /// <param name="row">指定行</param> /// <param name="recCodeCompasion">最新修改后的数据</param> /// <returns>bool</returns> private bool MakeRowData(DataTableViewRow row, ref RecCodeCompasion recCodeCompasion) { if (row == null || row.Index < 0) { return(false); } recCodeCompasion = row.Tag as RecCodeCompasion; if (recCodeCompasion == null) { recCodeCompasion = new RecCodeCompasion(); recCodeCompasion.ID = recCodeCompasion.MakeID(); } if (row.Cells[this.col_CODE_ID.Index].Value != null) { recCodeCompasion.CODE_ID = row.Cells[this.col_CODE_ID.Index].Value.ToString(); } if (row.Cells[this.col_CODE_NAME.Index].Value != null) { recCodeCompasion.CODE_NAME = (string)row.Cells[this.col_CODE_NAME.Index].Value; } if (row.Cells[this.col_DM.Index].Value != null) { recCodeCompasion.DM = (string)row.Cells[this.col_DM.Index].Value; } else { recCodeCompasion.DM = string.Empty; } recCodeCompasion.DMLB = this.m_RecCodeCompasion.DMLB; if (row.Cells[this.col_MC.Index].Value != null) { recCodeCompasion.MC = row.Cells[this.col_MC.Index].Value.ToString(); } else { recCodeCompasion.MC = string.Empty; } recCodeCompasion.CODETYPE_NAME = this.m_RecCodeCompasion.CODETYPE_NAME; return(true); }
/// <summary> /// 增加一行记录 /// </summary> private void AddNewItem() { RecCodeCompasion rec = this.dataGridView1.SelectedRows[0].Tag as RecCodeCompasion; //创建数据 RecCodeCompasion recCodeCompasion = new RecCodeCompasion(); //创建行 int index = this.dataGridView1.Rows.Add(); DataTableViewRow row = this.dataGridView1.Rows[index]; recCodeCompasion.ID = recCodeCompasion.MakeID(); row.Tag = recCodeCompasion; if (rec != null) { row.Cells[this.col_FORM_SQL.Index].Value = rec.FORM_SQL; row.Cells[this.col_TO_SQL.Index].Value = rec.TO_SQL; } this.dataGridView1.SetRowState(row, RowState.New); this.UpdateUIState(); this.dataGridView1.CurrentCell = row.Cells[this.col_CONFIG_NAME.Index]; this.dataGridView1.BeginEdit(true); }
private void LoadMC(RecCodeCompasion recCodeCompasion) { if (this.col_MC.Items == null) { return; } //待选项 this.col_MC.Items.Clear(); DataSet ds = null; short shRet = BAJKCommonAccess.Instance.ExecuteQuery(recCodeCompasion.TO_SQL, out ds); if (m_lstGyGydm == null) { m_lstGyGydm = new List <GyGydm>(); } m_lstGyGydm.Clear(); if (ds != null && ds.Tables[0].Rows.Count > 0) { this.m_lstGyGydm.Clear(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { GyGydm item = new GyGydm(); item.DM = ds.Tables[0].Rows[i]["DM"].ToString(); item.DMLB = ds.Tables[0].Rows[i]["DMLB"].ToString(); item.MC = ds.Tables[0].Rows[i]["MC"].ToString(); m_lstGyGydm.Add(item); } } if (m_lstGyGydm == null) { return; } foreach (GyGydm item in m_lstGyGydm) { this.col_MC.Items.Add(item); } }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { m_RecCodeCompasion = this.listBox1.SelectedItem as RecCodeCompasion; this.LoadBaseCodeDict(m_RecCodeCompasion, null); }
/// <summary> /// 更新一条整改通知单 /// </summary> /// <param name="timeQCRule">自动核查规则配置信息</param> /// <returns>SystemData.ReturnValue</returns> public short Update(RecCodeCompasion recCodeCompasion) { if (recCodeCompasion == null) { LogManager.Instance.WriteLog("", new string[] { "" } , new object[] { recCodeCompasion }, "参数不能为空"); return(SystemData.ReturnValue.PARAM_ERROR); } if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } if (recCodeCompasion.IS_CONFIG == 0) { if (string.IsNullOrEmpty(recCodeCompasion.MC) || string.IsNullOrEmpty(recCodeCompasion.DM)) { return(this.Delete(recCodeCompasion.ID)); } } StringBuilder sbField = new StringBuilder(); sbField.AppendFormat("{0}='{1}'," , SystemData.RecCodeCompasionTable.CODETYPE_NAME, recCodeCompasion.CODETYPE_NAME); sbField.AppendFormat("{0}='{1}'," , SystemData.RecCodeCompasionTable.CODE_ID, recCodeCompasion.CODE_ID); sbField.AppendFormat("{0}='{1}'," , SystemData.RecCodeCompasionTable.CODE_NAME, recCodeCompasion.CODE_NAME); sbField.AppendFormat("{0}='{1}'," , SystemData.RecCodeCompasionTable.DM, recCodeCompasion.DM); sbField.AppendFormat("{0}='{1}'," , SystemData.RecCodeCompasionTable.DMLB, recCodeCompasion.DMLB); sbField.AppendFormat("{0}={1}," , SystemData.RecCodeCompasionTable.FORM_SQL, base.MedQCAccess.GetSqlParamName("FORM_SQL")); sbField.AppendFormat("{0}='{1}'," , SystemData.RecCodeCompasionTable.CONFIG_NAME, recCodeCompasion.CONFIG_NAME); sbField.AppendFormat("{0}={1}," , SystemData.RecCodeCompasionTable.IS_CONFIG, recCodeCompasion.IS_CONFIG); sbField.AppendFormat("{0}={1}," , SystemData.RecCodeCompasionTable.TO_SQL, base.MedQCAccess.GetSqlParamName("TO_SQL")); sbField.AppendFormat("{0}='{1}'" , SystemData.RecCodeCompasionTable.MC, recCodeCompasion.MC); string szCondition = string.Format("{0}='{1}'", SystemData.RecCodeCompasionTable.ID, recCodeCompasion.ID); DbParameter[] pmi = new DbParameter[2]; pmi[0] = new DbParameter("FORM_SQL", recCodeCompasion.FORM_SQL == null ? string.Empty : recCodeCompasion.FORM_SQL); pmi[1] = new DbParameter("TO_SQL", recCodeCompasion.TO_SQL == null?string.Empty:recCodeCompasion.TO_SQL); string szSQL = string.Format(SystemData.SQL.UPDATE, TableName, sbField.ToString(), szCondition); int nCount = 0; try { nCount = base.MedQCAccess.ExecuteNonQuery(szSQL, CommandType.Text, ref pmi); } 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); }
public short GetRecCodeCompasion(string id, ref RecCodeCompasion recCodeCompasion) { if (base.MedQCAccess == null) { return(SystemData.ReturnValue.PARAM_ERROR); } StringBuilder sbField = new StringBuilder(); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.CODETYPE_NAME); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.CODE_ID); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.CODE_NAME); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.DM); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.DMLB); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.ID); sbField.AppendFormat("{0}", SystemData.RecCodeCompasionTable.MC); string szCondition = string.Format("1=1"); szCondition = string.Format("{0} AND {1} = '{2}'" , szCondition , SystemData.RecCodeCompasionTable.ID , id); string szSQL = string.Format(SystemData.SQL.SELECT_WHERE , sbField.ToString(), SystemData.DataTable.REC_CODE_COMPASION, 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 (recCodeCompasion == null) { recCodeCompasion = new RecCodeCompasion(); } for (int i = 0; i < dataReader.FieldCount; i++) { if (dataReader.IsDBNull(i)) { continue; } switch (dataReader.GetName(i)) { case SystemData.RecCodeCompasionTable.CODETYPE_NAME: recCodeCompasion.CODETYPE_NAME = dataReader.GetValue(i).ToString(); break; case SystemData.RecCodeCompasionTable.CODE_ID: recCodeCompasion.CODE_ID = dataReader.GetValue(i).ToString(); break; case SystemData.RecCodeCompasionTable.CODE_NAME: recCodeCompasion.DM = dataReader.GetValue(i).ToString(); break; case SystemData.RecCodeCompasionTable.DMLB: recCodeCompasion.ID = dataReader.GetValue(i).ToString(); break; case SystemData.RecCodeCompasionTable.MC: recCodeCompasion.MC = dataReader.GetValue(i).ToString(); break; case SystemData.RecCodeCompasionTable.DM: recCodeCompasion.DM = dataReader.GetValue(i).ToString(); 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); } }
/// <summary> /// 新增一条人工核查结果信息 /// </summary> /// <param name="recCodeCompasion">自动核查规则配置信息</param> /// <returns>SystemData.ReturnValue</returns> public short Insert(RecCodeCompasion recCodeCompasion) { if (recCodeCompasion == null) { LogManager.Instance.WriteLog("", new string[] { "" } , new object[] { recCodeCompasion }, "参数不能为空"); return(SystemData.ReturnValue.PARAM_ERROR); } if (recCodeCompasion.ID == string.Empty) { return(SystemData.ReturnValue.PARAM_ERROR); } StringBuilder sbField = new StringBuilder(); StringBuilder sbValue = new StringBuilder(); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.CODETYPE_NAME); sbValue.AppendFormat("'{0}',", recCodeCompasion.CODETYPE_NAME); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.CODE_ID); sbValue.AppendFormat("'{0}',", recCodeCompasion.CODE_ID); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.CODE_NAME); sbValue.AppendFormat("{0},", base.MedQCAccess.GetSqlParamName("CODE_NAME")); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.DM); sbValue.AppendFormat("'{0}',", recCodeCompasion.DM); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.DMLB); sbValue.AppendFormat("'{0}',", recCodeCompasion.DMLB); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.ID); sbValue.AppendFormat("'{0}',", recCodeCompasion.ID); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.FORM_SQL); sbValue.AppendFormat("{0},", base.MedQCAccess.GetSqlParamName("FORM_SQL")); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.IS_CONFIG); sbValue.AppendFormat("{0},", recCodeCompasion.IS_CONFIG); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.TO_SQL); sbValue.AppendFormat("{0},", base.MedQCAccess.GetSqlParamName("TO_SQL")); sbField.AppendFormat("{0},", SystemData.RecCodeCompasionTable.CONFIG_NAME); sbValue.AppendFormat("'{0}',", recCodeCompasion.CONFIG_NAME); sbField.AppendFormat("{0}", SystemData.RecCodeCompasionTable.MC); sbValue.AppendFormat("{0}", base.MedQCAccess.GetSqlParamName("MC")); if (recCodeCompasion.FORM_SQL == null) { recCodeCompasion.FORM_SQL = string.Empty; } if (recCodeCompasion.TO_SQL == null) { recCodeCompasion.TO_SQL = string.Empty; } if (recCodeCompasion.CODE_NAME == null) { recCodeCompasion.CODE_NAME = string.Empty; } if (recCodeCompasion.DM == null) { recCodeCompasion.DM = string.Empty; } if (recCodeCompasion.MC == null) { recCodeCompasion.MC = string.Empty; } DbParameter[] pmi = new DbParameter[4]; pmi[0] = new DbParameter("CODE_NAME", recCodeCompasion.CODE_NAME); pmi[1] = new DbParameter("FORM_SQL", recCodeCompasion.FORM_SQL); pmi[2] = new DbParameter("TO_SQL", recCodeCompasion.TO_SQL); pmi[3] = new DbParameter("MC", recCodeCompasion.MC); string szSQL = string.Format(SystemData.SQL.INSERT, TableName, sbField.ToString(), sbValue.ToString()); int nCount = 0; try { nCount = base.MedQCAccess.ExecuteNonQuery(szSQL, CommandType.Text, ref pmi); } 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); }