Exemplo n.º 1
0
        public void updateProflg(string sql)
        {
            /*
             * 出现预处理时,重新给procflg赋值为0
             */

            MySQLPool       pool = MySQLPool.getInstance();
            MySqlConnection conn = null;

            try
            {
                conn = pool.getConnection();

                MySqlCommand cmd = new MySqlCommand(sql, conn);
                cmd.ExecuteNonQuery();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("updateProflg执行失败");
            }
            finally
            {
                pool.releaseConnection(conn);
            }
        }
Exemplo n.º 2
0
        private void ReadOrderInfo()
        {
            while (listView1.Items.Count > 0)
            {
                listView1.Items.Clear();
            }
            try
            {
                MySQLPool       pool = MySQLPool.getInstance();
                MySqlConnection conn = null;
                try
                {
                    conn = pool.getConnection();
                    string          procInfo = "";
                    string          sql      = "select PatientID,PatientName,PrescriptionNo,PrescriptionDate,FetchWindow,ProcFlg,ProcDate,ProcCode from prescriptionlist where ProcFlg<4 order by PatientID,PrescriptionDate";
                    MySqlCommand    cmd      = new MySqlCommand(sql, conn);
                    MySqlDataReader dr       = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        switch (dr.GetInt32(5))
                        {
                        case 0:
                            procInfo = "队列等待中"; break;

                        case 1:
                            procInfo = "预处理完毕";
                            break;

                        case 2:
                            procInfo = "发药等待中"; break;

                        case 3:
                            procInfo = "正在发药"; break;

                        case 4:
                            procInfo = "发药完毕"; break;
                        }
                        ListViewItem[] p = new ListViewItem[1];
                        p[0] = new ListViewItem(new string[] { "", dr.GetString(0), dr.GetString(1), dr.GetString(2), dr.GetString(3), dr.GetString(4), procInfo, dr.IsDBNull(7) ? "" : dr.GetString(7) });
                        this.listView1.Items.AddRange(p);
                    }
                    dr.Close();
                }
                catch (System.Exception ex)
                {
                    //
                }
                finally
                {
                    pool.releaseConnection(conn);
                }
            }
            catch (System.Exception ex)
            {
                //MessageBox.Show(ex.Message.ToString());
            }
        }
Exemplo n.º 3
0
        private void PrintOrder(string procCode, string hzbh, string cfxh)
        {
            lock (syncRoot)
            {
                string sql = "";
                if ("".Equals(procCode))
                {
                    procCode = DateTime.Now.ToString("yyMMddHHmmss");
                    sql      = "update prescriptionlist set ProcFlg=4,ProcDate=now(),ProcCode='" + procCode + "' where (ProcFlg=0 or ProcFlg=4) and PatientID='" + hzbh + "' and PrescriptionNo='" + cfxh + "'";
                }
                else
                {
                    sql = "update prescriptionlist set ProcFlg=4,ProcDate=now() where (ProcFlg=0 or ProcFlg=4) and procCode='" + procCode + "'";
                }

                MySQLPool       pool = MySQLPool.getInstance();
                MySqlConnection conn = null;
                try
                {
                    conn = pool.getConnection();

                    MySqlCommand cmd = new MySqlCommand(sql, conn);
                    cmd.ExecuteNonQuery();

                    // 查询是否存在待打印处方,准备处方信息
                    sql = "select PatientID from prescriptionlist where ProcCode='" + procCode + "'";
                    MySqlCommand    cmd2 = new MySqlCommand(sql, conn);
                    MySqlDataReader dr   = cmd2.ExecuteReader();
                    while (dr.Read())
                    {
                        sql = "1";
                    }
                    dr.Close();

                    if (sql.Equals("1"))
                    {
                        sql = "update prescriptionlist set ProcFlg=5,ProcDate=now() where ProcCode='" + procCode + "'";
                        MySqlCommand cmd3 = new MySqlCommand(sql, conn);
                        cmd3.ExecuteNonQuery();

                        //$Q701 N xxx Nn xxxxxx xxxx*
                        string message = "$Q7030000" + procCode.Length + procCode + "xxxx*";
                        //     NELog.WriteLog(message);
                        Form1.mySyncdQ.Enqueue(message);
                    }
                }
                catch (System.Exception ex)
                {
                    //
                }
                finally
                {
                    pool.releaseConnection(conn);
                }
            }
        }
Exemplo n.º 4
0
        private void QueryOrder(int flag)
        {
            if (textBox1.Text.Trim().Length == 0)
            {
                MessageBox.Show("请输入要检索的患者姓名、患者编号或处方号!");
                return;
            }
            while (listView1.Items.Count > 0)
            {
                listView1.Items.RemoveAt(0);
            }
            while (listView2.Items.Count > 0)
            {
                listView2.Items.RemoveAt(0);
            }

            string sql = "";

            if (flag == 0)
            {
                sql = "select ProcCode,PatientID,PatientName,PrescriptionNo,PrescriptionDate,FetchWindow from prescriptionlist where PatientID like '%" + textBox1.Text + "%' or PatientName like '%" + textBox1.Text + "%' or PrescriptionNo like '%" + textBox1.Text + "%'";
            }
            else
            {
                sql = "select ProcCode,PatientID,PatientName,PrescriptionNo,PrescriptionDate,FetchWindow from prescriptionlist_b where PatientID like '%" + textBox1.Text + "%' or PatientName like '%" + textBox1.Text + "%' or PrescriptionNo like '%" + textBox1.Text + "%'";
            }

            MySQLPool       pool = MySQLPool.getInstance();
            MySqlConnection conn = null;

            try
            {
                conn = pool.getConnection();
                MySqlCommand    cmd = new MySqlCommand(sql, conn);
                MySqlDataReader dr  = cmd.ExecuteReader();
                while (dr.Read())
                {
                    ListViewItem[] p = new ListViewItem[1];
                    p[0] = new ListViewItem(new string[] { dr.IsDBNull(0) ? "" : dr.GetString(0), dr.IsDBNull(1) ? "" : dr.GetString(1), dr.IsDBNull(2) ? "" : dr.GetString(2), dr.IsDBNull(3) ? "" : dr.GetString(3), dr.IsDBNull(4) ? "" : dr.GetString(4), dr.IsDBNull(5) ? "" : dr.GetString(5) });
                    this.listView1.Items.AddRange(p);
                }
                dr.Close();
            }
            catch (System.Exception ex)
            {
                //
            }
            finally
            {
                pool.releaseConnection(conn);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 更新打印标识小于3的记录为0
        /// </summary>
        private void WaitingPrintInit()
        {
            MySQLPool       pool = MySQLPool.getInstance();
            MySqlConnection conn = null;

            try
            {
                conn = pool.getConnection();
                string       sql = "update order_info set print_flag=0 where print_flag<3";
                MySqlCommand cmd = new MySqlCommand(sql, conn);
                cmd.ExecuteNonQuery();
            }
            catch (System.Exception ex)
            {
                //
            }
            finally
            {
                pool.releaseConnection(conn);
            }
        }
Exemplo n.º 6
0
        private void listView1_Click(object sender, EventArgs e)
        {
            while (listView2.Items.Count > 0)
            {
                listView2.Items.RemoveAt(0);
            }

            if (listView1.SelectedIndices != null && listView1.SelectedIndices.Count > 0)
            {
                string hzbh = listView1.SelectedItems[0].SubItems[1].Text;
                string cfxh = listView1.SelectedItems[0].SubItems[3].Text;

                string sql = "select a.DrugCode,Drug_Name,Drug_Spec,Manufactory,concat(Quantity,ifnull(PrescriptionUnit,'')) as qty,StorageLoc from prescriptiondetail a left join drug_list b on a.DrugCode=b.drug_Code where patientid='" + hzbh + "' and prescriptionno='" + cfxh + "'";

                MySQLPool       pool = MySQLPool.getInstance();
                MySqlConnection conn = null;
                try
                {
                    conn = pool.getConnection();
                    MySqlCommand    cmd = new MySqlCommand(sql, conn);
                    MySqlDataReader dr  = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        ListViewItem[] p = new ListViewItem[1];
                        p[0] = new ListViewItem(new string[] { "", dr.IsDBNull(0) ? "" : dr.GetString(0), dr.IsDBNull(1) ? "" : dr.GetString(1), dr.IsDBNull(2) ? "" : dr.GetString(2), dr.IsDBNull(3) ? "" : dr.GetString(3), dr.IsDBNull(4) ? "" : dr.GetString(4), dr.IsDBNull(5) ? "" : dr.GetString(5) });
                        this.listView2.Items.AddRange(p);
                    }
                    dr.Close();
                }
                catch (System.Exception ex)
                {
                    //
                }
                finally
                {
                    pool.releaseConnection(conn);
                }
            }
        }
Exemplo n.º 7
0
        // 检索药品
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim().Length == 0)
            {
                MessageBox.Show("请输入要检索的药品简码、药品条码或药品名称!");
                return;
            }
            while (listView1.Items.Count > 0)
            {
                listView1.Items.RemoveAt(0);
            }

            string sql = sql = "select drug_Code,Drug_Name,Drug_Spec,Manufactory from drug_list where drug_name like '%" + textBox1.Text + "%' or short_code like '%" + textBox1.Text + "%' or drug_barcode like '%" + textBox1.Text + "%' limit 0,50";

            MySQLPool       pool = MySQLPool.getInstance();
            MySqlConnection conn = null;

            try
            {
                conn = pool.getConnection();
                MySqlCommand    cmd = new MySqlCommand(sql, conn);
                MySqlDataReader dr  = cmd.ExecuteReader();
                while (dr.Read())
                {
                    ListViewItem[] p = new ListViewItem[1];
                    p[0] = new ListViewItem(new string[] { dr.IsDBNull(0) ? "" : dr.GetString(0), dr.IsDBNull(1) ? "" : dr.GetString(1), dr.IsDBNull(2) ? "" : dr.GetString(2), dr.IsDBNull(3) ? "" : dr.GetString(3) });
                    this.listView1.Items.AddRange(p);
                }
                dr.Close();
            }
            catch (System.Exception ex)
            {
                //
            }
            finally
            {
                pool.releaseConnection(conn);
            }
        }
Exemplo n.º 8
0
        // 插入明细
        private void button3_Click(object sender, EventArgs e)
        {
            FormWindow f = new FormWindow();

            f.ShowDialog();

            string PrescriptionNo = DateTime.Now.ToString("OyyyyMMddHHmmss");

            MySQLPool       pool = MySQLPool.getInstance();
            MySqlConnection conn = null;

            try
            {
                conn = pool.getConnection();
                string sql = "";
                for (int i = 0; i < listView2.Items.Count; i++)
                {
                    sql = "insert into prescriptiondetail(PrescriptionNo,PatientID,PatientName,DrugCode,Quantity) values('" + PrescriptionNo + "','" + PrescriptionNo + "','测试','" + listView2.Items[i].SubItems[0].Text + "','" + listView2.Items[i].SubItems[4].Text + "')";
                    new MySqlCommand(sql, conn).ExecuteNonQuery();
                }

                sql = "insert into prescriptionlist(PrescriptionNo,PatientID,PatientName,PrescriptionDate,FetchWindow) values('" + PrescriptionNo + "','" + PrescriptionNo + "','测试',now(),'" + f.window + "')";
                new MySqlCommand(sql, conn).ExecuteNonQuery();

                listView1.Items.Clear();
                listView2.Items.Clear();
            }
            catch (System.Exception ex)
            {
                //
            }
            finally
            {
                pool.releaseConnection(conn);
            }
        }
Exemplo n.º 9
0
        private Patient getPrescription(string procCode)
        {
            Patient patient = new Patient();
            List <PrescriptionInfo> pInfoList = new List <PrescriptionInfo>();

            if (true)
            {
                MySQLPool       pool = MySQLPool.getInstance();
                MySqlConnection conn = null;
                try
                {
                    conn = pool.getConnection();
                    string          sql = @"select PrescriptionNo,PatientName,Sex,Age,DeptName,DoctorName,Diagnosis,FetchWindow from prescriptionlist where procCode='" + procCode + "'";
                    MySqlCommand    cmd = new MySqlCommand(sql, conn);
                    MySqlDataReader dr  = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        if (patient.PName == null || "".Equals(patient.PName))
                        {
                            patient.PName       = dr.IsDBNull(1) ? "" : dr.GetString(1);
                            patient.Sex         = dr.IsDBNull(2) ? "" : dr.GetString(2);
                            patient.Age         = dr.IsDBNull(3) ? "" : dr.GetString(3);
                            patient.FetchWindow = dr.IsDBNull(7) ? "" : dr.GetString(7);
                        }

                        PrescriptionInfo prescriptionInfo = new PrescriptionInfo();
                        prescriptionInfo.PrescriptionNO = dr.IsDBNull(0) ? "" : dr.GetString(0);

                        pInfoList.Add(prescriptionInfo);
                    }
                    dr.Close();

                    foreach (PrescriptionInfo prescInfo in pInfoList)
                    {
                        List <PrescriptionDetl> pDetlList = new List <PrescriptionDetl>();

                        string          sql2 = "select b.Quantity,b.PrescriptionUnit,b.Price,b.UseFrequency,b.UseDosage,b.UseRoute,c.Drug_Name,c.Drug_Spec,c.Manufactory,c.StorageLoc,Notes from prescriptiondetail b left join drug_list c on b.DrugCode=c.Drug_Code where b.PrescriptionNo='" + prescInfo.PrescriptionNO + "'";
                        MySqlCommand    cmd2 = new MySqlCommand(sql2, conn);
                        MySqlDataReader dr2  = cmd2.ExecuteReader();
                        while (dr2.Read())
                        {
                            PrescriptionDetl prescriptionDetl = new PrescriptionDetl();
                            prescriptionDetl.DrugName         = dr2.IsDBNull(6) ? "" : dr2.GetString(6);
                            prescriptionDetl.DrugSpec         = dr2.IsDBNull(7) ? "" : dr2.GetString(7);
                            prescriptionDetl.Manufactory      = dr2.IsDBNull(8) ? "" : dr2.GetString(8);
                            prescriptionDetl.PrescriptionQty  = dr2.IsDBNull(0) ? "" : dr2.GetString(0);
                            prescriptionDetl.PrescriptionUnit = dr2.IsDBNull(1) ? "" : dr2.GetString(1);
                            prescriptionDetl.StorageLoc       = dr2.IsDBNull(9) ? "" : dr2.GetString(9);
                            prescriptionDetl.UseFrequency     = dr2.IsDBNull(3) ? "" : dr2.GetString(3);
                            prescriptionDetl.UseDosage        = dr2.IsDBNull(4) ? "" : dr2.GetString(4);
                            prescriptionDetl.UseRoute         = dr2.IsDBNull(5) ? "" : dr2.GetString(5);
                            prescriptionDetl.Notes            = dr2.IsDBNull(10) ? "" : dr2.GetString(10);
                            //prescriptionDetl.Num_1 = dr2.IsDBNull(11) ? "" : dr2.GetString(11);
                            prescriptionDetl.Price = dr2.IsDBNull(2) ? "" : dr2.GetString(2);
                            pDetlList.Add(prescriptionDetl);
                        }
                        dr2.Close();

                        prescInfo.DetlList = pDetlList;
                    }

                    patient.PrescInfo = pInfoList;

                    sql = "update prescriptionlist set ProcFlg=5 where ProcCode='" + procCode + "'";
                    MySqlCommand cmd3 = new MySqlCommand(sql, conn);
                    cmd3.ExecuteNonQuery();
                }
                catch (System.Exception ex)
                {
                    NELog.WriteLog(ex.ToString());
                }
                finally
                {
                    pool.releaseConnection(conn);
                }
            }
            else
            {
                patient.PName       = "张珊珊";
                patient.Sex         = "女";
                patient.Age         = "2岁半";
                patient.FetchWindow = "④";

                {
                    PrescriptionInfo prescriptionInfo = new PrescriptionInfo();
                    prescriptionInfo.PrescriptionNO = "200000102103";

                    List <PrescriptionDetl> pDetlList = new List <PrescriptionDetl>();

                    {
                        PrescriptionDetl prescriptionDetl = new PrescriptionDetl();
                        prescriptionDetl.DrugName         = "复方磺胺甲噁唑片";
                        prescriptionDetl.DrugSpec         = "150mgx10粒/盒";
                        prescriptionDetl.Manufactory      = "天津金耀氨基酸有限公司";
                        prescriptionDetl.PrescriptionQty  = "2";
                        prescriptionDetl.PrescriptionUnit = "盒";
                        prescriptionDetl.StorageLoc       = "22-2-2";
                        pDetlList.Add(prescriptionDetl);
                    }

                    {
                        PrescriptionDetl prescriptionDetl = new PrescriptionDetl();
                        prescriptionDetl.DrugName         = "复方磺胺甲噁唑片";
                        prescriptionDetl.DrugSpec         = "150mgx10粒/盒";
                        prescriptionDetl.Manufactory      = "天津金耀氨基酸有限公司";
                        prescriptionDetl.PrescriptionQty  = "2";
                        prescriptionDetl.PrescriptionUnit = "盒";
                        prescriptionDetl.StorageLoc       = "22-2-2";
                        pDetlList.Add(prescriptionDetl);
                    }
                    prescriptionInfo.DetlList = pDetlList;

                    pInfoList.Add(prescriptionInfo);
                }
                {
                    PrescriptionInfo prescriptionInfo = new PrescriptionInfo();
                    prescriptionInfo.PrescriptionNO = "200000102102";

                    List <PrescriptionDetl> pDetlList = new List <PrescriptionDetl>();

                    {
                        PrescriptionDetl prescriptionDetl = new PrescriptionDetl();
                        prescriptionDetl.DrugName         = "2复方磺胺甲噁唑片";
                        prescriptionDetl.DrugSpec         = "150mgx10粒/盒";
                        prescriptionDetl.Manufactory      = "天津金耀氨基酸有限公司";
                        prescriptionDetl.PrescriptionQty  = "2";
                        prescriptionDetl.PrescriptionUnit = "盒";
                        prescriptionDetl.StorageLoc       = "22-2-2";
                        pDetlList.Add(prescriptionDetl);
                    }

                    prescriptionInfo.DetlList = pDetlList;

                    pInfoList.Add(prescriptionInfo);
                }

                patient.PrescInfo = pInfoList;
            }

            return(patient);
        }