Esempio n. 1
0
        public void ReadDrugMod_List()
        {
            string sql = "SELECT a.sid, b.drg_name, a.intake, a.medway, a.freq ";

            sql += "FROM drug_modual a ";
            sql += "LEFT JOIN drug_list b ON a.drg_code=b.drg_code ";
            sql += "WHERE a.status='Y' ";
            sql += "ORDER BY a.drg_code";
            DataTable dt     = db.Query(sql);
            Store     istore = Grid_DrugTerm.GetStore();

            istore.DataSource = db.GetDataArray(dt);
            istore.DataBind();
            dt.Dispose();
        }
Esempio n. 2
0
        protected void SaveSelRow(object sender, DirectEventArgs e)
        {
            string sql = "";
            string drg_code, drg_intake, drg_freq, drg_medway;
            string toDay  = DateTime.Now.ToString("yyyy-MM-dd");
            string toTime = DateTime.Now.ToString("HH:mm");

            string[] StrArray = new string[4];

            RowSelectionModel sm = this.Grid_DrugTerm.GetSelectionModel() as RowSelectionModel;

            foreach (SelectedRow row in sm.SelectedRows)
            {
                StrArray   = GetDrugValue(row.RecordID.ToString());
                drg_code   = StrArray[0];
                drg_intake = StrArray[1];
                drg_freq   = StrArray[2];
                drg_medway = StrArray[3];
                if (DrugKind.Text == "L")
                {
                    sql += "INSERT INTO longterm_ordermgt(lgord_patic, lgord_dateord, lgord_timeord, lgord_usr1, lgord_dtactst, lgord_usr2, ";
                    sql += "lgord_drug, lgord_intake, lgord_freq, lgord_medway, lgord_actst) ";
                    sql += "VALUES('" + PationID.Text + "','" + toDay + "','" + toTime + "','" + DocName.Text + "','','" + DocName.Text + "',";
                    sql += "'" + drg_code + "','" + drg_intake + "','" + drg_freq + "','" + drg_medway + "','00001'); ";
                }
                else //==S
                {
                    sql += "INSERT INTO shortterm_ordermgt(shord_patic, shord_dateord, shord_timeord, shord_usr1, shord_dtactst, shord_usr2, ";
                    sql += "shord_drug, shord_intake, shord_freq, shord_medway, shord_actst) ";
                    sql += "VALUES('" + PationID.Text + "','" + toDay + "','" + toTime + "','" + DocName.Text + "','','" + DocName.Text + "',";
                    sql += "'" + drg_code + "','" + drg_intake + "','" + drg_freq + "','" + drg_medway + "','00001'); ";
                }
            }
            db.Excute(sql);

            Store istore = Grid_DrugTerm.GetStore();

            istore.RemoveAll();
            DetailsWindow.Close();

            //更新長期醫囑清單
            if (DrugKind.Text == "L")
            {
                sql  = "SELECT a.lgord_id,a.lgord_dateord,a.lgord_timeord,a.lgord_usr1,b.drg_name,a.lgord_intake,a.lgord_freq,a.lgord_medway,a.lgord_comment,a.lgord_dtactst ";
                sql += ", CASE a.lgord_actst WHEN '00001' THEN '' WHEN '00002' THEN '停用' END As Status ";
                sql += "FROM longterm_ordermgt a ";
                sql += "LEFT JOIN drug_list b ON a.lgord_drug=b.drg_code ";
                sql += "WHERE a.lgord_patic='" + PationID.Text + "' ";
                sql += "ORDER BY a.lgord_dateord DESC, Status";
                //sql += "  AND a.lgord_actst='00001'"; //只取使用中的藥物
                DataTable dt = db.Query(sql);
                GridStore1.DataSource = db.GetDataArray(dt);
                GridStore1.DataBind();
            }
            else //更新短期醫囑清單
            {
                sql  = "SELECT a.shord_id,a.shord_dateord,a.shord_timeord,a.shord_usr1,b.drg_name,a.shord_intake,a.shord_freq,a.shord_medway,a.shord_comment,a.shord_dtactst ";
                sql += ", CASE a.shord_actst WHEN '00001' THEN '' WHEN '00002' THEN '停用' END As Status ";
                sql += "FROM shortterm_ordermgt a ";
                sql += "LEFT JOIN drug_list b ON a.shord_drug = b.drg_code ";
                sql += "WHERE a.shord_patic='" + PationID.Text + "' ";
                //sql += "AND a.shord_dateord='" + toDay + "' ";
                sql += "ORDER BY a.shord_dateord DESC, Status";
                //sql += "AND a.shord_actst='00001'";//只取使用中
                DataTable dt = db.Query(sql);
                GridStore1.DataSource = db.GetDataArray(dt);
                GridStore1.DataBind();
            }
        }