예제 #1
0
        /// <summary>
        ///  dbbase.odbcdb aa = new odbcdb("DSN=pathnet-his2;UID=sys_sqsf;PWD=sqsfglxt", "", "");
        ///DataTable dzbl_jcjg = new DataTable();
        /// </summary>
        public void myzxyy_hx(string blh, string debug)
        {
            string usr = f.ReadString("myzxyy", "usr", "sys_sqsf");
            string pwd = f.ReadString("myzxyy", "pwd", "sqsfglxt");
            string CZY = f.ReadString("yh", "yhmc", "").Replace("\0", "").Trim();

            DataTable brxx = new DataTable();



            brxx = aa.GetDataTable("select * from T_JCXX where F_blh='" + blh + "'", "brxx");

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

            cn = new OdbcConnection("DSN=pathnet-his;UID=" + usr + ";PWD=" + pwd + "");
            try
            {
                string brbh    = brxx.Rows[0]["F_brbh"].ToString().Trim();
                string rysj    = brxx.Rows[0]["F_RYSJ"].ToString().Trim();
                string zyh     = brxx.Rows[0]["F_zyh"].ToString().Trim();
                string mzh     = brxx.Rows[0]["F_mzh"].ToString().Trim();
                string bgzt    = brxx.Rows[0]["F_BGZT"].ToString().Trim();
                string sqxh    = brxx.Rows[0]["F_SQXH"].ToString().Trim();
                string sdrq    = brxx.Rows[0]["F_SDRQ"].ToString().Trim();
                string bgys    = brxx.Rows[0]["F_BGYS"].ToString().Trim();
                string blzd    = brxx.Rows[0]["F_BlZD"].ToString().Trim();
                string deljcid = "select * from dzbl_jcjg where jcdh='" + blh + "'";

                string brlb = brxx.Rows[0]["F_BRLB"].ToString().Trim();

                if (brbh != "")
                {
                    DataTable dt = new DataTable();
                    try
                    {
                        cn.Open();
                        OdbcDataAdapter dap = new OdbcDataAdapter(deljcid, cn);
                        dap.Fill(dt);
                        dap.Dispose();
                        cn.Close();
                    }
                    catch (Exception ee1)
                    {
                        MessageBox.Show("执行数据库失败:" + ee1.Message);
                        return;
                    }

                    if (bgzt == "已审核")
                    {
                        if (sqxh != "")                          //申请序号不为空才回写标志
                        {
                            if (brxx.Rows[0]["F_HXBZ"].ToString() != "1")
                            {
                                upstatus(blh, brlb, sqxh, debug);
                            }
                        }

                        string shrq = brxx.Rows[0]["F_SPARE5"].ToString().Trim();
                        string shys = brxx.Rows[0]["F_shys"].ToString().Trim();
                        string blk  = brxx.Rows[0]["F_Blk"].ToString().Trim();

                        if (brlb == "住院" || brlb == "门诊")
                        {
                            string in_jcjg = "";
                            if (dt.Rows.Count > 0)
                            {
                                in_jcjg = "update  dzbl_jcjg  set jcid='" + sqxh + "',jcsj='" + rysj + "',jcjl='" + blzd + "',zdys='" + bgys + "',shys='" + shys + "',sblx='病理',jcrq='" + sdrq + "',bgrq='" + shrq + "',jbdm='',jbmc='',zyh='" + brbh + "',khid=''  where   jcdh='" + blh + "'";
                            }
                            else
                            {
                                in_jcjg = "insert into dzbl_jcjg(jcid,jcsj,jcjl,zdys,shys,sblx,jcrq,bgrq,jbdm,jbmc,zyh,khid,jcdh)values('" + sqxh + "','" + rysj + "','" + blzd + "','" + bgys + "','" + shys + "','病理','" + sdrq + "','" + shrq + "','','','" + brbh + "','','" + blh + "')";
                            }

                            try
                            {
                                OdbcCommand cmd2 = new OdbcCommand(in_jcjg, cn);
                                cn.Open();
                                int z = cmd2.ExecuteNonQuery();
                                cn.Close();
                                if (z > 0)
                                {
                                    log.WriteMyLog(blh + "写入HIS成功;");
                                    if (debug == "1")
                                    {
                                        log.WriteMyLog(blh + ",执行语句;" + in_jcjg);
                                    }
                                    ZgqClass.BGHJ(blh, CZY, "审核", "写入HIS成功", "ZGQJK", "");
                                }
                                else
                                {
                                    log.WriteMyLog(blh + "写入HIS失败;" + in_jcjg);
                                    ZgqClass.BGHJ(blh, CZY, "审核", "写入HIS失败", "ZGQJK", "");
                                }
                            }
                            catch (Exception ee1)
                            {
                                MessageBox.Show("执行数据库失败:" + ee1.Message);
                                return;
                            }
                        }
                        else
                        {
                            if (debug == "1")
                            {
                                log.WriteMyLog(blh + "非门诊或住院病人,不处理");
                            }
                            ZgqClass.BGHJ(blh, CZY, "审核", "非门诊或住院病人,不处理", "ZGQJK", "");
                            return;
                        }
                    }
                    else
                    {
                        if (sqxh != "")
                        {
                            if (brxx.Rows[0]["F_HXBZ"].ToString() != "1")
                            {
                                upstatus(blh, brlb, sqxh, debug);
                            }
                        }

                        //取消审核
                        if (bgzt == "已写报告")
                        {
                            string in_jcjg = "";
                            if (dt.Rows.Count > 0)
                            {
                                in_jcjg = "update  dzbl_jcjg  set jcsj='',jcjl='',zdys='',shys='',bgrq=''   where   jcdh='" + blh + "'";

                                try
                                {
                                    OdbcCommand cmd2 = new OdbcCommand(in_jcjg, cn);
                                    cn.Open();
                                    int z = cmd2.ExecuteNonQuery();
                                    cn.Close();
                                    if (z > 0)
                                    {
                                        log.WriteMyLog(blh + "取消审核更改HIS记录成功");

                                        ZgqClass.BGHJ(blh, CZY, "取消审核", "更改HIS记录成功", "ZGQJK", "");
                                    }
                                    else
                                    {
                                        log.WriteMyLog(blh + "取消审核更改HIS记录失败:" + in_jcjg);
                                        ZgqClass.BGHJ(blh, CZY, "取消审核", "更改HIS记录失败", "ZGQJK", "");
                                    }
                                }
                                catch (Exception ee1)
                                {
                                    MessageBox.Show("执行数据库失败:" + ee1.Message);
                                    log.WriteMyLog(blh + "取消审核执行数据库失败:" + ee1.Message + "\r\n" + in_jcjg);
                                    ZgqClass.BGHJ(blh, CZY, "取消审核", "更改HIS记录失败", "ZGQJK", "");
                                    return;
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (sqxh != "")
                    {
                        if (brxx.Rows[0]["F_HXBZ"].ToString() != "1")
                        {
                            upstatus(blh, brlb, sqxh, debug);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                cn.Close();
                ZgqClass.BGHJ(blh, CZY, "审核", "异常:" + e.Message.ToString(), "ZGQJK", "");
                MessageBox.Show(e.Message.ToString());
            }
        }
예제 #2
0
        public void pathtohis(string blh, string bglx, string bgxh, string msg, string debug, string dz)
        {
            //安全校验凭证,凭证既是接口的检验码,也是调用方的身份标识,由集成平台提供给LIS、PACS.

            bglx = bglx.ToLower();
            if (bglx == "")
            {
                bglx = "cg";
            }
            if (bgxh == "")
            {
                bgxh = "1";
            }

            string blbh = blh + bglx + bgxh;

            if (bglx == "cg")
            {
                blbh = blh;
            }


            try
            {
                string yhmc        = f.ReadString("yh", "yhmc", "").Replace("\0", "");
                string yhbh        = f.ReadString("yh", "yhbh", "").Replace("\0", "");
                string CAQZ        = f.ReadString("savetohis", "CAQZ", "1").Replace("\0", "");
                string certificate = "7pzOrESsiv8VnB6RD2FXmndLaJCYpiY7";
                debug = 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 + "'", "blxx");

                string logname = "PATHHISZGQJK";

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

                string    bgzt  = bljc.Rows[0]["F_BGZT"].ToString().Trim();
                DataTable dt_bc = new DataTable();
                if (bglx == "bc")
                {
                    try
                    {
                        dt_bc = aa.GetDataTable("select * from T_bcbg where F_blh='" + blh + "'  and F_bc_bgxh='" + bgxh + "'", "bc");
                        if (dt_bc.Rows.Count >= 0)
                        {
                            bgzt = dt_bc.Rows[0]["F_BC_BGZT"].ToString().Trim();
                        }
                    }
                    catch
                    {}
                }

                DataTable dt_bd = new DataTable();
                if (bglx == "bd")
                {
                    try
                    {
                        dt_bd = aa.GetDataTable("select * from T_bdbg where F_blh='" + blh + "'  and F_bd_bgxh='" + bgxh + "'", "bd");
                        if (dt_bc.Rows.Count >= 0)
                        {
                            bgzt = dt_bd.Rows[0]["F_BD_BGZT"].ToString().Trim();
                        }
                    }
                    catch
                    {}
                }
                if (dz == "qxsh")
                {
                    bgzt = "取消审核";
                }
                //CA
                if (bgzt == "已审核" && CAQZ == "1")
                {
                    XJCAClass xjca = new XJCAClass();
                    xjca.CaQZ(blh, bglx, bgxh, debug, bljc, yhmc, bgzt);
                }

                if (bljc.Rows[0]["F_sqxh"].ToString().Trim() == "" || bljc.Rows[0]["F_BY2"].ToString().Trim() == "")
                {
                    log.WriteMyLog("无申请序号或医嘱项目为空,不处理!", logname);
                    return;
                }


                if (bglx == "bd")
                {
                    return;
                }

                try
                {
                    aa.ExecuteSQL("update [pathnet].[dbo].T_SQD set F_SQDZT='已登记'  where  F_SQXH='" + bljc.Rows[0]["F_sqxh"].ToString().Trim() + "' ");
                }
                catch
                {
                }

                string ocr1        = "SC";
                string ocr5        = "IP";
                int    reAuditFlag = 0;//是否重复审核
                if (bgzt == "已登记")
                {
                    ocr1 = "SC"; ocr5 = "IP";
                }
                if (bgzt == "已取材")
                {
                    ocr1 = "SC"; ocr5 = "A";
                }

                if (bgzt == "已写报告")
                {
                    ocr1 = "SC"; ocr5 = "RC";
                }
                if (bgzt == "已审核")
                {
                    ocr1 = "SC"; ocr5 = "CM";
                }
                if (bgzt == "取消审核")
                {
                    ocr1 = "OC"; ocr5 = "CM";
                }


                int F_CFSH = 0;

                try
                {
                    F_CFSH = int.Parse(bljc.Rows[0]["F_CFSH"].ToString().Trim());
                }
                catch
                {
                }

                if (bgzt == "已审核")
                {
                    if (F_CFSH >= 1)
                    {
                        reAuditFlag = 1;
                    }
                }


                if (bglx == "bc" && bgzt == "已审核")
                {
                    reAuditFlag = 1;
                    ocr1        = "SC"; ocr5 = "CM";
                }



                string brlb = bljc.Rows[0]["F_brlb"].ToString().Trim();

                if (brlb == "住院")
                {
                    brlb = "I";
                }
                else
                {
                    brlb = "O";
                }

                string xb = bljc.Rows[0]["F_XB"].ToString().Trim();
                if (xb == "女")
                {
                    xb = "F";
                }
                else if (xb.Trim() == "M男")
                {
                    xb = "M";
                }
                else
                {
                    xb = "";
                }

                string ZYH = bljc.Rows[0]["F_ZYH"].ToString().Trim();
                if (brlb != "住院")
                {
                    ZYH = bljc.Rows[0]["F_MZH"].ToString().Trim();
                }

                if (brlb == "住院")
                {
                    brlb = "I";
                }
                else if (brlb == "急诊")
                {
                    brlb = "E";
                }
                else if (brlb == "体检")
                {
                    brlb = "P";
                }
                else
                {
                    brlb = "O";
                }



                string Status_Hl7 = "MSH|^~\\&|P05||Z01||" + DateTime.Now.ToString("yyyyMMddHHmmss") + "||ORM^O01|" + DateTime.Now.ToString("yyyyMMddHHmmss") + "|P|2.7" + "\r"
                                    + "PID|||" + bljc.Rows[0]["F_BRBH"].ToString().Trim() + "^" + ZYH + "||" + bljc.Rows[0]["F_XM"].ToString().Trim() + "|||" + xb + "|||||||||\r"
                                    + "PV1||" + brlb + "|" + bljc.Rows[0]["F_BQ"].ToString().Trim() + "^^" + bljc.Rows[0]["F_CH"].ToString().Trim() + "||||||||||||||||" + ZYH + "\r"
                                    + "ORC|" + ocr1 + "|" + bljc.Rows[0]["F_SQXH"].ToString().Trim() + "|" + blh + "||" + ocr5 + "|||||" + yhbh + "^" + yhmc + "||||||0\r"
                                    + "BLG||||05^^^" + bljc.Rows[0]["F_YZXM"].ToString().Trim().Replace("^^", "^") + "\r";

                try
                {
                    XJZLYYWEB.WSInterface xjzl = new XJZLYYWEB.WSInterface();
                    //string webServicesURL = f.ReadString("savetohis", "WSURL", "");
                    //if (webServicesURL.Trim() != "")
                    //    xjzl.Url = webServicesURL;

                    if (debug == "1")
                    {
                        log.WriteMyLog("状态消息:" + Status_Hl7, logname);
                    }
                    string ztstr = xjzl.CallInterface("SendMessageByHL7", Status_Hl7, yhmc, certificate);
                    if (debug == "1")
                    {
                        log.WriteMyLog("状态返回:" + ztstr, logname);
                    }
                    if (!ztstr.Contains("AA"))
                    {
                        log.WriteMyLog("回传报告状态失败!原因:" + ztstr, logname);
                    }
                    else
                    {
                        if (debug == "1")
                        {
                            log.WriteMyLog("回传报告状态成功", logname);
                        }
                    }
                }
                catch (Exception e2)
                {
                    log.WriteMyLog("回写报告状态异常:" + e2.Message, logname);
                    ZgqClass.BGHJ(blh, yhmc, "ZGQJK", "[" + bgzt + "]回写状态异常:" + e2.Message, "ZGQJK", "ZGQJK");
                }

                try
                {
                    if (bgzt == "已审核")
                    {
                        aa.ExecuteSQL("update T_JCXX set F_CFSH=F_CFSH+1 where F_BLH='" + blh + "'");
                    }
                }
                catch
                {
                }

                return;
            }
            catch
            {
            }
        }
예제 #3
0
        public void pathtohis(string blh, string bglx, string bgxh, string debug, string dz, string msg)
        {
            if (bglx == "")
            {
                bglx = "cg";
            }
            if (bgxh == "")
            {
                bgxh = "0";
            }

            debug = f.ReadString("savetohis", "debug", "").Replace("\0", "").Trim();
            string tjtxpath = f.ReadString("savetohis", "toPDFPath", @"\\192.0.19.147\GMS");

            bglx = bglx.ToLower();



            dbbase.odbcdb aa   = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");
            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("病理数据库设置有问题!");
                return;
            }
            if (jcxx.Rows.Count < 1)
            {
                MessageBox.Show("病理号有错误!");
                return;
            }



            string jpgname = "";
            string jpgpath = "";
            string ispdf   = f.ReadString("savetohis", "ispdf", "1").Replace("\0", "").Trim();

            if (ispdf == "1")
            {
                string bgzt2 = "";
                try
                {
                    if (bglx.ToLower().Trim() == "bd")
                    {
                        DataTable dt_bd = aa.GetDataTable("select * from T_BDBG where F_BLH='" + blh + "' and  F_BD_BGXH='" + bgxh + "'", "bd");
                        bgzt2 = dt_bd.Rows[0]["F_BD_BGZT"].ToString();
                    }
                    if (bglx.ToLower().Trim() == "bc")
                    {
                        DataTable dt_bc = aa.GetDataTable("select * from T_BCBG where F_BLH='" + blh + "' and  F_BC_BGXH='" + bgxh + "'", "bc");
                        bgzt2 = dt_bc.Rows[0]["F_BC_BGZT"].ToString();
                    }
                    if (bglx.ToLower().Trim() == "cg")
                    {
                        bgzt2 = jcxx.Rows[0]["F_BGZT"].ToString();
                    }
                }
                catch
                {
                }

                if (bgzt2.Trim() == "")
                {
                    log.WriteMyLog("报告状态为空!不处理!" + blh + "^" + bglx + "^" + bgxh);
                }

                if (bgzt2.Trim() == "已审核" && dz != "qxsh")
                {
                    string ML      = DateTime.Parse(jcxx.Rows[0]["F_SDRQ"].ToString()).ToString("yyyyMM");
                    string err_msg = "";

                    //生成pdf
                    bool isrtn = MD_PDF_JPG(blh, bglx, bgxh, ML, ZgqPDFJPG.Type.PDF, ref err_msg, ref jpgname, ref jpgpath);
                    if (isrtn)
                    {
                        jpgname = jpgname.Substring(jpgname.LastIndexOf('\\') + 1);
                        ZgqClass.BGHJ(blh, "his接口", "报告审核", "生成pdf成功:" + jpgpath + "\\" + jpgname, "ZGQJK", "pdf");

                        aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");
                        aa.ExecuteSQL("insert  into T_BG_PDF(F_BLH,F_BGLX,F_BGXH,F_ML,F_FILENAME) values('" + blh + "','" + bglx + "','" + bgxh + "','" + jpgpath + "','" + jpgname + "')");
                    }
                    else
                    {
                        log.WriteMyLog(blh + "-" + err_msg);
                        ZgqClass.BGHJ(blh, "his接口", "审核PDF", "生成pdf失败" + err_msg, "ZGQJK", "pdf");

                        if (msg == "1")
                        {
                            MessageBox.Show("病理号:" + blh + "  生成pdf失败,请重新审核!\r\n" + err_msg);
                        }
                        return;
                    }
                }
                if (dz == "qxsh")
                {
                    DataTable dt2 = aa.GetDataTable("select top 1 * from T_BG_PDF where F_blh='" + blh + "'  and F_BGXH='" + bgxh + "' and F_BGLX='" + bglx + "'", "dt2");
                    if (dt2.Rows.Count > 0)
                    {
                        aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");

                        ZgqPDFJPG zgq     = new ZgqPDFJPG();
                        string    rtn_msg = "";
                        zgq.DelPDFFile(dt2.Rows[0]["F_ML"].ToString(), dt2.Rows[0]["F_FILENAME"].ToString(), ref rtn_msg);
                    }
                }



                return;
            }
        }
예제 #4
0
        public void pdfjpg(string blh, string bglx, string bgxh, string czlb, string dz, string msg, string debug, string yymc)
        {
            bglx = bglx.ToLower();
            if (bglx == "")
            {
                bglx = "cg";
            }

            if (bgxh == "")
            {
                bgxh = "1";
            }

            string blbh = blh + bglx + bgxh;

            if (bglx == "cg")
            {
                blbh = blh;
            }


            dbbase.odbcdb aa   = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");
            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("病理数据库设置有问题!");
                return;
            }
            if (jcxx.Rows.Count < 1)
            {
                MessageBox.Show("病理号有错误!");
                return;
            }

            if (bglx.Trim() == "")
            {
                log.WriteMyLog("报告类型为空,不处理!" + blh + "^" + bglx + "^" + bgxh);
                return;
            }
            if (dz == "qxsh" || dz == "取消审核")
            {
                //取消审核动作
                aa.ExecuteSQL("delete T_BG_PDF  where F_BLbH='" + blbh + "'");
            }


            string bgzt = jcxx.Rows[0]["F_BGZT"].ToString();

            try
            {
                if (bglx.ToLower().Trim() == "bd")
                {
                    DataTable dt_bd = aa.GetDataTable("select * from T_BDBG where F_BLH='" + blh + "' and  F_BD_BGXH='" + bgxh + "'", "bd");
                    bgzt = dt_bd.Rows[0]["F_BD_BGZT"].ToString();
                    //    jpgname=blh+bglx+bgxh+"_"+dt_bd.Rows[0]["F_BD_BGRQ"].ToString();
                }
                if (bglx.ToLower().Trim() == "bc")
                {
                    DataTable dt_bc = aa.GetDataTable("select * from T_BCBG where F_BLH='" + blh + "' and  F_BC_BGXH='" + bgxh + "'", "bc");
                    bgzt = dt_bc.Rows[0]["F_BC_BGZT"].ToString();
                    //     jpgname=blh+bglx+bgxh+"_"+dt_bc.Rows[0]["F_BC_SPARE5"].ToString();
                }
                if (bglx.ToLower().Trim() == "cg")
                {
                    bgzt = jcxx.Rows[0]["F_BGZT"].ToString();
                    //     jpgname=blh+bglx+bgxh+"_"+jcxx.Rows[0]["F_SPARE5"].ToString();
                }
            }
            catch (Exception e5)
            {
                log.WriteMyLog("报告状态为空!不处理!" + blh + "^" + bglx + "^" + bgxh + e5.Message);
            }

            if (bgzt != "已审核")
            {
                return;
            }

            string type = f.ReadString("savetohis", "type", "pdf").Trim().ToLower();



            ////生成pdf或jpg
            string    jpgname = "";                                                                   //生成pdf或jpg文件名
            string    ML      = DateTime.Parse(jcxx.Rows[0]["F_SDRQ"].ToString()).ToString("yyyyMM"); //ftp 上目录,可为空
            ZgqPDFJPG zgq     = new ZgqPDFJPG();
            string    message = "";
            // string pdfpath = "";
            // if (zgq.CreatePDF(blh, bglx, bgxh, ref jpgname, "", "", ZgqPDFJPG.Type.PDF, ref message))
            // {
            //     log.WriteMyLog("[" + blh + "]生成PDF成功");
            //     //生成pdf成功上传pdf到病理服务器
            //     if (zgq.UpPDF(blh, jpgname, ML, ref message, 3, ref pdfpath))
            //     {
            //         log.WriteMyLog("[" + blh + "]上传PDF成功:" + pdfpath);
            //         jpgname = pdfpath.Substring(pdfpath.LastIndexOf('\\') + 1);
            //         aa.ExecuteSQL("delete T_BG_PDF  where F_BLBH='" + blbh + "'");
            //         aa.ExecuteSQL("insert  into T_BG_PDF(F_BLBH,F_BLH,F_BGLX,F_BGXH,F_ML,F_FILENAME,f_pdfpath) values('" + blbh + "','" + blh + "','" + bglx + "','" + bgxh + "','" + ML + "\\" + blh + "','" + jpgname + "','" + pdfpath + "')");
            //     }
            //     else
            //         log.WriteMyLog("[" + blh + "]上传PDF失败:" + message);
            // }
            // else
            // {
            //     log.WriteMyLog("["+blh+"]生成PDF失败:" + message);
            //     ZgqClass.BGHJ(blh, "生成PDF失败", "审核", "生成pdf失败" + message, "ZGQJK", "生成PDF");
            // }



            bool isrtn = false;

            if (yymc.Trim() == "pdf")
            {
                isrtn = zgq.CreatePDF(blh, bglx, bgxh, ZgqPDFJPG.Type.PDF, ref jpgname, "", "", ref message);
            }
            else
            {
                isrtn = zgq.CreatePDF(blh, bglx, bgxh, ZgqPDFJPG.Type.PDF, ref jpgname, "", "", ref message);
            }

            if (!isrtn)
            {
                log.WriteMyLog("生成PDF失败" + message);
                ZgqClass.BGHJ(blh, "生成PDF失败", "审核", "生成pdf失败" + message, "ZGQJK", "生成PDF");
            }
            else
            {
                if (debug == "1")
                {
                    log.WriteMyLog("生成PDF成功");
                }

                ////二进制串
                if (File.Exists(jpgname))
                {
                    //上传
                    string pdfpath = "";
                    bool   ssa     = zgq.UpPDF(blh, jpgname, ML, ref message, 3, ref pdfpath);

                    if (ssa == true)
                    {
                        if (debug == "1")
                        {
                            log.WriteMyLog("上传PDF成功");
                        }

                        jpgname = pdfpath.Substring(pdfpath.LastIndexOf('\\') + 1);
                        ZgqClass.BGHJ(blh, "上传PDF成功", "审核", "上传PDF成功:" + pdfpath, "ZGQJK", "上传PDF");
                        aa.ExecuteSQL("delete T_BG_PDF  where F_BLBH='" + blbh + "'");
                        aa.ExecuteSQL("insert  into T_BG_PDF(F_BLBH,F_BLH,F_BGLX,F_BGXH,F_ML,F_FILENAME,f_pdfpath) values('" + blbh + "','" + blh + "','" + bglx + "','" + bgxh + "','" + ML + "\\" + blh + "','" + jpgname + "','" + pdfpath + "')");
                    }
                    else
                    {
                        log.WriteMyLog("上传PDF失败" + message);
                        ZgqClass.BGHJ(blh, "上传PDF失败", "审核", message, "ZGQJK", "上传PDF");
                    }
                }
                else
                {
                    log.WriteMyLog("未找到PDF文件" + jpgname);
                    ZgqClass.BGHJ(blh, "生成PDF失败", "审核", "未找到文件" + jpgname, "ZGQJK", "生成PDF");
                }
            }
            zgq.DelTempFile(blh);


            return;
        }
예제 #5
0
      private void scpdf(string blh, string bglx, string bgxh, string bgzt2, string ML)
      {
          try
          {
              dbbase.odbcdb aa = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");
              if (bgzt2.Trim() == "")
              {
                  log.WriteMyLog("报告状态为空!不处理!" + blh + "^" + bglx + "^" + bgxh);
              }

              if (bgzt2.Trim() == "已审核")
              {
                  //string ML = "";
                  string    message = ""; string jpgname = "";
                  ZgqPDFJPG zgq   = new ZgqPDFJPG();
                  bool      isrtn = zgq.CreatePDF(blh, bglx, bgxh, ZgqPDFJPG.Type.PDF, ref jpgname, "", ref message);

                  string xy = "3";// ZgqClass.GetSz("ZGQJK", "sctxfs", "3");
                  if (isrtn)
                  {
                      bool ssa = zgq.UpPDF(blh, jpgname, ML, ref message, int.Parse(xy));
                      if (ssa == true)
                      {
                          jpgname = jpgname.Substring(jpgname.LastIndexOf('\\') + 1);
                          ZgqClass.BGHJ(blh, "批量上传", "审核", "生成PDF成功:" + ML + "\\" + jpgname, "ZGQJK", "生成PDF");

                          aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");
                          aa.ExecuteSQL("insert  into T_BG_PDF(F_BLH,F_BGLX,F_BGXH,F_ML,F_FILENAME) values('" + blh + "','" + bglx + "','" + bgxh + "','" + ML + "','" + jpgname + "')");
                          aa.ExecuteSQL("update T_JCXX_FS set F_bz='生成PDF成功',F_FSZT='已处理'  where F_blh='" + blh + "' and F_BGLX='" + bglx.ToLower() + "' and F_BGXH='" + bgxh + "'");
                      }
                      else
                      {
                          log.WriteMyLog(message);
                          ZgqClass.BGHJ(blh, "批量上传", "审核", message, "ZGQJK", "生成PDF");
                          aa.ExecuteSQL("update T_JCXX_FS set F_ISJPG='false',F_bz='" + message + "'  where F_blh='" + blh + "' and F_BGLX='" + bglx + "' and F_BGXH='" + bgxh + "'");
                      }
                      zgq.DelTempFile(blh);
                  }
                  else
                  {
                      aa.ExecuteSQL("update T_JCXX_FS set F_ISJPG='false',F_BZ='" + message + "'  where F_blh='" + blh + "' and F_BGLX='" + bglx + "' and F_BGXH='" + bgxh + "'");
                  }
                  return;
              }
              else
              {
                  if (bgzt2 == "取消审核")
                  {
                      DataTable dt2 = aa.GetDataTable("select top 1 * from T_BG_PDF where F_blh='" + blh + "'  and F_BGXH='" + bgxh + "' and F_BGLX='" + bglx + "'", "dt2");
                      if (dt2.Rows.Count <= 0)
                      {
                          aa.ExecuteSQL("update T_jcxx_fs set  F_fszt='已处理',F_bz='取消审核,删除PDF成功!' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "'  and F_fszt='未处理' and F_bgzt='" + bgzt2 + "'");
                      }
                      else
                      {
                          aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");
                          ZgqPDFJPG zgq     = new ZgqPDFJPG();
                          string    rtn_msg = "";
                          zgq.DelPDFFile(dt2.Rows[0]["F_ml"].ToString(), dt2.Rows[0]["F_FILENAME"].ToString(), ref rtn_msg);
                          aa.ExecuteSQL("update T_JCXX_FS set F_bz='取消审核,删除PDF成功!',F_JPG_errmsg='',F_FSZT='已处理'  where F_blh='" + blh + "' and F_BGLX='" + bglx.ToLower() + "' and F_BGXH='" + bgxh + "'");
                      }
                      return;
                  }
              }
              return;
          }
          catch
          {
          }
      }
예제 #6
0
        public void pathtohis(string blh, string debug)
        {
            debug = f.ReadString("savetohis", "debug", "");
            string odbcsql = f.ReadString("savetohis", "odbcsql", "Data Source=.;Initial Catalog=pathnet;User Id=pathnet;Password=4s3c2a1p; ");
            string err_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 + "'", "bljc");

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

            if (bljc.Rows[0]["F_SQXH"].ToString().Trim() == "")
            {
                log.WriteMyLog("申请序号为空不处理!");
                ZgqClass.BGHJ(blh, "HIS接口", "审核", "申请序号为空不处理", "ZGQJK", "HIS接口");
                return;
            }

            if (bljc.Rows[0]["F_BGZT"].ToString().Trim() == "已登记" || bljc.Rows[0]["F_BGZT"].ToString().Trim() == "已取材" || bljc.Rows[0]["F_BGZT"].ToString().Trim() == "已写报告")
            {
                if (bljc.Rows[0]["F_HXBJ"].ToString().Trim() == "1")
                {
                    return;
                }

                //if (bljc.Rows[0]["F_HXBJ"].ToString().Trim() != "2")
                //    return;

                SqlDB db = new SqlDB();
                try
                {
                    SqlParameter[] oledbPt = new SqlParameter[2];

                    for (int j = 0; j < oledbPt.Length; j++)
                    {
                        oledbPt[j] = new SqlParameter();
                    }
                    oledbPt[0].ParameterName = "OrderID";
                    oledbPt[0].SqlDbType     = SqlDbType.VarChar;
                    oledbPt[0].Direction     = ParameterDirection.Input;
                    oledbPt[0].Size          = 32;
                    oledbPt[0].Value         = bljc.Rows[0]["F_SQXH"].ToString().Trim();

                    oledbPt[1].ParameterName = "OrderStatus";//
                    oledbPt[1].SqlDbType     = SqlDbType.Int;
                    oledbPt[1].Direction     = ParameterDirection.Input;
                    oledbPt[1].Value         = 1;


                    int x = db.ExecuteNonQuery(odbcsql, "SP_SyncOrderStatusToHIS", ref oledbPt, CommandType.StoredProcedure, ref err_msg);

                    if (x < 0)
                    {
                        log.WriteMyLog("执行回写标记异常:" + err_msg);
                        ZgqClass.BGHJ(blh, "HIS接口", "保存", "执行回写标记异常:" + err_msg, "ZGQJK", "HIS接口");
                    }
                    else
                    {
                        ZgqClass.BGHJ(blh, "HIS接口", "保存", "执行回写标记正常", "ZGQJK", "HIS接口");
                        aa.ExecuteSQL("update  T_JCXX  set  F_HXBJ='1' where F_BLH='" + bljc.Rows[0]["F_BLH"].ToString().Trim() + "'");
                    }
                    return;
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message); return;
                }
            }
            else
            if (bljc.Rows[0]["F_BGZT"].ToString().Trim() == "已审核")
            {
                SqlDB db = new SqlDB();


                try
                {
                    SqlParameter[] oledbPt = new SqlParameter[2];

                    for (int j = 0; j < oledbPt.Length; j++)
                    {
                        oledbPt[j] = new SqlParameter();
                    }
                    oledbPt[0].ParameterName = "OrderID";
                    oledbPt[0].SqlDbType     = SqlDbType.VarChar;
                    oledbPt[0].Direction     = ParameterDirection.Input;
                    oledbPt[0].Size          = 32;
                    oledbPt[0].Value         = bljc.Rows[0]["F_SQXH"].ToString().Trim();

                    oledbPt[1].ParameterName = "OrderStatus";    //
                    oledbPt[1].SqlDbType     = SqlDbType.Int;
                    oledbPt[1].Direction     = ParameterDirection.Input;
                    oledbPt[1].Value         = 2;

                    int x = db.ExecuteNonQuery(odbcsql, "SP_SyncOrderStatusToHIS", ref oledbPt, CommandType.StoredProcedure, ref err_msg);

                    if (x < 0)
                    {
                        log.WriteMyLog("执行回写审核标记异常:" + err_msg);
                        ZgqClass.BGHJ(blh, "HIS接口", "审核", "执行回写审核标记异常:" + err_msg, "ZGQJK", "HIS接口");
                    }
                    else
                    {
                        ZgqClass.BGHJ(blh, "HIS接口", "审核", "执行回写审核标记正常", "ZGQJK", "HIS接口");
                    }
                }
                catch (Exception e)
                {
                    log.WriteMyLog(e.Message);
                    return;
                }
                //回写报告
                try
                {
                    SqlParameter[] oledbPt = new SqlParameter[6];

                    for (int j = 0; j < oledbPt.Length; j++)
                    {
                        oledbPt[j] = new SqlParameter();
                    }
                    oledbPt[0].ParameterName = "OrderID";
                    oledbPt[0].SqlDbType     = SqlDbType.VarChar;
                    oledbPt[0].Direction     = ParameterDirection.Input;
                    oledbPt[0].Size          = 32;
                    oledbPt[0].Value         = bljc.Rows[0]["F_SQXH"].ToString().Trim();

                    oledbPt[1].ParameterName = "ReportGuid";
                    oledbPt[1].SqlDbType     = SqlDbType.VarChar;
                    oledbPt[1].Direction     = ParameterDirection.Input;
                    oledbPt[1].Size          = 128;
                    oledbPt[1].Value         = bljc.Rows[0]["F_BLH"].ToString().Trim();

                    oledbPt[2].ParameterName = "WYSText";
                    oledbPt[2].SqlDbType     = SqlDbType.VarChar;
                    oledbPt[2].Direction     = ParameterDirection.Input;
                    oledbPt[2].Size          = 4000;
                    oledbPt[2].Value         = bljc.Rows[0]["F_RYSJ"].ToString().Trim() + "\r\n" + bljc.Rows[0]["F_JXSJ"].ToString().Trim();

                    oledbPt[3].ParameterName = "WYGText";
                    oledbPt[3].SqlDbType     = SqlDbType.VarChar;
                    oledbPt[3].Direction     = ParameterDirection.Input;
                    oledbPt[3].Size          = 4000;
                    oledbPt[3].Value         = bljc.Rows[0]["F_blzd"].ToString().Trim() + "\r\n" + bljc.Rows[0]["F_tsjc"].ToString().Trim();

                    oledbPt[4].ParameterName = "PatientID";
                    oledbPt[4].SqlDbType     = SqlDbType.VarChar;
                    oledbPt[4].Direction     = ParameterDirection.Input;
                    oledbPt[4].Size          = 50;
                    oledbPt[4].Value         = bljc.Rows[0]["F_BRBH"].ToString().Trim();

                    oledbPt[5].ParameterName = "CheckedDate";
                    oledbPt[5].SqlDbType     = SqlDbType.VarChar;
                    oledbPt[5].Direction     = ParameterDirection.Input;
                    oledbPt[5].Size          = 50;
                    oledbPt[5].Value         = bljc.Rows[0]["F_SPARE5"].ToString().Trim();

                    int x = db.ExecuteNonQuery(odbcsql, "SP_SyncApprovedReportToHIS", ref oledbPt, CommandType.StoredProcedure, ref err_msg);

                    if (x < 0)
                    {
                        log.WriteMyLog("执行回写审核报告异常:" + err_msg);
                        ZgqClass.BGHJ(blh, "HIS接口", "审核", "执行回写审核报告异常:" + err_msg, "ZGQJK", "HIS接口");
                    }
                    else
                    {
                        ZgqClass.BGHJ(blh, "HIS接口", "审核", "执行回写审核报告正常", "ZGQJK", "HIS接口");
                        aa.ExecuteSQL("update  T_JCXX  set  F_HXBJ='2' where F_BLH='" + bljc.Rows[0]["F_BLH"].ToString().Trim() + "'");
                    }
                    return;
                }
                catch (Exception e)
                {
                    log.WriteMyLog(e.Message); return;
                }
            }
        }
예제 #7
0
        public void tjhx(string blh, DataTable dt_jcxx, string debug)
        {
            string tjodbc = f.ReadString("savetohis", "tjodbc", "DSN=pathnet-tj;UID=interfacepat;PWD=INTERFACEPAT");

            dbbase.odbcdb aa = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");



            string brlb = "";
            string ztbz = "";
            string sqxh = dt_jcxx.Rows[0]["f_sqxh"].ToString().Trim();

            if (dt_jcxx.Rows[0]["F_brlb"].ToString().Trim() != "体检" || dt_jcxx.Rows[0]["F_brbh"].ToString().Trim() == "")
            {
                return;
            }
            try
            {
                if (dt_jcxx.Rows[0]["F_BGZT"].ToString().Trim() == "已审核")
                {
                    DataTable TJ_bljc = new DataTable();
                    TJ_bljc = aa.GetDataTable(" select *  from T_TBS_BG where  F_blh='" + blh + "'", "blxx");
                    OdbcParameter[] mzORAPAR = new OdbcParameter[11];
                    for (int j = 0; j < mzORAPAR.Length; j++)
                    {
                        mzORAPAR[j] = new OdbcParameter();
                    }
                    mzORAPAR[0].ParameterName = "Sequenceno";
                    mzORAPAR[0].OdbcType      = OdbcType.VarChar;
                    mzORAPAR[0].Direction     = ParameterDirection.Input;
                    mzORAPAR[0].Size          = 50;

                    mzORAPAR[1].ParameterName = "CheckDescription";    //
                    mzORAPAR[1].OdbcType      = OdbcType.VarChar;
                    mzORAPAR[1].Direction     = ParameterDirection.Input;
                    mzORAPAR[1].Size          = 1000;

                    mzORAPAR[2].ParameterName = "CheckConclusion";    //
                    mzORAPAR[2].OdbcType      = OdbcType.VarChar;
                    mzORAPAR[2].Direction     = ParameterDirection.Input;
                    mzORAPAR[2].Size          = 1000;

                    mzORAPAR[3].ParameterName = "Checkdoccode";    //
                    mzORAPAR[3].OdbcType      = OdbcType.VarChar;
                    mzORAPAR[3].Direction     = ParameterDirection.Input;
                    mzORAPAR[3].Size          = 200;

                    mzORAPAR[4].ParameterName = "Checkdocname";    //
                    mzORAPAR[4].OdbcType      = OdbcType.VarChar;
                    mzORAPAR[4].Direction     = ParameterDirection.Input;
                    mzORAPAR[4].Size          = 200;

                    mzORAPAR[5].ParameterName = "Checkdate";    //
                    mzORAPAR[5].OdbcType      = OdbcType.Date;
                    mzORAPAR[5].Direction     = ParameterDirection.Input;

                    mzORAPAR[6].ParameterName = "Picture_Qty";    //
                    mzORAPAR[6].OdbcType      = OdbcType.Int;
                    mzORAPAR[6].Direction     = ParameterDirection.Output;

                    mzORAPAR[7].ParameterName = "Err_code";    //
                    mzORAPAR[7].OdbcType      = OdbcType.Int;
                    mzORAPAR[7].Direction     = ParameterDirection.Output;

                    mzORAPAR[8].ParameterName = "Err_text";    //
                    mzORAPAR[8].OdbcType      = OdbcType.VarChar;
                    mzORAPAR[8].Direction     = ParameterDirection.Output;
                    mzORAPAR[8].Size          = 200;

                    mzORAPAR[9].ParameterName = "AuditOpercode";    //
                    mzORAPAR[9].OdbcType      = OdbcType.VarChar;
                    mzORAPAR[9].Direction     = ParameterDirection.Input;
                    mzORAPAR[9].Size          = 200;

                    mzORAPAR[10].ParameterName = "AuditOpername";    //
                    mzORAPAR[10].OdbcType      = OdbcType.VarChar;
                    mzORAPAR[10].Direction     = ParameterDirection.Input;
                    mzORAPAR[10].Size          = 200;
                    //////////////////////////////////////////////////////

                    string tj_blzd = dt_jcxx.Rows[0]["F_blzd"].ToString().Trim();
                    string tj_jcsj = "";


                    if (dt_jcxx.Rows[0]["F_xb"].ToString().Trim() != "男")
                    {
                        string mcyj = dt_jcxx.Rows[0]["F_mcyj"].ToString().Trim();
                        string sfjj = dt_jcxx.Rows[0]["F_sfjj"].ToString().Trim();

                        if (mcyj.Trim() != "")
                        {
                            tj_jcsj = tj_jcsj + "末次月经:" + mcyj + "\n";
                        }
                        if (sfjj.Trim() != "")
                        {
                            tj_jcsj = tj_jcsj + "是否绝经:" + sfjj + "\n";
                        }
                    }

                    tj_jcsj = tj_jcsj + dt_jcxx.Rows[0]["F_rysj"].ToString().Trim();

                    if (TJ_bljc.Rows.Count > 0)
                    {
                        if (dt_jcxx.Rows[0]["F_blk"].ToString().Trim() == "TCT国产")
                        {
                            tj_jcsj = 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() + "\n";
                            if (TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() != "")
                            {
                                tj_blzd = tj_blzd + "补充意见1:" + TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() + "\n";
                            }
                            if (TJ_bljc.Rows[0]["F_TBS_BCYJ2"].ToString().Trim() != "")
                            {
                                tj_blzd = tj_blzd + "补充意见2:" + TJ_bljc.Rows[0]["F_TBS_BCYJ2"].ToString().Trim() + "\n";
                            }
                        }
                    }
                    if (debug == "1")
                    {
                        log.WriteMyLog(tj_jcsj);
                        log.WriteMyLog(tj_blzd);
                    }
                    /////////////////////////////////////////////////////
                    mzORAPAR[0].Value  = dt_jcxx.Rows[0]["f_sqxh"].ToString().Trim();                 //体检申请单号
                    mzORAPAR[1].Value  = tj_jcsj.Trim();                                              //检查所见
                    mzORAPAR[2].Value  = tj_blzd.Trim();                                              // 检查所得
                    mzORAPAR[3].Value  = "";                                                          //检查医生工号
                    mzORAPAR[4].Value  = dt_jcxx.Rows[0]["f_bgys"].ToString().Trim();                 // 检查医生姓名
                    mzORAPAR[5].Value  = DateTime.Parse(dt_jcxx.Rows[0]["f_bgrq"].ToString().Trim()); //检查时间
                    mzORAPAR[9].Value  = "";                                                          // 审核医生工号
                    mzORAPAR[10].Value = dt_jcxx.Rows[0]["f_shys"].ToString().Trim();                 // 审核医生姓名
                    ////////////////////////////////////////////////////
                    OdbcDB db     = new OdbcDB();
                    string errMsg = "";
                    try
                    {
                        int x = db.ExecuteNonQuery(tjodbc, "{ CALL hthis.PROC_PEIS_GETBLRESULTINFO(?,?,?,?,?,?,?,?,?,?,?)}", ref mzORAPAR, CommandType.StoredProcedure, ref errMsg);


                        if (mzORAPAR[8].Value.ToString().Trim() == "")
                        {
                            if (debug == "1")
                            {
                                log.WriteMyLog(blh + "体检回传成功!");
                            }
                            ZgqClass.BGHJ(blh, "ZGQJK", "审核", "体检回传成功", "ZGQJK", "体检接口");
                        }
                        else
                        {
                            ZgqClass.BGHJ(blh, "ZGQJK", "审核", "体检回传失败:" + mzORAPAR[6].Value.ToString().Trim() + "," + mzORAPAR[7].Value.ToString().Trim() + "," + mzORAPAR[8].Value.ToString().Trim(), "ZGQJK", "体检接口");
                            log.WriteMyLog("体检回传失败:" + blh + "," + mzORAPAR[6].Value.ToString().Trim() + "," + mzORAPAR[7].Value.ToString().Trim() + "," + mzORAPAR[8].Value.ToString().Trim());
                        }
                    }
                    catch (Exception e)
                    {
                        ZgqClass.BGHJ(blh, "ZGQJK", "审核", "体检回传异常:" + e.Message.ToString().Trim(), "ZGQJK", "体检接口");
                        log.WriteMyLog(e.Message.ToString());
                    }
                }
            }
            catch (Exception ee)
            {
                ZgqClass.BGHJ(blh, "ZGQJK", "审核", "体检回传异常:" + ee.Message.ToString().Trim(), "ZGQJK", "体检接口");
                log.WriteMyLog(ee.Message.ToString());
            }
        }
예제 #8
0
        public void pathtohis(string blh, string bglx, string bgxh, string msg1, string debug1, string[] cslb)
        {
            if (bglx == "")
            {
                bglx = "cg";
            }
            if (bgxh == "")
            {
                bgxh = "0";
            }

            string blbh  = blh + bglx + bgxh;
            string CZY   = f.ReadString("yh", "yhmc", "").Replace("\0", "").Trim();
            string CZYGH = f.ReadString("yh", "yhbh", "").Replace("\0", "").Trim();

            debug = f.ReadString("savetohis", "debug", "").Replace("\0", "").Trim();
            string isbghj = f.ReadString("zgqjk", "isbghj", "1").Replace("\0", "").Trim();

            string xtdm = f.ReadString("savetohis", "xtdm", "2060000");

            string certificate = f.ReadString("savetohis", "certificate", "ZmmJ9RMCKAUxFsiwl/08iiA3J17G0OpI");

            msg = msg1;

            string IP        = f.ReadString("savetohis", "IP", "223.220.200.7");
            string toPDFPath = f.ReadString("savetohis", "toPDFPath", "");
            string useName   = f.ReadString("savetohis", "useName", "");
            string pwd       = f.ReadString("savetohis", "pwd", "");
            string tjtxpath  = toPDFPath;

            string qxsh = "";
            string xdj  = "";

            bglx = bglx.ToLower();

            if (cslb.Length == 5)
            {
                if (cslb[4].ToLower() == "qxsh")
                {
                    qxsh = "1"; //取消审核动作
                }
                if (cslb[3].ToLower() == "new")
                {
                    xdj = "1";
                }
            }

            dbbase.odbcdb aa   = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");
            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("病理数据库设置有问题!");
                return;
            }
            if (jcxx.Rows.Count < 1)
            {
                MessageBox.Show("病理号有错误!");
                return;
            }
            if (jcxx.Rows[0]["F_SQXH"].ToString().Trim() == "")
            {
                log.WriteMyLog("无申请序号,不处理");
                ZgqClass.BGHJ(blh, CZY, "保存", "无申请序号,不处理", "ZGQJK", "");
                aa.ExecuteSQL("update T_JCXX_FS set F_bz='无申请序号,不处理',F_FSZT='已处理'  where F_blbh='" + blbh + "' ");
                return;
            }

            string bgzt = jcxx.Rows[0]["F_BGZT"].ToString().Trim();

            if (qxsh == "1")
            {
                bgzt = "取消审核";
            }



            string brbh = jcxx.Rows[0]["F_BRBH"].ToString().Trim();
            string brlb = jcxx.Rows[0]["F_brlb"].ToString().Trim();
            string sqxh = jcxx.Rows[0]["F_SQXH"].ToString().Trim();

            if (brlb == "住院")
            {
                brlb = "I";
            }
            else if (brlb == "体检")
            {
                brlb = "T";
            }
            else
            {
                brlb = "O";
            }

            string ZYH = jcxx.Rows[0]["F_MZH"].ToString().Trim();

            if (brlb == "I")
            {
                ZYH = jcxx.Rows[0]["F_ZYH"].ToString().Trim();
            }

            string SFZH = jcxx.Rows[0]["F_SFZH"].ToString().Trim();
            string XM   = jcxx.Rows[0]["F_XM"].ToString().Trim();
            string SJKS = jcxx.Rows[0]["F_BQ"].ToString().Trim();
            string CH   = jcxx.Rows[0]["F_CH"].ToString().Trim();
            string YZXM = jcxx.Rows[0]["F_YZXM"].ToString().Trim();

            //回写状态   客户端用
            int hczt = f.ReadInteger("savetohis", "hczt", 1);
            int hcbg = f.ReadInteger("savetohis", "hcbg", 1);

            if (hczt == 1)
            {
                if (bglx != "bc" && bglx != "bd")
                {
                    if (debug == "1")
                    {
                        log.WriteMyLog("回传状态");
                    }
                    #region  回状态(不包括审核)
                    if (bgzt == "已登记" || bgzt == "已取材" || bgzt == "已写报告" || bgzt == "报告延期" || bgzt == "取消审核")
                    {
                        string bgzt_1 = "";
                        if (bgzt == "已登记" || bgzt == "已取材")
                        {
                            bgzt_1 = "S";
                        }

                        if (bgzt == "已写报告" || bgzt == "报告延期")
                        {
                            bgzt_1 = "R";
                        }

                        if (bgzt == "已审核")
                        {
                            bgzt_1 = "F";
                        }

                        if (bgzt == "已写报告" && jcxx.Rows[0]["F_HXBJ"].ToString().Trim() == "1")
                        {
                            bgzt_1 = "C";
                        }

                        if (bgzt == "取消审核")
                        {
                            bgzt_1 = "C";
                        }


                        if (bgzt_1 == "")
                        {
                            log.WriteMyLog("bgzt_1状态为空,不回写!");
                            return;
                        }

                        string ChangeGmsApplyStatus_Hl7 = "MSH|^~\\&|GMS||HIS||" + DateTime.Now.ToString("yyyyMMddHHmmss") + "||ORM^O01|" + DateTime.Now.ToString("yyyyMMddHHmmss") + "|P|2.4" + "\r"
                                                          + "PID|||" + jcxx.Rows[0]["F_YZID"].ToString().Trim() + "^^^^PI~" + ZYH + "^^^^||" + XM + "^||||||||||||\r"
                                                          //+ "PID|||" + jcxx.Rows[0]["F_YZID"].ToString().Trim() + "^^^^PI||" + jcxx.Rows[0]["F_XM"].ToString().Trim() + "^||||||||||||\r"
                                                          + "PV1||" + brlb + "|||||||||||||||||" + ZYH + "\r"
                                                          + "ORC|SC|" + sqxh + "|||RC|||||" + CZYGH + "^" + CZY + "\r"
                                                          + "OBR||" + sqxh + "|" + "BL_" + blbh + "|" + YZXM + "|||||||||||||||||||||" + bgzt_1;
                        if (jcxx.Rows[0]["F_BRLB"].ToString().Trim() == "体检")
                        {
                            ChangeGmsApplyStatus_Hl7 = "MSH|^~\\&|GMS||HIS||" + DateTime.Now.ToString("yyyyMMddHHmmss") + "||ORM^O01|" + DateTime.Now.ToString("yyyyMMddHHmmss") + "|P|2.4" + "\r"
                                                       //+ "PID|||" + jcxx.Rows[0]["F_YZID"].ToString().Trim() + "^^^^PI~" + ZYH + "^^^^||" + XM + "^||||||||||||\r"
                                                       + "PID|||" + jcxx.Rows[0]["F_YZID"].ToString().Trim() + "^^^^PI||" + jcxx.Rows[0]["F_XM"].ToString().Trim() + "^||||||||||||\r"
                                                       + "PV1||" + brlb + "|||||||||||||||||" + ZYH + "\r"
                                                       + "ORC|SC|" + sqxh + "|||RC|||||" + CZYGH + "^" + CZY + "\r"
                                                       + "OBR||" + sqxh + "|" + blh + "|" + YZXM + "|||||||||||||||||||||" + bgzt_1;
                        }

                        if (debug == "1")
                        {
                            log.WriteMyLog(blh + "^" + bglx + "^" + bgxh + "-修改报告状态入参:" + ChangeGmsApplyStatus_Hl7);
                        }

                        string rtn_msg2 = rtn_CallInterface("HL7v2", "ChangeGmsApplyStatus", ChangeGmsApplyStatus_Hl7, "", certificate);


                        if (debug == "1")
                        {
                            log.WriteMyLog(blh + "^" + bglx + "^" + bgxh + "-修改报告状态平台返回:" + rtn_msg2);
                        }

                        if (rtn_msg2.Trim() == "-1")
                        {
                            log.WriteMyLog(blh + "^" + bglx + "^" + bgxh + "-回写报告状态失败:" + rtn_msg2);
                            if (isbghj == "1")
                            {
                                ZgqClass.BGHJ(blh, CZY, "保存", "回写报告状态失败:-1", "ZGQJK", "回写报告状态:" + bgzt);
                            }
                            return;
                        }
                        else
                        {
                            readhl7_fjfy r7 = new readhl7_fjfy();
                            int          xy = 0;
                            r7.Adt01(rtn_msg2, ref xy);
                            if (r7.MSA[1].Trim() == "AA")
                            {
                                if (debug == "1")
                                {
                                    log.WriteMyLog(r7.MSA[3].Trim());
                                }
                                if (isbghj == "1")
                                {
                                    ZgqClass.BGHJ(blh, CZY, "保存", "回写报告状态成功:" + r7.MSA[3].Trim(), "ZGQJK", "回写报告状态:" + bgzt);
                                }
                            }
                            else
                            {
                                log.WriteMyLog("回写报告状态失败:" + r7.MSA[3].Trim());
                                if (isbghj == "1")
                                {
                                    ZgqClass.BGHJ(blh, CZY, "保存", "回写报告状态失败:" + r7.MSA[3].Trim(), "ZGQJK", "回写报告状态:" + bgzt);
                                }
                            }
                        }
                    }
                    if (debug == "1")
                    {
                        log.WriteMyLog("回传状态结束");
                    }
                    #endregion
                }
            }



            DataTable dt_bc = new DataTable();
            DataTable dt_bd = new DataTable();
            string    bgzt2 = "";
            if (bglx.ToLower().Trim() == "bd")
            {
                dt_bd = aa.GetDataTable("select * from T_BDBG where F_BLH='" + blh + "' and  F_BD_BGXH='" + bgxh + "'", "bd");
                bgzt2 = dt_bd.Rows[0]["F_BD_BGZT"].ToString();
            }
            if (bglx.ToLower().Trim() == "bc")
            {
                dt_bc = aa.GetDataTable("select * from T_BCBG where F_BLH='" + blh + "' and  F_BC_BGXH='" + bgxh + "'", "bc");
                bgzt2 = dt_bc.Rows[0]["F_BC_BGZT"].ToString();
            }
            if (bgzt != "取消审核" && bglx.ToLower().Trim() != "cg")
            {
                bgzt = bgzt2;
            }

            string pdfname  = "";
            string pdfpath  = "";
            string filepath = "";
            string ispdf    = f.ReadString("savetohis", "ispdf", "1").Replace("\0", "").Trim();

            if (ispdf == "1")
            {
                #region  生成pdf
                if (bgzt.Trim() == "已审核")
                {
                    if (debug == "1")
                    {
                        log.WriteMyLog("生成pdf开始");
                    }
                    string ML      = DateTime.Parse(jcxx.Rows[0]["F_SDRQ"].ToString()).ToString("yyyyMM");
                    string err_msg = "";



                    //生成jpg
                    bool isrtn = false;
                    if (jcxx.Rows[0]["F_BRLB"].ToString().Trim() == "体检")
                    {
                        isrtn = MD_PDF_JPG(blh, bglx, bgxh, ML, ZgqPDFJPG.Type.JPG, ref err_msg, ref pdfname, ref pdfpath, ref filepath, IP, useName, pwd);
                    }
                    else
                    {
                        isrtn = MD_PDF_JPG(blh, bglx, bgxh, ML, ZgqPDFJPG.Type.PDF, ref err_msg, ref pdfname, ref pdfpath, ref filepath, IP, useName, pwd);
                    }

                    if (isrtn)
                    {
                        pdfname = pdfname.Substring(pdfname.LastIndexOf('\\') + 1);
                        ZgqClass.BGHJ(blh, "his接口", "报告审核", "生成PDF成功:" + pdfpath, "ZGQJK", "pdf");
                        aa.ExecuteSQL("delete T_BG_PDF  where F_BLBH='" + blbh + "' ");
                        aa.ExecuteSQL("insert  into T_BG_PDF(F_BLBH,F_BLH,F_BGLX,F_BGXH,F_PDFPATH,F_PDFNAME) values('" + blbh + "','" + blh + "','" + bglx + "','" + bgxh + "','" + pdfpath + "','" + pdfname + "')");
                    }
                    else
                    {
                        log.WriteMyLog(blh + "-" + err_msg);
                        ZgqClass.BGHJ(blh, "his接口", "审核PDF", "生成PDF失败" + err_msg, "ZGQJK", "pdf");
                        if (msg == "1")
                        {
                            MessageBox.Show("病理号:" + blh + "  生成PDF失败,请重新审核!\r\n" + err_msg);
                        }
                        return;
                    }
                    if (debug == "1")
                    {
                        log.WriteMyLog("生成pdf或jpg结束");
                    }
                }
                else
                {
                }


                # endregion
            }

            //回写报告

            if (hcbg == 1)
            {
                if (bgzt == "已审核")
                {
                    if (debug == "1")
                    {
                        log.WriteMyLog("回传审核状态");
                    }
                    string txwebpath = ZgqClass.GetSz("savetohis", "txwebpath", @"http://223.220.200.111/pathwebrpt/images").Replace("\0", "").Trim();

                    ////回写报告审核状态
                    if (bglx != "bc" && bglx != "bd")
                    {
                        #region 回写审核状态
                        string ChangeGmsApplyStatus_Hl7 = "MSH|^~\\&|GMS||HIS||" + DateTime.Now.ToString("yyyyMMddHHmmss") + "||ORM^O01|" + DateTime.Now.ToString("yyyyMMddHHmmss") + "|P|2.4" + "\r"
                                                          + "PID|||" + jcxx.Rows[0]["F_YZID"].ToString().Trim() + "^^^^PI~" + ZYH + "^^^^||" + XM + "^||||||||||||\r"
                                                          //+ "PID|||" + jcxx.Rows[0]["F_YZID"].ToString().Trim() + "^^^^PI||" + jcxx.Rows[0]["F_XM"].ToString().Trim() + "^||||||||||||\r"
                                                          + "PV1||" + brlb + "|||||||||||||||||" + ZYH + "\r"
                                                          + "ORC|SC|" + sqxh + "|||RC|||||" + CZYGH + "^" + CZY + "\r"
                                                          + "OBR||" + sqxh + "|" + "BL_" + blbh + "|" + YZXM + "|||||||||||||||||||||F";

                        if (jcxx.Rows[0]["F_BRLB"].ToString().Trim() == "体检")
                        {
                            ChangeGmsApplyStatus_Hl7 = "MSH|^~\\&|GMS||HIS||" + DateTime.Now.ToString("yyyyMMddHHmmss") + "||ORM^O01|" + DateTime.Now.ToString("yyyyMMddHHmmss") + "|P|2.4" + "\r"
                                                       //+ "PID|||" + jcxx.Rows[0]["F_YZID"].ToString().Trim() + "^^^^PI~" + ZYH + "^^^^||" + XM + "^||||||||||||\r"
                                                       + "PID|||" + jcxx.Rows[0]["F_YZID"].ToString().Trim() + "^^^^PI||" + jcxx.Rows[0]["F_XM"].ToString().Trim() + "^||||||||||||\r"
                                                       + "PV1||" + brlb + "|||||||||||||||||" + ZYH + "\r"
                                                       + "ORC|SC|" + sqxh + "|||RC|||||" + CZYGH + "^" + CZY + "\r"
                                                       + "OBR||" + sqxh + "|" + blh + "|" + YZXM + "|||||||||||||||||||||F";
                        }

                        if (debug == "1")
                        {
                            log.WriteMyLog(blh + "^" + bglx + "^" + bgxh + "-修改报告审核状态入参:" + ChangeGmsApplyStatus_Hl7);
                        }

                        string rtn_msg_zt = rtn_CallInterface("HL7v2", "ChangeGmsApplyStatus", ChangeGmsApplyStatus_Hl7, "", certificate);

                        if (debug == "1")
                        {
                            log.WriteMyLog(blh + "^" + bglx + "^" + bgxh + "-修改报告审核状态平台返回:" + rtn_msg_zt);
                        }

                        if (rtn_msg_zt.Trim() == "-1")
                        {
                            if (isbghj == "1")
                            {
                                ZgqClass.BGHJ(blh, CZY, "保存", "回写报告审核状态失败:-1", "ZGQJK", "回写报告状态:已审核");
                            }
                            log.WriteMyLog(blh + "^" + bglx + "^" + bgxh + "-回写报告状态失败:" + rtn_msg_zt);
                            return;
                        }
                        else
                        {
                            readhl7_fjfy r7 = new readhl7_fjfy();
                            int          xy = 0;
                            r7.Adt01(rtn_msg_zt, ref xy);
                            if (r7.MSA[1].Trim() == "AA")
                            {
                                if (debug == "1")
                                {
                                    log.WriteMyLog(r7.MSA[3].Trim());
                                }
                                if (isbghj == "1")
                                {
                                    ZgqClass.BGHJ(blh, CZY, "保存", "回写报告状态成功:" + r7.MSA[3].Trim(), "ZGQJK", "回写报告状态:已审核");
                                }
                            }
                            else
                            {
                                if (isbghj == "1")
                                {
                                    ZgqClass.BGHJ(blh, CZY, "保存", "回写报告状态失败:" + r7.MSA[3].Trim(), "ZGQJK", "回写报告状态:已审核");
                                }
                                log.WriteMyLog("回写报告状态失败:" + r7.MSA[3].Trim());
                            }
                        }
                        #endregion
                    }
                    DataTable dt_pdf = new DataTable();
                    dt_pdf = aa.GetDataTable("select *  from T_BG_PDF  where F_BLBH='" + blbh + "'", "pdf");
                    if (dt_pdf == null || dt_pdf.Rows.Count <= 0)
                    {
                        if (ispdf == "1")
                        {
                            #region  生成pdf
                            if (bgzt.Trim() == "已审核")
                            {
                                string ML      = DateTime.Parse(jcxx.Rows[0]["F_SDRQ"].ToString()).ToString("yyyyMM");
                                string err_msg = "";


                                //生成jpg
                                bool isrtn = false;
                                if (jcxx.Rows[0]["F_BRLB"].ToString().Trim() == "体检")
                                {
                                    isrtn = MD_PDF_JPG(blh, bglx, bgxh, ML, ZgqPDFJPG.Type.JPG, ref err_msg, ref pdfname, ref pdfpath, ref filepath, IP, useName, pwd);
                                }
                                else
                                {
                                    isrtn = MD_PDF_JPG(blh, bglx, bgxh, ML, ZgqPDFJPG.Type.PDF, ref err_msg, ref pdfname, ref pdfpath, ref filepath, IP, useName, pwd);
                                }

                                if (isrtn)
                                {
                                    pdfname = pdfname.Substring(pdfname.LastIndexOf('\\') + 1);
                                    ZgqClass.BGHJ(blh, "his接口", "报告审核", "生成PDF成功:" + pdfpath, "ZGQJK", "pdf");
                                    aa.ExecuteSQL("delete T_BG_PDF  where F_BLBH='" + blbh + "' ");
                                    aa.ExecuteSQL("insert  into T_BG_PDF(F_BLBH,F_BLH,F_BGLX,F_BGXH,F_PDFPATH,F_PDFNAME) values('" + blbh + "','" + blh + "','" + bglx + "','" + bgxh + "','" + pdfpath + "','" + pdfname + "')");
                                }
                                else
                                {
                                    log.WriteMyLog(blh + "-" + err_msg);
                                    ZgqClass.BGHJ(blh, "his接口", "审核PDF", "生成PDF失败" + err_msg, "ZGQJK", "pdf");
                                    if (msg == "1")
                                    {
                                        MessageBox.Show("病理号:" + blh + "  生成PDF失败,请重新审核!\r\n" + err_msg);
                                    }
                                    return;
                                }
                            }
                            else
                            {
                            }

                            if (debug == "1")
                            {
                                log.WriteMyLog("生成pdf或jpg结束");
                            }
                            # endregion
                        }
                    }
                    else
                    {
                        pdfpath = dt_pdf.Rows[0]["F_PDFPATH"].ToString().Trim();
                        pdfname = dt_pdf.Rows[0]["F_PDFNAME"].ToString().Trim();
                    }
                    #region 回传报告

                    if (debug == "1")
                    {
                        log.WriteMyLog("回传结果开始");
                    }

                    string bgys = jcxx.Rows[0]["F_BGYS"].ToString().Trim();
                    string shys = jcxx.Rows[0]["F_SHYS"].ToString().Trim();

                    string qcys   = jcxx.Rows[0]["F_QCYS"].ToString().Trim();
                    string qcysgh = getyhgh(qcys);
                    string qcrq   = jcxx.Rows[0]["F_QCrq"].ToString().Trim();
                    string bgrq   = DateTime.Parse(jcxx.Rows[0]["F_BGRQ"].ToString().Trim()).ToString("yyyyMMddHHmmss");
                    string shrq   = DateTime.Parse(jcxx.Rows[0]["F_SPARE5"].ToString().Trim()).ToString("yyyyMMddHHmmss");

                    // 诊断描述
                    string Res_char = (jcxx.Rows[0]["F_RYSJ"].ToString().Trim() + "\r\n" + jcxx.Rows[0]["F_JXSJ"].ToString().Trim());
                    //诊断结论	Res_con
                    string Res_con = (jcxx.Rows[0]["F_BLZD"].ToString().Trim() + "\r\n" + jcxx.Rows[0]["F_TSJC"].ToString().Trim());
                    try
                    {
                        qcrq = DateTime.Parse(qcrq).ToString("yyyyMMddHHmmss");
                    }
                    catch
                    {
                    }
                    if (bglx == "bc")
                    {
                        bgys     = dt_bc.Rows[0]["F_BC_BGYS"].ToString().Trim();
                        shys     = dt_bc.Rows[0]["F_BC_SHYS"].ToString().Trim();
                        Res_char = (dt_bc.Rows[0]["F_BC_JXSJ"].ToString().Trim());
                        Res_con  = (dt_bc.Rows[0]["F_BCZD"].ToString().Trim() + "\r\n" + dt_bc.Rows[0]["F_BC_TSJC"].ToString().Trim());
                        bgrq     = DateTime.Parse(dt_bc.Rows[0]["F_bc_bgrq"].ToString().Trim()).ToString("yyyyMMddHHmmss");
                        shrq     = DateTime.Parse(dt_bc.Rows[0]["F_bc_SPARE5"].ToString().Trim()).ToString("yyyyMMddHHmmss");
                    }
                    if (bglx == "bd")
                    {
                        bgys     = dt_bd.Rows[0]["F_BD_BGYS"].ToString().Trim();
                        shys     = dt_bd.Rows[0]["F_BD_SHYS"].ToString().Trim();
                        Res_char = "";
                        Res_con  = (dt_bd.Rows[0]["F_BDZD"].ToString().Trim());
                        bgrq     = DateTime.Parse(dt_bc.Rows[0]["F_bd_bgrq"].ToString().Trim()).ToString("yyyyMMddHHmmss");
                        shrq     = DateTime.Parse(dt_bc.Rows[0]["F_bd_bgrq"].ToString().Trim()).ToString("yyyyMMddHHmmss");
                    }
                    string bgysgh = getyhgh(bgys);
                    string shysgh = getyhgh(shys);

                    string hxbj = jcxx.Rows[0]["F_HXBJ"].ToString().Trim();

                    string zt2 = "F";
                    if (hxbj == "1")
                    {
                        zt2 = "C";
                    }

                    string xb = jcxx.Rows[0]["F_XB"].ToString().Trim();
                    if (xb == "女")
                    {
                        xb = "F";
                    }
                    else if (xb.Trim() == "男")
                    {
                        xb = "M";
                    }
                    else
                    {
                        xb = "U";
                    }
                    ////就诊科室,检查方法,检查部位,异常标记,申请科室,登记时间,登记人,检查时间,检查人,性别
                    string blk = jcxx.Rows[0]["F_BLK"].ToString().Trim();
                    if (blk.Contains("TCT") || blk == "LCT" || blk == "液基细胞")
                    {
                        DataTable TJ_bljc = new DataTable();
                        TJ_bljc = aa.GetDataTable(" select top 1  *  from T_TBS_BG where  F_blh='" + blh + "'", "blxx");
                        if (TJ_bljc.Rows.Count > 0)
                        {
                            Res_char = Res_char + "标本满意度:" + TJ_bljc.Rows[0]["F_TBS_BBMYD"].ToString().Trim() + "\r\n" + "\r\n";
                            Res_char = Res_char + "     " + "\r\n" + TJ_bljc.Rows[0]["F_TBS_XBL"].ToString().Trim() + "\r\n" + TJ_bljc.Rows[0]["F_TBS_XBXM1"].ToString().Trim()
                                       + "\r\n" + TJ_bljc.Rows[0]["F_TBS_XBXM2"].ToString().Trim() + "\r\n" + "\r\n";
                            Res_char = Res_char + "病原微生物:" + "\r\n" + TJ_bljc.Rows[0]["F_TBS_WSW2"].ToString().Trim() + "\r\n" + TJ_bljc.Rows[0]["F_TBS_WSW1"].ToString().Trim()
                                       + "\r\n" + TJ_bljc.Rows[0]["F_TBS_WSW3"].ToString().Trim() + "\r\n" + TJ_bljc.Rows[0]["F_TBS_BDXM1"].ToString().Trim() + "\r\n" + "\r\n";
                            Res_char = Res_char + "炎症程度:" + TJ_bljc.Rows[0]["F_TBS_YZCD"].ToString().Trim() + "\r\n" + "\r\n";

                            ///////////诊断/////////////////////////
                            Res_con = "TBS诊断:" + TJ_bljc.Rows[0]["F_TBSZD"].ToString().Trim() + "\r\n" + "\r\n";
                            if (TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() != "")
                            {
                                Res_con = Res_con + "补充意见:" + TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() + "\r\n";
                            }
                        }
                    }
                    string SendGmsReport_hl7 = "MSH|^~\\&|GMS||HIS||" + DateTime.Now.ToString("yyyyMMddHHmmss") + "||ORU^R01|" + DateTime.Now.ToString("yyyyMMddHHmmss") + "|P|2.4" + "\r"
                                               + "PID|||" + brbh + "^^^^PI||" + jcxx.Rows[0]["F_XM"].ToString().Trim() + "^||^" + jcxx.Rows[0]["F_nl"].ToString().Trim() + "|" + xb + "|||||||" + "\r"
                                               + "PV1||" + brlb + "|" + SJKS + "^^" + CH + "||||^" + jcxx.Rows[0]["F_SJYS"].ToString().Trim() + "||||||||||||" + ZYH + "|||||||||||||||||||||||||" + "\r"
                                               + "OBR||" + sqxh + "|" + "BL_" + blbh + "|" + YZXM + "||" + DateTime.Parse(jcxx.Rows[0]["F_sdrq"].ToString().Trim()).ToString("yyyyMMddHHmmss") + "|" + qcrq + "|||" + qcysgh + "^" + qcys + "||||" + DateTime.Parse(jcxx.Rows[0]["F_sdrq"].ToString().Trim()).ToString("yyyyMMddHHmmss") + "|" + jcxx.Rows[0]["F_BBMC"].ToString().Trim() + "|^" + jcxx.Rows[0]["F_SJYS"].ToString().Trim() + "||||||" + bgrq + "||||||||||" + bgysgh + "&" + bgys + "^^" + "\r"
                                               + "NTE|1||" + filepath + "|Z-RP" + "\r"
                                               + "OBX|1|FT|^肉眼所见||" + Res_char.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "\\.br\\.") + "|||N|||" + zt2 + "|||" + shrq + "||" + shysgh + "^" + shys + "|^" + jcxx.Rows[0]["F_BLK"].ToString().Trim() + "|" + "\r"
                                               + "OBX|2|FT| ^病理诊断||" + Res_con.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "\\.br\\.") + "|||N|||" + zt2 + "|||" + shrq + "||" + shysgh + "^" + shys + "|^" + jcxx.Rows[0]["F_BLK"].ToString().Trim() + "|" + "\r";


                    if (jcxx.Rows[0]["F_brlb"].ToString().Trim() == "体检")
                    {
                        SendGmsReport_hl7 = SendGmsReport_hl7 + "ZIM|1|pdfname|" + "BL_" + blbh + "|" + pdfpath.Replace("ftp", "http").Trim() + "||" + "\r";
                    }
                    else
                    {
                        DataTable dt_tx = aa.GetDataTable("select * from V_DYTX where F_blh='" + blh + "'", "tx");
                        if (dt_tx.Rows.Count > 0)
                        {
                            for (int x = 0; x < dt_tx.Rows.Count; x++)
                            {
                                string txlj = txwebpath + "/" + jcxx.Rows[0]["F_TXML"].ToString().Trim() + "/" + dt_tx.Rows[x]["F_TXM"].ToString();
                                SendGmsReport_hl7 = SendGmsReport_hl7 + "ZIM|" + (x + 1).ToString() + "|" + dt_tx.Rows[x]["F_ID"].ToString() + "|" + "BL_" + blbh + "|" + txlj + "||1" + "\r";
                            }
                        }
                        else
                        {
                            SendGmsReport_hl7 = SendGmsReport_hl7 + "ZIM|1|1|" + "BL_" + blbh + "|||" + "\r";
                        }
                    }

                    if (debug == "1")
                    {
                        log.WriteMyLog("报告审核回写结果:" + SendGmsReport_hl7);
                    }
                    string rtn_msg2 = rtn_CallInterface("HL7v2", "SendGmsReport", SendGmsReport_hl7, "", certificate);

                    string iscfsc = ZgqClass.GetSz("zgqjk", "iscfsc", "0").Replace("\0", "").Trim();
                    if (rtn_msg2.Contains("error"))
                    {
                        if (msg == "1")
                        {
                            MessageBox.Show("报告审核回写结果错误:" + rtn_msg2);
                        }
                        log.WriteMyLog("报告审核回写结果错误:" + rtn_msg2);
                        if (isbghj == "1")
                        {
                            ZgqClass.BGHJ(blh, "上传平台", "审核", "报告审核回写结果错误:" + rtn_msg2, "ZGQJK", "报告审核回写结果");
                        }

                        if (iscfsc == "1")
                        {
                            aa.ExecuteSQL("update T_JCXX_FS set F_errmsg='" + rtn_msg2 + "'  where F_blbh='" + blbh + "' ");
                        }
                        else
                        {
                            aa.ExecuteSQL("update T_JCXX_FS set F_errmsg='" + rtn_msg2 + "',F_FSZT='已处理'  where F_blbh='" + blbh + "' ");
                        }

                        return;
                    }
                    else
                    {
                        readhl7_fjfy r7 = new readhl7_fjfy();
                        int          xy = 0;
                        r7.Adt01(rtn_msg2, ref xy);
                        if (r7.MSA[1].Trim() == "AA")
                        {
                            if (debug == "1")
                            {
                                log.WriteMyLog(r7.MSA[3].Trim());
                            }
                            if (isbghj == "1")
                            {
                                ZgqClass.BGHJ(blh, "上传平台", "审核", "报告审核回写结果成功:" + r7.MSA[3].Trim(), "ZGQJK", "报告审核回写结果");
                            }
                        }
                        else
                        {
                            if (msg == "1")
                            {
                                MessageBox.Show(r7.MSA[3].Trim());
                            }
                            log.WriteMyLog("报告审核回写结果失败:" + r7.MSA[3].Trim());
                            if (isbghj == "1")
                            {
                                ZgqClass.BGHJ(blh, "上传平台", "审核", "报告审核回写结果失败:" + r7.MSA[3].Trim(), "ZGQJK", "报告审核回写结果");
                            }

                            if (iscfsc == "1")
                            {
                                aa.ExecuteSQL("update T_JCXX_FS set F_errmsg='报告审核回写结果失败:" + r7.MSA[3].Trim() + "'  where F_blbh='" + blbh + "' ");
                            }
                            else
                            {
                                aa.ExecuteSQL("update T_JCXX_FS set F_errmsg='报告审核回写结果失败:" + r7.MSA[3].Trim() + "',,F_FSZT='已处理'  where F_blbh='" + blbh + "' ");
                            }

                            return;
                        }
                    }
                    if (debug == "1")
                    {
                        log.WriteMyLog("回传结果结束");
                    }

                    #endregion

                    aa.ExecuteSQL("update T_JCXX_FS set F_errmsg='',F_FSZT='已处理'  where F_blbh='" + blbh + "'");
                    aa.ExecuteSQL("update T_JCXX set F_HXBJ='1' where F_blh='" + blh + "'");
                    return;
                }
                //取消审核,删除pdf
                #region
                if (bgzt == "取消审核")
                {
                    DataTable dt2 = aa.GetDataTable("select top 1 * from T_BG_PDF where F_blbh='" + blbh + "' ", "dt2");
                    if (dt2.Rows.Count > 0)
                    {
                        //开共享

                        if (useName.Trim() != "")
                        {
                            Process pro = new Process();
                            try
                            {
                                pro.StartInfo.FileName               = "cmd.exe";
                                pro.StartInfo.UseShellExecute        = false;
                                pro.StartInfo.RedirectStandardInput  = true;
                                pro.StartInfo.RedirectStandardOutput = true;
                                pro.StartInfo.RedirectStandardError  = true;
                                pro.StartInfo.CreateNoWindow         = true;
                                pro.Start();
                                pro.StandardInput.WriteLine("net use  \\\\" + IP + "\\ipc$ " + pwd + " /user:"******"");
                                Thread.Sleep(500);

                                if (File.Exists(dt2.Rows[0]["F_PDFPATH"].ToString()))
                                {
                                    File.Delete(dt2.Rows[0]["F_PDFPATH"].ToString());
                                }
                            }
                            catch (Exception ee)
                            {
                            }
                            finally
                            {
                                pro.StandardInput.WriteLine("net use  \\\\" + IP + "\\ipc$ /del");
                            }
                        }
                        else
                        {
                            if (File.Exists(dt2.Rows[0]["F_PDFPATH"].ToString()))
                            {
                                File.Delete(dt2.Rows[0]["F_PDFPATH"].ToString());
                            }
                        }
                        //判断共享上是否存在该pdf文件
                        aa.ExecuteSQL("delete T_BG_PDF  where F_BLbH='" + blbh + "' ");
                    }
                }
                #endregion
            }

            return;
        }
예제 #9
0
        public void pathtohis(string blh, string debug)
        {
            string CZY   = f.ReadString("yh", "yhmc", "").Replace("\0", "").Trim();
            string CZYGH = f.ReadString("yh", "yhbh", "").Replace("\0", "").Trim();
            int    ljfs  = f.ReadInteger("savetohis", "ljfs", 1);

            debug = f.ReadString("savetohis", "debug", "").Replace("\0", "").Trim();

            string msg   = f.ReadString("savetohis", "msg", "").Replace("\0", "").Trim();
            string wsurl = f.ReadString("savetohis", "wsurl", "").Replace("\0", "").Trim();



            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_sqxh"].ToString().Trim() == "")
            {
                log.WriteMyLog("无申请序号(单据号),不处理!");
                ZgqClass.BGHJ(blh, CZY, "保存", "无申请序号(单据号),不处理!", "ZGQJK", "");
                return;
            }



            string constr = f.ReadString("savetohis", "odbcsql", "Data Source=192.168.4.5;Initial Catalog=ESDB;User Id=sa;Password=abc123!;");

            SqlDB  db     = new SqlDB();
            string errmsg = "";

            try
            {
                if (bljc.Rows[0]["F_HISBJ"].ToString() == "" || bljc.Rows[0]["F_HISBJ"].ToString() == null)
                {
                    string sql1 = "update pacs_resulto_temp set flag=1  where detail_id='" + bljc.Rows[0]["F_SQXH"].ToString() + "'";

                    int x = db.ExecuteNonQuery(constr, sql1, ref errmsg);
                    if (x > 0)
                    {
                        aa.ExecuteSQL("update T_JCXX set F_HISBJ='1'  where F_blh='" + blh + "'");
                        if (debug == "1")
                        {
                            MessageBox.Show("ToHIS:回写状态成功");
                        }
                    }
                    else
                    {
                        log.WriteMyLog("ToHIS:回写状态失败:" + errmsg + "\r\n" + sql1);
                        if (debug == "1")
                        {
                            MessageBox.Show("ToHIS:回写状态失败");
                        }
                    }
                }
            }
            catch
            {
                log.WriteMyLog("ToHIS:回写状态异常");
            }
            if (bljc.Rows[0]["F_BGZT"].ToString() == "已审核")
            {
                string sql = "update pacs_resulto_temp set flag=2,report_no='" + blh + "',check_ok='" + bljc.Rows[0]["F_RYSJ"].ToString() + "',check_result='" + bljc.Rows[0]["F_BLZD"].ToString() + "',execute_date='" + bljc.Rows[0]["F_BGRQ"].ToString() + "',doctor='" + bljc.Rows[0]["F_SHYS"].ToString() + "',check_date='" + bljc.Rows[0]["F_SPARE5"].ToString() + "',check_doctor='" + bljc.Rows[0]["F_SHYS"].ToString() + "'";
                sql = sql + "  where detail_id='" + bljc.Rows[0]["F_SQXH"].ToString() + "'";

                if (debug == "1")
                {
                    log.WriteMyLog(sql);
                }

                int x = db.ExecuteNonQuery(constr, sql, ref errmsg);
                log.WriteMyLog("返回:" + x.ToString() + "---" + errmsg);
                if (x > 0)
                {
                    aa.ExecuteSQL("update T_JCXX set F_HISBJ='2' where F_blh='" + blh + "'");
                    if (debug == "1")
                    {
                        MessageBox.Show("ToHIS:回写报告成功");
                    }
                }
                else
                {
                    log.WriteMyLog("ToHIS:回写报告失败:" + errmsg + "\r\n" + sql);
                    if (debug == "1")
                    {
                        MessageBox.Show("ToHIS:回写报告失败");
                    }
                }
                //   return;
            }
            else
            if (bljc.Rows[0]["F_BGZT"].ToString() == "已写报告" && bljc.Rows[0]["F_HISBJ"].ToString() == "2")
            {
                string sql1 = "update pacs_resulto_temp set flag=-1,report_no='" + blh + "',check_ok='',check_result='',execute_date='',doctor='',check_date='',check_doctor='' "
                              + "  where detail_id='" + bljc.Rows[0]["F_SQXH"].ToString() + "'";

                int x = db.ExecuteNonQuery(constr, sql1, ref errmsg);
                if (x > 0)
                {
                    aa.ExecuteSQL("update T_JCXX set F_HISBJ='-1' where F_blh='" + blh + "'");
                    if (debug == "1")
                    {
                        MessageBox.Show("ToHIS:回收报告成功");
                    }
                }
                else
                {
                    log.WriteMyLog("ToHIS:回收报告失败:" + errmsg + "\r\n" + sql1);
                    if (debug == "1")
                    {
                        MessageBox.Show("ToHIS:回收报告失败");
                    }
                }
            }
            else
            {
                log.WriteMyLog("ToHIS:" + bljc.Rows[0]["F_BGZT"].ToString() + ",不处理");
            }
            //tohis
            //    tohis(blh, bljc,debug);
            //topacs
            // topacs(blh, bljc,debug,bglx,bgxh,dz);
        }
예제 #10
0
        public void pathtohis(string blh, string bglx, string bgxh, string msg, string debug, string[] cslb)
        {
            string qxsh = "";
            string xdj  = "";

            bglx = bglx.ToLower();

            if (cslb.Length == 5)
            {
                if (cslb[4].ToLower() == "qxsh")
                {
                    //取消审核动作
                    qxsh = "1";
                }

                if (cslb[3].ToLower() == "new")
                {
                    xdj = "1";
                }
            }
            if (bglx == "")
            {
                bglx = "cg";
            }

            if (bgxh == "")
            {
                bgxh = "0";
            }

            string JsonSvcWeb = f.ReadString("savetohis", "JsonSvcWeb", "http://192.9.200.56:9080/ChasSvc/services/JsonSvc4Ris").Replace("\0", "").Trim();
            string yydm       = f.ReadString("savetohis", "yydm", "1").Replace("\0", "").Trim();
            string MZHISWeb   = f.ReadString("savetohis", "WSURL", "http://192.9.199.12:8002/HisForInspectItemService.asmx").Replace("\0", "").Trim(); //获取sz.ini中设置的mrks
            string tomzhis    = f.ReadString("savetohis", "tomzhis", "1").Replace("\0", "").Trim();
            string tozyhis    = f.ReadString("savetohis", "tozyhis", "1").Replace("\0", "").Trim();

            dbbase.odbcdb aa   = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");
            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("病理数据库设置有问题!");
                return;
            }
            if (jcxx.Rows.Count < 1)
            {
                MessageBox.Show("病理号有错误!");
                return;
            }

            if (bglx.Trim() == "")
            {
                log.WriteMyLog("报告类型为空,不处理!" + blh + "^" + bglx + "^" + bgxh);
                return;
            }

            string bgzt = "";

            if (qxsh == "1")
            {
                bgzt = "取消审核";
            }
            else
            {
                bgzt = jcxx.Rows[0]["F_BGZT"].ToString();
            }

            if (tozyhis == "1")
            {
                #region   回写住院HIS状态
                if (jcxx.Rows[0]["F_brlb"].ToString() == "住院")
                {
                    if (bglx == "cg" || jcxx.Rows[0]["F_SQXH"].ToString() != "")
                    {
                        string yzxmid = "";
                        try
                        {
                            yzxmid = jcxx.Rows[0]["F_YZXM"].ToString().Split('^')[1];
                        }
                        catch
                        {
                        }
                        if (yzxmid == "")
                        {
                            return;
                        }

                        string actionCode = "register";
                        string actionName = "PACS登记";
                        string sqdzt = ""; string sqdztCode = "";
                        if (bgzt == "已登记")
                        {
                            sqdztCode = "CLDS.RISREGISTER.0000"; sqdzt = "登记";
                        }
                        else if (bgzt == "已审核")
                        {
                            sqdztCode = "CLDS.RISAUDIT.0000"; sqdzt = "审核报告"; actionCode = "updateStatus"; actionName = "更新状态";
                        }
                        else if (bgzt == "取消审核")
                        {
                            sqdztCode = "CLDS.RISFINISH.0000"; sqdzt = "已检查"; actionCode = "updateStatus"; actionName = "更新状态";
                        }
                        else if (bgzt == "报告延期")
                        {
                            sqdztCode = "CLDS.RISFINISH.0000"; sqdzt = "已检查"; actionCode = "updateStatus"; actionName = "更新状态";
                        }
                        else if (bgzt == "已作废")
                        {
                            sqdztCode = "CLDS.RIUNR.0000"; sqdzt = "取消登记"; actionCode = "cancel"; actionName = "退单";
                        }
                        else
                        {
                            return;
                        }


                        MemoryStream ms     = new MemoryStream();
                        StreamWriter sw     = new StreamWriter(ms, Encoding.GetEncoding("gb2312"));
                        JsonWriter   writer = new JsonTextWriter(sw);
                        Encoding     eee    = sw.Encoding;
                        writer.WriteStartObject();
                        writer.WritePropertyName("reqHeader");
                        writer.WriteStartObject();
                        writer.WritePropertyName("callFunction");
                        writer.WriteValue("updateExaminationApply");
                        writer.WritePropertyName("systemId");
                        writer.WriteValue("PACS.BL");
                        writer.WritePropertyName("reqTimestamp");
                        writer.WriteValue(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        writer.WriteEndObject();
                        //申请单  33333333333333333333
                        writer.WritePropertyName("requestForms");
                        writer.WriteStartArray();
                        writer.WriteStartObject();
                        //申请单号
                        writer.WritePropertyName("requestFormHisNo");
                        writer.WriteValue(jcxx.Rows[0]["F_SQXH"].ToString());
                        //申请单名称
                        writer.WritePropertyName("requestName");
                        writer.WriteValue("");
                        //检查号
                        writer.WritePropertyName("requestFormSysNo");
                        writer.WriteValue(blh);
                        //检查分类
                        writer.WritePropertyName("requestType");
                        writer.WriteValue("");
                        //检查项目列表2222222222222
                        writer.WritePropertyName("orderItem");
                        writer.WriteStartArray();
                        string[] orderItemHisNos = yzxmid.ToString().Split('|');
                        foreach (string orderItemHisNo in orderItemHisNos)
                        {
                            if (orderItemHisNo.Trim() != "")
                            {
                                writer.WriteStartObject();
                                //子申请单号
                                writer.WritePropertyName("orderItemHisNo");
                                writer.WriteValue(orderItemHisNo);
                                //检查项目编码
                                writer.WritePropertyName("orderCode");
                                writer.WriteValue("");
                                //检查项目名称
                                writer.WritePropertyName("orderName");
                                writer.WriteValue("");
                                //检查项目状态
                                writer.WritePropertyName("statusCode");
                                writer.WriteValue(sqdztCode);
                                //检查项目状态名称
                                writer.WritePropertyName("statusName");
                                writer.WriteValue(sqdzt);

                                ////检查项目部位
                                //writer.WritePropertyName("subItems");
                                //writer.WriteStartArray();
                                //writer.WriteStartObject();
                                //        //检查项目部位编码
                                //        writer.WritePropertyName("orderCode");
                                //        writer.WriteValue("");
                                //        //检查项目部位名称
                                //        writer.WritePropertyName("orderName");
                                //        writer.WriteValue("");
                                //writer.WriteEndObject();
                                //writer.WriteEndArray();

                                writer.WriteEndObject();
                            }
                        }
                        writer.WriteEndArray();
                        ////22222222222222222222222222222222

                        //操作111111111111111111
                        writer.WritePropertyName("action");
                        writer.WriteStartArray();
                        writer.WriteStartObject();
                        //操作代码
                        writer.WritePropertyName("actionCode");
                        writer.WriteValue(actionCode);
                        //操作名称
                        writer.WritePropertyName("actionName");
                        writer.WriteValue(actionName);
                        //操作时间
                        writer.WritePropertyName("actionTime");
                        writer.WriteValue(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

                        //操作备注
                        writer.WritePropertyName("memo");
                        writer.WriteValue(jcxx.Rows[0]["F_WFBGYY"].ToString());

                        //操作人
                        writer.WritePropertyName("actor");
                        writer.WriteStartObject();
                        ///////////////////////////////////
                        //操作人医院
                        writer.WritePropertyName("hospital");
                        writer.WriteStartObject();
                        //操作人医院
                        writer.WritePropertyName("hospitalCode");
                        if (jcxx.Rows[0]["F_sjdw"].ToString() == "大院" || jcxx.Rows[0]["F_sjdw"].ToString() == "总院")
                        {
                            writer.WriteValue("1");
                        }
                        else if (jcxx.Rows[0]["F_sjdw"].ToString() == "大学城医院" || jcxx.Rows[0]["F_sjdw"].ToString() == "大学城")
                        {
                            writer.WriteValue("2");
                        }
                        else if (jcxx.Rows[0]["F_sjdw"].ToString() == "二沙分院" || jcxx.Rows[0]["F_sjdw"].ToString() == "二沙")
                        {
                            writer.WriteValue("3");
                        }
                        else if (jcxx.Rows[0]["F_sjdw"].ToString() == "芳村分院" || jcxx.Rows[0]["F_sjdw"].ToString() == "芳村")
                        {
                            writer.WriteValue("4");
                        }
                        else
                        {
                            writer.WriteValue("1");
                        }

                        //操作人医院
                        writer.WritePropertyName("hospitalName");
                        writer.WriteValue(jcxx.Rows[0]["F_sjdw"].ToString());
                        writer.WriteEndObject();
                        ////////////////////////////////////
                        //操作人科室
                        writer.WritePropertyName("department");
                        writer.WriteStartObject();
                        // 科室名称
                        writer.WritePropertyName("departmentName");
                        writer.WriteValue("");
                        // 科室代码
                        writer.WritePropertyName("departmentCode");
                        writer.WriteValue("");
                        writer.WriteEndObject();
                        ////////////////////////
                        //操作员工信息
                        writer.WritePropertyName("employee");
                        writer.WriteStartObject();
                        // 人员名称
                        writer.WritePropertyName("employeeName");
                        writer.WriteValue("");
                        // 人员代码
                        writer.WritePropertyName("employeeCode");
                        writer.WriteValue("");
                        writer.WriteEndObject();
                        ////////////////////////
                        writer.WriteEndObject();


                        writer.WriteEndObject();
                        writer.WriteEndArray();
                        /////11111111111111111111111111111111
                        writer.WriteEndObject();
                        writer.WriteEndArray();
                        writer.WriteEndObject();
                        /////3333333333333333333333333
                        ;
                        writer.Flush();


                        string rtnrequest = GetHisSQD(JsonSvcWeb, ms.ToArray(), debug);

                        if (debug == "1")
                        {
                            log.WriteMyLog("出参:" + rtnrequest);
                        }

                        JObject ja          = (JObject)JsonConvert.DeserializeObject(rtnrequest);
                        string  respCode    = ja["respHeader"]["respCode"].ToString();
                        string  respMessage = ja["respHeader"]["respMessage"].ToString();

                        if (respCode != "000000")
                        {
                            log.WriteMyLog("执行失败:" + respCode + "^" + respMessage);
                        }
                        else
                        {
                            if (debug == "1")
                            {
                                log.WriteMyLog("执行成功:" + respCode + "^" + respMessage);
                            }
                        }
                    }
                }
                #endregion
            }
            if (tomzhis == "1")
            {
                #region  门诊状态执行
                if (jcxx.Rows[0]["F_brlb"].ToString() == "门诊" || jcxx.Rows[0]["F_brlb"].ToString() == "体检")
                {
                    if (bglx == "cg" && jcxx.Rows[0]["F_SQXH"].ToString().Trim() != "")
                    {
                        if (jcxx.Rows[0]["F_HXBJ"].ToString().Trim() != "1" || bgzt == "已审核")
                        {
                            string deptid = f.ReadString("savetohis", "deptid", "60027").Replace("\0", "").Trim();
                            string yhgh   = f.ReadString("yh", "yhbh", "").Replace("\0", "").Trim();

                            if (yhgh.Trim() == "")
                            {
                                yhgh = "0502";
                            }
                            string Flag = "1";
                            if (bgzt == "已审核")
                            {
                                Flag = "2";
                            }

                            gdszyyMzHisWeb.HisForInspectItemService mzhis = new gdszyyMzHisWeb.HisForInspectItemService();

                            try
                            {
                                mzhis.Url = MZHISWeb;
                            }
                            catch (Exception ee2)
                            {
                                log.WriteMyLog("门诊HIS web服务连接异常:" + ee2.Message);
                                return;
                            }

                            string [] sqdh = jcxx.Rows[0]["F_SQXH"].ToString().Split(new char[2] {
                                '|', '|'
                            });
                            for (int x = 0; x < sqdh.Length; x++)
                            {
                                if (sqdh[x].Trim() == "")
                                {
                                    continue;
                                }

                                string request_xml = "<Request><CheckNumber>" + sqdh[x].Trim() + "</CheckNumber><ExecDeptId>" + deptid + "</ExecDeptId><ExecUserNo>" + yhgh + "</ExecUserNo><Flag>" + Flag + "</Flag></Request>";
                                if (debug == "1")
                                {
                                    log.WriteMyLog("门诊项目执行条件:" + request_xml);
                                }
                                string rtn_xml = "";
                                try
                                {
                                    rtn_xml = mzhis.ExecuteCheckItem(request_xml);
                                    if (rtn_xml.Trim() == "")
                                    {
                                        //  MessageBox.Show("门诊项目执行失败:HIS返回空");
                                        log.WriteMyLog("门诊项目执行失败!返回消息为空!");
                                    }
                                    else
                                    {
                                        if (debug == "1")
                                        {
                                            log.WriteMyLog(rtn_xml);
                                        }

                                        XmlNode     xmlok_DATA = null;
                                        XmlDocument xd2        = new XmlDocument();
                                        try
                                        {
                                            xd2.LoadXml(rtn_xml);
                                            xmlok_DATA = xd2.SelectSingleNode("/Response");
                                            string ResultCode = xmlok_DATA["ResultCode"].InnerText.Trim();
                                            string ErrorMsg   = xmlok_DATA["ErrorMsg"].InnerText.Trim();

                                            if (ResultCode != "0")
                                            {
                                                log.WriteMyLog("门诊取项目执行失败:" + ErrorMsg);
                                                //  MessageBox.Show("门诊项目执行失败:" + ErrorMsg);
                                            }
                                            else
                                            {
                                                aa.ExecuteSQL("update  T_JCXX  set F_HXBJ='1'  where F_BLH='" + blh + "'");
                                                if (debug == "1")
                                                {
                                                    log.WriteMyLog("门诊项目执行成功:" + ErrorMsg);
                                                }
                                            }
                                        }
                                        catch (Exception xmlok_e)
                                        {
                                            // MessageBox.Show("门诊项目执行失败:解析DATA异常");
                                            log.WriteMyLog("解析DATA异常:" + xmlok_e.Message + "\r\n" + rtn_xml);
                                        }
                                    }
                                }
                                catch (Exception ee)
                                {
                                    //     MessageBox.Show("门诊项目执行失败:" + ee.Message);
                                    log.WriteMyLog("门诊项目执行失败:连接WebService服务异常:" + ee.Message + "\r\n");
                                }
                            }
                        }
                    }
                }

                #endregion
            }

            if (bgzt == "已审核" || bgzt == "取消审核")
            {
                string    bgzt2 = "";
                DataTable dt_bd = new DataTable();
                DataTable dt_bc = new DataTable();
                try
                {
                    if (bglx.ToLower().Trim() == "bd")
                    {
                        dt_bd = aa.GetDataTable("select * from T_BDBG where F_BLH='" + blh + "' and  F_BD_BGXH='" + bgxh + "'", "bd");
                        bgzt2 = dt_bd.Rows[0]["F_BD_BGZT"].ToString();
                    }

                    if (bglx.ToLower().Trim() == "bc")
                    {
                        dt_bc = aa.GetDataTable("select * from T_BCBG where F_BLH='" + blh + "' and  F_BC_BGXH='" + bgxh + "'", "bc");
                        bgzt2 = dt_bc.Rows[0]["F_BC_BGZT"].ToString();
                    }
                    if (bglx.ToLower().Trim() == "cg")
                    {
                        // DataTable jcxx2 = aa.GetDataTable("select * from T_jcxx where F_blh='" + blh + "'", "jcxx");
                        bgzt2 = jcxx.Rows[0]["F_BGZT"].ToString();
                    }
                }
                catch
                {
                }

                if (bgzt2.Trim() == "")
                {
                    log.WriteMyLog("报告状态为空!不处理!" + blh + "^" + bglx + "^" + bgxh);
                }

                if (bgzt2.Trim() == "已审核" && bgzt != "取消审核")
                {
                    //////////////////////生成pdf**********************************************************
                    string jpgname = "";
                    string ML      = DateTime.Parse(jcxx.Rows[0]["F_SDRQ"].ToString()).ToString("yyyyMM");
                    if (f.ReadString("savetohis", "ispdf", "1").Replace("\0", "").Trim() == "1")
                    {
                        #region  生成pdf

                        string    message = "";
                        ZgqPDFJPG zgq     = new ZgqPDFJPG();
                        if (debug == "1")
                        {
                            log.WriteMyLog("开始生成PDF。。。");
                        }
                        bool isrtn = zgq.CreatePDF(blh, bglx, bgxh, ZgqPDFJPG.Type.PDF, ref
                                                   message, ref jpgname);

                        string xy = "3";
                        if (isrtn)
                        {
                            if (File.Exists(jpgname))
                            {
                                bool ssa = zgq.UpPDF(blh, jpgname, ML, ref message, int.Parse(xy));
                                if (ssa == true)
                                {
                                    if (debug == "1")
                                    {
                                        log.WriteMyLog("上传PDF成功");
                                    }

                                    jpgname = jpgname.Substring(jpgname.LastIndexOf('\\') + 1);
                                    ZgqClass.BGHJ(blh, "JK", "审核", "上传PDF成功:" + ML + "\\" + blh + "\\" + jpgname, "ZGQJK", "上传PDF");

                                    aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");
                                    aa.ExecuteSQL("insert  into T_BG_PDF(F_BLH,F_BGLX,F_BGXH,F_ML,F_FILENAME) values('" + blh + "','" + bglx + "','" + bgxh + "','" + ML + "\\" + blh + "','" + jpgname + "')");
                                    aa.ExecuteSQL("update T_JCXX_FS set F_bz='上传PDF成功',F_FSZT='已处理'  where F_blh='" + blh + "' and F_BGLX='" + bglx.ToLower() + "' and F_BGXH='" + bgxh + "'");
                                }
                                else
                                {
                                    log.WriteMyLog("上传PDF失败:" + message);
                                    ZgqClass.BGHJ(blh, "JK", "审核", message, "ZGQJK", "上传PDF");
                                    aa.ExecuteSQL("update T_JCXX_FS set F_ISPDF='false',F_bz='上传PDF失败:" + message + "'  where F_blh='" + blh + "' and F_BGLX='" + bglx + "' and F_BGXH='" + bgxh + "'");
                                }
                            }
                            else
                            {
                                log.WriteMyLog("生成PDF失败:未找到文件---" + jpgname);
                                ZgqClass.BGHJ(blh, "JK", "审核", "上传PDF失败:未找到文件---" + jpgname, "ZGQJK", "生成PDF");
                                aa.ExecuteSQL("update T_JCXX_FS set F_ISPDF='false',F_bz='上传PDF失败:未找到文件---" + jpgname + "'  where F_blh='" + blh + "' and F_BGLX='" + bglx + "' and F_BGXH='" + bgxh + "'");
                            }
                        }
                        else
                        {
                            log.WriteMyLog("生成PDF失败:" + message);
                            ZgqClass.BGHJ(blh, "JK", "审核", message, "ZGQJK", "生成PDF");
                            aa.ExecuteSQL("update T_JCXX_FS set F_ISPDF='false',F_bz='生成PDF失败:" + message + "'  where F_blh='" + blh + "' and F_BGLX='" + bglx + "' and F_BGXH='" + bgxh + "'");
                        }
                        zgq.DelTempFile(blh);
                        #endregion
                    }

                    //////////////////////*****************************************************************
                }
                else
                {
                    if (bgzt == "取消审核")
                    {
                        DataTable dt2 = aa.GetDataTable("select top 1 * from T_BG_PDF where F_blh='" + blh + "'  and F_BGXH='" + bgxh + "' and F_BGLX='" + bglx + "'", "dt2");
                        if (dt2.Rows.Count <= 0)
                        {
                            aa.ExecuteSQL("update T_jcxx_fs set  F_fszt='已处理',F_bz='取消审核成功!' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "'  and F_fszt='未处理' and F_bgzt='" + bgzt + "'");
                        }
                        else
                        {
                            aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");
                            aa.ExecuteSQL("update T_JCXX_FS set F_bz='取消审核,删除PDF成功!',F_FSZT='已处理'  where F_blh='" + blh + "' and F_BGLX='" + bglx.ToLower() + "' and F_BGXH='" + bgxh + "' and F_bgzt='取消审核'");
                        }

                        #region  报告回收
                        #endregion
                    }
                    else
                    {
                        aa.ExecuteSQL("update T_jcxx_fs set F_bz='不处理,状态" + bgzt + "' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "' and F_fszt='未处理' and F_bgzt='取消审核'");
                    }
                }
            }
        }
예제 #11
0
        //  string msg = ""; string debug = "";
        public void pathtohis(string blh, string bglx, string bgxh, string msg, string debug, string[] cslb)
        {
            string jkmsg = f.ReadString("jkmsg", "jkmsg", "0").Replace("\0", "");

            f.WriteInteger("jkmsg", "jkmsg", 0);

            bglx = bglx.ToLower();
            if (bglx.ToLower().Trim() == "bd")
            {
                return;
            }



            debug = f.ReadString("savetohis", "debug", "0");
            msg   = f.ReadString("savetohis", "msg", "0");

            dbbase.odbcdb aa   = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");
            DataTable     jcxx = new DataTable();

            try
            {
                jcxx = aa.GetDataTable("select * from T_jcxx where F_blh='" + blh + "'", "jcxx");
            }
            catch (Exception ex)
            {
                MessageBox.Show(blh + "," + ex.Message);
                return;
            }
            if (jcxx == null)
            {
                MessageBox.Show(blh + ",病理数据库设置有问题!");
                return;
            }
            if (jcxx.Rows.Count < 1)
            {
                MessageBox.Show(blh + ",病理号有错误!");
                return;
            }
            string qxsh = "";


            if (cslb.Length == 5)
            {
                if (cslb[4].ToLower() == "qxsh")
                {
                    qxsh = "1";//取消审核动作
                }
            }

            if (bglx == "")
            {
                bglx = "cg";
            }

            if (bgxh == "")
            {
                bgxh = "0";
            }

            string bgzt = jcxx.Rows[0]["F_BGZT"].ToString().Trim();

            try
            {
                if (bglx.ToLower().Trim() == "bd")
                {
                    DataTable dt_bd = aa.GetDataTable("select * from T_BDBG where F_BLH='" + blh + "' and  F_BD_BGXH='" + bgxh + "'", "bd");
                    bgzt = dt_bd.Rows[0]["F_BD_BGZT"].ToString();
                }
                if (bglx.ToLower().Trim() == "bc")
                {
                    DataTable dt_bc = aa.GetDataTable("select * from T_BCBG where F_BLH='" + blh + "' and  F_BC_BGXH='" + bgxh + "'", "bc");
                    bgzt = dt_bc.Rows[0]["F_BC_BGZT"].ToString();
                }
            }
            catch
            {
            }



            if (qxsh == "1")
            {
                bgzt = "取消审核";
            }

            if (bgzt != "取消审核" && bgzt != "已审核" && bglx == "cg")
            {
                return;
            }



            if (bgzt.Trim() == "")
            {
                log.WriteMyLog("报告状态为空!不处理!" + blh + "^" + bglx + "^" + bgxh); return;
            }


            if (bgzt != "取消审核" && bgzt != "已审核")
            {
                return;
            }



            if (bgzt.Trim() == "已审核")
            {
                string    ML = DateTime.Parse(jcxx.Rows[0]["F_SDRQ"].ToString()).ToString("yyyyMM");
                string    message = ""; string jpgname = "";
                ZgqPDFJPG zgq   = new ZgqPDFJPG();
                bool      isrtn = zgq.CreatePDF(blh, bglx, bgxh, ZgqPDFJPG.Type.PDF, ref jpgname, "", ref message);

                string xy = "3";// ZgqClass.GetSz("ZGQJK", "sctxfs", "3");
                if (isrtn)
                {
                    bool ssa = zgq.UpPDF(blh, jpgname, ML, ref message, int.Parse(xy));
                    if (ssa == true)
                    {
                        jpgname = jpgname.Substring(jpgname.LastIndexOf('\\') + 1);
                        ZgqClass.BGHJ(blh, "批量上传", "审核", "生成PDF成功:" + ML + "\\" + jpgname, "ZGQJK", "生成PDF");


                        aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");
                        aa.ExecuteSQL("insert  into T_BG_PDF(F_BLH,F_BGLX,F_BGXH,F_ML,F_FILENAME) values('" + blh + "','" + bglx + "','" + bgxh + "','" + ML + "','" + jpgname + "')");
                        aa.ExecuteSQL("update T_JCXX_FS set F_BZ='',F_FSZT='已处理'  where F_blh='" + blh + "' and F_BGLX='" + bglx.ToLower() + "' and F_BGXH='" + bgxh + "'");

                        if (jkmsg == "1")
                        {
                            MessageBox.Show(blh + ",上传PDF成功");
                        }
                    }
                    else
                    {
                        if (msg == "1" || jkmsg == "1")
                        {
                            MessageBox.Show(blh + ",上传PDF失败,请重新审核!\r\n异常消息:" + message);
                        }

                        log.WriteMyLog(message);
                        ZgqClass.BGHJ(blh, "批量上传", "审核", message, "ZGQJK", "生成PDF");
                        aa.ExecuteSQL("update T_JCXX_FS set F_ISPDF='false',F_BZ='" + message + "',F_FSZT='未处理'  where F_blh='" + blh + "' and F_BGLX='" + bglx + "' and F_BGXH='" + bgxh + "'");
                    }
                    zgq.DelTempFile(blh);
                }
                else
                {
                    if (msg == "1" || jkmsg == "1")
                    {
                        MessageBox.Show(blh + ",生成PDF失败,请重新审核!\r\n异常消息:" + message);
                    }
                    log.WriteMyLog(message);
                    ZgqClass.BGHJ(blh, "接口", "审核", message, "ZGQJK", "生成PDF");
                    aa.ExecuteSQL("update T_JCXX_FS set F_ISPDF='false',F_BZ='" + message + "',F_FSZT='未处理'  where F_blh='" + blh + "' and F_BGLX='" + bglx + "' and F_BGXH='" + bgxh + "'");
                    zgq.DelTempFile(blh);
                }
                return;
            }
            else
            {
                if (bgzt == "取消审核")
                {
                    //删除T_BG_PDF记录
                    DataTable dt2 = aa.GetDataTable("select top 1 * from T_BG_PDF where F_blh='" + blh + "'  and F_BGXH='" + bgxh + "' and F_BGLX='" + bglx + "'", "dt2");
                    if (dt2.Rows.Count > 0)
                    {
                        aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");
                        //删除ftp上pdf文件
                        ZgqPDFJPG zgq     = new ZgqPDFJPG();
                        string    rtn_msg = "";
                        zgq.DelPDFFile(dt2.Rows[0]["F_ML"].ToString(), dt2.Rows[0]["F_FILENAME"].ToString(), ref rtn_msg);
                    }
                    else
                    {
                        log.WriteMyLog(blh + ",T_BG_PDF中未能找到记录");
                    }
                    aa.ExecuteSQL("update T_JCXX_FS set F_BZ='',F_FSZT='已处理',F_ISPDF=''  where F_blh='" + blh + "' and F_BGLX='" + bglx.ToLower() + "' and F_BGXH='" + bgxh + "'");
                }
            }
            return;
        }
예제 #12
0
        public void pathtohis(string F_blh, string bglx, string bgxh, string czlb, string dz, string msg, string debug)
        {
            string qxsh = "";
            string xdj  = "";

            bglx = bglx.ToLower();
            try
            {
                //审核后上传报告
                string shhscbg = f.ReadString("savetohis", "shhscbg", "1").Replace("\0", "");
                int    yssj    = f.ReadInteger("savetohis", "yssj", 8);
                if (bglx == "")
                {
                    bglx = "cg";
                }

                if (bgxh == "")
                {
                    bgxh = "1";
                }

                dbbase.odbcdb aa   = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");
                DataTable     bljc = new DataTable();
                try
                {
                    bljc = aa.GetDataTable("select * from T_jcxx where F_blh='" + F_blh + "'", "jcxx");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                    return;
                }
                if (bljc == null)
                {
                    MessageBox.Show("病理数据库设置有问题!");
                    return;
                }
                if (bljc.Rows.Count < 1)
                {
                    MessageBox.Show("病理号有错误!");
                    return;
                }

                string bgzt = "";
                if (dz == "qxsh")
                {
                    bgzt = "取消审核";
                }
                else
                {
                    bgzt = bljc.Rows[0]["F_BGZT"].ToString();
                }

                if (bljc.Rows[0]["F_ZYH"].ToString().Trim() == "" && bljc.Rows[0]["F_MZH"].ToString().Trim() == "")
                {
                    log.WriteMyLog("住院号和门诊号为空,不处理");
                    aa.ExecuteSQL("update T_jcxx_fs set F_fszt='不处理',F_BZ='住院号和门诊号为空,不处理' where F_blh='" + F_blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "' and F_fszt='未处理'");
                    return;
                }

                bool   issc  = false;
                string ftplj = "";
                if (shhscbg == "1")
                {
                    if (bgzt == "已审核" && bljc.Rows[0]["F_SFDY"].ToString().Trim() == "是")
                    {
                        issc = true;
                    }
                }

                //修改已发布状态
                if (bgzt == "已审核" && bljc.Rows[0]["F_SFDY"].ToString().Trim() == "是")
                {
                    if (bglx == "cg")
                    {
                        try
                        {
                            if (DateTime.Parse(bljc.Rows[0]["F_spare5"].ToString().Trim()).AddHours(yssj) <= DateTime.Now)
                            {
                                aa.ExecuteSQL("update T_JCXX  set F_BGZT='已发布'  where F_BLH='" + F_blh + "'");
                            }
                            else
                            {
                                issc = false;
                            }
                        }
                        catch
                        {
                        }
                    }
                }

                bool pdftoyxpt = false;
                #region  生成并上传pdf到服务器

                if (bgzt == "已发布" || issc)
                {
                    try
                    {
                        string    bgzt2 = "";
                        DataTable dt_bd = new DataTable();
                        DataTable dt_bc = new DataTable();
                        try
                        {
                            if (bglx.ToLower().Trim() == "bd")
                            {
                                dt_bd = aa.GetDataTable("select * from T_BDBG where F_BLH='" + F_blh + "' and  F_BD_BGXH='" + bgxh + "'", "bd");
                                bgzt2 = dt_bd.Rows[0]["F_BD_BGZT"].ToString();
                            }

                            if (bglx.ToLower().Trim() == "bc")
                            {
                                dt_bc = aa.GetDataTable("select * from T_BCBG where F_BLH='" + F_blh + "' and  F_BC_BGXH='" + bgxh + "'", "bc");
                                bgzt2 = dt_bc.Rows[0]["F_BC_BGZT"].ToString();
                            }
                            if (bglx.ToLower().Trim() == "cg")
                            {
                                bgzt2 = bljc.Rows[0]["F_BGZT"].ToString();
                            }
                        }
                        catch
                        {
                        }

                        if (bgzt2.Trim() == "")
                        {
                            log.WriteMyLog("报告状态为空!不处理!" + F_blh + "^" + bglx + "^" + bgxh);
                        }

                        if ((bgzt2.Trim() == "已发布" || issc) && bgzt != "取消审核")
                        {
                            ////////生成pdf**********************************************************
                            string jpgname = "";
                            string ML      = DateTime.Parse(bljc.Rows[0]["F_SDRQ"].ToString()).ToString("yyyyMM");
                            if (f.ReadString("savetohis", "ispdf", "1").Replace("\0", "").Trim() == "1")
                            {
                                #region  生成pdf
                                string    message = "";
                                ZgqPDFJPG zgq     = new ZgqPDFJPG();
                                if (debug == "1")
                                {
                                    log.WriteMyLog("开始生成PDF。。。");
                                }
                                bool isrtn = zgq.CreatePDF(F_blh, bglx, bgxh, ZgqPDFJPG.Type.PDF, ref jpgname, ref message);

                                string pdfpath = "";
                                if (isrtn)
                                {
                                    if (File.Exists(jpgname))
                                    {
                                        //上传病理服务器
                                        bool ssa = zgq.UpPDF(F_blh, jpgname, ML, ref message, 3, ref pdfpath);
                                        if (ssa == true)
                                        {
                                            if (debug == "1")
                                            {
                                                log.WriteMyLog("上传PDF成功");
                                            }

                                            string jpgname2 = jpgname.Substring(jpgname.LastIndexOf('\\') + 1);
                                            ZgqClass.BGHJ(F_blh, "JK", "审核", "上传PDF成功:" + pdfpath, "ZGQJK", "上传PDF");

                                            aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + F_blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");
                                            aa.ExecuteSQL("insert  into T_BG_PDF(F_BLH,F_BGLX,F_BGXH,F_ML,F_FILENAME) values('" + F_blh + "','" + bglx + "','" + bgxh + "','" + ML + "\\" + F_blh + "','" + jpgname2 + "')");
                                            aa.ExecuteSQL("update T_jcxx_fs set F_fszt='已处理',F_ispdf='true' where F_blh='" + F_blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "' ");
                                        }
                                        else
                                        {
                                            if (msg == "1")
                                            {
                                                MessageBox.Show("上传PDF失败:" + message);
                                            }
                                            log.WriteMyLog("上传PDF失败:" + message);
                                            ZgqClass.BGHJ(F_blh, "JK", "审核", message, "ZGQJK", "上传PDF");
                                            //   aa.ExecuteSQL("update T_JCXX_FS set F_ISPDF='false',F_bz='上传PDF失败:" + message + "'  where F_blh='" + blh + "' and F_BGLX='" + bglx + "' and F_BGXH='" + bgxh + "'");
                                        }

                                        //上传服务器

                                        //string ftpml = DateTime.Now.ToString("yyyyMMdd");
                                        //bool status = false;
                                        //for (int y = 0; y < 3; y++)
                                        //{
                                        //    status = zgq.UpPDF("", jpgname, ftpml, ref message, 4);
                                        //    if (status)
                                        //        break;
                                        //}
                                        //if (status)
                                        //{
                                        //    pdftoyxpt = true;
                                        //    FileInfo fi = new FileInfo(jpgname);
                                        //    ftplj = "PIS" + "//" + ftpml + "//" + fi.Name;
                                        //    log.WriteMyLog("ftp上传成功,上传路径:" + ftplj);
                                        //}
                                    }
                                    else
                                    {
                                        if (msg == "1")
                                        {
                                            MessageBox.Show("生成PDF失败:未找到文件---" + jpgname);
                                        }
                                        log.WriteMyLog("生成PDF失败:未找到文件---" + jpgname);
                                        ZgqClass.BGHJ(F_blh, "JK", "审核", "上传PDF失败:未找到文件---" + jpgname, "ZGQJK", "生成PDF");
                                    }
                                }
                                else
                                {
                                    if (msg == "1")
                                    {
                                        MessageBox.Show("生成PDF失败:" + message);
                                    }
                                    log.WriteMyLog("生成PDF失败:" + message);
                                    ZgqClass.BGHJ(F_blh, "JK", "审核", message, "ZGQJK", "生成PDF");
                                    // aa.ExecuteSQL("update T_JCXX_FS set F_ISPDF='false',F_bz='生成PDF失败:" + message + "'  where F_blh='" + blh + "' and F_BGLX='" + bglx + "' and F_BGXH='" + bgxh + "'");
                                }
                                zgq.DelTempFile(F_blh);
                                #endregion
                            }
                            //////////////////////*****************************************************************
                        }
                        else
                        {
                            if (bgzt == "取消审核")
                            {
                                aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + F_blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");
                            }
                        }
                    }
                    catch (Exception ee3)
                    {
                        log.WriteMyLog(ee3.Message);
                    }
                }
                #endregion


                if (bglx != "cg")//只传常规报告
                {
                    aa.ExecuteSQL("update T_jcxx_fs set F_fszt='不处理'  F_bz='非常规报告' where F_blh='" + F_blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "' and F_fszt='未处理'");
                    return;
                }
            }
            catch (Exception ee)
            {
                log.WriteMyLog(ee.Message);
            }

            return;
        }
예제 #13
0
        public void fj2yhis(string blh, string yymc)
        {
            string bglx = "cg";
            string bgxh = "0";

            string CZY   = f.ReadString("yh", "yhmc", "").Replace("\0", "").Trim();
            string CZYGH = f.ReadString("yh", "yhbh", "").Replace("\0", "").Trim();
            int    ljfs  = f.ReadInteger("savetohis", "ljfs", 1);
            string debug = f.ReadString("savetohis", "debug", "").Replace("\0", "").Trim();

            string msg   = f.ReadString("savetohis", "msg", "").Replace("\0", "").Trim();
            string wsurl = f.ReadString("savetohis", "wsurl", "").Replace("\0", "").Trim();

            string brlb = "";

            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() != "已审核")
            {
                return;
            }
            if (bljc.Rows[0]["F_sqxh"].ToString().Trim() == "")
            {
                log.WriteMyLog("无申请序号(单据号),不处理!");
                ZgqClass.BGHJ(blh, CZY, "保存", "无申请序号(单据号),不处理!", "ZGQJK", "");

                aa.ExecuteSQL("update T_JCXX_FS set F_BZ='无申请序号(单据号),不处理',F_FSZT='不处理'  where F_blh='" + blh + "' and F_BGLX='" + bglx.ToLower() + "' and F_BGXH='" + bgxh + "'");
                return;
            }
            if (bljc.Rows[0]["F_brbh"].ToString().Trim() == "")
            {
                log.WriteMyLog("无病人编号,不处理!");
                ZgqClass.BGHJ(blh, CZY, "保存", "无病人编号,不处理!", "ZGQJK", "");
                aa.ExecuteSQL("update T_JCXX_FS set F_BZ='无病人编号,不处理',F_FSZT='不处理'  where F_blh='" + blh + "' and F_BGLX='" + bglx.ToLower() + "' and F_BGXH='" + bgxh + "'");

                return;
            }
            if (bljc.Rows[0]["F_brlb"].ToString().Trim() == "住院")
            {
                brlb = "IN";
            }
            if (bljc.Rows[0]["F_brlb"].ToString().Trim() == "门诊")
            {
                brlb = "OU";
            }
            if (brlb == "")
            {
                log.WriteMyLog("非住院或门诊病人,不处理!");
                ZgqClass.BGHJ(blh, CZY, "保存", "非住院或门诊病人,不处理!", "ZGQJK", "");
                aa.ExecuteSQL("update T_JCXX_FS set F_BZ='非住院或门诊病人,不处理',F_FSZT='不处理'  where F_blh='" + blh + "' and F_BGLX='" + bglx.ToLower() + "' and F_BGXH='" + bgxh + "'");

                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", "");
            //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 ftpserver2 = f.ReadString("ftpup", "ftpip", "").Replace("\0", "");
            //string ftpuser2 = f.ReadString("ftpup", "user", "ftpuser").Replace("\0", "");
            //string ftppwd2 = f.ReadString("ftpup", "pwd", "ftp").Replace("\0", "");
            //string ftplocal2 = f.ReadString("ftpup", "ftplocal", "c:\\temp").Replace("\0", "");
            //string ftpremotepath2 = f.ReadString("ftpup", "ftpremotepath", "").Replace("\0", "");
            //string ftps2 = f.ReadString("ftp", "ftp", "").Replace("\0", "");
            //FtpWeb fwup = new FtpWeb(ftpserver2, ftpremotepath2, ftpuser2, ftppwd2);

            string    txml   = bljc.Rows[0]["F_txml"].ToString().Trim();
            string    bcbg   = "\r\n";
            DataTable bcbgtb = aa.GetDataTable("select * from T_bcbg where F_blh='" + blh + "' and F_bc_bgzt='已审核'", "bcbg");

            for (int i = 0; i < bcbgtb.Rows.Count; i++)
            {
                bcbg = bcbg + "[补充报告" + bcbgtb.Rows[i]["F_bc_bgxh"].ToString().Trim() + "]" + bcbgtb.Rows[i]["F_bczd"].ToString().Trim() + "\r\n";
            }
            DataTable txlb = aa.GetDataTable("select top 4 * from V_dytx where F_blh='" + blh + "'", "txlb");
            DataTable TBS  = aa.GetDataTable("select * from T_tbs_bg where F_blh='" + blh + "'", "tbs");

            string stxsm = "";


            //Im

            string inxml = "<?xml version=" + (char)34 + "1.0" + (char)34 + " encoding=" + (char)34 + "GB2312" + (char)34 + " standalone=" + (char)34 + "yes" + (char)34 + "?>";

            inxml = inxml + "<ExamList>";
            inxml = inxml + "<XmlDocument>";
            inxml = inxml + "<Header>";
            inxml = inxml + "<Application>" + "BL" + "</Application>";
            inxml = inxml + "<CreateTime>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_bgrq"].ToString().Trim()) + " 00:00:00</CreateTime>";
            inxml = inxml + "<VersionID>1,0,0,3</VersionID>";
            inxml = inxml + "</Header>";

            inxml = inxml + "<Event>";
            inxml = inxml + "<Code>C</Code>";
            inxml = inxml + "<Desc>病理报告</Desc>";
            inxml = inxml + "<Operator>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_bgys"].ToString().Trim()) + "</Operator>";
            inxml = inxml + "<UniqueID>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_BLH"].ToString().Trim()) + "</UniqueID>";
            inxml = inxml + "</Event>";

            inxml = inxml + "<Patient>";
            inxml = inxml + "<CardNo></CardNo>";
            inxml = inxml + "<SiCard>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_yzid"].ToString().Trim()) + "</SiCard>";
            inxml = inxml + "<MiCard>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_yzid"].ToString().Trim()) + "</MiCard>";
            inxml = inxml + "<SickNo>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_brbh"].ToString().Trim()) + "</SickNo>";
            inxml = inxml + "<PatientClass  code=" + brlb + ">" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_brlb"].ToString().Trim()) + "</PatientClass>";
            inxml = inxml + "<InPatientNo>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_zyh"].ToString().Trim()) + "</InPatientNo>";
            inxml = inxml + "<VisitID></VisitID>";
            inxml = inxml + "<OutPatientNo>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_mzh"].ToString().Trim()) + "</OutPatientNo>";
            inxml = inxml + "<PatientName>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_xm"].ToString().Trim()) + "</PatientName>";
            inxml = inxml + "<Phoneticize></Phoneticize>";
            inxml = inxml + "<BirthDate></BirthDate>";
            inxml = inxml + "<Age>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_nl"].ToString().Trim()) + "</Age>";
            inxml = inxml + "<Height></Height>";
            inxml = inxml + "<Weight></Weight>";
            inxml = inxml + "<BedNo>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_ch"].ToString().Trim()) + "</BedNo>";
            inxml = inxml + "<NativePlace></NativePlace>";
            inxml = inxml + "<Nationality></Nationality>";
            inxml = inxml + "<Sex>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_xb"].ToString().Trim()) + "</Sex>";
            inxml = inxml + "<Nation>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_mz"].ToString().Trim()) + "</Nation>";
            inxml = inxml + "<Address>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_lxxx"].ToString().Trim()) + "</Address>";
            inxml = inxml + "<ZipCode></ZipCode>";
            inxml = inxml + "<PhoneNumber></PhoneNumber>";
            inxml = inxml + "<MaritalStatus>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_hy"].ToString().Trim()) + "</MaritalStatus>";
            inxml = inxml + "<Identity><Type>ID</Type><Name>居民身份证</Name><Number>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_sfzh"].ToString().Trim()) + "</Number></Identity>";
            inxml = inxml + "<Memo></Memo>";
            inxml = inxml + "<Degree></Degree>";
            inxml = inxml + "<ChargeType></ChargeType>";

            inxml = inxml + "</Patient>";

            inxml = inxml + "<Exam>";

            inxml = inxml + "<HospitalName></HospitalName>";

            inxml = inxml + " <MasterID>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_blh"].ToString().Trim()) + "</MasterID>";

            inxml = inxml + "<ApplyNo>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_SQXH"].ToString().Trim()) + "</ApplyNo>";
            inxml = inxml + "<PatientID>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_blh"].ToString().Trim()) + "</PatientID>";
            inxml = inxml + "<OutRegNo></OutRegNo>";
            inxml = inxml + "<ExamStatus code=\"70\">确认报告</ExamStatus>";
            inxml = inxml + "<ExamTime>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_bgrq"].ToString().Trim()) + " 00:00:00</ExamTime>";
            inxml = inxml + "<ExamClass>病理</ExamClass>";
            inxml = inxml + "<ExamSubClass>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_blk"].ToString().Trim()) + "</ExamSubClass>";
            inxml = inxml + "<ExamItem>";
            inxml = inxml + "<Item code=" + (char)34 + (char)34 + " Cost=" + (char)34 + (char)34 + " Charge=" + (char)34 + (char)34 + " OrderNo=" + (char)34 + (char)34 + ">" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_yzxm"].ToString().Trim()) + "</Item>";
            inxml = inxml + "</ExamItem>";
            inxml = inxml + "<ExamOrgan><Organ>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_bbmc"].ToString().Trim()) + "</Organ></ExamOrgan>";
            inxml = inxml + "<Device></Device>";
            inxml = inxml + "<ExamGroup></ExamGroup>";
            inxml = inxml + "<PerformDept>病理科</PerformDept>";
            inxml = inxml + "<Technican>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_bgys"].ToString().Trim()) + "</Technican>";
            inxml = inxml + "<ExamDuration></ExamDuration>";
            inxml = inxml + "<ReqHospital></ReqHospital>";
            inxml = inxml + "<Regisiter>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_JSY"].ToString().Trim()) + "</Regisiter>";
            inxml = inxml + "<ReqDept>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_sjks"].ToString().Trim()) + "</ReqDept>";
            inxml = inxml + "<ReqWard>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_bq"].ToString().Trim()) + "</ReqWard>";
            inxml = inxml + "<ReqPhysician>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_sjys"].ToString().Trim()) + "</ReqPhysician>";
            inxml = inxml + "<ScheduledTime>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_sdrq"].ToString().Trim()) + " 00:00:00</ScheduledTime>";
            inxml = inxml + "<ReqTime>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_sdrq"].ToString().Trim()) + " 00:00:00</ReqTime>";
            inxml = inxml + "<PhysSign></PhysSign>";
            inxml = inxml + "<ClinSymp></ClinSymp>";
            inxml = inxml + "<ClinDiag>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_lczd"].ToString().Trim()) + "</ClinDiag>";
            inxml = inxml + "<Revisit></Revisit>";
            inxml = inxml + "<Charge></Charge>";
            inxml = inxml + "<Cost></Cost>";
            inxml = inxml + "<ChargeFlag></ChargeFlag>";
            inxml = inxml + "<Memo></Memo>";
            inxml = inxml + "<ExamRecord></ExamRecord>";
            inxml = inxml + "<Revisit></Revisit>";
            inxml = inxml + "<StudyUID></StudyUID>";
            inxml = inxml + "<AccessionNo></AccessionNo>";
            inxml = inxml + "</Exam>";

            inxml = inxml + "<Report>";
            if (bljc.Rows[0]["F_blk"].ToString().Trim().ToUpper() == "TCT")
            {
                if (TBS.Rows.Count < 0)
                {
                    log.WriteMyLog(bljc.Rows[0]["F_blh"].ToString() + "此TCT报告无结构化报告内容!");
                }
                else
                {
                    inxml = inxml + "<GMReport>";
                    inxml = inxml + "<SampleQuality>" + System.Security.SecurityElement.Escape(TBS.Rows[0]["F_TBS_BBMYD"].ToString().Trim()) + "</SampleQuality>";
                    inxml = inxml + "<CellCount>" + System.Security.SecurityElement.Escape(TBS.Rows[0]["F_TBS_XBL"].ToString().Trim()) + "</CellCount>";
                    inxml = inxml + "<CellItemOne>" + System.Security.SecurityElement.Escape(TBS.Rows[0]["F_TBS_XBXM1"].ToString().Trim()) + "</CellItemOne>";
                    inxml = inxml + "<CellItemTwo>" + System.Security.SecurityElement.Escape(TBS.Rows[0]["F_TBS_XBXM2"].ToString().Trim()) + "</CellItemTwo>";
                    inxml = inxml + "<AnimalculeOne>" + System.Security.SecurityElement.Escape(TBS.Rows[0]["F_TBS_WSW1"].ToString().Trim()) + "</AnimalculeOne>";
                    inxml = inxml + "<AnimalculeTwo>" + System.Security.SecurityElement.Escape(TBS.Rows[0]["F_TBS_WSW2"].ToString().Trim()) + "</AnimalculeTwo>";
                    inxml = inxml + "<AnimalculeThree>" + System.Security.SecurityElement.Escape(TBS.Rows[0]["F_TBS_WSW3"].ToString().Trim()) + "</AnimalculeThree>";
                    inxml = inxml + "<VirusItemOne>" + System.Security.SecurityElement.Escape(TBS.Rows[0]["F_TBS_BDXM1"].ToString().Trim()) + "</VirusItemOne>";
                    inxml = inxml + "<Inflammation>" + System.Security.SecurityElement.Escape(TBS.Rows[0]["F_TBS_YZCD"].ToString().Trim()) + "</Inflammation>";
                    inxml = inxml + "<Erythrocyte>" + System.Security.SecurityElement.Escape(TBS.Rows[0]["F_TBS_HXB"].ToString().Trim()) + "</Erythrocyte>";

                    inxml = inxml + "</GMReport>";
                }
            }
            inxml = inxml + "<ReportNo>1</ReportNo>";
            inxml = inxml + "<Category></Category>";
            inxml = inxml + "<Description>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_rysj"].ToString().Trim()) + "</Description>";
            if (bljc.Rows[0]["F_blk"].ToString().Trim().ToUpper() == "TCT")
            {
                if (TBS.Rows.Count > 0)
                {
                    inxml = inxml + "<Impression>" + System.Security.SecurityElement.Escape(TBS.Rows[0]["F_TBSZD"].ToString().Trim()) + "</Impression>";
                }
            }
            else
            {
                inxml = inxml + "<Impression>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_blzd"].ToString().Trim()) + bcbg + "</Impression>";
            }
            inxml = inxml + "<ExamParam></ExamParam>";
            if (bljc.Rows[0]["F_blk"].ToString().Trim().ToUpper() == "TCT")
            {
                if (TBS.Rows.Count > 0)
                {
                    inxml = inxml + "<Recommendation>" + System.Security.SecurityElement.Escape(TBS.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() + "\r\n" + TBS.Rows[0]["F_TBS_BCYJ2"].ToString().Trim()) + "</Recommendation>";
                }
            }
            else
            {
                inxml = inxml + "<Recommendation></Recommendation>";
            }
            inxml = inxml + "<AbNormalFlag></AbNormalFlag>";
            inxml = inxml + "<Reporter>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_bgys"].ToString().Trim()) + "</Reporter>";
            inxml = inxml + "<ReportTime>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_bgrq"].ToString().Trim()) + " 00:00:00</ReportTime>";
            inxml = inxml + "<MasterReporter>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_shys"].ToString().Trim()) + "</MasterReporter>";
            inxml = inxml + "<MasterTime>" + System.Security.SecurityElement.Escape(bljc.Rows[0]["F_spare5"].ToString().Trim()).Substring(0, 10) + "</MasterTime>";
            inxml = inxml + "<PrintTime></PrintTime>";
            //  <ReportContent Type="PDF">BASE64</ReportContent>
            inxml = inxml + "<ReportImageArray ImageType=\"JPG\">";
            for (int i = 0; i < txlb.Rows.Count; i++)
            {
                inxml = inxml + "<ReportImage>";
                inxml = inxml + "<Path>" + System.Security.SecurityElement.Escape(txlb.Rows[i]["F_txm"].ToString().Trim()) + "</Path>";
                inxml = inxml + "<Pos></Pos>";
                inxml = inxml + "<Desc></Desc>";
                inxml = inxml + "<SopInstanceUID>" + System.Security.SecurityElement.Escape(txlb.Rows[i]["F_ID"].ToString().Trim()) + "</SopInstanceUID>";
                inxml = inxml + "<ImageContent></ImageContent>";
                inxml = inxml + "</ReportImage>";
            }

            inxml = inxml + "</ReportImageArray>";
            inxml = inxml + "</Report>";
            inxml = inxml + "<Study>";

            inxml = inxml + "<ImageType>JPG</ImageType>";
            inxml = inxml + "<ImageCount>" + txlb.Rows.Count + "</ImageCount>";
            inxml = inxml + "<Modality>BL</Modality>";
            inxml = inxml + "<StudyUID></StudyUID>";

            inxml = inxml + "<SerialArray>";
            inxml = inxml + "<SerialInfo description=\"\" uid=\"\" number=\"\">";
            inxml = inxml + "<ImageArray>";
            inxml = inxml + "<ImagePath uid=\"\" number=\"\" KeyFlag=\"\">" + System.Security.SecurityElement.Escape("pathimages\\" + txml) + "</ImagePath>";
            inxml = inxml + "</ImageArray></SerialInfo>";
            inxml = inxml + "</SerialArray>";
            inxml = inxml + "</Study>";

            inxml = inxml + "</XmlDocument>";
            inxml = inxml + "</ExamList>";

            string putcmsg = "<ESBEntry><AccessControl><UserName/><Password/><Fid>BS25018</Fid></AccessControl><MessageHeader><Fid>BS25018</Fid><SourceSysCode>S45</SourceSysCode><TargetSysCode>S04</TargetSysCode><MsgDate>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                             + "</MsgDate></MessageHeader><MsgInfo><Msg><![CDATA[" + inxml + "]]></Msg></MsgInfo></ESBEntry>";

            //给平台发送数据
            string getcmsg = ""; string errmsg = "";

            if (sendxml("BS25018", putcmsg, debug, ljfs, wsurl, ref getcmsg, ref errmsg))
            {
                ZgqClass.BGHJ(blh, CZY, "审核", "上传平台成功", "ZGQJK", "");
                if (msg == "1")
                {
                    MessageBox.Show(getcmsg);
                }

                aa.ExecuteSQL("update T_JCXX_FS set F_BZ='',F_FSZT='已处理'  where F_blh='" + blh + "' and F_BGLX='" + bglx.ToLower() + "' and F_BGXH='" + bgxh + "'");
            }
            else
            {
                ZgqClass.BGHJ(blh, CZY, "审核", "上传平台失败," + errmsg, "ZGQJK", "");
                log.WriteMyLog(errmsg);
                if (msg == "1")
                {
                    MessageBox.Show(errmsg);
                }

                if (getcmsg == "")
                {
                    aa.ExecuteSQL("update T_JCXX_FS set F_BZ='平台返回空',F_FSZT='已处理'  where F_blh='" + blh + "' and F_BGLX='" + bglx.ToLower() + "' and F_BGXH='" + bgxh + "'");
                }
                else
                {
                    aa.ExecuteSQL("update T_JCXX_FS set F_BZ='" + getcmsg + "',F_FSZT='未处理'  where F_blh='" + blh + "' and F_BGLX='" + bglx.ToLower() + "' and F_BGXH='" + bgxh + "'");
                }
            }

            //string ftpstatusUP = "";

            //fwup.Makedir("BL" + blh, out ftpstatusUP);

            //fwup.Makedir("BL" + blh + "/" + "ReportImage", out ftpstatusUP);

            //for (int i = 0; i < txlb.Rows.Count; i++)
            //{
            //    fwup.Upload(ftplocal + "\\" + txlb.Rows[i]["F_txm"].ToString().Trim(), "BL" + blh + "/ReportImage", out ftpstatusUP);
            //    if (ftpstatusUP == "Error")
            //    {
            //        ZgqClass.BGHJ(blh, CZY, "审核", "上传图像Error", "ZGQJK", "");
            //        return;
            //    }
            //}
        }
예제 #14
0
        public void pathtohis(string blh, string yymc)
        {
            string debug = f.ReadString("savetohis", "debug", "");

            dbbase.odbcdb aa   = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");
            DataTable     bljc = new DataTable();

            try
            {
                bljc = aa.GetDataTable("select * from T_jcxx where F_blh='" + blh + "'", "jcxx");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
                return;
            }
            if (bljc == null)
            {
                MessageBox.Show("查询数据库失败");
                return;
            }

            if (bljc.Rows.Count <= 0)
            {
                log.WriteMyLog("JCXX表未查询到数据");
                return;
            }
            if (bljc.Rows[0]["f_brlb"].ToString().Trim() != "体检")
            {
                log.WriteMyLog("非体检病人不处理");
                return;
            }

            string sqxh = bljc.Rows[0]["f_sqxh"].ToString().Trim();

            if (sqxh == "")
            {
                log.WriteMyLog("体检病人无申请序号,不处理");
                return;
            }


            if (bljc.Rows[0]["F_BRLB"].ToString().Trim() == "体检")
            {
                string odbc_tj = f.ReadString("savetohis", "tjodbc", "Data Source=10.27.1.35;Initial Catalog=zonekingnet;User Id=sa;Password=zoneking;").Replace("\0", "").Trim();
                string bglx    = "cg";
                string bgxh    = "1";

                string ML    = DateTime.Parse(bljc.Rows[0]["F_SDRQ"].ToString()).ToString("yyyyMM");
                SqlDB  db_tj = new SqlDB();

                #region  执行存储过程,回写登记状态
                string errMsg = "";
                try
                {
                    if (bljc.Rows[0]["F_TJXTBJ"].ToString().Trim() == null || bljc.Rows[0]["F_TJXTBJ"].ToString().Trim() == "")
                    {
                        SqlParameter[] sqlPt = new SqlParameter[3];

                        for (int j = 0; j < sqlPt.Length; j++)
                        {
                            sqlPt[j] = new SqlParameter();
                        }
                        sqlPt[0].ParameterName = "@Exam_No";
                        sqlPt[0].SqlDbType     = SqlDbType.VarChar;
                        sqlPt[0].Direction     = ParameterDirection.Input;
                        sqlPt[0].Size          = 20;
                        sqlPt[0].Value         = sqxh;

                        sqlPt[1].ParameterName = "@StudyType";
                        sqlPt[1].SqlDbType     = SqlDbType.VarChar;
                        sqlPt[1].Direction     = ParameterDirection.Input;
                        sqlPt[1].Size          = 20;
                        sqlPt[1].Value         = "BL";

                        sqlPt[2].ParameterName = "@StudyState";
                        sqlPt[2].SqlDbType     = SqlDbType.Int;
                        sqlPt[2].Direction     = ParameterDirection.Input;
                        sqlPt[2].Value         = 1;

                        int x = db_tj.ExecuteNonQuery(odbc_tj, "dbo.Pro_pacs_ReqStatus", ref sqlPt, CommandType.StoredProcedure, ref errMsg);
                        if (x > 0)
                        {
                            aa.ExecuteSQL("update T_JCXX  set F_TJXTBJ='1' where F_blh='" + blh + "'");
                        }
                        else
                        {
                        }
                    }
                }
                catch (Exception ee2)
                {
                    log.WriteMyLog("体检申请单确认异常:" + ee2.Message);
                }
                #endregion

                #region  回传体检报告

                if (bljc.Rows[0]["F_bgzt"].ToString().Trim() == "已写报告" && bljc.Rows[0]["F_TJXTBJ"].ToString().Trim() == "2")
                {
                    db_tj.ExecuteNonQuery(odbc_tj, "delete  from T_SYN_ZK_CHECK_BL   where StudyID='" + sqxh + "'", ref errMsg);
                    aa.ExecuteSQL("update T_JCXX  set F_TJXTBJ='1' where F_blh='" + blh + "'");
                    return;
                }
                if (bljc.Rows[0]["F_bgzt"].ToString().Trim() == "已审核")
                {
                    #region 生成jpg
                    ZgqPDFJPG zgq      = new ZgqPDFJPG();
                    string    errmsg   = "";
                    string    filename = "";
                    string    tjtppath = "";
                    bool      isrtn    = zgq.CreatePDF(blh, bglx, bgxh, ZgqPDFJPG.Type.JPG, ref filename, "", ref errmsg);
                    string    xy       = "3";
                    if (isrtn)
                    {
                        //二进制串
                        if (!File.Exists(filename))
                        {
                            ZgqClass.BGHJ(blh, "体检生成JPG", "审核", "生成JPG失败:未找到文件" + filename, "ZGQJK", "生成JPG");
                            log.WriteMyLog("未找到文件" + filename);
                            zgq.DelTempFile(blh);
                            return;
                        }

                        ZgqClass.BGHJ(blh, "体检生成JPG", "审核", "生成JPG成功", "ZGQJK", "生成JPG");
                        string pdfpath = "";
                        bool   ssa     = zgq.UpPDF(blh, filename, ML, ref errmsg, 4, ref pdfpath);

                        // zgq.UpPDF(blh, filename, ML, ref errmsg, 3, ref pdfpath);
                        if (ssa == true)
                        {
                            if (debug == "1")
                            {
                                log.WriteMyLog("上传JPG成功");
                            }
                            filename = filename.Substring(filename.LastIndexOf('\\') + 1);
                            ZgqClass.BGHJ(blh, "上传JPG", "审核", "上传JPG成功:" + pdfpath, "ZGQJK", "上传JPG");
                            tjtppath = pdfpath.Substring(pdfpath.IndexOf("/", 8));
                        }
                        else
                        {
                            log.WriteMyLog("上传JPG失败:" + errmsg);
                            ZgqClass.BGHJ(blh, "上传JPG", "审核", "上传JPG失败:" + errmsg, "ZGQJK", "上传JPG");
                            zgq.DelTempFile(blh);
                            return;
                        }
                    }
                    else
                    {
                        log.WriteMyLog("体检生成JPG失败:" + errmsg);
                        ZgqClass.BGHJ(blh, "生成JPG", "审核", "生成JPG失败:" + errmsg, "ZGQJK", "生成JPG");
                        zgq.DelTempFile(blh);
                        return;
                    }

                    #endregion

                    DataTable dt_tj = new DataTable();
                    dt_tj = db_tj.DataAdapter(odbc_tj, "select * from T_SYN_ZK_CHECK_BL   where StudyID='" + sqxh + "'", ref errMsg);
                    if (errMsg != "")
                    {
                        log.WriteMyLog(errMsg);
                    }

                    string blzd = bljc.Rows[0]["F_BLZD"].ToString().Trim() + "\r\n" + bljc.Rows[0]["F_TSJC"].ToString().Trim();
                    string rysj = bljc.Rows[0]["F_rysj"].ToString().Trim() + "\r\n" + bljc.Rows[0]["F_JXSJ"].ToString().Trim();
                    string bz   = "";

                    if (bljc.Rows[0]["F_blk"].ToString().Trim() == "TCT")
                    {
                        DataTable TJ_bljc = new DataTable();
                        TJ_bljc = aa.GetDataTable(" select *  from T_TBS_BG where  F_blh='" + blh + "'", "blxx");
                        if (TJ_bljc == null || TJ_bljc.Rows.Count <= 0)
                        {
                        }
                        else
                        {
                            rysj = "标本满意度:" + TJ_bljc.Rows[0]["F_TBS_BBMYD"].ToString().Trim() + "\r\n" + TJ_bljc.Rows[0]["f_tbs_xbl"].ToString().Trim() + "\r\n";
                            rysj = rysj + TJ_bljc.Rows[0]["F_TBS_XBXM1"].ToString().Trim() + "\r\n" + TJ_bljc.Rows[0]["F_TBS_XBXM2"].ToString().Trim() + "\r\n";
                            rysj = rysj + TJ_bljc.Rows[0]["F_TBS_XBXM3"].ToString().Trim() + "\r\n";
                            rysj = rysj + "病原微生物:" + TJ_bljc.Rows[0]["F_TBS_WSW6"].ToString().Trim() + "\r\n" + TJ_bljc.Rows[0]["F_TBS_WSW2"].ToString().Trim() + "\r\n" + TJ_bljc.Rows[0]["F_TBS_WSW1"].ToString().Trim() + "\r\n";
                            rysj = rysj + TJ_bljc.Rows[0]["F_TBS_WSW3"].ToString().Trim() + "\r\n" + TJ_bljc.Rows[0]["F_TBS_BDXM1"].ToString().Trim() + "\r\n";
                            rysj = rysj + "炎症程度:" + TJ_bljc.Rows[0]["F_TBS_YZCD"].ToString().Trim();

                            ////////////////////////////////////
                            blzd = TJ_bljc.Rows[0]["F_TBSZD"].ToString().Trim();
                            if (TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() != "")
                            {
                                bz = bz + "补充意见1:" + TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() + "\r\n";
                            }
                            if (TJ_bljc.Rows[0]["F_TBS_BCYJ2"].ToString().Trim() != "")
                            {
                                bz = bz + "补充意见2:" + TJ_bljc.Rows[0]["F_TBS_BCYJ2"].ToString().Trim();
                            }
                        }
                    }
                    string sql_insert = "insert into T_SYN_ZK_CHECK_BL(Pacs_CheckID,CISID,StudyID,PacsItemCode,PatientNameChinese,"
                                        + "PatientSex,PatientBirthday,StudyType,StudyBodyPart,ClinicDiagnose,ClinicSymptom,ClinicAdvice,IMGStrings,"
                                        + "StudyState,Check_Doc,Check_Date,Report_Doc,Report_Date,Audit_Doc,Audit_Date,Status_To_Cis) values("
                                        + "'" + blh + "','" + bljc.Rows[0]["F_MZH"].ToString().Trim() + "','" + sqxh + "','','" + bljc.Rows[0]["F_XM"].ToString().Trim() + "',"
                                        + "'" + bljc.Rows[0]["F_XB"].ToString().Trim() + "','" + bljc.Rows[0]["F_ZY"].ToString().Trim() + "','',"
                                        + "'" + bljc.Rows[0]["F_BBMC"].ToString().Trim() + "','" + blzd + "','" + rysj + "','" + bz + "','" + tjtppath + "',5,"
                                        + "'" + bljc.Rows[0]["F_QCYS"].ToString().Trim() + "','" + bljc.Rows[0]["F_SDRQ"].ToString().Trim() + "',"
                                        + "'" + bljc.Rows[0]["F_BGYS"].ToString().Trim() + "','" + bljc.Rows[0]["F_BGRQ"].ToString().Trim() + "',"
                                        + "'" + bljc.Rows[0]["F_SHYS"].ToString().Trim() + "','" + bljc.Rows[0]["F_SPARE5"].ToString().Trim() + "',0"
                                        + ")";

                    if (dt_tj.Rows.Count > 0)
                    {
                        sql_insert = "update  T_SYN_ZK_CHECK_BL  set Pacs_CheckID='" + blh + "',CISID='" + bljc.Rows[0]["F_MZH"].ToString().Trim()
                                     + "',PatientNameChinese='" + bljc.Rows[0]["F_XM"].ToString().Trim() + "',"
                                     + "PatientSex='" + bljc.Rows[0]["F_XB"].ToString().Trim() + "',PatientBirthday='" + bljc.Rows[0]["F_ZY"].ToString().Trim()
                                     + "',StudyBodyPart='" + bljc.Rows[0]["F_BBMC"].ToString().Trim() + "',ClinicDiagnose='" + blzd + "',ClinicSymptom='" + rysj + "',ClinicAdvice='" + bz
                                     + "',IMGStrings='" + tjtppath + "'," + "StudyState=5,Check_Doc='" + bljc.Rows[0]["F_QCYS"].ToString().Trim()
                                     + "',Check_Date='" + bljc.Rows[0]["F_SDRQ"].ToString().Trim() + "',Report_Doc='" + bljc.Rows[0]["F_BGYS"].ToString().Trim()
                                     + "',Report_Date='" + bljc.Rows[0]["F_BGRQ"].ToString().Trim() + "',Audit_Doc='" + bljc.Rows[0]["F_SHYS"].ToString().Trim()
                                     + "',Audit_Date='" + bljc.Rows[0]["F_SPARE5"].ToString().Trim() + "',Status_To_Cis=0  "
                                     + " where StudyID='" + sqxh + "'";
                    }

                    if (debug == "1")
                    {
                        log.WriteMyLog(sql_insert);
                    }

                    int z = db_tj.ExecuteNonQuery(odbc_tj, sql_insert, ref errMsg);
                    if (z > 0)
                    {
                        if (debug == "1")
                        {
                            log.WriteMyLog("写入数据库成功");
                        }
                        aa.ExecuteSQL("update  T_JCXX  set F_TJXTBJ='2'  where F_BLH='" + blh + "'");
                    }
                    else
                    {
                        log.WriteMyLog("写入数据失败:" + errMsg);
                    }
                }
                #endregion
                return;
            }
        }
예제 #15
0
        public void pathtohis(string F_blh, string yymc)
        {
            string debug   = f.ReadString("savetohis", "debug", "");
            string odbcsql = ZgqClass.GetSz("ZGQJK", "odbcsql", "Data Source=192.168.6.43;Initial Catalog=nysy_pe;User Id=sa;Password=sa;");
            string yhmc    = f.ReadString("yh", "yhmc", "-").Replace("/0", "");

            string txpath = ZgqClass.GetSz("ZGQJK", "txpath", "");

            dbbase.odbcdb aa = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");

            DataTable bljc = new DataTable();

            try
            {
                bljc = aa.GetDataTable("select * from T_jcxx where F_blh='" + F_blh + "'", "jcxx");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
                return;
            }

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

            if (bljc.Rows[0]["F_brlb"].ToString().Trim() != "体检")
            {
                log.WriteMyLog("非体检病人,不处理!");
                return;
            }
            if (bljc.Rows[0]["F_SQXH"].ToString().Trim() == "")
            {
                log.WriteMyLog("无体检申请单号,不处理!");
                return;
            }
            if (bljc.Rows[0]["F_BGZT"].ToString().Trim() == "已审核")
            {
                if (bljc.Rows[0]["F_TXML"].ToString().Trim() != "")
                {
                    DataTable txlb = new DataTable();
                    txlb = aa.GetDataTable("select * from T_tx where F_blh='" + F_blh + "' and F_sfdy='1'", "txlb");


                    if (txlb.Rows.Count > 0)
                    {
                        if (txpath.Trim() == "")
                        {
                            txpath = bljc.Rows[0]["F_TXML"].ToString().Trim() + "\\" + txlb.Rows[0]["F_txm"].ToString().Trim();
                        }
                        else
                        {
                            txpath = txpath + "\\" + bljc.Rows[0]["F_TXML"].ToString().Trim() + "\\" + txlb.Rows[0]["F_txm"].ToString().Trim();
                        }
                    }
                    else
                    {
                        txpath = "";
                    }
                }
                else
                {
                    txpath = "";
                }

                try
                {
                    DataTable TJ_bljc = new DataTable();
                    TJ_bljc = aa.GetDataTable(" select *  from T_TBS_BG where  F_blh='" + F_blh + "'", "blxx");


                    SqlParameter[] mzORAPAR = new SqlParameter[9];
                    for (int j = 0; j < mzORAPAR.Length; j++)
                    {
                        mzORAPAR[j] = new SqlParameter();
                    }
                    mzORAPAR[0].ParameterName = "@applyid";
                    mzORAPAR[0].SqlDbType     = SqlDbType.VarChar;
                    mzORAPAR[0].Direction     = ParameterDirection.Input;
                    mzORAPAR[0].Size          = 50;

                    mzORAPAR[1].ParameterName = "@patientname";    //
                    mzORAPAR[1].SqlDbType     = SqlDbType.VarChar;
                    mzORAPAR[1].Direction     = ParameterDirection.Input;
                    mzORAPAR[1].Size          = 50;

                    mzORAPAR[2].ParameterName = "@Diagnosis";    //
                    mzORAPAR[2].SqlDbType     = SqlDbType.VarChar;
                    mzORAPAR[2].Direction     = ParameterDirection.Input;
                    mzORAPAR[2].Size          = 3000;

                    mzORAPAR[3].ParameterName = "@Feature";    //
                    mzORAPAR[3].SqlDbType     = SqlDbType.VarChar;
                    mzORAPAR[3].Direction     = ParameterDirection.Input;
                    mzORAPAR[3].Size          = 1024;

                    mzORAPAR[4].ParameterName = "@reportdoctor";    //
                    mzORAPAR[4].SqlDbType     = SqlDbType.VarChar;
                    mzORAPAR[4].Direction     = ParameterDirection.Input;
                    mzORAPAR[4].Size          = 50;

                    mzORAPAR[5].ParameterName = "@reporttime";    //
                    mzORAPAR[5].SqlDbType     = SqlDbType.DateTime;
                    mzORAPAR[5].Direction     = ParameterDirection.Input;

                    mzORAPAR[6].ParameterName = "@filepath";    //
                    mzORAPAR[6].SqlDbType     = SqlDbType.VarChar;;
                    mzORAPAR[6].Direction     = ParameterDirection.Input;
                    mzORAPAR[6].Size          = 100;

                    mzORAPAR[7].ParameterName = "@sex";    //
                    mzORAPAR[7].SqlDbType     = SqlDbType.VarChar;
                    mzORAPAR[7].Direction     = ParameterDirection.Input;
                    mzORAPAR[7].Size          = 50;

                    mzORAPAR[8].ParameterName = "@age";    //
                    mzORAPAR[8].SqlDbType     = SqlDbType.VarChar;
                    mzORAPAR[8].Direction     = ParameterDirection.Input;
                    mzORAPAR[8].Size          = 50;

                    //////////////////////////////////////////////////////

                    string tj_blzd = bljc.Rows[0]["F_blzd"].ToString().Trim();
                    string tj_jcsj = bljc.Rows[0]["F_jxsj"].ToString().Trim();

                    if (TJ_bljc.Rows.Count > 0)
                    {
                        if (bljc.Rows[0]["F_BGGS"].ToString().Trim() == "TBS" || bljc.Rows[0]["F_blk"].ToString().Trim().Contains("TCT"))
                        {
                            tj_jcsj = "标本满意度:" + TJ_bljc.Rows[0]["F_TBS_BBMYD"].ToString().Trim() + "\r\n";
                            tj_jcsj = tj_jcsj + "           " + TJ_bljc.Rows[0]["f_tbs_xbl"].ToString().Trim() + "\r\n";
                            tj_jcsj = tj_jcsj + "           " + TJ_bljc.Rows[0]["F_tbs_xbxm1"].ToString().Trim() + "\r\n";
                            tj_jcsj = tj_jcsj + "           " + TJ_bljc.Rows[0]["F_tbs_xbxm2"].ToString().Trim() + "\r\n";
                            tj_jcsj = tj_jcsj + "           " + TJ_bljc.Rows[0]["F_tbs_xbxm3"].ToString().Trim() + "\r\n";

                            tj_jcsj = tj_jcsj + "炎症程度:" + TJ_bljc.Rows[0]["F_TBS_YZCD"].ToString().Trim() + "\r\n";

                            ////////////////////////////////////
                            tj_blzd = TJ_bljc.Rows[0]["F_TBSZD"].ToString().Trim() + "\r\n";
                            if (TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() != "")
                            {
                                tj_blzd = tj_blzd + "补充意见1:" + TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() + "\r\n";
                            }
                            if (TJ_bljc.Rows[0]["F_TBS_BCYJ2"].ToString().Trim() != "")
                            {
                                tj_blzd = tj_blzd + "补充意见2:" + TJ_bljc.Rows[0]["F_TBS_BCYJ2"].ToString().Trim() + "\r\n";
                            }
                        }

                        //if (bljc.Rows[0]["F_blk"].ToString().Trim() == "HPV")
                        //{
                        //    tj_jcsj = tj_jcsj + "检测方法:" + TJ_bljc.Rows[0]["F_FZ_JCFF"].ToString().Trim() + "\n" + "检测内容:" + TJ_bljc.Rows[0]["F_FZ_JCWD"].ToString().Trim() + "\n";
                        //    tj_blzd = "检测结果:" + TJ_bljc.Rows[0]["F_FZ_JCJG"].ToString().Trim();// "检查结果:" + TJ_bljc.Rows[0]["F_FZ_YYX"].ToString().Trim();
                        //}
                    }
                    if (debug == "1")
                    {
                        MessageBox.Show(tj_jcsj);
                        MessageBox.Show(tj_blzd);
                        MessageBox.Show(txpath);
                    }
                    /////////////////////////////////////////////////////
                    mzORAPAR[0].Value = bljc.Rows[0]["f_sqxh"].ToString().Trim();                 //体检申请单号
                    mzORAPAR[1].Value = bljc.Rows[0]["f_xm"].ToString().Trim();                   // 姓名
                    mzORAPAR[2].Value = tj_blzd.Trim();                                           // 诊断结论
                    mzORAPAR[3].Value = tj_jcsj.Trim();                                           //描述
                    mzORAPAR[4].Value = bljc.Rows[0]["f_bgys"].ToString().Trim();                 // 检查医生姓名
                    mzORAPAR[5].Value = DateTime.Parse(bljc.Rows[0]["f_bgrq"].ToString().Trim()); //检查时间
                    mzORAPAR[6].Value = txpath;                                                   // 图像绝对路径
                    mzORAPAR[7].Value = bljc.Rows[0]["f_xb"].ToString().Trim();                   // 性别
                    mzORAPAR[8].Value = bljc.Rows[0]["f_nl"].ToString().Trim();                   // 年龄
                    ////////////////////////////////////////////////////
                    SqlConnection ocn = new SqlConnection(odbcsql);
                    try
                    {
                        SqlCommand mzcmd = new SqlCommand();
                        mzcmd.Connection  = ocn;
                        mzcmd.CommandType = CommandType.StoredProcedure;
                        mzcmd.CommandText = "proc_get_bl_result";
                        mzcmd.Parameters.Add(mzORAPAR[0]);
                        mzcmd.Parameters.Add(mzORAPAR[1]);
                        mzcmd.Parameters.Add(mzORAPAR[2]);
                        mzcmd.Parameters.Add(mzORAPAR[3]);
                        mzcmd.Parameters.Add(mzORAPAR[4]);
                        mzcmd.Parameters.Add(mzORAPAR[5]);
                        mzcmd.Parameters.Add(mzORAPAR[6]);
                        mzcmd.Parameters.Add(mzORAPAR[7]);
                        mzcmd.Parameters.Add(mzORAPAR[8]);

                        try
                        {
                            ocn.Open();
                            if (debug == "1")
                            {
                                MessageBox.Show("数据库打开正常");
                            }

                            mzcmd.ExecuteNonQuery();

                            if (debug == "1")
                            {
                                MessageBox.Show("数据库执行正常,回写成功");
                            }

                            ocn.Close();

                            ZgqClass.BGHJ(F_blh, yhmc, "审核", "体检报告回写成功", "ZGQJK", "ZGQJK");
                        }
                        catch (Exception eee)
                        {
                            ocn.Close();
                            log.WriteMyLog("数据库执行异常," + eee.Message);
                            if (debug == "1")
                            {
                                MessageBox.Show("数据库执行异常:" + eee.Message.ToString());
                            }
                            ZgqClass.BGHJ(F_blh, yhmc, "审核", "体检报告回写失败:" + eee.Message, "ZGQJK", "ZGQJK");
                            return;
                        }
                        finally
                        {
                            if (ocn.State == ConnectionState.Open)
                            {
                                ocn.Close();
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        log.WriteMyLog("参数错误:" + e.Message.ToString());
                    }
                }
                catch (Exception ee)
                {
                    log.WriteMyLog("参数错误2" + ee.Message.ToString());
                }
            }
        }
예제 #16
0
        public void pathtohis(string blh, string bglx, string bgxh, string msg1, string debug, string[] cslb)
        {
            string qxsh = "";
            string xdj  = "";

            bglx = bglx.ToLower();

            string jkmsg = f.ReadString("jkmsg", "jkmsg", "0").Replace("\0", "");


            f.WriteInteger("jkmsg", "jkmsg", 0);

            if (cslb.Length == 5)
            {
                if (cslb[4].ToLower() == "qxsh")
                {
                    //取消审核动作
                    qxsh = "1";
                }

                if (cslb[3].ToLower() == "new")
                {
                    xdj = "1";
                }
            }

            if (bglx == "")
            {
                bglx = "cg";
            }

            if (bgxh == "")
            {
                bgxh = "0";
            }
            dbbase.odbcdb aa   = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");
            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("病理数据库设置有问题!");
                return;
            }
            if (jcxx.Rows.Count < 1)
            {
                MessageBox.Show("病理号有错误!");
                return;
            }

            if (bglx.Trim() == "")
            {
                log.WriteMyLog("报告类型为空,不处理!" + blh + "^" + bglx + "^" + bgxh);
                return;
            }
            string bgzt = "";

            if (qxsh == "1")
            {
                bgzt = "取消审核";
            }
            else
            {
                bgzt = jcxx.Rows[0]["F_BGZT"].ToString().Trim();
            }

            int    plsc = f.ReadInteger("fsjk", "plsc", 0);
            string msg  = f.ReadString("savetohis", "msg", "1");

            if (plsc != 1)
            {
                ////增加体检回写接口/////zgq
                if (jcxx.Rows[0]["F_BRLB"].ToString().Trim() == "体检")
                {
                    # region  体检回写接口
                    if (jcxx.Rows[0]["F_BRBH"].ToString().Trim() == "")
                    {
                        ZgqClass.BGHJ(blh, "体检接口", "体检审核", "体检病人无病人编号,不处理", "ZGQJK", "体检接口");
                        aa.ExecuteSQL("update T_JCXX_FS set F_BZ='体检病人无病人编号,不处理'  where F_blh='" + blh + "' and F_BGLX='cg' and F_BGXH='0'");

                        log.WriteMyLog(blh + ",体检病人无病人编号,不处理!");
                        if (jkmsg == "1")
                        {
                            MessageBox.Show("此体检病人无病人编号,不处理!");
                        }
                        return;
                    }

                    string  err_msg = "";
                    string  constr  = f.ReadString("savetohis", "tj_odbcsql", "Provider='MSDAORA';data source=ZSYYTJ;User ID=SD_PE_LIS;Password=SD_PE_LIS;");
                    OleDbDB db      = new OleDbDB();


                    DataTable TJ_bljc = new DataTable();
                    TJ_bljc = aa.GetDataTable(" select top 1  *  from T_TBS_BG where  F_blh='" + blh + "'", "blxx");

                    if (debug == "1")
                    {
                        log.WriteMyLog("执行体检");
                    }

                    //体检确认
                    if (jcxx.Rows[0]["F_TJBJ"].ToString().Trim() != "1")
                    {
                        try
                        {
                            OleDbParameter[] oledbPt = new OleDbParameter[4];

                            for (int j = 0; j < oledbPt.Length; j++)
                            {
                                oledbPt[j] = new OleDbParameter();
                            }
                            oledbPt[0].ParameterName = "para_sfywid";
                            oledbPt[0].OleDbType     = OleDbType.Decimal;
                            oledbPt[0].Direction     = ParameterDirection.Input;
                            oledbPt[0].Size          = 10;
                            oledbPt[0].Value         = Decimal.Parse(jcxx.Rows[0]["F_BRBH"].ToString().Trim());

                            oledbPt[1].ParameterName = "para_flag";   //
                            oledbPt[1].OleDbType     = OleDbType.Char;
                            oledbPt[1].Direction     = ParameterDirection.Input;
                            oledbPt[1].Size          = 1;
                            oledbPt[1].Value         = '1';

                            oledbPt[2].ParameterName = "para_result";   //
                            oledbPt[2].OleDbType     = OleDbType.Char;
                            oledbPt[2].Direction     = ParameterDirection.Output;
                            oledbPt[2].Size          = 1;

                            oledbPt[3].ParameterName = "para_msg";   //
                            oledbPt[3].OleDbType     = OleDbType.VarChar;
                            oledbPt[3].Direction     = ParameterDirection.Output;
                            oledbPt[3].Size          = 200;

                            if (debug == "1")
                            {
                                log.WriteMyLog("执行标记:" + oledbPt[0].Value.ToString() + "@" + oledbPt[1].Value.ToString() + "@" + err_msg);
                            }

                            //删除
                            db.ExecuteNonQuery(constr, "updateBL", ref oledbPt, CommandType.StoredProcedure, ref err_msg);

                            if (debug == "1")
                            {
                                log.WriteMyLog("体检执行标记返回:" + oledbPt[2].Value.ToString() + "@" + oledbPt[3].Value.ToString() + "@" + err_msg);
                            }

                            if (oledbPt[2].Value.ToString() != "Y")
                            {
                                log.WriteMyLog("体检确认失败:" + oledbPt[2].Value.ToString() + "@" + oledbPt[3].Value.ToString() + "\r\n" + err_msg);
                            }
                            else
                            {
                                aa.ExecuteSQL("update T_JCXX  set F_TJBJ='1' where F_BLH='" + blh + "'");
                            }
                        }
                        catch (Exception e1)
                        {
                            log.WriteMyLog(e1.Message);
                        }
                        //                    确认过程:updateBL
                        //--para_sfywid 收费业务ID
                        //--para_flag   0:取消 1:确认
                        //--para_result  N:失败 Y:成功
                        //procedure updateBL(para_sfywid in  number, para_flag   in  char, para_result out char);
                    }
                    if (bgzt.Trim() == "已审核")
                    {
                        string ML = DateTime.Parse(jcxx.Rows[0]["F_SDRQ"].ToString()).ToString("yyyyMM");

                        string jpgname = "";
                        string jpgpath = "";


                        //生成jpg
                        bool isrtn = MD_PDF_JPG(blh, bglx, bgxh, ML, ZgqPDFJPG.Type.JPG, ref err_msg, ref jpgname, ref jpgpath);

                        if (isrtn)
                        {
                            jpgname = jpgname.Substring(jpgname.LastIndexOf('\\') + 1);
                            ZgqClass.BGHJ(blh, "体检接口", "体检审核", "生成jpg成功:" + jpgpath + "\\" + jpgname, "ZGQJK", "体检生成jpg");
                            aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");
                            aa.ExecuteSQL("insert  into T_BG_PDF(F_BLH,F_BGLX,F_BGXH,F_ML,F_FILENAME) values('" + blh + "','" + bglx + "','" + bgxh + "','" + jpgpath + "','" + jpgname + "')");
                        }
                        else
                        {
                            log.WriteMyLog(blh + "-" + err_msg);
                            ZgqClass.BGHJ(blh, "体检接口", "体检审核", "生成JPG格式图片失败" + err_msg, "ZGQJK", "体检接口");
                            aa.ExecuteSQL("update T_JCXX_FS set F_BZ='生成JPG格式图片失败:" + err_msg + "'  where F_blh='" + blh + "' and F_BGLX='cg' and F_BGXH='0'");
                            if (jkmsg == "1" || msg == "1")
                            {
                                MessageBox.Show("病理号:" + blh + "  生成JPG格式图片失败,请重新审核!\r\n" + err_msg);
                            }

                            return;
                        }

                        # region 回传体检报告



                        // 诊断描述
                        string Res_char = jcxx.Rows[0]["F_jxsj"].ToString().Trim();
                        //诊断结论	Res_con
                        string Res_con = jcxx.Rows[0]["F_blzd"].ToString().Trim();

                        if (TJ_bljc.Rows.Count > 0)
                        {
                            if (jcxx.Rows[0]["F_blk"].ToString().Trim() == "TCT")
                            {
                                Res_char = Res_char + "标本满意度:" + TJ_bljc.Rows[0]["F_TBS_BBMYD"].ToString().Trim() + "\r\n";

                                Res_char = Res_char + "细胞量:" + TJ_bljc.Rows[0]["F_TBS_XBL"].ToString().Trim() + "\r\n细胞成分:" + TJ_bljc.Rows[0]["F_TBS_XBXM2"].ToString().Trim()
                                           + "\r\n炎细胞:" + TJ_bljc.Rows[0]["F_TBS_YZCD"].ToString().Trim() + "\r\n";

                                Res_char = Res_char + "微生物:" + TJ_bljc.Rows[0]["F_TBS_WSW2"].ToString().Trim() + "\r\n";

                                ///////////诊断/////////////////////////
                                Res_con = "诊断:" + TJ_bljc.Rows[0]["F_TBSZD"].ToString().Trim() + "\r\n" + "\r\n";
                                if (TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() != "")
                                {
                                    Res_con = Res_con + "补充意见:" + TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() + "\r\n";
                                }
                            }
                        }

                        /////////////////////////////////////////////////////
                        string path = f.ReadString("savetohis", "jpgpath", @"\\192.10.33.84\pdfbg\");
                        jpgpath = path + jpgpath + "\\" + jpgname;
                        string sql_insert = "insert into BL_TJ_TJJGB0(SFYWID,TJH000,SQXMID,TZMS00,KSZD00,YXLJ00,JYYS00,SHYS00,JYRQ00,JYSJ00,SHRQ00,SHSJ00,JCXMLX,SFYX00)"
                                            + " values(" + jcxx.Rows[0]["F_BRBH"].ToString().Trim() + "," + jcxx.Rows[0]["F_mzh"].ToString().Trim() + "," + jcxx.Rows[0]["F_YZXM"].ToString().Trim().Split('^')[0] + ",'"
                                            + Res_char + "','" + Res_con + "','" + jpgpath + "','" + jcxx.Rows[0]["F_BGYS"].ToString().Trim() + "','" + jcxx.Rows[0]["F_shys"].ToString().Trim() + "','"
                                            + DateTime.Parse(jcxx.Rows[0]["F_BGRQ"].ToString().Trim()).ToString("yyyyMMdd") + "','" + DateTime.Parse(jcxx.Rows[0]["F_BGRQ"].ToString().Trim()).ToString("HH:mm:ss")
                                            + "','" + DateTime.Parse(jcxx.Rows[0]["F_SPARE5"].ToString().Trim()).ToString("yyyyMMdd") + "','" + DateTime.Parse(jcxx.Rows[0]["F_SPARE5"].ToString().Trim()).ToString("HH:mm:ss")
                                            + "','BL','0')";


                        string sql_del = "delete from BL_TJ_TJJGB0  where SFYWID=" + jcxx.Rows[0]["F_BRBH"].ToString().Trim() + " and TJH000=" + jcxx.Rows[0]["F_mzh"].ToString().Trim() + " and SQXMID="
                                         + jcxx.Rows[0]["F_YZXM"].ToString().Trim().Split('^')[0] + " and JCXMLX='BL'";

                        //删除
                        if (debug == "1")
                        {
                            log.WriteMyLog("删除体检表,语句:" + sql_del);
                        }

                        int x = db.ExecuteNonQuery(constr, sql_del, ref err_msg);
                        if (debug == "1")
                        {
                            log.WriteMyLog("删除体检表:" + err_msg + "@" + x.ToString());
                        }


                        if (debug == "1")
                        {
                            log.WriteMyLog("回写体检表,语句:" + sql_insert);
                        }
                        //插入
                        x = db.ExecuteNonQuery(constr, sql_insert, ref err_msg);

                        if (debug == "1")
                        {
                            log.WriteMyLog("回写体检表:" + err_msg + "@" + x.ToString());
                        }

                        if (x < 0)
                        {
                            ZgqClass.BGHJ(blh, "体检接口", "体检审核", "回写体检报告失败:" + err_msg, "ZGQJK", "体检接口");
                            aa.ExecuteSQL("update T_JCXX_FS set F_BZ='回写体检报告失败:" + err_msg + "'  where F_blh='" + blh + "' and F_BGLX='cg' and F_BGXH='0'");
                            log.WriteMyLog(blh + "-" + err_msg);
                            if (jkmsg == "1" || msg == "1")
                            {
                                MessageBox.Show("病理号:" + blh + "-回写体检报告失败,请重新审核!\r\n" + err_msg);
                            }
                        }
                        else
                        {
                            ZgqClass.BGHJ(blh, "体检接口", "体检审核", "回写体检报告成功", "ZGQJK", "体检接口");
                            aa.ExecuteSQL("update T_JCXX_FS set F_BZ='',F_FSZT='已处理'  where F_blh='" + blh + "' and F_BGLX='cg' and F_BGXH='0'");
                            aa.ExecuteSQL("update T_JCXX  set F_TJBJ='2' where F_BLH='" + blh + "'");
                            if (jkmsg == "1")
                            {
                                MessageBox.Show("病理号:" + blh + "-回写体检报告成功");
                            }
                        }

                        return;

                        #endregion
                    }
                    else
                    {
                        if (bgzt == "取消审核")
                        {
                            //删除中间表
                            string str_sql = "delete from BL_TJ_TJJGB0  where SFYWID=" + jcxx.Rows[0]["F_BRBH"].ToString().Trim() + " and TJH000=" + jcxx.Rows[0]["F_mzh"].ToString().Trim() + " and SQXMID="
                                             + jcxx.Rows[0]["F_YZXM"].ToString().Trim().Split('^')[0] + " and JCXMLX='BL'";

                            if (debug == "1")
                            {
                                log.WriteMyLog("回写体检表,语句:" + str_sql);
                            }

                            int x = db.ExecuteNonQuery(constr, str_sql, ref err_msg);
                            if (x < 0)
                            {
                                ZgqClass.BGHJ(blh, "体检接口", "体检取消审核", "取消体检报告失败:" + err_msg, "ZGQJK", "体检接口");
                                aa.ExecuteSQL("update T_JCXX_FS set F_BZ='取消体检报告失败:" + err_msg + "'  where F_blh='" + blh + "' and F_BGLX='cg' and F_BGXH='0'");
                                log.WriteMyLog(blh + "-" + err_msg);
                                if (msg == "1")
                                {
                                    MessageBox.Show("病理号:" + blh + "-取消体检报告失败!\r\n");
                                }
                            }
                            else
                            {
                                ZgqClass.BGHJ(blh, "体检接口", "体检取消审核", "取消体检报告成功", "ZGQJK", "体检接口");
                                aa.ExecuteSQL("update T_JCXX_FS set F_BZ='',F_FSZT='已处理'  where F_blh='" + blh + "' and F_BGLX='cg' and F_BGXH='0'");
                                aa.ExecuteSQL("update T_JCXX  set F_TJBJ='1' where F_BLH='" + blh + "'");
                            }

                            //删除T_BG_PDF记录
                            DataTable dt2 = aa.GetDataTable("select top 1 * from T_BG_PDF where F_blh='" + blh + "'  and F_BGXH='" + bgxh + "' and F_BGLX='" + bglx + "'", "dt2");
                            if (dt2.Rows.Count > 0)
                            {
                                aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");
                                //删除ftp上pdf文件
                                ZgqPDFJPG zgq     = new ZgqPDFJPG();
                                string    rtn_msg = "";
                                zgq.DelPDFFile(dt2.Rows[0]["F_ML"].ToString(), dt2.Rows[0]["F_FILENAME"].ToString(), ref rtn_msg);
                            }
                            else
                            {
                                log.WriteMyLog(blh + ",T_BG_PDF中未能找到记录");
                            }
                            return;
                        }
                        return;
                    }
                    return;


                    # endregion
                }
예제 #17
0
        public void CreatePDF(string blh, string bgxh, string bglx, DataTable dt_jcxx, string debug, string bgzt)
        {
            string blbh = blh + bglx + bgxh;

            dbbase.odbcdb aa = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");
            if (bglx == "cg")
            {
                blbh = blh;
            }
            if (bgzt == "取消审核")
            {
                try
                {
                    aa.ExecuteSQL("delete T_BG_PDF  where F_BLBH='" + blbh + "'");
                }
                catch
                {
                }
                return;
            }

            #region  生成pdf
            if (f.ReadString("savetohis", "ispdf", "1").Trim() == "1")
            {
                string ReprotFile = ""; string jpgname = "";
                string ML      = DateTime.Parse(dt_jcxx.Rows[0]["F_SDRQ"].ToString()).ToString("yyyyMM");
                string message = "";

                ZgqPDFJPG zgq   = new ZgqPDFJPG();
                bool      isrtn = zgq.CreatePDF(blh, bglx, bgxh, ZgqPDFJPG.Type.PDF, ref jpgname, "", ref message);
                if (isrtn)
                {
                    if (debug == "1")
                    {
                        log.WriteMyLog("生成PDF成功");
                    }

                    ////二进制串
                    if (File.Exists(jpgname))
                    {
                        string pdfpath = "";
                        bool   ssa     = zgq.UpPDF(blh, jpgname, ML, ref message, 3, ref pdfpath);

                        if (ssa == true)
                        {
                            if (debug == "1")
                            {
                                log.WriteMyLog("上传PDF成功");
                            }

                            jpgname = jpgname.Substring(jpgname.LastIndexOf('\\') + 1);
                            ZgqClass.BGHJ(blh, "上传PDF成功", "审核", "上传PDF成功:" + pdfpath, "ZGQJK", "上传PDF");
                            aa.ExecuteSQL("insert  into T_BG_PDF(F_BLBH,F_BLH,F_BGLX,F_BGXH,F_ML,F_FILENAME,f_pdfpath) values('" + blbh + "','" + blh + "','" + bglx + "','" + bgxh + "','" + ML + "\\" + blh + "','" + jpgname + "','" + pdfpath + "')");
                        }
                        else
                        {
                            if (debug == "1")
                            {
                                log.WriteMyLog("上传PDF失败" + message);
                            }
                            ZgqClass.BGHJ(blh, "上传PDF失败", "审核", message, "ZGQJK", "上传PDF");
                        }
                    }
                    else
                    {
                        if (debug == "1")
                        {
                            log.WriteMyLog("未找到文件" + jpgname);
                        }
                        ZgqClass.BGHJ(blh, "生成PDF失败", "审核", "未找到文件" + jpgname, "ZGQJK", "生成PDF");
                    }
                }
                else
                {
                    if (message == "报告未审核")
                    {
                        return;
                    }
                    else
                    {
                        if (debug == "1")
                        {
                            log.WriteMyLog("生成PDF失败" + message);
                        }
                        ZgqClass.BGHJ(blh, "生成PDF失败", "审核", "生成pdf失败" + message, "ZGQJK", "生成PDF");
                    }
                }
                zgq.DelTempFile(blh);
            }
            #endregion
        }
예제 #18
0
        public void pathtohis(string blh, string bglx, string bgxh, string msg, string debug, string[] cslb)
        {
            string qxsh = "";
            string xdj  = "";

            bglx = bglx.ToLower();

            if (cslb.Length == 5)
            {
                if (cslb[4].ToLower() == "qxsh")
                {
                    //取消审核动作
                    qxsh = "1";
                }

                if (cslb[3].ToLower() == "new")
                {
                    xdj = "1";
                }
            }


            if (bglx == "")
            {
                bglx = "cg";
            }

            if (bgxh == "")
            {
                bgxh = "0";
            }

            string tjodbcsql = f.ReadString("savetohis", "tj-odbcsql", "Data Source=172.16.95.190\\SQL2005;Initial Catalog=tj_zdzl;User Id=bl;Password=admin;");

            dbbase.odbcdb aa   = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");
            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("病理数据库设置有问题!");
                return;
            }
            if (jcxx.Rows.Count < 1)
            {
                MessageBox.Show("病理号有错误!");
                return;
            }

            if (bglx.Trim() == "")
            {
                log.WriteMyLog("报告类型为空,不处理!" + blh + "^" + bglx + "^" + bgxh);
                return;
            }
            string bgzt = "";

            if (qxsh == "1")
            {
                bgzt = "取消审核";
            }
            else
            {
                bgzt = "已审核";
            }


            int plsc = f.ReadInteger("fsjk", "plsc", 0);

            if (plsc != 1)
            {
                return;
            }
            ////增加体检回写接口/////zgq
            if (jcxx.Rows[0]["F_BRLB"].ToString().Trim() == "体检")
            {
                if (jcxx.Rows[0]["F_SQXH"].ToString().Trim() == "")
                {
                    aa.ExecuteSQL("update T_jcxx_fs set F_fszt='不处理',F_bz='体检病人无体检申请号,不处理!' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "' and F_fszt='未处理'");
                    log.WriteMyLog(blh + ",体检病人无病人编号,不处理!");
                    return;
                }


                if (jcxx.Rows[0]["F_BGZT"].ToString().Trim() == "已审核" && bgzt != "取消审核")
                {
                    DataTable TJ_bljc = new DataTable();
                    TJ_bljc = aa.GetDataTable(" select top 1  *  from T_TBS_BG where  F_blh='" + blh + "'", "blxx");


                    // 诊断描述
                    string Res_char = jcxx.Rows[0]["F_jxsj"].ToString().Trim();
                    //诊断结论	Res_con
                    string Res_con = jcxx.Rows[0]["F_blzd"].ToString().Trim();

                    if (TJ_bljc.Rows.Count > 0)
                    {
                        if (jcxx.Rows[0]["F_blk"].ToString().Trim() == "体检LCT" || jcxx.Rows[0]["F_blk"].ToString().Trim() == "液基细胞")
                        {
                            Res_char = Res_char + "标本满意度:" + TJ_bljc.Rows[0]["F_TBS_BBMYD"].ToString().Trim() + "\r\n" + "\r\n";

                            Res_char = Res_char + "项目:" + "\r\n" + TJ_bljc.Rows[0]["F_TBS_XBL"].ToString().Trim() + "\r\n" + TJ_bljc.Rows[0]["F_TBS_XBXM1"].ToString().Trim()
                                       + "\r\n" + TJ_bljc.Rows[0]["F_TBS_XBXM2"].ToString().Trim() + "\r\n" + "\r\n";

                            Res_char = Res_char + "病原体:" + "\r\n" + TJ_bljc.Rows[0]["F_TBS_WSW2"].ToString().Trim() + "\r\n" + TJ_bljc.Rows[0]["F_TBS_WSW1"].ToString().Trim()
                                       + "\r\n" + TJ_bljc.Rows[0]["F_TBS_WSW3"].ToString().Trim() + "\r\n" + TJ_bljc.Rows[0]["F_TBS_BDXM1"].ToString().Trim() + "\r\n" + "\r\n";

                            Res_char = Res_char + "炎症细胞量:" + TJ_bljc.Rows[0]["F_TBS_YZCD"].ToString().Trim() + "\r\n" + "\r\n";

                            ///////////诊断/////////////////////////
                            Res_con = "诊断:" + TJ_bljc.Rows[0]["F_TBSZD"].ToString().Trim() + "\r\n" + "\r\n";
                            if (TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() != "")
                            {
                                Res_con = Res_con + "补充意见:" + TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() + "\r\n";
                            }
                        }
                    }

                    /////////////////////////////////////////////////////

                    string str_com = "update  tj_pacs_resulto_temp  set Res_doctor='" + jcxx.Rows[0]["F_BGYS"].ToString().Trim() + "',Res_doctor_code='',Res_date='" + DateTime.Parse(jcxx.Rows[0]["F_BGrq"].ToString().Trim()) + "',Res_char='" + Res_char + "',Res_con='" + Res_con + "',Res_flag=2 where res_no='" + jcxx.Rows[0]["F_SQXH"].ToString().Trim() + "'";


                    if (debug == "1")
                    {
                        MessageBox.Show("回写体检表,语句:" + str_com);
                    }
                    SqlDB  db = new SqlDB();
                    string Exceptionmessage = "";
                    int    x = db.ExecuteNonQuery(tjodbcsql, str_com, ref Exceptionmessage);
                    if (Exceptionmessage != "" && Exceptionmessage != "OK")
                    {
                        if (Exceptionmessage.Length > 200)
                        {
                            aa.ExecuteSQL("update T_jcxx_fs set F_bz='" + Exceptionmessage.Substring(0, 200) + "' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "'  and F_fszt='未处理' and F_bgzt='" + bgzt + "'");
                        }
                        else
                        {
                            aa.ExecuteSQL("update T_jcxx_fs set F_bz='" + Exceptionmessage + "' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "' and F_fszt='未处理' and F_bgzt='" + bgzt + "'");
                        }

                        log.WriteMyLog(blh + ",体检报告审核,接口异常信息:" + Exceptionmessage);
                    }
                    else
                    {
                        aa.ExecuteSQL("update T_jcxx_fs set F_fszt='已处理',F_bz='体检报告审核,接口上传成功!' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "' and F_fszt='未处理'");
                    }
                }
                else
                {
                    //取消审核时
                    if (bgzt == "取消审核")
                    {
                        string str_com = "update  tj_pacs_resulto_temp set Res_doctor='" + "" + "',Res_doctor_code='',Res_date='" + DateTime.Today + "',Res_char='" + "" + "',Res_con='" + "" + "',Res_flag=2 where res_no='" + jcxx.Rows[0]["F_SQXH"].ToString().Trim() + "'";

                        if (debug == "1")
                        {
                            MessageBox.Show("回写体检表,语句:" + str_com);
                        }
                        SqlDB  db = new SqlDB();
                        string Exceptionmessage = "";
                        int    x = db.ExecuteNonQuery(tjodbcsql, str_com, ref Exceptionmessage);
                        if (Exceptionmessage != "" && Exceptionmessage != "OK")
                        {
                            log.WriteMyLog(Exceptionmessage);

                            if (Exceptionmessage.Length > 200)
                            {
                                aa.ExecuteSQL("update T_jcxx_fs set F_bz='" + Exceptionmessage.Substring(0, 200) + "' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "'  and F_fszt='未处理' and F_bgzt='" + bgzt + "'");
                            }
                            else
                            {
                                aa.ExecuteSQL("update T_jcxx_fs set F_bz='" + Exceptionmessage + "' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "' and F_fszt='未处理' and F_bgzt='" + bgzt + "'");
                            }

                            log.WriteMyLog(blh + ",体检报告取消审核,接口异常信息:" + Exceptionmessage);
                        }
                        else
                        {
                            aa.ExecuteSQL("update T_jcxx_fs set F_fszt='已处理',F_bz='体检报告取消审核,接口上传成功!' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "' and F_fszt='未处理'");
                        }
                    }
                    else
                    {
                        aa.ExecuteSQL("update T_jcxx_fs set F_bz='未知操作!' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "' and F_fszt='未处理'");
                    }
                }
            }
            else
            {
                //非体检病人回写
                //生成pdf 用于移动app
                string bgzt2 = "";
                try
                {
                    if (bglx.ToLower().Trim() == "bd")
                    {
                        DataTable dt_bd = aa.GetDataTable("select * from T_BDBG where F_BLH='" + blh + "' and  F_BD_BGXH='" + bgxh + "'", "bd");
                        bgzt2 = dt_bd.Rows[0]["F_BD_BGZT"].ToString();
                    }
                    if (bglx.ToLower().Trim() == "bc")
                    {
                        DataTable dt_bc = aa.GetDataTable("select * from T_BCBG where F_BLH='" + blh + "' and  F_BC_BGXH='" + bgxh + "'", "bc");
                        bgzt2 = dt_bc.Rows[0]["F_BC_BGZT"].ToString();
                    }
                    if (bglx.ToLower().Trim() == "cg")
                    {
                        // DataTable jcxx2 = aa.GetDataTable("select * from T_jcxx where F_blh='" + blh + "'", "jcxx");
                        bgzt2 = jcxx.Rows[0]["F_BGZT"].ToString();
                    }
                }
                catch
                {
                }

                if (bgzt2.Trim() == "")
                {
                    log.WriteMyLog("报告状态为空!不处理!" + blh + "^" + bglx + "^" + bgxh);
                }

                if (bgzt2.Trim() == "已审核" && bgzt != "取消审核")
                {
                    ////MD_JPG_PDF md = new MD_JPG_PDF();
                    ////int x = md.CreatePDF(blh, bglx, bgxh, MD_JPG_PDF.type.PDF, ref message);
                    ////if (x <= 0)
                    ////{
                    ////     LGZGQClass.log.WriteMyLog(message);
                    ////    if (message.Length > 200)
                    ////        aa.ExecuteSQL("update T_jcxx_fs set F_bz='" + message.Substring(0, 200) + "' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "'  and F_fszt='未处理' and F_bgzt='" + bgzt + "'");
                    ////    else
                    ////        aa.ExecuteSQL("update T_jcxx_fs set F_bz='" + message + "' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "'  and F_fszt='未处理' and F_bgzt='" + bgzt + "'");

                    ////}
                    ////else
                    ////    aa.ExecuteSQL("update T_jcxx_fs set  F_fszt='已处理',F_bz='审核, 生成PDF成功' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "'  and F_fszt='未处理' and F_bgzt='" + bgzt + "'");


                    string ML = DateTime.Parse(jcxx.Rows[0]["F_SDRQ"].ToString()).ToString("yyyyMM");
                    //string ML = "";
                    string    message = ""; string jpgname = "";
                    ZgqPDFJPG zgq   = new ZgqPDFJPG();
                    bool      isrtn = zgq.CreatePDF(blh, bglx, bgxh, ZgqPDFJPG.Type.PDF, ref jpgname, "", ref message);

                    string xy = "3";    // ZgqClass.GetSz("ZGQJK", "sctxfs", "3");
                    if (isrtn)
                    {
                        bool ssa = zgq.UpPDF(blh, jpgname, ML, ref message, int.Parse(xy));
                        if (ssa == true)
                        {
                            jpgname = jpgname.Substring(jpgname.LastIndexOf('\\') + 1);
                            ZgqClass.BGHJ(blh, "批量上传", "审核", "生成PDF成功:" + ML + "\\" + jpgname, "ZGQJK", "生成PDF");

                            aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");
                            aa.ExecuteSQL("insert  into T_BG_PDF(F_BLH,F_BGLX,F_BGXH,F_ML,F_FILENAME) values('" + blh + "','" + bglx + "','" + bgxh + "','" + ML + "','" + jpgname + "')");
                            aa.ExecuteSQL("update T_JCXX_FS set F_bz='生成PDF成功',F_FSZT='已处理'  where F_blh='" + blh + "' and F_BGLX='" + bglx.ToLower() + "' and F_BGXH='" + bgxh + "'");
                        }
                        else
                        {
                            log.WriteMyLog(message);
                            ZgqClass.BGHJ(blh, "批量上传", "审核", message, "ZGQJK", "生成PDF");
                            aa.ExecuteSQL("update T_JCXX_FS set F_ISJPG='false',F_bz='" + message + "'  where F_blh='" + blh + "' and F_BGLX='" + bglx + "' and F_BGXH='" + bgxh + "'");
                        }
                        zgq.DelTempFile(blh);
                    }
                    else
                    {
                        aa.ExecuteSQL("update T_JCXX_FS set F_ISJPG='false',F_BZ='" + message + "'  where F_blh='" + blh + "' and F_BGLX='" + bglx + "' and F_BGXH='" + bgxh + "'");
                    }
                }
                else
                {
                    if (bgzt == "取消审核")
                    {
                        DataTable dt2 = aa.GetDataTable("select top 1 * from T_BG_PDF where F_blh='" + blh + "'  and F_BGXH='" + bgxh + "' and F_BGLX='" + bglx + "'", "dt2");
                        if (dt2.Rows.Count <= 0)
                        {
                            aa.ExecuteSQL("update T_jcxx_fs set  F_fszt='已处理',F_bz='取消审核,删除PDF成功!' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "'  and F_fszt='未处理' and F_bgzt='" + bgzt + "'");
                        }
                        else
                        {
                            aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");
                            ZgqPDFJPG zgq     = new ZgqPDFJPG();
                            string    rtn_msg = "";
                            zgq.DelPDFFile("", dt2.Rows[0]["F_FILENAME"].ToString(), ref rtn_msg);
                            aa.ExecuteSQL("update T_JCXX_FS set F_bz='取消审核,删除PDF成功!',F_JPG_errmsg='',F_FSZT='已处理'  where F_blh='" + blh + "' and F_BGLX='" + bglx.ToLower() + "' and F_BGXH='" + bgxh + "'");
                        }
                    }
                    else
                    {
                        aa.ExecuteSQL("update T_jcxx_fs set F_bz='未知操作!' where F_blh='" + blh + "' and F_bglx='" + bglx + "' and F_bgxh='" + bgxh + "' and F_fszt='未处理'");
                    }
                }
            }
        }
예제 #19
0
        public string CaQZ(string blh, string bglx, string bgxh, string debug, DataTable dt_cg, string yhmc, string bgzt)
        {
            string msg     = f.ReadString("savetohis", "camsg", "0").Replace("\0", "");
            string logname = "CAZGQJK";

            dbbase.odbcdb aa   = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");
            string        blbh = blh;

            if (bglx == "bc" || bglx == "bd")
            {
                blbh = blh + bglx + bgxh;
            }

            try
            {
                if (debug == "1")
                {
                    log.WriteMyLog("开始签字。。。", logname);
                }

                DataTable dt_bd = new DataTable();
                DataTable dt_bc = new DataTable();
                //补充审核
                string sql_str = "";
                if (bglx == "bc")
                {
                    sql_str = "select * from T_BCBG where  F_BLH='" + blh + "' and F_BC_BGZT='已审核' and F_BC_BGXH='" + bgxh + "'";
                    dt_bc   = aa.GetDataTable(sql_str, "bcbg");
                    if (dt_bc.Rows.Count <= 0)
                    {
                        log.WriteMyLog("未查询到此补充报告" + blbh, logname);
                        return("0");
                    }
                }
                //小冰冻审核
                if (bglx == "bd")
                {
                    sql_str = "select * from T_BDBG where  F_BLH='" + blh + "' and  F_BD_BGZT='已审核' and F_BD_BGXH='" + bgxh + "'";
                    dt_bd   = aa.GetDataTable(sql_str, "bdbg");
                    if (dt_bd.Rows.Count <= 0)
                    {
                        log.WriteMyLog("未查询到此冰冻报告" + blbh, logname);
                        return("0");
                    }
                }

                string TimeSign_XML = "";
                //时间戳服务地址
                string yztime = f.ReadString("CA", "yztime", "0");
                if (yztime == "1")
                {
                    string timeip = f.ReadString("CA", "timeip_web", "http://172.20.89.23:8080/xjcaTimestamp/services/sign");
                    string hash   = blbh + "^" + dt_cg.Rows[0]["F_XM"].ToString().Trim() + "^" + dt_cg.Rows[0]["F_NL"].ToString().Trim() + "^"
                                    + dt_cg.Rows[0]["F_XM"].ToString().Trim() + "^" + dt_cg.Rows[0]["F_BRBH"].ToString().Trim() + "^" + dt_cg.Rows[0]["F_SQXH"].ToString().Trim() + "^" + dt_cg.Rows[0]["F_ZYH"].ToString().Trim() + "^" + dt_cg.Rows[0]["F_MZH"].ToString().Trim() + "^" + dt_cg.Rows[0]["F_SFZH"].ToString().Trim();
                    if (debug == "1")
                    {
                        log.WriteMyLog("验证时间戳:" + blbh + "\n" + hash, logname);
                    }
                    //返回值时间戳xml(TimeSign_XML)需要写人数据库
                    StringBuilder md5 = new StringBuilder(Getmd5(hash));
                    try
                    {
                        TimeSign_XML = XJCA_TimeSign(timeip, blbh, md5);
                    }
                    catch (Exception ee2)
                    {
                        if (msg == "1")
                        {
                            MessageBox.Show("CA签名:时间戳验证失败:" + ee2.Message);
                        }
                        ZgqClass.BGHJ(blh, yhmc, "数字签名", "时间戳验证失败:" + ee2.Message, "ZGQJK", "CA签名");
                        log.WriteMyLog("CA签名:时间戳验证失败:" + ee2.Message, logname);
                        return("0");
                    }
                    if (debug == "1")
                    {
                        log.WriteMyLog("CA签名:TimeSign_XML:" + TimeSign_XML, logname);
                    }

                    if (debug == "1")
                    {
                        log.WriteMyLog("CA签名:时间戳完成", logname);
                    }
                }


                //签章----------------------------------
                if (debug == "1")
                {
                    log.WriteMyLog("CA签名:开始签章。。。", logname);
                }


                //签章原文
                string xmlstr = "";
                string bgwy   = "";

                if (bglx == "cg" || bglx == "")
                {
                    xmlstr = xmlstr + "<F_BLZD><![CDATA[" + dt_cg.Rows[0]["F_BLZD"].ToString() + "]]></F_BLZD>";
                    xmlstr = xmlstr + "<F_BGYS>" + dt_cg.Rows[0]["F_BGYS"].ToString() + "</F_BGYS>";
                    xmlstr = xmlstr + "<F_SHYS>" + dt_cg.Rows[0]["F_SHYS"].ToString() + "</F_SHYS>";
                    xmlstr = xmlstr + "<F_BGRQ>" + dt_cg.Rows[0]["F_BGRQ"].ToString() + "</F_BGRQ>";
                    xmlstr = xmlstr + "<F_SPARE5>" + dt_cg.Rows[0]["F_spare5"].ToString() + "</F_SPARE5>";
                    xmlstr = xmlstr + "<F_BGLX>" + "cg1" + "</F_BGLX>";
                }
                if (bglx == "bc" && dt_bc.Rows.Count > 0)
                {
                    xmlstr = xmlstr + "<F_BLZD><![CDATA[" + dt_bc.Rows[0]["F_BCZD"].ToString() + "]]></F_BLZD>";
                    xmlstr = xmlstr + "<F_BGYS>" + dt_bc.Rows[0]["F_BC_BGYS"].ToString() + "</F_BGYS>";
                    xmlstr = xmlstr + "<F_SHYS>" + dt_bc.Rows[0]["F_BC_SHYS"].ToString() + "</F_SHYS>";
                    xmlstr = xmlstr + "<F_BGRQ>" + dt_bc.Rows[0]["F_BC_BGRQ"].ToString() + "</F_BGRQ>";
                    xmlstr = xmlstr + "<F_SPARE5>" + dt_bc.Rows[0]["F_BC_spare5"].ToString() + "</F_SPARE5>";
                    xmlstr = xmlstr + "<F_BGLX>" + "bc" + bgxh + "</F_BGLX>";
                }
                if (bglx == "bd")
                {
                    xmlstr = xmlstr + "<F_BLZD><![CDATA[" + dt_bd.Rows[0]["F_BDZD"].ToString() + "]]></F_BLZD>";
                    xmlstr = xmlstr + "<F_BGYS>" + dt_bd.Rows[0]["F_BD_BGYS"].ToString() + "</F_BGYS>";
                    xmlstr = xmlstr + "<F_SHYS>" + dt_bd.Rows[0]["F_BD_SHYS"].ToString() + "</F_SHYS>";
                    xmlstr = xmlstr + "<F_BGRQ>" + dt_bd.Rows[0]["F_BD_BGRQ"].ToString() + "</F_BGRQ>";
                    xmlstr = xmlstr + "<F_SPARE5>" + dt_bd.Rows[0]["F_BD_BGRQ"].ToString() + "</F_SPARE5>";
                    xmlstr = xmlstr + "<F_BGLX>" + "bd" + dt_bd.Rows[0]["F_BD_BGXH"].ToString() + "</F_BGLX>";
                }
                if (xmlstr == "")
                {
                    log.WriteMyLog("CA签名:签章数据内容为空,请重新审核", logname);
                    if (msg == "1")
                    {
                        MessageBox.Show("CA签名失败:签章数据内容为空");
                    }
                    ZgqClass.BGHJ(blh, yhmc, "数字签名", "签章数据内容为空", "ZGQJK", "CA签名");
                    return("0");
                }
                string bgyw = "";
                bgyw = "<BL>";
                bgyw = bgyw + "<F_BLBH>" + blbh + "</F_BLBH>";
                bgyw = bgyw + "<F_BLH>" + blh + "</F_BLH>";
                bgyw = bgyw + "<F_XM>" + blh + "</F_XM>";
                bgyw = bgyw + "<F_XB>" + blh + "</F_XB>";
                bgyw = bgyw + "<F_NL>" + blh + "</F_NL>";
                bgyw = bgyw + "<F_ZYH>" + blh + "</F_ZYH>";
                bgyw = bgyw + "<F_MZH>" + blh + "</F_MZH>";
                bgyw = bgyw + "<F_SQXH>" + blh + "</F_SQXH>";
                bgyw = bgyw + "<F_YZID>" + blh + "</F_YZID>";
                bgyw = bgyw + "<F_BRBH>" + blh + "</F_BRBH>";
                bgyw = bgyw + "<F_SFZH>" + blh + "</F_SFZH>";
                bgyw = bgyw + "<F_SDRQ>" + blh + "</F_SDRQ>";
                bgyw = bgyw + "<F_CH>" + blh + "</F_CH>";
                bgyw = bgyw + xmlstr + "</BL>";

                if (debug == "1")
                {
                    log.WriteMyLog("CA签名:签章内容:" + bgyw, logname);
                }


                try
                {
                    int           len     = 0;
                    StringBuilder signxml = new StringBuilder(100000);

                    bool qzrtn = XJCA_SignSeal(Getmd5(bgyw), signxml, ref len);

                    if (debug == "1")
                    {
                        log.WriteMyLog("CA签名:" + signxml.ToString(), logname);
                    }
                    if (!qzrtn)
                    {
                        log.WriteMyLog("CA签名:数字签名失败,请重新审核" + qzrtn, logname);

                        if (msg == "1")
                        {
                            MessageBox.Show("CA签名:数字签名失败,请重新审核" + qzrtn);
                        }
                        ZgqClass.BGHJ(blh, yhmc, "数字签名", "CA签名:数字签名失败" + qzrtn, "ZGQJK", "CA签名");
                        return("0");
                    }
                    else
                    {
                        string sign = signxml.ToString().Trim();
                        if (sign == "")
                        {
                            log.WriteMyLog("CA签名:KEY密码验证失败:签名失败", logname);
                            if (msg == "1")
                            {
                                MessageBox.Show("CA签名:KEY密码验证失败:签名失败");
                            }
                            ZgqClass.BGHJ(blh, yhmc, "数字签名", "CA签名:KEY密码验证失败:签名失败", "ZGQJK", "CA签名");
                            return("0");
                        }

                        if (sign.Split(',')[0].Trim() == "")
                        {
                            log.WriteMyLog("CA签名:KEY密码验证失败:签名失败", logname);
                            if (msg == "1")
                            {
                                MessageBox.Show("CA签名失败:KEY密码验证失败:签名失败");
                            }
                            ZgqClass.BGHJ(blh, yhmc, "数字签名", "CA签名:KEY密码验证失败:签名失败", "ZGQJK", "CA签名");

                            return("0");
                        }

                        if (debug == "1")
                        {
                            log.WriteMyLog("CA签名:签字通过,解析返回值", logname);
                        }
                        try
                        {
                            // 签章返回的信息signxml 包含签章数据,证书内容,证书id,以“,”隔开,保存签章数据和证书id
                            string[] getsignxml = signxml.ToString().Split(',');
                            //签章数据
                            string signxml_str = getsignxml[0];
                            //证书内容
                            string cert = getsignxml[1];
                            //证书id
                            string certID = getsignxml[2];
                            //将signxml,,TimeSign_XML等返回值 存入数据库-------------
                            try
                            {
                                string sqlstr = "insert into T_CAXX(F_blbh,blh,RQ,KeyName,bgnr,TimeSign_XML,signxml,cert,certID) values ('" + blbh + "','" + blh + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + yhmc + "','" + bgyw + "','" + TimeSign_XML + "','" + signxml.ToString() + "','" + cert + "','" + certID + "') ";

                                int x = SQL_ExecuteNonQuery(sqlstr);

                                if (x <= 0)
                                {
                                    log.WriteMyLog("CA签名:写入数据库T_SZQM失败", logname);
                                    if (msg == "1")
                                    {
                                        MessageBox.Show("CA签名:写入数据库T_SZQM失败");
                                    }
                                    ZgqClass.BGHJ(blh, yhmc, "数字签名", "CA签名:写入数据库T_SZQM失败", "ZGQJK", "CA签名");

                                    return("0");
                                }
                                else
                                {
                                    if (debug == "1")
                                    {
                                        log.WriteMyLog("CA签名:插入T_SZQM完成", logname);
                                    }
                                    if (bglx == "cg")
                                    {
                                        aa.ExecuteSQL("update T_JCXX  set F_SZQZ='1' where F_BLH='" + blh + "'");
                                    }
                                    if (bglx == "bc")
                                    {
                                        aa.ExecuteSQL("update T_BCBG  set F_SZQZ='1' where F_BLH='" + blh + "' and F_bc_bgxh='" + bgxh + "'");
                                    }
                                    if (bglx == "bd")
                                    {
                                        aa.ExecuteSQL("update T_BDBG  set F_SZQZ='1' where F_BLH='" + blh + "' and F_bd_bgxh='" + bgxh + "'");
                                    }
                                    ZgqClass.BGHJ(blh, yhmc, "数字签名", "CA签名:签名成功", "ZGQJK", "CA签名");
                                }
                            }
                            catch (Exception ee7)
                            {
                                log.WriteMyLog("CA签名:写入数据库异常:" + ee7.Message, logname);
                                if (msg == "1")
                                {
                                    MessageBox.Show("CA签名:写入数据库异常:" + ee7.Message);
                                }
                                ZgqClass.BGHJ(blh, yhmc, "数字签名", "CA签名:写入数据库异常:" + ee7.Message, "ZGQJK", "CA签名");

                                return("0");
                            }
                        }
                        catch (Exception ee8)
                        {
                            log.WriteMyLog("CA签名:解析签名数据异常:" + ee8.Message, logname);
                            if (msg == "1")
                            {
                                MessageBox.Show("CA签名:解析签名数据异常:" + ee8.Message);
                            }
                            ZgqClass.BGHJ(blh, yhmc, "数字签名", "CA签名:解析签名数据异常:" + ee8.Message, "ZGQJK", "CA签名");

                            return("0");
                        }
                    }

                    log.WriteMyLog("CA签名:签名完成", logname);
                }
                catch (Exception ee9)
                {
                    log.WriteMyLog("CA签名:签名异常:" + ee9.Message, logname);
                    if (msg == "1")
                    {
                        MessageBox.Show("CA签名:签名异常:" + ee9.Message);
                    }
                    ZgqClass.BGHJ(blh, yhmc, "数字签名", "CA签名:签名异常:" + ee9.Message, "ZGQJK", "CA签名");

                    return("0");
                }

                //----------------------------------------------
                //----------------获取签章图片----------------------
                //----------------------------------------------
                string getbmpfs = f.ReadString("CA", "getbmpfs", "2").Replace("\0", "").Trim();
                string upbmpfs  = f.ReadString("CA", "upbmpfs", "0").Replace("\0", "").Trim();
                string bmppath  = ZgqClass.GetSz("view", "szqmlj", Application.StartupPath.ToString() + "\\rpt-szqm\\ysbmp").Replace("\0", "");



                if (getbmpfs == "0")
                {
                    goto GetEwm;
                }
                if (getbmpfs == "2")
                {
                    if (File.Exists(bmppath + "\\" + yhmc + ".bmp"))
                    {
                        goto GetEwm;
                    }
                }
                if (!Directory.Exists(Application.StartupPath.ToString() + "\\rpt-szqm\\YSBMP\\"))
                {
                    Directory.CreateDirectory(Application.StartupPath.ToString() + "\\rpt-szqm\\YSBMP\\");
                }
                if (debug == "1")
                {
                    log.WriteMyLog("获取签章图片开始。。。", logname);
                }
                bool ss = XJCA_GetSealBMPB(Application.StartupPath.ToString() + "\\rpt-szqm\\YSBMP\\" + yhmc + ".bmp", 1);
                // XJCA_ResetDevice();
                if (ss)
                {
                    if (!File.Exists(Application.StartupPath.ToString() + "\\rpt-szqm\\YSBMP\\" + yhmc + ".bmp"))
                    {
                        log.WriteMyLog("获取签章图片失败" + Application.StartupPath.ToString() + "\\rpt-szqm\\YSBMP\\" + yhmc + ".bmp", logname);
                    }

                    if (debug == "1")
                    {
                        log.WriteMyLog("获取签章图片成功,开始上传。。", logname);
                    }

                    if (upbmpfs == "1")
                    {
                        if (debug == "1")
                        {
                            log.WriteMyLog("上传签名图片:" + Application.StartupPath.ToString() + "\\rpt-szqm\\YSBMP\\" + yhmc + ".bmp --->" + bmppath + yhmc + ".bmp", logname);
                        }

                        File.Copy(Application.StartupPath.ToString() + "\\rpt-szqm\\YSBMP\\" + yhmc + ".bmp", bmppath + yhmc + ".bmp", true);
                        if (!File.Exists(bmppath + yhmc + ".bmp"))
                        {
                            log.WriteMyLog("签章图片上传失败" + bmppath + yhmc + ".bmp", logname);
                            return("0");
                        }
                        if (debug == "1")
                        {
                            log.WriteMyLog("签章图片上传成功", logname);
                        }

                        return("1");
                    }
                    if (upbmpfs == "2")
                    {
                        ///////上传签章图片至ftp---------------------
                        string ftpServerIP = f.ReadString("ftp", "ftpip", "");
                        string ftpUserID   = f.ReadString("ftp", "user", "");
                        string ftpPassword = f.ReadString("ftp", "pwd", "");
                        string ftpszqmpath = f.ReadString("ca", "ftpszqmpath", "/pathsetup/pathqc/rpt-szqm/YSBMP/");
                        string ftpURI      = "ftp://" + ftpServerIP + "/" + ftpszqmpath + "/";
                        string status      = "";
                        FtpWeb fw          = new FtpWeb(ftpServerIP, ftpszqmpath, ftpUserID, ftpPassword);

                        fw.Upload(Application.StartupPath.ToString() + "\\rpt-szqm\\YSBMP\\" + yhmc + ".bmp", "", out status);
                        if (status == "Error")
                        {
                            log.WriteMyLog("CA签名:签章图片上传失败,请重新审核", logname);
                            return("0");
                        }
                        if (debug == "1")
                        {
                            log.WriteMyLog("签章图片上传成功", logname);
                        }
                    }
                }
                else
                {
                    if (debug == "1")
                    {
                        log.WriteMyLog("签章图片获取失败,请重新审核", logname);
                    }
                    return("1");
                }


                /////验章
                // XJCAverify.(M_signxml, M_signxml.Length, Application.StartupPath.ToString() + "\\rpt-szqm\\MakePdfFile\\" + blbh + "EWM.BMP", 7, 3, 3, 0);

GetEwm:
                # region 获取二维码图片
                string get2wm = f.ReadString("ca", "get2wm", "0").Replace("\0", "");

                if (get2wm == "1")
                {
                    if (!Directory.Exists(Application.StartupPath.ToString() + "\\rpt-szqm\\MakePdfFile\\"))
                    {
                        Directory.CreateDirectory(Application.StartupPath.ToString() + "\\rpt-szqm\\MakePdfFile\\");
                    }
                    else
                    {
                        DirectoryInfo dir = new DirectoryInfo(Application.StartupPath.ToString() + @"\rpt-szqm\MakePdfFile\");
                        foreach (FileInfo ff in dir.GetFiles("*.*"))
                        {
                            ff.Delete();
                        }
                    }

                    StringBuilder M_signxml = new StringBuilder(blbh, 10000);
                    XJCA_MakePdf417ToFile(M_signxml, M_signxml.Length, Application.StartupPath.ToString() + "\\rpt-szqm\\MakePdfFile\\" + blbh + "EWM.BMP", 7, 3, 3, 0);
                    //XJCA_ResetDevice();
                    if (!File.Exists(Application.StartupPath.ToString() + "\\rpt-szqm\\MakePdfFile\\" + blbh + "EWM.BMP"))
                    {
                        log.WriteMyLog("二维码不存在" + Application.StartupPath.ToString() + "\\rpt-szqm\\MakePdfFile\\" + blbh + "EWM.BMP", logname);
                        return("1");
                    }
                    string up2wmfs = f.ReadString("ca", "up2wmfs", "1").Replace("\0", "");
                    if (up2wmfs == "1")
                    {
                        string ewmpath = f.ReadString("ca", "ewmpath", Application.StartupPath.ToString() + "\\rpt-szqm\\MakePdfFile").Replace("\0", "");
                        if (debug == "1")
                        {
                            log.WriteMyLog("上传二维码图片:" + Application.StartupPath.ToString() + "\\rpt-szqm\\MakePdfFile\\" + blbh + "EWM.BMP --->" + ewmpath + "\\" + blbh + "EWM.BMP", logname);
                        }
                        File.Copy(Application.StartupPath.ToString() + "\\rpt-szqm\\MakePdfFile\\" + blbh + "EWM.BMP", ewmpath + "\\" + blbh + "EWM.BMP", true);
                        if (!File.Exists(ewmpath + "\\" + blbh + "EWM.BMP"))
                        {
                            log.WriteMyLog("二维码图片上传失败" + ewmpath + "\\" + blbh + "EWM.BMP", logname);
                            return("0");
                        }
                        if (debug == "1")
                        {
                            log.WriteMyLog("二维码图片上传成功", logname);
                        }
                        return("1");
                    }
                    if (upbmpfs == "2")
                    {
                        ///////上传签章图片至ftp---------------------
                        string ftpServerIP = f.ReadString("ftp", "ftpip", "");
                        string ftpUserID   = f.ReadString("ftp", "user", "");
                        string ftpPassword = f.ReadString("ftp", "pwd", "");
                        string ftpewmpath  = f.ReadString("ca", "ftpewmpath", "/pathimages/szqm/MakePdfFile/");

                        string ftpURI = "ftp://" + ftpServerIP + "/" + ftpewmpath + "/";
                        string status = "";
                        FtpWeb fw     = new FtpWeb(ftpServerIP, ftpewmpath, ftpUserID, ftpPassword);
                        fw.Upload(Application.StartupPath.ToString() + "\\rpt-szqm\\MakePdfFile\\" + blbh + "EWM.BMP", "", out status);
                        if (status == "Error")
                        {
                            log.WriteMyLog("二维码图片上传失败,请重新审核!", logname);
                            return("0");
                        }
                        if (debug == "1")
                        {
                            log.WriteMyLog("二维码图片上传成功", logname);
                        }
                    }
                }
                return("1");
            }
            catch (Exception ee1)
            {
                log.WriteMyLog(ee1.Message, logname);
                return("0");
            }
            #endregion
        }
예제 #20
0
        public void pathtoTJ(string blh, string bglx, string bgxh, DataTable jcxx, string debug)
        {
            ////增加体检回写接口/////zgq
            if (jcxx.Rows[0]["F_BRLB"].ToString().Trim() == "体检" && jcxx.Rows[0]["F_brbh"].ToString().Trim() == "体检")
            {
                // 生成pdf
                string err_msg = "";
                string constr  = f.ReadString("savetohis", "tj_odbcsql", "Data Source=192.168.90.236;Initial Catalog=tj_xlms;User Id=xlmsuser;Password=topsky;");

                SqlDB db = new SqlDB();


                if (jcxx.Rows[0]["F_BGZT"].ToString().Trim() == "已审核")
                {
                    string ML = DateTime.Parse(jcxx.Rows[0]["F_SDRQ"].ToString()).ToString("yyyyMM");

                    string jpgname = "";
                    string jpgpath = "";

                    //生成jpg
                    bool isrtn = MD_PDF_JPG(blh, bglx, bgxh, ML, ZgqPDFJPG.Type.JPG, ref err_msg, ref jpgname, ref jpgpath);
                    if (isrtn)
                    {
                        jpgname = jpgname.Substring(jpgname.LastIndexOf('\\') + 1);
                        ZgqClass.BGHJ(blh, "体检接口", "审核", "生成jpg成功:" + ML + "\\" + jpgname, "ZGQJK", "jpg");

                        aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");
                        aa.ExecuteSQL("insert  into T_BG_PDF(F_BLH,F_BGLX,F_BGXH,F_ML,F_FILENAME) values('" + blh + "','" + bglx + "','" + bgxh + "','" + jpgpath + "','" + jpgname + "')");
                    }
                    else
                    {
                        log.WriteMyLog(blh + "-" + err_msg);
                        ZgqClass.BGHJ(blh, "体检接口", "审核", "生成jpg失败" + err_msg, "ZGQJK", "jpg");
                        if (debug == "1")
                        {
                            MessageBox.Show("病理号:" + blh + "  生成jpg失败,请重新审核!\r\n" + err_msg);
                        }
                        //   return;
                    }

                    # region 回传体检报告
                    DataTable TJ_bljc = new DataTable();
                    TJ_bljc = aa.GetDataTable(" select top 1  *  from T_TBS_BG where  F_blh='" + blh + "'", "blxx");

                    // 诊断描述
                    string Res_char = jcxx.Rows[0]["F_jxsj"].ToString().Trim();
                    //诊断结论	Res_con
                    string Res_con = jcxx.Rows[0]["F_blzd"].ToString().Trim();

                    if (TJ_bljc.Rows.Count > 0)
                    {
                        if (jcxx.Rows[0]["F_blk"].ToString().Trim().Contains("TCT"))
                        {
                            Res_char = Res_char + "标本满意度:" + TJ_bljc.Rows[0]["F_TBS_BBMYD"].ToString().Trim() + "\r\n";

                            Res_char = Res_char + TJ_bljc.Rows[0]["F_TBS_XBL"].ToString().Trim() + "\r\n" + TJ_bljc.Rows[0]["F_TBS_XBXM1"].ToString().Trim()
                                       + "\r\n" + TJ_bljc.Rows[0]["F_TBS_XBXM2"].ToString().Trim() + "\r\n" + TJ_bljc.Rows[0]["F_TBS_XBXM3"].ToString().Trim()
                                       + "\r\n病原微生物:" + TJ_bljc.Rows[0]["F_TBS_WSW2"].ToString().Trim() + "\r\n" + TJ_bljc.Rows[0]["F_TBS_WSW1"].ToString().Trim()
                                       + "\r\n" + TJ_bljc.Rows[0]["F_TBS_WSW3"].ToString().Trim() + "\r\n" + TJ_bljc.Rows[0]["F_TBS_BDXM1"].ToString().Trim() + "\r\n";

                            Res_char = Res_char + "炎症程度:" + TJ_bljc.Rows[0]["F_TBS_YZCD"].ToString().Trim() + "\r\n";

                            ///////////诊断/////////////////////////
                            Res_con = "诊断:" + TJ_bljc.Rows[0]["F_TBSZD"].ToString().Trim() + "\r\n" + "\r\n";
                            if (TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() != "")
                            {
                                Res_con = Res_con + "补充意见:" + TJ_bljc.Rows[0]["F_TBS_BCYJ1"].ToString().Trim() + "\r\n";
                            }
                        }
                    }

                    /////////////////////////////////////////////////////
                    string path = f.ReadString("savetohis", "jpgpath", @"\\192.10.33.84\pdfbg\");
                    jpgpath = path + jpgpath + "\\" + jpgname;

                    string sql_insert = "insert into tj_pacsjgb(Djlsh,Zhxmbh,jg,jcsj,Jl,shr,Shrq,Tpzt,jcqkfzsm,Tplj,czy,Sysdatetime,Jkid,flag)"
                                        + " values('" + jcxx.Rows[0]["F_MZH"].ToString().Trim() + "','" + jcxx.Rows[0]["F_YZID"].ToString().Trim() + "','"
                                        + Res_con + "','" + Res_char + "','','" + jcxx.Rows[0]["F_SHYS"].ToString().Trim() + "','"
                                        + jcxx.Rows[0]["F_spare5"].ToString().Trim() + "','1','病理检查','" + jpgpath + ";','" + jcxx.Rows[0]["F_bgYS"].ToString().Trim() + "','" + DateTime.Now + "',2,'0')";



                    string sql_del = "delete from tj_pacsjgb  where Djlsh='" + jcxx.Rows[0]["F_MZH"].ToString().Trim() + "' and Zhxmbh='" + jcxx.Rows[0]["F_YZID"].ToString().Trim() + "' and jcqkfzsm='病理检查'";

                    //删除
                    if (debug == "1")
                    {
                        log.WriteMyLog("删除体检表,语句:" + sql_del);
                    }

                    int x = db.ExecuteNonQuery(constr, sql_del, ref err_msg);
                    if (debug == "1")
                    {
                        log.WriteMyLog("删除体检表:" + err_msg + "@" + x.ToString());
                    }


                    if (debug == "1")
                    {
                        log.WriteMyLog("回写体检表,语句:" + sql_insert);
                    }
                    //插入
                    x = db.ExecuteNonQuery(constr, sql_insert, ref err_msg);

                    if (debug == "1")
                    {
                        log.WriteMyLog("回写体检表:" + err_msg + "@" + x.ToString());
                    }

                    if (x < 0)
                    {
                        ZgqClass.BGHJ(blh, "体检接口", "审核", "回写体检报告失败:" + err_msg, "ZGQJK", "体检接口");

                        log.WriteMyLog(blh + "-" + err_msg);
                        if (debug == "1")
                        {
                            MessageBox.Show("病理号:" + blh + "-回写体检报告失败,请重新审核!\r\n" + err_msg);
                        }
                    }
                    else
                    {
                        ZgqClass.BGHJ(blh, "体检接口", "审核", "回写体检报告成功", "ZGQJK", "体检接口");
                        aa.ExecuteSQL("update T_JCXX  set F_TJBJ='2' where F_BLH='" + blh + "'");
                        if (debug == "1")
                        {
                            MessageBox.Show("病理号:" + blh + "-回写体检报告成功");
                        }
                    }

                    return;

                    #endregion
                }
                else
                {
                    if (jcxx.Rows[0]["F_TJBJ"].ToString().Trim() == "2")
                    {
                        DataTable dt2 = aa.GetDataTable("select top 1 * from T_BG_PDF where F_blh='" + blh + "'  and F_BGXH='" + bgxh + "' and F_BGLX='" + bglx + "'", "dt2");
                        if (dt2.Rows.Count > 0)
                        {
                            aa.ExecuteSQL("delete T_BG_PDF  where F_BLH='" + blh + "' and  F_BGLX='" + bglx + "'  and F_BGXH='" + bgxh + "'");
                            //删除ftp上pdf文件
                            ZgqPDFJPG zgq     = new ZgqPDFJPG();
                            string    rtn_msg = "";
                            zgq.DelPDFFile(dt2.Rows[0]["F_ML"].ToString(), dt2.Rows[0]["F_FILENAME"].ToString(), ref rtn_msg);
                        }
                        string sql_del = "delete from tj_pacsjgb  where Djlsh='" + jcxx.Rows[0]["F_MZH"].ToString().Trim() + "' and Zhxmbh='" + jcxx.Rows[0]["F_YZID"].ToString().Trim() + "' and jcqkfzsm='病理检查'";

                        //删除
                        if (debug == "1")
                        {
                            log.WriteMyLog("删除体检表,语句:" + sql_del);
                        }

                        int x = db.ExecuteNonQuery(constr, sql_del, ref err_msg);

                        if (debug == "1")
                        {
                            log.WriteMyLog("删除体检表:" + err_msg + "@" + x.ToString());
                        }

                        return;
                    }
                }
            }