Exemplo n.º 1
0
        /// <summary>
        /// false: not login; true: login
        /// </summary>
        /// <param name="floor"></param>
        /// <param name="area"></param>
        /// <param name="time"></param>
        /// <param name="beno"></param>
        /// <returns></returns>
        static public bool does_login(pat pat_obj)
        {
            string floor = pat_obj.floor, area = pat_obj.area, time = pat_obj.time, bedno = pat_obj.bedno;

            string sql = "SELECT b.pif_name name,b.pif_sex,b.pif_ic id," + DateTime.Now.Year.ToString() + "-year(b.pif_dob) age,b.pif_hpack,a.pv_macno,a.pv_weight,a.pv_macstat ";

            sql += "from pat_visit a,pat_info b  ";
            sql += "where a.pv_datevisit = '" + DateTime.Now.ToString("yyyy-MM-dd") + "' ";
            sql += "and a.pv_floor = '" + floor + "' ";
            sql += "and a.pv_sec = '" + area + "' ";
            sql += "and a.pv_time = '" + time + "' ";
            sql += "and a.pv_bedno = '" + bedno + "' ";
            sql += "and a.pv_ic = b.pif_ic";
            string    result;
            DataTable dt = DBMysql.query(sql, out result);

            if (dt.Rows.Count == 0)
            {
                return(false);
            }
            // if(dt.Rows.Count > 0)
            // {
            //     throw new Exception("在同一天而且同一個時段而且同一張床查到兩筆以上的淨化資料");
            // }
            return(true);
        }
Exemplo n.º 2
0
        private void refresh()
        {
            string sql = "SELECT b.pif_hpack, b.pif_hpack2 as mechine_model, " +
                         "b.pif_hpack3, b.pif_name name, b.pif_sex, b.pif_ic, " +
                         DateTime.Now.Year.ToString() + "-year(b.pif_dob) age, " +
                         "b.pif_hpack,a.pv_macno,a.pv_weight,a.pv_macstat ";

            sql += "from pat_visit a,pat_info b  ";
            sql += "where a.pv_datevisit = '" + DateTime.Now.ToString("yyyy-MM-dd") + "' ";
            sql += "and a.pv_floor = '" + floor + "' ";
            sql += "and a.pv_sec = '" + area + "' ";
            sql += "and a.pv_time = '" + time + "' ";
            sql += "and a.pv_bedno = '" + bedno + "' ";
            sql += "and a.pv_ic = b.pif_ic";
            string    result;
            DataTable dt = DBMysql.query(sql, out result);

            if (dt == null || dt.Rows.Count == 0)
            {
                status = pat_status.not_login;
                return;
            }

            DataRow row = dt.Rows[0];

            name       = row["name"].ToString();
            sex        = row["pif_sex"].ToString();
            pif_ic     = row["pif_ic"].ToString();
            age        = row["age"].ToString();
            pif_hpack2 = row["mechine_model"].ToString();
            string tmp = Common.get_tube_model(row);

            if (tmp == null || tmp.Length == 0)
            {
                Common.SaveERR("debug", "pif_hpack3 is empty with sql: " + sql);
            }
            else
            {
                pif_hpack3 = tmp;
            }
            if (pif_hpack3 == "" || _pif_hpack3.Length == 0)
            {
                Common.SaveERR("debug", "在數據庫裡找不到管路型号, with sql: " + sql);
                //throw new Exception("在數據庫裡找不到管路型号");
            }
            if (row["pv_macstat"].ToString() == "S")//是否已經停機判斷
            {
                //已關機
                status = pat_status.stop;
            }
            else
            {
                status = pat_status.not_stop;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// only used for get_hp3pack_code, get_hp3pack_name
        /// </summary>
        /// <param name="column"></param>
        /// <param name="code_or_name"></param>
        /// <returns></returns>
        static private string get_hp3_value(string column, string code_or_name)
        {
            string    sql_tmp = "select " + column + " from hpack3_setup where hp3_code = '" + code_or_name + "' or hp3_name ='" + code_or_name + "'";
            string    result;
            DataTable dt_tmp = DBMysql.query(sql_tmp, out result);

            if (dt_tmp != null && dt_tmp.Rows.Count > 0)
            {
                return(dt_tmp.Rows[0][column].ToString());
            }
            return(null);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 透析器型號, 從cln1_col26欄位讀透析器型號, pif_hpack2
        /// </summary>
        /// <param name="cln1_col26"></param>
        /// <returns></returns>
        static public string get_hp2_name(string cln1_col26)
        {
            string    sql = "select hp2_name from hpack2_setup b where b.hp2_code='" + cln1_col26 + "' or b.hp2_name='" + cln1_col26 + "'";
            string    result;
            DataTable dt = DBMysql.query(sql, out result);

            if (dt == null || dt.Rows.Count == 0)
            {
                return("");
            }
            return(dt.Rows[0]["hp2_name"].ToString());
        }
Exemplo n.º 5
0
        /// <summary>
        /// 血管通路, cln1_col34, pif_hpack
        /// </summary>
        /// <param name="cln1_col26"></param>
        /// <returns></returns>
        static public string get_hp_name(string cln1_col34)
        {
            string    sql = "select pck_name from package_setup where pck_code='" + cln1_col34 + "' or pck_name='" + cln1_col34 + "'";
            string    result;
            DataTable dt = DBMysql.query(sql, out result);

            if (dt != null && dt.Rows.Count > 0)
            {
                return(dt.Rows[0]["pck_name"].ToString());
            }
            return(null);
        }
Exemplo n.º 6
0
        /// <summary>
        /// true: stop; false: N/A
        /// pv_ic, pif_ic, pif_ic='" + Tex_Patient_ID.Text + "' ";
        /// </summary>
        /// <returns></returns>
        static public bool does_stop(string pv_ic)
        {
            string sql = "SELECT a.* ";

            sql += "FROM pat_visit a ";
            sql += "WHERE a.pv_ic = '" + pv_ic + "' ";
            sql += "  AND a.pv_datevisit = '" + DateTime.Now.ToString("yyyy-MM-dd") + "' ";
            sql += "  AND a.pv_macstat = 'S'";
            string    result;
            DataTable dt = DBMysql.query(sql, out result);

            if (dt.Rows.Count == 0)
            {
                return(false);
            }
            return(true);
        }