private void Notice() { StringBuilder stringBuilder1 = new StringBuilder(); GetPrivateProfileString("Ward", "WardCode", "", stringBuilder1, 255, ".\\IMEQPIVAs.ini"); string wardcode = stringBuilder1.ToString(); this.richTextBox1.Text = ""; DB_Help db = new DB_Help(); string aa = ""; try { string sql = "SELECT DrugName, Discription FROM NoticeSet ns INNER JOIN Notice n ON ns.DrugCode = n.DrugCode WHERE ns.WardCode = '" + wardcode + "' AND ns.status = 0"; DataSet ds = db.GetPIVAsDB(sql); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { aa += ds.Tables[0].Rows[i][0].ToString() + "_" + ds.Tables[0].Rows[i][1].ToString() + "\r\n"; } } } catch (Exception e) { } this.richTextBox1.Text = aa; }
private void QrUserCode_Load(object sender, EventArgs e) { try { comboBox1.SelectedIndex = 0; db = new DB_Help(); string ir = db.IniReadValuePivas("Printer", "EmpReportWe"); comboBox2.SelectedIndex = string.IsNullOrEmpty(ir) ? 0 : Convert.ToInt32(ir); //if (db.GetPIVAsDB(string.Format("SELECT [LimitName] FROM [dbo].[ManageLimit] where [DEmployeeID]='{0}' and LimitName='QrUserCode'", User)).Tables[0].Rows.Count == 0) if (!GetPivasLimit.Instance.Limit(User, "QrUserCode")) { this.Dispose(true); } string sql = " select *from DEmployee"; demploy = db.GetPIVAsDB(sql).Tables[0]; listBox1.DataSource = demploy; listBox1.DisplayMember = "DEmployeeCode"; listBox1.ValueMember = "DEmployeeCode"; textBox1.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected virtual void Dispose(bool disposing) { if (_disposed) { return; } this._disposed = true; if (disposing) { //释放托管资源,系统调用时不进来。用于主动释放 ds = null; dicSendWindow = null; DB = null; try { threadHandlePackPLCComm.Abort(); } catch {} } //非托管对象释放,不管是手动还是系统都要执行; try { threadHandlePackPLCComm = null; smartThreadPool.Dispose(); Ax.Dispose(); } catch { } }
private void ShowLabelCheck(string Label) { int i = 0; pnlInfo.Controls.Clear(); DB_Help db = new DB_Help(); SQL sql = new SQL(); DataSet ds = db.GetPIVAsDB(sql.msg(Label)); for (int J = 0; J < ds.Tables[1].Rows.Count; J++) { CancelMessage msg = new CancelMessage(); msg.setmsg("核对", ds.Tables[1].Rows[J]); msg.Top = i * 20; pnlInfo.Controls.Add(msg); i++; } if (int.Parse(ds.Tables[0].Rows[0]["LabelOver"].ToString()) < 0) { CancelMessage msg = new CancelMessage(); msg.setmsg("配置取消", ds.Tables[0].Rows[0]); msg.Top = i * 20; pnlInfo.Controls.Add(msg); i++; } if (int.Parse(ds.Tables[0].Rows[0]["WardRetreat"].ToString()) > 0) { CancelMessage msg = new CancelMessage(); msg.setmsg("退药", ds.Tables[0].Rows[0]); msg.Top = i * 20; pnlInfo.Controls.Add(msg); i++; } }
private void InsertNoticeSet() { try { DB_Help db = new DB_Help(); using (DataSet ds = db.GetPIVAsDB("SELECT DrugCode FROM Notice ")) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { //DB_Help dd = new DB_Help(); DataSet dst = db.GetPIVAsDB("SELECT wardCode FROM NoticeSet WHERE DrugCode = '" + ds.Tables[0].Rows[i]["DrugCode"].ToString() + "'"); if (dst != null && dst.Tables[0].Rows.Count > 0) { for (int m = 0; m < dst.Tables[0].Rows.Count; m++) { db.GetPIVAsDB(" IF EXISTS (SELECT wardCode FROM NoticeSet WHERE wardCode = '" + dst.Tables[0].Rows[m]["wardCode"].ToString() + "')" + " UPDATE NoticeSet SET status = 1 WHERE wardCode = '" + dst.Tables[0].Rows[m]["wardCode"].ToString() + "' AND DrugCode = '" + ds.Tables[0].Rows[i]["DrugCode"].ToString() + "' " + "ELSE " + "INSERT INTO NoticeSet VALUES ('" + dst.Tables[0].Rows[m]["wardCode"].ToString() + "', '" + ds.Tables[0].Rows[i]["DrugCode"].ToString() + "', 0)"); } } else { DataSet dd = db.GetPIVAsDB("SELECT wardCode FROM DWard WHERE IsOpen = 1"); for (int n = 0; n < dd.Tables[0].Rows.Count; n++) { db.GetPIVAsDB("INSERT INTO NoticeSet VALUES ('" + dd.Tables[0].Rows[n]["wardCode"].ToString() + "', '" + ds.Tables[0].Rows[i]["DrugCode"].ToString() + "', 0)"); } } } } } catch (Exception e) { } }
private void DateChange() { if (DateisChange) { StringBuilder sb = new StringBuilder(); sb.AppendLine(string.Format("SELECT distinct Batch FROM [dbo].[IVRecord] WHERE IVStatus>8 and DATEDIFF({0},InfusionDT,'{1}')>=0 and DATEDIFF({0},InfusionDT,'{2}')<=0 Order by Batch ", DateByRd, dateTimePicker2.Value.ToString("yyyy-MM-dd hh:mm:ss"), dateTimePicker1.Value.ToString("yyyy-MM-dd hh:mm:ss"))); sb.AppendLine(string.Format("SELECT distinct d.WardCode,d.WardName,WardSeqNo FROM [IVRecord] iv inner join [DWard] d on iv.WardCode=d.WardCode and IVStatus>8 and DATEDIFF({0},InfusionDT,'{1}')>=0 and DATEDIFF({0},InfusionDT,'{2}')<=0 Order by WardSeqNo ", DateByRd, dateTimePicker2.Value.ToString("yyyy-MM-dd hh:mm:ss"), dateTimePicker1.Value.ToString("yyyy-MM-dd hh:mm:ss"))); using (DataSet ds = new DB_Help().GetPIVAsDB(sb.ToString())) { if (ds != null && ds.Tables.Count > 1) { Batchs = new List <TreeNode>(); foreach (DataRow dr in ds.Tables[0].Rows) { TreeNode tn = new TreeNode(); tn.Checked = true; tn.Text = dr["Batch"].ToString(); Batchs.Add(tn); } DWards = new List <TreeNode>(); foreach (DataRow dr in ds.Tables[1].Rows) { TreeNode tn = new TreeNode(); tn.Checked = true; tn.Text = dr["WardName"].ToString(); tn.Tag = dr["WardCode"].ToString(); DWards.Add(tn); } } } DateisChange = false; } }
private void ControlLoad() { StringBuilder sb = new StringBuilder(); sb.AppendLine(" SELECT distinct Species FROM [dbo].[DDrug] where Species is not null and Species !=''"); sb.AppendLine(" SELECT DrugCode,DrugName,Spec,SpellCode,NoName FROM DDrug"); if (!GetPivasLimit.Instance.Limit(userID, "PivasDrugCash")) { MessageBox.Show("您没有权限,请联系管理员!"); this.Dispose(true); } //MessageBox.Show(sb.ToString()); using (DataSet ds = new DB_Help().GetPIVAsDB(sb.ToString())) { if (ds != null && ds.Tables.Count == 2) { DrugDB = ds.Tables[1]; foreach (DataRow dr in ds.Tables[0].Rows) { comboBox1.Items.Add(dr[0].ToString()); } } else { this.Dispose(true); } } radioButton3.Checked = true; comboBox2.SelectedIndex = 0; comboBox1.SelectedIndex = 0; dateTimePicker1.Value = begindate; dateTimePicker2.Value = enddate; }
private void MainForm_Load(object sender, EventArgs e) { MessageBox.Show(UniPreparationID); if (UniPreparationID.Length > 0) { StringBuilder str = new StringBuilder(); str.Append(" SELECT SpecificationID, TypeID, UniversalID, SubTitle as 修改日期, DrugNames 药品名称,"); str.Append(" Characters 性状, Pharmacology 药理毒理, Dynamics 药代动力学, AdapterSymtoms as '适应症/功能主治',"); str.Append(" Usages 用法用量, SideEffects 不良反应, Taboos 禁忌, Notion 注意事项, WomenUsages 孕妇及哺乳期妇女用药,"); str.Append(" ChildrenUsages 儿童用药,OldUsages 老年用药, Interactions 药物相互作用, Paranormal 药物过量, Specifications 规格,"); str.Append(" Storage 贮藏, Package 包装, ValidityPeriod 有效期, ConfirmNumber 批准文号, Factory 生产企业, InputOrg, IsValid, Title,"); //str.Append(" company FROM kd0100.dbo.DrugSpecification "); str.Append(" company FROM kd0102.dbo.DrugSpecification "); str.Append(" WHERE UniversalID in (select UniversalID from kd0100.dbo.UniPreparation where UniPreparationID='" + UniPreparationID + "')"); str.Append(" order by TypeID"); DB_Help db = new DB_Help(); ds = db.GetPIVAsDB(str.ToString()); if (ds != null && ds.Tables[0].Rows.Count > 0) { //加载tab名称 if (ds.Tables[0].Rows[0]["company"].ToString().Trim().Length > 0) { tabPage1.Text = ds.Tables[0].Rows[0]["company"].ToString(); } else { if (ds.Tables[0].Rows[0]["TypeID"].ToString().Equals("1")) { tabPage1.Text = "标准说明书"; } } //加载tab for (int j = 1; j < ds.Tables[0].Rows.Count && tabControl1.Controls.Count < ds.Tables[0].Rows.Count; j++) { TabPage tab = new TabPage(ds.Tables[0].Rows[j]["company"].ToString()); tabControl1.Controls.Add(tab); } //赋值内容 DataShow(); } else { Title.Parent = tabPage1; Title.Text = "无药品说明书"; flowLayoutPanel1.Visible = false; } } else { Title.Parent = tabPage1; Title.Text = "未匹配此药品对应的制剂信息"; flowLayoutPanel1.Visible = false; } }
private DataSet getDrug() { DB_Help db = new DB_Help(); DataSet ds = null; try { ds = db.GetPIVAsDB("SELECT DrugName, Spec, firm_id FROM DDrug WHERE isStop = 1"); } catch { } return(ds); }
public void USynMin_Load(object sender, EventArgs e) { db = new DB_Help(); if (USynMinSet.SynTimeCode == Tag.ToString()) { pictureBox2.Visible = true; label1.ForeColor = Color.Black; label2.ForeColor = Color.Black; } else { pictureBox2.Visible = false; label1.ForeColor = Color.Silver; label2.ForeColor = Color.Silver; } if (Tag != null) { switch (Tag.ToString()) { case "1": { label1.Text = "一次"; label2.Text = "每天定时执行一次同步"; label3.Text = "在" + (USynMinSet.begin.Contains(",") ? USynMinSet.begin.Split(',')[0] : USynMinSet.begin) + "点执行"; break; } case "2": { label1.Text = "时段"; label2.Text = "每天的一个时间段内间隔执行同步"; label3.Text = "间隔" + USynMinSet.space + "分钟执行"; break; } case "3": { label1.Text = "全天"; label2.Text = "全天间隔执行同步"; label3.Text = "间隔" + USynMinSet.space + "分钟执行"; break; } case "4": { label1.Text = "手动"; pictureBox1.Visible = false; break; } } } }
private void updateDB_CC(string s) { DB_Help DB = new DB_Help(); try { string ustr = " insert into IVRecordToCC(LabelNo,CCDT) values('" + s + "', GETDATE()) "; DB.SetPIVAsDB(ustr); } catch (Exception ex) { } }
public MainShow() { DB = new DB_Help(); dt = new DataTable(); dt.Columns.Add("Time", typeof(string)); dt.Columns.Add("PrinterID", typeof(string)); dt.Columns.Add("PrintCount", typeof(int)); dt.Columns.Add("Oldds", typeof(string)); dt.Columns.Add("DrugQRCode", typeof(string)); InitializeComponent(); dateTimePicker1.Value = DateTime.Now.Date; comboBox2.SelectedIndex = 0; }
private void QfInfo(string wardcode, int i, string patcode, string begindt, string enddt) { try { string sql = "exec QfInfoSelect '{0}',{1},'{2}','{3}','{4}'"; sql = string.Format(sql, wardcode, i, patcode, begindt, enddt); DB_Help db = new DB_Help(); DataSet ds = db.GetPIVAsDB(sql); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int a = 0; a < ds.Tables[0].Rows.Count; a++) { if (i == 1) { label10.Text = ds.Tables[0].Rows[0][0].ToString(); label2.Text = ds.Tables[0].Rows[0][1].ToString(); label20.Text = ds.Tables[0].Rows[0][2].ToString(); } else if (i == 2) { ListViewItem lv1 = new ListViewItem(ds.Tables[0].Rows[a][0].ToString().Trim()); lv1.SubItems.Add(ds.Tables[0].Rows[a][1].ToString().Trim()); lv1.SubItems.Add(ds.Tables[0].Rows[a][2].ToString().Trim()); listView1.Items.Add(lv1); } else if (i == 3) { ListViewItem lv1 = new ListViewItem(ds.Tables[0].Rows[a][0].ToString().Trim()); lv1.SubItems.Add(ds.Tables[0].Rows[a][1].ToString().Trim()); lv1.SubItems.Add(ds.Tables[0].Rows[a][2].ToString().Trim()); lv1.SubItems.Add(ds.Tables[0].Rows[a][3].ToString().Trim()); lv1.SubItems.Add(ds.Tables[0].Rows[a][4].ToString().Trim()); listView2.Items.Add(lv1); } else { ListViewItem lv1 = new ListViewItem(ds.Tables[0].Rows[a][0].ToString().Trim()); lv1.SubItems.Add(ds.Tables[0].Rows[a][1].ToString().Trim()); lv1.SubItems.Add(ds.Tables[0].Rows[a][2].ToString().Trim()); listView3.Items.Add(lv1); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private string[,] fn = new string[3, 4];//第3行为按钮的名字,空则按钮不显示,非空按钮显示 public string[,] GetInfor(string wardCode) { string sql = "exec QfInfoSelect '" + wardCode + "' ,0 ,'','',''"; DB_Help db = new DB_Help(); DataSet ds = db.GetPIVAsDB(sql); try { if (ds == null || ds.Tables[0].Rows.Count <= 0) { fn[0, 0] = "欠费病人"; fn[0, 1] = "欠费瓶签数"; fn[0, 2] = ""; fn[0, 3] = ""; fn[1, 0] = "0"; fn[1, 1] = "0"; fn[1, 2] = ""; fn[1, 3] = ""; fn[2, 0] = "查询"; fn[2, 1] = ""; fn[2, 2] = ""; fn[2, 3] = ""; } else { fn[0, 0] = ds.Tables[0].Rows[0][0].ToString(); fn[0, 1] = ds.Tables[0].Rows[0][1].ToString(); fn[0, 2] = ds.Tables[0].Rows[0][2].ToString(); fn[0, 3] = ds.Tables[0].Rows[0][3].ToString(); fn[1, 0] = ds.Tables[0].Rows[0][4].ToString(); fn[1, 1] = ds.Tables[0].Rows[0][5].ToString(); fn[1, 2] = ds.Tables[0].Rows[0][6].ToString(); fn[1, 3] = ds.Tables[0].Rows[0][7].ToString(); fn[2, 0] = ds.Tables[0].Rows[0][8].ToString(); fn[2, 1] = ds.Tables[0].Rows[0][9].ToString(); fn[2, 2] = ds.Tables[0].Rows[0][10].ToString(); fn[2, 3] = ds.Tables[0].Rows[0][11].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } return(fn); }
private void listView1_MouseDoubleClick(object sender, MouseEventArgs e) { this.richTextBox1.Visible = true; try { DB_Help db = new DB_Help(); DataSet ds = db.GetPIVAsDB("SELECT Discription FROM Notice WHERE DrugCode = '" + ccode + "' AND (Discription IS NOT NULL OR Discription <> '')"); if (ds != null && ds.Tables[0].Rows.Count > 0) { this.richTextBox1.Text = ds.Tables[0].Rows[0]["Discription"].ToString(); } else { this.richTextBox1.Text = "(字数限制在250字之内....)"; } } catch (Exception ex) { } this.panel1.Visible = true; }
/// <summary> /// 登录按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void label1_Click(object sender, EventArgs e) { db = new DB_Help(); try { if (TestDB()) { LoginProving(cbox_user.Text.Trim(), txt_pwd.Text.Trim()); } else { MessageBox.Show(" 连接失败 !!!"); } } catch { MessageBox.Show("登陆失败! 未知错误。。。"); } }
private void syntoset() { DB_Help db = new DB_Help(); try { string sql = "SELECT * FROM [IVRecordUpdateWait] WHERE CenterAct = 0"; string sql2 = "update IVRecord set PackAdvance=1,PackID='1',PackTime=getdate() where LabelNo in (SELECT WardLabelNo FROM [IVRecordUpdateWait] WHERE CenterAct = 0)"; string sql3 = "update [IVRecordUpdateWait] set CenterAct=(select isnull(i.PackAdvance,0) from IVRecord i where i.LabelNo=WardLabelNo) ,CenterEmployeeID=(select i.PackID from IVRecord i where i.LabelNo=WardLabelNo) ,CenterInsertDT=GETDATE() " + "where WardLabelNo in (SELECT WardLabelNo FROM [IVRecordUpdateWait] WHERE CenterAct = 0) and WardAct='0'"; DataSet dataSet = db.GetPIVAsDB(sql); if (dataSet != null && dataSet.Tables[0].Rows.Count > 0) { db.GetPIVAsDB(sql2); db.GetPIVAsDB(sql3); } } catch (Exception e) { } }
private void getDrug() { this.checkedListBox1.Items.Clear(); this.checkedListBox1.Items.Add("全选/取消"); try { DB_Help dbHelp = new DB_Help(); using (DataSet dataSet = dbHelp.GetPIVAsDB(string.Format("SELECT DrugName FROM DDrug WHERE IsValid = 1 AND DrugCode NOT IN (SELECT DrugCode FROM Notice)"))) { if (dataSet.Tables[0].Rows.Count > 0) { foreach (DataRow dataRow in dataSet.Tables[0].Rows) { this.checkedListBox1.Items.Add(dataRow[0]); } } } } catch (Exception e) { } }
private void NoticeDrug() { try { string sql = "SELECT DrugCode, DrugName, Discription FROM Notice"; //sql = string.Format(sql, wardcode); DB_Help db = new DB_Help(); DataSet ds = db.GetPIVAsDB(sql); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int a = 0; a < ds.Tables[0].Rows.Count; a++) { ListViewItem lv1 = new ListViewItem(ds.Tables[0].Rows[a]["DrugCode"].ToString().Trim()); lv1.SubItems.Add(ds.Tables[0].Rows[a]["DrugName"].ToString().Trim()); lv1.SubItems.Add(ds.Tables[0].Rows[a]["Discription"].ToString().Trim()); listView1.Items.Add(lv1); } } } catch (Exception e) { } }
private void UpdateNotice(string drugCode) { try { DB_Help db = new DB_Help(); string mess = ""; if ("(字数限制在250字之内....)" != this.richTextBox1.Text) { mess = this.richTextBox1.Text; } else { mess = ""; } if ("" != mess) { db.GetPIVAsDB("UPDATE Notice SET Discription = '" + mess + "' WHERE DrugCode = '" + drugCode + "'"); } } catch (Exception e) { } }
/// <summary> /// 创建空表,仅有表结构 /// </summary> static void CreateEmptyTable(string hisTableName, string tempTableName, string preDBName) { DB_Help dbHelp = new DB_Help(); int rtn = -1; DataSet ds = dbHelp.GetPIVAsDB("select 1 from " + preDBName + "sysobjects where id = object_id('" + hisTableName + "') and type = 'U'"); if (ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { rtn = 1; } else {//不存在时,才创建表 rtn = dbHelp.SetPIVAsDB("select * into " + hisTableName + " from " + tempTableName + " where 1=2"); } if (rtn < 0) { InternalLogger.Log.Error("CREATE TABLE error"); } }
private void DengLu() { DB_Help DB = new DB_Help(); if (string.IsNullOrEmpty(txtDoc.Text)) { MessageBox.Show("工号为空!"); txtDoc.Focus(); return; } DataTable dt = DB.GetPIVAsDB("SELECT * FROM DEmployee WHERE AccountID='" + txtDoc.Text + "' and [Pas]='" + txtPas.Text.Trim() + "'").Tables[0]; if (dt.Rows.Count <= 0) { MessageBox.Show("用户名或者密码错误!"); txtPas.Text = null; txtDoc.Focus(); return; } loginUser(dt.Rows[0]["DEmployeeName"].ToString(), dt.Rows[0]["DEmployeeID"].ToString()); this.Dispose(); }
private void timer1_Tick(object sender, EventArgs e) { this.richTextBox1.Text = ""; DB_Help db = new DB_Help(); try { DataSet ds = db.GetPIVAsDB("SELECT DrugCode FROM NoticeSet WHERE WardCode = '" + wardCode + "' AND status = 0"); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int a = 0; a < ds.Tables[0].Rows.Count; a++) { ListViewItem lv1 = new ListViewItem(ds.Tables[0].Rows[a]["DrugName"].ToString().Trim()); lv1.SubItems.Add(ds.Tables[0].Rows[a]["Spec"].ToString().Trim()); lv1.SubItems.Add(ds.Tables[0].Rows[a]["Dosage"].ToString().Trim() + ds.Tables[0].Rows[a]["DosageUnit"].ToString().Trim()); listView3.Items.Add(lv1); } this.panel2.Visible = true; } } catch (Exception ex) { } }
private void hadLook() { StringBuilder stringBuilder1 = new StringBuilder(); GetPrivateProfileString("Ward", "WardCode", "", stringBuilder1, 255, ".\\IMEQPIVAs.ini"); string wardcode = stringBuilder1.ToString(); DB_Help db = new DB_Help(); try { string sql1 = "SELECT ns.DrugCode FROM NoticeSet ns INNER JOIN Notice n ON ns.DrugCode = n.DrugCode WHERE ns.WardCode = '" + wardcode + "' AND ns.status = 0"; DataSet dataSet = db.GetPIVAsDB(sql1); if (dataSet != null && dataSet.Tables[0].Rows.Count > 0) { for (int m = 0; m < dataSet.Tables[0].Rows.Count; m++) { string sql2 = "UPDATE NoticeSet SET status = 1 WHERE WardCode = '" + wardcode + "' AND DrugCode = '" + dataSet.Tables[0].Rows[m][0].ToString() + "'"; DataSet ds = db.GetPIVAsDB(sql2); } } } catch (Exception e) { } }
private void InsertNotic() { for (int i = 0; i < this.checkedListBox1.Items.Count; i++) { if (this.checkedListBox1.GetItemChecked(i)) { string drugName = this.checkedListBox1.GetItemText(this.checkedListBox1.Items[i]); try { DB_Help db = new DB_Help(); DataSet ds = db.GetPIVAsDB("SELECT DISTINCT DrugCode, DrugName FROM DDrug WHERE DrugName = '" + drugName + "'"); if (ds != null && ds.Tables[0].Rows.Count > 0) { for (int a = 0; a < ds.Tables[0].Rows.Count; a++) { db.GetPIVAsDB("INSERT INTO Notice VALUES ('" + ds.Tables[0].Rows[a]["DrugCode"] + "','" + ds.Tables[0].Rows[a]["DrugName"] + "','')"); } } } catch (Exception e) { } } } }
private void listView2_Click(object sender, EventArgs e) { listView3.Clear(); listview3Init(); string sql = "select DrugName ,Spec ,iv.WardName ,pt.BedNo ,case pt.Sex when '1' then '男' else '女' end sex ,pt.Age ,pt.AgeSTR ,iv.PatCode, " + "iv.Batch ,Convert(float,id.Dosage) Dosage,id.DosageUnit ,CONVERT (varchar(100),iv.InfusionDT,24) InfusionDT,iv.FreqCode " + "from IVRecord iv inner join IVRecordDetail id on iv.IVRecordID =id.IVRecordID " + "inner join Patient pt on pt.PatCode =iv.PatCode where LabelNo ="; try { string labelno = listView2.FocusedItem.SubItems[2].Text; DB_Help db = new DB_Help(); DataSet ds = db.GetPIVAsDB(sql + labelno); if (ds != null && ds.Tables[0].Rows.Count > 0) { label8.Text = ds.Tables[0].Rows[0]["BedNo"].ToString(); label6.Text = ds.Tables[0].Rows[0]["sex"].ToString(); label15.Text = ds.Tables[0].Rows[0]["age"].ToString() + ds.Tables[0].Rows[0]["AgeSTR"].ToString(); label17.Text = ds.Tables[0].Rows[0]["PatCode"].ToString(); label18.Text = ds.Tables[0].Rows[0]["FreqCode"].ToString(); label11.Text = ds.Tables[0].Rows[0]["InfusionDT"].ToString(); label13.Text = ds.Tables[0].Rows[0]["Batch"].ToString(); for (int a = 0; a < ds.Tables[0].Rows.Count; a++) { ListViewItem lv1 = new ListViewItem(ds.Tables[0].Rows[a]["DrugName"].ToString().Trim()); lv1.SubItems.Add(ds.Tables[0].Rows[a]["Spec"].ToString().Trim()); lv1.SubItems.Add(ds.Tables[0].Rows[a]["Dosage"].ToString().Trim() + ds.Tables[0].Rows[a]["DosageUnit"].ToString().Trim()); listView3.Items.Add(lv1); } } } catch (Exception) { throw; } }
private void ShowLabelCheck(string Label, string date) { DB_Help db = new DB_Help(); SQL sql = new SQL(); dgvPre.Rows.Clear(); using (DataTable dt = db.GetPIVAsDB(sql.PreForLabel(Label, date)).Tables[0]) { if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { dgvPre.Rows.Add(1); dgvPre.Rows[i].Cells["LabelNo"].Value = dt.Rows[i]["LabelNo"].ToString(); dgvPre.Rows[i].Cells["BedNo"].Value = dt.Rows[i]["BedNo"].ToString(); dgvPre.Rows[i].Cells["PatName"].Value = dt.Rows[i]["PatName"].ToString(); dgvPre.Rows[i].Cells["IVStatus"].Value = CheckReturn(int.Parse(dt.Rows[i]["IVStatus"].ToString()), dt.Rows[i]["WardRetreat"].ToString(), int.Parse(dt.Rows[i]["LabelOver"].ToString())); dgvPre.Rows[i].Cells["Batch"].Value = dt.Rows[i]["Batch"].ToString().Trim(); dgvPre.Rows[i].Cells["FreqCode"].Value = dt.Rows[i]["FreqCode"].ToString().Trim(); dgvPre.Rows[i].Cells["PreCode"].Value = dt.Rows[i]["PrescriptionID"].ToString(); } } } }
private void timer1_Tick(object sender, EventArgs e) { //listview1Init(); //string sql = "EXEC p_baxter_pivas_pivano "; //try //{ // db.GetPIVAsDB(sql); //} //catch (Exception ex) //{ } //StringBuilder stringBuilder1 = new StringBuilder(); //GetPrivateProfileString("Ward", "WardCode", "", stringBuilder1, 255, ".\\IMEQPIVAs.ini"); //string wardcode = stringBuilder1.ToString(); DB_Help db = new DB_Help(); try { string sql = "SELECT * FROM IVRecord WHERE Remark6 LIKE '%发药计费成功%' AND PrinterName IS NOT NULL "; DataSet ds = db.GetPIVAsDB(sql); if (ds != null && ds.Tables[0].Rows.Count > 0) { //if (this.WindowState == FormWindowState.Minimized) //{ // this.Show(); // this.WindowState = FormWindowState.Normal; // Notice(); //} //else // return; db.GetPIVAsDB("UPDATE IVRecord SET Remark3 = 16, IVStatus = 13 WHERE Remark6 LIKE '%发药计费成功%' AND PrinterName IS NOT NULL AND DATEDIFF(DD, InsertDT, GETDATE()) = 0"); } } catch (Exception ex) { } //syntoset(); }
private GetPivasLimit() { dbHelp = new DB_Help(); }
private void button1_Click(object sender, EventArgs e) { try { if (comboBox2.SelectedIndex == 0 && radioButton3.Checked && (dateTimePicker2.Value - dateTimePicker1.Value).Days > 31) { MessageBox.Show("按天统计,时间跨度不可超过31天!!!"); return; } string GetMoth = string.Empty; switch (comboBox2.SelectedIndex) { case 0: { GetMoth = DateByRd; break; } case 1: { GetMoth = "Ward"; break; } case 2: { GetMoth = "Batch"; break; } } using (DataTable DatDB = new DataTable()) { //MessageBox.Show(string.Format("EXECUTE [dbo].[GetDrugCash] '{0}','{1}','{2}','{3}','{4}','{5}','{6}'", GetMoth, begindate, enddate, WardCode, Batch, DrugType, DateByRd)); using (DataSet ds = new DB_Help().GetPIVAsDB(string.Format("EXECUTE [dbo].[GetDrugCash] '{0}','{1}','{2}','{3}','{4}','{5}','{6}'", GetMoth, begindate, enddate, WardCode, Batch, DrugType, DateByRd))) { if (ds != null && ds.Tables.Count > 1) { DatDB.Columns.Add("药品名", typeof(string)); DatDB.Columns.Add("规格", typeof(string)); DatDB.Columns.Add("理论总用量", typeof(string)); DatDB.Columns.Add("实际总用量", typeof(string)); DatDB.Columns.Add("总结余", typeof(string)); if (comboBox2.SelectedIndex == 1) { foreach (DataRow dr in ds.Tables[0].Rows) { DataColumn dc = new DataColumn(); dc.Caption = dr["WardName"].ToString().Trim(); dc.ColumnName = dr["WardCode"].ToString().Trim(); dc.DataType = typeof(string); DatDB.Columns.Add(dc); } } else { foreach (DataRow dr in ds.Tables[0].Rows) { DatDB.Columns.Add(dr[0].ToString().Trim(), typeof(string)); } } foreach (DataRow dr in DrugDB.Select(string.Format("DrugName like ('%{0}%') or SpellCode like ('%{0}%')", textBox1.Text.Trim() == "药品名称/药品简拼" ? string.Empty : textBox1.Text.Trim()), "NoName desc")) { DataRow d = DatDB.NewRow(); float Qs = 0; float LLal = 0; float SJal = 0; foreach (DataRow drs in ds.Tables[1].Select(string.Format("DrugCode='{0}'", dr["DrugCode"].ToString().Trim()))) { if (DatDB.Columns.Contains(drs[1].ToString().Trim())) { d[drs[1].ToString().Trim()] = drs[2]; float QS = 0; float LLall = 0; float SJall = 0; float.TryParse(drs[2].ToString(), out QS); float.TryParse(drs[3].ToString(), out LLall); float.TryParse(drs[4].ToString(), out SJall); Qs = Qs + QS; LLal = LLal + LLall; SJal = SJal + SJall; } } if (Qs > 0 || LLal > 0 || SJal > 0) { d["药品名"] = dr["DrugName"].ToString().Trim(); d["规格"] = dr["Spec"].ToString().Trim(); d["理论总用量"] = LLal; d["实际总用量"] = SJal; d["总结余"] = Qs; DatDB.Rows.Add(d); } } } } if (DatDB.Rows.Count == 0) { MessageBox.Show("当前条件下没有药品结余!!!"); } else { if (comboBox2.SelectedIndex == 1) { foreach (DataColumn dc in DatDB.Columns) { dc.ColumnName = dc.Caption; } } else { foreach (DataColumn dc in DatDB.Columns) { dc.ColumnName = dc.ColumnName.Replace("#", "批").Replace("-", "_"); } } dataGridView1.Columns.Clear(); dataGridView1.DataSource = DatDB; dataGridView1.Columns[0].Width = 200; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }