//若沒有選擇病患就先選擇一位病患
        private void loadAspxFile()
        {
            Panel_Loader1.Hidden = false;
            Panel_Loader2.Hidden = true;
            Panel_Loader3.Hidden = true;

            if (Session["USER_ID"] == null)
            {
                X.Redirect("login.aspx?target=" + url);
            }
            else
            {
                userId = Session["USER_ID"].ToString();
            }

            if (_PAT_IC == "")
            {
                Session["redirect"] = url;
                PatInfo_Query();
            }
            else
            {
                Panel_Loader1.Loader.SuspendScripting();
                Panel_Loader1.Loader.Url            = url;
                Panel_Loader1.Loader.DisableCaching = true;
                Panel_Loader1.LoadContent();
                Refreach_Label();
            }
        }
        protected void BtnQuery_Click(object sender, DirectEventArgs e)
        {
            string sql = "SELECT a.pif_ic, b.apptst_patrefid, b.apptst_flr, b.apptst_sec, b.apptst_bed, b.apptst_mactyp, b.apptst_wktyp, b.apptst_daytyp, b.apptst_timetyp FROM pat_info a ";

            sql += "LEFT JOIN appointment_setup b ON a.pif_ic=b.apptst_patic ";
            sql += "WHERE pif_mrn='" + TextQuery.Text + "' ";
            sql += "AND b.apptst_flr='" + sFLOOR.Text + "' ";
            sql += "AND b.apptst_timetyp='" + sTIME.Text + "' ";
            sql += "AND b.apptst_daytyp='" + sWEEK.Text + "'";
            DataTable dt = db.Query(sql);

            if (dt.Rows.Count > 0)
            {
                string pid     = dt.Rows[0]["pif_ic"].ToString();
                string pname   = dt.Rows[0]["apptst_patrefid"].ToString();
                string bedno   = dt.Rows[0]["apptst_bed"].ToString();
                string mactype = dt.Rows[0]["apptst_mactyp"].ToString();
                string area    = dt.Rows[0]["apptst_sec"].ToString();
                Common._NotificationShow("开始报到");
                string url = "checkin/Patient_detail.aspx?personid=" + pid + "&patient_name=" + pname + "&machine_type=" + mactype + "&floor=" + sFLOOR.Text;
                url += "&area=" + area + "&time=" + sTIME.Text + "&bedno=" + bedno + "&daytyp=" + sWEEK.Text + "&sdate=" + sDATE.Text;

                _PAT_IC            = pid;
                Session["PAT_IC"]  = pid;
                _PIF_NAME          = pname;
                _USER_NAME         = Session["USER_NAME"].ToString();
                FormPanel2.Enabled = false;

                Panel_Loader1.Hidden = false;
                Panel_Loader2.Hidden = true;
                Panel_Loader3.Hidden = true;
                Store istore = grdBED_LIST.GetStore();
                istore.RemoveAll();

                Panel_Loader1.Loader.SuspendScripting();
                Panel_Loader1.Loader.Url            = url;
                Panel_Loader1.Loader.DisableCaching = true;
                Panel_Loader1.LoadContent();
                Refreach_Label();
            }
            else
            {
                Common._NotificationShow("查无此人或已逾时" + TextQuery.Text);
            }
            TextQuery.Text = "";
            TextQuery.Focus(false, 100);
        }
        //直接轉往功能項目
        private void DirectLoad()
        {
            Panel_Loader1.Hidden = false;
            Panel_Loader2.Hidden = true;
            Panel_Loader3.Hidden = true;

            if (Session["USER_ID"] == null)
            {
                X.Redirect("login.aspx?target=" + url);
            }
            else
            {
                userId = Session["USER_ID"].ToString();
            }

            Panel_Loader1.Loader.SuspendScripting();
            Panel_Loader1.Loader.Url            = url;
            Panel_Loader1.Loader.DisableCaching = true;
            Panel_Loader1.LoadContent();
        }
        protected void RowSelect(object sender, DirectEventArgs e)
        {
            //Panel_Left.Collapse();
            string json = e.ExtraParams["Values"];

            Dictionary <string, string>[] selRow = JSON.Deserialize <Dictionary <string, string>[]>(json);

            string pic     = selRow[0]["PERSON_IC"].ToString();
            string pname   = selRow[0]["PERSON_NAME"].ToString();
            string bedno   = selRow[0]["BED_NO"];
            string mactype = selRow[0]["MAC_TYPE"];
            string area    = selRow[0]["AREA"];
            string pid     = selRow[0]["PERSON_ID"].ToString();
            string weight  = selRow[0]["PERSON_WEIGHT"].ToString();

            if (pic != "")
            {
                _PAT_ID            = pid;
                _PAT_IC            = pic;
                Session["PAT_IC"]  = pic;
                _PIF_NAME          = pname;
                _USER_NAME         = Session["USER_NAME"].ToString();
                FormPanel2.Enabled = false;

                Panel_Loader1.Hidden = false;
                Panel_Loader2.Hidden = true;
                Panel_Loader3.Hidden = true;
                Store istore = grdBED_LIST.GetStore();
                istore.RemoveAll();

                string url = "checkin/Patient_detail.aspx?personid=" + pic + "&patient_name=" + pname + "&machine_type=" + mactype + "&floor=" + sFLOOR.Text;
                url += "&area=" + area + "&time=" + sTIME.Text + "&bedno=" + bedno + "&daytyp=" + sWEEK.Text + "&sdate=" + sDATE.Text + "&patient_weight=" + weight;

                Panel_Loader1.Loader.SuspendScripting();
                Panel_Loader1.Loader.Url            = url;
                Panel_Loader1.Loader.DisableCaching = true;
                Panel_Loader1.LoadContent();
                Refreach_Label();
            }
        }