private void delButton_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("确定是否要删除?", "删除提醒", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { String id = styleComboBox.SelectedValue.ToString(); Business.DictProcess dictProcess = new Business.DictProcess(); //公共不能删除 DataTable dtStyle = dictProcess.GetStyleByID(id).Tables[0]; string strFrcode = ""; if (dtStyle.Rows.Count > 0) { strFrcode = dtStyle.Rows[0]["frcode"].ToString(); if (!strFrcode.Equals(Util.Util.GetAppSetting("rcode"))) { MessageBox.Show("不能删除公共格式!", "删除提醒"); return; } } Hashtable data = new Hashtable(); data["id"] = id; bool result = dictProcess.DelStyle(data); if (result) { MessageBox.Show("删除成功!", "删除提醒"); this.loadStyle(); } } }
/// <summary> /// 循环gridview like匹配中心项目 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnMap_Click(object sender, EventArgs e) { DataTable dt = (DataTable)this.DetailGridView.DataSource; if (dt.Rows.Count > 0) { Business.DictProcess dictProcess = new Business.DictProcess(); for (int i = 0; i < dt.Rows.Count; i++) { string oldName = dt.Rows[i]["name"].ToString(); string centerCode = ""; string centerName = ""; DataTable resultDt = dictProcess.MapItemByName(oldName).Tables[0]; if (resultDt.Rows.Count > 0) { centerCode = resultDt.Rows[0]["code"].ToString(); centerName = resultDt.Rows[0]["name"].ToString(); dt.Rows[i]["centercode"] = centerCode; dt.Rows[i]["centername"] = centerName; } } this.DetailGridView.DataSource = dt; MessageBox.Show("匹配成功"); } }
private void okButton_Click(object sender, EventArgs e) { MainForm form = (MainForm)this.Owner; String billStyle = new Business.DictProcess().GetStyleByID(styleComboBox.SelectedValue.ToString()).Tables[0].Rows[0]["code"].ToString(); String[] styles = billStyle.Split(','); form.setBillStyle(styles); this.Close(); }
/// <summary> /// 通过scanname showname 获取,加载数据的时候,两个值相等 /// </summary> /// <param name="data"></param> /// <returns></returns> private Hashtable getItemDictRowByScanName(string data) { Hashtable ht = new Hashtable(); int count = 0; string centercode = ""; string firstCenterCode = ""; string showname = ""; DataTable dtItemDict = null; //改成存储过程 DataSet ds = new Business.ItemProcess().GetItemDict(this.frcode, data); if (ds.Tables.Count > 0) { dtItemDict = ds.Tables[0]; if (dtItemDict.Rows.Count > 0) { DataRow dr = dtItemDict.Rows[0]; centercode = dr["centercode"] == null ? "" : dr["centercode"].ToString(); showname = dr["showname"] == null ? "" : dr["showname"].ToString(); if (!String.IsNullOrEmpty(centercode)) { if (String.IsNullOrEmpty(firstCenterCode)) { firstCenterCode = centercode; } } } } if (!String.IsNullOrEmpty(firstCenterCode)) { DataSet dsDict = new Business.DictProcess().GetItemByID(firstCenterCode); if (dsDict.Tables.Count > 0) { DataTable dtDict = dsDict.Tables[0]; if (dtDict.Rows.Count > 0) { ScanDataSet.CenterDataRow centerDataRow = (ScanDataSet.CenterDataRow)dtDict.Rows[0]; ht.Add("row", centerDataRow); return(ht); } } } return(ht); }
private Hashtable getItemDictRowByKeyWord(string data) { Hashtable ht = new Hashtable(); string centercode = ""; string firstCenterCode = ""; DataTable dtItemDict = new Business.DictProcess().GetItemDictByKeyWord(data).Tables[0]; if (dtItemDict.Rows.Count > 0) { for (int i = 0; i < dtItemDict.Rows.Count; i++) { DataRow dr = dtItemDict.Rows[i]; if (data.IndexOf(dr["keyword"].ToString()) > -1) { centercode = dr["centercode"] == null ? "" : dr["centercode"].ToString(); if (!String.IsNullOrEmpty(centercode)) { if (String.IsNullOrEmpty(firstCenterCode)) { firstCenterCode = centercode; } } } } } if (!String.IsNullOrEmpty(firstCenterCode)) { DataSet dsDict = new Business.DictProcess().GetItemByID(firstCenterCode); if (dsDict.Tables.Count > 0) { DataTable dtDict = dsDict.Tables[0]; if (dtDict.Rows.Count > 0) { ScanDataSet.CenterDataRow centerDataRow = (ScanDataSet.CenterDataRow)dtDict.Rows[0]; ht.Add("row", centerDataRow); return(ht); } } } return(ht); }
private void MapAllToolStripButton_Click(object sender, EventArgs e) { //判断选中几行 for (int i = 0; i < this.ScanDataGridView.Rows.Count; i++) { if (this.ScanDataGridView.Rows[i].Cells[this.ScanDataGridView.Columns["SelectCheck"].Index].EditedFormattedValue.ToString() == "True") { //获取comboxvalue if (this.DictToolStripComboBox.SelectedItem.ToString() != "请选择") { string centercodet = this.dictHT[this.DictToolStripComboBox.SelectedItem.ToString()].ToString(); string endName = this.ScanDataGridView.Rows[i].Cells["nameDataGridViewTextBoxColumn"].Value == null ? "" : this.ScanDataGridView.Rows[i].Cells["nameDataGridViewTextBoxColumn"].Value.ToString(); string beginName = this.ScanDataGridView.Rows[i].Cells["oldName"].Value == null ? "" : this.ScanDataGridView.Rows[i].Cells["oldName"].Value.ToString(); DataSet ds = new Business.DictProcess().GetItemByID(centercodet); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; this.ScanDataGridView.Rows[i].Cells["centercode"].Value = dr["code"].ToString(); this.ScanDataGridView.Rows[i].Cells["centername"].Value = dr["name"].ToString(); this.ScanDataGridView.Rows[i].Cells["itemtype"].Value = dr["itemtype"].ToString(); this.ScanDataGridView.Rows[i].Cells["feetype"].Value = dr["feetype"].ToString(); //批量对照之后 更新对照关系 if (!String.IsNullOrEmpty(beginName.Trim()) && !String.IsNullOrEmpty(endName.Trim())) { new Business.ItemProcess().UpdateItemDictRelation(beginName, endName, dr["code"].ToString(), frcode); } //对照之后 更新当前行非选中 this.ScanDataGridView.Rows[i].Cells[this.ScanDataGridView.Columns["SelectCheck"].Index].Value = false; } } else { MessageBox.Show("请选择要对照的中心项目!"); return; } } } }
private void btnfc_Click(object sender, EventArgs e) { DataTable dt = new Business.DictProcess().GetItemAll().Tables[0]; //第一个版本应该保存body和title,搜索结果形成超链接,不显示正文。 string indexPath = "c:/index"; FSDirectory directory = FSDirectory.Open(new DirectoryInfo(indexPath), new NativeFSLockFactory()); bool isUpdate = IndexReader.IndexExists(directory); if (isUpdate) { //如果索引目录被锁定(比如索引过程中程序异常退出),则首先解锁 if (IndexWriter.IsLocked(directory)) { IndexWriter.Unlock(directory); } } IndexWriter writer = new IndexWriter(directory, new PanGuAnalyzer(), !isUpdate, Lucene.Net.Index.IndexWriter.MaxFieldLength.UNLIMITED); for (int i = 0; i < dt.Rows.Count; i++) { //为避免重复索引,所以先删除number=i的记录,再重新添加 writer.DeleteDocuments(new Term("code", dt.Rows[i]["code"].ToString())); Document document = new Document(); //只有对需要全文检索的字段才ANALYZED document.Add(new Field("code", dt.Rows[i]["code"].ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED)); document.Add(new Field("name", dt.Rows[i]["name"].ToString(), Field.Store.YES, Field.Index.ANALYZED)); writer.AddDocument(document); } //Document document = new Document(); ////只有对需要全文检索的字段才ANALYZED //document.Add(new Field("code", "codes", Field.Store.YES, Field.Index.NOT_ANALYZED)); //document.Add(new Field("name", "我的阿莫西林", Field.Store.YES, Field.Index.ANALYZED)); //writer.AddDocument(document); writer.Close(); directory.Close();//不要忘了Close,否则索引结果搜不到 }
private void button1_Click(object sender, EventArgs e) { string str = this.tbCondition.Text.Trim(); if (!String.IsNullOrEmpty(str)) { DataSet ds = new Business.DictProcess().GetItemByStr(str); if (ds.Tables.Count > 0) { dtInfo = ds.Tables[0]; if (dtInfo.Rows.Count > 0) { InitDataSet(); } } } }
private void okButton_Click(object sender, EventArgs e) { String billStyle = ""; String billStyleName = ""; int endIndex = 0; for (int i = 9; i >= 1; i--) { ComboBox comboBox = (ComboBox)styleGroupBox.Controls["comboBox" + i]; string comdata = comboBox.SelectedValue.ToString(); if (!String.IsNullOrEmpty(comdata)) { endIndex = i; break; } } for (int j = 1; j <= endIndex; j++) { ComboBox comboBox = (ComboBox)styleGroupBox.Controls["comboBox" + j]; string comdata = comboBox.SelectedValue.ToString(); billStyle += comdata + ","; billStyleName += comboBox.Text + ","; } if (billStyle.Length >= 2) { billStyle = billStyle.Substring(0, billStyle.Length - 1); } string newStyleID = ""; Hashtable data = new Hashtable(); data["code"] = billStyle; data["name"] = billStyleName; data["frcode"] = this.frcode; newStyleID = new Business.DictProcess().InsertStyle(data); IStyleOwner owner = (IStyleOwner)this.Owner; owner.setBillStyle(billStyleName, billStyle, newStyleID); this.Close(); }
private void save(string id) { if (this.ScanDataGridView.Rows.Count > 1) { try { DataTable dt = (DataTable)this.ScanDataGridView.DataSource; //循环处理数据 bool result = true; int rowcount = dt.Rows.Count; //获取保存在dataset中的数据 if (dt.Rows.Count > 1) { //可能会有gridview 数据多,dataset 数据少,数据源没刷新的情况 this.ScanDataGridView.EndEdit(); ((IEditableObject)this.ScanDataGridView.CurrentRow.DataBoundItem).EndEdit(); this.ScanDataGridView.CurrentCell = null; Application.DoEvents(); for (int i = 0; i < dt.Rows.Count; i++) { dt.Rows[i]["pid"] = id; dt.Rows[i]["paydate"] = System.DateTime.Now.ToShortDateString(); string code = dt.Rows[i]["code"] == null?i.ToString() : dt.Rows[i]["code"].ToString(); if (String.IsNullOrEmpty(code)) { dt.Rows[i]["code"] = i.ToString(); } string detailGUID = dt.Rows[i]["DetailGUID"] == null?Guid.NewGuid().ToString() : dt.Rows[i]["DetailGUID"].ToString(); if (String.IsNullOrEmpty(detailGUID)) { dt.Rows[i]["DetailGUID"] = Guid.NewGuid().ToString(); } string centercode = dt.Rows[i]["centercode"] == null?i.ToString() : dt.Rows[i]["centercode"].ToString(); string itemname = dt.Rows[i]["name"] == null ? "" : dt.Rows[i]["name"].ToString(); if (String.IsNullOrEmpty(centercode)) { MessageBox.Show("中心编码不能为空!项目名称:【" + itemname + "】"); return; } string centername = ""; DataTable dtname = new Business.DictProcess().GetItemByID(centercode).Tables[0]; if (dtname.Rows.Count > 0) { centername = dtname.Rows[0]["name"].ToString(); } dt.Rows[i]["centername"] = centername; } result = new Business.ItemProcess().SaveAndUpdateDetail(dt); if (result) { this.loadForm.DialogResult = DialogResult.OK; MessageBox.Show("保存成功"); } } } catch (Exception ex) { showError(ex.ToString()); } } }
/// <summary> /// 保存数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { if (!ValidateControls()) { MessageBox.Show("输入不能为空,请核查!"); return; } //获取form数据 string fmcard = this.tbMcard.Text.Trim(); string fname = this.tbName.Text.Trim(); string fidcard = this.tbIdcard.Text.Trim(); string finhosnum = this.tbInhosNum.Text.Trim(); string finhosorg = this.hdInhosOrg; string finhostype = this.cbInhosType.SelectedValue.ToString(); string finhosdept = this.hdInHosDept; string finhosdeptname = this.tbInhosDept.Text.Trim(); // DateTime finhosdate = this.dtInhos.Value; string finhosdate = this.dtInhos.Value.ToShortDateString(); string finhosstatus = this.cbInhosStatus.SelectedValue.ToString(); string finhosdia = this.hdInhosDia; string fouthosdia = this.hdOutHosDia; string fouthosdept = this.hdOutHosDept; // DateTime fouthosdate = this.dtOutHosp.Value; string fouthosdate = this.dtOutHosp.Value.ToShortDateString(); int finhosdays = (Convert.ToDateTime(fouthosdate) - Convert.ToDateTime(finhosdate)).Days + 1; string fouthosstatus = this.cbOutHospStatus.SelectedValue.ToString(); string fjzys = this.tbDoctor.Text.Trim(); string frcode = Util.Util.GetAppSetting("rcode"); //"@sdx", "@zyh", "@yljg", "@ylzh", "@name", "@idcard", "@jzlx", "@rysj", "@cysj", "@sjzyts", "@ryks", "@ryksname", "@cyks", "@cyksname", "@jzys", "@ryzt", "@cyzt", "@ryzd", "@cyzd" }; Hashtable ht = new Hashtable(); ht.Add("sdx", frcode); ht.Add("zyh", finhosnum); ht.Add("yljg", finhosorg); ht.Add("ylzh", fmcard); ht.Add("name", fname); ht.Add("idcard", fidcard); ht.Add("jzlx", finhostype); ht.Add("rysj", finhosdate); ht.Add("cysj", fouthosdate); ht.Add("sjzyts", finhosdays); ht.Add("ryks", finhosdept); ht.Add("cyks", fouthosdept); ht.Add("jzys", fjzys); ht.Add("ryzt", finhosstatus); ht.Add("cyzt", fouthosstatus); ht.Add("ryzd", finhosdia); ht.Add("cyzd", fouthosdia); //保存时添加guid,同时向父窗体guid赋值 string guid = Guid.NewGuid().ToString(); ht.Add("guid", guid); bool result = new Business.MainList().InsertZyjl(ht); if (result) { MessageBox.Show(this, "保存成功!", "保存提示", MessageBoxButtons.OK, MessageBoxIcon.Information); MainForm form = (MainForm)this.Owner; String billStyle = new Business.DictProcess().GetStyleByID(styleComboBox.SelectedValue.ToString()).Tables[0].Rows[0]["code"].ToString(); String[] styles = billStyle.Split(','); form.callBack(guid, fname, styles); this.DialogResult = DialogResult.OK; // this.Close(); } else { MessageBox.Show(this, "保存失败!", "保存提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void GetSearchData() { try { if (!String.IsNullOrEmpty(SearchText)) { switch (SearchType) { case "Icd": //初始化 列 this.dataGridView1.Columns.Clear(); DataGridViewTextBoxColumn[] dgvColumns = new DataGridViewTextBoxColumn[] { new DataGridViewTextBoxColumn() { HeaderText = "疾病编码", DataPropertyName = "icdcode", Name = "icdcode" }, new DataGridViewTextBoxColumn() { HeaderText = "疾病名称", DataPropertyName = "icdname", Name = "icdname" }, new DataGridViewTextBoxColumn() { HeaderText = "助记码", DataPropertyName = "zjm", Name = "zjm" } }; this.dataGridView1.Columns.AddRange(dgvColumns); this.dataGridView1.DataSource = null; DataTable dt = new Business.DictProcess().GetIcdByStr(SearchText).Tables[0]; if (dt.Rows.Count > 0) { this.Count = dt.Rows.Count; this.dataGridView1.DataSource = dt; this.dataGridView1.Rows[0].Selected = true; } break; case "Dept": //初始化 列 this.dataGridView1.Columns.Clear(); DataGridViewTextBoxColumn[] dgvDeptColumns = new DataGridViewTextBoxColumn[] { new DataGridViewTextBoxColumn() { HeaderText = "科室编码", DataPropertyName = "code", Name = "code" }, new DataGridViewTextBoxColumn() { HeaderText = "科室名称", DataPropertyName = "name", Name = "name" }, new DataGridViewTextBoxColumn() { HeaderText = "助记码", DataPropertyName = "zjm", Name = "zjm" } }; this.dataGridView1.Columns.AddRange(dgvDeptColumns); this.dataGridView1.DataSource = null; DataTable dtDept = new Business.DictProcess().GetDeptByStr(SearchText).Tables[0]; if (dtDept.Rows.Count > 0) { this.Count = dtDept.Rows.Count; this.dataGridView1.DataSource = dtDept; this.dataGridView1.Rows[0].Selected = true; } break; case "Org": //初始化 列 this.dataGridView1.Columns.Clear(); DataGridViewTextBoxColumn[] dgvOrgColumns = new DataGridViewTextBoxColumn[] { new DataGridViewTextBoxColumn() { HeaderText = "机构编码", DataPropertyName = "code", Name = "code" }, new DataGridViewTextBoxColumn() { HeaderText = "机构名称", DataPropertyName = "name", Name = "name" }, new DataGridViewTextBoxColumn() { HeaderText = "助记码", DataPropertyName = "zjm", Name = "zjm" } }; this.dataGridView1.Columns.AddRange(dgvOrgColumns); this.dataGridView1.DataSource = null; DataTable dtOrg = new Business.DictProcess().GetOrgByStr(SearchText).Tables[0]; if (dtOrg.Rows.Count > 0) { this.Count = dtOrg.Rows.Count; this.dataGridView1.DataSource = dtOrg; this.dataGridView1.Rows[0].Selected = true; } break; case "Item": //初始化 列 this.dataGridView1.Columns.Clear(); DataGridViewTextBoxColumn[] dgvItemColumns = new DataGridViewTextBoxColumn[] { new DataGridViewTextBoxColumn() { HeaderText = "项目编码", AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells, DataPropertyName = "code", Name = "code" }, new DataGridViewTextBoxColumn() { HeaderText = "项目名称", AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells, DataPropertyName = "name", Name = "name" }, new DataGridViewTextBoxColumn() { HeaderText = "剂型", AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells, DataPropertyName = "forms", Name = "forms" }, new DataGridViewTextBoxColumn() { HeaderText = "补偿比例", AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells, DataPropertyName = "FCOMPUTERATIO", Name = "FCOMPUTERATIO" }, new DataGridViewTextBoxColumn() { HeaderText = "省级价格", AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells, DataPropertyName = "provprice", Name = "provprice" }, new DataGridViewTextBoxColumn() { HeaderText = "市级价格", AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells, DataPropertyName = "cityprice", Name = "cityprice" }, new DataGridViewTextBoxColumn() { HeaderText = "乡级价格", AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells, DataPropertyName = "counprice", Name = "counprice" }, new DataGridViewTextBoxColumn() { HeaderText = "助记码", AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells, DataPropertyName = "zjm", Name = "zjm" }, new DataGridViewTextBoxColumn() { HeaderText = "项目类型", DataPropertyName = "itemtype", Name = "itemtype", Visible = false }, new DataGridViewTextBoxColumn() { HeaderText = "费用类别", DataPropertyName = "feetype", Name = "feetype", Visible = false } }; this.dataGridView1.Columns.AddRange(dgvItemColumns); this.dataGridView1.DataSource = null; DataSet ds = new Business.DictProcess().GetItemByStr(SearchText); if (ds.Tables.Count > 0) { DataTable dtItem = ds.Tables[0]; if (dtItem.Rows.Count > 0) { this.Count = dtItem.Rows.Count; this.dataGridView1.DataSource = dtItem; if (this.dataGridView1.Rows.Count > 0) { this.dataGridView1.Rows[0].Selected = true; } } } break; } } } catch (Exception ex) { throw new ApplicationException("检索中心项目异常:" + ex.ToString()); } }