Beispiel #1
0
        public string cdicom(string blh, DataTable bljc, sqldb aa, ref string dcmlb)
        {
            string ftplocal = @"c:\temp_sr\" + blh;

            try
            {
                System.IO.Directory.CreateDirectory(ftplocal);
            }
            catch
            { }
            IniFiles2 f = new IniFiles2(Application.StartupPath + "\\sz.ini");

            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_sr").Replace("\0", "");
            string    ftpremotepath = f.ReadString("ftp", "ftpremotepath", "pathimages").Replace("\0", "");
            FtpWeb    fw            = new FtpWeb(ftpserver, ftpremotepath, ftpuser, ftppwd);
            string    txml          = bljc.Rows[0]["F_txml"].ToString().Trim();
            DataTable txlb          = aa.GetDataTable("select top 4 * from V_DYTX where F_blh='" + blh + "' and (F_pacs IS NULL OR f_PACS<>'3')", "txlb");

            for (int i = 0; i < txlb.Rows.Count; i++)
            {
                string ftpstatus = "";
                fw.Download(ftplocal, txml + "/" + txlb.Rows[i]["F_txm"].ToString().Trim(), txlb.Rows[i]["F_txm"].ToString().Trim(), out ftpstatus);
                if (ftpstatus == "Error")
                {
                    log.WriteMyLog("图像下载失败!");
                    return("");
                }
            }



            //DataTable txb = aa.GetDataTable("select top 4 * from V_dytx where F_blh='" + blh + "'", "txb");
            for (int i = 0; i < txlb.Rows.Count; i++)
            {
                string      dcmname = @"c:\temp_sr\" + blh + @"\" + i.ToString() + ".dcm";
                dicomfilezh df      = new dicomfilezh();

                df.createdicom(blh, aa, @"c:\temp_sr\" + blh + @"\" + txlb.Rows[i]["F_txm"].ToString().Trim(), ref dcmname, "");

                if (dcmname == "")
                {
                    log.WriteMyLog("重新生成一次!");
                    df.createdicom(blh, aa, @"c:\temp_sr\" + blh + @"\" + txlb.Rows[i]["F_txm"].ToString().Trim(), ref dcmname, "");
                }
                if (dcmname != "")
                {
                    aa.ExecuteSQL("update T_tx set F_pacs='" + dcmname + "' where F_id='" + txlb.Rows[i]["F_id"].ToString().Trim() + "'");
                    dcmlb = dcmlb + dcmname + "^";
                }
            }
            return("true");
        }
        private void stzxyy()
        {
            DataTable bljc = new DataTable();
            DataTable blbd = new DataTable();
            string    brlb = "";

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

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

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

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

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

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



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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

                if (sdwsint < 1)
                {
                    MessageBox.Show("HIS写入失败!" + sdwsint.ToString());
                }
                return;
            }
            return;
        }
Beispiel #3
0
        public string createdicom(string blh, sqldb aa, string bmpname, ref string dcmname, string bmpint)
        {
            string yydm = f.ReadString("dicom", "yydm", "南京鼓楼医院").Replace("\0", "");
            string sbmc = f.ReadString("dicom", "sbmc", "PIS").Replace("\0", "");

            if (bmpint == "")
            {
                bmpint = bmpname.Substring(bmpname.Length - 7, 3);
            }
            DataTable jcxx = aa.GetDataTable("select * from T_jcxx where F_blh='" + blh + "'", "jcxx");

            if (jcxx.Rows.Count < 1)
            {
                log.WriteMyLog("未找到病理号!");
                dcmname = "";
                return("");
            }
            string STUDYID = jcxx.Rows[0]["F_STUDY_UID"].ToString().Trim();

            if (STUDYID == "")
            {
                STUDYID = "72.67.90.68.71." + GetNumFromStr(blh) + "." + DateTime.Now.ToString("yyyyMMdd.HHss");
                aa.ExecuteSQL("update T_jcxx set F_STUDY_UID ='" + STUDYID + "' where F_blh='" + blh + "'");
            }
            if ((int)dllload.initPath("wtimgapi.dll") == 0)
            {
                log.WriteMyLog("dicom生成控件调用错误!");
                dcmname = "";
                return("");
            }

            string brsr = jsnl(jcxx);

            System.Drawing.Bitmap BMP1 = new System.Drawing.Bitmap(bmpname);
            int BH = BMP1.Height;
            int BW = BMP1.Width;

            BMP1.Dispose();
            wt_setDcmdataset dcmset = (wt_setDcmdataset)dllload.InvokeMethod("wt_setDcmdataset", typeof(wt_setDcmdataset));

            wt_createdicomfile writedcm = (wt_createdicomfile)dllload.InvokeMethod("wt_createdicomfile", typeof(wt_createdicomfile));
            string             xb       = "O";

            if (jcxx.Rows[0]["F_xb"].ToString().Trim() == "男")
            {
                xb = "M";
            }
            if (jcxx.Rows[0]["F_xb"].ToString().Trim() == "女")
            {
                xb = "F";
            }
            string nl = jcxx.Rows[0]["F_age"].ToString() + "Y";
            string ss = jcxx.Rows[0]["F_nl"].ToString();

            if (ss.IndexOf("岁") > 0)
            {
                nl = ss.Substring(0, ss.IndexOf("岁")) + "Y";
            }
            else if (ss.IndexOf("月") > 0)
            {
                nl = ss.Substring(0, ss.IndexOf("岁")) + "M";
            }
            else if (ss.IndexOf("天") > 0)
            {
                nl = ss.Substring(0, ss.IndexOf("岁")) + "D";
            }
            string brlb = "";

            nl = "000" + nl;
            nl = nl.Substring(nl.Length - 4, 4);

            if (jcxx.Rows[0]["F_brlb"].ToString().Trim() == "住院")
            {
                brlb = "INPATIENT";
            }
            if (jcxx.Rows[0]["F_brlb"].ToString().Trim() == "门诊")
            {
                brlb = "OUTPATIENT";
            }
            try
            {
                dcmset(-1, 0x16, -1, -1, "UI", "1.2.840.10008.5.1.4.1.1.7");


                //dcmset(0x2, 0x1, -1, -1, "OB", "00");
                dcmset(0x2, 0x2, -1, -1, "UI", STUDYID);
                dcmset(0x2, 0x3, -1, -1, "UI", STUDYID + ".1." + bmpint);
                dcmset(0x2, 0x10, -1, -1, "UI", "1.2.840.10008.1.2.1");
                dcmset(0x2, 0x12, -1, -1, "UI", "1.3.12.2.1107.5.8.2");
                dcmset(0x2, 0x13, -1, -1, "SH", "SHS_MV300_VA40B");
                dcmset(0x2, 0x16, -1, -1, "AE", "MagicView 300");

                dcmset(0x8, 0x5, -1, -1, "CS", "GB18030");
                dcmset(0x8, 0x8, -1, -1, "CS", "ORIGINAL");
                //   dcmset(0x8, 0x12, -1, -1, "DA", DateTime.Now.ToString("yyyyMMdd"));
                //   dcmset(0x8, 0x13, -1, -1, "TM", DateTime.Now.ToString("HHmmss"));

                dcmset(0x8, 0x16, -1, -1, "UI", STUDYID);

                dcmset(0x8, 0x18, -1, -1, "UI", STUDYID + ".1." + bmpint);

                dcmset(0x8, 0x20, -1, -1, "DA", Convert.ToDateTime(jcxx.Rows[0]["F_bgrq"].ToString().Trim()).ToString("yyyyMMdd"));
                dcmset(0x8, 0x21, -1, -1, "DA", Convert.ToDateTime(jcxx.Rows[0]["F_bgrq"].ToString().Trim()).ToString("yyyyMMdd"));
                //    dcmset(0x8, 0x21, -1, -1, "DA", Convert.ToDateTime(jcxx.Rows[0]["F_bgrq"].ToString().Trim()).ToString("yyyyMMdd"));
                //    dcmset(0x8, 0x22, -1, -1, "DA", Convert.ToDateTime(jcxx.Rows[0]["F_bgrq"].ToString().Trim()).ToString("yyyyMMdd"));
                //    dcmset(0x8, 0x23, -1, -1, "DA", Convert.ToDateTime(jcxx.Rows[0]["F_bgrq"].ToString().Trim()).ToString("yyyyMMdd"));

                dcmset(0x8, 0x30, -1, -1, "TM", "010101");
                dcmset(0x8, 0x31, -1, -1, "TM", "000000");
                //    dcmset(0x8, 0x32, -1, -1, "TM", "000000");
                //    dcmset(0x8, 0x33, -1, -1, "TM", "000000");

                dcmset(0x8, 0x50, -1, -1, "SH", blh);
                dcmset(0x8, 0x54, -1, -1, "AE", "");

                dcmset(0x8, 0x60, -1, -1, "CS", sbmc);

                dcmset(0x8, 0x64, -1, -1, "CS", "DI");
                dcmset(0x8, 0x70, -1, -1, "LO", "WUXI LOGENE");
                dcmset(0x8, 0x80, -1, -1, "LO", yydm);//医院代码

                dcmset(0x8, 0x90, -1, -1, "PN", "");
                //   dcmset(0x8, 0x1010, -1, -1, "SH", " ");
                dcmset(0x8, 0x1030, -1, -1, "LO", "NORMAL");
                dcmset(0x8, 0x1080, -1, -1, "LO", "");
                //jcxx.Rows[0]["F_xm"].ToString().Trim()
                dcmset(0x10, 0x10, -1, -1, "PN", jcxx.Rows[0]["F_xm"].ToString().Trim());
                //dcmset(0x10, 0x10, -1, -1, "PN", hl7en2);

                //dcmset(0x10, 0x20, -1, -1, "LO", jcxx.Rows[0]["F_YZID"].ToString().Trim());

                dcmset(0x10, 0x20, -1, -1, "LO", jcxx.Rows[0]["F_brbh"].ToString().Trim());

                //dcmset(0x10, 0x21, -1, -1, "LO", "SITE_DEFAULT_LOCAL");

                dcmset(0x10, 0x30, -1, -1, "DA", brsr);


                dcmset(0x10, 0x40, -1, -1, "CS", xb);
                dcmset(0x10, 0x1000, -1, -1, "AS", jcxx.Rows[0]["F_BRBH"].ToString().Trim());
                dcmset(0x10, 0x1010, -1, -1, "AS", nl);

                //dcmset(0x18, 0x15, -1, -1, "CS", "");

                // dcmset(0x18, 0x1020, -1, -1, "LO", "4.0.106A (VE25A  SL08P13)");
                // dcmset(0x18, 0x5010, -1, -1, "LO", "CH4-1");
                // dcmset(0x18, 0x5022, -1, -1, "DS", "1.03575527668");

                dcmset(0x20, 0xd, -1, -1, "UI", STUDYID);
                dcmset(0x20, 0xe, -1, -1, "UI", STUDYID + ".1");
                dcmset(0x20, 0x10, -1, -1, "SH", blh);
                dcmset(0x20, 0x11, -1, -1, "IS", "1");
                dcmset(0x20, 0x13, -1, -1, "IS", "103");
                //dcmset(0x20, 0x1209, -1, -1, "IS", "2");

                //dcmset(0x20, 0x20, -1, -1, "CS", " ");
                //dcmset(0x20, 0x60, -1, -1, "CS", " ");
                //dcmset(0x20, 0x4000, -1, -1, "LT", " ");

                //dcmset(0x28, 0x2, 3, -1, "US", "");
                //dcmset(0x28, 0x4, -1, -1, "CS", "RGB");
                //dcmset(0x28, 0x26, -1, -1, "CS", "RGB");
                dcmset(0x28, 0x6, 0, -1, "US", "");
                //dcmset(0x28, 0x8, -1, -1, "IS", "1");

                // dcmset(0x28, 0x10, BH, -1, "US", "");
                // dcmset(0x28, 0x11, BW, -1, "US", "");
                dcmset(0x28, 0x14, 0, -1, "US", "");
                // dcmset(0x28, 0x100, 8, -1, "US", "");
                // dcmset(0x28, 0x101, 8, -1, "US", "");
                // dcmset(0x28, 0x102, 7, -1, "US", "");
                dcmset(0x28, 0x103, 0, -1, "US", "");


                //dcmset(0x38, 0x10, 0, -1, "LO", jcxx.Rows[0]["F_mzh"].ToString().Trim());//门诊号
                //dcmset(0x38, 0x11, 0, -1, "LO", jcxx.Rows[0]["F_zyh"].ToString().Trim());//住院号
                //  dcmset(0x38, 0x400, 0, -1, "LO", brlb);
                //FileStream fs = new FileStream(bmpname, FileMode.Open);


                writedcm(bmpname, dcmname);
            }
            catch (Exception ex)
            {
                dcmname = "";
                return(ex.Message);
            }
            finally
            {
                dllload.freeLoadDll();
            }
            return("true");
        }
Beispiel #4
0
        public static string cz1yxml(string Sslbx, string Ssbz, string Debug)
        {
            dbbase.sqldb aa       = new sqldb(Application.StartupPath + "\\sz.ini", "jsddb");
            string       brlb     = "";
            string       codetype = "";
            string       zxks     = f.ReadString(Sslbx, "zxks", "307").Replace("\0", "");
            string       yzxm     = "";

            int sqd = 0;

            if (Sslbx == "体检号")
            {
                brlb     = "3";
                codetype = "1";
                sqd      = f.ReadInteger(Sslbx, "sqd", 0);
                zxks     = f.ReadString(Sslbx, "zxks", "307").Replace("\0", "");
            }
            if (brlb == "")
            {
                MessageBox.Show("无此" + Sslbx);
                return("0");
            }
            string sqlstring = "exec usp_yjjk_getbrxx " + brlb + "," + codetype + ",'" + Ssbz + "',0";

            DataSet ds1 = aa.GetDataSet(sqlstring, "tjdt");

            try
            {
                if (ds1.Tables[0].Rows.Count < 1)
                {
                    MessageBox.Show("未找到病人!");
                    return("0");
                }
            }
            catch
            {
                MessageBox.Show("HIS连接失败!");
                return("0");
            }

            DataTable jcxm = aa.GetDataTable("exec usp_yjjk_getwzxxm " + brlb + ",'" + Ssbz + "','" + Ssbz + "','','',0,0", "jcxm");

            string jcxmdm = "";
            int    intxh  = 0;

            try
            {
                if (jcxm.Rows.Count > 0)
                {
                    //1508250002
                    DataTable dtx = new DataTable();
                    dtx.Columns.Add("序号", Type.GetType("System.String"));
                    dtx.Columns.Add("医嘱项目", Type.GetType("System.String"));
                    dtx.Columns.Add("单价", Type.GetType("System.String"));
                    dtx.Columns.Add("数量", Type.GetType("System.String"));
                    dtx.Columns.Add("申请时间", Type.GetType("System.String"));
                    dtx.Columns.Add("申请科室", Type.GetType("System.String"));
                    dtx.Columns.Add("执行科室", Type.GetType("System.String"));

                    string[] dtxrow = new string[dtx.Columns.Count];
                    for (int i = 0; i < jcxm.Rows.Count; i++)
                    {
                        if (jcxm.Rows[i]["ExecDept"].ToString() != "307" && jcxm.Rows[i]["ExecDept"].ToString() != "病理科")
                        {
                            jcxm.Rows.RemoveAt(i); i--;
                            continue;
                        }

                        dtxrow[0] = i.ToString();
                        dtxrow[1] = jcxm.Rows[i]["ItemName"].ToString();
                        dtxrow[2] = jcxm.Rows[i]["Price"].ToString();
                        dtxrow[3] = jcxm.Rows[i]["ItemQty"].ToString();
                        dtxrow[4] = jcxm.Rows[i]["ApplyTime"].ToString();
                        dtxrow[5] = jcxm.Rows[i]["ApplyDept"].ToString();
                        dtxrow[6] = jcxm.Rows[i]["ExecDept"].ToString();
                        dtx.Rows.Add(dtxrow);
                    }

                    if (dtx.Rows.Count > 1)
                    {
                        yzxz_yfy from2 = new yzxz_yfy(dtx);

                        string xhb = "";

                        if (from2.ShowDialog() == DialogResult.OK)
                        {
                            xhb    = from2.xh;
                            intxh  = Convert.ToInt16(xhb);
                            jcxmdm = jcxm.Rows[intxh]["LogNo"].ToString().Trim();
                            yzxm   = jcxm.Rows[intxh]["ItemName"].ToString().Trim();
                        }
                        else
                        {
                            MessageBox.Show("未选择医嘱!");
                            return("0");
                        }
                    }
                    else
                    {
                        jcxmdm = jcxm.Rows[0]["LogNo"].ToString().Trim();
                        yzxm   = jcxm.Rows[0]["ItemName"].ToString().Trim();
                    }
                }
                else
                {
                    if (MessageBox.Show("未找到医嘱信息,是否提取病人信息?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                    }
                    else
                    {
                        return("0");
                    }
                }
            }
            catch
            {
                if (MessageBox.Show("未找到医嘱信息,是否提取病人信息?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                }
                else
                {
                    return("0");
                }
            }

            int xh = 0;

            if (ds1.Tables[0].Rows.Count > 0)
            {
                string xml = "<?xml version=" + (char)34 + "1.0" + (char)34 + " encoding=" + (char)34 + "gbk" + (char)34 + "?>";
                xml = xml + "<LOGENE>";
                xml = xml + "<row ";
                if (f.ReadInteger(Sslbx, "cardno", 0) != 1)
                {
                    xml = xml + "病人编号=" + (char)34 + ds1.Tables[0].Rows[xh]["PatientID"].ToString().Trim() + (char)34 + " ";
                }
                else
                {
                    xml = xml + "病人编号=" + (char)34 + ds1.Tables[0].Rows[xh]["CardNO"].ToString().Trim() + (char)34 + " ";
                }
                //MessageBox.Show(ds1.Tables[0].Rows[xh]["CardNO"].ToString().Trim());
                //MessageBox.Show(f.ReadInteger(Sslbx, "cardno", 0).ToString());
                try
                {
                    xml = xml + "就诊ID=" + (char)34 + ds1.Tables[0].Rows[xh]["CureNo"].ToString().Trim() + (char)34 + " ";
                }
                catch
                {
                    xml = xml + "就诊ID=" + (char)34 + (char)34 + " ";
                }
                xml = xml + "申请序号=" + (char)34 + "" + (char)34 + " ";

                xml = xml + "门诊号=" + (char)34 + (char)34 + " ";



                xml = xml + "住院号=" + (char)34 + (char)34 + " ";

                xml = xml + "姓名=" + (char)34 + ds1.Tables[0].Rows[xh]["PatName"].ToString().Trim() + (char)34 + " ";
                string xb = "";
                if (ds1.Tables[0].Rows[xh]["Sex"].ToString().Trim() == "1")
                {
                    xb = "男";
                }
                if (ds1.Tables[0].Rows[xh]["Sex"].ToString().Trim() == "2")
                {
                    xb = "女";
                }
                if (ds1.Tables[0].Rows[xh]["Sex"].ToString().Trim() == "3")
                {
                    xb = "其他";
                }

                xml = xml + "性别=" + (char)34 + xb + (char)34 + " ";

                string ppp  = ds1.Tables[0].Rows[xh]["BIRTH"].ToString().Trim();
                string pppp = "";
                string nl   = "";
                try
                {
                    pppp = ppp.Substring(0, 4) + "-" + ppp.Substring(4, 2) + "-" + ppp.Substring(6, 2);
                    nl   = datediff(DateTime.Now, Convert.ToDateTime(pppp));
                }
                catch
                {
                }


                xml = xml + "年龄=" + (char)34 + nl + (char)34 + " ";
                xml = xml + "婚姻=" + (char)34 + (char)34 + " ";
                try
                {
                    xml = xml + "地址=" + (char)34 + ds1.Tables[0].Rows[xh]["Address"].ToString().Trim() + (char)34 + " ";
                }
                catch
                {
                    xml = xml + "地址=" + (char)34 + (char)34 + " ";
                }
                try
                {
                    xml = xml + "电话=" + (char)34 + ds1.Tables[0].Rows[xh]["Phone"].ToString().Trim() + (char)34 + " ";
                }
                catch
                {
                    xml = xml + "电话=" + (char)34 + (char)34 + " ";
                }

                xml = xml + "病区=" + (char)34 + (char)34 + " ";

                try
                {
                    xml = xml + "床号=" + (char)34 + ds1.Tables[0].Rows[xh]["BedNo"].ToString().Trim() + (char)34 + " ";
                }
                catch
                {
                    xml = xml + "床号=" + (char)34 + (char)34 + " ";
                }
                try
                {
                    xml = xml + "身份证号=" + (char)34 + ds1.Tables[0].Rows[xh]["IDNum"].ToString().Trim() + (char)34 + " ";
                }
                catch
                {
                    xml = xml + "身份证号=" + (char)34 + (char)34 + " ";
                }
                try
                {
                    xml = xml + "民族=" + (char)34 + ds1.Tables[0].Rows[xh]["Nation"].ToString().Trim() + (char)34 + " ";
                }
                catch
                {
                    xml = xml + "民族=" + (char)34 + (char)34 + " ";
                }
                try
                {
                    xml = xml + "职业=" + (char)34 + ds1.Tables[0].Rows[xh]["Career"].ToString().Trim() + (char)34 + " ";
                }
                catch
                {
                    xml = xml + "职业=" + (char)34 + (char)34 + " ";
                }

                try
                {
                    xml = xml + "送检科室=" + (char)34 + ds1.Tables[0].Rows[xh]["DeptName"].ToString().Trim() + (char)34 + " ";
                }
                catch
                {
                    xml = xml + "送检科室=" + (char)34 + (char)34 + " ";
                }
                try
                {
                    xml = xml + "送检医生=" + (char)34 + ds1.Tables[0].Rows[xh]["ToDoc"].ToString().Trim() + (char)34 + " ";
                }
                catch
                {
                    xml = xml + "送检医生=" + (char)34 + (char)34 + " ";
                }

                //xml = xml + "临床诊断=" + (char)34 + (char)34 + " ";
                //xml = xml + "临床病史=" + (char)34 + (char)34 + " ";
                xml = xml + "收费=" + (char)34 + (char)34 + " ";
                xml = xml + "标本名称=" + (char)34 + (char)34 + " ";
                xml = xml + "送检医院=" + (char)34 + "本院" + (char)34 + " ";
                xml = xml + "医嘱项目=" + (char)34 + yzxm + (char)34 + " ";
                xml = xml + "备用1=" + (char)34 + (char)34 + " ";

                xml = xml + "备用2=" + (char)34 + jcxmdm + (char)34 + " ";



                string fkfs = "";

                //if (ds1.Tables[0].Rows[xh]["ChargeType"].ToString().Trim() == "7") fkfs = "干保";

                xml = xml + "费别=" + (char)34 + fkfs + (char)34 + " ";

                xml = xml + "病人类别=" + (char)34 + "体检" + (char)34 + " ";

                xml = xml + "/>";
                xml = xml + "<临床病史><![CDATA[" + " " + "]]></临床病史>";
                xml = xml + "<临床诊断><![CDATA[" + " " + "]]></临床诊断>";
                xml = xml + "</LOGENE>";
                if (Debug == "1")
                {
                    log.WriteMyLog("返回的xml字符串:" + xml);
                }
                return(xml);
            }
            else
            {
                MessageBox.Show("无此" + Sslbx);
                return("0");
            }
        }
Beispiel #5
0
        public static string ptxml(string Sslbx, string Ssbz, string Debug)
        {
            string pathWEB = f.ReadString("条形码", "webservicesurl", ""); //获取sz.ini中设置的webservicesurl
            string msg     = w.ReadString("pathgethis", "msg", "");

            if (Sslbx != "")
            {
                if (Sslbx == "条形码")
                {
                    LGHISJKZGQ.nbyzrmyyWeb.PisServiceLJ yzyy = new LGHISJKZGQ.nbyzrmyyWeb.PisServiceLJ();
                    if (pathWEB != "")
                    {
                        yzyy.Url = pathWEB;
                    }
                    string sBillInfo   = "";
                    string sSampleInfo = "";
                    string Mes         = "";
                    try {
                        Mes = yzyy.PatBillWritePIS(Ssbz, ref sBillInfo, ref sSampleInfo, 1);
                        //log.WriteMyLog(sBillInfo + "&" + sSampleInfo);
                    }
                    catch (Exception ee)
                    {
                        MessageBox.Show("此标本条形码不存在,请核对!");
                        if (Debug == "1")
                        {
                            MessageBox.Show(ee.ToString());
                        }
                        log.WriteMyLog("参数:" + Ssbz + "返回值:" + sBillInfo + "提示信息:" + Mes);

                        return("0");
                    }

                    if (Mes != "")
                    {
                        MessageBox.Show("HIS:" + Mes); return("0");
                    }
                    //-------------------------------

                    XmlNode     xmlok = null;
                    XmlDocument xd    = new XmlDocument();
                    try
                    {
                        xd.LoadXml(sBillInfo);
                        xmlok = xd.SelectSingleNode("/BILL");
                    }
                    catch { if (Debug == "1")
                            {
                                MessageBox.Show("XML解析错误");
                            }
                            return("0"); }
                    //标本名称------------------------------------------------------------

                    XmlDocument  xd1   = new XmlDocument();
                    string       bbmc  = "";
                    string       bbbm  = "";
                    string       bbsl  = "0";
                    string       sqxh  = "";
                    int          index = 0;
                    dbbase.sqldb aa    = new sqldb(System.Windows.Forms.Application.StartupPath, "sqlserver");
                    try
                    { xd1.LoadXml(sSampleInfo);
                      XmlNodeList xnl = xd1.SelectNodes("/SAMPLES/SAMPLE");

                      index = xnl.Count;
                      int ii;


                      sqxh = xmlok["HIS_KEYNO"].InnerText;
                      bbmc = xmlok["COLLECTBODY"].InnerText;
                      bbbm = Ssbz;
                      bbsl = index.ToString();

                      ii = aa.ExecuteSQL("insert into t_txm (sqxh,bbbm,sl,sdrq) values('" + sqxh + "','" + bbbm + "','" + bbsl + "','" + DateTime.Now + "')"); }
                    catch { if (Debug == "1")
                            {
                                MessageBox.Show("标本XML解析错误");
                            }
                            return("0"); }

                    DataTable dt = aa.GetDataTable("select * from t_txm where sqxh='" + sqxh + "'", "tablename");
                    int       x  = 0;
                    if (dt != null)
                    {
                        x = dt.Rows.Count;
                    }
                    if (index > x)
                    {
                        MessageBox.Show("标本还未扫描完,请继续。。。");
                        return("");
                    }

                    //-返回xml----------------------------------------------------
                    try
                    {
                        string xml = "<?xml version=" + (char)34 + "1.0" + (char)34 + " encoding=" + (char)34 + "gbk" + (char)34 + "?>";
                        xml = xml + "<LOGENE>";
                        xml = xml + "<row ";
                        xml = xml + "病人编号=" + (char)34 + xmlok["MEDRECNO"].InnerText + (char)34 + " ";
                        xml = xml + "就诊ID=" + (char)34 + "" + (char)34 + " ";
                        xml = xml + "申请序号=" + (char)34 + xmlok["HIS_KEYNO"].InnerText + (char)34 + " ";
                        xml = xml + "门诊号=" + (char)34 + xmlok["OUTPATIENTNO"].InnerText + (char)34 + " ";
                        xml = xml + "住院号=" + (char)34 + xmlok["INHOSPITALNO"].InnerText + (char)34 + " ";
                        xml = xml + "姓名=" + (char)34 + xmlok["PNAME"].InnerText + (char)34 + " ";
                        string PSEX = xmlok["PSEX"].InnerText;
                        if (PSEX == "F")
                        {
                            PSEX = "女";
                        }
                        else
                        {
                            if (PSEX == "M")
                            {
                                PSEX = "男";
                            }
                            else
                            {
                                PSEX = " ";
                            }
                        }
                        xml = xml + "性别=" + (char)34 + PSEX + (char)34 + " ";
                        string nl1 = xmlok["PBIRTHDAY"].InnerText;
                        string nl  = "0岁";
                        try
                        { nl = (DateTime.Now.Year - DateTime.Parse(nl1).Year).ToString() + "岁"; }
                        catch
                        { nl = "0岁"; }
                        xml = xml + "年龄=" + (char)34 + nl + (char)34 + " ";
                        string MARRIED = xmlok["MARRIED"].InnerText;
                        switch (MARRIED)
                        {
                        case "Y": MARRIED = "已婚"; break;

                        case "W": MARRIED = "未婚"; break;

                        case "L": MARRIED = "离异"; break;

                        case "S": MARRIED = "丧偶"; break;

                        default: MARRIED = ""; break;
                        }

                        xml = xml + "婚姻=" + (char)34 + MARRIED + (char)34 + " ";
                        xml = xml + "地址=" + (char)34 + xmlok["ADDRESS"].InnerText + (char)34 + "   ";
                        xml = xml + "电话=" + (char)34 + xmlok["PTELEPHONENO"].InnerText + (char)34 + " ";
                        xml = xml + "病区=" + (char)34 + xmlok["WARD"].InnerText + (char)34 + " ";
                        xml = xml + "床号=" + (char)34 + xmlok["BEDNO"].InnerText + (char)34 + " ";
                        //xml = xml + "病区=" + (char)34 + "" + (char)34 + " ";
                        // xml = xml + "床号=" + (char)34 +""+ (char)34 + " ";

                        xml = xml + "身份证号=" + (char)34 + xmlok["IDCARD"].InnerText + (char)34 + " ";
                        xml = xml + "民族=" + (char)34 + " " + (char)34 + " ";
                        xml = xml + "职业=" + (char)34 + xmlok["VOCATION"].InnerText + (char)34 + " ";
                        xml = xml + "送检科室=" + (char)34 + xmlok["SUBMITDEPT"].InnerText + (char)34 + " ";
                        xml = xml + "送检医生=" + (char)34 + xmlok["SUBMITDOC"].InnerText + (char)34 + " ";
                        //xml = xml + "送检科室=" + (char)34 + "" + (char)34 + " ";
                        //xml = xml + "送检医生=" + (char)34 +"" + (char)34 + " ";

                        //xml = xml + "临床诊断=" + (char)34 + (char)34 + " ";
                        //xml = xml + "临床病史=" + (char)34 + (char)34 + " ";
                        xml = xml + "收费=" + (char)34 + "" + (char)34 + " ";
                        xml = xml + "标本名称=" + (char)34 + bbmc + (char)34 + " ";
                        xml = xml + "送检医院=" + (char)34 + "本院" + (char)34 + " ";
                        xml = xml + "医嘱项目=" + (char)34 + (char)34 + " ";
                        xml = xml + "备用1=" + (char)34 + (char)34 + " ";
                        xml = xml + "备用2=" + (char)34 + (char)34 + " ";
                        xml = xml + "费别=" + (char)34 + xmlok["MEDICALTYPE"].InnerText + (char)34 + " ";
                        string PATIENTTYPE = xmlok["PATIENTTYPE"].InnerText;
                        if (PATIENTTYPE == "1000")
                        {
                            PATIENTTYPE = "门诊";
                        }
                        if (PATIENTTYPE == "2000")
                        {
                            PATIENTTYPE = "急诊";
                        }
                        if (PATIENTTYPE == "3000")
                        {
                            PATIENTTYPE = "住院";
                        }
                        if (PATIENTTYPE == "4000")
                        {
                            PATIENTTYPE = "体检";
                        }
                        xml = xml + "病人类别=" + (char)34 + PATIENTTYPE + (char)34 + " ";
                        xml = xml + "/>";
                        xml = xml + "<临床病史><![CDATA[" + xmlok["HISCONSULTATION"].InnerText + "]]></临床病史>";
                        xml = xml + "<临床诊断><![CDATA[" + xmlok["DISEASE"].InnerText + "]]></临床诊断>";
                        xml = xml + "</LOGENE>";

                        w.WriteString("pathgethis", "bbsl", "");
                        w.WriteString("pathgethis", "bbmh", "");
                        w.WriteString("pathgethis", "ysbbmh", "");
                        w.WriteString("pathgethis", "ysbbsl", "");
                        w.WriteString("pathgethis", "sqxh", "");
                        return(xml);
                    }
                    catch (Exception ee)
                    {
                        if (Debug == "1")
                        {
                            MessageBox.Show(ee.ToString());
                        }
                        return("0");
                    }
                }
                //----------------------------------------------------------------------------
                if (Sslbx == "申请单号")
                {
                    LGHISJKZGQ.nbyzrmyyWeb.PisServiceLJ yzyy = new LGHISJKZGQ.nbyzrmyyWeb.PisServiceLJ();
                    if (pathWEB != "")
                    {
                        yzyy.Url = pathWEB;
                    }
                    string sBillInfo   = "";
                    string sSampleInfo = "";
                    string Mes         = "";
                    try
                    {
                        Mes = yzyy.PatBillWritePIS(Ssbz, ref sBillInfo, ref sSampleInfo, 0);
                        //log.WriteMyLog(sBillInfo + "&" + sSampleInfo);
                    }
                    catch (Exception ee)
                    {
                        MessageBox.Show("此申请单号不存在,请核对!");
                        if (Debug == "1")
                        {
                            MessageBox.Show(ee.ToString());
                        }
                        log.WriteMyLog("参数:" + Ssbz + "返回值:" + sBillInfo + "提示信息:" + Mes);

                        return("0");
                    }
                    //--------------------------------



                    //-------------------------------

                    XmlNode     xmlok = null;
                    XmlDocument xd    = new XmlDocument();
                    try
                    {
                        xd.LoadXml(sBillInfo);
                        xmlok = xd.SelectSingleNode("/BILL");
                    }
                    catch { if (Debug == "1")
                            {
                                MessageBox.Show("XML解析错误");
                            }
                            return("0"); }
                    //标本名称------------------------------------------------------------

                    XmlDocument xd1   = new XmlDocument();
                    string      bbmc  = "";
                    string      bbbm  = "";
                    int         index = 0;
                    try
                    {
                        xd1.LoadXml(sSampleInfo);
                        XmlNodeList xnl = xd1.SelectNodes("/SAMPLES/SAMPLE");

                        index = xnl.Count;
                        if (index > 1)
                        {
                            MessageBox.Show("此病人共有" + index + "个标本!");
                        }
                        for (int x = 0; x < xnl.Count; x++)
                        {
                            XmlNode xmlok1 = xnl[x];
                            bbmc = bbmc + "  " + xmlok1["COLLECTBODY"].InnerText;
                            if (bbbm == "")
                            {
                                bbbm = xmlok1["SAMPLENO"].InnerText;
                            }
                            else
                            {
                                bbbm = bbbm + "," + xmlok1["SAMPLENO"].InnerText;
                            }
                        }
                    }
                    catch { if (Debug == "1")
                            {
                                MessageBox.Show("标本XML解析错误");
                            }
                            return("0"); }
                    if (Mes != "")
                    {
                        MessageBox.Show(Mes); return("0");
                    }


                    //-返回xml----------------------------------------------------
                    try
                    {
                        string xml = "<?xml version=" + (char)34 + "1.0" + (char)34 + " encoding=" + (char)34 + "gbk" + (char)34 + "?>";
                        xml = xml + "<LOGENE>";
                        xml = xml + "<row ";
                        xml = xml + "病人编号=" + (char)34 + xmlok["MEDRECNO"].InnerText + (char)34 + " ";
                        xml = xml + "就诊ID=" + (char)34 + "" + (char)34 + " ";
                        xml = xml + "申请序号=" + (char)34 + xmlok["HIS_KEYNO"].InnerText + (char)34 + " ";
                        xml = xml + "门诊号=" + (char)34 + xmlok["OUTPATIENTNO"].InnerText + (char)34 + " ";
                        xml = xml + "住院号=" + (char)34 + xmlok["INHOSPITALNO"].InnerText + (char)34 + " ";
                        xml = xml + "姓名=" + (char)34 + xmlok["PNAME"].InnerText + (char)34 + " ";
                        string PSEX = xmlok["PSEX"].InnerText;
                        if (PSEX == "F")
                        {
                            PSEX = "女";
                        }
                        else
                        {
                            if (PSEX == "M")
                            {
                                PSEX = "男";
                            }
                            else
                            {
                                PSEX = " ";
                            }
                        }
                        xml = xml + "性别=" + (char)34 + PSEX + (char)34 + " ";
                        string nl1 = xmlok["PBIRTHDAY"].InnerText;
                        string nl  = "0岁";
                        try
                        { nl = (DateTime.Now.Year - DateTime.Parse(nl1).Year).ToString() + "岁"; }
                        catch
                        { nl = "0岁"; }
                        xml = xml + "年龄=" + (char)34 + nl + (char)34 + " ";
                        string MARRIED = xmlok["MARRIED"].InnerText;
                        switch (MARRIED)
                        {
                        case "Y": MARRIED = "已婚"; break;

                        case "W": MARRIED = "未婚"; break;

                        case "L": MARRIED = "离异"; break;

                        case "S": MARRIED = "丧偶"; break;

                        default: MARRIED = ""; break;
                        }

                        xml = xml + "婚姻=" + (char)34 + MARRIED + (char)34 + " ";
                        xml = xml + "地址=" + (char)34 + xmlok["ADDRESS"].InnerText + (char)34 + "   ";
                        xml = xml + "电话=" + (char)34 + xmlok["PTELEPHONENO"].InnerText + (char)34 + " ";
                        xml = xml + "病区=" + (char)34 + xmlok["WARD"].InnerText + (char)34 + " ";
                        xml = xml + "床号=" + (char)34 + xmlok["BEDNO"].InnerText + (char)34 + " ";
                        //xml = xml + "病区=" + (char)34 + "" + (char)34 + " ";
                        // xml = xml + "床号=" + (char)34 +""+ (char)34 + " ";

                        xml = xml + "身份证号=" + (char)34 + xmlok["IDCARD"].InnerText + (char)34 + " ";
                        xml = xml + "民族=" + (char)34 + " " + (char)34 + " ";
                        xml = xml + "职业=" + (char)34 + xmlok["VOCATION"].InnerText + (char)34 + " ";
                        xml = xml + "送检科室=" + (char)34 + xmlok["SUBMITDEPT"].InnerText + (char)34 + " ";
                        xml = xml + "送检医生=" + (char)34 + xmlok["SUBMITDOC"].InnerText + (char)34 + " ";
                        //xml = xml + "送检科室=" + (char)34 + "" + (char)34 + " ";
                        //xml = xml + "送检医生=" + (char)34 +"" + (char)34 + " ";

                        //xml = xml + "临床诊断=" + (char)34 + (char)34 + " ";
                        //xml = xml + "临床病史=" + (char)34 + (char)34 + " ";
                        xml = xml + "收费=" + (char)34 + "" + (char)34 + " ";
                        xml = xml + "标本名称=" + (char)34 + bbmc + (char)34 + " ";
                        xml = xml + "送检医院=" + (char)34 + "本院" + (char)34 + " ";
                        xml = xml + "医嘱项目=" + (char)34 + (char)34 + " ";
                        xml = xml + "备用1=" + (char)34 + (char)34 + " ";
                        xml = xml + "备用2=" + (char)34 + (char)34 + " ";
                        xml = xml + "费别=" + (char)34 + xmlok["MEDICALTYPE"].InnerText + (char)34 + " ";
                        string PATIENTTYPE = xmlok["PATIENTTYPE"].InnerText;
                        if (PATIENTTYPE == "1000")
                        {
                            PATIENTTYPE = "门诊";
                        }
                        if (PATIENTTYPE == "2000")
                        {
                            PATIENTTYPE = "急诊";
                        }
                        if (PATIENTTYPE == "3000")
                        {
                            PATIENTTYPE = "住院";
                        }
                        if (PATIENTTYPE == "4000")
                        {
                            PATIENTTYPE = "体检";
                        }
                        xml = xml + "病人类别=" + (char)34 + PATIENTTYPE + (char)34 + " ";
                        xml = xml + "/>";
                        xml = xml + "<临床病史><![CDATA[" + xmlok["HISCONSULTATION"].InnerText + "]]></临床病史>";
                        xml = xml + "<临床诊断><![CDATA[" + xmlok["DISEASE"].InnerText + "]]></临床诊断>";
                        xml = xml + "</LOGENE>";

                        return(xml);
                    }
                    catch (Exception ee)
                    {
                        if (Debug == "1")
                        {
                            MessageBox.Show(ee.ToString());
                        }
                        return("0");
                    }
                }
                if (Sslbx == "撤销申请单")
                {
                    string inxml = "";
                    inxml = inxml + "<?xml version='1.0' encoding='GB2312'?>";
                    inxml = inxml + "<REPORTINFO>";
                    inxml = inxml + "<ITEM>";
                    inxml = inxml + "<SQDBH>" + Ssbz + "</SQDBH>";
                    inxml = inxml + "<ZT>" + "99" + "</ZT>";
                    inxml = inxml + "<JSRY>" + "" + "</JSRY>";
                    inxml = inxml + "<JSSJ>" + "" + "</JSSJ>";
                    inxml = inxml + "<BGRY>" + "" + "</BGRY>";
                    inxml = inxml + "<BGSJ>" + "" + "</BGSJ>";
                    inxml = inxml + "<SHRY>" + "" + "</SHRY>";
                    inxml = inxml + "<SHSJ>" + "" + "</SHSJ>";
                    inxml = inxml + "<CXRY>" + "" + "</CXRY>";
                    inxml = inxml + "<CXSJ>" + DateTime.Now.ToString("yyyyMMddHHMMss") + "</CXSJ>";
                    inxml = inxml + "<JCSJ>" + "" + "</JCSJ>";
                    inxml = inxml + "<JCJL>" + "" + "</JCJL>";
                    inxml = inxml + "<WEBURL>" + "" + "</WEBURL>";
                    inxml = inxml + "</ITEM>";
                    inxml = inxml + "</REPORTINFO>";

                    if (Debug == "1")
                    {
                        log.WriteMyLog("回传的xml数据:" + inxml);
                    }
                    string outxml = "";
                    try
                    {
                        LGHISJKZGQ.nbyzrmyyWeb.PisServiceLJ yzyyweb = new LGHISJKZGQ.nbyzrmyyWeb.PisServiceLJ();
                        if (pathWEB != "")
                        {
                            yzyyweb.Url = pathWEB;
                        }
                        outxml = yzyyweb.SetPISReportInfo(decimal.Parse(Ssbz), inxml);
                    }
                    catch (Exception ee)
                    {
                        MessageBox.Show("申请单撤销失败!请确认申请单号是否存在!");
                        log.WriteMyLog("申请单撤销失败!调用HIS接口出错:" + ee.ToString());

                        return("0");
                    }

                    if (outxml == "")
                    {
                        MessageBox.Show("申请单撤销成功!");
                    }
                    else
                    {
                        log.WriteMyLog("申请单撤销失败!原因:" + outxml);
                        if (Debug == "1")
                        {
                            MessageBox.Show("申请单撤销失败!" + outxml);
                        }
                    }
                    return("0");
                }
                else
                {
                    MessageBox.Show("无此" + Sslbx);
                    return("0");
                }
            }
            else
            {
                MessageBox.Show("无此" + Sslbx);
                if (Debug == "1")
                {
                    log.WriteMyLog(Sslbx + Ssbz + "不存在!");
                }

                return("0");
            }
        }