private void deleteInfo() { if (this.treeView1.SelectedNode != null && this.treeView1.SelectedNode != this.treeView1.Nodes[0]) { string id = this.treeView1.SelectedNode.Tag.ToString(); DataSet dsZyjl = new Business.MainList().GetZyjlById(Int32.Parse(id)); if (dsZyjl.Tables[0].Rows.Count < 1) { MessageBox.Show("未查到该患者的住院记录!"); return; } if (MessageBox.Show("确定是否要删除?", "删除提醒", MessageBoxButtons.YesNo) == DialogResult.Yes) { //开启子线程弹出正在处理form 初始化之后之后关闭加载框 MyProgressWait = new Thread(ProgressBarWait); MyProgressWait.Start(); try { bool result = new Business.MainList().DeleteZyjlById(id); if (result) { this.loadForm.DialogResult = DialogResult.OK; MessageBox.Show("删除成功!"); } } catch (Exception ex) { this.loadForm.DialogResult = DialogResult.OK; this.showError("删除患者信息:" + ex.ToString()); } finally { this.ScanDataGridView.DataSource = null; loadData(); } } } else { MessageBox.Show("请选择要删除的患者!"); } }
public void loadDataByStr() { string sdx = Util.Util.GetAppSetting("rcode"); Hashtable ht = new Hashtable(); if (!String.IsNullOrEmpty(this.tbName.Text.Trim())) { ht.Add("condition", this.tbName.Text.Trim()); } DataTable dt = new Business.MainList().GetMainInfoList(sdx, ht).Tables[0]; if (dt.Rows.Count > 0) { dtInfo = dt; InitDataSet(); } }
private void InitInfo() { if (!String.IsNullOrEmpty(this.pid)) { DataSet ds = new Business.MainList().GetZyjlById(Int32.Parse(this.pid)); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { dtZyInfo = ds.Tables[0]; DataRow dr = dtZyInfo.Rows[0]; this.tbMcard.Text = dr["ylzh"].ToString(); this.tbName.Text = dr["name"].ToString(); this.tbInhosNum.Text = dr["zyh"].ToString(); } else { MessageBox.Show("未查询到要修改的住院信息!"); return; } } }
private void loadDataByStr() { string sdx = Util.Util.GetAppSetting("rcode"); Hashtable ht = new Hashtable(); if (!String.IsNullOrEmpty(this.tbName.Text.Trim())) { ht.Add("name", this.tbName.Text.Trim()); } if (!String.IsNullOrEmpty(this.tbMcard.Text.Trim())) { ht.Add("ylzh", this.tbMcard.Text.Trim()); } if (!String.IsNullOrEmpty(this.tbInhosnum.Text.Trim())) { ht.Add("zyh", this.tbInhosnum.Text.Trim()); } DataTable dt = new Business.MainList().GetMainInfoList(sdx, ht).Tables[0]; if (dt.Rows.Count > 0) { this.treeView1.Nodes.Clear(); TreeNode root = new TreeNode(); root.Text = "外诊录入信息"; root.Tag = "外诊录入信息-guid"; for (int i = 0; i < dt.Rows.Count; i++) { TreeNode tmp = new TreeNode(); tmp.Text = dt.Rows[i]["name"].ToString() + "(" + dt.Rows[i]["ylzh"].ToString() + ")"; tmp.Tag = dt.Rows[i]["id"].ToString(); root.Nodes.Add(tmp); } this.treeView1.Nodes.Add(root); root.Expand(); } }
private void treeView1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (this.treeView1.SelectedNode != this.treeView1.Nodes[0] && e.KeyCode == Keys.Delete) { //MessageBox.Show(this.treeView1.SelectedNode.Text+this.treeView1.SelectedNode.Tag.ToString()); try { string id = this.treeView1.SelectedNode.Tag.ToString(); bool result = new Business.MainList().DeleteZyjlById(id); if (result) { MessageBox.Show("删除成功!", "上传提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); this.loadData(); } } catch (Exception ex) { this.showError("删除住院记录错误:" + ex.ToString()); } } }
private void loadData() { string sdx = Util.Util.GetAppSetting("rcode"); DataTable dt = new Business.MainList().GetMainInfoList(sdx, null).Tables[0]; if (dt.Rows.Count > 0) { this.treeView1.Nodes.Clear(); TreeNode root = new TreeNode(); root.Text = "外诊录入信息"; root.Tag = "外诊录入信息-guid"; for (int i = 0; i < dt.Rows.Count; i++) { TreeNode tmp = new TreeNode(); tmp.Text = dt.Rows[i]["name"].ToString() + "(" + dt.Rows[i]["ylzh"].ToString() + ")"; tmp.Tag = dt.Rows[i]["id"].ToString(); root.Nodes.Add(tmp); } this.treeView1.Nodes.Add(root); root.Expand(); } }
private void button1_Click(object sender, EventArgs e) { if (this.treeView1.SelectedNode != this.treeView1.Nodes[0] && this.treeView1.SelectedNode != null && this.treeView1.Nodes[0].IsExpanded) { string id = this.treeView1.SelectedNode.Tag.ToString(); DataSet dsZyjl = new Business.MainList().GetZyjlById(Int32.Parse(id)); if (dsZyjl.Tables[0].Rows.Count < 1) { MessageBox.Show("未查到该患者的住院记录!"); return; } string inhosGuid = dsZyjl.Tables[0].Rows[0]["GUID"].ToString(); string pname = dsZyjl.Tables[0].Rows[0]["name"].ToString(); //赋值给mainform MainForm mainForm = null; if (this.Owner is MainForm) { mainForm = ((MainForm)this.Owner); } else { mainForm = new MainForm(); } mainForm.Show(); mainForm.DialogResult = DialogResult.OK; mainForm.callBack(inhosGuid, pname, null); this.Close(); } else { MessageBox.Show("请先选择要扫描的患者信息!"); return; } }
private void button4_Click(object sender, EventArgs e) { try { DataSet ds = new Business.MainList().CombineFeeDetail("2"); SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Excel files (*.xls)|*.xls"; saveFileDialog.FilterIndex = 0; saveFileDialog.RestoreDirectory = true; saveFileDialog.CreatePrompt = false; saveFileDialog.FileName = "wang-123" + ".xls"; if (saveFileDialog.ShowDialog() == DialogResult.Cancel) { return; } Util.Util.WriteExcel(ds.Tables[0], saveFileDialog.FileName); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnDel_Click(object sender, EventArgs e) { //判断选中几行 try { int count = 0; for (int i = 0; i < this.dgvInhosList.Rows.Count; i++) { if (this.dgvInhosList.Rows[i].Cells[this.dgvInhosList.Columns["SelectCheck"].Index].EditedFormattedValue.ToString() == "True") { count++; DialogResult dialogResult = MessageBox.Show("确定要删除吗?", "删除提醒", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { string zyID = this.dgvInhosList.Rows[i].Cells[this.dgvInhosList.Columns["id"].Index].Value.ToString(); bool result = new Business.MainList().DeleteZyjlById(zyID); if (result) { MessageBox.Show("删除成功!"); loadDataByStr(); return; } else { MessageBox.Show("删除失败!"); return; } } } } } catch (Exception ex) { throw ex; } }
private void upload() { if (this.treeView1.SelectedNode != null && this.treeView1.SelectedNode != this.treeView1.Nodes[0]) { string id = this.treeView1.SelectedNode.Tag.ToString(); DataSet dsZyjl = new Business.MainList().GetZyjlById(Int32.Parse(id)); if (dsZyjl.Tables[0].Rows.Count < 1) { MessageBox.Show("请先登记再上传!"); return; } DataRow dr = dsZyjl.Tables[0].Rows[0]; string result = ""; try { result = new Business.MainList().UploadZyjl(dr); } catch (Exception ex) { MessageBox.Show("上传失败!==>" + ex.ToString(), "上传提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); return; } /* * <?xml version="1.0" encoding="UTF-8"?><businessdata><functioncode>200222</functioncode><state>0</state><result/><remark1/><remark2/><remark3/><remark4/><remark5/></businessdata> */ //this.TopMost = false; if (!String.IsNullOrEmpty(result)) { XmlDocument xdResult = new XmlDocument(); xdResult.LoadXml(result); XmlElement rootResult = xdResult.DocumentElement; string state = rootResult.SelectSingleNode("state").InnerText; if (state.Equals("0")) { bool result1 = new Business.MainList().UpdateUploadZyjlById(dr["id"].ToString()); bool result2 = new Business.MainList().UpdateUploadFymxByPId(dr["id"].ToString()); if (result1 && result2) { MessageBox.Show("上传成功!", "上传提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); } else { MessageBox.Show("上传成功!更新上传标识异常!", "上传提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); } } else { MessageBox.Show("上传失败!==>" + rootResult.SelectSingleNode("result").InnerText, "上传提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); } } else { MessageBox.Show("上传失败!==>上传返回结果为空!", "上传提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); } } else { MessageBox.Show("请先选中住院记录再上传!"); return; } }
private void upload() { //获取数据记录再拼包 //根据guid获取记录,guid由登记主信息之后,传过来的 DataSet dsZyjl = new Business.MainList().GetZyjlByGuid("4a4b9c7a-ca0a-474f-a010-bbedc4e5bcd1"); if (dsZyjl.Tables[0].Rows.Count < 1) { MessageBox.Show("请先登记再上传!"); return; } DataRow dr = dsZyjl.Tables[0].Rows[0]; string result = new Business.MainList().UploadZyjl(dr); /* * <?xml version="1.0" encoding="UTF-8"?><businessdata><functioncode>200222</functioncode><state>0</state><result/><remark1/><remark2/><remark3/><remark4/><remark5/></businessdata> */ this.TopMost = false; if (!String.IsNullOrEmpty(result)) { try { XmlDocument xdResult = new XmlDocument(); xdResult.LoadXml(result); XmlElement rootResult = xdResult.DocumentElement; string state = rootResult.SelectSingleNode("state").InnerText; if (state.Equals("0")) { bool result1 = new Business.MainList().UpdateUploadZyjlById(dr["id"].ToString()); bool result2 = new Business.MainList().UpdateUploadFymxByPId(dr["id"].ToString()); if (result1 && result2) { MessageBox.Show("上传成功!", "上传提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); } else { MessageBox.Show("上传成功!更新上传标识异常!", "上传提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); } } else { MessageBox.Show("上传失败!==>" + rootResult.SelectSingleNode("result").InnerText, "上传提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); } } catch (Exception ex) { throw ex; } } else { MessageBox.Show("上传失败!==>上传返回结果为空!", "上传提示", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); } }
/// <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); } }