Beispiel #1
0
        protected void BtnSave_Click(object sender, DirectEventArgs e)
        {
            string sql;

            sql  = "SELECT cln1_diadate FROM clinical1_doc_henan ";
            sql += "WHERE cln1_patic='" + Patient_ID.Text + "' AND cln1_diadate='" + text_info_date.Text + "' ";
            DataTable dt = db.Query(sql);

            if (dt.Rows.Count > 0)
            {
                sql  = "UPDATE clinical1_doc_henan ";
                sql += "SET cln1_col1 = '" + Common.GetComboBoxText(cbo_h_type) + "',";    //血管通路類型
                sql += "cln1_col2 = '" + Common.GetComboBoxText(cbo_machine_model) + "',"; //透析器型号
                sql += "cln1_col3 = '" + Common.GetComboBoxText(cbo_Machinetype) + "',";   //透析方式
                sql += "cln1_col4 = '" + txt_weight_after_expect.Text + "',";              //干体重
                sql += "cln1_col5 = '" + Common.GetComboBoxText(SelectBox10) + "',";       //抗凝药物
                sql += "cln1_col6 = '" + TextField3.Text + "',";                           //目标定容量
                sql += "cln1_col7 = '" + TextField8.Text + "',";                           //首次剂量
                sql += "cln1_col8 = '" + TextAdd.Text + "',";                              //追加量
                sql += "cln1_col9 = '" + TextAmount.Text + "', ";                          //总量
                sql += "cln1_col10 = '" + TextField6.Text + "', ";
                sql += "cln1_col11 = '" + TextField7.Text + "', ";
                sql += "cln1_col12 = '" + TextField9.Text + "', ";
                sql += "cln1_col13 = '" + TextField10.Text + "' ";
                sql += "WHERE cln1_patic='" + Patient_ID.Text + "' AND cln1_diadate='" + text_info_date.Text + "' ";
            }
            else
            {
                sql  = "INSERT INTO clinical1_doc_henan(cln1_patic,cln1_diadate,";
                sql += "cln1_col1, cln1_col2, cln1_col3, cln1_col4, cln1_col5,";
                sql += "cln1_col6, cln1_col7, cln1_col8, cln1_col9,";
                sql += "cln1_col10, cln1_col11, cln1_col12, cln1_col13) ";
                sql += "VALUES('" + Patient_ID.Text + "', '" + text_info_date.Text + "', ";
                sql += "'" + Common.GetComboBoxText(cbo_h_type) + "', ";
                sql += "'" + Common.GetComboBoxText(cbo_machine_model) + "', ";
                sql += "'" + Common.GetComboBoxText(cbo_Machinetype) + "', ";
                sql += "'" + txt_weight_after_expect.Text + "', ";
                sql += "'" + Common.GetComboBoxText(SelectBox10) + "', ";
                sql += "'" + TextField3.Text + "', ";
                sql += "'" + TextField8.Text + "', ";
                sql += "'" + TextAdd.Text + "', ";
                sql += "'" + TextAmount.Text + "', ";
                sql += "'" + TextField6.Text + "', ";
                sql += "'" + TextField7.Text + "', ";
                sql += "'" + TextField9.Text + "', ";
                sql += "'" + TextField10.Text + "') ";
            }
            db.Excute(sql);
            text_info_date.RemoveCls("Text-red");
            text_info_date.AddCls("Text-blue");
            _NotificationShow("<font size=4>储存成功!</font>");
        }
Beispiel #2
0
        private void Page_Init(object sender, EventArgs e)
        {
            try
            {
                DBMysql db = new DBMysql();

                string    sRPT_LOGO = "";
                DataTable dtLOGO    = db.Query("SELECT *  FROM general_setup WHERE  genst_code='RPT_LOGO'");
                if (dtLOGO.Rows.Count > 0)
                {
                    sRPT_LOGO = dtLOGO.Rows[0]["genst_desc"].ToString();
                    sRPT_LOGO = Server.MapPath(sRPT_LOGO);
                }
                string    sRPT_NAME = "";
                DataTable dtNAME    = db.Query("SELECT *  FROM general_setup WHERE  genst_code='RPT_NAME'");
                if (dtNAME.Rows.Count > 0)
                {
                    sRPT_NAME = dtNAME.Rows[0]["genst_desc"].ToString();
                }

                #region 統計分析-病患人數
                int       W_COUNT         = 0;
                int       W_ZINFO07_COUNT = 0;
                DataTable dtPAT_INFO      = db.Query("SELECT COUNT(*) AS COUNT FROM PAT_INFO ");
                if (dtPAT_INFO.Rows.Count > 0)
                {
                    W_COUNT = Convert.ToInt32(dtPAT_INFO.Rows[0]["COUNT"].ToString());
                }
                DataTable dtzinfo07 = db.Query("SELECT COUNT(*) as ZINFO07_COUNT FROM zinfo_a_07 WHERE opt_1 = '1' OR opt_1 = '2' OR opt_1 = '3' OR opt_1 = '4' ORDER BY PAT_ID");
                if (dtzinfo07.Rows.Count > 0)
                {
                    W_ZINFO07_COUNT = Convert.ToInt32(dtzinfo07.Rows[0]["ZINFO07_COUNT"].ToString());
                }
                int W_TOTAL = 0;                     //線上透析總人數
                W_TOTAL = W_COUNT - W_ZINFO07_COUNT; //減去死亡或退出
                string    sqlCHKREG = "select genst_desc from general_setup where genst_ctg = 'statistics'" + " and genst_code = '001" + "'";
                DataTable dt        = db.Query(sqlCHKREG);
                string    sql       = "";
                if (dt.Rows.Count == 0)
                {
                    sql = "INSERT into general_setup (genst_ctg, genst_code, genst_desc) VALUES('statistics', '001', '" + W_TOTAL + "') ";
                }
                else
                {
                    sql = "UPDATE  general_setup a set genst_desc='" + W_TOTAL + "' WHERE a.genst_ctg='statistics' AND a.genst_code='001'";
                }
                db.Excute(sql);
                #endregion

                ReportDocument rpt = new ReportDocument();
                rpt.Load(Server.MapPath("statistics.rpt"));
                rpt.DataDefinition.FormulaFields["RPT_LOGO"].Text = "ToText('" + sRPT_LOGO + "')";
                rpt.DataDefinition.FormulaFields["RPT_NAME"].Text = "ToText('" + sRPT_NAME + "')";

                ParameterDiscreteValue pdv = new ParameterDiscreteValue();

                CRViewer.ReportSource = rpt;

                ConnectionInfo connInfo = new ConnectionInfo();

                //Server=192.168.1.118;Database=myhaisv3;UID=root;PWD=; CharSet=utf8
                //資料庫連線設定無效,阿亮是使用ODBC連線。
                string[] MySqlString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString().Split(';');
                for (int i = 0; i < MySqlString.Length; i++)
                {
                    switch (MySqlString[i].ToUpper().Substring(0, 3))
                    {
                    case "SER":
                        connInfo.ServerName = MySqlString[i].Split('=')[1];
                        break;

                    case "DAT":
                        connInfo.DatabaseName = MySqlString[i].Split('=')[1];
                        break;

                    case "UID":
                        connInfo.UserID = MySqlString[i].Split('=')[1];
                        break;

                    case "PWD":
                        connInfo.Password = MySqlString[i].Split('=')[1];
                        break;
                    }
                }
                //connInfo. ServerName = "192.168.1.130";
                //connInfo. DatabaseName = "mysql";
                //connInfo. UserID = "root";
                //connInfo. Password = "";

                TableLogOnInfos tableLogOnInfos = CRViewer.LogOnInfo;

                foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
                {
                    tableLogOnInfo.ConnectionInfo = connInfo;
                }
            }
            catch (Exception ex)
            {
                Common._ErrorMsgShow(ex.Message.ToString());
            }
        }
        protected void Btn_save_Click(object sender, DirectEventArgs e)
        {
            string sql = "SELECT a.* ", scln3_bld = "1";

            scln3_bld = Common.GetComboBoxValue(cbo_pressure);

            //switch (Common.GetComboBoxText(cbo_pressure))
            //{
            //    case "基本正常":
            //        scln3_bld = "1";
            //        break;
            //    case "较高":
            //        scln3_bld = "2";
            //        break;
            //    case "较低":
            //        scln3_bld = "3";
            //        break;
            //    default:
            //        throw new Exception("GetComboBoxText cbo_pressure failure");
            //}

            sql += "  FROM clinical3_nurse a ";
            sql += " where a.cln3_patic = '" + patient_id.Text + "' ";
            sql += "  and a.cln3_date = '" + DateTime.Now.ToString("yyyy-MM-dd") + "' ";
            DataTable dt = db.Query(sql);

            if (dt.Rows.Count == 1)
            {
                sql  = "UPDATE clinical3_nurse b ";
                sql += "set b.cln3_date = '" + DateTime.Now.ToString("yyyy-MM-dd") + "',";
                sql += "  b.cln3_time = '" + ttt.Text + "',";
                sql += "  b.cln3_rmk = '" + TextField4.Text + "',";
                sql += "  b.cln3_a1 = '" + TextField5.Text + "',";
                sql += "  b.cln3_a2 = '" + TextField6.Text + "',";
                sql += "  b.cln3_b1 = '" + TextField7.Text + "',";
                sql += "  b.cln3_b2 = '" + TextField8.Text + "',";
                sql += "  b.cln3_ysa = '" + Common.GetComboBoxText(cbo_symptom) + "',";
                sql += "  b.cln3_pressure = '" + Common.GetComboBoxText(cbo_pressure) + "',";
                sql += "  b.cln3_bld = '";
                sql += scln3_bld;

                sql += "', ";
                sql += "    b.cln3_yn = '" + (Common.GetComboBoxText(cbo_symptom) == "无症状" ? "N" : "Y");
                sql += "', ";
                sql += "    b.cln3_rmk2 = '" + TextArea2.Text + "' ";
                //sql += "    b.cln3_doc1 = '" + TextField9.Text + "',";
                //sql += "    b.cln3_nur1 = '" + TextField10.Text + "' ";
                sql += " where b.cln3_patic = '" + patient_id.Text + "' ";
                sql += "   AND b.cln3_date = '" + DateTime.Now.ToString("yyyy-MM-dd") + "' ";
            }
            else
            {
                sql = "INSERT into clinical3_nurse(cln3_patic,cln3_date,cln3_time," +
                      "cln3_a1,cln3_a2,cln3_b1,cln3_b2," +
                      "cln3_CatheterAccess,cln3_MuscleAtrophy,cln3_ysa,cln3_pressure,cln3_DialysisMachine,cln3_HeparinPumpArtery,cln3_HeparinPumpVein," +
                      "cln3_bld,cln3_yn,cln3_rmk2,cln3_rmk) ";                            //
                sql += "VALUES('" + patient_id.Text + "','" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + ttt.Text + "'," +
                       "'" + TextField5.Text + "','" + TextField6.Text + "','" + TextField7.Text + "','" + TextField8.Text + "'," +
                       "'',''," +
                       "'" + Common.GetComboBoxText(cbo_symptom) + "','" + Common.GetComboBoxText(cbo_pressure) + "'," +
                       "'','','','";
                sql += scln3_bld;
                sql += "','";
                sql += Common.GetComboBoxText(cbo_symptom) == "无症状" ? "N" : "Y";
                sql += "','" + TextArea2.Text + "','" + TextField4.Text + "')";
            }
            db.Excute(sql);
            Common._NotificationShow("储存成功!");
        }
Beispiel #4
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();
            }
        }
Beispiel #5
0
        protected void Btn_save_Click(object sender, DirectEventArgs e)
        {
            string    sql;
            DataTable dt;

            if (cbo_mechine_model.Text.Trim() == "")
            {
                Common._ErrorMsgShow("请输入透析器型号!");
                return;
            }
            else if (cbo_h_type.Text.Trim() == "")
            {
                Common._ErrorMsgShow("请输入血管通路!");
                return;
            }
            else
            {
                try //深静脉置管
                {
                    //DBMysql db = new DBMysql();
                    sql  = "SELECT cln1_diadate FROM clinical1_nurse_suzhou ";
                    sql += "WHERE cln1_patic = '" + patient_id.Text + "' AND cln1_diadate = '" + info_date1.Text + "' ";
                    dt   = db.Query(sql);
                    if (dt.Rows.Count > 0)
                    {
                        sql  = "UPDATE clinical1_nurse_suzhou SET ";
                        sql += "cln1_col11 = '" + Col11 + "',";
                        sql += "cln1_col12 = '" + coltext11 + "',";
                        sql += "cln1_col21 = '" + Col21 + "',";
                        sql += "cln1_col22 = '" + coltext21 + "',";
                        sql += "cln1_col31 = '" + Col31 + "',";
                        sql += "cln1_col32 = '" + coltext31 + "',";
                        sql += "cln1_col41 = '" + Col41 + "',";
                        sql += "cln1_col42 = '" + coltext41 + "',";
                        sql += "cln1_col50 = '" + Col50 + "' ";
                        sql += "WHERE cln1_patic = '" + patient_id.Text + "' AND cln1_diadate = '" + info_date1.Text + "' ";
                    }
                    else
                    {
                        sql  = "INSERT INTO clinical1_nurse_suzhou (cln1_patic, cln1_diadate,";
                        sql += "cln1_col11, cln1_col12, cln1_col21, cln1_col22, cln1_col31, cln1_col32, cln1_col41, cln1_col42, cln1_col50) ";
                        sql += "VALUES('" + patient_id.Text + "','" + info_date1.Text + "',";
                        sql += "'" + Col11 + "','" + coltext11 + "',";
                        sql += "'" + Col21 + "','" + coltext21 + "',";
                        sql += "'" + Col31 + "','" + coltext31 + "',";
                        sql += "'" + Col41 + "','" + coltext41 + "',";
                        sql += "'" + Col50 + "')";
                    }
                    db.Excute(sql); //深静脉置管
                }
                catch               //深静脉置管,儲存失敗
                {
                }

                string checktext = ",";
                if (CheckboxEPO.Checked == true || SelectBoxEPO.Text.Trim() != "")
                {
                    checktext += "EPO,";
                }
                if (CheckboxLCard.Checked == true || SelectBoxLcard.Text.Trim() != "")
                {
                    checktext += "左卡,";
                }
                if (CheckboxMecobalamin.Checked == true || SelectBoxMecobalamin.Text.Trim() != "")
                {
                    checktext += "甲钴铵,";
                }
                if (CheckboxIron.Checked == true || SelectBoxIron.Text.Trim() != "")
                {
                    checktext += "铁剂,";
                }
                if (CheckboxCalcitriol.Checked == true || SelectBoxCalcitriol.Text.Trim() != "")
                {
                    checktext += "溉醇,";
                }
                if (CheckboxSodium.Checked == true || SelectBoxSodium.Text.Trim() != "")
                {
                    checktext += "透析液钠,";
                }
                if (CheckboxCalcitriol.Checked == true || SelectBoxCalcitriol.Text.Trim() != "")
                {
                    checktext += "透析液钾,";
                }
                sql  = "UPDATE clinical1_nurse a ";
                sql += " SET a.cln1_col1 = '" + Common.GetComboBoxText(cbo_diagnosis) + "',";
                sql += "     a.cln1_col2 = '" + bedno.Text + "',";
                sql += "     a.cln1_col3 = '" + cbo_dialysis_type.Text + "',";
                sql += "     a.cln1_col4 = '" + hpack.Text + "',";
                sql += "     a.cln1_col5 = '" + txt_weight_before.Text + "',";
                sql += "     a.cln1_col6 = '" + txt_weight_after_expect.Text + "',";
                sql += "     a.cln1_col7 = '" + TextField3.Text + "',";

                if (txt_weight_after.Text != "")
                {
                    sql += "     a.cln1_col8 = '" + txt_weight_after.Text + "',";
                }

                sql += "     a.cln1_col9 = '" + info_date1.Text + "',";
                sql += "     a.cln1_col10 = '" + TextField5.Text + "',";
                sql += "     a.cln1_col11 = '" + TextField6.Text + "',";
                sql += "     a.cln1_col12 = '" + TextField7.Text + "',";
                sql += "     a.cln1_col13 = '" + TextFirst.Text + "',";
                sql += "     a.cln1_col14 = '" + TextAdd.Text + "',";
                sql += "     a.cln1_col15 = '" + SelectBox10.Text + "',";
                if (checktext.Length > 1)
                {
                    sql += " a.cln1_col16 = '" + checktext.Substring(1) + "',";
                }
                else
                {
                    sql += " a.cln1_col16 = '',";
                }
                sql += "     a.cln1_col17 = '" + TextAmount.Text + "',";
                sql += "     a.cln1_col19 = '" + TextReplaceAmount.Text + "',";   //置換量
                sql += "     a.cln1_col20 = '" + TextField12.Text + "',";
                sql += "     a.cln1_col21 = '" + TextField13.Text + "',";
                //sql += "     a.cln1_col22 = '" + TextField14.Text + "',";
                sql += "     a.cln1_col25 = '" + TextField131.Text + "',";
                sql += "     a.cln1_col23 = '" + TextArea1.Text + "',";
                sql += "     a.cln1_col26 = '" + Common.GetComboBoxText(cbo_mechine_model) + "', ";
                sql += "     a.cln1_col28 = '" + Common.GetComboBoxText(SelectBoxEPO) + "', ";
                sql += "     a.cln1_col29 = '" + Common.GetComboBoxText(SelectBoxLcard) + "', ";
                sql += "     a.cln1_col30 = '" + Common.GetComboBoxText(SelectBoxMecobalamin) + "', ";
                sql += "     a.cln1_col31 = '" + Common.GetComboBoxText(SelectBoxIron) + "', ";
                sql += "     a.cln1_col32 = '" + Common.GetComboBoxText(SelectBoxCalcitriol) + "', ";
                sql += "     a.cln1_col33 = '" + TextField23.Text + "',";
                if (cbo_hpack3.Text == "")
                {
                    sql += "a.cln1_col27 = '血管路', ";
                }
                else
                {
                    sql += "a.cln1_col27 = '" + Common.GetComboBoxText(cbo_hpack3) + "', ";
                }
                sql += "     a.cln1_col34 = '" + Common.GetComboBoxText(cbo_h_type) + "',";
                sql += "     a.cln1_col35 = '" + TextCln1_col35.Text + "',";
                //sql += "     a.cln1_col36 = '" + TextField25.Text + "',";
                sql += "     a.cln1_col37 = '" + Common.GetComboBoxText(SelectBoxSodium) + "', ";
                sql += "     a.cln1_col38 = '" + Common.GetComboBoxText(SelectBoxPotassium) + "', ";
                sql += "     a.cln1_user = '',";
                sql += "     a.cln1_dateadded = '' ";
                sql += "WHERE a.cln1_patic = '" + patient_id.Text + "' ";
                sql += "  AND a.cln1_diadate = '" + info_date1.Text + "' ";
                db.Excute(sql);

                //更新clinical1_nurse_xian
                sql  = "SELECT cln1_diadate FROM clinical1_nurse_xian ";
                sql += "WHERE cln1_patic = '" + patient_id.Text + "' AND cln1_diadate = '" + info_date1.Text + "' ";
                dt   = db.Query(sql);
                if (dt.Rows.Count > 0)
                {
                    sql  = "UPDATE clinical1_nurse_xian ";
                    sql += " SET cln1_col11 = '" + TextField2.Text + "',";
                    sql += "     cln1_col12 = '" + TextField4.Text + "',";
                    sql += "     cln1_col21 = '" + TextField9.Text + "',";
                    sql += "     cln1_col22 = '" + TextField10.Text + "', ";
                    sql += "     cln1_col31 = '" + TextField11.Text + "',";
                    sql += "     cln1_col32 = '" + TextField15.Text + "' ";
                    sql += "WHERE cln1_patic = '" + patient_id.Text + "' ";
                    sql += "  AND cln1_diadate = '" + info_date1.Text + "' ";
                }
                else
                {
                    sql  = "INSERT into clinical1_nurse_xian(cln1_patic,cln1_diadate,";
                    sql += "cln1_col11,cln1_col12,cln1_col21" + ",";
                    sql += "cln1_col22,cln1_col31,cln1_col32" + ") ";
                    sql += "VALUES('" + patient_id.Text + "','" + info_date1.Text + "','";
                    sql += TextField2.Text + "','" + TextField4.Text + "','" + TextField9.Text + "','";
                    sql += TextField10.Text + "','" + TextField11.Text + "','" + TextField15.Text + "')";
                }
                db.Excute(sql);

                //更新pat_info
                sql = "UPDATE pat_info " +
                      "SET pif_hpack='" + Common.GetComboBoxValue(cbo_h_type) + "', " +   //20160321 Alex
                      "pif_hpack2='" + Common.GetComboBoxValue(cbo_mechine_model) + "', " +
                      "pif_hpack3='" + Common.GetComboBoxValue(cbo_hpack3) + "' " +       //20160321 Alex
                      "WHERE pif_ic='" + patient_id.Text + "' ";
                db.Excute(sql);

                //更新pat_visit
                sql = "UPDATE pat_visit " +
                      "SET pv_macno='" + Common.GetComboBoxValue(cbo_dialysis_type) + "', " +
                      "pv_weight='" + txt_weight_before.Text + "', " +
                      "pv_hpack='" + Common.GetComboBoxValue(cbo_h_type) + "', " +       //20160321 Alex
                      "pv_hpack2='" + Common.GetComboBoxValue(cbo_mechine_model) + "', " +
                      "pv_hpack3='" + Common.GetComboBoxValue(cbo_hpack3) + "' " +       //20160321 Alex
                      "WHERE pv_ic='" + patient_id.Text + "' " +
                      "AND pv_datevisit='" + info_date1.Text + "' ";
                db.Excute(sql);


                sql  = "SELECT * FROM clinical3_nurse ";
                sql += " where cln3_patic = '" + patient_id.Text + "' ";
                sql += "  and cln3_date = '" + info_date1.Text + "' ";
                dt   = db.Query(sql);
                if (dt.Rows.Count > 0)
                {
                    sql  = "UPDATE clinical3_nurse ";
                    sql += "SET cln3_doc1 = '" + TextField23.Text + "', ";
                    sql += "    cln3_nur1 = '" + TextField13.Text + "' ";
                    sql += "WHERE cln3_patic = '" + patient_id.Text + "' ";
                    sql += "AND cln3_date = '" + info_date1.Text + "' ";
                }
                else
                {
                    sql  = "INSERT INTO clinical3_nurse(cln3_patic,cln3_date,cln3_doc1,cln3_nur1) ";
                    sql += "VALUES('" + patient_id.Text + "','" + info_date1.Text + "','" + TextField23.Text + "','" + TextField13.Text + "')";
                }

                CheckcboValue();
                Common._NotificationShow("<font size=4>储存成功!</font>");
            }
        }
        protected void cmdSAVE(object sender, DirectEventArgs e)
        {
            try {
                string SQLT_APPOINTMENT_SEL            = @"
                        SELECT apptst_patrefid, apptst_patic, apptst_daytyp FROM appointment_setup
                        WHERE apptst_flr='{0}' AND apptst_sec='{1}' AND apptst_bed='{2}' AND apptst_timetyp='{3}' and apptst_daytyp='{4}';";
                string SQLT_APPOINTMENT_CHANGE_SEL     = @"SELECT * FROM appointment_change
                                WHERE ah_date='{0}' AND ah_flr='{1}' AND ah_sec='{2}' AND ah_bed='{3}' AND ah_timetyp='{4}';";
                string SQLT_APPOINTMENT_CHANGE_UPDATE  = @"UPDATE appointment_change
                                SET ah_patic = '{0}'
                                WHERE ah_date='{1}' AND ah_flr='{2}' AND ah_sec='{3}' AND ah_bed='{4}' AND ah_timetyp='{5}';";
                string SQLT_APPOINTMENT_CHANGE_INSERT  = @"INSERT INTO appointment_change (ah_date, ah_patic, ah_flr, ah_sec, ah_bed, ah_mactyp, ah_timetyp, ah_stat, ah_dycnt)
                                VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', 'N', '{7}');";
                ChangeRecords <BedWeeklySchedule> recs = new StoreDataHandler(e.ExtraParams["data"]).BatchObjectData <BedWeeklySchedule>();

                foreach (BedWeeklySchedule curBed in recs.Updated)
                {
                    // analysis if patient changed from Monday to Sunday
                    int iweek = GetWeekNo() + 1;
                    for (int i = iweek; i <= 7; i++) //大於或等於今天日期才可以換床
                    {
                        BedWeeklySchedule.Patient TmpPatient = null;
                        BedWeeklySchedule.Patient newPatient = null;
                        switch (i)
                        {
                        case 1:
                            TmpPatient = curBed.Week1;
                            break;

                        case 2:
                            TmpPatient = curBed.Week2;
                            break;

                        case 3:
                            TmpPatient = curBed.Week3;
                            break;

                        case 4:
                            TmpPatient = curBed.Week4;
                            break;

                        case 5:
                            TmpPatient = curBed.Week5;
                            break;

                        case 6:
                            TmpPatient = curBed.Week6;
                            break;

                        case 7:
                            TmpPatient = curBed.Week7;
                            break;

                        default:
                            break;
                        }

                        if (TmpPatient.Name.Contains("(s)") == false)
                        {
                            newPatient = TmpPatient;
                            // original patient state before saving(combine patient in appointment_setup & appointment_change
                            // patient in appointment_setup table
                            string   oldPatientId  = null;
                            DateTime dtCurAnalysis = GetDateTimeFromDayType(i);
                            string   sql           = string.Format(SQLT_APPOINTMENT_SEL,
                                                                   curBed.Floor,
                                                                   curBed.Area,
                                                                   curBed.BedNo,
                                                                   curBed.TimeType,
                                                                   i.ToString()
                                                                   );
                            DataTable dtAppointSetup = db.Query(sql);

                            // patient in appointment_change table
                            string dateStringChange = GetDateTimeFromDayType(i).ToString("yyyy-MM-dd");
                            string sqlChange        = string.Format(SQLT_APPOINTMENT_CHANGE_SEL,
                                                                    dateStringChange,
                                                                    curBed.Floor,
                                                                    curBed.Area,
                                                                    curBed.BedNo,
                                                                    curBed.TimeType
                                                                    );
                            DataTable dtChange = db.Query(sqlChange);

                            // get real patient state here. (the state before saving)
                            DataRow drChg = null;
                            if (dtChange.Rows.Count > 0)
                            {
                                drChg        = dtChange.Rows[0];
                                oldPatientId = drChg["ah_patic"].ToString();
                            }
                            else
                            {
                                if (dtAppointSetup.Rows.Count > 0)
                                {
                                    oldPatientId = dtAppointSetup.Rows[0]["apptst_patic"].ToString();
                                }
                                else
                                {
                                    oldPatientId = "";  // no patient
                                }
                            }

                            // patient changed
                            if (newPatient.Id != oldPatientId)
                            {
                                // we already have record in the appointment change table
                                if (drChg != null)
                                {
                                    string sqlUpdate = string.Format(SQLT_APPOINTMENT_CHANGE_UPDATE,
                                                                     newPatient.Id,
                                                                     dateStringChange,
                                                                     curBed.Floor,
                                                                     curBed.Area,
                                                                     curBed.BedNo,
                                                                     curBed.TimeType);

                                    db.Excute(sqlUpdate);
                                }
                                else
                                {
                                    // not exist in appoint_change table, insert it
                                    string sqlInsert = string.Format(SQLT_APPOINTMENT_CHANGE_INSERT,
                                                                     dateStringChange,
                                                                     newPatient.Id,
                                                                     curBed.Floor,
                                                                     curBed.Area,
                                                                     curBed.BedNo,
                                                                     curBed.MachineType,
                                                                     curBed.TimeType,
                                                                     i.ToString());

                                    db.Excute(sqlInsert);
                                }
                            }
                        }
                    }
                }

                Load_Appointment();
            } catch (Exception ex) {
                Common._ErrorMsgShow(ex.Message.ToString());
            }
        }
Beispiel #7
0
        //2015.01.20 andy 短期醫囑:增加給藥方式 執行護士
        //2015.04.16 andy
        protected void Btn_save_drg_Click(object sender, DirectEventArgs e)
        {
            // DBMysql db = new DBMysql();
            string sql;
            string ildrgcode;

            //if (cbo_druggrp.Text == "" || cbo_druglist.Text == "" || txt_ordcount.Text == "" ||
            //    cmd_medway.Text == "" || cmb_ordfreq.Text == "" || txt_nuser_stfcode.Text == "")

            if (cbo_druggrp.Text == "" || cbo_druglist.Text == "" || txt_ordcount.Text == "" ||
                cmd_medway.Text == "" || cmb_ordfreq.Text == "")
            {
                Common._ErrorMsgShow("注意 : *注记为 '必填栏位' ");
                return;
            }


            string sql2 = "SELECT drg_code ";

            sql2 += "FROM drug_list ";
            sql2 += "WHERE drg_name = '" + cbo_druglist.Text + "'";

            DataTable dt2 = db.Query(sql2);

            if (dt2.Rows.Count != 0)
            {
                ildrgcode = dt2.Rows[0]["drg_code"].ToString();
            }
            else
            {
                ildrgcode = "";
            }


            //2015.01.20 04.22 andy 護士工號
            //string sql3 = "";
            //string wacclv_id = "";
            //sql3 = " select acclv_id from access_level where acclv_stfcode = '" + txt_nuser_stfcode.Text + "' ";
            //DataTable dt3 = db.Query(sql3);
            //if (dt3.Rows.Count != 0)
            //{
            //    wacclv_id = dt3.Rows[0]["acclv_id"].ToString();
            //}
            //else
            //{
            //    bs._ErrorMsgShow("注意.护士工号未填或不存在!");
            //    return;
            //}

            //2015.01.20 04.22 andy 護士工號
            //string sql5 = "";
            //sql5 = "SELECT  a.associate_id,a.associate_active";
            //sql5 += " FROM  associate_list a ";
            //sql5 += " WHERE a.associate_id     = '" + wacclv_id + "'";
            //sql5 += " AND   a.associate_active ='A" + "'";
            //DataTable dt5 = db.Query(sql5);
            //if (dt5.Rows.Count == 0)
            //{
            //    bs._NotificationShow("此工號已關閉,请重新输入!");
            //    return;
            //}


            //2015.01.20 andy 增加 給藥方式(med_medway) 執行護士(txt_nuser_stfcode):之前是傳空值 (護士姓名 與備註串一起)
            //txt_ordremark.Text = txt_ordremark.Text + "  ,護士姓名:" + txt_nuser_name.Text ;
            //txt_ordremark.Text = txt_ordremark.Text + "  " + txt_nuser_name.Text;
            txt_ordremark.Text = txt_ordremark.Text;

            sql  = "INSERT INTO shortterm_ordermgt(shord_patic,shord_dateord,shord_timeord,shord_usr1,shord_drug,shord_actst,shord_dtactst,shord_usr2,shord_comment,shord_intake,shord_freq,shord_nurs,shord_medway) ";
            sql += "VALUES('" + patient_id.Text + "','" + txt_orddate.Text + "','" + txt_ordtime.Text + "','" + txt_orddoc.Text;
            sql += "','" + ildrgcode + "','00001','','','" + txt_ordremark.Text + "','" + txt_ordcount.Text + "','" + cmb_ordfreq.Text + "','','" + cmd_medway.Text + "')";
            //sql += "','" + ildrgcode + "','00001','','','" + txt_ordremark.Text + "','" + txt_ordcount.Text + "','" + cmb_ordfreq.Text + "','" + txt_nuser_stfcode.Text + "','" + cmd_medway.Text + "')";
            db.Excute(sql);
            Show_shortdrughistory();
            txt_ordtime.Text   = DateTime.Now.ToString("HH:mm");
            txt_ordcount.Text  = "";
            txt_ordremark.Text = "";
            cmb_ordfreq.Text   = "";
        }
Beispiel #8
0
        protected void Btn_save_Click(object sender, DirectEventArgs e)
        {
            string sql = "SELECT a.* ", scln3_bld = "1";

            // 2015年7月27日 下午 01:20:23 svn Revision: 3122 當時或之前.
            // ipad 净化过程小结 與  pc版血透 myhaisv4 净化过程小结 各唱各的調
            // ipad 將 血压 寫在 clinical3_nurse 資料表 cln3_pressure 欄位
            // pc版血透myhaisv4 將 血压 寫在 clinical3_nurse 資料表 cln3_bld 欄位
            switch (Common.GetComboBoxText(cbo_pressure))
            {
            case "基本正常":
                scln3_bld = "1";
                break;

            case "较高":
                scln3_bld = "2";
                break;

            case "较低":
                scln3_bld = "3";
                break;

            default:
                throw new Exception("GetComboBoxText cbo_pressure failure");
            }

            sql += "  FROM clinical3_nurse a ";
            sql += " where a.cln3_patic = '" + patient_id.Text + "' ";
            sql += "  and a.cln3_date = '" + info_date1.Text + "' ";
            DataTable dt = db.Query(sql);

            if (dt.Rows.Count == 1)
            {
                sql  = "UPDATE clinical3_nurse b ";
                sql += "set b.cln3_date = '" + info_date1.Text + "',";
                sql += "  b.cln3_time = '" + ttt.Text + "',";
                sql += "  b.cln3_rmk = '" + TextField4.Text + "',";
                sql += "  b.cln3_a1 = '" + TextField5.Text + "',";
                sql += "  b.cln3_a2 = '" + TextField6.Text + "',";
                sql += "  b.cln3_b1 = '" + TextField7.Text + "',";
                sql += "  b.cln3_b2 = '" + TextField8.Text + "',";
                sql += "  b.cln3_ysa = '" + Common.GetComboBoxText(cbo_symptom) + "',";
                sql += "  b.cln3_pressure = '" + Common.GetComboBoxText(cbo_pressure) + "',";
                sql += "  b.cln3_bld = '";
                sql += scln3_bld;

                sql += "', ";
                sql += "    b.cln3_yn = '" + (Common.GetComboBoxText(cbo_symptom) == "无症状" ? "N" : "Y");
                sql += "', ";
                sql += "    b.cln3_rmk2 = '" + TextArea2.Text + "' ";
                //sql += "    b.cln3_doc1 = '" + TextField9.Text + "',";
                //sql += "    b.cln3_nur1 = '" + TextField10.Text + "' ";
                sql += " where b.cln3_patic = '" + patient_id.Text + "' ";
                sql += "   AND b.cln3_date = '" + info_date1.Text + "' ";
            }
            else
            {
                sql = "INSERT into clinical3_nurse(cln3_patic,cln3_date,cln3_time," +
                      "cln3_a1,cln3_a2,cln3_b1,cln3_b2," +
                      "cln3_CatheterAccess,cln3_MuscleAtrophy,cln3_ysa,cln3_pressure,cln3_DialysisMachine,cln3_HeparinPumpArtery,cln3_HeparinPumpVein," +
                      "cln3_bld,cln3_yn,cln3_rmk2,cln3_rmk) ";                            //
                sql += "VALUES('" + patient_id.Text + "','" + info_date1.Text + "','" + ttt.Text + "'," +
                       "'" + TextField5.Text + "','" + TextField6.Text + "','" + TextField7.Text + "','" + TextField8.Text + "'," +
                       "'',''," +
                       "'" + Common.GetComboBoxText(cbo_symptom) + "','" + Common.GetComboBoxText(cbo_pressure) + "'," +
                       "'','','','";
                sql += scln3_bld;
                sql += "','";
                sql += Common.GetComboBoxText(cbo_symptom) == "无症状" ? "N" : "Y";
                sql += "','" + TextArea2.Text + "','" + TextField4.Text + "')";
            }
            db.Excute(sql);
            Common._NotificationShow("储存成功!");
        }
Beispiel #9
0
        protected void Btn_save_Click(object sender, DirectEventArgs e)
        {
            string    sql;
            DataTable dt;

            if (cbo_mechine_model.Text.Trim() == "")
            {
                ErrorMsgShow("请输入透析器型号!");
                return;
            }
            else if (cbo_h_type.Text.Trim() == "")
            {
                Common._ErrorMsgShow("请输入血管通路!");
                return;
            }
            else
            {
                string checktext = ",";
                if (SelectBoxEPO.Text.Trim() != "")
                {
                    checktext += "EPO,";
                }
                if (SelectBoxLcard.Text.Trim() != "")
                {
                    checktext += "左卡,";
                }
                if (SelectBoxFe.Text.Trim() != "")
                {
                    checktext += "铁剂,";
                }
                if (SelectBoxCalcitriol.Text.Trim() != "")
                {
                    checktext += "骨化三醇,";
                }
                if (SelectBoxMethycobal.Text.Trim() != "")
                {
                    checktext += "弥可保,";
                }
                if (SelectBoxB12.Text.Trim() != "")
                {
                    checktext += "维生素B12";
                }

                sql  = "UPDATE clinical1_nurse a ";
                sql += " SET a.cln1_col1 = '" + Common.GetComboBoxText(cbo_diagnosis) + "',";
                sql += "     a.cln1_col2 = '" + bedno.Text + "',";
                sql += "     a.cln1_col3 = '" + cbo_dialysis_type.Text + "',";
                sql += "     a.cln1_col4 = '" + hpack.Text + "',";
                sql += "     a.cln1_col5 = '" + txt_weight_before.Text + "',";
                sql += "     a.cln1_col6 = '" + txt_weight_after_expect.Text + "',";
                sql += "     a.cln1_col7 = '" + TextField3.Text + "',";

                if (txt_weight_after.Text != "")
                {
                    sql += " a.cln1_col8 = '" + txt_weight_after.Text + "',";
                }

                sql += "     a.cln1_col9 = '" + info_date1.Text + "',";
                sql += "     a.cln1_col10 = '" + TextField5.Text + "',";
                sql += "     a.cln1_col11 = '" + TextField6.Text + "',";
                sql += "     a.cln1_col12 = '" + TextField7.Text + "',";
                sql += "     a.cln1_col13 = '" + TextField8.Text + "',";
                sql += "     a.cln1_col14 = '" + TextField9.Text + "',";
                sql += "     a.cln1_col15 = '" + TextField10.Text + "',";
                if (checktext.Length > 1)
                {
                    sql += " a.cln1_col16 = '" + checktext.Substring(1) + "',";
                }
                else
                {
                    sql += " a.cln1_col16 = '',";
                }
                sql += "     a.cln1_col28 = '" + SelectBoxEPO.Text + "',";
                sql += "     a.cln1_col29 = '" + SelectBoxLcard.Text + "',";
                sql += "     a.cln1_col30 = '" + SelectBoxFe.Text + "',";
                sql += "     a.cln1_col31 = '" + SelectBoxCalcitriol.Text + "',";
                sql += "     a.cln1_col32 = '" + SelectBoxMethycobal.Text + "',";
                sql += "     a.cln1_col37 = '" + SelectBoxB12.Text + "',";
                sql += "     a.cln1_col30q = 0,";
                sql += "     a.cln1_col31q = 0,";
                sql += "     a.cln1_col32q = 0,";

                sql += "     a.cln1_col17 = '" + cbo_SelDialysisNa.Text + "',";
                sql += "     a.cln1_col18 = '',";
                sql += "     a.cln1_col19 = '" + TextField11.Text + "',";
                sql += "     a.cln1_col20 = '',";
                sql += "     a.cln1_col21 = '" + TextField13.Text + "',";
                sql += "     a.cln1_col22 = '',";
                sql += "     a.cln1_col25 = '" + TextField131.Text + "',";
                sql += "     a.cln1_col23 = '" + TextArea1.Text + "',";
                sql += "     a.cln1_col26 = '" + Common.GetComboBoxText(cbo_mechine_model) + "', ";
                sql += "     a.cln1_col33 = '" + TextField23.Text + "',";
                if (cbo_hpack3.Text == "")
                {
                    sql += "a.cln1_col27 = '血管路', ";
                }
                else
                {
                    sql += "a.cln1_col27 = '" + Common.GetComboBoxText(cbo_hpack3) + "', ";
                }
                sql += "     a.cln1_col34 = '" + Common.GetComboBoxText(cbo_h_type) + "',";
                sql += "     a.cln1_col35 = '" + TextField24.Text + "',";
                sql += "     a.cln1_col36 = '',";
                sql += "     a.cln1_user = '',";
                sql += "     a.cln1_dateadded = '" + TextTotalCap.Text + "' ";
                sql += "WHERE a.cln1_patic = '" + patient_id.Text + "' ";
                sql += "  AND a.cln1_diadate = '" + info_date1.Text + "' ";
                db.Excute(sql);

                //更新pat_info
                sql = "UPDATE pat_info " +
                      "SET pif_hpack='" + Common.GetComboBoxValue(cbo_h_type) + "', " +    //20160321 Alex
                      "pif_hpack2='" + Common.GetComboBoxValue(cbo_mechine_model) + "', " +
                      "pif_hpack3='" + Common.GetComboBoxValue(cbo_hpack3) + "' " +        //20160321 Alex
                      "WHERE pif_ic='" + patient_id.Text + "' ";
                db.Excute(sql);

                //更新pat_visit
                sql = "UPDATE pat_visit " +
                      "SET pv_macno='" + Common.GetComboBoxValue(cbo_dialysis_type) + "', " + //透析方式
                      "pv_weight='" + txt_weight_before.Text + "', " +
                      "pv_hpack='" + Common.GetComboBoxValue(cbo_h_type) + "', " +            //20160321 Alex
                      "pv_hpack2='" + Common.GetComboBoxValue(cbo_mechine_model) + "', " +
                      "pv_hpack3='" + Common.GetComboBoxValue(cbo_hpack3) + "' " +            //20160321 Alex
                      "WHERE pv_ic='" + patient_id.Text + "' " +
                      "AND pv_datevisit='" + info_date1.Text + "' ";
                db.Excute(sql);


                sql  = "SELECT * FROM clinical3_nurse ";
                sql += " where cln3_patic = '" + patient_id.Text + "' ";
                sql += "  and cln3_date = '" + info_date1.Text + "' ";
                dt   = db.Query(sql);
                if (dt.Rows.Count > 0)
                {
                    sql  = "UPDATE clinical3_nurse SET ";
                    sql += "cln3_CatheterAccess = '" + TextFieldCatheterAccess.Text + "',";
                    sql += "cln3_MuscleAtrophy = '" + TextFieldMuscleAtrophy.Text + "',";
                    sql += "cln3_DialysisMachine = '" + Common.GetComboBoxText(cbo_DialysisMachine) + "',";
                    sql += "cln3_HeparinPumpArtery = '" + Common.GetComboBoxText(cbo_HeparinPump_a) + "',";
                    sql += "cln3_HeparinPumpVein = '" + Common.GetComboBoxText(cbo_HeparinPump_v) + "' ";
                    sql += "WHERE cln3_patic = '" + patient_id.Text + "' AND cln3_date='" + info_date1.Text + "' ";
                }
                else
                {
                    sql  = "INSERT INTO clinical3_nurse(cln3_patic, cln3_date, cln3_CatheterAccess, cln3_MuscleAtrophy, cln3_DialysisMachine, cln3_HeparinPumpArtery, cln3_HeparinPumpVein) ";
                    sql += "VALUES('" + patient_id.Text + "','" + info_date1.Text + "',";
                    sql += "'" + TextFieldCatheterAccess.Text + "',";
                    sql += "'" + TextFieldMuscleAtrophy.Text + "',";
                    sql += "'" + Common.GetComboBoxText(cbo_DialysisMachine) + "',";
                    sql += "'" + Common.GetComboBoxText(cbo_HeparinPump_a) + "',";
                    sql += "'" + Common.GetComboBoxText(cbo_HeparinPump_v) + "')";
                }
                db.Excute(sql);

                CheckcboValue();
                Common._NotificationShow("<font size=4>储存成功!</font>");
                db.myConnection.Close();
            }
        }
Beispiel #10
0
        protected void Btn_save_Click(object sender, DirectEventArgs e)
        {
            string    sql;
            DataTable dt;

            if (cbo_mechine_model.Text.Trim() == "")
            {
                Common._ErrorMsgShow("请输入透析器型号!");
                return;
            }
            else if (cbo_h_type.Text.Trim() == "")
            {
                Common._ErrorMsgShow("请输入血管通路!");
                return;
            }
            else
            {
                try //深静脉置管
                {
                    if (Radio11.Checked == true)
                    {
                        Col11     = Radio11.InputValue;
                        coltext11 = "";
                    }
                    else if (Radio12.Checked == true)
                    {
                        Col11     = Radio12.InputValue;
                        coltext11 = "";
                    }
                    else if (Radio13.Checked == true)
                    {
                        Col11     = Radio13.InputValue;
                        coltext11 = RField1.Text;
                    }

                    if (Radio21.Checked == true)
                    {
                        Col21     = Radio21.InputValue;
                        coltext21 = "";
                    }
                    else if (Radio22.Checked == true)
                    {
                        Col21     = Radio22.InputValue;
                        coltext21 = RField2.Text;
                    }

                    if (Radio31.Checked == true)
                    {
                        Col31     = Radio31.InputValue;
                        coltext31 = "";
                    }
                    else if (Radio32.Checked == true)
                    {
                        Col31     = Radio32.InputValue;
                        coltext31 = RField3.Text;
                    }

                    if (Radio41.Checked == true)
                    {
                        Col41     = Radio41.InputValue;
                        coltext41 = "";
                    }
                    else if (Radio42.Checked == true)
                    {
                        Col41     = Radio42.InputValue;
                        coltext41 = RField4.Text;
                    }

                    if (Radio51.Checked == true)
                    {
                        Col50 = Radio51.InputValue;
                    }
                    else if (Radio52.Checked == true)
                    {
                        Col50 = Radio52.InputValue;
                    }

                    //DBMysql db = new DBMysql();
                    sql  = "SELECT cln1_diadate FROM clinical1_nurse_suzhou ";
                    sql += "WHERE cln1_patic = '" + patient_id.Text + "' AND cln1_diadate = '" + info_date1.Text + "' ";
                    dt   = db.Query(sql);
                    if (dt.Rows.Count > 0)
                    {
                        sql  = "UPDATE clinical1_nurse_suzhou SET ";
                        sql += "cln1_col11 = '" + Col11 + "',";
                        sql += "cln1_col12 = '" + coltext11 + "',";
                        sql += "cln1_col21 = '" + Col21 + "',";
                        sql += "cln1_col22 = '" + coltext21 + "',";
                        sql += "cln1_col31 = '" + Col31 + "',";
                        sql += "cln1_col32 = '" + coltext31 + "',";
                        sql += "cln1_col41 = '" + Col41 + "',";
                        sql += "cln1_col42 = '" + coltext41 + "',";
                        sql += "cln1_col50 = '" + Col50 + "' ";
                        sql += "WHERE cln1_patic = '" + patient_id.Text + "' AND cln1_diadate = '" + info_date1.Text + "' ";
                    }
                    else
                    {
                        sql  = "INSERT INTO clinical1_nurse_suzhou (cln1_patic, cln1_diadate,";
                        sql += "cln1_col11, cln1_col12, cln1_col21, cln1_col22, cln1_col31, cln1_col32, cln1_col41, cln1_col42, cln1_col50) ";
                        sql += "VALUES('" + patient_id.Text + "','" + info_date1.Text + "',";
                        sql += "'" + Col11 + "','" + coltext11 + "',";
                        sql += "'" + Col21 + "','" + coltext21 + "',";
                        sql += "'" + Col31 + "','" + coltext31 + "',";
                        sql += "'" + Col41 + "','" + coltext41 + "',";
                        sql += "'" + Col50 + "')";
                    }
                    db.Excute(sql); //深静脉置管
                }
                catch               //深静脉置管,儲存失敗
                {
                }

                if (TextCheckbox3q.Text == "")
                {
                    TextCheckbox3q.Text = "0";
                }
                if (TextCheckbox4q.Text == "")
                {
                    TextCheckbox4q.Text = "0";
                }
                if (TextCheckbox5q.Text == "")
                {
                    TextCheckbox5q.Text = "0";
                }
                string checktext = ",";
                if (Checkbox1.Checked == true && SelectBoxEPO.Text != "")
                {
                    checktext += "EPO,";
                }
                if (Checkbox2.Checked == true && TextCheckbox2.Text != "" && TextCheckbox2.Text != "0")
                {
                    checktext += "左卡,";
                }
                if (Checkbox3.Checked == true && SelectCheckbox3.Text != "")
                {
                    checktext += "钙剂,";
                }
                if (Checkbox4.Checked == true && SelectCheckbox4.Text != "")
                {
                    checktext += "稀释液,";
                }
                if (Checkbox5.Checked == true && SelectCheckbox5.Text != "")
                {
                    checktext += "其它";
                }
                sql  = "UPDATE clinical1_nurse a ";
                sql += " SET a.cln1_col1 = '" + Common.GetComboBoxText(cbo_diagnosis) + "',";
                sql += "     a.cln1_col2 = '" + bedno.Text + "',";
                sql += "     a.cln1_col3 = '" + cbo_dialysis_type.Text + "',";
                sql += "     a.cln1_col4 = '" + hpack.Text + "',";
                sql += "     a.cln1_col5 = '" + txt_weight_before.Text + "',";
                sql += "     a.cln1_col6 = '" + txt_weight_after_expect.Text + "',";
                sql += "     a.cln1_col7 = '" + TextField3.Text + "',";

                if (txt_weight_after.Text != "")
                {
                    sql += "     a.cln1_col8 = '" + txt_weight_after.Text + "',";
                }

                sql += "     a.cln1_col9 = '" + info_date1.Text + "',";
                sql += "     a.cln1_col10 = '" + TextField5.Text + "',";
                sql += "     a.cln1_col11 = '" + TextField6.Text + "',";
                sql += "     a.cln1_col12 = '" + TextField7.Text + "',";
                sql += "     a.cln1_col13 = '" + TextField8.Text + "',";
                sql += "     a.cln1_col14 = '" + TextField9.Text + "',";
                sql += "     a.cln1_col15 = '" + TextField10.Text + "',";
                if (checktext.Length > 1)
                {
                    sql += " a.cln1_col16 = '" + checktext.Substring(1) + "',";
                }
                else
                {
                    sql += " a.cln1_col16 = '',";
                }
                sql += "     a.cln1_col28 = '" + SelectBoxEPO.Text.Replace("'", "''") + "',";
                sql += "     a.cln1_col29 = '" + TextCheckbox2.Text + "',";
                sql += "     a.cln1_col30 = '" + SelectCheckbox3.Text + "',";
                sql += "     a.cln1_col31 = '" + SelectCheckbox4.Text + "',";
                sql += "     a.cln1_col32 = '" + SelectCheckbox5.Text + "',";
                if (TextCheckbox3q.Text == "")
                {
                    TextCheckbox3q.Text = "0";
                }
                if (TextCheckbox4q.Text == "")
                {
                    TextCheckbox4q.Text = "0";
                }
                if (TextCheckbox5q.Text == "")
                {
                    TextCheckbox5q.Text = "0";
                }
                sql += "     a.cln1_col30q = " + TextCheckbox3q.Text + ",";
                sql += "     a.cln1_col31q = " + TextCheckbox4q.Text + ",";
                sql += "     a.cln1_col32q = " + TextCheckbox5q.Text + ",";

                sql += "     a.cln1_col17 = '" + SelectBox3.Text + "',";
                sql += "     a.cln1_col18 = '" + Common.GetComboBoxText(cbo_change_type) + "',";
                sql += "     a.cln1_col19 = '" + TextField11.Text + "',";
                sql += "     a.cln1_col20 = '" + TextField12.Text + "',";
                sql += "     a.cln1_col21 = '" + TextField13.Text + "',";
                sql += "     a.cln1_col22 = '" + TextField14.Text + "',";
                sql += "     a.cln1_col25 = '" + TextField131.Text + "',";
                sql += "     a.cln1_col23 = '" + TextArea1.Text + "',";
                sql += "     a.cln1_col26 = '" + Common.GetComboBoxText(cbo_mechine_model) + "', ";
                sql += "     a.cln1_col33 = '" + TextField23.Text + "',";
                if (cbo_hpack3.Text == "")
                {
                    sql += "a.cln1_col27 = '血管路', ";
                }
                else
                {
                    sql += "a.cln1_col27 = '" + Common.GetComboBoxText(cbo_hpack3) + "', ";
                }
                sql += "     a.cln1_col34 = '" + Common.GetComboBoxText(cbo_h_type) + "',";
                sql += "     a.cln1_col35 = '" + TextField24.Text + "',";
                sql += "     a.cln1_col36 = '" + TextField25.Text + "',";
                sql += "     a.cln1_user = '',";
                sql += "     a.cln1_dateadded = ''";
                sql += "WHERE a.cln1_patic = '" + patient_id.Text + "' ";
                sql += "  AND a.cln1_diadate = '" + info_date1.Text + "' ";
                db.Excute(sql);

                //更新pat_info
                sql = "UPDATE pat_info " +
                      "SET pif_hpack='" + Common.GetComboBoxValue(cbo_h_type) + "', " +    //20160321 Alex
                      "pif_hpack2='" + Common.GetComboBoxValue(cbo_mechine_model) + "', " +
                      "pif_hpack3='" + Common.GetComboBoxValue(cbo_hpack3) + "' " +        //20160321 Alex
                      "WHERE pif_ic='" + patient_id.Text + "' ";
                db.Excute(sql);

                //更新pat_visit
                sql = "UPDATE pat_visit " +
                      "SET pv_macno='" + Common.GetComboBoxValue(cbo_dialysis_type) + "', " +
                      "pv_weight='" + txt_weight_before.Text + "', " +
                      "pv_hpack='" + Common.GetComboBoxValue(cbo_h_type) + "', " +        //20160321 Alex
                      "pv_hpack2='" + Common.GetComboBoxValue(cbo_mechine_model) + "', " +
                      "pv_hpack3='" + Common.GetComboBoxValue(cbo_hpack3) + "' " +        //20160321 Alex
                      "WHERE pv_ic='" + patient_id.Text + "' " +
                      "AND pv_datevisit='" + info_date1.Text + "' ";
                db.Excute(sql);


                sql  = "SELECT * FROM clinical3_nurse ";
                sql += " where cln3_patic = '" + patient_id.Text + "' ";
                sql += "  and cln3_date = '" + info_date1.Text + "' ";
                dt   = db.Query(sql);
                if (dt.Rows.Count > 0)
                {
                    sql  = "UPDATE clinical3_nurse ";
                    sql += "SET cln3_doc1 = '" + TextField23.Text + "', ";
                    sql += "    cln3_nur1 = '" + TextField25.Text + "' ";
                    sql += "WHERE cln3_patic = '" + patient_id.Text + "' ";
                    sql += "AND cln3_date = '" + info_date1.Text + "' ";
                }
                else
                {
                    sql  = "INSERT INTO clinical3_nurse(cln3_patic,cln3_date,cln3_doc1,cln3_nur1) ";
                    sql += "VALUES('" + patient_id.Text + "','" + info_date1.Text + "','" + TextField23.Text + "','" + TextField25.Text + "')";
                }

                CheckcboValue();
                Common._NotificationShow("<font size=4>储存成功!</font>");
            }
        }
Beispiel #11
0
        protected void Btn_save_Click(object sender, DirectEventArgs e)
        {
            string    sql;
            DataTable dt;

            if (cbo_mechine_model.Text.Trim() == "")
            {
                Common._ErrorMsgShow("请输入透析器型号!");
                return;
            }
            else if (cbo_h_type.Text.Trim() == "")
            {
                Common._ErrorMsgShow("请输入血管通路!");
                return;
            }

            string checktext = ",";

            if (Checkbox1.Checked == true)
            {
                checktext += "EPO,";
            }
            if (Checkbox2.Checked == true)
            {
                checktext += "左卡,";
            }
            if (Checkbox3.Checked == true)
            {
                checktext += "铁剂,";
            }
            if (Checkbox4.Checked == true)
            {
                checktext += "钙剂,";
            }
            if (Checkbox5.Checked == true)
            {
                checktext += "抗菌素/其它";
            }

            sql  = "SELECT a.cln1_diadate FROM clinical1_nurse a ";
            sql += "WHERE a.cln1_patic = '" + patient_id.Text + "' AND a.cln1_diadate = '" + info_date1.Text + "' ";
            dt   = db.Query(sql);
            if (dt.Rows.Count > 0)
            {
                sql  = "UPDATE clinical1_nurse a ";
                sql += " SET a.cln1_col1 = '" + Common.GetComboBoxText(cbo_diagnosis) + "',";
                sql += "     a.cln1_col2 = '" + bedno.Text + "',";
                sql += "     a.cln1_col3 = '" + machine_type.Text + "',";
                sql += "     a.cln1_col4 = '" + hpack.Text + "',";
                sql += "     a.cln1_col5 = '" + txt_weight_before.Text + "',";
                sql += "     a.cln1_col6 = '" + txt_weight_after_expect.Text + "',";
                sql += "     a.cln1_col7 = '" + TextField3.Text + "',";

                if (txt_weight_after.Text != "")
                {
                    sql += "     a.cln1_col8 = '" + txt_weight_after.Text + "',";
                }

                sql += "     a.cln1_col9 = '" + info_date1.Text + "',";
                sql += "     a.cln1_col10 = '" + TextField5.Text + "',";
                sql += "     a.cln1_col11 = '" + TextField6.Text + "',";
                sql += "     a.cln1_col12 = '" + TextField7.Text + "',";
                sql += "     a.cln1_col13 = '" + TextField8.Text + "',";
                sql += "     a.cln1_col14 = '" + TextField9.Text + "',";
                sql += "     a.cln1_col15 = '" + TextField10.Text + "',";
                if (checktext.Length > 1)
                {
                    sql += " a.cln1_col16 = '" + checktext.Substring(1) + "',";
                }
                else
                {
                    sql += " a.cln1_col16 = '',";
                }
                sql += "     a.cln1_col28 = '',";
                sql += "     a.cln1_col29 = '',";
                sql += "     a.cln1_col30 = '',";
                sql += "     a.cln1_col31 = '',";
                sql += "     a.cln1_col32 = '" + TextCheckbox5.Text + "',";
                sql += "     a.cln1_col30q = 0,";
                sql += "     a.cln1_col31q = 0,";
                sql += "     a.cln1_col32q = 0,";

                sql += "     a.cln1_col17 = '" + SelectBox3.Text + "',";
                sql += "     a.cln1_col18 = '" + Common.GetComboBoxText(cbo_change_type) + "',";
                sql += "     a.cln1_col19 = '" + TextField11.Text + "',";
                sql += "     a.cln1_col20 = '" + TextField12.Text + "',";
                sql += "     a.cln1_col21 = '" + TextField13.Text + "',";
                sql += "     a.cln1_col22 = '',";
                sql += "     a.cln1_col25 = '" + TextField131.Text + "',";
                sql += "     a.cln1_col23 = '" + TextArea1.Text + "',";
                sql += "     a.cln1_col26 = '" + Common.GetComboBoxText(cbo_mechine_model) + "', ";
                sql += "     a.cln1_col33 = '" + TextField23.Text + "',";
                if (cbo_hpack3.Text == "")
                {
                    sql += "a.cln1_col27 = '血管路', ";
                }
                else
                {
                    sql += "a.cln1_col27 = '" + Common.GetComboBoxText(cbo_hpack3) + "', ";
                }
                sql += "     a.cln1_col34 = '" + Common.GetComboBoxText(cbo_h_type) + "',";
                sql += "     a.cln1_col35 = '" + TextField24.Text + "',";
                sql += "     a.cln1_col36 = '" + TextField25.Text + "',";
                sql += "     a.cln1_user = '',";
                sql += "     a.cln1_dateadded = ''";
                sql += "WHERE a.cln1_patic = '" + patient_id.Text + "' ";
                sql += "  AND a.cln1_diadate = '" + info_date1.Text + "' ";
            }
            else
            {
                sql  = "INSERT into clinical1_nurse(cln1_patic,cln1_diadate,";
                sql += "cln1_col1,cln1_col2,cln1_col3,cln1_col4,cln1_col5,";

                sql += "cln1_col6,cln1_col7,cln1_col8,cln1_col9,cln1_col10,";
                sql += "cln1_col11,cln1_col12,cln1_col13,cln1_col14,cln1_col15,";
                sql += "cln1_col16,cln1_col17,cln1_col18,cln1_col19,cln1_col20,";

                sql += "cln1_col21,cln1_col22,cln1_col23,cln1_col24,cln1_col25,";
                sql += "cln1_col26,cln1_col27,";
                sql += "cln1_col28,cln1_col29,cln1_col30,cln1_col31,cln1_col32, cln1_col30q,cln1_col31q,cln1_col32q,"; //加上數量
                sql += "cln1_col33,cln1_col34,cln1_col35,";
                sql += "cln1_col36,cln1_user,cln1_dateadded) ";
                sql += "VALUES('" + patient_id.Text + "','" + info_date1.Text + "','";
                sql += Common.GetComboBoxText(cbo_diagnosis) + "','" + bedno.Text + "','" + machine_type.Text + "','" + hpack.Text + "','" + txt_weight_before.Text + "','";
                //sql += Common.GetComboBoxText(cbo_diagnosis) + "','" + bedno.Text + "','" + machine_type.Text + "','" + txt_weight_before.Text + "','";
                sql += txt_weight_after_expect.Text + "','" + TextField3.Text + "','" + txt_weight_after.Text + "','" + info_date1.Text + "','" + TextField5.Text + "','";
                sql += TextField6.Text + "','" + TextField7.Text + "','" + TextField8.Text + "','" + TextField9.Text + "','" + TextField10.Text + "','";
                sql += checktext.Substring(1); //cln1_col16
                sql += "','" + SelectBox3.Text + "','" + Common.GetComboBoxText(cbo_change_type) + "','" + TextField11.Text + "','" + TextField12.Text + "',";

                sql += "'" + TextField13.Text + "','','" + TextArea1.Text + "','','',";
                sql += "'" + Common.GetComboBoxText(cbo_mechine_model) + "','" + Common.GetComboBoxText(cbo_hpack3) + "',";
                //擬用藥 EPO...Value
                sql += "'','','','','" + TextCheckbox5.Text + "',0,0,0,";
                //擬用藥
                sql += "'" + TextField23.Text + "','" + Common.GetComboBoxText(cbo_h_type) + "','" + TextField24.Text + "',";
                sql += "'" + TextField25.Text + "','','')";
            }
            db.Excute(sql);

            //更新pat_info
            sql = "UPDATE pat_info " +
                  "SET pif_hpack='" + Common.GetComboBoxValue(cbo_h_type) + "', " +       //20160321 Alex
                  "pif_hpack2='" + Common.GetComboBoxValue(cbo_mechine_model) + "', " +
                  "pif_hpack3='" + Common.GetComboBoxValue(cbo_hpack3) + "' " +           //20160321 Alex
                  "WHERE pif_ic='" + patient_id.Text + "' ";
            db.Excute(sql);

            //更新pat_visit
            sql = "UPDATE pat_visit " +
                  "SET pv_macno='" + Common.GetComboBoxValue(cbo_dialysis_type) + "', " +
                  "pv_weight='" + txt_weight_before.Text + "', " +
                  "pv_hpack='" + Common.GetComboBoxValue(cbo_h_type) + "', " +           //20160321 Alex
                  "pv_hpack2='" + Common.GetComboBoxValue(cbo_mechine_model) + "', " +
                  "pv_hpack3='" + Common.GetComboBoxValue(cbo_hpack3) + "' " +           //20160321 Alex
                  "WHERE pv_ic='" + patient_id.Text + "' " +
                  "AND pv_datevisit='" + info_date1.Text + "' ";
            db.Excute(sql);


            sql  = "SELECT * FROM clinical3_nurse ";
            sql += " where cln3_patic = '" + patient_id.Text + "' ";
            sql += "  and cln3_date = '" + info_date1.Text + "' ";
            dt   = db.Query(sql);
            if (dt.Rows.Count > 0)
            {
                sql  = "UPDATE clinical3_nurse ";
                sql += "SET cln3_doc1 = '" + TextField23.Text + "', ";
                sql += "    cln3_nur1 = '" + TextField25.Text + "' ";
                sql += "WHERE cln3_patic = '" + patient_id.Text + "' ";
                sql += "AND cln3_date = '" + info_date1.Text + "' ";
            }
            else
            {
                sql  = "INSERT INTO clinical3_nurse(cln3_patic,cln3_date,cln3_doc1,cln3_nur1) ";
                sql += "VALUES('" + patient_id.Text + "','" + info_date1.Text + "','" + TextField23.Text + "','" + TextField25.Text + "')";
            }

            CheckcboValue();
            Common._NotificationShow("<font size=4>储存成功!</font>");
        }
        protected void SaveDataList(object sender, DirectEventArgs e)
        {
            string PationID     = e.ExtraParams["PationID"];
            string DialysisDate = e.ExtraParams["DialysisDate"];
            string DialysisTime = e.ExtraParams["DialysisTime"];
            string sql1         = "";
            string sql0         = "SELECT dialysis_time, column_7, column_6, column_2, column_3, column_10, column_8, column_4 FROM data_list ";

            sql0 += "WHERE person_id='" + PationID + "' ";
            sql0 += "AND dialysis_date='" + DialysisDate + "' ";
            sql0 += "AND dialysis_time='" + OldTime.Text + "'";
            DataTable dt0 = db.Query(sql0);

            if (dt0.Rows.Count > 0)
            {
                sql1 += "UPDATE data_list SET ";
                sql1 += "dialysis_time='" + DialysisTime + "', ";
                sql1 += "column_7='" + diagno.Text + "', ";
                sql1 += "column_6='" + Column4.Text + "', ";
                sql1 += "column_2='" + Column2.Text + "', ";
                sql1 += "column_3='" + Column23.Text + "', ";
                sql1 += "column_10='" + Column3.Text + "', ";
                sql1 += "column_8='" + Column1.Text + "', ";
                sql1 += "column_4='" + Column5.Text + "' ";
                sql1 += "WHERE person_id='" + PationID + "' ";
                sql1 += "AND dialysis_date='" + DialysisDate + "' ";
                sql1 += "AND dialysis_time='" + OldTime.Text + "'; ";
            }
            else
            {
                dt0.Clear();
                sql0  = "SELECT pv_floor, pv_bedno FROM pat_visit ";
                sql0 += "WHERE pv_ic='" + PationID + "' ";
                sql0 += "AND pv_datevisit='" + DialysisDate + "' ";
                dt0   = db.Query(sql0);
                string pv_floor = dt0.Rows[0]["pv_floor"].ToString();
                string pv_bedno = dt0.Rows[0]["pv_bedno"].ToString();

                sql1 += "INSERT INTO data_list ";
                sql1 += "(person_id, dialysis_date, dialysis_time, floor_no, bed_no, column_7, column_6, column_2, column_10, column_8, column_4) ";
                sql1 += "VALUES('" + PationID + "','" + DialysisDate + "','" + DialysisTime + "','" + pv_floor + "','" + pv_bedno + "','";
                sql1 += diagno.Text + "','" + Column4.Text + "','" + Column2.Text + "','";
                sql1 += Column3.Text + "','" + Column1.Text + "','" + Column5.Text + "'); ";
            }

            sql0  = "SELECT cln2_date, cln2_time, cln2_t, cln2_p, cln2_r, cln2_bp, cln2_rmk, cln2_user, cln2_dateadded FROM clinical2_nurse ";
            sql0 += "WHERE cln2_patic='" + PationID + "' ";
            sql0 += "AND cln2_date='" + DialysisDate + "' ";
            sql0 += "AND cln2_time='" + OldTime.Text + "'";
            dt0   = db.Query(sql0);
            if (dt0.Rows.Count > 0)
            {
                sql1 += "UPDATE clinical2_nurse SET ";
                sql1 += "cln2_time='" + DialysisTime + "', ";
                sql1 += "cln2_t='" + Column6.Text + "', ";
                sql1 += "cln2_p='" + Column7.Text + "', ";
                sql1 += "cln2_r='" + Column8.Text + "', ";
                sql1 += "cln2_bp='" + Column9.Text + "', ";
                sql1 += "cln2_rmk='" + Column10.Text + "', ";
                sql1 += "cln2_user='******' ";
                sql1 += "WHERE cln2_patic='" + PationID + "' ";
                sql1 += "AND cln2_date='" + DialysisDate + "' ";
                sql1 += "AND cln2_time='" + OldTime.Text + "';";
            }
            else
            {
                sql1 += "INSERT INTO clinical2_nurse ";
                sql1 += "(cln2_patic, cln2_date, cln2_time, cln2_t, cln2_p, cln2_r, cln2_bp, cln2_rmk, cln2_user) ";
                sql1 += "VALUES('" + PationID + "','" + DialysisDate + "','" + DialysisTime + "','";
                sql1 += Column6.Text + "','" + Column7.Text + "','" + Column8.Text + "','" + Column9.Text + "','";
                sql1 += Column10.Text + "','" + Column11.Text + "')";
            }
            db.Excute(sql1);

            this.DetailsWindow.Hide();
            GridStore.Reload();
        }
        protected void Btn_Submit_Click(object sender, DirectEventArgs e)
        {
            DBMysql db        = new DBMysql();
            string  checktext = "";

            if (Checkbox1.Checked == true)
            {
                checktext += ",EPO";
            }
            if (Checkbox2.Checked == true)
            {
                checktext += ",左卡";
            }
            if (Checkbox3.Checked == true)
            {
                checktext += ",铁剂";
            }
            if (Checkbox4.Checked == true)
            {
                checktext += ",钙剂";
            }
            if (Checkbox5.Checked == true)
            {
                checktext += ",抗菌素/其它";
            }

            string sql = "update clinical1_nurse a,pat_info b ";

            sql += "set a.cln1_col1 = '" + SelectBox1.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col2 = '" + TextField2.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col3 = '" + TextField3.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col34 = '" + TextField4.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col5 = '" + TextField5.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col6 = '" + TextField6.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col7 = '" + TextField7.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col8 = '" + TextField8.Text.Replace("'", "''") + "',";
            //sql += "a.cln1_col9 = '" + TextField9.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col10 = '" + TextField10.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col11 = '" + TextField11.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col12 = '" + TextField12.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col13 = '" + TextField13.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col14 = '" + TextField14.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col15 = '" + TextField15.Text.Replace("'", "''") + "',";
            if (checktext.Length > 1)
            {
                sql += "a.cln1_col16 = '" + checktext.Substring(1) + "',";
            }
            else
            {
                sql += "a.cln1_col16 = '',";
            }
            sql += "a.cln1_col28 = '" + TextCheckbox1.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col29 = '" + TextCheckbox2.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col30 = '" + TextCheckbox3.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col31 = '" + TextCheckbox4.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col32 = '" + TextCheckbox5.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col17 = '" + SelectBox3.Text + "',";
            sql += "a.cln1_col18 = '" + SelectBox4.Text + "',";
            sql += "a.cln1_col19 = '" + TextField18.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col20 = '" + TextField19.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col21 = '" + TextField20.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col22 = '" + TextField21.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col35 = '" + TextField17.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col36 = '" + TextField22.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col33 = '" + TextField23.Text.Replace("'", "''") + "',";
            sql += "a.cln1_col23 = '" + TextArea1.Text.Replace("'", "''") + "' ";
            sql += " WHERE b.pif_id = '" + _PAT_ID + "' ";
            sql += " AND a.cln1_patic = b.pif_ic ";
            sql += " AND a.cln1_diadate = '" + TextField9.Text + "' ";
            db.Excute(sql);
            Panel1.Hidden = true;

            Grid_clinical1_nurse.Hidden = false;
            show_grid();



            //增加一筆常規記錄zinfo_e_01 Andy 20150601
            //1.hpack2_setup    透析機器型號設置
            //2.clinical1_nurs  血液淨化紀錄
            //3.clinical2_nurse 血液淨化過程明細
            //4.a_result_log    檢驗記錄檔

            //1.透析機器型號設置 hp2_id資料序號:key 自動
            DataTable dt;
            string    sSQL     = "";
            string    w_opt_11 = "";
            string    w_pif_ic = "";

            sSQL = "SELECT * FROM pat_info " +
                   "LEFT JOIN hpack2_setup " +
                   "ON    pat_info.pif_hpack2 = hpack2_setup.hp2_code " +
                   "WHERE pif_id=" + _PAT_ID + " ";
            dt = new DataTable();
            dt = db.Query(sSQL);
            if (dt.Rows.Count > 0)
            {
                //透析器名稱 hp2_name
                w_opt_11 = dt.Rows[0]["hp2_name"].ToString();
                w_pif_ic = dt.Rows[0]["pif_ic"].ToString();
            }
            dt.Dispose();


            //2.clinical1_nurs  血液淨化紀錄
            //cli_id淨化流水號 :key 自動
            //病人身分證號 cln1_patic + 日期cln1_diadate
            string winfo_date = _Get_YMD(TextField9.Text);
            string w_opt_7    = "";
            string w_num_13   = "";
            string w_num_8    = "";
            string w_num_9    = "";
            string w_num_10   = "";

            sSQL = "SELECT * FROM clinical1_nurse WHERE cln1_patic='" + w_pif_ic + "' AND cln1_diadate='" + TextField9.Text + "' ";
            dt   = new DataTable();
            dt   = db.Query(sSQL);
            if (dt.Rows.Count > 0)
            {
                //血管通路類型 cln1_col4
                w_opt_7 = dt.Rows[0]["cln1_col4"].ToString();
                //體重(乾體重)
                w_num_13 = dt.Rows[0]["cln1_col6"].ToString();
                //抗凝方案(甘素首量)
                w_num_8 = dt.Rows[0]["cln1_col13"].ToString();
                //抗凝方案(追加量)
                w_num_9 = dt.Rows[0]["cln1_col14"].ToString();
                //抗凝方案(低分子肝素)
                w_num_10 = dt.Rows[0]["cln1_col15"].ToString();
            }
            dt.Dispose();


            //3.clinical2_nurse 血液淨化過程明細
            //KEY:cln2_id:血液淨化流水號 自動
            string w_TextArea1 = "";
            int    iCNT        = 0;
            string w_num_16    = "";
            string w_num_17    = "";
            string w_num_18    = "";
            string w_num_19    = "";
            string w_num_57    = "";
            string w_num_58    = "";
            double bpiLOW_MIN  = 9999;
            double bpiLOW_MAX  = 0;
            double bpiLOW_SUM  = 0;
            double bpiLOW_AVG  = 0;
            double bpiHIGH_MIN = 9999;
            double bpiHIGH_MAX = 0;
            double bpiHIGH_SUM = 0;
            double bpiHIGH_AVG = 0;
            string bpsLOW_MIN  = "";
            string bpsLOW_MAX  = "";
            string bpsLOW_AVG  = "";
            string bpsHIGH_MIN = "";
            string bpsHIGH_MAX = "";
            string bpsHIGH_AVG = "";

            sSQL = "SELECT * FROM clinical2_nurse " +
                   "WHERE cln2_patic='" + w_pif_ic + "' " +
                   " AND cln2_bp LIKE '%/%' " +
                   " AND cln2_date LIKE '" + TextField9.Text + "%' " +
                   " ORDER BY cln2_date, cln2_time ";
            dt = new DataTable();
            dt = db.Query(sSQL);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string[] t  = dt.Rows[i]["cln2_bp"].ToString().Split('/');
                    double   zL = 0;
                    double   zH = 0;
                    if (Double.TryParse(t[1], out zL))
                    {
                        zL = Convert.ToDouble(t[1]);
                    }
                    if (Double.TryParse(t[0], out zH))
                    {
                        zH = Convert.ToDouble(t[0]);
                    }
                    if ((zH > zL) && (zL > 0))
                    {
                        bpiLOW_SUM  = bpiLOW_SUM + zL;
                        bpiHIGH_SUM = bpiHIGH_SUM + zH;
                        if (zH > bpiHIGH_MAX)
                        {
                            bpiHIGH_MAX = zH;
                        }
                        if (zL > bpiLOW_MAX)
                        {
                            bpiLOW_MAX = zL;
                        }
                        if (zH < bpiHIGH_MIN)
                        {
                            bpiHIGH_MIN = zH;
                        }
                        if (zL < bpiLOW_MIN)
                        {
                            bpiLOW_MIN = zL;
                        }
                        iCNT++;
                        w_TextArea1 += iCNT.ToString() + ". " + dt.Rows[i]["cln2_date"].ToString() + " " +
                                       dt.Rows[i]["cln2_time"].ToString() + " " +
                                       dt.Rows[i]["cln2_bp"].ToString() + Environment.NewLine;
                    }
                    else
                    {
                        w_TextArea1 += "X. " + dt.Rows[i]["cln2_date"].ToString() + " " +
                                       dt.Rows[i]["cln2_time"].ToString() + " " +
                                       dt.Rows[i]["cln2_bp"].ToString() + Environment.NewLine;
                    }
                }
                bpiLOW_AVG = bpiLOW_SUM / iCNT;
                if (bpiLOW_AVG != 0)
                {
                    bpsLOW_AVG = bpiLOW_AVG.ToString("0.0");
                }
                bpiHIGH_AVG = bpiHIGH_SUM / iCNT;
                if (bpiHIGH_AVG != 0)
                {
                    bpsHIGH_AVG = bpiHIGH_AVG.ToString("0.0");
                }
                if (bpiLOW_MIN != 9999)
                {
                    bpsLOW_MIN = bpiLOW_MIN.ToString();
                }
                if (bpiLOW_MAX != 0)
                {
                    bpsLOW_MAX = bpiLOW_MAX.ToString();
                }
                if (bpiHIGH_MIN != 9999)
                {
                    bpsHIGH_MIN = bpiHIGH_MIN.ToString();
                }
                if (bpiHIGH_MAX != 0)
                {
                    bpsHIGH_MAX = bpiHIGH_MAX.ToString();
                }
            }
            //血壓範圍:
            w_num_16 = bpsLOW_MIN;
            w_num_17 = bpsLOW_MAX;
            w_num_18 = bpsHIGH_MIN;
            w_num_19 = bpsHIGH_MAX;
            w_num_57 = bpsLOW_AVG;
            w_num_58 = bpsHIGH_AVG;
            dt.Dispose();
            //


            //4.a_result_log檢驗記錄檔 ROW_ID自動編號 :KEY
            //              病患資料列序號 PAT_NO
            sSQL = "";
            string w_num_31 = "";
            string w_num_32 = "";
            string w_num_37 = "";
            string w_txt_43 = "";
            string w_num_44 = "";
            string w_num_45 = "";
            string w_num_46 = "";
            string w_num_47 = "";
            string w_num_50 = "";
            string w_num_51 = "";

            sSQL = "SELECT RESULT_DATE, RESULT_CODE, RESULT_VALUE_T " +
                   " FROM a_result_log " +
                   " WHERE PAT_NO=" + _PAT_ID + " " +
                   " AND RESULT_DATE='" + TextField9.Text + "' " +
                   " AND RESULT_VER=0 ";
            dt = new DataTable();
            dt = db.Query(sSQL);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                switch (dt.Rows[i]["RESULT_CODE"].ToString())
                {
                case "5017":
                    w_num_31 = dt.Rows[i]["RESULT_VALUE_T"].ToString();    //URR
                    break;

                case "5018":
                    w_num_32 = dt.Rows[i]["RESULT_VALUE_T"].ToString();    //KT/V
                    break;

                case "4003":
                    w_num_37 = dt.Rows[i]["RESULT_VALUE_T"].ToString();    //Hb
                    break;

                case "4027":
                    w_txt_43 = dt.Rows[i]["RESULT_VALUE_T"].ToString();    //鐵蛋白
                    break;

                case "4050":
                    w_num_44 = dt.Rows[i]["RESULT_VALUE_T"].ToString();    //鐵蛋白飽和度
                    break;

                case "4021":
                    w_num_45 = dt.Rows[i]["RESULT_VALUE_T"].ToString();    //鈣
                    break;

                case "4023":
                    w_num_46 = dt.Rows[i]["RESULT_VALUE_T"].ToString();    //磷
                    break;

                case "4030":
                    w_num_47 = dt.Rows[i]["RESULT_VALUE_T"].ToString();    //iPTH
                    break;

                case "4009":
                    w_num_50 = dt.Rows[i]["RESULT_VALUE_T"].ToString();    //GOT=AST
                    break;

                case "4010":
                    w_num_51 = dt.Rows[i]["RESULT_VALUE_T"].ToString();    //GPT=ALT
                    break;
                }
            }
            dt.Dispose();
            //

            //寫入常規記錄
            //PAT_ID 1/404
            //病患資料序號pat_id + 記錄日期INFO_DATE
            //string winfo_date = _Get_YMD(TextField9.Text);

            string ww_opt_7 = "";

            switch (w_opt_7)
            {
            case "临时中心静脉置管":      //"临时中心静脉置管":
                ww_opt_7 = "1";
                break;

            case "长期中心静脉置管":      //"长期中心静脉置管":
                ww_opt_7 = "2";
                break;

            case "自体内瘘":              //"自体内瘘":
                ww_opt_7 = "3";
                break;

            case "移植血管":              //"移植血管":
                ww_opt_7 = "4";
                break;

            default:
                break;
            }

            string ww_opt_11 = "";

            switch (w_opt_11)
            {
            case "Toray TS-1.3 S":             //"Toray TS-1.3 S":
                ww_opt_11 = "1";
                break;

            case "Toray TS-1.3 U":             //"Toray TS-1.3 U":
                ww_opt_11 = "2";
                break;

            case "Toray TS-1.6 SL":             //"Toray TS-1.6 SL":
                ww_opt_11 = "3";
                break;

            case "Toray TS-1.8 SL":             //"Toray TS-1.8 SL":
                ww_opt_11 = "4";
                break;

            case "旭化成REXEED 15UC":             //"旭化成REXEED 15UC":
                ww_opt_11 = "5";
                break;

            case "尼普洛FB-150U":             //"尼普洛FB-150U":
                ww_opt_11 = "6";
                break;

            case "B1-1.6H":             //"B1-1.6H":
                ww_opt_11 = "7";
                break;

            default:
                ww_opt_11 = "0";
                break;
            }

            sSQL  = "";
            sSQL  = "  SELECT * ";
            sSQL += " FROM zinfo_e_01 ";
            sSQL += " WHERE pat_id    = '" + _PAT_ID + "'";
            sSQL += " AND   info_date = '" + winfo_date + "'";
            DataTable dt2 = db.Query(sSQL);

            if (dt2.Rows.Count == 1)
            {
                sSQL = " UPDATE zinfo_e_01 set opt_7 = '" + ww_opt_7 + "'," +
                       " num_8  = '" + w_num_8 + "'," +
                       " num_9  = '" + w_num_9 + "'," +
                       " num_10 = '" + w_num_10 + "'," +
                       " opt_11 = '" + ww_opt_11 + "'," +
                       " num_13 = '" + w_num_13 + "'," +
                       " num_16 = '" + w_num_16 + "'," +
                       " num_17 = '" + w_num_17 + "'," +
                       " num_18 = '" + w_num_18 + "'," +
                       " num_19 = '" + w_num_19 + "'," +
                       " num_31 = '" + w_num_31 + "'," +
                       " num_32 = '" + w_num_32 + "'," +
                       " num_37 = '" + w_num_37 + "'," +
                       " txt_43 = '" + w_txt_43 + "'," +
                       " num_44 = '" + w_num_44 + "'," +
                       " num_45 = '" + w_num_45 + "'," +
                       " num_46 = '" + w_num_46 + "'," +
                       " num_47 = '" + w_num_47 + "'," +
                       " num_50 = '" + w_num_50 + "'," +
                       " num_51 = '" + w_num_51 + "'," +
                       " num_57 = '" + w_num_57 + "'," +
                       " num_58 = '" + w_num_58 + "'," +
                       "info_user = '******'" +
                       " WHERE pat_id    ='" + _PAT_ID + "'" +
                       " AND   info_date ='" + winfo_date + "'";
                db.Excute(sSQL);
            }
            else
            {
                sSQL  = "INSERT INTO zinfo_e_01 (pat_id,info_date,info_user,opt_7,num_8,num_9,num_10,opt_11,num_13,num_16,num_17,num_18,num_19,num_31,num_32,num_37,txt_43,num_44,num_45,num_46,num_47,num_50,num_51,num_57,num_58) ";
                sSQL += "VALUES('" + _PAT_ID + "','" + winfo_date + "',";
                sSQL += "'Admin" + "',";
                sSQL += "'" + ww_opt_7 + "',";
                sSQL += "'" + w_num_8 + "',";
                sSQL += "'" + w_num_9 + "',";
                sSQL += "'" + w_num_10 + "',";
                sSQL += "'" + ww_opt_11 + "',";
                sSQL += "'" + w_num_13 + "',";
                sSQL += "'" + w_num_16 + "',";
                sSQL += "'" + w_num_17 + "',";
                sSQL += "'" + w_num_18 + "',";
                sSQL += "'" + w_num_19 + "',";
                sSQL += "'" + w_num_31 + "',";
                sSQL += "'" + w_num_32 + "',";
                sSQL += "'" + w_num_37 + "',";
                sSQL += "'" + w_txt_43 + "',";
                sSQL += "'" + w_num_44 + "',";
                sSQL += "'" + w_num_45 + "',";
                sSQL += "'" + w_num_46 + "',";
                sSQL += "'" + w_num_47 + "',";
                sSQL += "'" + w_num_50 + "',";
                sSQL += "'" + w_num_51 + "',";
                sSQL += "'" + w_num_57 + "',";
                sSQL += "'" + w_num_58 + "'";
                sSQL += "" + ")";
                db.Excute(sSQL);
            }
            dt2.Dispose();
            //
            _NotificationShow("储存成功!");
        }
        /// <summary>
        /// 排班轉檔作業
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            //
            this.Panel4.Hidden   = true;
            this.txtMESSAGE.Text = "排班轉檔......";
            if (!X.IsAjaxRequest)
            {
            }
            // 未來排班轉檔程式要從 Web 搬移出去 , 在 windows 排程中 執行

            //
            DBMysql  db  = new DBMysql();
            DateTime now = DateTime.Now;

            this.txtDATE.Text = now.ToString("yyyy-MM-dd");
            this.txtTIME.Text = now.ToString("yyyy-MM-dd HH:mm:ss");
            string w_apptst_flr = "";
            string sql          = "";

            GET_WEEK();
            string w_flag = "";
            //目前時間
            int Hm = int.Parse(now.ToString("HHmm"));

            //Hm = 2300;
            //this.txtWEEK.Text = "星期日";

            if (this.txtWEEK.Text == "星期日")
            {
                if (Hm >= 2200 && w_flag == "")
                {
                    //星期日 22:00開始 排班轉檔
                    DateTime dt = DateTime.Now;
                    DateTime w_date1;
                    DateTime w_date2;
                    DateTime w_date3;
                    DateTime w_date4;
                    DateTime w_date5;
                    DateTime w_date6;
                    DateTime w_date7;
                    w_date1 = dt.AddDays(1);
                    string s_date1 = w_date1.ToString("yyyy-MM-dd");
                    w_date2 = dt.AddDays(2);
                    string s_date2 = w_date2.ToString("yyyy-MM-dd");
                    w_date3 = dt.AddDays(3);
                    string s_date3 = w_date3.ToString("yyyy-MM-dd");
                    w_date4 = dt.AddDays(4);
                    string s_date4 = w_date4.ToString("yyyy-MM-dd");
                    w_date5 = dt.AddDays(5);
                    string s_date5 = w_date5.ToString("yyyy-MM-dd");
                    w_date6 = dt.AddDays(6);
                    string s_date6 = w_date6.ToString("yyyy-MM-dd");
                    w_date7 = dt.AddDays(7);
                    string s_date7 = w_date7.ToString("yyyy-MM-dd");

                    //
                    try
                    {
                        //select a.*,b.pif_id,b.pif_name from appointment a, pat_info b where a.pif_id = b.pif_id order by a.pif_id
                        //SELECT a.*,b.pif_id,b.pif_name as patrefid,b.pif_ic as patic  FROM appointment a,pat_info b
                        //where  a.pif_id = b.pif_id
                        //and appointment_date in ('2015-06-22','2015-06-23','2015-06-24','2015-06-25','2015-06-26','2015-06-27','2015-06-28') ORDER BY appointment_date
                        //20150909 Andy
                        sql = "";
                        sql = "DELETE FROM appointment_setup";
                        DataTable appointment_DATA = db.Query(sql);

                        sql = "";
                        sql = "SELECT mac_flr, mac_sec, mac_bedno, mac_typ FROM mac_setup";
                        DataTable mac_setup_DATA = db.Query(sql);

                        sql = "";
                        sql = "SELECT a.*,b.pif_id,b.pif_name as patrefid,b.pif_ic as patic  FROM appointment a,pat_info b where  a.pif_id = b.pif_id  and  appointment_date in ('" +
                              s_date1 + "','" + s_date2 + "','" + s_date3 + "','" + s_date4 + "','" +
                              s_date5 + "','" + s_date6 + "','" + s_date7 + "')" + " ORDER BY appointment_date ";
                        DataTable dtappointment_DATA = db.Query(sql);

                        foreach (DataRow dr in dtappointment_DATA.Rows)
                        {
                            try
                            {
                                dr["mac_type"] = mac_setup_DATA.Select("mac_flr = '" + dr["pv_floor"].ToString() + "' and mac_sec = '" + dr["pv_sec"].ToString() + "' and mac_bedno = '" + dr["pv_bedno"].ToString() + "'")[0]["mac_typ"].ToString();
                            }
                            catch (Exception ex)
                            {
                                logger.Error(ex.Message + ":" + ex.StackTrace);
                            }
                        }

                        //if (dtappointment_DATA.Rows.Count > 0)
                        for (int i = 0; i < dtappointment_DATA.Rows.Count; i++)
                        {
                            sql  = "";
                            sql  = "insert into  appointment_setup  (apptst_flr,apptst_sec,";
                            sql += "apptst_bed,apptst_mactyp,apptst_patrefid,apptst_patic,apptst_wktyp,apptst_daytyp,apptst_timetyp) ";
                            sql += " values ('";
                            sql += dtappointment_DATA.Rows[i]["pv_floor"].ToString() + "','";
                            sql += dtappointment_DATA.Rows[i]["pv_sec"].ToString() + "','";
                            sql += dtappointment_DATA.Rows[i]["pv_bedno"].ToString() + "','";
                            sql += dtappointment_DATA.Rows[i]["mac_type"].ToString() + "','";
                            sql += dtappointment_DATA.Rows[i]["patrefid"].ToString() + "','";
                            sql += dtappointment_DATA.Rows[i]["patic"].ToString() + "','";
                            //1
                            if (dtappointment_DATA.Rows[i]["appointment_date"].ToString() == s_date1)
                            {
                                sql += "135" + "','";
                                sql += "1" + "','";
                                sql += dtappointment_DATA.Rows[i]["time_type"].ToString() + "'";
                            }
                            if (dtappointment_DATA.Rows[i]["appointment_date"].ToString() == s_date2)
                            {
                                sql += "246" + "','";
                                sql += "2" + "','";
                                sql += dtappointment_DATA.Rows[i]["time_type"].ToString() + "'";
                            }
                            if (dtappointment_DATA.Rows[i]["appointment_date"].ToString() == s_date3)
                            {
                                sql += "135" + "','";
                                sql += "3" + "','";
                                sql += dtappointment_DATA.Rows[i]["time_type"].ToString() + "'";
                            }
                            if (dtappointment_DATA.Rows[i]["appointment_date"].ToString() == s_date4)
                            {
                                sql += "246" + "','";
                                sql += "4" + "','";
                                sql += dtappointment_DATA.Rows[i]["time_type"].ToString() + "'";
                            }
                            if (dtappointment_DATA.Rows[i]["appointment_date"].ToString() == s_date5)
                            {
                                sql += "135" + "','";
                                sql += "5" + "','";
                                sql += dtappointment_DATA.Rows[i]["time_type"].ToString() + "'";
                            }
                            if (dtappointment_DATA.Rows[i]["appointment_date"].ToString() == s_date6)
                            {
                                sql += "246" + "','";
                                sql += "6" + "','";
                                sql += dtappointment_DATA.Rows[i]["time_type"].ToString() + "'";
                            }
                            if (dtappointment_DATA.Rows[i]["appointment_date"].ToString() == s_date7)
                            {
                                sql += "135" + "','";
                                sql += "7" + "','";
                                sql += dtappointment_DATA.Rows[i]["time_type"].ToString() + "'";
                            }
                            sql += ")";
                            db.Excute(sql);
                        }
                    }
                    catch (Exception ex)
                    {
                        Common._ErrorMsgShow(ex.Message.ToString());
                        //logger.Error(ex.Message + ":" + ex.StackTrace);
                    }
                }
            }

            w_flag = "Y";
        }