public void pathtohis(string blh, string yymc) { blhgy = blh; string msg = f.ReadString("savetohis", "msg", ""); string sfsctx = f.ReadString("savetohis", "sfsctx", ""); string odbcsql = f.ReadString("savetohis", "odbcsql", ""); if (odbcsql.Trim() != "") { orcon_str = odbcsql; } dbbase.odbcdb aa = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", ""); DataTable bljc = new DataTable(); bljc = aa.GetDataTable("select * from T_jcxx where F_blh='" + blh + "'", "blxx"); if (bljc == null) { MessageBox.Show("病理数据库设置有问题!"); log.WriteMyLog("病理数据库设置有问题!"); return; } if (bljc.Rows.Count < 1) { MessageBox.Show("病理号有错误!"); log.WriteMyLog("病理号有错误!"); return; } if (bljc.Rows[0]["F_sqxh"].ToString().Trim() == "") { log.WriteMyLog("无申请序号(单据号),不处理!"); return; } //----------- int brlb = 0; switch (bljc.Rows[0]["F_brlb"].ToString().Trim()) { case "门诊": brlb = 1; break; case "急诊": brlb = 2; break; case "住院": brlb = 3; break; case "体检": brlb = 4; break; default: brlb = 0; break; } //--------------- if (bljc.Rows[0]["F_BGZT"].ToString().Trim() == "已审核") { ////-----------------查询---------- string select_to_his = "select * from ZEMR_PACS_REPORT where PACS_NO='" + bljc.Rows[0]["F_SQXH"].ToString().Trim() + "'"; OracleConnection orcon = new OracleConnection(orcon_str); OracleCommand orcom = new OracleCommand(select_to_his, orcon); bool x = false; try { orcon.Open(); OracleDataReader dr = orcom.ExecuteReader(); x = dr.HasRows; dr.Close(); orcom.Dispose(); } catch (Exception e) { log.WriteMyLog("查询状态出错:" + e.ToString()); orcom.Dispose(); orcon.Close(); return; } finally { orcom.Dispose(); orcon.Close(); } //-------------增加---------------- int count = 0; string Oraclestring = ""; decimal MODIFY_FLAG = 0; string blzd = "<desc note=\"检查描述\">" + bljc.Rows[0]["F_rysj"].ToString().Trim() + "</desc><diag note=\"诊断\">" + bljc.Rows[0]["F_BLZD"].ToString().Trim() + "</diag>"; MessageBox.Show(blzd.ToString()); ////----------------- MODIFY_FLAG = 1;重新审核—修改---------- //----------------- MODIFY_FLAG =0;审核—增加---------- // Byte[] blzdByte = System.Text.Encoding.ASCII.GetBytes(blzd);//把图片转成 Byte型 二进制流 Byte[] blzdByte = System.Text.Encoding.Default.GetBytes(blzd); if (x) { MODIFY_FLAG = 1; Oraclestring = @"update ZEMR_PACS_REPORT set INSPECT_CONTENT=:ZD,OPERATER='" + bljc.Rows[0]["F_BGYS"].ToString().Trim() + "',INSPECTOR='" + bljc.Rows[0]["F_SHYS"].ToString().Trim() + "',REPORT_TIME=to_date('" + DateTime.Parse(bljc.Rows[0]["F_BGRQ"].ToString().Trim()) + "','YYYY-MM-DD HH24:MI:SS'),LAST_MODIFY_TIME=to_date('" + DateTime.Parse(bljc.Rows[0]["F_BGRQ"].ToString().Trim()) + "','YYYY-MM-DD HH24:MI:SS')" + ", MODIFY_FLAG='" + MODIFY_FLAG + "',REMARK1='" + bljc.Rows[0]["F_SFFH"].ToString().Trim() + "',QUANTITY_FLAG='" + bljc.Rows[0]["F_YYX"].ToString().Trim() + "' where PACS_NO='" + bljc.Rows[0]["F_SQXH"].ToString().Trim() + "'"; } else { Oraclestring = @"insert into ZEMR_PACS_REPORT(PACS_NO,PATIENT_ID,EVENT_NO,PATIENT_TYPE,PACS_TYPE,PATIENT_NAME, PATIENT_SEX,PATIENT_AGE,IN_DEPT,BED,WARD,ADDRESS,TELEPHONE,MARRIAGE,PROFESSION,CHECKNO,BARCODE_ID, INSPECT_TYPE,INSPECT_SUB_TYPE,INSPECT_NAME,INSTRUMENT_NAME,INSPECT_CONTENT,APPLICANT,OPERATER, INSPECTOR,OPERATER_TIME,REPORT_TIME,LAST_MODIFY_TIME,MODIFY_FLAG,REMARK1,REMARK2,STATUS,APPLY_NO,QUANTITY_FLAG) values ('" + bljc.Rows[0]["F_SQXH"].ToString().Trim() + "','" + bljc.Rows[0]["F_BRBH"].ToString().Trim() + "','" + bljc.Rows[0]["F_ZYH"].ToString().Trim() + "','" + brlb + "'," + MODIFY_FLAG + ",'" + bljc.Rows[0]["F_XM"].ToString().Trim() + "','" + bljc.Rows[0]["F_XB"].ToString().Trim() + "','" + bljc.Rows[0]["F_NL"].ToString().Trim() + "','" + bljc.Rows[0]["F_SJKS"].ToString().Trim() + "','" + bljc.Rows[0]["F_CH"].ToString().Trim() + "','" + bljc.Rows[0]["F_BQ"].ToString().Trim() + "','" + bljc.Rows[0]["F_LXXX"].ToString().Trim() + "','" + "" + "','" + bljc.Rows[0]["F_HY"].ToString().Trim() + "','" + bljc.Rows[0]["F_ZY"].ToString().Trim() + "','" + bljc.Rows[0]["F_BLH"].ToString().Trim() + "','" + "" + "','" + bljc.Rows[0]["F_BLK"].ToString().Trim() + "','" + "" + "','" + "" + "','',:ZD,'" + bljc.Rows[0]["F_SJYS"].ToString().Trim() + "','" + bljc.Rows[0]["F_BGYS"].ToString().Trim() + "','" + bljc.Rows[0]["F_SHYS"].ToString().Trim() + "','" + "" + "',to_date('" + DateTime.Parse(bljc.Rows[0]["F_BGRQ"].ToString().Trim()) + "','YYYY-MM-DD HH24:MI:SS')," + "to_date('" + DateTime.Parse(bljc.Rows[0]["F_SPARE5"].ToString().Trim()) + "','YYYY-MM-DD HH24:MI:SS')," + MODIFY_FLAG + ",'" + bljc.Rows[0]["F_SFFH"].ToString().Trim() + "','" + "" + "'," + MODIFY_FLAG + ",'" + bljc.Rows[0]["F_SQXH"].ToString().Trim() + "','" + bljc.Rows[0]["F_YYX"].ToString().Trim() + "')"; } MessageBox.Show(Oraclestring); OracleCommand orcom_insert = new OracleCommand(); orcom_insert.Connection = orcon; orcom_insert.CommandText = Oraclestring; orcom_insert.Parameters.Add("ZD", System.Data.OracleClient.OracleType.Blob, blzdByte.Length); orcom_insert.Parameters["ZD"].Value = blzdByte; try { orcon.Open(); count = orcom_insert.ExecuteNonQuery(); orcom_insert.Dispose(); orcon.Close(); } catch (Exception ee) { log.WriteMyLog("回传报告出错:" + ee.ToString()); orcom_insert.Dispose(); orcon.Close(); return; } finally { orcom_insert.Dispose(); orcon.Close(); } //下面程序中图像信息 if (sfsctx.Trim() == "1")//FTP下载方式 { //下载FTP参数 string ftpserver = f.ReadString("ftp", "ftpip", "").Replace("\0", ""); string ftpuser = f.ReadString("ftp", "user", "ftpuser").Replace("\0", ""); string ftppwd = f.ReadString("ftp", "pwd", "ftp").Replace("\0", ""); string ftplocal = f.ReadString("ftp", "ftplocal", "c:\\temp").Replace("\0", ""); string ftpremotepath = f.ReadString("ftp", "ftpremotepath", "pathimages").Replace("\0", ""); string ftps = f.ReadString("ftp", "ftp", "").Replace("\0", ""); string txpath = f.ReadString("txpath", "txpath", "").Replace("\0", ""); FtpWeb fw = new FtpWeb(ftpserver, ftpremotepath, ftpuser, ftppwd); string txml = bljc.Rows[0]["F_txml"].ToString().Trim(); //下载图像 DataTable txlb = aa.GetDataTable("select top 4 * from V_dytx where F_blh='" + bljc.Rows[0]["F_BLH"].ToString().Trim() + "'", "txlb"); if (txlb.Rows.Count < 1) { log.WriteMyLog("该病人无图像,不上传"); return; } int i2 = 1; for (int i = 0; i < txlb.Rows.Count; i++) { if (i >= txlb.Rows.Count) { return; } bool tx_count = false; // string strcon11 = "server =.; uid =pathnet;pwd =4s3c2a1p;database =pathnet"; OracleConnection orcon_tx = new OracleConnection(orcon_str); try { //-----------判断该图片是否已上传-------------- string txOracle_select = @"select * from ZEMR_LIS_PACS_REPORT_IMAGE where IMAGE_ID='" + txlb.Rows[i]["F_txm"].ToString().Trim() + "'"; try { OracleCommand orcom_tx = new OracleCommand(txOracle_select, orcon_tx); orcon_tx.Open(); OracleDataReader Oracledr_select = orcom_tx.ExecuteReader(); tx_count = Oracledr_select.HasRows; orcom_tx.Dispose(); orcon_tx.Close(); } catch (Exception tx_e) { orcon_tx.Close(); log.WriteMyLog("判断该图片是否已上传错误" + tx_e.ToString()); return; } if (tx_count) { continue; } //-------------------------- i2 = i + 1; string ftpstatus = ""; fw.Download(ftplocal, txml + "/" + txlb.Rows[i]["F_txm"].ToString().Trim(), txlb.Rows[i]["F_txm"].ToString().Trim(), out ftpstatus); if (ftpstatus == "Error") { log.WriteMyLog("FTP下载图像出错!"); return; } //----------------加载图像--------------------- string imgPath = ftplocal + "\\" + txlb.Rows[i]["F_txm"].ToString().Trim();//图片文件所在路径 FileStream file = new FileStream(imgPath, FileMode.Open, FileAccess.Read); Byte[] imgByte = new Byte[file.Length]; //把图片转成 Byte型 二进制流 file.Read(imgByte, 0, imgByte.Length); //把二进制流读入缓冲区 file.Close(); //===================上传图片===================== try { orcon_tx.Open(); string txOracle = @"insert into ZEMR_LIS_PACS_REPORT_IMAGE(REPORT_NO,REPORT_TYPE,IMAGE_ID,IMAGE_NAME, IMAGE_CONTENT,COMPRESSION,REMARK) values ('" + bljc.Rows[0]["F_SQXH"].ToString() + "',2,'" + txlb.Rows[i]["F_txm"].ToString().Trim() + "','" + txlb.Rows[i]["F_txm"].ToString().Trim() + "',:p,0,'')"; OracleCommand orcom_tx1 = new OracleCommand(); orcom_tx1.Connection = orcon_tx; orcom_tx1.CommandText = txOracle; orcom_tx1.Parameters.Add("p", System.Data.OracleClient.OracleType.Blob, imgByte.Length); orcom_tx1.Parameters["p"].Value = imgByte; int qw = orcom_tx1.ExecuteNonQuery(); orcom_tx1.Dispose(); orcon_tx.Close(); } catch (Exception orcom_tx_e) { orcon_tx.Close(); log.WriteMyLog("上传图片错误_1" + orcom_tx_e.ToString()); return; } } catch (Exception e_e) { orcon_tx.Close(); log.WriteMyLog("上传图片错误" + e_e.ToString()); return; } } } } }
public static void downtx(string ftp_blh, string txml, odbcdb aa, ref string txlbs, ref string localpath) { //Çå¿Õc:\temp_srĿ¼ if (!System.IO.Directory.Exists(@"c:\temp\" + ftp_blh)) { System.IO.Directory.CreateDirectory(@"c:\temp\" + ftp_blh); } else { try { System.IO.Directory.Delete(@"c:\temp\" + ftp_blh, true); System.IO.Directory.CreateDirectory(@"c:\temp\" + ftp_blh); } catch (Exception e1) { MessageBox.Show(e1.Message.ToString()); } } localpath = @"c:\temp\" + ftp_blh; //ÏÂÔØFTP²ÎÊý string ftpserver = f.ReadString("ftp", "ftpip", "").Replace("\0", ""); string ftpuser = f.ReadString("ftp", "user", "ftpuser").Replace("\0", ""); string ftppwd = f.ReadString("ftp", "pwd", "ftp").Replace("\0", ""); string ftplocal = f.ReadString("ftp", "ftplocal", "c:\\temp\\").Replace("\0", ""); string ftpremotepath = f.ReadString("ftp", "ftpremotepath", "pathimages").Replace("\0", ""); string ftps = f.ReadString("ftp", "ftp", "").Replace("\0", ""); string txpath = f.ReadString("txpath", "txpath", "").Replace("\0", ""); FtpWeb fw = new FtpWeb(ftpserver, ftpremotepath, ftpuser, ftppwd); //¹²ÏíĿ¼ string gxml = f.ReadString("txpath", "txpath", "").Replace("\0", ""); string gxuid = f.ReadString("txpath", "username", "").Replace("\0", ""); string gxpwd = f.ReadString("txpath", "password", "").Replace("\0", ""); DataTable txlb = aa.GetDataTable("select * from T_tx where F_blh='" + ftp_blh + "' and F_sfdy='1'", "txlb"); string txm = ""; if (ftps == "1")//FTPÏÂÔØ·½Ê½ { for (int i = 0; i < txlb.Rows.Count; i++) { txm = txlb.Rows[i]["F_txm"].ToString().Trim(); string ftpstatus = ""; try { fw.Download(localpath, txml + "/" + txlb.Rows[i]["F_txm"].ToString().Trim(), txlb.Rows[i]["F_txm"].ToString().Trim(), out ftpstatus); if (ftpstatus == "Error") { log.WriteMyLog("FTPÏÂÔØͼÏñ³ö´í£¡"); localpath = ""; return; } else { if (f.ReadInteger("TX", "ZOOM", 0) == 1) { int picx = f.ReadInteger("TX", "picx", 320); int picy = f.ReadInteger("TX", "picy", 240); try { prreport.txzoom(localpath + "/" + txlb.Rows[i]["F_txm"].ToString().Trim(), localpath + "/" + txlb.Rows[i]["F_txm"].ToString().Trim(), picx, picy); } catch (Exception ee2) { log.WriteMyLog("ѹËõͼÏñÒì³££º" + ee2.Message); } } txlbs = txlbs + "<Image INDEX=" + (char)34 + (i + 1).ToString() + (char)34 + ">" + localpath + "\\" + txlb.Rows[i]["F_txm"].ToString().Trim() + "</Image>"; } } catch { log.WriteMyLog("FTPÏÂÔØͼÏñ³ö´í£¡"); } } } else //¹²ÏíÏÂÔØ·½Ê½ { if (txpath == "") { log.WriteMyLog("sz.ini txpathͼÏñĿ¼δÉèÖÃ"); return; } for (int i = 0; i < txlb.Rows.Count; i++) { txm = txlb.Rows[i]["F_txm"].ToString().Trim(); try { try { File.Copy(txpath + txml + "\\" + txlb.Rows[i]["F_txm"].ToString().Trim(), localpath + "\\" + txlb.Rows[i]["F_txm"].ToString().Trim(), true); if (f.ReadInteger("TX", "ZOOM", 0) == 1) { int picx = f.ReadInteger("TX", "picx", 320); int picy = f.ReadInteger("TX", "picy", 240); try { prreport.txzoom(localpath + "/" + txlb.Rows[i]["F_txm"].ToString().Trim(), localpath + "/" + txlb.Rows[i]["F_txm"].ToString().Trim(), picx, picy); } catch (Exception ee2) { log.WriteMyLog("ѹËõͼÏñÒì³££º" + ee2.Message); } } txlbs = txlbs + "<Image INDEX=" + (char)34 + (i + 1).ToString() + (char)34 + ">" + localpath + "\\" + txlb.Rows[i]["F_txm"].ToString().Trim() + "</Image>"; } catch { } } catch { log.WriteMyLog("¹²ÏíĿ¼²»´æÔÚ£¡"); localpath = ""; return; } } } }
public void pathtohis(string blh, string yymc) { blhgy = blh; string msg = f.ReadString("savetohis", "msg", ""); string sfsctx = f.ReadString("savetohis", "sfsctx", ""); string odbcsql = f.ReadString("savetohis", "odbcsql", ""); if (odbcsql.Trim() != "") { ConnectionString = odbcsql; } if (msg == "1") { MessageBox.Show(blh); } dbbase.odbcdb aa = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", ""); DataTable bljc = new DataTable(); bljc = aa.GetDataTable("select * from T_jcxx where F_blh='" + blh + "'", "blxx"); if (bljc == null) { MessageBox.Show("病理数据库设置有问题!"); log.WriteMyLog("病理数据库设置有问题!"); return; } if (bljc.Rows.Count < 1) { MessageBox.Show("病理号有错误!"); log.WriteMyLog("病理号有错误!"); return; } if (bljc.Rows[0]["F_sqxh"].ToString().Trim() == "") { log.WriteMyLog("无申请序号(单据号),不处理!"); return; } //----------- //--------------- if (bljc.Rows[0]["F_BGZT"].ToString().Trim() == "已审核") { string brbh = bljc.Rows[0]["F_brbh"].ToString().Trim(); if (msg == "1") { MessageBox.Show("报告已审核,准备上传"); } /////////////// string gs = ""; DataTable dt_blk = new DataTable(); dt_blk = aa.GetDataTable("select F_LISXH from T_BLK_CS where F_BLKMC='" + bljc.Rows[0]["F_BLK"].ToString().Trim() + "'", "blk"); if (dt_blk.Rows.Count > 0) { gs = dt_blk.Rows[0]["F_LISXH"].ToString().Trim(); } else { log.WriteMyLog("获取病例库对应格式错误!"); return; } if (gs == "") { log.WriteMyLog("获取病例库对应格式错误!"); return; } brbh = brbh.Substring(0, 8) + gs + brbh.Substring(8, 4); /////////////// ////string zm = bljc.Rows[0]["F_BLH"].ToString().Trim().Substring(0, 1); ////if (bljc.Rows[0]["F_BLK"].ToString().Trim()=="常规") //// brbh = "B" + brbh; ////else brbh = zm + brbh; ////-----------------查询---------- if (msg == "1") { MessageBox.Show("查询SAMPLE_RESULT"); } string select_to_his = "select * from dbo.SAMPLE_RESULT where id='" + brbh + "' and requisition_id='" + bljc.Rows[0]["F_SQXH"].ToString().Trim() + "'"; OleDbConnection orcon = new OleDbConnection(ConnectionString); OleDbCommand orcom = new OleDbCommand(select_to_his, orcon); bool x = false; try { orcon.Open(); OleDbDataReader dr = orcom.ExecuteReader(); x = dr.HasRows; dr.Close(); orcom.Dispose(); } catch (Exception e) { log.WriteMyLog("查询状态出错:" + e.ToString()); orcom.Dispose(); orcon.Close(); return; } finally { orcom.Dispose(); orcon.Close(); } if (msg == "1") { MessageBox.Show("查询SAMPLE_RESULT," + x.ToString()); } //-------------增加---------------- ////RESULT_ANALYZE 病理诊断 ////diagnosis_advice, 肉眼所见 ////assistant_info_1 镜下所见 ////assistant_info_2 特殊检查 ////assistant_info_3 标本满意度 ////assistant_info_4 反应性细胞变化 ////assistant_info_5 微生物项目 ////assistant_info_6 上皮细胞情况 ////assistant_info_7 报告医生 ////assistant_info_8 病理号 ////remark 备注 //RESULT_ANALYZE 病理诊断 string RESULT_ANALYZE = bljc.Rows[0]["F_blzd"].ToString().Trim(); //assistant_info_3 标本满意度 string assistant_info_3 = ""; //assistant_info_4 反应性细胞变化 string assistant_info_4 = ""; //assistant_info_5 微生物项目 string assistant_info_5 = ""; //assistant_info_6 上皮细胞情况 string assistant_info_6 = ""; //remark 备注 string remark = bljc.Rows[0]["F_bz"].ToString().Trim(); if (bljc.Rows[0]["F_blk"].ToString().Trim().Contains("TCT")) { DataTable tbs = new DataTable(); tbs = aa.GetDataTable("select * from T_TBS_BG where F_blh='" + blh + "'", "TBSbg"); if (tbs.Rows.Count > 0) { //assistant_info_2 = tbs.Rows[0]["F_TBS_JYFF"].ToString().Trim(); //assistant_info_3 = tbs.Rows[0]["F_TBS_jyff"].ToString().Trim(); assistant_info_3 = tbs.Rows[0]["F_TBS_BBMYD"].ToString().Trim() + " " + tbs.Rows[0]["F_TBS_XBL"].ToString().Trim() + " " + tbs.Rows[0]["F_TBS_XBXM1"].ToString().Trim() + " " + tbs.Rows[0]["F_TBS_XBXM2"].ToString().Trim() + " " + tbs.Rows[0]["F_TBS_XBXM3"].ToString().Trim(); assistant_info_4 = tbs.Rows[0]["F_TBS_BDXM1"].ToString().Trim() + "\r\n"; assistant_info_4 = assistant_info_4 + tbs.Rows[0]["F_TBS_BDXM2"].ToString().Trim() + "\r\n"; assistant_info_4 = assistant_info_4 + tbs.Rows[0]["F_TBS_BDXM3"].ToString().Trim() + "\r\n"; assistant_info_4 = assistant_info_4 + tbs.Rows[0]["F_TBS_YZCD"].ToString().Trim() + "\r\n"; assistant_info_5 = tbs.Rows[0]["F_TBS_WSW1"].ToString().Trim() + "\r\n"; assistant_info_5 = assistant_info_5 + tbs.Rows[0]["F_TBS_WSW2"].ToString().Trim() + "\r\n"; assistant_info_5 = assistant_info_5 + tbs.Rows[0]["F_TBS_WSW3"].ToString().Trim() + "\r\n"; assistant_info_5 = assistant_info_5 + tbs.Rows[0]["F_TBS_WSW4"].ToString().Trim() + "\r\n"; assistant_info_5 = assistant_info_5 + tbs.Rows[0]["F_TBS_WSW5"].ToString().Trim() + "\r\n"; assistant_info_5 = assistant_info_5 + tbs.Rows[0]["F_TBS_WSW6"].ToString().Trim(); assistant_info_6 = tbs.Rows[0]["F_TBS_BDXM4"].ToString().Trim() + "\r\n"; assistant_info_6 = assistant_info_6 + tbs.Rows[0]["F_TBS_BDXM5"].ToString().Trim(); RESULT_ANALYZE = tbs.Rows[0]["F_TBSZD"].ToString().Trim(); remark = tbs.Rows[0]["F_TBS_BCYJ1"].ToString().Trim(); } } int ITEM_NUM = 0; if (bljc.Rows[0]["F_blk"].ToString().Trim() == "免疫组化") { DataTable myzh_num = new DataTable(); myzh_num = aa.GetDataTable("select count(*) from T_TJYZ where F_blh='" + blh + "'", "myzh_num"); ITEM_NUM = int.Parse(myzh_num.Rows[0][0].ToString()); } //////////////////// //执行语句 if (msg == "1") { MessageBox.Show("拼接执行语句"); } string Oraclestring = ""; if (x) { Oraclestring = @"update dbo.SAMPLE_RESULT set RESULT_ANALYZE ='" + RESULT_ANALYZE.Trim() + "',remark ='" + remark.Trim() + "',diagnosis_advice='" + bljc.Rows[0]["F_rysj"].ToString().Trim() + "',assistant_info_1='" + bljc.Rows[0]["F_jxsj"].ToString().Trim() + "',assistant_info_2='" + bljc.Rows[0]["F_tsjc"].ToString().Trim() + "',assistant_info_3='" + assistant_info_3.Trim() + "',assistant_info_4='" + assistant_info_4.Trim() + "',assistant_info_5='" + assistant_info_5.Trim() + "',assistant_info_6='" + assistant_info_6.Trim() + "',assistant_info_7='" + bljc.Rows[0]["F_SHYS"].ToString().Trim() + "',assistant_info_8='" + bljc.Rows[0]["F_BLH"].ToString().Trim() + "',ITEM_NUM='" + ITEM_NUM + "',sample_name='" + bljc.Rows[0]["F_bbmc"].ToString().Trim() + "',lczd='" + bljc.Rows[0]["F_lczd"].ToString().Trim() + "' ,SAMPLE_NUMBER='" + bljc.Rows[0]["F_bblx"].ToString().Trim() + "',mcyj= '" + bljc.Rows[0]["F_mcyj"].ToString().Trim() + "',recivedate='" + bljc.Rows[0]["F_SDRQ"].ToString().Trim() + "',report_person='" + bljc.Rows[0]["F_BGYS"].ToString().Trim() + "',is_jj='" + bljc.Rows[0]["F_SFJJ"].ToString().Trim() + "' where id='" + brbh + "' and requisition_id='" + bljc.Rows[0]["F_SQXH"].ToString().Trim() + "'"; } else { //RESULT_ANALYZE 病理诊断 // diagnosis_advice, 肉眼所见 //assistant_info_1 镜下所见 //assistant_info_2 特殊检查 //assistant_info_3 检验方法 //assistant_info_4 标本满意度 //assistant_info_5 病原体 //assistant_info_6 炎症程度 //assistant_info_7 报告医生 //assistant_info_8 病理号 //remark 备注 Oraclestring = @"insert into dbo.SAMPLE_RESULT(id,requisition_id,RESULT_ANALYZE,remark,diagnosis_advice,assistant_info_1,assistant_info_2,assistant_info_3,assistant_info_4,assistant_info_5,assistant_info_6,assistant_info_7,assistant_info_8,ITEM_NUM,sample_name,lczd,SAMPLE_NUMBER,mcyj,recivedate,report_person,is_jj) values ('" + brbh.Trim() + "','" + bljc.Rows[0]["F_sqxh"].ToString().Trim() + "','" + RESULT_ANALYZE.Trim() + "','" + remark.Trim() + "','" + bljc.Rows[0]["F_rysj"].ToString().Trim() + "','" + bljc.Rows[0]["F_jxsj"].ToString().Trim() + "','" + bljc.Rows[0]["F_tsjc"].ToString().Trim() + "','" + assistant_info_3.Trim() + "','" + assistant_info_4.Trim() + "','" + assistant_info_5.Trim() + "','" + assistant_info_6.Trim() + "','" + bljc.Rows[0]["F_SHYS"].ToString().Trim() + "','" + bljc.Rows[0]["F_BLH"].ToString().Trim() + "','" + ITEM_NUM + "','" + bljc.Rows[0]["F_bbmc"].ToString().Trim() + "','" + bljc.Rows[0]["F_lczd"].ToString().Trim() + "','" + bljc.Rows[0]["F_bblx"].ToString().Trim() + "','" + bljc.Rows[0]["F_mcyj"].ToString().Trim() + "','" + bljc.Rows[0]["F_SDRQ"].ToString().Trim() + "','" + bljc.Rows[0]["F_BGYS"].ToString().Trim() + "','" + bljc.Rows[0]["F_SFJJ"].ToString().Trim() + "')"; } if (Oraclestring.Trim() == "") { MessageBox.Show("插入语句不能为空"); return; } if (msg == "1") { MessageBox.Show("执行语句:" + Oraclestring); log.WriteMyLog("执行语句:" + Oraclestring); } OleDbCommand orcom_insert = new OleDbCommand(Oraclestring, orcon); int z = -1; try { orcon.Open(); z = orcom_insert.ExecuteNonQuery(); orcom_insert.Dispose(); orcon.Close(); } catch (Exception ee) { log.WriteMyLog("回传报告出错:" + ee.ToString()); orcom_insert.Dispose(); orcon.Close(); return; } finally { orcom_insert.Dispose(); orcon.Close(); } if (msg == "1") { MessageBox.Show("数据库写入完成,返回:" + z.ToString()); } ////下面程序中图像信息 if (sfsctx.Trim() == "1") //FTP下载方式 { //下载FTP参数 string ftpserver = f.ReadString("ftp", "ftpip", "").Replace("\0", ""); string ftpuser = f.ReadString("ftp", "user", "ftpuser").Replace("\0", ""); string ftppwd = f.ReadString("ftp", "pwd", "ftp").Replace("\0", ""); string ftplocal = f.ReadString("ftp", "ftplocal", "c:\\temp").Replace("\0", ""); string ftpremotepath = f.ReadString("ftp", "ftpremotepath", "").Replace("\0", ""); string ftps = f.ReadString("ftp", "ftp", "").Replace("\0", ""); string txpath = f.ReadString("txpath", "txpath", "").Replace("\0", ""); FtpWeb fw = new FtpWeb(ftpserver, ftpremotepath, ftpuser, ftppwd); string txml = bljc.Rows[0]["F_txml"].ToString().Trim(); //下载图像 DataTable txlb = aa.GetDataTable("select top 4 * from V_dytx where F_blh='" + bljc.Rows[0]["F_BLH"].ToString().Trim() + "'", "txlb"); if (txlb.Rows.Count < 1) { log.WriteMyLog("该病人无图像,不上传"); return; } int i2 = 1; for (int i = 0; i < txlb.Rows.Count; i++) { if (i >= txlb.Rows.Count) { return; } try { //-------------------------- i2 = i + 1; string ftpstatus = ""; fw.Download(ftplocal, txml + "/" + txlb.Rows[i]["F_txm"].ToString().Trim(), txlb.Rows[i]["F_txm"].ToString().Trim(), out ftpstatus); if (ftpstatus == "Error") { log.WriteMyLog("FTP下载图像出错!"); return; } //===================上传图片===================== //---上传jpg---------- //----------------上传签章jpg至ftp--------------------- //上传FTP参数 string status = ""; string ftpServerIP_up = f.ReadString("ftpup", "ftpip", "").Replace("\0", ""); string ftpUserID_up = f.ReadString("ftpup", "user", "ftpuser").Replace("\0", ""); string ftpPassword_up = f.ReadString("ftpup", "pwd", "ftp").Replace("\0", ""); string ftplocal_up = f.ReadString("ftpup", "ftplocal", "c:\\temp").Replace("\0", ""); string ftpRemotePath_up = f.ReadString("ftpup", "ftpremotepath", "pathimages").Replace("\0", ""); FtpWeb fw_up = new FtpWeb(ftpServerIP_up, ftpRemotePath_up, ftpUserID_up, ftpPassword_up); string ml1 = bljc.Rows[0]["F_brbh"].ToString().Trim().Substring(0, 4); string ml2 = bljc.Rows[0]["F_brbh"].ToString().Trim().Substring(4, 2); string ml3 = bljc.Rows[0]["F_brbh"].ToString().Trim().Substring(6, 2); string bh = bljc.Rows[0]["F_brbh"].ToString().Trim().Substring(8, 4); string ftpURI = "ftp://" + ftpServerIP_up + "/" + ftpRemotePath_up; try { //判断目录是否存在 if (!fw_up.fileCheckExist(ftpURI + "/" + ml1, ml1)) { //目录不存在,创建 string stat = ""; fw_up.Makedir(ml1, out stat); } if (!fw_up.fileCheckExist(ftpURI + "/" + ml2, ml2)) { //目录不存在,创建 string stat = ""; fw_up.Makedir(ml1 + "/" + ml2, out stat); } if (!fw_up.fileCheckExist(ftpURI + "/" + ml2 + "/" + ml3, ml3)) { //目录不存在,创建 string stat = ""; fw_up.Makedir(ml1 + "/" + ml2 + "/" + ml3, out stat); } //-------------- string jpgname = gs + "000000" + bh + "0" + (i + 1).ToString() + ".jpg"; //判断ftp上是否存在该jpg文件 if (fw_up.fileCheckExist(ftpURI + "/" + ml1 + "/" + ml2 + "/" + ml3 + "/", jpgname)) { //删除ftp上的jpg文件 fw_up.fileDelete(ftpURI + "/" + ml1 + "/" + ml2 + "/" + ml3, jpgname).ToString(); } //上传新生成的jpg文件 string errMsg = ""; fw_up.Upload("C:\\temp\\" + txlb.Rows[i]["F_txm"].ToString().Trim(), ml1 + "/" + ml2 + "/" + ml3, jpgname, out status, ref errMsg); if (status == "Error") { MessageBox.Show("jpg上传失败,请重新审核\r\n" + errMsg); } try { if (System.IO.Directory.Exists(@"c:\temp\" + blh)) { System.IO.Directory.Delete(@"c:\temp\" + blh, true); } } catch { log.WriteMyLog("删除临时目录" + blh + "失败"); } } catch { MessageBox.Show("上传jpg文件异常"); } } catch { MessageBox.Show("上传jpg文件异常"); } } } } }