private void loadGv(DataGridView gv, string sql) { dataSet = new DataSet(); dataSet = dbConn1.GetDataSet(Strsql); dataTable = dataSet.Tables[0]; gv.DataSource = dataTable; }
private void Form2_Load(object sender, EventArgs e) { string sql = "SELECT distinct sfmc from GY_SFXM "; hisDBConn conn = new hisDBConn(); DataSet ds = conn.GetDataSet(sql); DataTable dt = ds.Tables[0]; path = System.AppDomain.CurrentDomain.BaseDirectory + "//dlwh.xml"; if (File.Exists(@path)) { ReadXml(path); } else { CreateXmlFile(dt, path); ReadXml(path); } for (int i = 0; i < dt.Rows.Count; i++) { comboBox1.Items.Add(dt.Rows[i][0].ToString()); } comboBox2.Items.Add("-"); foreach (var y in qj.yka111.Values) { comboBox2.Items.Add(y); } if (comboBox1.Items.Count > 0) { comboBox1.SelectedIndex = 0; } if (comboBox2.Items.Count > 0) { comboBox2.SelectedIndex = 0; } DataTable xml = new DataTable(); xml.Columns.Add("本地大类名称"); xml.Columns.Add("异地结算大类名称"); foreach (var t in list) { DataRow dr = xml.NewRow(); dr[0] = t.odlmc; dr[1] = t.dlmc; xml.Rows.Add(dr); } dataGridView1.DataSource = xml; }
private void button1_Click(object sender, EventArgs e) { hisDBConn hdb = new hisDBConn(); string zyhsql = "select zyh from ZY_BRRY where ZYHM = '" + gx.akc190 + "'"; DataTable dt1 = hdb.GetDataSet(zyhsql).Tables[0]; string zyh = dt1.Rows[0]["zyh"].ToString(); string ykc675 = (from r in qj.ykc675 where comboBox1.SelectedItem.ToString() == r.Value select r.Key).ToList <string>()[0]; string asql = "select SUM(zjje) as 'akc264' from ZY_JSMX where ZYH = '" + zyh + "'"; string akc264 = hdb.GetDataSet(asql).Tables[0].Rows[0][0].ToString(); string resultxml = qj.cscf("0303", "<?xml version=\"1.0\" encoding=\"GBK\"?>" + "<input>" + "<aab299>" + PublicCommon.aab299 + "</aab299>" + "<yab600>" + PublicCommon.yab600 + "</yab600>" + "<akb026>" + PublicCommon.akb026 + "</akb026>" + "<akb021>" + PublicCommon.akb021 + "</akb021>" + "<ykc700>" + gx.ykc700 + "</ykc700>" + "<aab301>" + gx.aab301 + "</aab301>" + "<yab060>" + gx.yab060 + "</yab060>" + "<aac002>" + gx.aac002 + "</aac002>" + "<aac043>" + gx.aac043 + "</aac043>" + "<aac044>" + gx.aac044 + "</aac044>" + "<ykc675>" + ykc675 + "</ykc675>" + "<akc264>" + akc264 + "</akc264>" + "</input>"); if (resultxml == "") { return; } mnjs mj = new mnjs(); mj = (mnjs)qj.rxml(mj, resultxml, null, null, null); if (mj != null) { Addkj(mj); } }
public void init() { textBox1.Text = zyhm; fl = new fymxlr(); hisDBConn hdb = new hisDBConn(); string zyhsql = "select zyh from ZY_BRRY where ZYHM = '" + zyhm.Trim() + "'"; DataTable dt = hdb.GetDataSet(zyhsql).Tables[0]; if (dt.Rows.Count < 1) { MessageBox.Show("查询不到该病号的费用明细"); return; } zyh = dt.Rows[0]["zyh"].ToString(); string fymxsql = " SELECT f.yzxh as 'akc220',f.rowid as 'ykc610', s.SFXM as 'yka111',s.SFMC as 'yka112'," + "( case when fyxm = 2 or fyxm = 3 or fyxm = 4 or fyxm = 21 or fyxm = 22 or fyxm = 23 or fyxm = 24 then case when f.yplx = 1 or f.yplx = 3 or f.yplx = 0 or f.yplx = 2" + "then(select distinct ISNULL( ybdm,sbdm) from yk_typk where yk_typk.ypxh = f.fyxh) end ELSE(select distinct ISNULL( ybdm,sbdm) from gy_ylsf where gy_ylsf.fyxh" + "= f.fyxh ) END) as 'ake001', " + "( case when fyxm = 2 or fyxm = 3 or fyxm = 4 or fyxm = 21 or fyxm = 22 or fyxm = 23 or fyxm = 24 then case when f.yplx = 1 or f.yplx = 3 or f.yplx = 0 or f.yplx = 2" + "then(select distinct fymc from yk_typk where yk_typk.ypxh = f.fyxh) end ELSE(select distinct fymc from gy_ylsf where gy_ylsf.fyxh" + "= f.fyxh) END) as 'ake002'," + "( case when fyxm = 2 or fyxm = 3 or fyxm = 4 or fyxm = 21 or fyxm = 22 or fyxm = 23 or fyxm = 24 then case when f.yplx = 1 or f.yplx = 3 or f.yplx = 0 or f.yplx = 2" + " then(select MESS from yk_typk where yk_typk.ypxh = f.fyxh) end ELSE('') END) as 'mess' ," + "'' as 'ake114','0' as 'aka185','' as 'yke230','' as 'yke231'," + "( case when fyxm = 2 or fyxm = 3 or fyxm = 4 or fyxm = 21 or fyxm = 22 or fyxm = 23 or fyxm = 24 then case when f.yplx = 1 or f.yplx = 3 or f.yplx = 0 or f.yplx = 2" + "then(select distinct sbdm from yk_typk where yk_typk.ypxh = f.fyxh) end ELSE(select distinct sbdm from gy_ylsf where gy_ylsf.fyxh" + "= f.fyxh) END) as 'ake005',f.FYMC as 'ake006' , f.FYSL as 'akc226',f.FYDJ as 'akc225', f.ZJJE as 'akc264',yc.CDMC as 'ykc611', '' as 'ykc615','' as 'aka074'," + " '' as 'aka067' , '' as 'aka070','' as 'akc056','' as 'akc273' ,k.KSMC as 'aae386' ,CONVERT(varchar(12) , f.fyrq, 112 ) as 'akc221','" + aae011 + "' as 'aae011','' as 'aae036'" + " FROM ZY_FYMX f join GY_SFXM s on s.SFXM = f.FYXM left join YK_CDDZ yc on yc.YPCD = f.YPCD join GY_KSDM k on k.KSDM = f.FYKS WHERE 1 = 1 AND(f.ZYH = '" + zyh + "') "; mxdt = hdb.GetDataSet(fymxsql).Tables[0]; Form2 frm = new Form2(this); string path = System.AppDomain.CurrentDomain.BaseDirectory + "//dlwh.xml"; frm.ReadXml(path); List <string> mesls = new List <string>(); foreach (DataRow r in mxdt.Rows) { if (r["mess"].ToString() != "" && r["mess"] != null) { mesls.Add(r["ykc610"].ToString()); } foreach (var v in qj.dlwh) { if (v.odlmc == r["yka112"].ToString()) { if (v.dlmc != "-") { r["yka111"] = (from y in qj.yka111 where y.Value == v.dlmc select y.Key).ToList <string>()[0]; r["yka112"] = v.dlmc; } } } fymx fy = new fymx(); var pros = fy.GetType().GetProperties(); foreach (var p in pros) { if (p.Name == "yka111") { if (r[p.Name].ToString().Length < 2) { p.SetValue(fy, "0" + r[p.Name].ToString().Trim(), null); continue; } } if (p.Name == "aae036") { p.SetValue(fy, DateTime.Now.ToString("yyyyMMdd"), null); continue; } p.SetValue(fy, r[p.Name].ToString().Trim(), null); } fl.fyls.Add(fy); } dataGridView1.DataSource = mxdt; DBConn db = new DBConn(); string fyczsql = "select * from fymxjl where aac044 = '" + gx.aac044 + "'and id = " + str_id; DataTable dt2 = db.GetDataSet(fyczsql).Tables[0]; if (dt2.Rows.Count != 0) { button1.Text = "费用明细回退"; return; } else { List <DataRow> lsd = new List <DataRow>(); foreach (var l in mesls) { DataRow d = mxdt.Select("ykc610 = " + l + "")[0]; DialogResult dr = MessageBox.Show(d["ake006"].ToString() + ",该药品为(" + d["mess"].ToString() + ")使用药品!是[可报销],否[自费]?", "提示:医保限制用药", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { d["aka185"] = "1"; } } } }
private void Form11_Load(object sender, EventArgs e) { Dictionary <string, string> ls = new Dictionary <string, string>(); string commandString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=C:\\Users\\Administrator\\Desktop\\新建文件夹(1)\\201902更新三目\\广东1.17.09中成药全库.xls;" + ";Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1\""; string commandString1 = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=C:\\Users\\Administrator\\Desktop\\新建文件夹(1)\\201902更新三目\\广东1.17.10西药全库.xls;" + ";Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1\""; DataSet dataSet = new DataSet(); // 创建连接到数据源的对象 OleDbConnection command = new OleDbConnection(commandString); OleDbConnection command1 = new OleDbConnection(commandString1); // 打开连接 command.Open(); // Sql的查询命令,有关于数据库自行百度或者Google string sqlex = "select * from [中成药注册信息库$]"; string sqlex1 = "select * from [西药注册信息库$]"; OleDbDataAdapter adaper = new OleDbDataAdapter(sqlex, command); OleDbDataAdapter adaper1 = new OleDbDataAdapter(sqlex1, command1); // 用来存放数据 dataSet = new DataSet(); adaper.Fill(dataSet); // 填充DataTable数据到DataSet中 DataTable dt = dataSet.Tables[0]; foreach (DataRow r in dt.Rows) { ls.Add(r["药监局药品编码"].ToString(), r["中成药药品代码"].ToString()); } dataSet = new DataSet(); adaper1.Fill(dataSet); dt = dataSet.Tables[0]; foreach (DataRow r in dt.Rows) { ls.Add(r["药监局药品编码"].ToString(), r["西药药品代码"].ToString()); } hisDBConn hdb = new hisDBConn(); //foreach (var l in ls) //{ // string sql = "update yk_typk2 set YBDM = '" + l.Value + "' where sbdm = '" + l.Key + "'"; // hdb.GetSqlCmd(sql); //} Dictionary <string, string> nls = new Dictionary <string, string>(); string sqln = "select * from [YK_TYPK2] where ybdm is null"; DataTable dtn = hdb.GetDataSet(sqln).Tables[0]; foreach (DataRow n in dtn.Rows) { string ypxh = n["ypxh"].ToString(); string sbdm = n["sbdm"].ToString(); string sql = "update yk_typk2 set YBDM = '" + sbdm + "' where ypxh = '" + ypxh + "'"; hdb.GetSqlCmd(sql); } // 释放连接的资源 command.Close(); }