Example #1
0
        private void SaveToHIS(DataTable bljc, PathHISJK.ODBCHelper bb)
        {
            string blh  = bljc.Rows[0]["F_BLH"] == null ? "" : bljc.Rows[0]["F_BLH"].ToString().Trim();
            string sqxh = bljc.Rows[0]["F_SQXH"] == null ? "" : bljc.Rows[0]["F_SQXH"].ToString().Trim();
            string xm   = bljc.Rows[0]["F_XM"] == null ? "" : bljc.Rows[0]["F_XM"].ToString().Trim();
            string xb   = bljc.Rows[0]["F_XB"] == null ? "" : bljc.Rows[0]["F_XB"].ToString().Trim();
            string bbmc = bljc.Rows[0]["F_BBMC"] == null ? "" : bljc.Rows[0]["F_BBMC"].ToString().Trim();
            string rysj = bljc.Rows[0]["F_RYSJ"] == null ? "" : bljc.Rows[0]["F_RYSJ"].ToString().Trim();
            string blzd = bljc.Rows[0]["F_BLZD"] == null ? "" : bljc.Rows[0]["F_BLZD"].ToString().Trim();
            string bgys = bljc.Rows[0]["F_BGYS"] == null ? "" : bljc.Rows[0]["F_BGYS"].ToString().Trim();
            string shys = bljc.Rows[0]["F_SHYS"] == null ? "" : bljc.Rows[0]["F_SHYS"].ToString().Trim();
            string bgrq = bljc.Rows[0]["F_BGRQ"] == null ? "" : bljc.Rows[0]["F_BGRQ"].ToString().Trim();

            mdjpg  xx   = new mdjpg();
            string bglj = "";

            xx.BMPTOJPG(blh, ref bglj, "CG", "0");

            string ftpserver = f.ReadString("hisftp", "ftpip", "").Replace("\0", "");
            string ftpuser   = f.ReadString("hisftp", "user", "ZKFTP").Replace("\0", "");
            string ftppwd    = f.ReadString("hisftp", "pwd", "ZKFTP").Replace("\0", "");
            string txpath    = f.ReadString("hisftp", "txpath", "PACSDATA").Replace("\0", "");
            string ftppath   = Path.Combine(ftpserver, txpath);

            if (bglj != "")
            {
                FtpWeb fw     = new FtpWeb(ftpserver, txpath, ftpuser, ftppwd);
                string status = "";
                fw.Upload(@"C:\temp\" + blh + @"\" + blh + @"_1.jpg", "", out status);

                string insertsql = string.Format("insert into dbo.T_SYN_ZK_CHECK(PACS_CheckID,CISID,PatientNameChinese,PatientSex,PatientBirthday,StudyType,StudyBodyPart,ClinicDiagnose,ClinicSymptom,ClinicAdvice,IMGStrings,StudyState,Check_Doc,Check_Date,Report_Doc,Report_Date,Audit_Doc,Audit_Date) values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}')", blh, sqxh, xm, xb, "", "GJ", bbmc, blzd, rysj, "", blh + @"_1.jpg", 5, "", "", bgys, bgrq, shys, bgrq);


                OdbcCommand cmd = bb.GetOdbcStringCommond(insertsql);
                if (msg == "1")
                {
                    MessageBox.Show(cmd.Connection.ConnectionString);
                }
                bb.ExecuteNonQuery(cmd);
            }
        }
Example #2
0
        public void pathtohis(string blh, string debug)
        {
            dbbase.odbcdb aa = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");
            msg = f.ReadString("savetohis", "msg", "");
            DataTable jcxx = new DataTable();

            try
            {
                jcxx = aa.GetDataTable("select * from T_jcxx where F_blh='" + blh + "'", "jcxx");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
                return;
            }
            if (jcxx == null)
            {
                MessageBox.Show("病理数据库设置有问题!");
                log.WriteMyLog("病理数据库设置有问题!");
                return;
            }
            if (jcxx.Rows.Count < 1)
            {
                MessageBox.Show("病理号有错误!");
                log.WriteMyLog("病理号有错误!");
                return;
            }
            if (jcxx.Rows[0]["F_brlb"].ToString().Trim() != "体检")
            {
                //不检查审核状态
                if (jcxx.Rows[0]["F_bgzt"].ToString().Trim() != "已审核")
                {
                    return;
                }
                //string bgzt = dataGridView1.CurrentRow.Cells["报告状态"].Value.ToString().Trim();
                if (jcxx.Rows[0]["F_brbh"].ToString().Trim() == "")
                {
                    log.WriteMyLog(blh + ",无病人编号,不处理!");
                    return;
                }

                string brlb = "";

                string brbh = "";
                string brxb = "";
                string zyh  = "";
                string yzid = "";
                string shys = jcxx.Rows[0]["F_SHYS"].ToString().Trim();
                string sdrq = jcxx.Rows[0]["F_sdrq"].ToString().Trim();
                string bgrq = jcxx.Rows[0]["F_bgrq"].ToString().Trim();
                brxb = jcxx.Rows[0]["F_xb"].ToString().Trim();
                brxm = jcxx.Rows[0]["F_xm"].ToString().Trim();
                brbh = jcxx.Rows[0]["F_brbh"].ToString().Trim();
                // blh = jcxx.Rows[0]["F_blh"].ToString().Trim();
                zyh  = jcxx.Rows[0]["F_zyh"].ToString().Trim();
                yzid = jcxx.Rows[0]["F_yzid"].ToString().Trim();
                string his_blh = "";
                if (jcxx.Rows[0]["F_brlb"].ToString().Trim() == "住院")
                {
                    brlb    = "1";
                    his_blh = jcxx.Rows[0]["F_zyh"].ToString().Trim();
                    //zybh = jcxx.Rows[0]["F_yzid"].ToString().Trim();
                }
                else
                {
                    if (jcxx.Rows[0]["F_brlb"].ToString().Trim() == "门诊")
                    {
                        brlb    = "0";
                        his_blh = jcxx.Rows[0]["F_mzh"].ToString().Trim();
                    }
                    //zybh = jcxx.Rows[0]["F_brbh"].ToString().Trim();
                }
                bg01(brlb, brbh, blh, "1", his_blh, brxb, bgrq, yzid, sdrq, shys);
            }
            else
            {
                //------------------------------
                //  string msg = f.ReadString("savetohis", "msg", "");
                //string odbcstr = f.ReadString("savetohis", "odbcsql", "Data Source=192.168.0.1;Initial Catalog=zonekingnet;User Id=sa;Password=zoneking;"); //获取sz.ini中设置的odbcsql
                string odbcstr = f.ReadString("savetohis", "odbcsql", "DSN=pathnet-tj;UID=sa;PWD=zoneking;"); //获取sz.ini中设置的odbcsql

                if (jcxx.Rows[0]["F_SQXH"].ToString().Trim() == "")
                {
                    log.WriteMyLog("无体检号申请单号,不处理!");
                    return;
                }
                if (jcxx.Rows[0]["F_BGZT"].ToString().Trim() == "已审核")
                {
                    string jpgname   = "";
                    string ftpstatus = "";
                    mdjpg  mdj       = new mdjpg();
                    try
                    {
                        mdj.BMPTOJPG(blh, ref jpgname, "", "");
                    }
                    catch (Exception ee)
                    {
                        MessageBox.Show(ee.ToString());
                    }
                    if (msg == "1")
                    {
                        MessageBox.Show("生成jpg成功");
                    }
                    //---上传jpg----------
                    //----------------上传签章jpg至ftp---------------------
                    string status        = "";
                    string ftps          = f.ReadString("ftp", "ftp", "").Replace("\0", "");
                    string ftpServerIP   = f.ReadString("ftp", "ftpip", "").Replace("\0", "");
                    string ftpUserID     = f.ReadString("ftp", "user", "ftpuser").Replace("\0", "");
                    string ftpPassword   = f.ReadString("ftp", "pwd", "ftp").Replace("\0", "");
                    string ftplocal      = f.ReadString("ftp", "ftplocal", "c:\\temp").Replace("\0", "");
                    string ftpRemotePath = f.ReadString("ftp", "bgjpgPath", "pathimages/bgjpg").Replace("\0", "");
                    string tjtxpath      = f.ReadString("savetohis", "tjtxpath", "bgjpg");


                    string jpgpath = "";
                    if (ftps == "1")
                    {
                        FtpWeb fw     = new FtpWeb(ftpServerIP, ftpRemotePath, ftpUserID, ftpPassword);
                        string ftpURI = "ftp://" + ftpServerIP + "/" + ftpRemotePath + "/";

                        try
                        {
                            //判断ftp上是否存在该jpg文件
                            if (fw.fileCheckExist(ftpURI, blh + "_1.jpg"))
                            {
                                //删除ftp上的jpg文件
                                fw.fileDelete(ftpURI, blh + "_1.jpg").ToString();
                            }
                            //上传新生成的jpg文件
                            fw.Upload("C:\\temp\\" + blh + "\\" + blh + "_1.jpg", "", out status);

                            if (status == "Error")
                            {
                                MessageBox.Show("报告jpg上传失败,请重新审核!");
                                return;
                            }
                        }
                        catch
                        {
                            if (msg == "1")
                            {
                                MessageBox.Show("上传报告jpg文件异常");
                            }
                            return;
                        }
                    }
                    else
                    {
                        if (tjtxpath == "")
                        {
                            log.WriteMyLog("sz.ini txpath图像目录未设置");
                            return;
                        }
                        try
                        {
                            File.Copy(ftplocal + "\\" + blh + "\\" + blh + "_1.jpg", tjtxpath + "\\" + blh + "_1.jpg", true);
                        }
                        catch (Exception ee)
                        {
                            log.WriteMyLog("源路径:" + ftplocal + "\\" + blh + "_1.jpg" + "\n" + " 目标路径:" + tjtxpath + "\\" + blh + "_1.jpg");
                            log.WriteMyLog("复制文件异常!" + ee.ToString());
                            return;
                        }
                    }
                    if (msg == "1")
                    {
                        MessageBox.Show("上传报告jpg文件完成");
                    }
                    try
                    {
                        if (System.IO.Directory.Exists(@"c:\temp\" + blh))
                        {
                            System.IO.Directory.Delete(@"c:\temp\" + blh, true);
                        }
                    }
                    catch
                    {
                        log.WriteMyLog("删除临时目录" + blh + "失败"); return;
                    }

                    //////////////////////////////////////////////////////////
                    ///////回写体检数据库-T_SYN_TCT_CHECK////////////////////////////////////

                    string    tj_blzd = jcxx.Rows[0]["F_blzd"].ToString().Trim();
                    string    tj_jcsj = jcxx.Rows[0]["F_rysj"].ToString().Trim();
                    string    tj_ysyj = jcxx.Rows[0]["F_BZ"].ToString().Trim();
                    DataTable TJ_bljc = new DataTable();
                    TJ_bljc = aa.GetDataTable(" select *  from T_TBS_BG where  F_blh='" + blh + "'", "blxx");
                    if (TJ_bljc.Rows.Count > 0)
                    {
                        if (jcxx.Rows[0]["F_blk"].ToString().Trim() == "TCT体检" || jcxx.Rows[0]["F_blk"].ToString().Trim() == "TCT")
                        {
                            tj_jcsj = "标本满意度:" + TJ_bljc.Rows[0]["F_TBS_BBMYD"].ToString().Trim() + "\n" + TJ_bljc.Rows[0]["f_tbs_xbl"].ToString().Trim() + "\n";
                            tj_jcsj = tj_jcsj + TJ_bljc.Rows[0]["F_TBS_XBXM1"].ToString().Trim() + "\n" + TJ_bljc.Rows[0]["F_TBS_XBXM2"].ToString().Trim() + "\n";
                            tj_jcsj = tj_jcsj + TJ_bljc.Rows[0]["F_TBS_XBXM3"].ToString().Trim() + "\n";
                            tj_jcsj = tj_jcsj + "病原微生物:" + TJ_bljc.Rows[0]["F_TBS_WSW6"].ToString().Trim() + "\n" + TJ_bljc.Rows[0]["F_TBS_WSW2"].ToString().Trim() + "\n" + TJ_bljc.Rows[0]["F_TBS_WSW1"].ToString().Trim() + "\n";
                            tj_jcsj = tj_jcsj + TJ_bljc.Rows[0]["F_TBS_WSW3"].ToString().Trim() + "\n" + TJ_bljc.Rows[0]["F_TBS_BDXM1"].ToString().Trim() + "\n";
                            ////////////////////////////////////
                            tj_blzd = "诊断:" + TJ_bljc.Rows[0]["F_TBSZD"].ToString().Trim() + "\n" + "炎症程度:" + TJ_bljc.Rows[0]["F_TBS_YZCD"].ToString().Trim();
                            if (TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() != "")
                            {
                                tj_ysyj = tj_ysyj + "补充意见1:" + TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() + "\n";
                            }
                            if (TJ_bljc.Rows[0]["F_TBS_BCYJ2"].ToString().Trim() != "")
                            {
                                tj_ysyj = tj_ysyj + "补充意见2:" + TJ_bljc.Rows[0]["F_TBS_BCYJ2"].ToString().Trim() + "\n";
                            }
                        }
                    }
                    tj_blzd = tj_blzd + "\n" + tj_ysyj;

                    if (msg == "1")
                    {
                        MessageBox.Show(tj_jcsj);
                        MessageBox.Show(tj_blzd);
                    }



                    string cmdtxt = @"insert into T_SYN_TCT_CHECK(PACS_CheckID,CISID,PACSItemCode,PatientNameChinese,PatientSex,StudyType,StudyBodyPart,ClinicDiagnose,ClinicSymptom,ClinicAdvice,IMGStrings,StudyState,Check_Doc,Check_Date,Report_Doc,Report_Date,Audit_Doc,Audit_Date) values("
                                    + "'" + jcxx.Rows[0]["F_SQXH"].ToString().Trim() + "','" + jcxx.Rows[0]["F_BRBH"].ToString().Trim() + "','" + jcxx.Rows[0]["F_YZID"].ToString().Trim() + "','" + jcxx.Rows[0]["F_XM"].ToString().Trim() + "','" + jcxx.Rows[0]["F_XB"].ToString().Trim() + "',"
                                    + "'BL','" + jcxx.Rows[0]["F_bbmc"].ToString().Trim() + "','" + tj_blzd + "','" + tj_jcsj + "','','" + @"pathimages/bgjpg/" + blh + "_1.jpg" + "',5,'" + jcxx.Rows[0]["F_BGYS"].ToString().Trim() + "','" + jcxx.Rows[0]["F_SDRQ"].ToString().Trim() + "',"
                                    + "'" + jcxx.Rows[0]["F_bgys"].ToString().Trim() + "','" + jcxx.Rows[0]["F_bgrq"].ToString().Trim() + "','" + jcxx.Rows[0]["F_shys"].ToString().Trim() + "','" + jcxx.Rows[0]["F_SPARE5"].ToString().Trim() + "')";

                    // int x = SQL_ExecuteNonQuery(odbcstr, cmdtxt, msg);
                    int x = Odbc_ExecuteNonQuery(odbcstr, cmdtxt, msg);
                    if (msg == "1")
                    {
                        MessageBox.Show("影响行数:" + x.ToString());
                    }
                    if (x < 1)
                    {
                        log.WriteMyLog("回写体检接口失败。");
                    }
                    else
                    {
                        aa.ExecuteSQL("update T_JCXX  set F_SCBJ='1' where F_BLH='" + blh.Trim() + "'");
                    }
                }
                else
                {
                    if (jcxx.Rows[0]["F_SCBJ"].ToString().Trim() == "1")
                    {
                        string cmdtxt = "delete from  T_SYN_TCT_CHECK where  PACS_CheckID='" + jcxx.Rows[0]["F_SQXH"].ToString().Trim() + "' and  CISID='" + jcxx.Rows[0]["F_BRBH"].ToString().Trim() + "' and PACSItemCode='" + jcxx.Rows[0]["F_YZID"].ToString().Trim() + "'";
                        int    x      = Odbc_ExecuteNonQuery(odbcstr, cmdtxt, msg);
                    }
                }
            }
        }
Example #3
0
        public void pathtohis(string blh, string bglx, string bgxh, string czlb, string dz, string debug, string msg)
        {
            //   MessageBox.Show(blh + "^" + bglx + "^" + bgxh + "^" + czlb + "^" + dz);

            if (dz != "save")
            {
                return;
            }

            string ServiceUrl = f.ReadString("savetohis", "ServiceUrl", "192.9.200.1");

            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_brbh"].ToString().Trim() == "")
            {
                log.WriteMyLog("病人编号为空不回传");
                return;
            }


            string bgzt = "";
            string SHRQ = "";
            string bgys = "";
            string shys = "";
            string fzys = "";
            string bgrq = "";
            string blzd = "";
            string rysj = "";

            if (bglx == "cg")
            {
                bgzt = bljc.Rows[0]["F_BGZT"].ToString().Trim();
                SHRQ = bljc.Rows[0]["F_SPARE5"].ToString().Trim();
                bgys = bljc.Rows[0]["F_BGYS"].ToString().Trim();
                shys = bljc.Rows[0]["F_SHYS"].ToString().Trim();
                fzys = bljc.Rows[0]["F_FZYS"].ToString().Trim();
                bgrq = bljc.Rows[0]["F_BGRQ"].ToString().Trim();
                rysj = System.Security.SecurityElement.Escape(bljc.Rows[0]["F_rysj"].ToString().Trim()) + "\r\n" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_JXSJ"].ToString().Trim());
                blzd = System.Security.SecurityElement.Escape(bljc.Rows[0]["F_BLZD"].ToString().Trim()) + "\r\n" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_TSJC"].ToString().Trim());
            }
            if (bglx == "bd")
            {
                DataTable bdbg = new DataTable();
                bdbg = aa.GetDataTable("select * from T_BDBG where F_blh='" + blh + "' and F_bd_BGXH='" + bgxh + "'", "bd");
                bgzt = bdbg.Rows[0]["F_BD_BGZT"].ToString().Trim();
                SHRQ = bdbg.Rows[0]["F_BD_BGRQ"].ToString().Trim();
                bgys = bdbg.Rows[0]["F_bd_BGYS"].ToString().Trim();
                shys = bdbg.Rows[0]["F_bd_SHYS"].ToString().Trim();
                fzys = bdbg.Rows[0]["F_bd_FZYS"].ToString().Trim();
                bgrq = bdbg.Rows[0]["F_bd_BGRQ"].ToString().Trim();
                rysj = "";
                blzd = System.Security.SecurityElement.Escape(bdbg.Rows[0]["F_BdZD"].ToString().Trim());
            }
            if (bglx == "bc")
            {
                DataTable bcbg = new DataTable();
                bcbg = aa.GetDataTable("select * from T_BcBG where F_blh='" + blh + "' and F_bc_BGXH='" + bgxh + "'", "bc");
                bgzt = bcbg.Rows[0]["F_BC_BGZT"].ToString().Trim();
                SHRQ = bcbg.Rows[0]["F_BC_SPARE5"].ToString().Trim();
                bgys = bcbg.Rows[0]["F_bc_BGYS"].ToString().Trim();
                shys = bcbg.Rows[0]["F_bc_SHYS"].ToString().Trim();
                fzys = bcbg.Rows[0]["F_bc_FZYS"].ToString().Trim();
                bgrq = bcbg.Rows[0]["F_bc_BGRQ"].ToString().Trim();
                rysj = System.Security.SecurityElement.Escape(bcbg.Rows[0]["F_bc_JXSJ"].ToString().Trim());
                blzd = System.Security.SecurityElement.Escape(bcbg.Rows[0]["F_BcZD"].ToString().Trim()) + "\r\n" + System.Security.SecurityElement.Escape(bcbg.Rows[0]["F_BC_TSJC"].ToString().Trim());
            }
            //病理号^cg/bd/bc^bgxh^new/old^save/qxsh (同济)
            if (bgzt == "已审核")
            {
                //---------------------------------------
                //***************************************
                //---回写蓝韵pacs
                //***************************************
                //---------------------------------------

                if (debug == "1")
                {
                    log.WriteMyLog("开始回写pacs");
                }

                string xmlstr     = "";
                string ReprotFile = "";
                //-----------------------------------------------------------
                string jpgname = "";
                mdjpg  jpgxx   = new mdjpg();
                try
                {
                    if (bgxh == "")
                    {
                        bgxh = "0";
                    }
                    jpgxx.BMPTOJPG(blh, ref jpgname, bglx, bgxh);
                    //-读图片
                    string ftplocal = f.ReadString("ftp", "ftplocal", "c:\\temp").Replace("\0", "");
                    string imgPath  = ftplocal + "\\" + blh + "\\" + blh + "_" + bglx + "_" + bgxh + "_1.jpg";   //图片文件所在路径

                    FileStream file    = new FileStream(imgPath, FileMode.Open, FileAccess.Read);
                    Byte[]     imgByte = new Byte[file.Length]; //把图片转成 Byte型 二进制流
                    file.Read(imgByte, 0, imgByte.Length);      //把二进制流读入缓冲区

                    file.Close();
                    ReprotFile = Convert.ToBase64String(imgByte);

                    try
                    {
                        if (System.IO.Directory.Exists(@"c:\temp\" + blh))
                        {
                            System.IO.Directory.Delete(@"c:\temp\" + blh, true);
                        }
                    }
                    catch
                    {
                        log.WriteMyLog("回写pacs,删除报告JPG失败");
                    }
                }
                catch (Exception ee)
                {
                    log.WriteMyLog("回写pacs,生成报告JPG失败" + ee.Message);
                    ReprotFile = "";
                }
                //-----------------------------------------------------------------

                try
                {
                    xmlstr = "<?xml version='1.0' encoding='GB2312' ?><StudyInfo StationType='1'>";
                    xmlstr = xmlstr + "<PatientCode4></PatientCode4>";
                    //病人ID
                    xmlstr = xmlstr + "<PatientID>" + bljc.Rows[0]["F_BLH"].ToString().Trim() + "</PatientID>";
                    xmlstr = xmlstr + "<PatientName>" + bljc.Rows[0]["F_XM"].ToString().Trim() + "</PatientName> ";
                    xmlstr = xmlstr + "<PatientNameEn></PatientNameEn>";
                    xmlstr = xmlstr + "<PatientSex>" + bljc.Rows[0]["F_xb"].ToString().Trim() + "</PatientSex>";
                    xmlstr = xmlstr + "<DateOfBirth></DateOfBirth> ";
                    xmlstr = xmlstr + "<Citizenship /><IDCardNumber /><Occupation />";
                    xmlstr = xmlstr + "<Address>" + bljc.Rows[0]["F_lxxx"].ToString().Trim() + "</Address>";
                    xmlstr = xmlstr + "<TelPhone /><MedicalAlert /><ContrastAllergies /> ";
                    xmlstr = xmlstr + "<RegisteDate>" + bljc.Rows[0]["F_SDRQ"].ToString().Trim() + "</RegisteDate>";
                    //检查ID
                    xmlstr = xmlstr + "<StudyID>" + blh + "_" + bglx + "_" + bgxh + "</StudyID>";
                    xmlstr = xmlstr + "<BedNumber>" + bljc.Rows[0]["F_CH"].ToString().Trim() + "</BedNumber>";
                    xmlstr = xmlstr + "<InPatientNumber>" + bljc.Rows[0]["F_zyh"].ToString().Trim() + "</InPatientNumber>";
                    xmlstr = xmlstr + "<ClinicSymptom>" + bljc.Rows[0]["F_lczl"].ToString().Trim() + "</ClinicSymptom>";
                    xmlstr = xmlstr + "<ClinicDiagnose>" + bljc.Rows[0]["F_lczd"].ToString().Trim() + "</ClinicDiagnose>";
                    xmlstr = xmlstr + "<RequestMemo />";
                    xmlstr = xmlstr + "<AppliedDoctor>" + bljc.Rows[0]["F_sjys"].ToString().Trim() + "</AppliedDoctor>";
                    xmlstr = xmlstr + "<AppliedDate></AppliedDate>";
                    xmlstr = xmlstr + "<ArrivedDate>" + bljc.Rows[0]["F_SDRQ"].ToString().Trim() + "</ArrivedDate>";
                    xmlstr = xmlstr + "<BodyPart>" + bljc.Rows[0]["F_bbmc"].ToString().Trim() + "</BodyPart>";
                    xmlstr = xmlstr + "<Modality></Modality>";

                    xmlstr = xmlstr + "<ScanType /><FinishTime>" + bgrq + "</FinishTime>";
                    xmlstr = xmlstr + "<AppliedDepartment>" + bljc.Rows[0]["F_sjks"].ToString().Trim() + "</AppliedDepartment>";

                    xmlstr = xmlstr + "<Technician>" + bljc.Rows[0]["F_bgys"].ToString().Trim() + "</Technician>";

                    xmlstr = xmlstr + "<StudyDiagnose>" + rysj + "</StudyDiagnose>";
                    xmlstr = xmlstr + "<StudyTechnic /><StudyStatus>已审核</StudyStatus>";

                    xmlstr = xmlstr + "<StudyResult>" + blzd + "</StudyResult>";

                    xmlstr = xmlstr + "<FirstReportTime>" + bgrq + "</FirstReportTime>";

                    xmlstr = xmlstr + "<FirstDoctor>" + bgys + "</FirstDoctor>";

                    xmlstr = xmlstr + "<SecondReportTime>" + SHRQ + "</SecondReportTime>";

                    xmlstr = xmlstr + "<SecondDoctor>" + shys + "</SecondDoctor> ";
                    xmlstr = xmlstr + "<Register>" + bljc.Rows[0]["F_jsy"].ToString().Trim() + "</Register>";
                    xmlstr = xmlstr + "<Fee></Fee><Age>" + bljc.Rows[0]["F_NL"].ToString().Trim() + "</Age>";
                    xmlstr = xmlstr + "<Positive></Positive><ExamDepartment>病理科</ExamDepartment>   ";

                    xmlstr = xmlstr + "<ThirdDoctor>" + fzys + "</ThirdDoctor>";

                    xmlstr = xmlstr + "<ThirdReportTime /><Result1 /> <Result2 /> <Result3 /> <Result4 /> <Result5 /> <Result6 /> <Result7 /> <Result8 /> ";
                    xmlstr = xmlstr + "<TrackTime /> <TrackResult />";
                    xmlstr = xmlstr + "<PositiveType>" + bljc.Rows[0]["F_YYX"].ToString().Trim() + "</PositiveType> <TrackDoctor />";

                    xmlstr = xmlstr + "<PatientType>" + bljc.Rows[0]["F_brlb"].ToString().Trim() + "</PatientType>";
                    xmlstr = xmlstr + "<StudyType>" + bljc.Rows[0]["F_BLK"].ToString().Trim() + "</StudyType>";
                    xmlstr = xmlstr + "<ModalityType>BL</ModalityType>";
                    xmlstr = xmlstr + "<IsTracked /> <Weight /> <Height /><ReportType /> <AcrIndex />";
                    //常规,冰冻,补充
                    xmlstr = xmlstr + "<StudyCode>" + "BL_" + blh + "_" + bglx + "_" + bgxh + "</StudyCode>";

                    if (bljc.Rows[0]["F_brlb"].ToString().Trim() == "住院")
                    {
                        xmlstr = xmlstr + "<HisCode1>" + bljc.Rows[0]["F_ZYH"].ToString().Trim() + "</HisCode1>";
                    }
                    else
                    {
                        xmlstr = xmlstr + "<HisCode1>" + bljc.Rows[0]["F_MZH"].ToString().Trim() + "</HisCode1>";
                    }
                    xmlstr = xmlstr + "<HisCode2>" + bljc.Rows[0]["F_sqxh"].ToString().Trim() + "</HisCode2>";
                    xmlstr = xmlstr + "<HisCode3>" + bljc.Rows[0]["F_brbh"].ToString().Trim() + "</HisCode3> ";
                    xmlstr = xmlstr + "<HisCode4>" + bljc.Rows[0]["F_YZID"].ToString().Trim() + "</HisCode4>";
                    xmlstr = xmlstr + "<StudyUIDS><StudyUID></StudyUID></StudyUIDS>";
                    xmlstr = xmlstr + "<ReportFile>" + ReprotFile + "</ReportFile>";
                    xmlstr = xmlstr + "<TrueOfClinic>" + bljc.Rows[0]["F_SFFH"].ToString().Trim() + "</TrueOfClinic></StudyInfo>";
                }
                catch (Exception ee)
                {
                    log.WriteMyLog("回传pacs,xml生成异常:" + ee.Message);
                    return;
                }

                string rtn = "";
                try
                {
                    if (debug == "1")
                    {
                        log.WriteMyLog(xmlstr);
                    }

                    if (ConnectService(ServiceUrl))
                    {
                        if (UploadXmlContent(xmlstr))
                        {
                            if (debug == "1")
                            {
                                MessageBox.Show("true");
                            }
                        }
                        else
                        {
                            log.WriteMyLog("回写失败,false");
                            if (debug == "1")
                            {
                                MessageBox.Show("false");
                            }
                        }
                    }
                    else
                    {
                        log.WriteMyLog("连接数据库错误:" + ServiceUrl);
                    }
                    DisconnectService();
                }
                catch (Exception e2)
                {
                    log.WriteMyLog("回传pacs异常:" + e2.Message);
                    return;
                }
            }
            return;
        }
Example #4
0
        public void pathtohis(string blh, string yymc)
        {
            string msg = f.ReadString("savetohis", "msg", "");


            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_yzid"].ToString().Trim() == "")
            //{
            //     LGZGQClass.log.WriteMyLog("医嘱ID为空不回传");
            //    return;
            //}
            //if (bljc.Rows[0]["F_sqxh"].ToString().Trim() == "")
            //{
            //     LGZGQClass.log.WriteMyLog("无申请序号(单据号),不处理!");
            //    return;
            //}
            string yhID   = f.ReadString("yh", "yhbh", "").Replace("\0", "");
            string tohis  = f.ReadString("savetohis", "tohis", "1").Replace("\0", "");
            string topacs = f.ReadString("savetohis", "topacs", "1").Replace("\0", "");
            string tojmjk = f.ReadString("savetohis", "tojmjk", "1").Replace("\0", "");


            if (bljc.Rows[0]["F_bgzt"].ToString().Trim() == "已审核")
            {
                if (msg == "1")
                {
                    log.WriteMyLog("-------------------------------");
                }

                string F_YZID = bljc.Rows[0]["F_yzid"].ToString().Trim();
                if (F_YZID == "")
                {
                    F_YZID = "^";
                }
                string[] yzid = F_YZID.Split('^');
                //---------------------------------------
                //***************************************
                //---回写蓝韵pacs
                //***************************************
                //---------------------------------------
                if (topacs == "1")
                {
                    if (msg == "1")
                    {
                        log.WriteMyLog("开始回写pacs");
                    }

                    string xmlstr     = "";
                    string ReprotFile = "";

                    //-----------------------------------------------------------
                    string jpgname = "";
                    mdjpg  jpgxx   = new mdjpg();
                    try
                    {
                        jpgxx.BMPTOJPG(blh, ref jpgname, "cg", "1");

                        //-读图片
                        string ftplocal = f.ReadString("ftp", "ftplocal", "c:\\temp").Replace("\0", "");
                        string imgPath  = ftplocal + "\\" + blh + "\\" + blh + "_cg_1_1.jpg";//图片文件所在路径

                        FileStream file    = new FileStream(imgPath, FileMode.Open, FileAccess.Read);
                        Byte[]     imgByte = new Byte[file.Length]; //把图片转成 Byte型 二进制流
                        file.Read(imgByte, 0, imgByte.Length);      //把二进制流读入缓冲区

                        file.Close();
                        ReprotFile = Convert.ToBase64String(imgByte);

                        try
                        {
                            if (System.IO.Directory.Exists(@"c:\temp\" + blh))
                            {
                                System.IO.Directory.Delete(@"c:\temp\" + blh, true);
                            }
                        }
                        catch
                        {
                            log.WriteMyLog("回写pacs,删除临时报告JPG失败");
                        }
                    }
                    catch (Exception ee)
                    {
                        log.WriteMyLog("回写pacs,生成报告JPG失败");
                        ReprotFile = "";
                    }
                    //-----------------------------------------------------------------

                    try
                    {
                        xmlstr = "<?xml version='1.0' encoding='GB2312' ?><StudyInfo StationType='1'>";
                        xmlstr = xmlstr + "<PatientCode4></PatientCode4><PatientID>" + bljc.Rows[0]["F_BLH"].ToString().Trim() + "</PatientID><PatientName>" + bljc.Rows[0]["F_XM"].ToString().Trim() + "</PatientName> ";
                        xmlstr = xmlstr + "<PatientNameEn></PatientNameEn><PatientSex>" + bljc.Rows[0]["F_xb"].ToString().Trim() + "</PatientSex><DateOfBirth></DateOfBirth> ";
                        xmlstr = xmlstr + "<Citizenship /><IDCardNumber /><Occupation /><Address>" + bljc.Rows[0]["F_lxxx"].ToString().Trim() + "</Address><TelPhone /><MedicalAlert /><ContrastAllergies /> ";
                        xmlstr = xmlstr + "<RegisteDate>" + bljc.Rows[0]["F_SDRQ"].ToString().Trim() + "</RegisteDate><StudyID>" + bljc.Rows[0]["F_BLH"].ToString().Trim() + "</StudyID>";
                        xmlstr = xmlstr + "<BedNumber>" + bljc.Rows[0]["F_CH"].ToString().Trim() + "</BedNumber><InPatientNumber>" + bljc.Rows[0]["F_zyh"].ToString().Trim() + "</InPatientNumber>";
                        xmlstr = xmlstr + "<ClinicSymptom>" + bljc.Rows[0]["F_lczl"].ToString().Trim() + "</ClinicSymptom><ClinicDiagnose>" + bljc.Rows[0]["F_lczd"].ToString().Trim() + "</ClinicDiagnose><RequestMemo />";
                        xmlstr = xmlstr + "<AppliedDoctor>" + bljc.Rows[0]["F_sjys"].ToString().Trim() + "</AppliedDoctor><AppliedDate></AppliedDate>";
                        xmlstr = xmlstr + " <ArrivedDate>" + bljc.Rows[0]["F_SDRQ"].ToString().Trim() + "</ArrivedDate><BodyPart>" + bljc.Rows[0]["F_bbmc"].ToString().Trim() + "</BodyPart><Modality></Modality>";
                        xmlstr = xmlstr + " <ScanType /><FinishTime></FinishTime><AppliedDepartment>" + bljc.Rows[0]["F_sjks"].ToString().Trim() + "</AppliedDepartment>";
                        xmlstr = xmlstr + "<Technician>" + bljc.Rows[0]["F_bgys"].ToString().Trim() + "</Technician><StudyDiagnose>" + bljc.Rows[0]["F_rysj"].ToString().Trim() + "</StudyDiagnose>";
                        xmlstr = xmlstr + " <StudyTechnic /><StudyStatus>已审核</StudyStatus><StudyResult>" + bljc.Rows[0]["F_blzd"].ToString().Trim() + "</StudyResult><FirstReportTime>" + bljc.Rows[0]["F_bgrq"].ToString().Trim() + "</FirstReportTime>";
                        xmlstr = xmlstr + " <FirstDoctor>" + bljc.Rows[0]["F_BGYS"].ToString().Trim() + "</FirstDoctor><SecondReportTime>" + bljc.Rows[0]["F_SPARE5"].ToString().Trim() + "</SecondReportTime>";
                        xmlstr = xmlstr + "<SecondDoctor>" + bljc.Rows[0]["F_shys"].ToString().Trim() + "</SecondDoctor> ";
                        xmlstr = xmlstr + " <Register>" + bljc.Rows[0]["F_jsy"].ToString().Trim() + "</Register><Fee></Fee><Age>" + bljc.Rows[0]["F_NL"].ToString().Trim() + "</Age><Positive></Positive><ExamDepartment>病理科</ExamDepartment>   ";
                        xmlstr = xmlstr + " <ThirdDoctor /><ThirdReportTime /><Result1 /> <Result2 /> <Result3 /> <Result4 /> <Result5 /> <Result6 /> <Result7 /> <Result8 /> ";
                        xmlstr = xmlstr + " <TrackTime /> <TrackResult /> <PositiveType /> <TrackDoctor /> <PatientType>" + bljc.Rows[0]["F_brlb"].ToString().Trim() + "</PatientType><StudyType>" + bljc.Rows[0]["F_BLK"].ToString().Trim() + "</StudyType> <ModalityType>pis</ModalityType>";
                        xmlstr = xmlstr + " <IsTracked /> <Weight /> <Height /> <StudyTechnic /> <ReportType /> <AcrIndex /> <StudyCode>" + bljc.Rows[0]["F_blh"].ToString().Trim() + "</StudyCode> <HisCode1>" + yzid[1].ToString() + "</HisCode1> <HisCode2>" + yzid[0].ToString() + "</HisCode2> <HisCode3>" + bljc.Rows[0]["F_brbh"].ToString().Trim() + "</HisCode3> ";
                        xmlstr = xmlstr + " <HisCode4>" + bljc.Rows[0]["F_sqxh"].ToString().Trim() + "</HisCode4><ReportFile>" + ReprotFile + "</ReportFile><TrueOfClinic>" + bljc.Rows[0]["F_SFFH"].ToString().Trim() + "</TrueOfClinic> </StudyInfo>";
                    }
                    catch
                    {
                        log.WriteMyLog("回传pacs,xml生成异常");
                        goto jkda;
                    }

                    string rtn = "";
                    try
                    {
                        if (msg == "1")
                        {
                            log.WriteMyLog(xmlstr);
                        }
                        wys_pacs_web.CISService wys = new wys_pacs_web.CISService();

                        rtn = wys.Upload(xmlstr);
                        if (msg == "1")
                        {
                            log.WriteMyLog("回写pacs完成,返回" + rtn);
                        }
                    }
                    catch
                    {
                        log.WriteMyLog("回传pacs异常!" + rtn);
                    }
                }
                //---------------------------------------
                //***************************************
                //---回写居民健康
                //**************************************
                //---------------------------------------
                if (msg == "1")
                {
                    log.WriteMyLog("-------------------------------");
                }
                jkda : if (tojmjk == "1")
                {
                    if (msg == "1")
                    {
                        log.WriteMyLog("开始回写居民健康档案----");
                    }

                    if (bljc.Rows[0]["F_yzid"].ToString().Trim() == "")
                    {
                        log.WriteMyLog("医嘱ID为空不回传");
                        goto his;
                    }
                    if (bljc.Rows[0]["F_yzid"].ToString().Trim() == "^")
                    {
                        log.WriteMyLog("医嘱ID为空不回传");
                        goto his;
                    }
                    if (yzid[0].ToString().Trim() == "")
                    {
                        log.WriteMyLog("PATIENT_ID为空不回传");
                        goto his;
                    }
                    if (yzid[1].ToString().Trim() == "")
                    {
                        log.WriteMyLog("EVENT_ID为空不回传");
                        goto his;
                    }


                    string brlb = bljc.Rows[0]["F_brlb"].ToString().Trim();
                    int    lb   = 0;
                    if (brlb == "住院")
                    {
                        lb = 2;
                    }
                    if (brlb == "门诊")
                    {
                        lb = 1;
                    }

                    string sex_id = "0";
                    if (bljc.Rows[0]["F_XB"].ToString().Trim() == "男")
                    {
                        sex_id = "1";
                    }
                    if (bljc.Rows[0]["F_XB"].ToString().Trim() == "女")
                    {
                        sex_id = "2";
                    }

                    int csrq = (2013 - int.Parse((bljc.Rows[0]["F_nl"].ToString().Trim().Split('岁'))[0].ToString()) + 1);

                    string intostr = "";
                    string qcrq    = bljc.Rows[0]["F_QCrq"].ToString().Trim();
                    if (qcrq == "")
                    {
                        qcrq = bljc.Rows[0]["F_sdrq"].ToString().Trim();
                    }
                    try
                    {
                        intostr = "insert into CEHR_EXAM_MASTER(MASTER_ID,PATIENT_ID,EVENT_TYPE,EVENT_NO,RETRIEVE_DATE,CLASS_CODE,CLASS_NAME,BODY_PART_CODE,BODY_PART_NAME,EXAM_CODE,EXAM_NAME,TITLE,EFFECTIVE_TIME,CONFIDENTIALITY,";
                        intostr = intostr + "PATIENT_NAME,PATIENT_SEX,PATIENT_SEX_DETAIL,PATIENT_BIRTHDAY,AUTHOR_ID,AUTHOR_TIME,AUTHOR_NAME,AUTHENTICATOR_ID,AUTHENTICATOR_TIME,AUTHENTICATOR_NAME,PARTICIPANT_DEPT,PARTICIPANT_ID,PARTICIPANT_TIME,PARTICIPANT_NAME,ORDER_ID,";
                        intostr = intostr + "ORDER_PRIORITY,ORDER_PRIORITY_NAME,PERFORMER_DEPT_NAME,PERFORMER_DOCTOR,PERFORMER_TIME,PLAYING_DEVICE,CLINIC_DIAGNOSIS,PATIENT_CONDITION,EXAM_CAUSE,DESCRIPTION,IS_ABNORMAL) ";
                        intostr = intostr + "values('" + bljc.Rows[0]["F_BLH"].ToString().Trim() + "','" + yzid[0].ToString() + "'," + lb + ",'" + yzid[1].ToString() + "',to_date('" + DateTime.Parse(bljc.Rows[0]["F_SPARE5"].ToString().Trim()).ToString("yyyy-MM-dd HH:mm:ss") + "','YYYY-MM-DD HH24:MI:SS'),'','','','";
                        intostr = intostr + bljc.Rows[0]["F_BBMC"].ToString().Trim() + "','','" + "病理检查" + "','病理" + bljc.Rows[0]["F_BLK"].ToString().Trim() + "检查报告单',to_date('" + DateTime.Parse(bljc.Rows[0]["F_SDRQ"].ToString().Trim()).ToString("yyyy-MM-dd HH:mm:ss") + "','YYYY-MM-DD HH24:MI:SS'),'N','";
                        intostr = intostr + bljc.Rows[0]["F_XM"].ToString().Trim() + "','" + sex_id + "','" + bljc.Rows[0]["F_xb"].ToString().Trim() + "',to_date('" + DateTime.Parse(csrq.ToString() + "-01-01").ToString("yyyy-MM-dd HH:mm:ss") + "','YYYY-MM-DD HH24:MI:SS'),'" + getyhbh(bljc.Rows[0]["F_bgys"].ToString().Trim()) + "',to_date('" + DateTime.Parse(bljc.Rows[0]["F_bgrq"].ToString().Trim()).ToString("yyyy-MM-dd HH:mm:ss");
                        intostr = intostr + "','YYYY-MM-DD HH24:MI:SS'),'" + bljc.Rows[0]["F_bgys"].ToString().Trim() + "','" + getyhbh(bljc.Rows[0]["F_shys"].ToString().Trim()) + "',to_date('" + DateTime.Parse(bljc.Rows[0]["F_SPARE5"].ToString().Trim()).ToString("yyyy-MM-dd HH:mm:ss") + "','YYYY-MM-DD HH24:MI:SS'),'" + bljc.Rows[0]["F_shys"].ToString().Trim() + "','";
                        intostr = intostr + bljc.Rows[0]["F_sjks"].ToString().Trim() + "','','','" + bljc.Rows[0]["F_sjys"].ToString().Trim() + "','" + bljc.Rows[0]["F_SQXH"].ToString().Trim() + "','R','','病理科','";
                        intostr = intostr + bljc.Rows[0]["F_qcys"].ToString().Trim() + "',to_date('" + DateTime.Parse(qcrq) + "','YYYY-MM-DD HH24:MI:SS'),'','" + bljc.Rows[0]["F_lczd"].ToString().Trim() + "','','','" + bljc.Rows[0]["F_BLZD"].ToString().Trim() + "','')";
                    }
                    catch (Exception eee)
                    {
                        log.WriteMyLog("回传健康档案异常!拼接语句错误" + eee.ToString());
                        log.WriteMyLog(intostr);
                        goto his;
                    }
                    try
                    {
                        int xxxxx = insert_orcl(intostr, "");
                        if (msg == "1")
                        {
                            log.WriteMyLog("回写居民健康档案完成,影响行数" + xxxxx);
                        }
                    }
                    catch
                    {
                        log.WriteMyLog("回传健康档案异常!执行插入语句异常2");
                        return;
                    }
                }
                //------------------------------
                //---回写his
                //------------------------------
                if (msg == "1")
                {
                    log.WriteMyLog("-------------------------------");
                }
                his : if (tohis == "1")
                {
                    if (msg == "1")
                    {
                        log.WriteMyLog("开始回写his----");
                    }

                    if (bljc.Rows[0]["F_sqxh"].ToString().Trim() == "")
                    {
                        log.WriteMyLog("无申请序号(单据号),不处理!");
                        return;
                    }
                    string rtn = "";
                    try
                    { //来源 : 1 门诊,2 住院,
                        string brlb      = bljc.Rows[0]["F_brlb"].ToString().Trim();
                        string InLaiYuan = "1";

                        if (brlb == "住院")
                        {
                            InLaiYuan = "2";
                        }

                        try
                        {
                            rtn = jcbgsave(bljc.Rows[0]["F_rysj"].ToString().Trim(), bljc.Rows[0]["F_blzd"].ToString().Trim(), "病理" + bljc.Rows[0]["F_blk"].ToString().Trim() + "检查", bljc.Rows[0]["F_bgys"].ToString().Trim(), DateTime.Parse(bljc.Rows[0]["F_bgrq"].ToString().Trim()).ToString("yyyy-MM-dd HH:mm:ss"), bljc.Rows[0]["F_brbh"].ToString().Trim(), bljc.Rows[0]["F_SQXH"].ToString().Trim(), InLaiYuan, getyhbh(bljc.Rows[0]["F_BGYS"].ToString().Trim()), "JC12");
                            if (rtn.Trim() == "Y")
                            {
                                if (msg == "1")
                                {
                                    log.WriteMyLog("回写his完成,返回" + rtn);
                                }

                                return;
                            }
                            else
                            {
                                log.WriteMyLog("回写his错误,返回" + rtn);
                                return;
                            }
                        }
                        catch (Exception eReport)
                        {
                            log.WriteMyLog("回写his异常," + eReport.ToString());
                            return;
                        }
                    }
                    catch (Exception ee)
                    {
                        log.WriteMyLog("回写his异常," + ee.ToString());
                        return;
                    }
                }

                //---结束-------------------------------------
            }
            else
            {
                //冰冻


                DataTable blbd = new DataTable();
                blbd = aa.GetDataTable("select * from T_BDBG where F_bd_bgzt='已审核' and F_blh='" + blh + "'", "blbd");
                if (blbd == null)
                {
                    MessageBox.Show("病理数据库设置有问题!");
                    log.WriteMyLog("病理数据库设置有问题!");
                    return;
                }
                if (blbd.Rows.Count > 0)
                {
                    //上传冰冻报告 to 蓝韵pacs

                    string F_YZID = bljc.Rows[0]["F_yzid"].ToString().Trim();
                    if (F_YZID == "")
                    {
                        F_YZID = "^";
                    }
                    string[] yzid = F_YZID.Split('^');

                    if (topacs == "1")
                    {
                        string xmlstr     = "";
                        string ReprotFile = "";

                        //-----------------------------------------------------------
                        string jpgname = "";
                        mdjpg  jpgxx   = new mdjpg();
                        try
                        {
                            jpgxx.BMPTOJPG(blh, ref jpgname, "bd", "1");

                            //-读图片
                            string ftplocal = f.ReadString("ftp", "ftplocal", "c:\\temp").Replace("\0", "");
                            string imgPath  = ftplocal + "\\" + blh + "\\" + blh + "_bd_1_1.jpg";//图片文件所在路径

                            FileStream file    = new FileStream(imgPath, FileMode.Open, FileAccess.Read);
                            Byte[]     imgByte = new Byte[file.Length]; //把图片转成 Byte型 二进制流
                            file.Read(imgByte, 0, imgByte.Length);      //把二进制流读入缓冲区

                            file.Close();
                            ReprotFile = Convert.ToBase64String(imgByte);

                            try
                            {
                                //if (System.IO.Directory.Exists(@"c:\temp\" + blh))
                                //     System.IO.Directory.Delete(@"c:\temp\" + blh, true);
                            }
                            catch
                            {
                                log.WriteMyLog("回写pacs,删除临时冰冻报告JPG失败");
                            }
                        }
                        catch (Exception ee)
                        {
                            log.WriteMyLog("回写pacs,生成冰冻报告JPG失败");
                            ReprotFile = "";
                        }
                        //-----------------------------------------------------------------

                        try
                        {
                            xmlstr = "<?xml version='1.0' encoding='GB2312' ?><StudyInfo StationType='1'>";
                            xmlstr = xmlstr + "<PatientCode4></PatientCode4><PatientID>" + bljc.Rows[0]["F_BLH"].ToString().Trim() + "</PatientID><PatientName>" + bljc.Rows[0]["F_XM"].ToString().Trim() + "</PatientName> ";
                            xmlstr = xmlstr + "<PatientNameEn></PatientNameEn><PatientSex>" + bljc.Rows[0]["F_xb"].ToString().Trim() + "</PatientSex><DateOfBirth></DateOfBirth> ";
                            xmlstr = xmlstr + "<Citizenship /><IDCardNumber /><Occupation /><Address>" + bljc.Rows[0]["F_lxxx"].ToString().Trim() + "</Address><TelPhone /><MedicalAlert /><ContrastAllergies /> ";
                            xmlstr = xmlstr + "<RegisteDate>" + bljc.Rows[0]["F_SDRQ"].ToString().Trim() + "</RegisteDate><StudyID>" + bljc.Rows[0]["F_BLH"].ToString().Trim() + "</StudyID>";
                            xmlstr = xmlstr + "<BedNumber>" + bljc.Rows[0]["F_CH"].ToString().Trim() + "</BedNumber><InPatientNumber>" + bljc.Rows[0]["F_zyh"].ToString().Trim() + "</InPatientNumber>";
                            xmlstr = xmlstr + "<ClinicSymptom>" + bljc.Rows[0]["F_lczl"].ToString().Trim() + "</ClinicSymptom><ClinicDiagnose>" + bljc.Rows[0]["F_lczd"].ToString().Trim() + "</ClinicDiagnose><RequestMemo />";
                            xmlstr = xmlstr + "<AppliedDoctor>" + bljc.Rows[0]["F_sjys"].ToString().Trim() + "</AppliedDoctor><AppliedDate></AppliedDate>";
                            xmlstr = xmlstr + " <ArrivedDate>" + bljc.Rows[0]["F_SDRQ"].ToString().Trim() + "</ArrivedDate><BodyPart>" + bljc.Rows[0]["F_bbmc"].ToString().Trim() + "</BodyPart><Modality></Modality>";
                            xmlstr = xmlstr + " <ScanType /><FinishTime></FinishTime><AppliedDepartment>" + bljc.Rows[0]["F_sjks"].ToString().Trim() + "</AppliedDepartment>";
                            xmlstr = xmlstr + "<Technician>" + blbd.Rows[0]["F_BD_bgys"].ToString().Trim() + "</Technician><StudyDiagnose>" + bljc.Rows[0]["F_rysj"].ToString().Trim() + "</StudyDiagnose>";
                            xmlstr = xmlstr + " <StudyTechnic /><StudyStatus>已审核</StudyStatus><StudyResult>" + blbd.Rows[0]["F_bdzd"].ToString().Trim() + "</StudyResult><FirstReportTime>" + blbd.Rows[0]["F_bd_bgrq"].ToString().Trim() + "</FirstReportTime>";
                            xmlstr = xmlstr + " <FirstDoctor>" + blbd.Rows[0]["F_bd_BGYS"].ToString().Trim() + "</FirstDoctor><SecondReportTime>" + blbd.Rows[0]["F_BD_SDRQ"].ToString().Trim() + "</SecondReportTime>";
                            xmlstr = xmlstr + "<SecondDoctor>" + blbd.Rows[0]["F_bd_shys"].ToString().Trim() + "</SecondDoctor> ";
                            xmlstr = xmlstr + " <Register>" + bljc.Rows[0]["F_jsy"].ToString().Trim() + "</Register><Fee></Fee><Age>" + bljc.Rows[0]["F_NL"].ToString().Trim() + "</Age><Positive></Positive><ExamDepartment>病理科</ExamDepartment>   ";
                            xmlstr = xmlstr + " <ThirdDoctor /><ThirdReportTime /><Result1 /> <Result2 /> <Result3 /> <Result4 /> <Result5 /> <Result6 /> <Result7 /> <Result8 /> ";
                            xmlstr = xmlstr + " <TrackTime /> <TrackResult /> <PositiveType /> <TrackDoctor /> <PatientType>" + bljc.Rows[0]["F_brlb"].ToString().Trim() + "</PatientType><StudyType>" + "冰冻" + "</StudyType> <ModalityType>pis</ModalityType>";
                            xmlstr = xmlstr + " <IsTracked /> <Weight /> <Height /> <StudyTechnic /> <ReportType /> <AcrIndex /> <StudyCode>" + bljc.Rows[0]["F_blh"].ToString().Trim() + "</StudyCode> <HisCode1>" + yzid[1].ToString() + "</HisCode1> <HisCode2>" + yzid[0].ToString() + "</HisCode2> <HisCode3>" + bljc.Rows[0]["F_brbh"].ToString().Trim() + "</HisCode3> ";
                            xmlstr = xmlstr + " <HisCode4>" + bljc.Rows[0]["F_sqxh"].ToString().Trim() + "</HisCode4><ReportFile>" + ReprotFile + "</ReportFile><TrueOfClinic>" + bljc.Rows[0]["F_SFFH"].ToString().Trim() + "</TrueOfClinic> </StudyInfo>";
                        }
                        catch
                        {
                            log.WriteMyLog("回传pacs,xml生成异常");
                        }
                        string rtn = "";


                        try
                        {
                            if (msg == "1")
                            {
                                log.WriteMyLog(xmlstr);
                            }
                            wys_pacs_web.CISService wys = new wys_pacs_web.CISService();

                            rtn = wys.Upload(xmlstr);
                            if (msg == "1")
                            {
                                log.WriteMyLog("回写pacs完成,返回" + rtn);
                            }
                        }
                        catch
                        {
                            log.WriteMyLog("回传pacs异常!" + rtn);
                        }
                    }
                }
            } return;
        }
Example #5
0
        public void pathtohis(string blh, string debug)
        {
            string msg = f.ReadString("savetohis", "debug", "");

            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 + "'", "bljc");

            if (bljc == null)
            {
                MessageBox.Show("病理数据库设置有问题!");
                log.WriteMyLog("病理数据库设置有问题!");
                return;
            }
            if (bljc.Rows.Count < 1)
            {
                MessageBox.Show("病理号有错误!");
                log.WriteMyLog("病理号有错误!");
                return;
            }
            if (bljc.Rows[0]["F_BGZT"].ToString().Trim() == "已审核")
            {
                if (bljc.Rows[0]["F_brlb"].ToString().Trim() != "体检")
                {
                    log.WriteMyLog("非体检病人,不处理!");
                    return;
                }
                if (bljc.Rows[0]["F_brbh"].ToString().Trim() == "")
                {
                    log.WriteMyLog("无体检号,不处理!");
                    return;
                }


                string jpgname   = "";
                string ftpstatus = "";
                //mdjpg mdj = new mdjpg();

                //try
                //{
                //    mdj.BMPTOJPG(blh, ref jpgname, "", "", "rpt//szqm");
                //}
                //catch (Exception ee)
                //{
                //    MessageBox.Show(ee.ToString());
                //}

                mdjpg mdj = new mdjpg();
                try
                {
                    for (int x = 0; x < 3; x++)
                    {
                        if (!File.Exists("C:\\temp\\" + blh + "\\" + blh + "_1.jpg"))
                        {
                            mdj.BMPTOJPG(blh, ref jpgname, "rpt//szqm");
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                catch (Exception ee)
                {
                    if (msg == "1")
                    {
                        MessageBox.Show("生成JPG异常:" + ee.Message);
                    }
                    log.WriteMyLog(blh + ",生成JPG异常:" + ee.Message);
                }

                if (!File.Exists("C:\\temp\\" + blh + "\\" + blh + "_1.jpg"))
                {
                    if (msg == "1")
                    {
                        MessageBox.Show("未找到文件" + "C:\\temp\\" + blh + "\\" + blh + "_1.jpg");
                    }
                    log.WriteMyLog(blh + ",未找到文件" + "C:\\temp\\" + blh + "\\" + blh + "_1.jpg");
                    return;
                }
                else
                {
                    if (msg == "1")
                    {
                        MessageBox.Show("生成jpg成功");
                    }
                }
                //---上传jpg----------
                //----------------上传签章jpg至ftp---------------------

                string status        = "";
                string ftps          = f.ReadString("ftp", "ftp", "").Replace("\0", "");
                string ftpServerIP   = f.ReadString("ftp", "ftpip", "").Replace("\0", "");
                string ftpUserID     = f.ReadString("ftp", "user", "ftpuser").Replace("\0", "");
                string ftpPassword   = f.ReadString("ftp", "pwd", "ftp").Replace("\0", "");
                string ftplocal      = f.ReadString("ftp", "ftplocal", "c:\\temp").Replace("\0", "");
                string ftpRemotePath = f.ReadString("ftp", "bgjpgPath", "pathimages/bgjpg").Replace("\0", "");
                string tjtxpath      = f.ReadString("savetohis", "tjtxpath", "bgjpg");
                if (ftps == "1")
                {
                    FtpWeb fw     = new FtpWeb(ftpServerIP, ftpRemotePath, ftpUserID, ftpPassword);
                    string ftpURI = "ftp://" + ftpServerIP + "/" + ftpRemotePath + "/";
                    try
                    {
                        //判断ftp上是否存在该jpg文件
                        if (fw.fileCheckExist(ftpURI, blh + "_1.jpg"))
                        {
                            //删除ftp上的jpg文件
                            fw.fileDelete(ftpURI, blh + "_1.jpg").ToString();
                        }
                        //上传新生成的jpg文件
                        fw.Upload("C:\\temp\\" + blh + "\\" + blh + "_1.jpg", "", out status);

                        if (status == "Error")
                        {
                            MessageBox.Show("报告jpg上传失败,请重新审核!");
                            return;
                        }
                    }
                    catch
                    {
                        if (msg == "1")
                        {
                            MessageBox.Show("上传报告jpg文件异常");
                        }
                        return;
                    }
                }
                else
                {
                    if (tjtxpath == "")
                    {
                        log.WriteMyLog("sz.ini txpath图像目录未设置");
                        return;
                    }
                    try
                    {
                        File.Copy(ftplocal + "\\" + blh + "\\" + blh + "_1.jpg", tjtxpath + "\\" + blh + "_1.jpg", true);
                    }
                    catch (Exception ee)
                    {
                        log.WriteMyLog("源路径:" + ftplocal + "\\" + blh + "_1.jpg" + "\n" + " 目标路径:" + tjtxpath + "\\" + "_1.jpg");
                        log.WriteMyLog("复制文件异常!" + ee.ToString());
                        return;
                    }
                }
                if (msg == "1")
                {
                    MessageBox.Show("上传报告jpg文件完成");
                }
                try
                {
                    if (System.IO.Directory.Exists(@"c:\temp\" + blh))
                    {
                        System.IO.Directory.Delete(@"c:\temp\" + blh, true);
                    }
                }
                catch
                {
                    log.WriteMyLog("删除临时目录" + blh + "失败"); return;
                }
            }
            else
            {
                if (bljc.Rows[0]["F_brlb"].ToString().Trim() != "体检")
                {
                    log.WriteMyLog("非体检病人,不处理!");
                    return;
                }
                if (bljc.Rows[0]["F_brbh"].ToString().Trim() == "")
                {
                    log.WriteMyLog("无体检号,不处理!");
                    return;
                }

                if (bljc.Rows[0]["F_BGZT"].ToString().Trim() == "已写报告")
                {
                    string status        = "";
                    string ftps          = f.ReadString("ftp", "ftp", "").Replace("\0", "");
                    string ftpServerIP   = f.ReadString("ftp", "ftpip", "").Replace("\0", "");
                    string ftpUserID     = f.ReadString("ftp", "user", "ftpuser").Replace("\0", "");
                    string ftpPassword   = f.ReadString("ftp", "pwd", "ftp").Replace("\0", "");
                    string ftplocal      = f.ReadString("ftp", "ftplocal", "c:\\temp").Replace("\0", "");
                    string ftpRemotePath = f.ReadString("ftp", "bgjpgPath", "pathimages/bgjpg").Replace("\0", "");
                    string tjtxpath      = f.ReadString("savetohis", "tjtxpath", "bgjpg");
                    if (ftps == "1")
                    {
                        FtpWeb fw     = new FtpWeb(ftpServerIP, ftpRemotePath, ftpUserID, ftpPassword);
                        string ftpURI = "ftp://" + ftpServerIP + "/" + ftpRemotePath + "/";
                        try
                        {
                            //判断ftp上是否存在该jpg文件
                            if (fw.fileCheckExist(ftpURI, blh + "_1.jpg"))
                            {
                                //删除ftp上的jpg文件
                                fw.fileDelete(ftpURI, blh + "_1.jpg").ToString();
                            }
                            return;
                        }
                        catch
                        {
                            if (msg == "1")
                            {
                                MessageBox.Show("报告jpg文件删除异常");
                            }
                            return;
                        }
                    }
                    else
                    {
                        if (tjtxpath == "")
                        {
                            log.WriteMyLog("sz.ini txpath图像目录未设置");
                            return;
                        }
                        try
                        {
                            File.Delete(tjtxpath + "\\" + blh + "_1.jpg");
                        }
                        catch (Exception ee)
                        {
                            log.WriteMyLog("删除jpg文件异常!" + ee.ToString());
                            return;
                        }
                    }
                }
            }
        }
Example #6
0
        public void pathtohis(string blh, string debug)
        {
            debug = f.ReadString("savetohis", "debug", "");
            string connectionString = f.ReadString("savetohis", "odbcsql", "");

            string jcxx_fs   = f.ReadString("savetohis", "jcxx_fs", "0");
            string tj_constr = f.ReadString("savetohis", "tj_odbcsql", "Data Source=172.18.100.20;Initial Catalog=tj_db;User Id=sa;Password=sql;");
            string rtnmsg    = "";

            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 + "'", "bljc");

            if (bljc == null)
            {
                MessageBox.Show("病理数据库设置有问题!");
                log.WriteMyLog(blh + ",病理数据库设置有问题!");
                return;
            }
            if (bljc.Rows.Count < 1)
            {
                MessageBox.Show("病理号有错误!");
                log.WriteMyLog(blh + ",病理号有错误!");
                return;
            }

            sendDX(blh, bljc, debug);

            if (bljc.Rows[0]["F_brlb"].ToString().Trim() != "住院" && bljc.Rows[0]["F_brlb"].ToString().Trim() != "体检")
            {
                log.WriteMyLog(blh + ",非住院或体检病人,不处理!");
                return;
            }

            if (bljc.Rows[0]["F_brlb"].ToString().Trim() == "体检")
            {
                if (bljc.Rows[0]["F_SQXH"].ToString().Trim() == "")
                {
                    log.WriteMyLog(blh + ",无体检申请号,不处理!");
                    return;
                }

                if (bljc.Rows[0]["F_BGZT"].ToString().Trim() == "已审核")
                {
                    string cmdText = "update  tj_pacs_resulto_temp set res_char='" + bljc.Rows[0]["F_BLZD"].ToString().Trim() + "',res_date='" + bljc.Rows[0]["F_BGRQ"].ToString().Trim() + "',res_doctor='" + bljc.Rows[0]["F_BGYS"].ToString().Trim() + "',res_send_date='" + DateTime.Today.ToString("yyyy-MM-dd") + "',res_flag=2  where   res_no='" + bljc.Rows[0]["F_SQXH"].ToString().Trim() + "'";

                    int x = SQL_ExecuteNonQuery(tj_constr, cmdText, ref rtnmsg);
                    if (debug == "1" && rtnmsg.Trim() != "")
                    {
                        MessageBox.Show(rtnmsg);
                    }

                    if (x > 0)
                    {
                        aa.ExecuteSQL("update T_JCXX  set F_SCBJ='1' where F_BLH='" + blh.Trim() + "'");
                    }
                }
                else
                {
                    if (bljc.Rows[0]["F_SCBJ"].ToString().Trim() == "1")
                    {
                        string cmdText = "update  tj_pacs_resulto_temp set res_char='',res_date='',res_doctor='',res_send_date='" + DateTime.Today.ToString("yyyy-MM-dd") + "',res_flag=0  where   res_no='" + bljc.Rows[0]["F_SQXH"].ToString().Trim() + "'";

                        int x = SQL_ExecuteNonQuery(tj_constr, cmdText, ref rtnmsg);
                    }
                }
                return;
            }

            if (bljc.Rows[0]["F_BGZT"].ToString().Trim() == "已审核" && bljc.Rows[0]["F_brlb"].ToString().Trim() == "住院")
            {
                if (bljc.Rows[0]["F_ZYH"].ToString().Trim() == "")
                {
                    log.WriteMyLog(blh + ",无住院号,不处理!");
                    return;
                }
                string jpgname   = "";
                string ftpstatus = "";

                try
                {
                    mdjpg mdj = new mdjpg();

                    for (int x = 0; x < 3; x++)
                    {
                        if (!File.Exists("C:\\temp\\" + blh + "\\" + blh + "_1.jpg"))
                        {
                            mdj.BMPTOJPG(blh, ref jpgname, "", "");
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                catch (Exception ee)
                {
                    if (jcxx_fs == "1")
                    {
                        aa.ExecuteSQL("update T_jcxx_fs  set F_BZ='生成JPG异常:" + ee.Message + "' where F_BLH='" + blh.Trim() + "'");
                    }
                    if (debug == "1")
                    {
                        MessageBox.Show("生成JPG异常:" + ee.Message);
                    }
                    log.WriteMyLog(blh + ",生成JPG异常:" + ee.Message);
                }


                ///////////////////////////////////////////
                string imgPath = "C:\\temp\\" + blh + "\\" + blh + "_1.jpg";//图片文件所在路径
                Byte[] imgByte;
                if (!File.Exists("C:\\temp\\" + blh + "\\" + blh + "_1.jpg"))
                {
                    imgByte = new Byte[1];
                    if (jcxx_fs == "1")
                    {
                        aa.ExecuteSQL("update T_jcxx_fs  set F_BZ='" + "未找到文件" + "C:\\temp\\" + blh + "\\" + blh + "_1.jpg" + "' where F_BLH='" + blh.Trim() + "'");
                    }
                    if (debug == "1")
                    {
                        MessageBox.Show("未找到文件" + "C:\\temp\\" + blh + "\\" + blh + "_1.jpg");
                    }
                    log.WriteMyLog(blh + ",未找到文件" + "C:\\temp\\" + blh + "\\" + blh + "_1.jpg");
                }
                else
                {
                    try
                    {
                        FileStream file = new FileStream(imgPath, FileMode.Open, FileAccess.Read);
                        imgByte = new Byte[file.Length];       //把图片转成 Byte型 二进制流
                        file.Read(imgByte, 0, imgByte.Length); //把二进制流读入缓冲区
                        file.Close();
                    }
                    catch (Exception ee3)
                    {
                        imgByte = new Byte[1];
                        if (jcxx_fs == "1")
                        {
                            aa.ExecuteSQL("update T_jcxx_fs  set F_BZ='图片转数据流异常:" + ee3.Message + "' where F_BLH='" + blh.Trim() + "'");
                        }
                        if (debug == "1")
                        {
                            MessageBox.Show("图片转数据流异常:" + ee3.Message);
                        }
                        log.WriteMyLog("图片转数据流异常:" + ee3.Message);
                    }
                }


                try
                {
                    if (System.IO.Directory.Exists(@"c:\temp\" + blh))
                    {
                        System.IO.Directory.Delete(@"c:\temp\" + blh, true);
                    }
                }
                catch
                {
                    log.WriteMyLog(blh + ",删除临时目录" + blh + "失败"); return;
                }
                ///////////////////////////////////////////

                string CommandText = "delete from  t_itf_blreport where  zyh='" + bljc.Rows[0]["F_ZYH"].ToString().Trim() + "' and  yxh='" + bljc.Rows[0]["F_YXH"].ToString().Trim() + "'";
                SQL_ExecuteNonQuery(connectionString, CommandText, ref rtnmsg);

                //}
                //////////////////////////////////////////bljc.Rows[0]["F_SCBJ"].ToString().Trim()
                string yxh  = "病理图" + DateTime.Today.ToString("yyyyMMdd") + blh;
                string brlb = bljc.Rows[0]["F_brlb"].ToString().Trim();
                if (brlb == "门诊")
                {
                    brlb = "1";
                }
                else
                {
                    brlb = "2";
                }


                string cmdText = @"insert  into t_itf_blreport(yxh,jqxh,xb,xm,nl,zyh,ch,scks,scys,scsj,jcbw,jcmc,yxsj,yxjl,bgys,bgsj,bgtp,type_int,zycs)"
                                 + "values('" + yxh + "','病理图','" + bljc.Rows[0]["F_XB"].ToString().Trim() + "','" + bljc.Rows[0]["F_XM"].ToString().Trim() + "','" + bljc.Rows[0]["F_NL"].ToString().Trim()
                                 + "','" + bljc.Rows[0]["F_ZYH"].ToString().Trim() + "','" + bljc.Rows[0]["F_CH"].ToString().Trim() + "','" + bljc.Rows[0]["F_SJKS"].ToString().Trim()
                                 + "','" + bljc.Rows[0]["F_SJYS"].ToString().Trim() + "','" + bljc.Rows[0]["F_SDRQ"].ToString().Trim() + "','" + bljc.Rows[0]["F_BBMC"].ToString().Trim()
                                 + "','" + bljc.Rows[0]["F_BBMC"].ToString().Trim() + "','" + bljc.Rows[0]["F_RYSJ"].ToString().Trim() + "','" + bljc.Rows[0]["F_BLZD"].ToString().Trim()
                                 + "','" + bljc.Rows[0]["F_BGYS"].ToString().Trim() + "','" + bljc.Rows[0]["F_BGRQ"].ToString().Trim() + "',@p,'" + brlb + "','" + bljc.Rows[0]["F_YZID"].ToString().Trim() + "')";
                SqlConnection con    = con = new SqlConnection(connectionString);
                SqlCommand    sqlcom = null;
                try
                {
                    sqlcom             = new SqlCommand();
                    sqlcom.Connection  = con;
                    sqlcom.CommandText = cmdText;
                    con.Open();
                    sqlcom.Parameters.Add("@p", SqlDbType.Image, imgByte.Length);
                    sqlcom.Parameters["@p"].Value = imgByte;
                    int qw = sqlcom.ExecuteNonQuery();
                    sqlcom.Dispose();
                    con.Close();

                    aa.ExecuteSQL("update T_JCXX  set F_SCBJ='1',F_YXH='" + yxh + "' where F_BLH='" + blh.Trim() + "'");
                    if (jcxx_fs == "1")
                    {
                        aa.ExecuteSQL("update T_jcxx_fs  set F_FSZT='已处理' where F_BLH='" + blh.Trim() + "'");
                    }
                }
                catch (Exception ee)
                {
                    con.Close(); sqlcom.Dispose();
                    if (jcxx_fs == "1")
                    {
                        aa.ExecuteSQL("update T_jcxx_fs  set F_BZ='执行数据库异常:" + ee.Message + "' where F_BLH='" + blh.Trim() + "'");
                    }
                    if (debug == "1")
                    {
                        MessageBox.Show("执行数据库异常:" + ee.Message);
                    }
                    log.WriteMyLog(blh + ",执行数据库异常:" + ee.Message + "\r\n" + cmdText);
                    return;
                }
            }
            else
            {
                if (bljc.Rows[0]["F_SCBJ"].ToString().Trim() == "1")
                {
                    string CommandText = "delete from  t_itf_blreport where  zyh='" + bljc.Rows[0]["F_ZYH"].ToString().Trim() + "' and  yxh='" + bljc.Rows[0]["F_YXH"].ToString().Trim() + "'";
                    int    x           = SQL_ExecuteNonQuery(connectionString, CommandText, ref rtnmsg);
                    if (jcxx_fs == "1")
                    {
                        aa.ExecuteSQL("delete from T_jcxx_fs  where F_BLH='" + blh.Trim() + "'");
                    }
                }
            }
        }