Example #1
0
        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
                {
                }
            }
            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
                                {
                                    bool ss = prreport.txzoom(localpath + "\\" + txlb.Rows[i]["F_txm"].ToString().Trim(), localpath + "\\" + txlb.Rows[i]["F_txm"].ToString().Trim(), picx, picy);
                                    log.WriteMyLog(ss.ToString());
                                }
                                catch (Exception ex)
                                {
                                    log.WriteMyLog("zoom" + ex.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
                                {
                                    bool ss = prreport.txzoom(localpath + "\\" + txlb.Rows[i]["F_txm"].ToString().Trim(), localpath + "\\" + txlb.Rows[i]["F_txm"].ToString().Trim(), picx, picy);
                                    log.WriteMyLog(ss.ToString());
                                }
                                catch (Exception ex)
                                {
                                    log.WriteMyLog("zoom" + ex.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;
                    }
                }
            }
        }
Example #2
0
        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;
                    }

                }

            }


        }
Example #3
0
        private void stzxyy()
        {
            DataTable bljc = new DataTable();
            DataTable blbd = new DataTable();
            string    brlb = "";

            bljc = aa.GetDataTable("select * from T_jcxx where F_blh='" + blh + "'", "bljc");
            blbd = aa.GetDataTable("select * from T_BDBG where F_blh='" + blh + "' and F_BD_BGZT='已审核'  and  F_BD_BGXH='" + bgxh + "'", "blbd");

            if (bljc == null)
            {
                MessageBox.Show("病理数据库设置有问题!");
                return;
            }
            if (bljc.Rows.Count < 1)
            {
                MessageBox.Show("病理号有错误!");
                return;
            }
            if (bglx == "cg" && dz == "save" && bljc.Rows[0]["F_bgzt"].ToString().Trim() != "已审核")
            {
                if (bljc.Rows[0]["F_BRBH"].ToString().Trim() != "" && bljc.Rows[0]["F_YZXM"].ToString().Trim().Contains("||"))
                {
                    string con_str = f.ReadString("savetohis", "odbcsql", "Data Source=172.16.0.30;Initial Catalog=hisdbstzx;User Id=bl;Password=bl123;");
                    //  MessageBox.Show(bljc.Rows[0]["F_YZXM"].ToString().Trim().Substring(bljc.Rows[0]["F_YZXM"].ToString().LastIndexOf("||")+2));
                    SqlConnection sqlcon = new SqlConnection(con_str);
                    try
                    {
                        sqlcon.Open();
                        SqlCommand sqlcom = new SqlCommand();
                        sqlcom.Connection  = sqlcon;
                        sqlcom.CommandText = "MzInterfacePath_getinfo_Update";
                        sqlcom.CommandType = CommandType.StoredProcedure;

                        sqlcom.Parameters.Add("@p_id", SqlDbType.VarChar, 12);
                        sqlcom.Parameters["@p_id"].Value = bljc.Rows[0]["F_BRBH"].ToString().Trim();

                        sqlcom.Parameters.Add("@jy_sn", SqlDbType.VarChar, 12);
                        sqlcom.Parameters["@jy_sn"].Value = bljc.Rows[0]["F_YZXM"].ToString().Trim().Substring(bljc.Rows[0]["F_YZXM"].ToString().LastIndexOf("||") + 2);

                        sqlcom.ExecuteNonQuery();
                        sqlcon.Close();
                    }
                    catch (Exception ee)
                    {
                        sqlcon.Close();
                        MessageBox.Show("回传his接受标记异常" + ee.ToString());
                        return;
                    }
                }
                return;
            }

            if (bljc.Rows[0]["F_brlb"].ToString().Trim() == "住院")
            {
                brlb = "2";
            }
            if (bljc.Rows[0]["F_brlb"].ToString().Trim() == "门诊")
            {
                brlb = "1";
            }
            if (brlb == "")
            {
                log.WriteMyLog("非住院或门诊病人,不处理!");
                return;
            }



            if (bglx == "bd" && dz == "save")
            {
                //冰冻审核

                if (blbd == null)
                {
                    MessageBox.Show("病理数据库设置有问题!");
                    return;
                }
                if (blbd.Rows.Count < 1)
                {
                    log.WriteMyLog("没有需要上传的病理报告");
                    return;
                }
                //生成冰冻报告,不打图
                string   ftplocal  = f.ReadString("ftp", "ftplocal", "c:\\temp").Replace("\0", "");
                string   sBGGSName = Application.StartupPath.ToString() + "\\rpt\\冰冻.frf";
                string   sJPGNAME  = ftplocal + "\\" + blh.Trim() + "_B_" + blbd.Rows[0]["F_BD_BGXH"].ToString() + ".jpg";
                string   sSQL_DY   = "SELECT * FROM T_JCXX,T_BDBG  WHERE T_JCXX.F_BLH *= T_BDBG.F_BLH AND T_JCXX.F_BLH = '" + blh + "'";
                prreport pr        = new prreport();
                pr.print(sSQL_DY, this.Handle, "", "", sBGGSName, sJPGNAME);
                Image        bgjpg = Image.FromFile(ftplocal + "\\" + blh.Trim() + "_B_" + blbd.Rows[0]["F_BD_BGXH"].ToString() + "_1.jpg");
                MemoryStream ms    = new MemoryStream();
                bgjpg.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                byte[] bgbyte = ms.ToArray();
                PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType[] hs = new PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType[1];
                hs[0]       = new PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType();
                hs[0].Value = bgbyte;
                hs[0].Key   = blh.Trim() + "_B_" + blbd.Rows[0]["F_BD_BGXH"].ToString() + ".jpg";

                //调用生成xml字符串子程序
                string xml = sdxml_BD(bljc, blbd, blh.Trim() + "_B_" + blbd.Rows[0]["F_BD_BGXH"].ToString() + ".jpg", brlb);
                if (xml == "")
                {
                    MessageBox.Show(@"部分内容含有非法字符(<,>,@,&,\等),镜下所见和病理诊断除外,HIS写入失败!");
                    return;
                }
                bool sdwstrue  = true;
                bool sdwstrue1 = true;
                bool sdwstrue2 = true;
                bool sdwstrue3 = true;
                int  sdwsint   = 0;
                int  sdwsint1  = 0;

                //调用webservice
                try
                {
                    PathHISJK.Webstzxyy.clsWcfInterface sdws = new PathHISJK.Webstzxyy.clsWcfInterface();
                    string url = f.ReadString("stzxyy", "weburl", "");
                    if (url != "")
                    {
                        sdws.Url = url;
                    }

                    sdws.EHRInterfaceBL(xml, hs, out sdwsint, out sdwstrue, out sdwsint1, out sdwstrue1, out sdwstrue2, out sdwstrue3);
                }
                catch (Exception e)
                {
                    MessageBox.Show("Web服务器未打开!" + e.ToString());
                    return;
                }
                if (sdwsint < 1)
                {
                    MessageBox.Show("HIS写入失败!" + sdwsint.ToString());
                }
                return;
                //------------------------------------------------------------------
            }

            else
            {
                if (bljc.Rows[0]["F_bgzt"].ToString().Trim() != "已审核")
                {
                    return;
                }

                //下载及生成报告图片
                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", "");
                FtpWeb    fw            = new FtpWeb(ftpserver, ftpremotepath, ftpuser, ftppwd);
                string    txml          = bljc.Rows[0]["F_txml"].ToString().Trim();
                DataTable txlb          = aa.GetDataTable("select * from V_dytx where F_blh='" + blh + "'", "txlb");
                string    sbmp          = "";
                string    stxsm         = "";
                string    sBGGSName     = Application.StartupPath.ToString() + "\\rpt\\" + bljc.Rows[0]["F_bggs"].ToString().Trim() + "-" + txlb.Rows.Count.ToString() + "图.frf";
                string    sJPGNAME      = ftplocal + "\\" + blh.Trim() + ".jpg";
                for (int i = 0; i < txlb.Rows.Count; i++)
                {
                    stxsm = stxsm + txlb.Rows[i]["F_txsm"].ToString().Trim() + ",";
                    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")
                    {
                        return;
                    }
                    sbmp = sbmp + ftplocal + "\\" + txlb.Rows[i]["F_txm"].ToString().Trim() + ",";
                }
                //生成常规报告
                string   sSQL_DY = "SELECT * FROM T_JCXX,T_TBS_BG WHERE T_JCXX.F_BLH *= T_TBS_BG.F_BLH AND T_JCXX.F_BLH = '" + blh + "'";
                prreport pr      = new prreport();
                pr.print(sSQL_DY, this.Handle, sbmp, stxsm, sBGGSName, sJPGNAME);
                Image        bgjpg = Image.FromFile(ftplocal + "\\" + blh.Trim() + "_1.jpg");
                MemoryStream ms    = new MemoryStream();
                bgjpg.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                byte[] bgbyte = ms.ToArray();
                PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType[] hs = null;// = new PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType[1];

                hs[0]       = new PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType();
                hs[0].Value = bgbyte;
                hs[0].Key   = blh.Trim() + "_1.jpg";


                /////// 分子病理报告单 2页

                if (File.Exists(ftplocal + "\\" + blh.Trim() + "_2.jpg"))
                {
                    try
                    {
                        log.WriteMyLog("分子病理上传多页报告");
                        PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType[] hs2 = new PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType[2];

                        hs2[0]       = new PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType();
                        hs2[0].Value = bgbyte;
                        hs2[0].Key   = blh.Trim() + "_1.jpg";

                        Image        bgjpg2 = Image.FromFile(ftplocal + "\\" + blh.Trim() + "_2.jpg");
                        MemoryStream ms2    = new MemoryStream();
                        bgjpg2.Save(ms2, System.Drawing.Imaging.ImageFormat.Jpeg);
                        byte[] bgbyte2 = ms2.ToArray();
                        hs2[1]       = new PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType();
                        hs2[1].Value = bgbyte2;
                        hs2[1].Key   = blh.Trim() + "_2.jpg";
                        hs           = hs2;
                    }
                    catch (Exception ss)
                    {
                        MessageBox.Show(ss.ToString());
                        log.WriteMyLog("分子病理上传多页失败" + ss.ToString());
                    }
                }
                else
                {
                    PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType[] hs1 = new PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType[1];
                    hs1[0]       = new PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType();
                    hs1[0].Value = bgbyte;
                    hs1[0].Key   = blh.Trim() + "_1.jpg";
                    hs           = hs1;
                }
                //PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType[] hs = new PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType[1];
                //hs[0] = new PathHISJK.Webstzxyy.ArrayOfKeyValueOfanyTypeanyTypeKeyValueOfanyTypeanyType();
                //hs[0].Value = bgbyte;
                //hs[0].Key = blh.Trim() + "_1.jpg";
                // hs = hs1;

                //调用生成xml字符串子程序
                string xml = sdxml(bljc, blh.Trim() + "_1.jpg", brlb);

                if (xml == "")
                {
                    MessageBox.Show(@"部分内容含有非法字符(<,>,@,&,\等),镜下所见和病理诊断除外,HIS写入失败!");
                    return;
                }
                bool sdwstrue  = true;
                bool sdwstrue1 = true;
                bool sdwstrue2 = true;
                bool sdwstrue3 = true;
                int  sdwsint   = 0;
                int  sdwsint1  = 0;

                //调用webservice
                try
                {
                    PathHISJK.Webstzxyy.clsWcfInterface sdws = new PathHISJK.Webstzxyy.clsWcfInterface();
                    string url = f.ReadString("stzxyy", "weburl", "");
                    if (url != "")
                    {
                        sdws.Url = url;
                    }
                    sdws.EHRInterfaceBL(xml, hs, out sdwsint, out sdwstrue, out sdwsint1, out sdwstrue1, out sdwstrue2, out sdwstrue3);
                    aa.ExecuteSQL("update T_JCXX set F_SCBJ='1'  where  F_BLH='" + blh + "'");
                }
                catch (Exception e)
                { MessageBox.Show("Web服务器未打开!" + e.ToString());
                  return; }

                if (sdwsint < 1)
                {
                    MessageBox.Show("HIS写入失败!" + sdwsint.ToString());
                }
                return;
            }
            return;
        }