Beispiel #1
0
        public static string njxkyyXML(string Sslbx, string Ssbz, string Debug)
        {
            string brlb     = "";
            string codetype = "";
            string zxks     = "";
            string sjks     = "";
            string yzxm     = "";
            string sqdh     = "";
            string sjys     = "";
            int    sqd      = 0;

            if (Sslbx == "住院号")
            {
                brlb     = "1";
                codetype = "1";
                sqd      = f.ReadInteger("住院号", "sqd", 0);
                zxks     = f.ReadString("住院号", "zxks", "222").Replace("\0", "");
            }
            if (Sslbx == "发票号")
            {
                brlb     = "0";
                codetype = "9";
                sqd      = f.ReadInteger("发票号", "sqd", 0);
                zxks     = f.ReadString("发票号", "zxks", "21AA").Replace("\0", "");
            }
            if (Sslbx == "卡号")
            {
                try
                {
                    Ssbz = Read(100);
                }
                catch
                {
                    MessageBox.Show("请讲卡放在读卡器上");
                    return("0");
                }
                //  MessageBox.Show(Ssbz.ToString());
                brlb     = "0";
                codetype = "2";
                sqd      = f.ReadInteger("卡号", "sqd", 0);
                zxks     = f.ReadString("卡号", "zxks", "21AA").Replace("\0", "");
            }
            if (Sslbx == "门诊号")
            {
                brlb     = "0";
                codetype = "1";
                sqd      = f.ReadInteger("门诊号", "sqd", 0);
                zxks     = f.ReadString("门诊号", "zxks", "21AA").Replace("\0", "");
            }
            if (Sslbx == "体检号")
            {
                return("0");
            }


            if (brlb == "")
            {
                MessageBox.Show("无此" + Sslbx);
                return("0");
            }

            string readxml = jb01zgq(brlb, codetype, Ssbz, Debug);

            MessageBox.Show("222");
            MessageBox.Show("HIS传出的字符串" + readxml);
            log.WriteMyLog(readxml);
            //string readxml = jb012(brlb, codetype, Ssbz, Debug);
            DataSet ds1 = new DataSet();

            try
            {
                StringReader  xmlstr = null;
                XmlTextReader xmread = null;
                xmlstr = new StringReader(readxml);
                xmread = new XmlTextReader(xmlstr);
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.Load(xmread);

                XmlNode node = xmldoc.SelectSingleNode("//ROWDATA");
                string  A    = node.OuterXml;
                A      = "<?xml version=" + (char)34 + "1.0" + (char)34 + " encoding=" + (char)34 + "gbk" + (char)34 + "?>" + A;
                xmlstr = new StringReader(A);
                xmread = new XmlTextReader(xmlstr);

                ds1.ReadXml(xmread);
            }
            catch
            {
                if (Debug == "1")
                {
                    log.WriteMyLog("xml转表失败!");
                }
                return("0");
            }
            int xh = 0;

            try
            {
                sjks = ds1.Tables[0].Rows[xh]["DeptName"].ToString().Trim();
            }
            catch
            {
                sjks = "";
            }
            //申请单查询
            if (sqd == 1)
            {
                string his_blh   = ds1.Tables[0].Rows[0]["hospno"].ToString().Trim();
                string his_brlb  = brlb;
                string his_brxm  = ds1.Tables[0].Rows[0]["Patname"].ToString().Trim();
                string his_patid = ds1.Tables[0].Rows[0]["Patientid"].ToString().Trim();

                string his_syxh = "";
                //2014-10-29后加发票号

                try
                {
                    his_syxh = ds1.Tables[0].Rows[0]["Syxh"].ToString().Trim();
                }
                catch
                {
                    his_syxh = "0";
                }


                //  his_fph = "0";


                string Tjrybh = "";
                try
                {
                    Tjrybh = ds1.Tables[0].Rows[0]["Tjrybh"].ToString().Trim();
                }
                catch
                {
                    Tjrybh = "0";
                }

                //string zxks = f.ReadString("msyy", "zxks", "21AA");
                readxml = jb032(his_brlb, his_blh, his_patid, his_syxh, "0", "", "", "", zxks, "0");
                int     xh2     = 0;
                DataSet jb03_ds = new DataSet();
                try
                {
                    StringReader  xmlstr = null;
                    XmlTextReader xmread = null;
                    xmlstr = new StringReader(readxml);
                    xmread = new XmlTextReader(xmlstr);
                    XmlDocument xmldoc = new XmlDocument();
                    xmldoc.Load(xmread);

                    XmlNode node = xmldoc.SelectSingleNode("//ROWDATA");
                    string  A    = node.OuterXml;
                    A      = "<?xml version=" + (char)34 + "1.0" + (char)34 + " encoding=" + (char)34 + "gbk" + (char)34 + "?>" + A;
                    xmlstr = new StringReader(A);
                    xmread = new XmlTextReader(xmlstr);

                    jb03_ds.ReadXml(xmread);

                    DataTable dtx = new DataTable();
                    dtx.Columns.Add("序号", Type.GetType("System.String"));
                    dtx.Columns.Add("病历号", Type.GetType("System.String"));
                    dtx.Columns.Add("病人ID", 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"));
                    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 < jb03_ds.Tables[0].Rows.Count; i++)
                    {
                        dtxrow[0] = i.ToString();
                        dtxrow[1] = jb03_ds.Tables[0].Rows[i]["blh"].ToString();
                        //dtxrow[2] = ds1.Tables[0].Rows[i]["yzlb"].ToString();
                        dtxrow[2]  = jb03_ds.Tables[0].Rows[i]["patid"].ToString();
                        dtxrow[3]  = his_brxm;
                        dtxrow[4]  = jb03_ds.Tables[0].Rows[i]["Itemname"].ToString();
                        dtxrow[5]  = jb03_ds.Tables[0].Rows[i]["Price"].ToString();
                        dtxrow[6]  = jb03_ds.Tables[0].Rows[i]["Itemqty"].ToString();
                        dtxrow[7]  = jb03_ds.Tables[0].Rows[i]["itemunit"].ToString();
                        dtxrow[8]  = jb03_ds.Tables[0].Rows[i]["Qqksmc"].ToString();
                        dtxrow[9]  = jb03_ds.Tables[0].Rows[i]["Ysmc"].ToString();
                        dtxrow[10] = jb03_ds.Tables[0].Rows[i]["qqrq"].ToString();

                        dtx.Rows.Add(dtxrow);
                    }
                    if (dtx.Rows.Count > 0)
                    {
                        yzxz_yfy from2 = new yzxz_yfy(dtx);

                        string xhb = "";

                        if (from2.ShowDialog() == DialogResult.OK)
                        {
                            xhb  = from2.xh;
                            xh2  = Convert.ToInt16(xhb);
                            sqdh = jb03_ds.Tables[0].Rows[xh2]["qqxh"].ToString().Trim();
                            yzxm = jb03_ds.Tables[0].Rows[xh2]["itemname"].ToString().Trim();
                            sjks = jb03_ds.Tables[0].Rows[xh2]["qqksmc"].ToString().Trim();
                            sjys = jb03_ds.Tables[0].Rows[xh2]["ysmc"].ToString().Trim();
                        }
                        else
                        {
                            if (Debug == "1")
                            {
                                log.WriteMyLog("未选择医嘱!");
                            }
                            return("0");
                        }
                    }
                    //dataGridView1.DataSource = dtx;
                }
                catch (Exception ex)
                {
                    log.WriteMyLog(ex.Message);
                    // MessageBox.Show("未查找到检查记录!");
                }
            }
            //申请单查询结束

            string xml = "<?xml version=" + (char)34 + "1.0" + (char)34 + " encoding=" + (char)34 + "gbk" + (char)34 + "?>";

            xml = xml + "<LOGENE>";
            xml = xml + "<row ";

            if (brlb == "0")
            {
                xml = xml + "病人编号=" + (char)34 + ds1.Tables[0].Rows[xh]["patientid"].ToString().Trim() + (char)34 + " ";
                xml = xml + "就诊ID=" + (char)34 + ds1.Tables[0].Rows[xh]["cardno"].ToString().Trim() + (char)34 + " ";
                xml = xml + "门诊号=" + (char)34 + ds1.Tables[0].Rows[xh]["HospNo"].ToString().Trim() + (char)34 + " ";
                xml = xml + "住院号=" + (char)34 + (char)34 + " ";
            }
            else if (brlb == "1")
            {
                xml = xml + "病人编号=" + (char)34 + ds1.Tables[0].Rows[xh]["CureNO"].ToString().Trim() + (char)34 + " ";
                xml = xml + "就诊ID=" + (char)34 + ds1.Tables[0].Rows[xh]["PatientID"].ToString().Trim() + (char)34 + " ";
                xml = xml + "门诊号=" + (char)34 + (char)34 + " ";
                xml = xml + "住院号=" + (char)34 + ds1.Tables[0].Rows[xh]["HospNo"].ToString().Trim() + (char)34 + " ";
            }
            else
            {
                xml = xml + "病人编号=" + (char)34 + ds1.Tables[0].Rows[xh]["patientid"].ToString().Trim() + (char)34 + " ";
                xml = xml + "就诊ID=" + (char)34 + ds1.Tables[0].Rows[xh]["cardno"].ToString().Trim() + (char)34 + " ";
                xml = xml + "门诊号=" + (char)34 + ds1.Tables[0].Rows[xh]["HospNo"].ToString().Trim() + (char)34 + " ";
                xml = xml + "住院号=" + (char)34 + (char)34 + " ";
            }
            xml = xml + "申请序号=" + (char)34 + sqdh + (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 nl = datediff(DateTime.Now, Convert.ToDateTime(ds1.Tables[0].Rows[xh]["birthday"].ToString().Trim()));

            try
            {
                xml = xml + "年龄=" + (char)34 + ds1.Tables[0].Rows[xh]["Age"].ToString().Trim() + ds1.Tables[0].Rows[xh]["AgeUnit"].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]["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 + " ";
            }
            try
            {
                xml = xml + "病区=" + (char)34 + ds1.Tables[0].Rows[xh]["bqmc"].ToString().Trim() + (char)34 + " ";
            }
            catch
            {
                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 + " ";
            }
            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 + " ";
            }
            xml = xml + "送检医生=" + (char)34 + sjys + (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 + (char)34 + " ";
            string fkfs = "";

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

            xml = xml + "费别=" + (char)34 + fkfs + (char)34 + " ";
            if (brlb == "1")
            {
                xml = xml + "病人类别=" + (char)34 + "住院" + (char)34 + " ";
            }
            else
            {
                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);
        }
Beispiel #2
0
        public static string shsrjyyXML(string Sslbx, string Ssbz, string Debug)
        {
            string lczd     = "";
            string lczl     = "";
            string bbmc     = "";
            string brlb     = "";
            string codetype = "";
            string zxks     = "";
            string sjks     = "";
            string yzxm     = "";
            string sqdh     = "";
            string sjys     = "";


            string F_yzid = "";
            string F_sqxh = "";

            int sqd   = 0;
            int sqdxx = 0;

            if (Sslbx == "住院号")
            {
                brlb     = "1";
                codetype = "1";
                sqd      = f.ReadInteger("住院号", "sqd", 0);
                sqdxx    = f.ReadInteger("住院号", "sqdxx", 0);
                zxks     = f.ReadString("住院号", "zxks", "222").Replace("\0", "");
            }
            if (Sslbx == "发票号")
            {
                brlb     = "0";
                codetype = "9";
                sqd      = f.ReadInteger("发票号", "sqd", 0);
                sqdxx    = f.ReadInteger("发票号", "sqdxx", 0);
                zxks     = f.ReadString("发票号", "zxks", "21AA").Replace("\0", "");
            }
            if (Sslbx == "卡号")
            {
                int isdk = f.ReadInteger("卡号", "isdk", 0);
                if (isdk == 1)
                {
                    Ssbz = Read(100);
                }
                //  MessageBox.Show(Ssbz.ToString());
                brlb     = "0";
                codetype = "2";
                sqd      = f.ReadInteger("卡号", "sqd", 0);
                sqdxx    = f.ReadInteger("卡号", "sqdxx", 0);
                zxks     = f.ReadString("卡号", "zxks", "21AA").Replace("\0", "");
            }
            if (Sslbx == "门诊号")
            {
                brlb     = "0";
                codetype = "1";
                sqd      = f.ReadInteger("门诊号", "sqd", 0);
                sqd      = f.ReadInteger("门诊号", "sqdxx", 0);
                zxks     = f.ReadString("门诊号", "zxks", "21AA").Replace("\0", "");
            }
            if (brlb == "")
            {
                MessageBox.Show("无此" + Sslbx);
                return("0");
            }

            string readxml = jb01(brlb, codetype, Ssbz, Debug);

            MessageBox.Show(readxml);
            if (Debug == "1")
            {
                log.WriteMyLog("调用jb01返回:" + readxml);
            }
            //string readxml = jb012(brlb, codetype, Ssbz, Debug);
            if (readxml == "0")
            {
                return("0");
            }


            DataSet ds1 = new DataSet();

            try
            {
                StringReader  xmlstr = null;
                XmlTextReader xmread = null;
                xmlstr = new StringReader(readxml);
                xmread = new XmlTextReader(xmlstr);
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.Load(xmread);

                XmlNode node = xmldoc.SelectSingleNode("//ROWDATA");
                string  A    = node.OuterXml;
                A      = "<?xml version=" + (char)34 + "1.0" + (char)34 + " encoding=" + (char)34 + "gbk" + (char)34 + "?>" + A;
                xmlstr = new StringReader(A);
                xmread = new XmlTextReader(xmlstr);

                ds1.ReadXml(xmread);
                if (ds1.Tables.Count < 1)
                {
                    MessageBox.Show("未查询到病人信息");
                    return("0");
                }
            }
            catch
            {
                log.WriteMyLog("xml转表失败!未查询到病人信息,返回XML:" + readxml.Trim());
                MessageBox.Show("未查询到病人信息");
                return("0");
            }
            if (ds1.Tables[0].Rows.Count < 1)
            {
                MessageBox.Show("未查询到病人信息!");
                return("0");
            }

            int xh = 0;

            try
            {
                sjks = ds1.Tables[0].Rows[xh]["DeptName"].ToString().Trim();
            }
            catch
            {
                sjks = "";
            }
            if (brlb == "1")
            {
                F_sqxh = ds1.Tables[0].Rows[xh]["syxh"].ToString().Trim();
            }
            else
            {
                F_sqxh = ds1.Tables[0].Rows[xh]["Jzlsh"].ToString().Trim();
            }
            //申请单查询
            if (sqd == 1)
            {
                string his_blh   = ds1.Tables[0].Rows[0]["hospno"].ToString().Trim();
                string his_brlb  = brlb;
                string his_brxm  = ds1.Tables[0].Rows[0]["Patname"].ToString().Trim();
                string his_patid = ds1.Tables[0].Rows[0]["Patientid"].ToString().Trim();
                string his_syxh  = "";

                try
                {
                    his_syxh = ds1.Tables[0].Rows[0]["Syxh"].ToString().Trim();
                }
                catch
                {
                    his_syxh = "0";
                }
                string Tjrybh = "";
                try
                {
                    Tjrybh = ds1.Tables[0].Rows[0]["Tjrybh"].ToString().Trim();
                }
                catch
                {
                    Tjrybh = "0";
                }

                //string zxks = f.ReadString("msyy", "zxks", "21AA");
                readxml = jb03(his_brlb, his_blh, his_patid, his_syxh, "0", "", "", "", zxks, "0");

                if (Debug == "1")
                {
                    log.WriteMyLog("调用JB03参数" + his_brlb + ";" + his_blh + ";" + his_patid + ";" + his_syxh + ";" + "0" + ";" + "" + ";" + "" + ";" + "" + ";" + zxks + ";" + "0");
                    log.WriteMyLog("调用JB03返回" + readxml);
                }
                int     xh2     = 0;
                DataSet jb03_ds = new DataSet();
                try
                {
                    StringReader  xmlstr = null;
                    XmlTextReader xmread = null;

                    xmlstr = new StringReader(readxml);
                    xmread = new XmlTextReader(xmlstr);
                    XmlDocument xmldoc = new XmlDocument();
                    xmldoc.Load(xmread);

                    XmlNode node = xmldoc.SelectSingleNode("//ROWDATA");
                    string  A    = node.OuterXml;

                    A      = "<?xml version=" + (char)34 + "1.0" + (char)34 + " encoding=" + (char)34 + "gbk" + (char)34 + "?>" + A;
                    xmlstr = new StringReader(A);
                    xmread = new XmlTextReader(xmlstr);

                    jb03_ds.ReadXml(xmread);


                    if (jb03_ds.Tables[0].Rows.Count < 1)
                    {
                        MessageBox.Show("未查询到病人申请单信息");
                        goto xml;
                    }


                    DataTable dtx = new DataTable();
                    dtx.Columns.Add("序号", Type.GetType("System.String"));
                    dtx.Columns.Add("病历号", Type.GetType("System.String"));
                    dtx.Columns.Add("病人ID", 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"));
                    dtx.Columns.Add("申请医生", Type.GetType("System.String"));
                    string[] dtxrow = new string[dtx.Columns.Count];
                    for (int i = 0; i < jb03_ds.Tables[0].Rows.Count; i++)
                    {
                        dtxrow[0] = i.ToString();
                        dtxrow[1] = jb03_ds.Tables[0].Rows[i]["blh"].ToString();
                        //dtxrow[2] = ds1.Tables[0].Rows[i]["yzlb"].ToString();
                        dtxrow[2] = jb03_ds.Tables[0].Rows[i]["patid"].ToString();
                        dtxrow[3] = his_brxm;
                        dtxrow[4] = jb03_ds.Tables[0].Rows[i]["Itemname"].ToString();
                        dtxrow[5] = jb03_ds.Tables[0].Rows[i]["Price"].ToString();
                        dtxrow[6] = jb03_ds.Tables[0].Rows[i]["Itemqty"].ToString();
                        dtxrow[7] = jb03_ds.Tables[0].Rows[i]["itemunit"].ToString();
                        dtxrow[8] = jb03_ds.Tables[0].Rows[i]["Qqksmc"].ToString();
                        dtxrow[9] = jb03_ds.Tables[0].Rows[i]["Ysmc"].ToString();
                        dtx.Rows.Add(dtxrow);
                    }
                    if (dtx.Rows.Count > 0)
                    {
                        yzxz_yfy from2 = new yzxz_yfy(dtx);

                        string xhb = "";

                        if (from2.ShowDialog() == DialogResult.OK)
                        {
                            xhb  = from2.xh;
                            xh2  = Convert.ToInt16(xhb);
                            sqdh = jb03_ds.Tables[0].Rows[xh2]["qqxh"].ToString().Trim();
                            yzxm = jb03_ds.Tables[0].Rows[xh2]["itemname"].ToString().Trim();
                            sjks = jb03_ds.Tables[0].Rows[xh2]["qqksmc"].ToString().Trim();
                            sjys = jb03_ds.Tables[0].Rows[xh2]["ysmc"].ToString().Trim();
                            string sqdxh2 = jb03_ds.Tables[0].Rows[xh2]["sqdxh"].ToString().Trim();



                            F_yzid = jb03_ds.Tables[0].Rows[xh2]["blh"].ToString().Trim();
                            F_sqxh = F_sqxh + "^" + jb03_ds.Tables[0].Rows[xh2]["sqdxh"].ToString().Trim() + "^" + jb03_ds.Tables[0].Rows[xh2]["patid"].ToString().Trim();

                            if (sqdxx == 1)
                            {
                                string readxml2 = SQ02(brlb, sqdxh2, Debug);
                                try
                                {
                                    StringReader  xmlstr2 = null;
                                    XmlTextReader xmread2 = null;

                                    xmlstr2 = new StringReader(readxml2);
                                    xmread2 = new XmlTextReader(xmlstr2);
                                    XmlDocument xmldoc2 = new XmlDocument();

                                    xmldoc2.Load(xmread2);

                                    XmlNode node2 = xmldoc2.SelectSingleNode("//ROWDATA");
                                    string  b     = node2.OuterXml;
                                    if (Debug == "1")
                                    {
                                        MessageBox.Show(b);
                                    }
                                    b       = "<?xml version=" + (char)34 + "1.0" + (char)34 + " encoding=" + (char)34 + "gbk" + (char)34 + "?>" + b;
                                    xmlstr2 = new StringReader(b);

                                    xmread2 = new XmlTextReader(xmlstr2);
                                    DataSet SQ03_ds = new DataSet();
                                    SQ03_ds.ReadXml(xmread2);


                                    if (SQ03_ds.Tables[0].Rows.Count > 0)
                                    {
                                        //string [] caption=new string[SQ03_ds.Tables[0].Rows.Count];
                                        //string[] values = new string[SQ03_ds.Tables[0].Rows.Count];
                                        for (int xx = 0; xx < SQ03_ds.Tables[0].Rows.Count; xx++)
                                        {
                                            //caption[xx]= SQ03_ds.Tables[0].Rows[xx]["caption"];
                                            //values[xx] = SQ03_ds.Tables[0].Rows[xx]["values"];


                                            if (brlb == "1")
                                            {
                                                if (SQ03_ds.Tables[0].Rows[xx]["caption"].ToString() == "临床诊断")
                                                {
                                                    lczd = SQ03_ds.Tables[0].Rows[xx]["value"].ToString().Trim();
                                                }
                                                if (SQ03_ds.Tables[0].Rows[xx]["caption"].ToString() == "病史资料")
                                                {
                                                    lczl = SQ03_ds.Tables[0].Rows[xx]["value"].ToString().Trim();
                                                }
                                                if (SQ03_ds.Tables[0].Rows[xx]["caption"].ToString() == "部位")
                                                {
                                                    bbmc = SQ03_ds.Tables[0].Rows[xx]["value"].ToString().Trim();
                                                }
                                            }
                                            else
                                            {
                                                if (SQ03_ds.Tables[0].Rows[xx]["caption"].ToString() == "诊断")
                                                {
                                                    lczd = SQ03_ds.Tables[0].Rows[xx]["value"].ToString().Trim();
                                                }
                                                if (SQ03_ds.Tables[0].Rows[xx]["caption"].ToString() == "临床信息")
                                                {
                                                    lczl = SQ03_ds.Tables[0].Rows[xx]["value"].ToString().Trim();
                                                }
                                                // bbmc = SQ03_ds.Tables[0].Rows[15]["value"].ToString().Trim();
                                            }
                                        }
                                    }
                                    else
                                    {
                                        lczd = "";
                                        lczl = "";
                                    }
                                }
                                catch
                                {
                                    lczd = "";
                                    lczl = "";
                                }
                            }
                        }
                        else
                        {
                            if (Debug == "1")
                            {
                                log.WriteMyLog("未选择医嘱!");
                            }
                            MessageBox.Show("未选择医嘱!");
                            return("0");
                        }
                    }
                    else
                    {
                        MessageBox.Show("未查找到医嘱信息!");
                    }
                    //dataGridView1.DataSource = dtx;
                }
                catch (Exception ex)
                {
                    log.WriteMyLog(ex.Message);
                    MessageBox.Show("未查找到医嘱信息!");
                }
            }

            //申请单查询结束
xml:
            string xml = "<?xml version=" + (char)34 + "1.0" + (char)34 + " encoding=" + (char)34 + "gbk" + (char)34 + "?>";

            xml = xml + "<LOGENE>";
            xml = xml + "<row ";

            if (brlb == "0")
            {
                xml = xml + "病人编号=" + (char)34 + ds1.Tables[0].Rows[xh]["cardno"].ToString().Trim() + (char)34 + " ";
                xml = xml + "就诊ID=" + (char)34 + F_yzid + (char)34 + " ";
                xml = xml + "门诊号=" + (char)34 + ds1.Tables[0].Rows[xh]["HospNo"].ToString().Trim() + (char)34 + " ";
                xml = xml + "住院号=" + (char)34 + (char)34 + " ";
            }
            else if (brlb == "1")
            {
                xml = xml + "病人编号=" + (char)34 + ds1.Tables[0].Rows[xh]["cardno"].ToString().Trim() + (char)34 + " ";
                xml = xml + "就诊ID=" + (char)34 + F_yzid + (char)34 + " ";
                xml = xml + "门诊号=" + (char)34 + (char)34 + " ";
                xml = xml + "住院号=" + (char)34 + ds1.Tables[0].Rows[xh]["HospNo"].ToString().Trim() + (char)34 + " ";
            }
            else
            {
                xml = xml + "病人编号=" + (char)34 + ds1.Tables[0].Rows[xh]["cardno"].ToString().Trim() + (char)34 + " ";
                xml = xml + "就诊ID=" + (char)34 + F_yzid + (char)34 + " ";
                xml = xml + "门诊号=" + (char)34 + ds1.Tables[0].Rows[xh]["HospNo"].ToString().Trim() + (char)34 + " ";
                xml = xml + "住院号=" + (char)34 + (char)34 + " ";
            }
            xml = xml + "申请序号=" + (char)34 + F_sqxh + (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 nl = datediff(DateTime.Now, Convert.ToDateTime(ds1.Tables[0].Rows[xh]["birthday"].ToString().Trim()));

            xml = xml + "年龄=" + (char)34 + ds1.Tables[0].Rows[xh]["Age"].ToString().Trim() + ds1.Tables[0].Rows[xh]["AgeUnit"].ToString().Trim() + (char)34 + " ";
            xml = xml + "婚姻=" + (char)34 + (char)34 + " ";
            xml = xml + "地址=" + (char)34 + ds1.Tables[0].Rows[xh]["Address"].ToString().Trim() + (char)34 + " ";
            try
            {
                xml = xml + "电话=" + (char)34 + ds1.Tables[0].Rows[xh]["Phone"].ToString().Trim() + (char)34 + " ";
            }
            catch
            {
                xml = xml + "电话=" + (char)34 + (char)34 + " ";
            }
            try
            {
                xml = xml + "病区=" + (char)34 + ds1.Tables[0].Rows[xh]["bqmc"].ToString().Trim() + (char)34 + " ";
            }
            catch
            {
                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 + " ";
            }
            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 + " ";
            }
            xml = xml + "送检医生=" + (char)34 + sjys + (char)34 + " ";
            //xml = xml + "临床诊断=" + (char)34 + (char)34 + " ";
            //xml = xml + "临床病史=" + (char)34 + (char)34 + " ";
            xml = xml + "收费=" + (char)34 + (char)34 + " ";
            try
            {
                xml = xml + "标本名称=" + (char)34 + bbmc.Trim() + (char)34 + " ";
            }
            catch
            {
                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 + " ";
            try
            {
                xml = xml + "备用2=" + (char)34 + ds1.Tables[0].Rows[xh]["ward"].ToString().Trim() + (char)34 + " ";
            }
            catch
            {
                xml = xml + "备用2=" + "" + (char)34 + " ";
            }
            string fkfs = "";

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

            xml = xml + "费别=" + (char)34 + fkfs + (char)34 + " ";
            if (brlb == "1")
            {
                xml = xml + "病人类别=" + (char)34 + "住院" + (char)34 + " ";
            }
            else
            {
                xml = xml + "病人类别=" + (char)34 + "门诊" + (char)34 + " ";
            }
            xml = xml + "/>";
            try
            {
                xml = xml + "<临床病史><![CDATA[" + lczl.Trim() + "]]></临床病史>";
            }
            catch
            {
                xml = xml + "<临床病史><![CDATA[" + "" + "]]></临床病史>";
            }
            try
            {
                xml = xml + "<临床诊断><![CDATA[" + lczd.Trim() + "]]></临床诊断>";
            }
            catch
            {
                xml = xml + "<临床诊断><![CDATA[" + "" + "]]></临床诊断>";
            }
            xml = xml + "</LOGENE>";



            if (Debug == "1")
            {
                log.WriteMyLog("返回的xml字符串:" + xml);
            }

            return(xml);
        }