コード例 #1
0
ファイル: Two25.cs プロジェクト: ewin66/wholePivas
 public void twoTwoFive_stop()
 {
     try
     {
         string str = " select distinct top 100 labelno,teamNumber from IVRecord(nolock) where labelover < 0 and DATEDIFF(dd,GETDATE(),InfusionDT) >= -1 and LabelNo not in (select LabelNo from IVRecordToTY) ";
         //string str = " select distinct top 100 labelno from IVRecord where labelover < 0 and (labelno like '20171010%' or labelno like '20171011%') and LabelNo not in (select LabelNo from IVRecordToTY) ";
         //string str = " select labelno from IVRecord where labelover < 0 and LabelNo in ('20171010102387') and LabelNo not in (select LabelNo from IVRecordToTY) ";
         DataSet ds = DB.GetPIVAsDB(str);
         if (ds.Tables.Count > 0 && !(ds == null) && ds.Tables[0].Rows.Count > 0)
         {
             string sendstr = makestr(ds);
             //调应webservice
             string        s       = wls.HisTransData(sendstr);
             DataSet       dsxml   = new DataSet();
             StringReader  read    = new StringReader(s);
             XmlTextReader readxml = new XmlTextReader(read);
             dsxml.ReadXml(readxml);
             DataTable dt1 = dsxml.Tables[0];
             int       i   = int.Parse(dt1.Rows[0]["RETCODE"].ToString());
             if (i == 1)
             {
                 updateDB(ds);
             }
         }
     }
     catch (Exception ex)
     {
         //暂未处理,输出异常到log
     }
 }
コード例 #2
0
ファイル: sql.cs プロジェクト: ewin66/wholePivas
        /// <summary>
        /// 用日期搜索日志
        /// </summary>
        /// <param name="date1"></param>
        /// <param name="date2"></param>
        /// <returns></returns>
        public DataSet SelectRemarkByDate(string date1, string date2)
        {
            string  sql;
            DataSet ds = null;

            try
            {
                sql = "select * from ItemDamage where ";
                if (date1 == date2)
                {
                    sql += " datediff(DD,date,'" + date1 + "')=0";
                }
                else
                {
                    sql += "date Between '" + date1 + "' and '" + date2 + "'";
                }
                sql += " order by ID ";

                ds = DB.GetPIVAsDB(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ds);
        }
コード例 #3
0
        private void GetCangWeiNum()
        {
            string  sql = "SELECT [IsOpen], [DeskNo],[IsPTY],[IsKSS],[IsHLY],[IsYYY] ,'确认'  as 'a' FROM [IVRecordDeskSet] order by DeskNo";
            DataSet ds  = db.GetPIVAsDB(sql);

            dgv.DataSource = ds.Tables[0];
        }
コード例 #4
0
ファイル: RGDict.cs プロジェクト: ewin66/wholePivas
        private void ShowDict()
        {
            listView1.Items.Clear();
            DataSet ds = new DataSet();

            ds = db.GetPIVAsDB("select * from CPResultRGDict ");
            if (ds == null || ds.Tables[0].Rows.Count <= 0)
            {
                return;
            }
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                ListViewItem lvi = new ListViewItem();

                lvi.Text = ds.Tables[0].Rows[i]["ID"].ToString();
                lvi.SubItems.Add(ds.Tables[0].Rows[i]["Name"].ToString());
                listView1.Items.Add(lvi);
            }
            ImageList image = new ImageList();

            image.ImageSize             = new Size(1, 30);
            listView1.SmallImageList    = image;
            listView1.Items[0].Selected = true;
            CurrentID = listView1.SelectedItems[0].Text.ToString();
            ShowDictDetail(listView1.SelectedItems[0].Text.ToString());
        }
コード例 #5
0
ファイル: MakeYtjXml.cs プロジェクト: ewin66/wholePivas
        /// <summary>
        /// 搜索需要向英特吉发送的瓶签资源
        /// </summary>
        /// <returns></returns>
        private DataSet getResourse()
        {
            string labelSql = "select LabelNo,BatchSavedDT from IVRecord(nolock) iv where IVRecordID in " +
                              //从英特吉返回的药品表,需存在才发送
                              "(select ivd.IVRecordID from IVRecordDetail(nolock) ivd where DrugCode in (select DrugCode from Drug_YTJ)) " +
                              //已进入打印的下个流程的,不再发送给英特吉去打印;and Remark3 >= 10;
                              //BatchSaved标记是否已在界面点击发送(已发送=1,已发送后才能发给英特吉)
                              "and iv.IVStatus <= 5  and iv.BatchSaved = 1 " +
                              //已因各种原因被取消的瓶签,不再发送给英特吉去打印
                              "and iv.LabelOver >= 0 " + "and DATEDIFF(DD, InfusionDT, GETDATE()) < 2 " +
                              //发送成功保存在IVRecordToYTJ中,再次发送时,需不在此表中。例外:批次更新后需重新发送
                              "and not exists (select * from IVRecordToYTJ ivi where ivi.labelno = iv.labelno " +
                              "and ISNULL(ivi.BatchSavedDT,1)=ISNULL(iv.BatchSavedDT,1)) union " +

                              //union 营养药
                              "select LabelNo,BatchSavedDT from IVRecord(nolock) iv " +
                              "inner join Prescription p on iv.GroupNo =p.GroupNo where " +
                              //已进入打印的下个流程的,不再发送给英特吉去打印;and Remark3 >= 10;
                              //BatchSaved标记是否已在界面点击发送(已发送=1,已发送后才能发给英特吉)
                              "iv.IVStatus <= 5  and iv.BatchSaved = 1 " +
                              //已因各种原因被取消的瓶签,不再发送给英特吉去打印
                              "and iv.LabelOver >= 0 " + "and DATEDIFF(DD, InfusionDT, GETDATE()) < 2 " +
                              //发送成功保存在IVRecordToYTJ中,再次发送时,需不在此表中。例外:批次更新后需重新发送
                              "and not exists (select * from IVRecordToYTJ ivi where ivi.labelno = iv.labelno " +
                              "and ISNULL(ivi.BatchSavedDT,1)=ISNULL(iv.BatchSavedDT,1)) " +
                              //判断是TPN用药方式的才能送;根据drugType只能确定药品的类别,但可能营养医嘱里面含有普通药物
                              "and (p.UsageCode = 'TPN' or p.UsageCode = '111' or p.UsageCode = '1' or p.DrugType = 4)";

            DataSet labelDs = DB.GetPIVAsDB(labelSql);

            return(labelDs);
        }
コード例 #6
0
 private void PreInformation_Load(object sender, EventArgs e)
 {
     if (ID != string.Empty)
     {
         if (LNo == string.Empty)
         {
             SetInformation(ID);
             splitContainer1.Panel2.Controls.Clear();
             setResult(ID);
             string    sql = "select distinct labelno from ivrecord where prescriptionid = '" + ID + "'";
             DataTable dt  = DB.GetPIVAsDB(sql).Tables[0];
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 ShowLabelCheck(dt.Rows[i][0].ToString());
             }
         }
         else
         {
             SetInformation(ID);
             setResult(ID);
             splitContainer1.Panel2.Controls.Clear();
             ShowLabelCheck(LNo);
         }
     }
 }
コード例 #7
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     try
     {
         int Schedule;//、= Convert.ToInt32(ds.Tables[0].Rows[0]["Schedule"].ToString().Trim().Equals("") ? "0" : ds.Tables[0].Rows[0]["Schedule"].ToString());
         if (!SynCode.Trim().Equals(""))
         {
             ds      = DB.GetPIVAsDB(getThisSynDate());
             endtime = ds.Tables[0].Rows[0]["EndTime"].ToString();
             if (endtime.Trim().Equals(""))
             {
                 run(Schedule);
                 label1.Text = ds.Tables[0].Rows[0]["SYnName"].ToString() + " (正在同步)";
                 label2.Text = label1.Text;
                 panel2.Size = new Size(panel1.Size.Width * Schedule / 500, panel1.Size.Height);
             }
             else
             {
                 label1.Text = ds.Tables[0].Rows[0]["SYnName"].ToString() + "(" + ds.Tables[0].Rows[0]["EndTime"].ToString() + ")";
                 label2.Text = label1.Text;
                 panel2.Size = new Size(0, 0);
             }
         }
     }
     catch (Exception EX)
     {
         MessageBox.Show(EX.Message);
     }
 }
コード例 #8
0
ファイル: Confirm.cs プロジェクト: ewin66/wholePivas
        private void btnOK_Click(object sender, EventArgs e)
        {
            ecode = txtCode.Text;
            epass = txtPass.Text;
            if (txtCode.Text.Trim() == "")
            {
                MessageBox.Show("帐号不可为空");
                return;
            }
            string  str = "select * from DEmployee where AccountID = '" + ecode + "' and Pas = '******'";
            DataSet ds  = DB.GetPIVAsDB(str);

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                ecode         = ds.Tables[0].Rows[0]["DEmployeeID"].ToString();
                DoctorExplain = richTextBox1.Text.Replace("'", "");
                //this.DialogResult = DialogResult.OK;
                check(ecode, DoctorExplain, rmk);
                this.Dispose();
            }
            else
            {
                MessageBox.Show("用户不存在或密码错误");
                return;
            }
        }
コード例 #9
0
ファイル: SyncWork.cs プロジェクト: ewin66/wholePivas
 /// <summary>
 /// 根据配置的同步周期,插入到日志表
 /// 原来是30秒
 /// </summary>
 void InsertSynLogByTimeCode()
 {
     while (true)
     {
         try
         {
             if (bDBConnectStatus && bCanRun)//数据库连接成功状态且同步程序是唯一的
             {
                 //where (DATEDIFF(MI,EndTime,GETDATE())>=SyncSpaceTime or StartTime is null
                 string sql = "SELECT [SynTimeCode],[SynStarTime],[SynEndTime],[SyncSpaceTime],[SynID]," +
                              "[SynCode],[StartTime],[StartUPTime],[EndUPTime],[EndTime],[Success],[Schedule]," +
                              "GETDATE() dat FROM [dbo].[V_Sync]";
                 using (DataSet ds = dbHelp.GetPIVAsDB(sql))
                 {
                     if (ds != null && ds.Tables.Count > 0)
                     {
                         InsertSynLog(ds);
                     }
                     ListBoxMsgAddItem("检测自动同步   " + DateTime.Now.ToString("HH:mm:ss"));
                 }
             }
         }
         catch (Exception ex)
         {
             InternalLogger.Log.Error("插入到日志表SynLog时出错" + ex.Message);
         }
         Thread.Sleep(INSERTLOGBYTIME_INTERNAL);
     }
 }
コード例 #10
0
ファイル: PivasFreqRule.cs プロジェクト: ewin66/wholePivas
        private void PivasFreqRule_Load(object sender, EventArgs e)
        {
            label1.Parent      = this.pictureBox1;
            label9.Parent      = this.pictureBox1;
            Pic_Min.Parent     = this.pictureBox1;
            Panel_Close.Parent = this.pictureBox1;

            label3.Parent = this.pictureBox2;

            if (GetPivasLimit.Instance.Limit(UserID, "PivasFreqRule"))
            {
                DataSet nm = new DataSet();
                label9.Text = "";
                string str1 = "select DEmployeeName from DEmployee where DEMployeeID = " + UserID + "";
                nm = db.GetPIVAsDB(str1);
                if (nm != null && nm.Tables[0].Rows.Count > 0)
                {
                    label9.Text = nm.Tables[0].Rows[0][0].ToString();
                }
                Label_freg_Click(null, null);
            }
            else
            {
                MessageBox.Show("您没有操作权限,请与管理员联系!");
                this.Dispose();
            }
        }
コード例 #11
0
ファイル: BQlabelShow.cs プロジェクト: ewin66/wholePivas
 private void Tmrun()
 {
     try
     {
         locked = true;
         if (!string.IsNullOrEmpty(labelNo))
         {
             using (DataSet ds = DB.GetPIVAsDB(string.Format("SELECT * FROM ({0} where LabelNo = '{1}')V order by NoName,DosageUnit,Dosage", piv.GetLabelNoSql, labelNo)))
             {
                 if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                 {
                     using (DataTable dt = ds.Tables[0].Copy())
                     {
                         string xml = string.Empty;
                         using (DataTable ivd = dtMed.Clone())
                         {
                             foreach (DataRow dr in dt.Rows)
                             {
                                 ivd.Rows.Add(dr["drugname"].ToString().Replace('[', '(').Replace(']', ')'), dr["spec"].ToString().Replace('[', '(').Replace(']', ')').Trim(), (dr["Dosage"].ToString().Contains(".") ? dr["Dosage"].ToString().TrimEnd('0').TrimEnd('.') : dr["Dosage"].ToString().Trim()) + dr["DosageUnit"].ToString().Trim(), Math.Round(double.Parse(dr["DosageSums"].ToString()), 3).ToString(), dr["FormUnit"].ToString(), dr["Remark7"].ToString().Trim(), dr["Remark8"].ToString(), dr["Remark9"].ToString(), dr["Remark10"].ToString(), Equals(dr["PiShi"], true) ? "要皮试" : string.Empty);
                             }
                             using (System.IO.StringWriter sw = new System.IO.StringWriter())
                             {
                                 ivd.WriteXml(sw, XmlWriteMode.WriteSchema, false);
                                 xml = sw.ToString();
                             }
                         }
                         using (DataTable dts = DB.GetPIVAsDB(string.Format("SELECT [DrugPlusConditionName],[LabelNo] FROM [dbo].[V_DrugAC] where DATEDIFF(DAY,'{0}',InfusionDT)=0 and LabelNo='{1}'", piv.dateTimePicker1.Value.ToString("yyyy-MM-dd"), dt.Rows[0]["LabelNo"].ToString())).Tables[0])
                         {
                             DataRow dr = dt.Rows[0];
                             string  DrugPlusConditionName = string.Empty;
                             foreach (DataRow drs in dts.Rows)
                             {
                                 DrugPlusConditionName = DrugPlusConditionName + drs[0].ToString().Trim() + ",";
                             }
                             dtOuvia.Rows.Clear();
                             dtOuvia.Rows.Add(dr["PatientCode"].ToString().Trim(), dr["PatName"].ToString().Trim(), dr["BedNo"].ToString().Trim(), dr["LabelNo"].ToString().Trim(), "1", string.Empty, dr["WardName"].ToString().Trim(), dr["WardSimName"].ToString().Trim(), dr["Batch"].ToString().Trim(), dr["Age"].ToString().Trim(), dr["AgeSTR"].ToString().Trim(), dr["CaseID"].ToString().Trim(), dr["FreqCode"].ToString().Trim(), dr["UsageCode"].ToString().Trim(), piv.ArrDrugUserCode, piv.PZDrugUserCode, piv.PackDrugUserCode, DrugPlusConditionName.TrimEnd(','), dr["tod"].ToString(), dr["FreqNum"].ToString(), DateTime.Now.Ticks.ToString().Substring(3, 10), (dr["sex"].ToString().Trim() == "1" ? "男" : "女"), dr["CpUser"].ToString(), dr["Remark1"].ToString(), dr["Remark2"].ToString(), dr["Remark3"].ToString(), dr["Remark4"].ToString(), dr["Remark5"].ToString(), dr["Remark6"].ToString(), dr["DeskNo"].ToString(), xml);
                         }
                         report.GetParameter("total").Value = dt.Rows.Count;
                         report.RegisterData(dtOuvia, "ouvia");
                         (report.FindObject("Data1") as FastReport.DataBand).DataSource = report.GetDataSource("ouvia");
                         report.UseFileCache = true;
                         report.DoublePass   = false;
                         report.Show();
                     }
                 }
             }
         }
     }
     catch (KeyNotFoundException)
     {
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         timer1.Start();
     }
 }
コード例 #12
0
        private void UpdateTY()
        {
            string[] labels = labelNos.Split(',');

            for (int i = 0; i < labels.Length; i++)
            {
                //MessageBox.Show(labels[i].ToString());
                using (DataSet dsPCode = db.GetPIVAsDB("select PrinterID from IVRecord where LabelNo='" + labels[i] + "'"))
                {
                    using (DataSet dsDBCode = db.GetPIVAsDB("select DBCode from IVRecord_TY where IVRecordID='" + labels[i] + "'"))
                    {
                        //在插入表时候先进行查询,如果表中有值就更新,否则就插入
                        if (dsDBCode.Tables[0].Rows.Count == 0)
                        {
                            string sqlInsert = "insert into IVRecord_TY (IVRecordID,TYDT,PCode,DBCode) values('{0}','{1}','{2}','{3}')";
                            sqlInsert = string.Format(sqlInsert, labels[i], DateTime.Now.ToString(), dsPCode.Tables[0].Rows[0]["PrinterID"].ToString(), DBCode);
                            db.GetPIVAsDB(sqlInsert);
                        }
                        else
                        {
                            string sqlUpdate = "update IVRecord_TY set DBCode='{0}' where  IVRecordID='{1}'";
                            sqlUpdate = string.Format(sqlUpdate, DBCode, labels[i]);
                            db.GetPIVAsDB(sqlUpdate);
                        }
                    }
                }
            }
        }
コード例 #13
0
ファイル: ChangeDate.cs プロジェクト: ewin66/wholePivas
        private void ShowDrugList(string patientCode)
        {
            DataSet ds = db.GetPIVAsDB(Mysql.GetDrugList(patientCode));

            if (ds.Tables != null && ds.Tables.Count > 0)
            {
                dgvDruglist.Rows.Clear();

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    dgvDruglist.Rows.Add(1);
                    dgvDruglist.Rows[i].Cells["GroupNo"].Value  = ds.Tables[0].Rows[i]["GroupNo"].ToString();
                    dgvDruglist.Rows[i].Cells["RecipeID"].Value = ds.Tables[0].Rows[i]["RecipeID"].ToString();
                    dgvDruglist.Rows[i].Cells["FregCode"].Value = ds.Tables[0].Rows[i]["FregCode"].ToString();
                    dgvDruglist.Rows[i].Cells["DrugCode"].Value = ds.Tables[0].Rows[i]["DrugCode"].ToString();
                    dgvDruglist.Rows[i].Cells["DrugName"].Value = ds.Tables[0].Rows[i]["DrugName"].ToString();
                    dgvDruglist.Rows[i].Cells["StartDt"].Value  = ds.Tables[0].Rows[i]["begindt"].ToString();
                    dgvDruglist.Rows[i].Cells["occdt"].Value    = ds.Tables[0].Rows[i]["OccDT"].ToString();
                    dgvDruglist.Rows[i].Cells["Spec"].Value     = ds.Tables[0].Rows[i]["Spec"].ToString();
                    dgvDruglist.Rows[i].Cells["EndDt"].Value    = ds.Tables[0].Rows[i]["enddt"].ToString();

                    DateTime dt1 = Convert.ToDateTime(ds.Tables[0].Rows[i]["occdt"].ToString());
                    DateTime dt2 = Convert.ToDateTime(ds.Tables[0].Rows[i]["enddt"].ToString());
                    DateTime dt3 = Convert.ToDateTime(ds.Tables[0].Rows[i]["begindt"].ToString());
                    if (dt1.ToString("yyyy-MM-dd") == dt3.ToString("yyyy-MM-dd") || dt1 < DateTime.Now)
                    {
                        dgvDruglist.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;
                    }
                }
            }
        }
コード例 #14
0
        /// <summary>
        /// 获得群聊天记录
        /// </summary>
        private void Talk1(int type)
        {
            flp.Controls.Clear();
            DataSet ds = new DataSet();

            if (type == 1)
            {
                ds = db.GetPIVAsDB(sql.GetWardTalk(WardCode, "0", true, dateTimePicker1.Value, dateTimePicker2.Value));
            }
            else
            {
                //配置中心
                if (login == "PivasMate")
                {
                    ds = db.GetPIVAsDB(sql.GetWardTalk(TalkName, "1", true, dateTimePicker1.Value, dateTimePicker2.Value));
                }
                //护士工作站内
                else if (login == "PivasNurse" && TalkName == WardCode)
                {
                    ds = db.GetPIVAsDB(sql.GetWardTalk(TalkName, "2", true, dateTimePicker1.Value, dateTimePicker2.Value));
                }
                else if (login == "PivasNurse" && TalkName == "PivasMate")
                {
                    ds = db.GetPIVAsDB(sql.GetWardTalk(WardCode, "1", true, dateTimePicker1.Value, dateTimePicker2.Value));
                }
            }
            ShowTalkLog(ds);
        }
コード例 #15
0
ファイル: DrugChange.cs プロジェクト: ewin66/wholePivas
 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) { }
 }
コード例 #16
0
        public void setLabelNo()
        {
            StringBuilder str = new StringBuilder();

            str.Append("  SELECT distinct [Batch] as '批次' ,[FreqName] as '频次' ,InfusionDT as '用药时间',");
            str.Append(" [PrintDT] as '打印时间',[PrinterName] as '打印人' ,[PatCode] as '病人编号' ,[PatName] as '姓名'  ");
            str.Append(",[BedNo]as '床号',iv.WardName as '病区' ,a.DrugName as '主药' ,b.DrugName as '溶媒' ");
            str.Append("  ,case iv.IVStatus when 0 then '瓶签产生' when 1 then '批次产生' when 3 then '打印' when 5 then '排药核对' ");
            str.Append(" when 7 then '进仓核对' when 9 then '配置核对' when 11 then '出仓核对' when 13 then '打包核对' when 15 then '病区签收' end as '状态'");
            str.Append("  FROM [IVRecord] iv  left join  DDrug a on iv.MarjorDrug=a.DrugCode  ");
            str.Append("left join  DDrug b  on iv.Menstruum=b.DrugCode  ");
            str.Append(" left join DWard on iv.WardCode=DWard.WardCode   ");
            str.Append(" left join IVRecordDetail ivd on ivd.IVRecordID=iv.IVRecordID ");
            str.Append(" where iv.LabelNo= '");
            str.Append(dgv1.CurrentRow.Cells[0].Value.ToString());
            str.Append("' ");
            DataTable dt = DB.GetPIVAsDB(str.ToString()).Tables[0];

            tbName.Text    = dt.Rows[0][6].ToString();
            textBox1.Text  = dt.Rows[0][4].ToString();
            textBox2.Text  = dt.Rows[0][7].ToString();
            textBox3.Text  = dt.Rows[0][8].ToString();
            textBox4.Text  = dt.Rows[0][0].ToString();
            textBox5.Text  = dt.Rows[0][1].ToString();
            textBox6.Text  = dt.Rows[0][9].ToString();
            textBox7.Text  = dt.Rows[0][10].ToString();
            textBox8.Text  = dt.Rows[0][2].ToString();
            textBox9.Text  = dt.Rows[0][3].ToString();
            textBox10.Text = dt.Rows[0][11].ToString();
        }
コード例 #17
0
        private void AddDrugK_Load(object sender, EventArgs e)
        {
            string  sql = "select DrugCode,DrugName,Spec from DDrug where DrugCode not in(select DrugCode from OrderWcodeDrugK where WardCode='" + wardCode + "')";
            DataSet ds  = DB.GetPIVAsDB(sql);

            dgv.DataSource = ds.Tables[0];
        }
コード例 #18
0
ファイル: MedcineRule.cs プロジェクト: ewin66/wholePivas
        /// <summary>
        /// 病区加载
        /// </summary>
        private void ShowWard()
        {
            string str = "select WardCode, WardName From DWard where IsOpen = 1";

            try
            {
                DS = DB.GetPIVAsDB(str);
                DT = DS.Tables[0];
                pnlWard.Controls.Clear();
                for (int i = 0; i < DT.Rows.Count; i++)
                {
                    DWard Ward = new DWard(DT.Rows[i]["WardCode"].ToString(), pnlWard);
                    Ward.Show(DT.Rows[i]);
                    Ward.Top = i * 30;
                    //默认选中第一行数据
                    if (i == 0)
                    {
                        Ward.BackColor = Color.FromArgb(140, 140, 255);
                    }
                    pnlWard.Controls.Add(Ward);
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #19
0
ファイル: PIVASMate.cs プロジェクト: ewin66/wholePivas
        /// <summary>
        /// 二次登陆系统判断上一次停留程序路径
        /// </summary>
        /// <param name="DEmpID">登陆账号ID</param>
        protected void FormPath(string DEmpID)
        {
            try
            {
                Control_welcome we = new Control_welcome();
                Control_welcome.DEmployeeID = Convert.ToInt32(DEmployeeID);
                Control_welcome.Logname     = EmpName;

                DataSet  ds            = dbHelp.GetPIVAsDB("select * from PivasMateFormSet where DEmployeeID='" + DEmpID + "'");
                bool     noShowWelcome = true;           //默认显示
                PageType pageNo        = PageType.Check; //默认是页面
                if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    noShowWelcome = bool.Parse(ds.Tables[0].Rows[0]["Welcome"].ToString());
                    int iStartForm = Convert.ToInt32(ds.Tables[0].Rows[0]["StartForm"].ToString().Trim());
                    if (iStartForm > 0 && iStartForm < 8)//在PageType枚举范围内
                    {
                        pageNo = (PageType)iStartForm;
                    }
                }

                if (!noShowWelcome)//若显示,则添加
                {
                    panelContent.Controls.Add(we);
                    we.Size = panelContent.Size;
                }
                switchPage(pageNo);
            }
            catch (Exception ex)
            {
                ShowMsgHelper.ShowError("登录后设置欢迎页面和上次页面出错:" + ex.Message);
            }
        }
コード例 #20
0
ファイル: Sync.cs プロジェクト: ewin66/wholePivas
 private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     if (!locked)
     {
         locked = true;
         bool HasSyn = false;
         try
         {
             using (DataSet ds = db.GetPIVAsDB(getSynSetDate()))
             {
                 if (ds != null && ds.Tables.Count > 0)
                 {
                     foreach (SyncMin sm in flowLayoutPanel1.Controls)
                     {
                         DataRow[] drs = ds.Tables[0].Select(string.Format("SynCode='{0}'", sm.getcode()));
                         if (drs.Length > 0)
                         {
                             DataRow dr = drs[0];
                             if (string.IsNullOrEmpty(dr["EndTime"].ToString()) && !string.IsNullOrEmpty(dr["SynID"].ToString()))
                             {
                                 sm.elementHost1.Visible = true;
                                 int Schedule = 0;
                                 //Schedule进度0~500若处方与药单则0~400数据插入;存储过程执行400~500
                                 int.TryParse(dr["Schedule"].ToString().Trim(), out Schedule);
                                 sm.syn_ProgressBar1.progressbar.Value = Schedule;
                                 //1:等待同步 2:同步开始 3:数据插入 4:拆分处方(审方)5拆分药单 6:同步完成
                                 sm.label2.Text = dr["ScheduleTxt"].ToString() + " , 总进度已完成:" + (Schedule > 499 ? 100 : Convert.ToInt32(Schedule / 5)) + "%    操作员工:" + dr["DEmployeeName"].ToString();
                             }
                             else
                             {
                                 if (sm.elementHost1.Visible)
                                 {
                                     sm.syn_ProgressBar1.progressbar.Value = 500;
                                     sm.elementHost1.Visible = false;
                                     sm.syn_ProgressBar1.progressbar.Value = 0;
                                 }
                                 sm.label2.Text = "上次同步时间:" + dr["EndTime"].ToString() + "    同步结果:" + dr["ScheduleTxt"].ToString() + "    操作员工:" + dr["DEmployeeName"].ToString();
                             }
                         }
                         if (sm.elementHost1.Visible)
                         {
                             HasSyn = true;
                         }
                         timer.Interval = HasSyn ? 500 : 1000;
                     }
                 }
             }
         }
         catch (Exception EX)
         {
             MessageBox.Show(EX.Message);
         }
         finally
         {
             locked = false;
         }
     }
 }
コード例 #21
0
        private void Dgv1_Lord()
        {
            string    str = "select distinct StatusCode '节点编号',StatusName '节点' from ErrorRule";
            DataTable dt  = DB.GetPIVAsDB(str).Tables[0];

            dataGridView1.Columns.Clear();
            dataGridView1.DataSource          = dt;
            dataGridView1.Columns["节点"].Width = 230;
        }
コード例 #22
0
ファイル: MainError.cs プロジェクト: ewin66/wholePivas
        public MainError(string ID)
        {
            InitializeComponent();
            this.UserID = ID;
            string  str = "select DEmployeeName from DEmployee where DEmployeeID= '" + UserID + "'";
            DataSet ds  = DB.GetPIVAsDB(str);

            labelUser.Text = ds.Tables[0].Rows[0][0].ToString();
        }
コード例 #23
0
ファイル: DosageDiffer.cs プロジェクト: ewin66/wholePivas
        private void getDrugList()
        {
            StringBuilder str = new StringBuilder();

            str.Append("select distinct udc.[DrugName],udc.DrugCode, pd.Spec,pd.Dosage,pd.DosageUnit,udc.[Quantity],udc.QuantityUnit ");
            str.Append("from UseDrugListCheck udc   ");
            str.Append("left join PrescriptionDetail pd on pd.GroupNo= udc.GroupNo and pd.DrugCode=udc.DrugCode ");
            str.Append("where udc.CheckResult=0 and ");
            str.Append("udc.DrugCode not in(select DrugCode from DrugModel dm ");
            str.Append("where dm.DrugCode=udc.DrugCode and dm.Spec=udc.Spec and dm.Dosage=pd.Dosage)  ");

            str.Append(" update UseDrugListCheck  set Quantity=dm.DrugCount ,QuantityUnit=dm.DrugCountUnit,QuantityCheck=1 ");
            str.Append("from DrugModel dm where dm.DrugCode= UseDrugListCheck.DrugCode and QuantityCheck=0 ");
            str.Append("and dm.Spec= UseDrugListCheck.Spec and dm.Dosage= UseDrugListCheck.Dosage ");

            DataSet ds = db.GetPIVAsDB(str.ToString());

            if (ds.Tables != null && ds.Tables.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    if (ds.Tables[0].Rows[i]["Quantity"].ToString() == null || ds.Tables[0].Rows[i]["Quantity"].ToString() == "0" || ds.Tables[0].Rows[i]["Quantity"].ToString().IndexOf('.') != -1 || int.Parse(ds.Tables[0].Rows[i]["Quantity"].ToString()) >= 20)
                    {
                        dgv.Rows.Add(1);
                        dgv.Rows[dgv.Rows.Count - 1].Cells["QueRen"].Value       = true;
                        dgv.Rows[dgv.Rows.Count - 1].Cells["DrugName"].Value     = ds.Tables[0].Rows[i]["DrugName"].ToString();
                        dgv.Rows[dgv.Rows.Count - 1].Cells["Spec"].Value         = ds.Tables[0].Rows[i]["Spec"].ToString();
                        dgv.Rows[dgv.Rows.Count - 1].Cells["Dosage"].Value       = float.Parse(ds.Tables[0].Rows[i]["Dosage"].ToString()) + ds.Tables[0].Rows[i]["DosageUnit"].ToString();
                        dgv.Rows[dgv.Rows.Count - 1].Cells["DosageUnit"].Value   = ds.Tables[0].Rows[i]["DosageUnit"].ToString();
                        dgv.Rows[dgv.Rows.Count - 1].Cells["Quantity"].Value     = ds.Tables[0].Rows[i]["Quantity"].ToString();
                        dgv.Rows[dgv.Rows.Count - 1].Cells["QuantityUnit"].Value = ds.Tables[0].Rows[i]["QuantityUnit"].ToString();
                    }
                    else
                    {
                        StringBuilder str1 = new StringBuilder();
                        str1.Append("insert into DrugModel([DrugName],[DrugCode],[Spec],[Dosage],[DosageUnit],[DrugCount],[DrugCountUnit]) ");
                        str1.Append("values('");
                        str1.Append(ds.Tables[0].Rows[i]["DrugName"].ToString());
                        str1.Append("','" + ds.Tables[0].Rows[i]["DrugCode"].ToString());
                        str1.Append("','" + ds.Tables[0].Rows[i]["Spec"].ToString());
                        str1.Append("','" + ds.Tables[0].Rows[i]["Dosage"].ToString());
                        str1.Append("','" + ds.Tables[0].Rows[i]["DosageUnit"].ToString());
                        str1.Append("','" + ds.Tables[0].Rows[i]["Quantity"].ToString());
                        str1.Append("','" + ds.Tables[0].Rows[i]["QuantityUnit"].ToString());
                        str1.Append("')  ");
                        str1.Append("update UseDrugListCheck  set QuantityCheck=1 where DrugCode='");
                        str1.Append(ds.Tables[0].Rows[i]["DrugCode"].ToString());
                        str1.Append("' and Dosage='");
                        str1.Append(ds.Tables[0].Rows[i]["Dosage"].ToString());
                        str1.Append("' and DosageUnit='");
                        str1.Append(ds.Tables[0].Rows[i]["QuantityUnit"].ToString());
                        str1.Append("'");
                        db.SetPIVAsDB(str1.ToString());
                    }
                }
            }
        }
コード例 #24
0
ファイル: frmScanPre.cs プロジェクト: ewin66/wholePivas
        /// <summary>
        /// 取颜色
        /// </summary>
        private void changeColor()
        {
            string    sql = "  select top 1[Level3Color],[Level5Color],[RightColor],[SelectedColor] from RevPreFormSet order by DEmployeeID ";
            DataTable dt  = DB.GetPIVAsDB(sql).Tables[0];

            string[] numbers  = dt.Rows[0][2].ToString().Trim().Split(',');
            string[] numbers1 = dt.Rows[0][0].ToString().Trim().Split(',');
            string[] numbers2 = dt.Rows[0][1].ToString().Trim().Split(',');
            string[] numbers3 = dt.Rows[0][3].ToString().Trim().Split(',');
            if (dt.Rows.Count == 0)
            {
                for (int i = 0; i < dgvPre.Rows.Count; i++)
                {
                    switch (dgvPre.Rows[i].Cells["Level"].Value.ToString().Trim())
                    {
                    case "0":
                        dgvPre.Rows[i].DefaultCellStyle.BackColor          = Color.FromArgb(157, 245, 159);
                        dgvPre.Rows[i].DefaultCellStyle.SelectionBackColor = Color.FromArgb(205, 250, 205);
                        break;

                    case "3":
                        dgvPre.Rows[i].DefaultCellStyle.BackColor          = Color.FromArgb(249, 253, 156);
                        dgvPre.Rows[i].DefaultCellStyle.SelectionBackColor = Color.FromArgb(252, 254, 182);
                        break;

                    case "5":
                        dgvPre.Rows[i].DefaultCellStyle.BackColor          = Color.FromArgb(253, 212, 218);
                        dgvPre.Rows[i].DefaultCellStyle.SelectionBackColor = Color.FromArgb(254, 231, 235);
                        break;
                    }
                }
            }
            else
            {
                for (int i = 0; i < dgvPre.Rows.Count; i++)
                {
                    switch (dgvPre.Rows[i].Cells["Level"].Value.ToString().Trim())
                    {
                    case "0":
                        dgvPre.Rows[i].DefaultCellStyle.BackColor          = Color.FromArgb(Convert.ToInt32(numbers[0]), Convert.ToInt32(numbers[1]), Convert.ToInt32(numbers[2]));
                        dgvPre.Rows[i].DefaultCellStyle.SelectionBackColor = Color.FromArgb(Convert.ToInt32(numbers3[0]), Convert.ToInt32(numbers3[1]), Convert.ToInt32(numbers3[2]));
                        break;

                    case "3":
                        dgvPre.Rows[i].DefaultCellStyle.BackColor          = Color.FromArgb(Convert.ToInt32(numbers1[0]), Convert.ToInt32(numbers1[1]), Convert.ToInt32(numbers1[2]));
                        dgvPre.Rows[i].DefaultCellStyle.SelectionBackColor = Color.FromArgb(Convert.ToInt32(numbers3[0]), Convert.ToInt32(numbers3[1]), Convert.ToInt32(numbers3[2]));
                        break;

                    case "5":
                        dgvPre.Rows[i].DefaultCellStyle.BackColor          = Color.FromArgb(Convert.ToInt32(numbers2[0]), Convert.ToInt32(numbers2[1]), Convert.ToInt32(numbers2[2]));
                        dgvPre.Rows[i].DefaultCellStyle.SelectionBackColor = Color.FromArgb(Convert.ToInt32(numbers3[0]), Convert.ToInt32(numbers3[1]), Convert.ToInt32(numbers3[2]));
                        break;
                    }
                }
            }
        }
コード例 #25
0
        /// <summary>
        /// 取得当天的所有瓶签
        /// </summary>
        private void TotalLabel()
        {
            string sql = string.Format("select *from V_IVRecordPrintPreview where DATEDIFF(DD,InfusionDT,'{0}')=0", this.date);

            LabelTol = db.GetPIVAsDB(sql).Tables[0];

            string sql1 = string.Format(" select *from V_PlusCondition where DATEDIFF(dd, InfusionDT,'{0}')=0 ", this.date);

            DrugPlusCondition = db.GetPIVAsDB(sql1).Tables[0];
        }
コード例 #26
0
        private void Select(string Code)
        {
            DataRow dr = db.GetPIVAsDB(select.Get_SynSet(Code)).Tables[0].Rows[0];

            Label_TypeText.Text     = string.IsNullOrEmpty(dr["SynMode"].ToString()) ? "SQLSERVER" : dr["SynMode"].ToString();
            Txt_DataSource.Text     = string.IsNullOrEmpty(dr["DataSource"].ToString()) ? "数据库地址" : db.Decrypt(dr["DataSource"].ToString());
            Txt_InitialCatalog.Text = string.IsNullOrEmpty(dr["InitialCatalog"].ToString()) ? "数据库名" : db.Decrypt(dr["InitialCatalog"].ToString());
            Txt_UserID.Text         = string.IsNullOrEmpty(dr["UserID"].ToString()) ? "用户名" : db.Decrypt(dr["UserID"].ToString());
            Txt_Password.Text       = string.IsNullOrEmpty(dr["Password"].ToString()) ? "密码" : db.Decrypt(dr["Password"].ToString());
            textBox1.Text           = dr["Sql"].ToString().Trim();
        }
コード例 #27
0
        private void CheckPreID(string PreID)
        {
            StringBuilder str = new StringBuilder();

            str.Append(" select PrescriptionID  from Prescription where PrescriptionID= '" + PreID + "' ");
            str.Append(" select PrescriptionID from IVRecord where LabelNo='" + PreID + "'");
            DataTable dt  = DB.GetPIVAsDB(str.ToString()).Tables[0];
            DataTable dt1 = DB.GetPIVAsDB(str.ToString()).Tables[1];

            if (dt.Rows.Count == 0 || dt == null)
            {
                if (dt1.Rows.Count == 0 || dt1 == null)
                {
                    MessageBox.Show("不存在此瓶签号/医嘱号");
                    textBox1.Controls.Clear();
                    clean();
                }
                else
                {
                    dataGridView1.DataSource = null;
                    //dataGridView1.Rows.Clear();
                    dataGridView1.Columns.Clear();
                    addcol();
                    dataGridView1.Rows.Add(textBox1.Text);
                    dataGridView1.Visible = true;
                    panel1.Controls.Clear();
                    rc          = 0;
                    b           = 0;
                    c           = 0;
                    label4.Text = dt1.Rows[0][0].ToString();
                    ShowLabelCheck(dt1.Rows[0][0].ToString(), PreID);
                    label5.Visible = true;
                    panel1.Visible = true;
                }
            }
            else
            {
                this.panel1.Controls.Clear();
                rc = 0;
                b  = 0;
                c  = 0;
                dataGridView1.Controls.Clear();
                dataGridView1.Columns.Clear();
                addcol();
                string    str1 = "select distinct labelno from ivrecord where prescriptionid = '" + PreID + "'";
                DataTable dt2  = DB.GetPIVAsDB(str1).Tables[0];
                dataGridView1.DataSource = dt2;
                dataGridView1.Visible    = true;
                label4.Text = PreID;
                ShowLabelCheck(PreID, dt2.Rows[0][0].ToString());
                label5.Visible = true;
                panel1.Visible = true;
            }
        }
コード例 #28
0
ファイル: DataBase.cs プロジェクト: ewin66/wholePivas
        public DataSet getWard()
        {
            DataSet ds = null;

            try
            {
                ds = db.GetPIVAsDB("SELECT * FROM DWard WHERE IsOpen = 1");
            }
            catch (Exception e) { }
            return(ds);
        }
コード例 #29
0
ファイル: Form1.cs プロジェクト: ewin66/wholePivas
        private void Form1_Load(object sender, EventArgs e)
        {
            comboBox1.SelectedIndex = 0;
            dateTimePicker1.Enabled = false;
            dateTimePicker2.Enabled = false;
            //label1.Visible = false;
            DataSet ds = db.GetPIVAsDB("select DEmployeeName from DEmployee where DEmployeeID='" + this.DemployId + "'");

            if (ds != null && 0 < ds.Tables.Count && ds.Tables[0].Rows.Count > 0)
            {
                this.demployname = ds.Tables[0].Rows[0][0].ToString();
            }
        }
コード例 #30
0
ファイル: sqldb.cs プロジェクト: ewin66/wholePivas
        /// <summary>
        /// 药品统计
        /// </summary>
        /// <param name="date1">日期1</param>
        /// <param name="date2">日期2</param>
        /// <param name="ivstatus1">状态1</param>
        /// <param name="ivstatus2">状态2</param>
        /// <param name="labelover">配置取消</param>
        /// <returns></returns>
        public DataSet DrugSelect(string date1, string date2, string ivstatus1, string ivstatus2, bool labelover, bool K)
        {
            ds = new DataSet();
            StringBuilder str = new StringBuilder();
            StringBuilder con = new StringBuilder();

            try
            {
                if (ivstatus1 == ivstatus2)
                {
                    con.Append("   IVStatus = " + ivstatus1 + "");
                }
                else
                {
                    con.Append("   IVStatus between " + ivstatus1 + " and " + ivstatus2 + "");
                }

                if (!labelover)
                {
                    con.Append("   and LabelOver >=0 ");
                }

                if (!K)
                {
                    con.Append("    and batch not like '%K%'");
                }
                if (date1 == date2)
                {
                    con.Append("   and  datediff(DD, InfusionDT,'" + date1 + "')=0 ");
                }
                else
                {
                    con.Append("   and  InfusionDT  between '" + date1 + "' and '" + date2 + "'");
                }

                str.Append("   select distinct d.PortNo,D.DrugName,D.DrugNameJC,D.Spec,SUM(DgNo) num  ");
                str.Append("   FROM IVRecord iv inner join IVRecordDetail ivd on iv.IVRecordID=ivd.IVRecordID");
                str.Append("  inner join DDrug d on ivd.DrugCode=d.DrugCode ");
                str.Append("   where " + con.ToString() + " ");
                str.Append(" GROUP BY D.DrugCode,D.DrugName,D.DrugNameJC,D.Spec,PortNo,d.FormUnit ");
                str.Append("   order by PortNo ");

                ds = DB.GetPIVAsDB(str.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("方法DrugSelect:", ex);
            }

            return(ds);
        }