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("储存成功!"); }
public TipoArticulo(DBMysql DBMysql_) { this.DBMysql_ = DBMysql_; }
public static List <UsrInf_Cond_zinfo_a_07> GetData(string sPat_id, string sInfo_date) { DBMysql DbInfo = new DBMysql(); DataTable MyInfoDt = new DataTable(); string sSQL = ""; //sSQL = sSQL + " select z.* ,p.pif_id,pif_name,pif_ic from zinfo_a_07 z left join //pat_info p on p.pif_id = z.pat_id "; //sSQL = sSQL + " where pat_id = '" + sPat_id + "' and info_date = '" + sInfo_date + "' "; if (!string.IsNullOrWhiteSpace(sPat_id)) { sSQL = sSQL + " select z.* ,p.pif_id,pif_name,pif_ic from zinfo_a_07 z left join pat_info p on p.pif_id = z.pat_id "; sSQL = sSQL + " where pat_id = '" + sPat_id + "' and info_date = '" + sInfo_date + "' "; } MyInfoDt = DbInfo.Query(sSQL); UsrInf_Cond_zinfo_a_07_List = null; if (UsrInf_Cond_zinfo_a_07_List == null) { UsrInf_Cond_zinfo_a_07_List = new List <UsrInf_Cond_zinfo_a_07>(); if (MyInfoDt.Rows.Count > 0) { for (int cc = 0; cc <= MyInfoDt.Rows.Count - 1; cc++) { UsrInf_Cond_zinfo_a_07 UsrInf_Cond_zinfo_a_07_00 = new UsrInf_Cond_zinfo_a_07(); //塞欄位到 UsrInf_Cond_zinfo_a_07 class /* * pat_id string * info_date string * info_user string * * opt_1 int * opt_2 int * txt_3 string * opt_4 int * opt_5 int * txt_6 string * chk_7 string * chk_8 string * txt_9 string * chk_10 string * txt_11 string * chk_12 string * txt_13 string * txt_14 string * * */ // Convert.ToInt32(MyInfoDt.Rows[cc]["ROW_ID"].ToString().Trim()); // MyInfoDt.Rows[cc]["ROW_ID"].ToString().Trim(); UsrInf_Cond_zinfo_a_07_00.pat_id = MyInfoDt.Rows[cc]["pat_id"].ToString().Trim(); UsrInf_Cond_zinfo_a_07_00.info_date = MyInfoDt.Rows[cc]["info_date"].ToString().Trim(); UsrInf_Cond_zinfo_a_07_00.info_user = MyInfoDt.Rows[cc]["info_user"].ToString().Trim(); if (string.IsNullOrWhiteSpace((MyInfoDt.Rows[cc]["opt_1"].ToString().Trim()))) { UsrInf_Cond_zinfo_a_07_00.opt_1 = 0; //0 是沒選 RadioButton } else { UsrInf_Cond_zinfo_a_07_00.opt_1 = Convert.ToInt32(MyInfoDt.Rows[cc]["opt_1"].ToString().Trim()); } if (string.IsNullOrWhiteSpace((MyInfoDt.Rows[cc]["opt_2"].ToString().Trim()))) { UsrInf_Cond_zinfo_a_07_00.opt_2 = 0; //0 是沒選 RadioButton } else { UsrInf_Cond_zinfo_a_07_00.opt_2 = Convert.ToInt32(MyInfoDt.Rows[cc]["opt_2"].ToString().Trim()); } UsrInf_Cond_zinfo_a_07_00.txt_3 = MyInfoDt.Rows[cc]["txt_3"].ToString().Trim(); if (string.IsNullOrWhiteSpace((MyInfoDt.Rows[cc]["opt_4"].ToString().Trim()))) { UsrInf_Cond_zinfo_a_07_00.opt_4 = 0; //0 是沒選 RadioButton } else { UsrInf_Cond_zinfo_a_07_00.opt_4 = Convert.ToInt32(MyInfoDt.Rows[cc]["opt_4"].ToString().Trim()); } if (string.IsNullOrWhiteSpace((MyInfoDt.Rows[cc]["opt_5"].ToString().Trim()))) { UsrInf_Cond_zinfo_a_07_00.opt_5 = 0; //0 是沒選 RadioButton } else { UsrInf_Cond_zinfo_a_07_00.opt_5 = Convert.ToInt32(MyInfoDt.Rows[cc]["opt_5"].ToString().Trim()); } UsrInf_Cond_zinfo_a_07_00.txt_6 = MyInfoDt.Rows[cc]["txt_6"].ToString().Trim(); if (string.IsNullOrWhiteSpace((MyInfoDt.Rows[cc]["chk_7"].ToString().Trim()))) { UsrInf_Cond_zinfo_a_07_00.chk_7 = ""; } else { UsrInf_Cond_zinfo_a_07_00.chk_7 = MyInfoDt.Rows[cc]["chk_7"].ToString().Trim(); } if (string.IsNullOrWhiteSpace((MyInfoDt.Rows[cc]["chk_8"].ToString().Trim()))) { UsrInf_Cond_zinfo_a_07_00.chk_8 = ""; } else { UsrInf_Cond_zinfo_a_07_00.chk_8 = MyInfoDt.Rows[cc]["chk_8"].ToString().Trim(); } UsrInf_Cond_zinfo_a_07_00.txt_9 = MyInfoDt.Rows[cc]["txt_9"].ToString().Trim(); if (string.IsNullOrWhiteSpace((MyInfoDt.Rows[cc]["chk_10"].ToString().Trim()))) { UsrInf_Cond_zinfo_a_07_00.chk_10 = ""; } else { UsrInf_Cond_zinfo_a_07_00.chk_10 = MyInfoDt.Rows[cc]["chk_10"].ToString().Trim(); } UsrInf_Cond_zinfo_a_07_00.txt_11 = MyInfoDt.Rows[cc]["txt_11"].ToString().Trim(); if (string.IsNullOrWhiteSpace((MyInfoDt.Rows[cc]["chk_12"].ToString().Trim()))) { UsrInf_Cond_zinfo_a_07_00.chk_12 = ""; } else { UsrInf_Cond_zinfo_a_07_00.chk_12 = MyInfoDt.Rows[cc]["chk_12"].ToString().Trim(); } UsrInf_Cond_zinfo_a_07_00.txt_13 = MyInfoDt.Rows[cc]["txt_13"].ToString().Trim(); UsrInf_Cond_zinfo_a_07_00.txt_14 = MyInfoDt.Rows[cc]["txt_14"].ToString().Trim(); //pat_info 欄位 pif_name if (string.IsNullOrWhiteSpace((MyInfoDt.Rows[cc]["pif_name"].ToString().Trim()))) { UsrInf_Cond_zinfo_a_07_00.pif_name = ""; } else { UsrInf_Cond_zinfo_a_07_00.pif_name = MyInfoDt.Rows[cc]["pif_name"].ToString().Trim(); } //pat_info 欄位 pif_ic if (string.IsNullOrWhiteSpace((MyInfoDt.Rows[cc]["pif_ic"].ToString().Trim()))) { UsrInf_Cond_zinfo_a_07_00.pif_ic = ""; } else { UsrInf_Cond_zinfo_a_07_00.pif_ic = MyInfoDt.Rows[cc]["pif_ic"].ToString().Trim(); } UsrInf_Cond_zinfo_a_07_List.Add(UsrInf_Cond_zinfo_a_07_00); } } } return(UsrInf_Cond_zinfo_a_07_List); }//GetData
public PedidoAbono(DBMysql DBMysql_) { this.DBMysql_ = DBMysql_; }
public NotaPedido(DBMysql DBMysql_) { this.DBMysql_ = DBMysql_; }
protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest) { //TextField1.Hidden = true; //TextField2.Hidden = true; DBMysql db = new DBMysql(); try { string sPAD_HEAD = "Styles/mark1.png"; //string sPAD_HEAD = ""; DataTable dtPAD_HEAD = db.Query("SELECT * FROM general_setup WHERE genst_code='IPAD_HEAD'"); if (dtPAD_HEAD.Rows.Count > 0) { sPAD_HEAD = dtPAD_HEAD.Rows[0]["genst_desc"].ToString(); //sPAD_HEAD = Server.MapPath(sPAD_HEAD); Image2.ImageUrl = sPAD_HEAD; } } catch (Exception ex) { //_ErrorMsgShow(ex.Message.ToString()); } DateTime now = DateTime.Now; //this.txtDATE.Text = now.ToString("yyyy-MM-dd"); this.txtTIME.Text = now.ToString("yyyy-MM-dd HH:mm:ss"); this.txtTIME1.Text = now.ToString("yyyy-MM-dd"); //sDATE.Text = this.txtDATE.Text; sDATE.Text = this.txtTIME.Text.Substring(0, 10); //this.txtWEEK.Text = now.ToString("ddd"); if (Session["PAD_TIME"] == null) { int Hm = int.Parse(now.ToString("HHmm")); if (1 <= Hm && Hm <= 1159) { sTIME.Text = "001"; cboTIME.Select(sTIME.Text); } else if (1200 <= Hm && Hm <= 1759) { sTIME.Text = "002"; cboTIME.Select(sTIME.Text); } else if (1800 <= Hm && Hm <= 2400) { sTIME.Text = "003"; cboTIME.Select(sTIME.Text); } } else { sTIME.Text = Session["PAD_TIME"].ToString(); cboTIME.Select(sTIME.Text); } GET_WEEK(); this.WYEAR.Text = now.ToString("yyyy"); this.WMON.Text = now.ToString("MM"); this.cboYEAR.Disabled = false; YEAR_CHECK(this.WYEAR.Text); MON_CHECK(this.WMON.Text); if (dtAREA == null) { dtAREA = db.Query("SELECT distinct mac_flr, mac_sec FROM mac_setup WHERE 1=1 ORDER BY mac_flr, mac_sec "); } if (dtAREA.Rows.Count > 0) { if (Session["PAD_FLOOR"] == null) { sFLOOR.Text = dtAREA.Rows[0]["mac_flr"].ToString(); } else { sFLOOR.Text = Session["PAD_FLOOR"].ToString(); } if (Session["PAD_AREA"] == null) { sAREA.Text = dtAREA.Rows[0]["mac_sec"].ToString(); } else { sAREA.Text = Session["PAD_AREA"].ToString(); } } System.Data.DataTable dtFLOOR = db.Query("SELECT distinct mac_flr FROM mac_setup WHERE 1=1 ORDER BY mac_flr "); for (int i = 0; i < dtFLOOR.Rows.Count; i++) { Ext.Net.ListItem litem; litem = new Ext.Net.ListItem(dtFLOOR.Rows[i]["mac_flr"].ToString() + "楼", dtFLOOR.Rows[i]["mac_flr"].ToString()); this.cboFLOOR.Items.Add(litem); } this.cboFLOOR.GetStore().DataBind(); if (dtFLOOR.Rows.Count > 0) { this.cboFLOOR.Disabled = false; this.cboFLOOR.Select(sFLOOR.Text); //SetComboBoxValue(this.cboFLOOR, "05楼", false); FILL_AREA(sFLOOR.Text, sAREA.Text); WFLOOR.Text = sFLOOR.Text; WAREA.Text = sAREA.Text; //Column9.Text = WFLOOR.Text + "楼"; //Column11.Text = WAREA.Text + "區"; //FILL_BED(); //FILL_BEDN(); } else { this.cboFLOOR.Disabled = true; this.cboAREA.Disabled = true; } //Timer1.Enabled = true; //TaskManager1.Enabled = true; TaskManager1.StopTask("servertime"); //2015.03.25 姓名 Andy System.Data.DataTable dtName = db.Query("select DISTINCT apptst_patrefid from appointment_setup order by apptst_patrefid"); for (int i = 0; i < dtName.Rows.Count; i++) { Ext.Net.ListItem litem1; litem1 = new Ext.Net.ListItem(dtName.Rows[i]["apptst_patrefid"].ToString(), dtName.Rows[i]["apptst_patrefid"].ToString()); this.SelectBox1.Items.Add(litem1); } this.SelectBox1.GetStore().DataBind(); if (dtName.Rows.Count > 0) { this.SelectBox1.Disabled = false; this.SelectBox1.Select(sNAME.Text); //FILL_AREA(sFLOOR.Text, sAREA.Text); //FILL_BED(); } else { //this.cboFLOOR.Disabled = true; //this.cboAREA.Disabled = true; } // //2015.03.25 GP 身分證號 Andy System.Data.DataTable dtpatic = db.Query("select DISTINCT apptst_patic from appointment_setup order by apptst_patic"); for (int i = 0; i < dtpatic.Rows.Count; i++) { Ext.Net.ListItem litem2; litem2 = new Ext.Net.ListItem(dtpatic.Rows[i]["apptst_patic"].ToString(), dtpatic.Rows[i]["apptst_patic"].ToString()); this.SelectBox2.Items.Add(litem2); } this.SelectBox2.GetStore().DataBind(); if (dtpatic.Rows.Count > 0) { this.SelectBox2.Disabled = false; this.SelectBox2.Select(spatic.Text); } else { } // } }
public PedidoAjuste(DBMysql DBMysql_) { this.DBMysql_ = DBMysql_; }
public void UploadAdminTwo() { try { UploadAdmin uploadAdmin = new UploadAdmin(); try { uploadAdmin.OrganizationCreateUpdate(orgId); logger.Info("Organization Create/Update:" + orgId); } catch (Exception ex) { logger.Error(ex.Message); } //多筆醫師處置人員 //DBOracle db = new DBOracle(); DBMysql db = new DBMysql(); DataTable Mydt = new DataTable(); Mydt = db.Query("select acclv_stfcode, acclv_fname, acclv_type, acclv_active from access_level"); if (Mydt.Rows.Count > 0) { //orgId = "H57069000.8602"; //orgId = "H32000800.8066"; //orgName = "南京市大厂医院血液净化中心"; //orgName = "南京医科大学血液净化中心"; string acclv_stfcode = "Admin"; string acclv_fname = "Administrator"; string acclv_type = "Doctor"; Boolean acclv_active = true; string acclv_id = "1"; /*if (new TimeSpan(DateTime.Now.Ticks - newestSuccessListDateTime.Ticks).Days < 5) * { * DataTable MydtFilter = new DataTable(); * foreach (DataRow row in Mydt.Rows) * { * if (!newstSuccessIdList.Contains(row["acclv_stfcode"].ToString())) * MydtFilter.ImportRow(row); * } * Mydt = MydtFilter; * } * if (Mydt.Rows.Count == 0) * logger.Info("Practitioner Creaete/Update List is Empty"); */ ConcurrentBag <AuditObject> successList = new ConcurrentBag <AuditObject>(); ConcurrentBag <AuditObject> failList = new ConcurrentBag <AuditObject>(); int practitionerCounter = 1; Stopwatch sw = new Stopwatch(); sw.Start(); //foreach (DataRow row in Mydt.Rows) Parallel.ForEach(Mydt.AsEnumerable(), row => { lock (syncHandle) { acclv_stfcode = row["acclv_stfcode"].ToString(); acclv_fname = row["acclv_fname"].ToString(); acclv_type = row["acclv_type"].ToString(); //acclv_id = Mydt.Rows[i]["acclv_id"].ToString(); } logger.Info("Practitioner information@" + "acclv_stfcode=" + acclv_stfcode + ",acclv_fname=" + acclv_fname); try { // TODO: Create Practitioner //orgId, orgName, Stracclv_stfcode, Stracclv_fname, Stracclv_type, typeSystem, Bacclv_active, tel, email AuditObject resultAudit = uploadAdmin.PractitionerCreateUpdate(orgId, orgName, acclv_stfcode, acclv_fname, acclv_type, "", acclv_active, "", ""); logger.Info("Practitioner Create/Update:" + practitionerCounter + "/" + Mydt.Rows.Count); if (resultAudit.Success) { successList.Add(resultAudit); logger.Info("Practitioner Create Success@" + "acclv_stfcode=" + acclv_stfcode + ",acclv_fname=" + acclv_fname); } else { failList.Add(resultAudit); logger.Info("Practitioner Create Fail@" + "acclv_stfcode=" + acclv_stfcode + ",acclv_fname=" + acclv_fname); } practitionerCounter++; } catch (Exception ex) { failList.Add(new AuditObject { Success = false, Name = acclv_stfcode, Desc = acclv_fname }); logger.Error(ex.Message); logger.Error("Practitioner Create catch Fail@" + "acclv_stfcode=" + acclv_stfcode + ",acclv_fname=" + acclv_fname); } }); sw.Stop(); logger.Info("Practitioner Create/Update exec:" + practitionerCounter + "/" + Mydt.Rows.Count + " total cost " + (sw.ElapsedMilliseconds / 1000).ToString() + " seconds"); string ip = null; if (HttpContext.Current != null) { ip = HttpContext.Current.Request.UserHostAddress; } else { System.Net.IPAddress SvrIP = new System.Net.IPAddress(Dns.GetHostByName(Dns.GetHostName()).AddressList[0].Address); ip = SvrIP.ToString(); } try { if (successList.Count > 0) { uploadAdmin.AuditEventCreateUpdate("UL.Practitioner", "Organization", orgId, orgId, successList.ToList <AuditObject>(), Hl7.Fhir.Model.AuditEvent.AuditEventAction.U, Hl7.Fhir.Model.AuditEvent.AuditEventOutcome.N0, new Hl7.Fhir.Model.Coding("http://www.datacom.com.tw", "UL_PRACTITIONER"), ip); } if (failList.Count > 0) { uploadAdmin.AuditEventCreateUpdate("UL.Practitioner", "Organization", orgId, orgId, failList.ToList <AuditObject>(), Hl7.Fhir.Model.AuditEvent.AuditEventAction.U, Hl7.Fhir.Model.AuditEvent.AuditEventOutcome.N4, new Hl7.Fhir.Model.Coding("http://www.datacom.com.tw", "UL_PRACTITIONER"), ip); } } catch (Exception ex) { logger.Error(ex.Message); logger.Error("AuditEvent Create Fail@" + "UL_PRACTITIONER"); } } //病患上傳資料 Mydt = new DataTable(); Mydt = db.Query(" select pif_ic, pif_name, pif_pattyp, pif_mrn, pif_dob, pif_sex, pif_address, pif_contactperson, pif_contact, pif_imgloc, pif_insurance, pif_insid, pif_docname from pat_info group by pif_ic"); if (Mydt.Rows.Count > 0) { string pif_ic = ""; string pif_name = ""; string pif_pattyp = ""; string pif_mrn = ""; string pif_dob = ""; string pif_sex = ""; string pif_address = ""; string pif_contactperson = ""; string pif_contact = ""; //tel string pif_imgloc = ""; string pif_insurance = ""; string pif_insid = ""; string pif_docname = ""; ConcurrentBag <AuditObject> successList = new ConcurrentBag <AuditObject>(); ConcurrentBag <AuditObject> failList = new ConcurrentBag <AuditObject>(); int patientCounter = 1; Stopwatch sw1 = new Stopwatch(); sw1.Start(); //foreach (DataRow row in Mydt.Rows) Parallel.ForEach(Mydt.AsEnumerable(), row => { lock (syncHandle1) { pif_ic = row["pif_ic"].ToString(); pif_name = row["pif_name"].ToString(); pif_pattyp = row["pif_pattyp"].ToString(); pif_mrn = row["pif_mrn"].ToString(); pif_dob = row["pif_dob"].ToString(); pif_sex = row["pif_sex"].ToString(); pif_address = row["pif_address"].ToString(); pif_contactperson = row["pif_contactperson"].ToString(); pif_contact = row["pif_contact"].ToString(); pif_imgloc = row["pif_imgloc"].ToString(); pif_insurance = row["pif_insurance"].ToString(); pif_insid = row["pif_insid"].ToString(); pif_docname = row["pif_docname"].ToString(); //acclv_id = Mydt.Rows[i]["acclv_id"].ToString(); } logger.Info("Patient information@" + "pif_ic=" + pif_ic + ",pif_name=" + pif_name); try { // TODO: Create Patient //Str_pif_ic, Str_pif_name, Str_pif_dob, Str_pif_pattyp, Str_pif_mrn, Str_pif_sex, Str_pif_address, Str_pif_contactperson, Str_pif_contact, Str_pif_imgloc, Str_pif_insurance, Str_pif_insid, Str_pif_docname, email AuditObject resultAudit = uploadAdmin.PatientCreateUpdate(orgId, orgName, pif_ic, pif_name, pif_dob, pif_pattyp, pif_mrn, pif_sex, pif_address, pif_contactperson, pif_contact, pif_imgloc, pif_insurance, pif_insid, pif_docname, ""); logger.Info("Patient Create/Update:" + patientCounter + "/" + Mydt.Rows.Count); if (resultAudit.Success) { successList.Add(resultAudit); logger.Info("Patient Create Success@" + "pif_ic=" + pif_ic + ",pif_name=" + pif_name); } else { failList.Add(resultAudit); logger.Info("Patient Create Fail@" + "pif_ic=" + pif_ic + ",pif_name=" + pif_name); } patientCounter++; } catch (Exception ex) { failList.Add(new AuditObject { Success = false, Name = pif_ic, Desc = pif_name }); logger.Error(ex.Message); logger.Error("Patient Create catch Fail@" + "pif_ic=" + pif_ic + ",pif_name=" + pif_name); } }); sw1.Stop(); logger.Info("Patient Create/Update exec:" + patientCounter + "/" + Mydt.Rows.Count + " total cost " + (sw1.ElapsedMilliseconds / 1000).ToString() + " seconds"); sw1.Restart(); try { if (successList.Count > 0) { /*uploadAdmin.AuditEventCreateUpdate(null, "Organization", orgId, orgId, successList.ToList<AuditObject>(), * Hl7.Fhir.Model.SecurityEvent.SecurityEventAction.U, Hl7.Fhir.Model.SecurityEvent.SecurityEventOutcome.N0, * new Hl7.Fhir.Model.CodeableConcept("http://www.datacom.com.tw", "UL_PATIENT"), * HttpContext.Current.Request.UserHostAddress); */ List <AuditObject> ulClinicalList = successList.ToList <AuditObject>(); string auditDateTime = DateTime.Now.ToString("yyyyMMddHHmmss"); foreach (AuditObject obj in ulClinicalList) { obj.Name = auditDateTime; obj.Desc = ""; } uploadAdmin.AuditEventCreateUpdate("UL_CLINICAL", null, "Organization", orgId, orgId, ulClinicalList, Hl7.Fhir.Model.AuditEvent.AuditEventOutcome.N0, new Hl7.Fhir.Model.Coding("http://www.datacom.com.tw", "UL_CLINICAL"), HttpContext.Current.Request.UserHostAddress); } /*if (failList.Count > 0) * uploadAdmin.AuditEventCreateUpdate(null, "Organization", orgId, orgId, failList.ToList<AuditObject>(), * Hl7.Fhir.Model.AuditEvent.AuditEventAction.U, Hl7.Fhir.Model.SecurityEvent.AuditEventOutcome.N4, * new Hl7.Fhir.Model.Coding("http://www.datacom.com.tw", "UL_PATIENT"), * HttpContext.Current.Request.UserHostAddress); */ } catch (Exception ex) { logger.Error(ex.Message); logger.Error("Audit Create Fail@" + "UL_PATIENT"); } sw1.Stop(); logger.Info("PatientAudit Create/Update total cost " + (sw1.ElapsedMilliseconds / 1000).ToString() + " seconds"); } } catch (Exception uploadAdminException) { logger.Error(uploadAdminException.Message); logger.Error("UploadAdmin Error:" + uploadAdminException.Message); } finally { } }
public static List <UserInfoObs> GetData(string sPat_no, string sResult_date, string sOrgId, string sOrgName) { DBMysql DbInfoObs = new DBMysql(); DataTable MyInfoObsDt = new DataTable(); string UsesOrgId = sOrgId.Substring(1).ToString().Trim(); string UsesOrgName = sOrgName; string sSQL = ""; //sSQL = sSQL + " select * from a_result_log L, a_ritem_setup I ,pat_info P "; //sSQL = sSQL + " where L.pat_no = '" + sPat_no + "' and L.result_date = '" + sResult_date + "' and L.result_code = I.ritem_code and P.pif_id = L.pat_no "; sSQL = sSQL + " select * from "; sSQL = sSQL + " (select * from a_result_log L left join pat_info P on L.pat_no = p.pif_id )L left join a_ritem_setup I "; sSQL = sSQL + " on L.result_code = I.ritem_code "; sSQL = sSQL + " where L.pat_no = '" + sPat_no + "' and L.result_date = '" + sResult_date + "' "; MyInfoObsDt = DbInfoObs.Query(sSQL); UserInfoObsList = null; if (UserInfoObsList == null) { UserInfoObsList = new List <UserInfoObs>(); if (MyInfoObsDt.Rows.Count > 0) { for (int jj = 0; jj <= MyInfoObsDt.Rows.Count - 1; jj++) { UserInfoObs UserInfoObs0 = new UserInfoObs(); //塞欄位 /* * int _PAT_NO * String _RESULT_DATE; * String _RESULT_CODE * double RESULT_VALUE_N * int RESULT_VER * string KIN_USER * string authorid * //int PAT_NO * string pif_name * string patientId * string RITEM_NAME * string RITEM_UNIT * string RITEM_LOW1 * string RITEM_HIGH1 */ // UserInfoObs0.orgId = Info_index.; UserInfoObs0.ROW_ID = Convert.ToInt32(MyInfoObsDt.Rows[jj]["ROW_ID"].ToString().Trim()); UserInfoObs0.PAT_NO = Convert.ToInt32(MyInfoObsDt.Rows[jj]["pat_no"].ToString().Trim()); UserInfoObs0.RESULT_DATE = MyInfoObsDt.Rows[jj]["RESULT_DATE"].ToString().Trim(); UserInfoObs0.RESULT_CODE = MyInfoObsDt.Rows[jj]["RESULT_CODE"].ToString().Trim(); UserInfoObs0.RESULT_VALUE_N = Convert.ToDouble(MyInfoObsDt.Rows[jj]["RESULT_VALUE_N"].ToString().Trim()); UserInfoObs0.RESULT_VER = Convert.ToInt16(MyInfoObsDt.Rows[jj]["RESULT_VER"].ToString().Trim()); UserInfoObs0.KIN_DATE = MyInfoObsDt.Rows[jj]["KIN_DATE"].ToString().Trim(); UserInfoObs0.KIN_USER = MyInfoObsDt.Rows[jj]["KIN_USER"].ToString().Trim(); //MyUserInfoObs.authorid = MyLabObsDt.Rows[i]["authorid"].ToString().Trim();//string authorid = "P32000800.8066." + KIN_USER; //UserInfoObs0.authorid = "P32000800.8066." + UserInfoObs0.KIN_USER; UserInfoObs0.authorid = "PRAC" + UsesOrgId + "." + UserInfoObs0.KIN_USER; UserInfoObs0.pif_name = MyInfoObsDt.Rows[jj]["pif_name"].ToString().Trim(); UserInfoObs0.pif_ic = MyInfoObsDt.Rows[jj]["pif_ic"].ToString().Trim(); //MyUserInfoObs.patientId //string patientId = "PAT32000800.8066." + PAT_NO; //UserInfoObs0.patientId = "PAT32000800.8066." + UserInfoObs0.PAT_NO; UserInfoObs0.patientId = "PAT" + UsesOrgId + "." + UserInfoObs0.PAT_NO; UserInfoObs0.RITEM_NAME = MyInfoObsDt.Rows[jj]["RITEM_NAME"].ToString().Trim(); UserInfoObs0.RITEM_UNIT = MyInfoObsDt.Rows[jj]["RITEM_UNIT"].ToString().Trim(); UserInfoObs0.RITEM_LOW1 = MyInfoObsDt.Rows[jj]["RITEM_LOW1"].ToString().Trim(); UserInfoObs0.RITEM_HIGH1 = MyInfoObsDt.Rows[jj]["RITEM_HIGH1"].ToString().Trim(); //ADD UserInfoObsList.Add(UserInfoObs0); } } } return(UserInfoObsList); }
public bool UploadPatient(string TrDate) { string[] OrganizationInfo; try { OrganizationInfo = DialysisToFhir.ReadFhirID01(); if (OrganizationInfo[0] == "nodata") { return(false); } orgId = OrganizationInfo[0]; orgName = OrganizationInfo[1]; } catch (Exception) { return(false); } try { UploadAdmin uploadAdmin = new UploadAdmin(); try { uploadAdmin.OrganizationCreateUpdate(orgId); logger.Info("Organization Create/Update:" + orgId); } catch (Exception ex) { logger.Error(ex.Message); } DBMysql db = new DBMysql(); DataTable Mydt = new DataTable(); //病患上傳資料 Mydt = new DataTable(); string sql = "select pif_ic, pif_name, pif_pattyp, pif_mrn, pif_dob, pif_sex, pif_address, pif_contactperson, pif_contact, pif_imgloc, pif_insurance, pif_insid, pif_docname " + " from pat_info " + " left join zinfo_a_07 f on pat_info.pif_id = f.pat_id and f.opt_1 not in('','5') and f.info_date <= '" + TrDate + "' " + " WHERE pif_dob<= CURDATE() and SUBSTR(PIF_DOB,1,1) IN ('1','2') " + " AND PIF_SEX<>'' and pat_info.pif_id not in (select b.pif_id from pat_info b " + " inner join (select a.pat_id,a.opt_1, a.info_date from zinfo_a_07 a " + " inner join (select pat_id,max(info_date) AS last_date from zinfo_a_07 group by pat_id) b " + " on a.pat_id=b.pat_id and a.info_date=b.last_date) f " + " on b.pif_id = f.pat_id and f.opt_1 in('1','2','3','4') and f.info_date<='" + TrDate + "') " + " group by pif_ic limit 10"; Mydt = db.Query(sql); if (Mydt.Rows.Count > 0) { string pif_ic = "", pif_contactperson = "", pif_address = "", pif_sex = "", pif_dob = "", pif_mrn = "", pif_pattyp = "", pif_name = ""; string pif_contact = ""; //tel string pif_imgloc = "", pif_docname = "", pif_insid = "", pif_insurance = ""; DateTime lastUpdated; getAuditList(); try { lastUpdated = new DateTime(Convert.ToInt16(slastUpdated.Substring(0, 4)), Convert.ToInt16(slastUpdated.Substring(5, 2)), Convert.ToInt16(slastUpdated.Substring(8, 2))); } catch (Exception) { lastUpdated = DateTime.Now; } ConcurrentBag <AuditObject> successList = new ConcurrentBag <AuditObject>(); ConcurrentBag <AuditObject> failList = new ConcurrentBag <AuditObject>(); int patientCounter = 0; Stopwatch sw1 = new Stopwatch(); sw1.Start(); foreach (DataRow row in Mydt.Rows) //Parallel.ForEach(Mydt.AsEnumerable(), row => { patientCounter++; logger.Info(""); logger.Info("Patient information: " + patientCounter.ToString() + "/" + Mydt.Rows.Count.ToString() + "@" + "pif_ic=" + row["pif_ic"].ToString() + ",pif_name=" + row["pif_name"].ToString()); dvFhir.RowFilter = "C1='" + row["pif_ic"].ToString() + "'"; if (dvFhir.Count > 0) { // 先拿掉要 5 天以上才能更新的門檻 - Remarked by Evan 20160906 //if (lastUpdated.CompareTo(DateTime.Now.AddDays(-5)) < 0) { if (dvFhir[0].Row["C3"].ToString() == (row["pif_name"].ToString() + row["pif_docname"].ToString() + row["pif_dob"].ToString()).GetHashCode().ToString()) { logger.Info("Patient information pif_ic no transfer:@pif_ic=" + row["pif_ic"].ToString() + ",pif_name=" + row["pif_name"].ToString()); continue; } } //else //{ // logger.Info("Patient information pif_ic no transfer:@pif_ic=" + row["pif_ic"].ToString() + ",pif_name=" + row["pif_name"].ToString()); // continue; //} //------------------------------ } pif_ic = row["pif_ic"].ToString(); pif_name = row["pif_name"].ToString(); pif_pattyp = row["pif_pattyp"].ToString(); pif_mrn = row["pif_mrn"].ToString(); pif_dob = row["pif_dob"].ToString(); pif_sex = row["pif_sex"].ToString(); pif_address = row["pif_address"].ToString(); pif_contactperson = row["pif_contactperson"].ToString(); pif_contact = row["pif_contact"].ToString(); pif_imgloc = row["pif_imgloc"].ToString(); pif_insurance = row["pif_insurance"].ToString(); pif_insid = row["pif_insid"].ToString(); pif_docname = row["pif_docname"].ToString(); try { AuditObject resultAudit; resultAudit = uploadAdmin.PatientCreateUpdate(orgId, orgName, pif_ic, pif_name, pif_dob, pif_pattyp, pif_mrn, pif_sex, pif_address, pif_contactperson, pif_contact, pif_imgloc, pif_insurance, pif_insid, pif_docname, ""); if (resultAudit.Success) { successList.Add(resultAudit); logger.Info("Patient Create Success@" + "pif_ic=" + pif_ic + ",pif_name=" + pif_name); } else { failList.Add(resultAudit); logger.Info("Patient Create Fail@" + "pif_ic=" + pif_ic + ",pif_name=" + pif_name); } } catch (Exception ex) { failList.Add(new AuditObject { Success = false, Name = pif_ic, Desc = pif_name }); logger.Error(ex.Message); logger.Error("Patient Create catch Fail@" + "pif_ic=" + pif_ic + ",pif_name=" + pif_name); logger.Info("Patient Create catch Fail@" + "pif_ic=" + pif_ic + ",pif_name=" + pif_name); } } ; sw1.Stop(); logger.Info("Patient Create/Update exec:" + patientCounter.ToString() + "/" + Mydt.Rows.Count + " total cost " + (sw1.ElapsedMilliseconds / 1000).ToString() + " seconds"); sw1.Restart(); try { if (successList.Count > 0) { string ip = null; if (HttpContext.Current != null) { ip = HttpContext.Current.Request.UserHostAddress; } else { System.Net.IPAddress SvrIP = new System.Net.IPAddress(Dns.GetHostByName(Dns.GetHostName()).AddressList[0].Address); ip = SvrIP.ToString(); } uploadAdmin.AuditEventPatientCreateUpdate("UL.PATIENT", orgId, "Organization", orgId, orgId, successList.ToList <AuditObject>(), Hl7.Fhir.Model.AuditEvent.AuditEventOutcome.N0, new Hl7.Fhir.Model.Coding("http://www.datacom.com.tw", "UL.PATIENT"), HttpContext.Current.Request.UserHostAddress); } } catch (Exception ex) { logger.Error(ex.Message); logger.Error("Audit Create catch Fail@" + "UL.PATIENT"); } sw1.Stop(); logger.Info("PatientAudit Create/Update total cost " + (sw1.ElapsedMilliseconds / 1000).ToString() + " seconds"); } } catch (Exception uploadAdminException) { logger.Error(uploadAdminException.Message); logger.Error("UploadAdmin Error:" + uploadAdminException.Message); return(false); } finally { } return(true); }
public bool UploadPractitioner(string TrDate) { string[] OrganizationInfo; try { OrganizationInfo = DialysisToFhir.ReadFhirID01(); if (OrganizationInfo[0] == "nodata") { return(false); } orgId = OrganizationInfo[0]; orgName = OrganizationInfo[1]; } catch (Exception) { return(false); } UploadAdmin uploadAdmin = new UploadAdmin(); try { uploadAdmin.OrganizationCreateUpdate(orgId); logger.Info("Organization Create/Update:" + orgId); } catch (Exception ex) { logger.Error(ex.Message); } //多筆醫師處置人員 DBMysql db = new DBMysql(); DataTable Mydt = new DataTable(); string sSQL = "SELECT usrnm, name, type, active FROM access_level "; sSQL += "ORDER BY acclv_id"; Mydt = db.Query(sSQL); if (Mydt.Rows.Count > 0) { string acclv_stfcode = "Admin"; string acclv_fname = "Administrator"; string acclv_type = "Doctor"; Boolean acclv_active = true; DateTime lastUpdated; getAuditList(); try { lastUpdated = new DateTime(Convert.ToInt16(slastUpdated.Substring(0, 4)), Convert.ToInt16(slastUpdated.Substring(5, 2)), Convert.ToInt16(slastUpdated.Substring(8, 2))); } catch (Exception) { lastUpdated = DateTime.Now.AddMonths(-1); } ConcurrentBag <AuditObject> successList = new ConcurrentBag <AuditObject>(); ConcurrentBag <AuditObject> failList = new ConcurrentBag <AuditObject>(); int practitionerCounter = 0; AuditObject resultAudit = new AuditObject(); resultAudit.Success = false; Stopwatch sw = new Stopwatch(); sw.Start(); foreach (DataRow row in Mydt.Rows) //Parallel.ForEach(Mydt.AsEnumerable(), row => { lock (syncHandle) { acclv_stfcode = row["usrnm"].ToString(); acclv_fname = row["name"].ToString(); acclv_type = row["type"].ToString(); if (row["active"].ToString() == "A") { acclv_active = true; } else { acclv_active = false; } } practitionerCounter++; logger.Info("Practitioner Create " + practitionerCounter.ToString() + "/" + Mydt.Rows.Count.ToString() + " @" + "acclv_stfcode=" + acclv_stfcode + ",acclv_fname=" + acclv_fname); dvFhir.RowFilter = "C1='" + acclv_stfcode + "'"; if (dvFhir.Count > 0) { // 先拿掉要 5 天以上才能更新的門檻 - Remarked by Evan 20160906 //if (lastUpdated.CompareTo(DateTime.Now.AddDays(-5)) < 0) { if (dvFhir[0].Row["C3"].ToString() == acclv_fname.GetHashCode().ToString()) { continue; } } //else // continue; //------------------------------ } try { // TODO: Create Practitioner //orgId, orgName, Stracclv_stfcode, Stracclv_fname, Stracclv_type, typeSystem, Bacclv_active, tel, email // logger.Info("Practitioner Create/Update:" + practitionerCounter + "/" + Mydt.Rows.Count); resultAudit = uploadAdmin.PractitionerCreateUpdate(orgId, orgName, acclv_stfcode, acclv_fname, acclv_type, "", acclv_active, "", ""); if (resultAudit.Success) { successList.Add(resultAudit); } else { failList.Add(resultAudit); } } catch (Exception ex) { failList.Add(new AuditObject { Success = false, Name = acclv_stfcode, Desc = acclv_fname }); logger.Error(ex.Message); logger.Info(ex.Message); logger.Error("Practitioner Create catch Fail: " + practitionerCounter.ToString() + "/" + Mydt.Rows.Count.ToString() + " @" + "acclv_stfcode=" + acclv_stfcode + ",acclv_fname=" + acclv_fname); } //while (interval.CompareTo(DateTime.Now) > 0) { if (flag) { logger.Info("--------------"); flag = false; } }; } ; sw.Stop(); logger.Info("Practitioner Create/Update exec:" + practitionerCounter.ToString() + "/" + Mydt.Rows.Count.ToString() + " total cost " + (sw.ElapsedMilliseconds / 1000).ToString() + " seconds"); string ip = null; if (HttpContext.Current != null) { ip = HttpContext.Current.Request.UserHostAddress; } else { System.Net.IPAddress SvrIP = new System.Net.IPAddress(Dns.GetHostByName(Dns.GetHostName()).AddressList[0].Address); ip = SvrIP.ToString(); } try { if (successList.Count > 0) { uploadAdmin.AuditEventPracCreateUpdate("UL.PRACTITIONER", orgId, "Organization", orgId, orgId, successList.ToList <AuditObject>(), Hl7.Fhir.Model.AuditEvent.AuditEventOutcome.N0, new Hl7.Fhir.Model.Coding("http://www.datacom.com.tw", "UL.PRACTITIONER"), ip); } //if (successList.Count > 0) // uploadAdmin.AuditEventCreateUpdate("UL.Practitioner", "Organization", orgId, orgId, successList.ToList<AuditObject>(), // Hl7.Fhir.Model.AuditEvent.AuditEventAction.U, Hl7.Fhir.Model.AuditEvent.AuditEventOutcome.N0, // new Hl7.Fhir.Model.Coding("http://www.datacom.com.tw", "UL_PRACTITIONER"), ip); //if (failList.Count > 0) // uploadAdmin.AuditEventCreateUpdate("UL.Practitioner", "Organization", orgId, orgId, failList.ToList<AuditObject>(), // Hl7.Fhir.Model.AuditEvent.AuditEventAction.U, Hl7.Fhir.Model.AuditEvent.AuditEventOutcome.N4, // new Hl7.Fhir.Model.Coding("http://www.datacom.com.tw", "UL_PRACTITIONER"), ip); } catch (Exception ex) { logger.Error(ex.Message); logger.Error("AuditEvent Create catch Fail@" + "UL.PRACTITIONER"); } } return(true); }
public CuentaAbono(DBMysql DBMysql_) { this.DBMysql_ = DBMysql_; }
public Cliente(DBMysql DBMysql_) { this.DBMysql_ = DBMysql_; }
protected void btnDecrypt_Click(object sender, DirectEventArgs e) { //if (TextField1.Text == "" || TextField16.Text == "") if (TextField1.Text == "") { _ErrorMsgShow("请输入工号!"); return; } else { DBMysql db = new DBMysql(); string sql = "SELECT a.acclv_fname,a.acclv_funm "; sql += " FROM access_level a "; sql += "where a.acclv_stfcode = '" + TextField1.Text.Replace("'", "''") + "' "; //sql += " and a.acclv_funm = '" + TextField16.Text.Replace("'", "''") + "' "; DataTable dt = db.Query(sql); if (dt.Rows.Count == 1) { if (a == "TextField19") { TextField19.Text = dt.Rows[0]["acclv_fname"].ToString(); } else if (a == "TextField20") { TextField20.Text = dt.Rows[0]["acclv_fname"].ToString(); } else if (a == "TextField21") { TextField21.Text = dt.Rows[0]["acclv_fname"].ToString(); } else if (a == "TextField17") { TextField17.Text = dt.Rows[0]["acclv_fname"].ToString(); } else if (a == "TextField22") { TextField22.Text = dt.Rows[0]["acclv_fname"].ToString(); } else if (a == "TextField23") { TextField23.Text = dt.Rows[0]["acclv_fname"].ToString(); } } else { //AlexShen 20151210 //sql = "SELECT a.acclv_fname,a.acclv_funm "; //sql += " FROM access_level a "; //sql += "where a.acclv_stfcode = '" + TextField1.Text.Replace("'", "''") + "' "; //dt = db.Query(sql); //if (dt.Rows.Count > 0) //{ //_ErrorMsgShow("密码错误请重新输入!"); //TextField16.Text = ""; //return; //} //else { _ErrorMsgShow("登入失败请重新输入!"); //TextField16.Text = ""; TextField1.Text = ""; return; } } a = ""; TextField1.Text = ""; //TextField16.Text = ""; Window1.Close(); } }
protected void Show_Bio_Not_Checked_List_orn() { DBMysql db = new DBMysql(); int iFlag = 0, iCount = 0, iOrn = 0; string sql; DateTime today = DateTime.Now; string sDate = today.ToString("yyyy-MM-dd"); string sMdate = today.ToString("yyyy-MM-dd").Substring(0, 8); string weekType = (0 == (iOrn = today.DayOfWeek.GetHashCode()) ? 7 : iOrn).ToString(); string sTitle = " " + sMdate + "01 ~ " + sDate + " 未检测项目 "; sql = "SELECT pi.pif_id, pi.PIF_IC, ars.RESULT_VALUE, pi.PIF_NAME, pi.RESULT_CODE, pi.RITEM_NAME, if (ars.RESULT_VALUE > 0, 0, 1) as NotChecked "; sql += "FROM "; sql += "(SELECT pio.pif_id, pio.pif_name, pio.pif_ic, bcl.RESULT_CODE, bcl.RITEM_NAME "; sql += "FROM pat_info pio "; sql += "NATURAL JOIN bio_check_list bcl where pio.pif_id IN "; sql += "(SELECT P.pif_id FROM mac_setup M "; sql += "LEFT JOIN appointment_setup A ON M.mac_flr = A.apptst_flr "; sql += "AND M.mac_sec = A.apptst_sec AND M.mac_bedno = A.apptst_bed AND A.apptst_daytyp='" + weekType + "' "; sql += "INNER JOIN pat_info P ON A.apptst_patic=P.pif_ic) and bcl.I_MONTH = 1) pi "; sql += "LEFT JOIN "; sql += "(SELECT arl.pat_no, arl.result_date, arl.result_code, arl.RESULT_VALUE_T AS RESULT_VALUE "; sql += "FROM a_result_log arl "; sql += "where arl.RESULT_CODE IN (SELECT RESULT_CODE FROM bio_check_list where I_MONTH = 1) "; sql += "and result_date >= '" + sMdate + "01' and result_date <= '" + sDate + "') ars on pi.pif_id = ars.pat_no and pi.RESULT_CODE = ars.RESULT_CODE "; sql += "ORDER BY pi.pif_id, pi.RESULT_CODE "; DataTable dt = db.Query(sql); DataTable dtNCL = new DataTable(); foreach (DataColumn item in dt.Columns) { string sColumn = item.ToString(); if (sColumn == "PIF_IC" || sColumn == "RESULT_VALUE" || sColumn == "PIF_NAME") { dtNCL.Columns.Add(sColumn); } } DataRow drN = dtNCL.NewRow(); // 相同的資料,不同的版面,重新排版,未來有時間可考慮寫成陽春型排版系統(.net java 都有人做過) 例:excel vba foreach (DataRow dr in dt.Rows) { int iPid = int.Parse(dr["pif_id"].ToString()); if (iPid != iFlag) { if (iFlag != 0) { drN["RESULT_VALUE"] += iCount.ToString() + " 项: "; dtNCL.Rows.Add(drN); iCount = 0; drN = dtNCL.NewRow(); } iFlag = iPid; } if (dr["NotChecked"].ToString() == "1") { if (iCount == 0) { drN["PIF_IC"] = dr["PIF_NAME"].ToString(); drN["RESULT_VALUE"] = sTitle; drN["PIF_NAME"] = dr["RITEM_NAME"].ToString(); } else { drN["PIF_NAME"] += ", " + dr["RITEM_NAME"].ToString(); } iCount++; } } drN["RESULT_VALUE"] += iCount.ToString() + " 项: "; dtNCL.Rows.Add(drN); Store istore = Grid_BioNotChecked_List.GetStore(); istore.DataSource = db.GetDataArray_AddRowNum(dtNCL); istore.DataBind(); }
public static Paging <Doctor> DoctorsPaging(int start, int limit, string sort, string dir, string filter) { List <Doctor> doctors = new List <Doctor>(); if (filter.Length > 0) { doctors.Clear(); DBMysql db = new DBMysql(); List <Doctor> data = new List <Doctor>(); string sql = "SELECT PY, HZ, ZM FROM pinyin "; if (filter != "*") { sql += "WHERE PY LIKE '" + filter + "%' AND ZM='" + filter.Substring(0, 1) + "' "; } DataTable dt = db.Query(sql); if (dt.Rows.Count > 0) //使用拼音輸入 { sql = "SELECT a.acclv_id, a.acclv_fname FROM access_level a "; sql += "INNER JOIN associate_list b ON a.acclv_id=b.associate_id "; sql += "WHERE (b.associate_type='DC' OR b.associate_type='DH') AND (1=0 "; for (int i = 0; i < dt.Rows.Count; i++) { sql += "OR a.acclv_fname LIKE '%" + dt.Rows[i]["HZ"].ToString() + "%' "; } sql += ") "; DataTable dt1 = db.Query(sql); if (dt1.Rows.Count > 0) { for (int j = 0; j < dt1.Rows.Count; j++) { Doctor doctor = new Doctor(); doctor.acclv_id = dt1.Rows[j]["acclv_id"].ToString(); doctor.acclv_fname = dt1.Rows[j]["acclv_fname"].ToString(); doctors.Add(doctor); } } dt1.Dispose(); } else { sql = "SELECT a.acclv_id, a.acclv_fname FROM access_level a "; //直接輸入中文字 sql += "INNER JOIN associate_list b ON a.acclv_id=b.associate_id "; sql += "WHERE (b.associate_type='DC' OR b.associate_type='DH') AND a.acclv_fname LIKE '%" + filter + "%' "; dt = db.Query(sql); if (dt.Rows.Count > 0) { for (int j = 0; j < dt.Rows.Count; j++) { Doctor doctor = new Doctor(); doctor.acclv_id = dt.Rows[j]["acclv_id"].ToString(); doctor.acclv_fname = dt.Rows[j]["acclv_fname"].ToString(); doctors.Add(doctor); } } } dt.Dispose(); db.Close(); } if (!string.IsNullOrEmpty(sort)) { doctors.Sort(delegate(Doctor x, Doctor y) { object a; object b; int direction = dir == "DESC" ? -1 : 1; a = x.GetType().GetProperty(sort).GetValue(x, null); b = y.GetType().GetProperty(sort).GetValue(y, null); return(CaseInsensitiveComparer.Default.Compare(a, b) * direction); }); } if ((start + limit) > doctors.Count) { limit = doctors.Count - start; } List <Doctor> rangeDoctors = (start < 0 || limit < 0) ? doctors : doctors.GetRange(start, limit); return(new Paging <Doctor>(rangeDoctors, doctors.Count)); }
protected void Show_Bio_Not_Checked_List() { DBMysql db = new DBMysql(); int iFlag = 0, iCount = 0, iCs = 4, iOrn = 0; string sql, sColumn, sColumnNAME, sColumnVALUE; DateTime today = DateTime.Now; string sDate = today.ToString("yyyy-MM-dd"); string sMdate = today.ToString("yyyy-MM-dd").Substring(0, 8); string weekType = (0 == (iOrn = today.DayOfWeek.GetHashCode()) ? 7 : iOrn).ToString(); string sTitle1 = " " + sMdate + "01 ~ " + today.ToString("yyyy-MM-dd").Substring(8, 2); string sTitle2 = "未检测项目"; sql = "SELECT pi.pif_id, pi.PIF_IC, ars.RESULT_VALUE, pi.PIF_NAME, pi.RESULT_CODE, pi.RITEM_NAME, if (ars.RESULT_VALUE > 0, 0, 1) as NotChecked "; sql += "FROM "; sql += "(SELECT pio.pif_id, pio.pif_name, pio.pif_ic, bcl.RESULT_CODE, bcl.RITEM_NAME "; sql += "FROM pat_info pio "; sql += "NATURAL JOIN bio_check_list bcl where pio.pif_id IN "; sql += "(SELECT P.pif_id FROM mac_setup M "; sql += "LEFT JOIN appointment_setup A ON M.mac_flr = A.apptst_flr "; sql += "AND M.mac_sec = A.apptst_sec AND M.mac_bedno = A.apptst_bed AND A.apptst_daytyp='" + weekType + "' "; sql += "INNER JOIN pat_info P ON A.apptst_patic=P.pif_ic) and bcl.I_MONTH = 1) pi "; sql += "LEFT JOIN "; sql += "(SELECT arl.pat_no, arl.result_date, arl.result_code, arl.RESULT_VALUE_T AS RESULT_VALUE "; sql += "FROM a_result_log arl "; sql += "where arl.RESULT_CODE IN (SELECT RESULT_CODE FROM bio_check_list where I_MONTH = 1) "; sql += "and result_date >= '" + sMdate + "01' and result_date <= '" + sDate + "') ars on pi.pif_id = ars.pat_no and pi.RESULT_CODE = ars.RESULT_CODE "; sql += "ORDER BY pi.pif_id, pi.RESULT_CODE "; DataTable dt = db.Query(sql); DataTable dtNCL = new DataTable(); if (dt.Rows.Count > 0) { for (int i = 1; i < 46; i++) { sColumn = "C" + i.ToString(); dtNCL.Columns.Add(sColumn); } DataRow drN = dtNCL.NewRow(); foreach (DataRow dr in dt.Rows) { int iPid = int.Parse(dr["pif_id"].ToString()); if (iPid != iFlag) { if (iFlag != 0) { drN["C3"] += iCount.ToString() + "项: "; dtNCL.Rows.Add(drN); iCount = 0; iCs = 4; drN = dtNCL.NewRow(); } iFlag = iPid; } if (iCs > 5) { if (iCs % 2 == 0) { iCs += 2; } } sColumnNAME = "C" + iCs.ToString(); sColumnVALUE = "C" + (iCs + 2).ToString(); if (iCount == 0) { drN["C1"] = dr["PIF_NAME"].ToString(); drN["C2"] = sTitle1; drN["C3"] = sTitle2; drN[sColumnNAME] = dr["RITEM_NAME"].ToString(); drN[sColumnVALUE] = dr["NotChecked"].ToString() == "1" ? "X" : dr["RESULT_VALUE"].ToString(); } else { drN[sColumnNAME] = dr["RITEM_NAME"].ToString(); drN[sColumnVALUE] = dr["NotChecked"].ToString() == "1" ? "X" : dr["RESULT_VALUE"].ToString(); } iCount++; iCs++; } drN["C3"] += iCount.ToString() + "项: "; dtNCL.Rows.Add(drN); DataTable dtNCL2 = new DataTable(); for (int i = 1; i < 4; i++) { sColumn = "C" + i.ToString(); dtNCL2.Columns.Add(sColumn); } DataRow drN2 = dtNCL2.NewRow(); foreach (DataRow dr in dtNCL.Rows) { for (iCs = 1; iCs < 47; iCs++) { if (iCs < 4) { sColumnNAME = "C" + iCs.ToString(); drN2[sColumnNAME] = dr[sColumnNAME].ToString(); } else if (iCs % 2 == 0) { dtNCL2.Rows.Add(drN2); drN2 = dtNCL2.NewRow(); } if (iCs > 3 && iCs < 46) { sColumnNAME = "C" + iCs.ToString(); sColumnVALUE = "C" + (iCs % 2 + 2).ToString(); drN2[sColumnVALUE] = dr[sColumnNAME].ToString(); } } } Store istore = Grid_BioNotChecked_List.GetStore(); istore.DataSource = db.GetDataArray_AddRowNum(dtNCL2); istore.DataBind(); } }
public Producto(DBMysql DBMysql_) { this.DBMysql_ = DBMysql_; }
protected void FILL_BED() { //if (GetComboBoxValu(this.cboFLOOR) != "") // sFLOOR.Text = GetComboBoxValu(this.cboFLOOR); //if (GetComboBoxValu(this.cboAREA) != "") // sAREA.Text = GetComboBoxValu(this.cboAREA); DateTime now = DateTime.Now; //this.txtDATE.Text = now.ToString("yyyy-MM-dd"); this.txtTIME.Text = now.ToString("yyyy-MM-dd HH:mm:ss"); //sDATE.Text = this.txtDATE.Text; sDATE.Text = this.txtTIME.Text.Substring(0, 10); GET_WEEK(); string sSQL = ""; sSQL = "SELECT M.mac_bedno AS BED_NO, G.genst_desc AS MAC_MODEL, M.mac_typ AS MAC_TYPE, M.mac_status AS MAC_STATE, " + "P.pif_name AS PERSON_NAME, A.apptst_patic AS PERSON_ID, " + "V.pv_weight AS PERSON_WEIGHT, V.pv_macstat AS PERSON_STATE " + "FROM mac_setup M " + "LEFT JOIN appointment_setup A " + "ON M.mac_flr=A.apptst_flr " + "AND M.mac_sec=A.apptst_sec " + "AND M.mac_bedno=A.apptst_bed " + "AND A.apptst_daytyp='" + sWEEK.Text + "' " + "AND A.apptst_timetyp='" + sTIME.Text + "' " + "LEFT JOIN pat_visit V " + "ON A.apptst_patic=V.pv_ic " + "AND V.pv_datevisit='" + sDATE.Text + "' " + "LEFT JOIN general_setup G " + "ON M.mac_brand=G.genst_code " + "AND G.genst_ctg='macbrd' " + "LEFT JOIN pat_info P " + "ON A.apptst_patic=P.pif_ic " + "WHERE M.mac_flr='" + sFLOOR.Text + "' " + "AND M.mac_sec='" + sAREA.Text + "' " + "ORDER BY CONVERT(SUBSTRING_INDEX(M.mac_bedno, '-', 1),UNSIGNED INTEGER), M.mac_bedno "; // "AND M.mac_sec='" + sAREA.Text + "' " + DBMysql db = new DBMysql(); System.Data.DataTable dt = db.Query(sSQL); //補上臨時預約 2015.03.26 ANDY 暫MARK sSQL = "SELECT A.ah_bed, A.ah_patic, A.ah_flr, A.ah_sec, " + "A.ah_bed, A.ah_timetyp, P.pif_name, " + "V.pv_weight, V.pv_macstat " + "FROM appointment_change A " + "LEFT JOIN pat_info P " + "ON A.ah_patic=P.pif_ic " + "LEFT JOIN pat_visit V " + "ON A.ah_patic=V.pv_ic " + "AND V.pv_datevisit='" + sDATE.Text + "' " + "WHERE ah_date='" + sDATE.Text + "' " + "AND ah_timetyp='" + sTIME.Text + "' "; System.Data.DataTable dt2 = db.Query(sSQL); System.Data.DataView dv = dt.DefaultView; //Column5.Text = sDATE.Text; Column5.Text = "25"; //2015.01.07 這裡是臨時預約跟換床沒關 先把flag旗標關閉 //bool changeFlag = false; //2014.01.05 Frank 開始點名換床的人 for (int i = 0; i < dt2.Rows.Count; i++) { dv.RowFilter = "PERSON_ID='" + dt2.Rows[i]["ah_patic"].ToString() + "' "; if (dv.Count > 0) { dv[0]["PERSON_NAME"] = ""; dv[0]["PERSON_WEIGHT"] = ""; dv[0]["PERSON_STATE"] = ""; dv[0]["PERSON_ID"] = ""; //2015.01.07 這裡是臨時預約跟換床沒關 先把flag旗標關閉 //changeFlag = true; } dv.RowFilter = "BED_NO='" + dt2.Rows[i]["ah_bed"].ToString() + "' "; if (dv.Count > 0) { dv[0]["PERSON_ID"] = dt2.Rows[i]["ah_patic"].ToString(); //2015.01.07 這裡是臨時預約跟換床沒關 先把flag旗標關閉 //if (changeFlag) //dv[0]["PERSON_NAME"] = dt2.Rows[i]["pif_name"].ToString() + ""; //2015.01.07 這裡是臨時預約跟換床沒關 先把flag旗標關閉 //else // dv[0]["PERSON_NAME"] = dt2.Rows[i]["pif_name"].ToString() + "(临)"; dv[0]["PERSON_NAME"] = dt2.Rows[i]["pif_name"].ToString(); dv[0]["PERSON_WEIGHT"] = dt2.Rows[i]["pv_weight"].ToString(); dv[0]["PERSON_STATE"] = dt2.Rows[i]["pv_macstat"].ToString(); } } Session.Add("PAD_TIME", sTIME.Text); Session.Add("PAD_FLOOR", sFLOOR.Text); Session.Add("PAD_AREA", sAREA.Text); ROW_CNT.Text = dt.Rows.Count.ToString(); for (int i = 0; i < dt.Rows.Count; i++) { switch (dt.Rows[i]["PERSON_STATE"].ToString()) { case "A": dt.Rows[i]["PERSON_STATE"] = "开"; break; case "S": dt.Rows[i]["PERSON_STATE"] = "关"; break; } switch (dt.Rows[i]["MAC_STATE"].ToString()) { case "Y": dt.Rows[i]["MAC_STATE"] = "正常"; break; case "y": dt.Rows[i]["MAC_STATE"] = "正常"; break; case "N": dt.Rows[i]["MAC_STATE"] = "保养中"; break; case "n": dt.Rows[i]["MAC_STATE"] = "保养中"; break; } } dt.AcceptChanges(); Store istore = grdBED_LIST.GetStore(); istore.DataSource = db.GetDataArray(dt); istore.DataBind(); }
public List <SaatlikDurum> SaatlikIstek(DBMysql db, MySqlDataReader reader, List <model> Nesneler, string[] veriler, int saat) { db = new DBMysql(); db.OpenConnection(); List <SaatlikDurum> saatlikNesne = new List <SaatlikDurum>(); SaatlikDurum s_nesne; int hourWather = (int.Parse(veriler[2]) - 1) * 3; if (hourWather > saat) { hourWather = (hourWather - saat) / 3; } else if (hourWather < saat) { hourWather = (24 - saat + hourWather) / 3; } else { hourWather = 0; } string _saat; if (saat < 10) { _saat = "0" + saat.ToString(); } else { _saat = saat.ToString(); } string date = DateTime.Now.ToString($"{veriler[3]} {_saat}"); int indexSayac_ = 0; reader = db.CommandReader($"SELECT * FROM HourlyForecasts WHERE tarih1='{date}'"); while (reader.Read()) { int index = Nesneler.FindIndex(a => a.SaatlikIstasyon == reader.GetString(2)); s_nesne = new SaatlikDurum(); s_nesne.ilAdi = Nesneler[index].ilAd; s_nesne.lat = Nesneler[index].lat; s_nesne.lang = Nesneler[index].lang; s_nesne.ilceAdi = Nesneler[index].ilceAd; s_nesne.SaatlikistNo = Nesneler[index].SaatlikIstasyon; s_nesne.Hadise = reader.GetString(5 + hourWather * 8); s_nesne.Sicaklik = reader.GetDecimal(6 + hourWather * 8); s_nesne.HissedilenSicaklik = reader.GetDecimal(7 + hourWather * 8); s_nesne.Nem = reader.GetInt32(8 + hourWather * 8); s_nesne.RuzgarYon = reader.GetInt32(9 + hourWather * 8); s_nesne.RuzgarHizi = reader.GetInt32(10 + hourWather * 8); s_nesne.MaxRuzgarHizi = reader.GetInt32(11 + hourWather * 8); s_nesne.Resim = reader.GetString(5 + hourWather * 8) + ".png"; if (indexSayac_ == 0 || saatlikNesne[indexSayac_ - 1].SaatlikistNo != s_nesne.SaatlikistNo) { saatlikNesne.Add(s_nesne); indexSayac_++; } } db.CloseConnection(); return(saatlikNesne); }
public static List <UsrInf_Cond_zinfo_a_04> GetData(string sPat_id, string sInfo_date) { DBMysql DbInfo = new DBMysql(); DataTable MyInfoDt = new DataTable(); string sSQL = ""; //sSQL = sSQL + " select z.* ,p.pif_id,pif_name,pif_ic from zinfo_a_04 z left join //pat_info p on p.pif_id = z.pat_id "; //sSQL = sSQL + " where pat_id = '" + sPat_id + "' and info_date = '" + sInfo_date + "' "; if (!string.IsNullOrWhiteSpace(sPat_id)) { sSQL = sSQL + " select z.* ,p.pif_id,pif_name,pif_ic from zinfo_a_04 z left join pat_info p on p.pif_id = z.pat_id "; sSQL = sSQL + " where pat_id = '" + sPat_id + "' and info_date = '" + sInfo_date + "' "; } MyInfoDt = DbInfo.Query(sSQL); UsrInf_Cond_zinfo_a_04_List = null; if (UsrInf_Cond_zinfo_a_04_List == null) { UsrInf_Cond_zinfo_a_04_List = new List <UsrInf_Cond_zinfo_a_04>(); if (MyInfoDt.Rows.Count > 0) { for (int cc = 0; cc <= MyInfoDt.Rows.Count - 1; cc++) { UsrInf_Cond_zinfo_a_04 UsrInf_Cond_zinfo_a_04_00 = new UsrInf_Cond_zinfo_a_04(); //塞欄位到 UsrInf_Cond_zinfo_a_04 class /* * pat_id string * info_date string * info_user string * chk_1 string * txt_2 string * */ // Convert.ToInt32(MyInfoDt.Rows[cc]["ROW_ID"].ToString().Trim()); // MyInfoDt.Rows[cc]["ROW_ID"].ToString().Trim(); UsrInf_Cond_zinfo_a_04_00.pat_id = MyInfoDt.Rows[cc]["pat_id"].ToString().Trim(); UsrInf_Cond_zinfo_a_04_00.info_date = MyInfoDt.Rows[cc]["info_date"].ToString().Trim(); UsrInf_Cond_zinfo_a_04_00.info_user = MyInfoDt.Rows[cc]["info_user"].ToString().Trim(); if (string.IsNullOrWhiteSpace((MyInfoDt.Rows[cc]["chk_1"].ToString().Trim()))) { UsrInf_Cond_zinfo_a_04_00.chk_1 = ""; } else { UsrInf_Cond_zinfo_a_04_00.chk_1 = MyInfoDt.Rows[cc]["chk_1"].ToString().Trim(); } UsrInf_Cond_zinfo_a_04_00.txt_2 = MyInfoDt.Rows[cc]["txt_2"].ToString().Trim(); //pat_info 欄位 pif_name if (string.IsNullOrWhiteSpace((MyInfoDt.Rows[cc]["pif_name"].ToString().Trim()))) { UsrInf_Cond_zinfo_a_04_00.pif_name = ""; } else { UsrInf_Cond_zinfo_a_04_00.pif_name = MyInfoDt.Rows[cc]["pif_name"].ToString().Trim(); } //pat_info 欄位 pif_ic if (string.IsNullOrWhiteSpace((MyInfoDt.Rows[cc]["pif_ic"].ToString().Trim()))) { UsrInf_Cond_zinfo_a_04_00.pif_ic = ""; } else { UsrInf_Cond_zinfo_a_04_00.pif_ic = MyInfoDt.Rows[cc]["pif_ic"].ToString().Trim(); } UsrInf_Cond_zinfo_a_04_List.Add(UsrInf_Cond_zinfo_a_04_00); } } } return(UsrInf_Cond_zinfo_a_04_List); }//GetData
public JsonResult VeriGetir(string[] veriler) { DBMysql db = new DBMysql(); db.OpenConnection(); MySqlDataReader reader; List <model> Nesneler = new List <model>(); model md; if (veriler[0] != "il Seçin" && veriler[1] == "2") { reader = db.CommandReader($"select * from CityMasterTable Where Oncelik='1'"); } else if (veriler[0] != "il Seçin") { reader = db.CommandReader($"select * from CityMasterTable Where ilAdi='{veriler[0]}'"); } else { reader = db.CommandReader($"select * from CityMasterTable Where Oncelik='1'"); } while (reader.Read()) { if (reader.GetInt32(6) % 100 != 1 || reader.GetInt32(2) != 0) { md = new model(); md.lat = reader.GetDouble(4); //enlem md.lang = reader.GetDouble(5); //boylam md.ilAd = reader.GetString(0); //il ad md.ilceAd = reader.GetString(1); //ilce ad md.GunlukIstasyon = reader.GetInt32(6); //Gunlük istasyon no if (!reader.IsDBNull(reader.GetOrdinal("SaatlikTahminIstNo"))) { md.SaatlikIstasyon = reader.GetString(7);//Saatlik istasyon no } if (!reader.IsDBNull(reader.GetOrdinal("SonDurumTahminIstNo"))) { md.SonDurumIstasyon = reader.GetInt32(8);//son durum tahmin istasyon } Nesneler.Add(md); } } if (veriler[1] == "1") { List <GunlukDurum> gunlukNesne = new List <GunlukDurum>(); GunlukDurum g_nesne; reader.Close(); string date = DateTime.Now.ToString($"{veriler[3]} 02:00:00"); string date1 = DateTime.Now.ToString($"{veriler[3]} 04:00:00"); int dayWeather = int.Parse(veriler[2]) - 1; if (veriler[0] != "il Seçin") { reader = db.CommandReader($"SELECT * FROM DailyForecasts WHERE (InsertDate BETWEEN '{date}' AND '{date1}') AND ilAdi='{veriler[0]}'"); while (reader.Read()) { int index = Nesneler.FindIndex(a => a.GunlukIstasyon == reader.GetInt32(2)); g_nesne = new GunlukDurum(); g_nesne.ilAdi = Nesneler[index].ilAd; g_nesne.lat = Nesneler[index].lat; g_nesne.lang = Nesneler[index].lang; g_nesne.ilceAdi = Nesneler[index].ilceAd; g_nesne.GunlukistNo = Nesneler[index].GunlukIstasyon; g_nesne.EnDusukSicaklik = reader.GetDecimal(9 + dayWeather); g_nesne.EnyuksekSicaklik = reader.GetDecimal(14 + dayWeather); g_nesne.hadiseKodu = reader.GetString(29 + dayWeather); g_nesne.Resim = reader.GetString(29 + dayWeather) + ".png"; g_nesne.EnDusukNem = reader.GetDecimal(19 + dayWeather); g_nesne.EnYuksekNem = reader.GetDecimal(24 + dayWeather); g_nesne.RuzgarHizi = reader.GetDecimal(34 + dayWeather); g_nesne.RuzgarYon = reader.GetDecimal(39 + dayWeather); gunlukNesne.Add(g_nesne); } } else { int indexSayac = 0; reader = db.CommandReader($"SELECT * FROM DailyForecasts WHERE (InsertDate BETWEEN '{date}' AND '{date1}')"); while (reader.Read()) { if (Convert.ToInt32(reader.GetInt32(2)) % 100 == 1) { int index = Nesneler.FindIndex(a => a.GunlukIstasyon == reader.GetInt32(2)); g_nesne = new GunlukDurum(); g_nesne.ilAdi = Nesneler[index].ilAd; g_nesne.lat = Nesneler[index].lat; g_nesne.lang = Nesneler[index].lang; g_nesne.ilceAdi = Nesneler[index].ilceAd; g_nesne.GunlukistNo = Nesneler[index].GunlukIstasyon; g_nesne.EnDusukSicaklik = reader.GetDecimal(9 + dayWeather); g_nesne.EnyuksekSicaklik = reader.GetDecimal(14 + dayWeather); g_nesne.hadiseKodu = reader.GetString(29 + dayWeather); g_nesne.Resim = reader.GetString(29 + dayWeather) + ".png"; g_nesne.EnDusukNem = reader.GetDecimal(19 + dayWeather); g_nesne.EnYuksekNem = reader.GetDecimal(24 + dayWeather); g_nesne.RuzgarHizi = reader.GetDecimal(34 + dayWeather); g_nesne.RuzgarYon = reader.GetDecimal(39 + dayWeather); if (indexSayac == 0 || gunlukNesne[indexSayac - 1].GunlukistNo != g_nesne.GunlukistNo) { gunlukNesne.Add(g_nesne); indexSayac++; } } } } return(Json(gunlukNesne, JsonRequestBehavior.AllowGet)); } else if (veriler[1] == "2") { List <SaatlikDurum> saatlikNesne_; int DataHours = ((int.Parse(veriler[2])) - 1); int saat = 0; saatlikNesne_ = SaatlikIstek(db, reader, Nesneler, veriler, saat); while (saatlikNesne_.Count < 70) { reader.Close(); saat += 3; saatlikNesne_ = SaatlikIstek(db, reader, Nesneler, veriler, saat); } return(Json(saatlikNesne_, JsonRequestBehavior.AllowGet)); } db.CloseConnection(); return(Json(Nesneler, JsonRequestBehavior.AllowGet)); }
public void SetConnection(DBMysql DBMysql_) { this.DBMysql_ = DBMysql_; }
public JsonResult GunlukdurumGetir(string[] dataliste) { GunlukDurum gunlukNesne = new GunlukDurum(); DBMysql db = new DBMysql(); db.OpenConnection(); MySqlDataReader reader; int hours = DateTime.Now.Hour; int day = DateTime.Now.Day; int month = DateTime.Now.Month; string h1 = ""; string h2 = ""; string month_ = ""; string dd = ""; if (day == 1 && hours < 3) { month--; day = 30; } if (month < 10) { month_ = "0" + month.ToString(); } else { month_ = month.ToString(); } if (hours < 3 || hours >= 15) { h1 = "14"; h2 = "16"; day--; } else { h1 = "02"; h2 = "04"; } if (day < 10) { dd = "0" + day.ToString(); } else { dd = day.ToString(); } string date = DateTime.Now.ToString($"yyyy-{month_}-{dd} {h1}:00:00"); string date1 = DateTime.Now.ToString($"yyyy-{month_}-{dd} {h2}:00:00"); int dayWeather = Int32.Parse(dataliste[3]) - 1; reader = db.CommandReader($"SELECT * FROM DailyForecasts WHERE ilAdi='{dataliste[0]}' AND ilceAdi='{dataliste[1]}' AND (InsertDate BETWEEN '{date}' AND '{date1}')"); while (reader.Read()) { gunlukNesne.EnDusukSicaklik = reader.GetDecimal(9 + dayWeather); gunlukNesne.EnyuksekSicaklik = reader.GetDecimal(14 + dayWeather); gunlukNesne.hadiseKodu = reader.GetString(29 + dayWeather); gunlukNesne.EnDusukNem = reader.GetDecimal(19 + dayWeather); gunlukNesne.EnYuksekNem = reader.GetDecimal(24 + dayWeather); gunlukNesne.RuzgarHizi = reader.GetDecimal(34 + dayWeather); gunlukNesne.RuzgarYon = reader.GetDecimal(39 + dayWeather); } db.CloseConnection(); return(Json(gunlukNesne, JsonRequestBehavior.AllowGet)); }
public static Paging <Drug> drugsPaging(int start, int limit, string sort, string dir, string filter) { List <Drug> drugs = Drug.Getdrugname; if (filter.Length > 0) { drugs.Clear(); DBMysql db = new DBMysql(); List <Drug> data = new List <Drug>(); string sql = "SELECT drg_name FROM drug_list "; //簡碼輸入 sql += "WHERE short_code LIKE '%" + filter + "%' AND drg_status='Y'"; DataTable dt1 = db.Query(sql); if (dt1.Rows.Count > 0) { for (int j = 0; j < dt1.Rows.Count; j++) { Drug drug = new Drug(); drug.py = filter; drug.drugname = dt1.Rows[j]["drg_name"].ToString(); //drg_name drugs.Add(drug); } } else //直接輸入中文字 { sql = "SELECT drg_name FROM drug_list "; sql += "WHERE drg_name LIKE '%" + filter + "%' AND drg_status='Y' "; dt1 = db.Query(sql); if (dt1.Rows.Count > 0) { for (int j = 0; j < dt1.Rows.Count; j++) { Drug drug = new Drug(); drug.py = filter; drug.drugname = dt1.Rows[j]["drg_name"].ToString(); //drg_name drugs.Add(drug); } } else { sql = "SELECT PY, HZ, ZM FROM pinyin "; if (filter != "*") { sql += "WHERE PY LIKE '" + filter + "%' AND ZM='" + filter.Substring(0, 1) + "' "; } DataTable dt = db.Query(sql); if (dt.Rows.Count > 0) //使用拼音輸入 { sql = "SELECT drg_name FROM drug_list WHERE (1=0 "; for (int i = 0; i < dt.Rows.Count; i++) { sql += "OR drg_name LIKE '" + dt.Rows[i]["HZ"].ToString() + "%' "; } sql += ") AND drg_status='Y'"; dt1 = db.Query(sql); if (dt1.Rows.Count > 0) { for (int j = 0; j < dt1.Rows.Count; j++) { Drug drug = new Drug(); drug.py = filter.Substring(0, 1); drug.drugname = dt1.Rows[j]["drg_name"].ToString(); //drg_name drugs.Add(drug); } } } dt.Dispose(); } dt1.Dispose(); db.Close(); } } //if (!string.IsNullOrEmpty(filter) && filter != "*") //{ // drugs.RemoveAll(drug => !drug.py.StartsWith(filter)); //} if (!string.IsNullOrEmpty(sort)) { drugs.Sort(delegate(Drug x, Drug y) { object a; object b; int direction = dir == "DESC" ? -1 : 1; a = x.GetType().GetProperty(sort).GetValue(x, null); b = y.GetType().GetProperty(sort).GetValue(y, null); return(CaseInsensitiveComparer.Default.Compare(a, b) * direction); }); } if ((start + limit) > drugs.Count) { limit = drugs.Count - start; } List <Drug> rangeDrugs = (start < 0 || limit < 0) ? drugs : drugs.GetRange(start, limit); return(new Paging <Drug>(rangeDrugs, drugs.Count)); }
public JsonResult VerileriGetir() { DBMysql db = new DBMysql(); List <GunlukDurum> nesneListem = new List <GunlukDurum>(); GunlukDurum gunlukNesne; db.OpenConnection(); List <SelectListItem> Liste_il = new List <SelectListItem>(); MySqlDataReader reader = db.CommandReader("select * from CityMasterTable"); while (reader.Read()) { if (reader.GetInt32(2) > 0) { gunlukNesne = new GunlukDurum(); gunlukNesne.lat = reader.GetDouble(4); gunlukNesne.lang = reader.GetDouble(5); gunlukNesne.ilAdi = reader.GetString(0); gunlukNesne.GunlukistNo = reader.GetInt32(6); nesneListem.Add(gunlukNesne); } } reader.Close(); int hours = DateTime.Now.Hour; int day = DateTime.Now.Day; int month = DateTime.Now.Month; string h1 = ""; string h2 = ""; string month_ = ""; string dd = ""; if (day == 1 && hours < 3) { month--; day = 30; } if (month < 10) { month_ = "0" + month.ToString(); } else { month_ = month.ToString(); } if (hours < 3 || hours >= 15) { h1 = "14"; h2 = "16"; day--; } else { h1 = "02"; h2 = "04"; } if (day < 10) { dd = "0" + day.ToString(); } else { dd = day.ToString(); } string date = DateTime.Now.ToString($"yyyy-{month_}-{dd} {h1}:00:00"); string date1 = DateTime.Now.ToString($"yyyy-{month_}-{dd} {h2}:00:00"); reader = db.CommandReader($"SELECT * FROM DailyForecasts WHERE (InsertDate BETWEEN '{date}' AND '{date1}')"); while (reader.Read()) { if (Convert.ToInt32(reader.GetInt32(2)) % 100 == 1) { int index = nesneListem.FindIndex(a => a.GunlukistNo == reader.GetInt32(2)); nesneListem[index].EnDusukSicaklik = reader.GetDecimal(9); nesneListem[index].EnyuksekSicaklik = reader.GetDecimal(14); nesneListem[index].hadiseKodu = reader.GetString(29); nesneListem[index].Resim = reader.GetString(29) + ".png"; } } db.CloseConnection(); return(Json(nesneListem, JsonRequestBehavior.AllowGet)); }
public static Paging <Patinfo> PatinfosPaging(int start, int limit, string sort, string dir, string filter) { List <Patinfo> patinfos = Patinfo.Getpatname; if (filter.Length > 0) { patinfos.Clear(); DBMysql db = new DBMysql(); List <Patinfo> data = new List <Patinfo>(); string sql = "SELECT PY, HZ, ZM FROM pinyin "; if (filter != "*") { sql += "WHERE PY LIKE '%" + filter + "%' AND ZM='" + filter.Substring(0, 1) + "' "; } DataTable dt = db.Query(sql); if (dt.Rows.Count > 0) //使用拼音輸入 { sql = "SELECT pif_ic, pif_name FROM pat_info WHERE (1=0 "; for (int i = 0; i < dt.Rows.Count; i++) { sql += "OR pif_name LIKE '" + dt.Rows[i]["HZ"].ToString() + "%' "; } sql += ") "; DataTable dt1 = db.Query(sql); if (dt1.Rows.Count > 0) { for (int j = 0; j < dt1.Rows.Count; j++) { Patinfo patinfo = new Patinfo(); patinfo.patic = dt1.Rows[j]["pif_ic"].ToString(); patinfo.patname = dt1.Rows[j]["pif_name"].ToString(); patinfos.Add(patinfo); } } dt1.Dispose(); } else { sql = "SELECT pif_ic, pif_name FROM pat_info "; //直接輸入中文字 sql += "WHERE pif_name LIKE '%" + filter + "%' "; dt = db.Query(sql); if (dt.Rows.Count > 0) { for (int j = 0; j < dt.Rows.Count; j++) { Patinfo patinfo = new Patinfo(); patinfo.patic = dt.Rows[j]["pif_ic"].ToString();; patinfo.patname = dt.Rows[j]["pif_name"].ToString(); patinfos.Add(patinfo); } } } dt.Dispose(); db.Close(); } if (!string.IsNullOrEmpty(sort)) { patinfos.Sort(delegate(Patinfo x, Patinfo y) { object a; object b; int direction = dir == "DESC" ? -1 : 1; a = x.GetType().GetProperty(sort).GetValue(x, null); b = y.GetType().GetProperty(sort).GetValue(y, null); return(CaseInsensitiveComparer.Default.Compare(a, b) * direction); }); } if ((start + limit) > patinfos.Count) { limit = patinfos.Count - start; } List <Patinfo> rangePatinfos = (start < 0 || limit < 0) ? patinfos : patinfos.GetRange(start, limit); return(new Paging <Patinfo>(rangePatinfos, patinfos.Count)); }
public Inversionista(DBMysql DBMysql_) { this.DBMysql_ = DBMysql_; }
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()); } }
/// <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"; }