Example #1
0
        public static string rtn_CallInterface(string format, string serverName, string msgBody, string callOperator, string WebUrl, string debug)
        {
            string certificate = ZGQClass.getSZ_String("JK_ZGQ", "certificate", "5lYdPpiVdi0CxHKEhy3kqbzNlsXgNKZb");

            //集成平台地址

            xm1yweb.WSInterface wsif = new LGHISJKZGQ.xm1yweb.WSInterface();
            // XMDYYY_WEB.WSInterface wsif = new LGHISJKZGQ.XMDYYY_WEB.WSInterface();

            string msgHeader = "<?xml version=\"1.0\" encoding=\"utf-8\"?><root><serverName>" + serverName.Trim() + "</serverName>"
                               + "<format>" + format + "</format><callOperator>" + callOperator.Trim() + "</callOperator><certificate>" + certificate + "</certificate></root>";


            if (debug == "1")
            {
                log.WriteMyLog("入参:msgHeader:" + msgHeader + "\r\nmsgBody" + msgBody);
            }



            try
            {
                if (WebUrl.Trim() != "")
                {
                    wsif.Url = WebUrl;
                }

                string rtn = wsif.CallInterface(msgHeader, msgBody);

                if (debug == "1")
                {
                    log.WriteMyLog("返回:" + rtn);
                }
                return(rtn);
            }
            catch (Exception ee)
            {
                MessageBox.Show("连接webservice异常:" + ee.Message);
                return("-1");
            }
        }
Example #2
0
        public static string ptxml(string Sslbx, string Ssbz, string Debug)
        {
            string exp   = "";
            string WSURL = f.ReadString(Sslbx, "WSURL", "").Replace("\0", "").Trim();  //获取sz.ini中设置的webservicesurl

            Debug = f.ReadString(Sslbx, "debug", "").Replace("\0", "").Trim();;
            string isFY = f.ReadString(Sslbx, "isFY", "1").Replace("\0", "").Trim();

            if (Sslbx != "")
            {
                string rtn_XML = "";

                if (Sslbx == "取消申请")
                {
                    #region
                    string yhbh = f.ReadString("yh", "yhbh", "").Replace("\0", "").Trim();
                    string yhmc = f.ReadString("yh", "yhmc", "").Replace("\0", "").Trim();

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

                    DataTable jcxx = new DataTable();
                    jcxx = aa.GetDataTable("select * from  T_JCXX  where F_BLH='" + Ssbz + "'", "jcxx");
                    if (jcxx == null)
                    {
                        MessageBox.Show("病理数据库设置有问题!");
                        return("0");
                    }
                    if (jcxx.Rows.Count < 1)
                    {
                        MessageBox.Show("此病理号不存在!");
                        return("0");
                    }
                    if (jcxx.Rows[0]["F_YZID"].ToString().Trim() == "")
                    {
                        MessageBox.Show("此病例无医嘱号无法取消申请!");
                        return("0");
                    }

                    string [] yzids = jcxx.Rows[0]["F_YZID"].ToString().Split('^');

                    string Request_XML = "";
                    foreach (string yzid in yzids)
                    {
                        if (yzid.Trim() != "")
                        {
                            Request_XML = Request_XML + "<ModifyStauts>"
                                          + "<Status>U</Status>"
                                          + "<Rowid>" + yzid + "</Rowid>"
                                          + "<StudyNo>" + Ssbz + "</StudyNo>"
                                          + "<ExeUser>" + yhbh + "@" + yhmc + "</ExeUser>"
                                          + "<RBDate>" + DateTime.Today.ToString("yyyy-MM-dd") + "</RBDate>"
                                          + "<RBTime>" + DateTime.Now.ToString("HH:mm:ss") + "</RBTime>"
                                          + "<RBLoc>病理科</RBLoc>"
                                          + "</ModifyStauts>";
                        }
                    }

                    if (Request_XML == "")
                    {
                        MessageBox.Show("此病例无医嘱号无法取消申请!");
                        return("0");
                    }
                    Request_XML = "<Request><ModifyStatuses>" + Request_XML + "</ModifyStatuses></Request>";


                    if (Debug == "1")
                    {
                        log.WriteMyLog(Request_XML);
                    }


                    string Response_XML = "";
                    try
                    {
                        xy2yWebService.XYEPACS xy2yweb = new LGHISJKZGQ.xy2yWebService.XYEPACS();
                        if (WSURL.Trim() != "")
                        {
                            xy2yweb.Url = WSURL;
                        }
                        Response_XML = xy2yweb.ModifyStatus(Request_XML);
                    }
                    catch (Exception ee1)
                    {
                        MessageBox.Show(ee1.Message);
                        log.WriteMyLog(ee1.Message);
                        return("0");
                    }

                    XmlNode     xmlok_DATA = null;
                    XmlDocument xd2        = new XmlDocument();
                    try
                    {
                        xd2.LoadXml(Response_XML);
                        xmlok_DATA = xd2.SelectSingleNode("/Response");
                    }
                    catch (Exception xmlok_e)
                    {
                        log.WriteMyLog(rtn_XML);
                        MessageBox.Show("解析XML异常:" + xmlok_e.Message);
                        return("0");
                    }
                    if (xmlok_DATA["ResultCode"].InnerText.Trim() != "0")
                    {
                        MessageBox.Show("获取数据失败:" + xmlok_DATA["ErrorMsg"].InnerText.Trim());
                        return("0");
                    }
                    #endregion
                }

                if (Sslbx == "卡号" || Sslbx == "住院号" || Sslbx == "病人ID")
                {
                    string yhbh    = f.ReadString("yh", "yhbh", "").Replace("\0", "").Trim();
                    string yhmc    = f.ReadString("yh", "yhmc", "").Replace("\0", "").Trim();
                    string DepCode = f.ReadString(Sslbx, "DepCode", "2310000").Replace("\0", "").Trim();
                    if (yhbh == "")
                    {
                        yhbh = "0783";
                    }

                    string kh = ""; string zyh = ""; string brid = "";
                    string Inpatient = "N";
                    if (Sslbx == "卡号")
                    {
                        kh = Ssbz.Trim().Replace("\0", "").Trim();
                    }
                    if (Sslbx == "住院号")
                    {
                        zyh       = Ssbz.Trim();
                        Inpatient = "Y";
                    }
                    if (Sslbx == "病人ID")
                    {
                        brid = Ssbz.Trim();
                    }

                    string Request_XML = "<Request>"
                                         + "<StartDate>" + DateTime.Today.AddDays(-10).ToString("yyyy-MM-dd") + "</StartDate>"
                                         + "<EndDate>" + DateTime.Today.ToString("yyyy-MM-dd") + "</EndDate>"
                                         + "<CardNo>" + kh + "</CardNo>"
                                         + "<PatNo>" + brid + "</PatNo>"
                                         + "<UserId>" + yhbh + "</UserId>"
                                         + "<DepCode>" + DepCode + "</DepCode>"
                                         + "<Inpatient>" + Inpatient + "</Inpatient>"
                                         + "<WardCode></WardCode>"
                                         + "<InpatientNo>" + zyh + "</InpatientNo>"
                                         + "</Request>";

                    if (Debug == "1")
                    {
                        log.WriteMyLog(Request_XML);
                    }


                    string Response_XML = "";
                    try
                    {
                        xy2yWebService.XYEPACS xy2yweb = new LGHISJKZGQ.xy2yWebService.XYEPACS();
                        if (WSURL.Trim() != "")
                        {
                            xy2yweb.Url = WSURL;
                        }
                        Response_XML = xy2yweb.RegInfo(Request_XML);
                    }
                    catch (Exception ee1)
                    {
                        MessageBox.Show("获取数据异常:" + ee1.Message);
                        log.WriteMyLog(ee1.Message);
                        return("0");
                    }

                    if (Response_XML == "")
                    {
                        MessageBox.Show("WebService返回为空,获取数据失败!");
                        return("0");
                    }

                    if (Debug == "1")
                    {
                        log.WriteMyLog(Response_XML);
                    }


                    try
                    {
                        XmlNode     xmlok_DATA = null;
                        XmlDocument xd2        = new XmlDocument();
                        try
                        {
                            xd2.LoadXml(Response_XML);
                            xmlok_DATA = xd2.SelectSingleNode("/Response");
                        }
                        catch (Exception xmlok_e)
                        {
                            log.WriteMyLog(rtn_XML);
                            MessageBox.Show("解析XML异常:" + xmlok_e.Message);
                            return("0");
                        }
                        if (xmlok_DATA["ResultCode"].InnerText.Trim() != "0")
                        {
                            MessageBox.Show("获取数据失败:" + xmlok_DATA["ErrorMsg"].InnerText.Trim());
                            return("0");
                        }

                        XmlNode xn2 = xd2.SelectSingleNode("/Response/FindOrds/FindOrd");

                        DataTable dt_sqd = ZGQClass.DT_SQD();

                        DataRow dr = dt_sqd.NewRow();
                        dt_sqd.Rows.Add(dr);
                        //PatInfo 病人信息
                        dr["F_XM"]   = xn2["PatInfo"]["Name"].InnerText.Trim();
                        dr["F_BRBH"] = xn2["PatInfo"]["PatNo"].InnerText.Trim();
                        dr["F_XB"]   = xn2["PatInfo"]["Sex"].InnerText.Trim().Split('@')[1];
                        dr["F_NL"]   = xn2["PatInfo"]["Age"].InnerText.Trim();
                        dr["F_HY"]   = xn2["PatInfo"]["Marry"].InnerText.Trim();
                        dr["F_DZ"]   = xn2["PatInfo"]["Address"].InnerText.Trim();
                        dr["F_DH"]   = "^" + xn2["PatInfo"]["Telephone"].InnerText.Trim();
                        try
                        {
                            dr["F_SFZH"] = xn2["PatInfo"]["IDCard"].InnerText.Trim();
                        }
                        catch
                        {
                            dr["F_SFZH"] = "";
                        }
                        dr["F_MZ"]   = xn2["PatInfo"]["Nation"].InnerText.Trim();
                        dr["F_ZYH"]  = xn2["PatInfo"]["InpatientNo"].InnerText.Trim();
                        dr["F_SJDW"] = "本院";// xn2["PatInfo"]["Hospital"].InnerText.Trim();
                        //AdmInfo/AdmRecord 科室信息
                        dr["F_MZH"]  = xn2["AdmInfo"]["AdmRecord"]["AdmDR"].InnerText.Trim();
                        dr["F_BRLB"] = xn2["AdmInfo"]["AdmRecord"]["AdmType"].InnerText.Trim().Split('@')[1];
                        dr["F_SJKS"] = xn2["AdmInfo"]["AdmRecord"]["Ward"].InnerText.Trim().Split('@')[1];// xn2["AdmInfo"]["AdmRecord"]["Loc"].InnerText.Trim().Split('@')[1];
                        dr["F_SJYS"] = xn2["AdmInfo"]["AdmRecord"]["Doctor"].InnerText.Trim().Split('@')[1];
                        dr["F_CH"]   = xn2["AdmInfo"]["AdmRecord"]["BedNo"].InnerText.Trim();
                        dr["F_BQ"]   = xn2["AdmInfo"]["AdmRecord"]["Ward"].InnerText.Trim().Split('@')[1];
                        dr["F_LCZD"] = xn2["AdmInfo"]["AdmRecord"]["ClinicDiagnose"].InnerText.Trim();
                        dr["F_LCZL"] = xn2["AdmInfo"]["AdmRecord"]["OperationInfo"].InnerText.Trim();


                        //// AdmInfo/AdmRecord/HISOrders/Order收费信息 循环

                        DataTable dt_yzxx = new DataTable();

                        DataColumn OrdRowid = new DataColumn("OrdRowid");
                        dt_yzxx.Columns.Add(OrdRowid);

                        DataColumn OrdName = new DataColumn("OrdName");
                        dt_yzxx.Columns.Add(OrdName);

                        DataColumn OrdNum = new DataColumn("OrdNum");
                        dt_yzxx.Columns.Add(OrdNum);

                        DataColumn ItemPrice = new DataColumn("ItemPrice");
                        dt_yzxx.Columns.Add(ItemPrice);

                        DataColumn BillStatus = new DataColumn("BillStatus");
                        dt_yzxx.Columns.Add(BillStatus);

                        DataColumn ApplyDate = new DataColumn("ApplyDate");
                        dt_yzxx.Columns.Add(ApplyDate);

                        DataColumn AppTime = new DataColumn("AppTime");
                        dt_yzxx.Columns.Add(AppTime);

                        DataColumn OrdStatus = new DataColumn("OrdStatus");
                        dt_yzxx.Columns.Add(OrdStatus);

                        DataColumn OrdLoc = new DataColumn("OrdLoc");
                        dt_yzxx.Columns.Add(OrdLoc);

                        DataColumn RisBody = new DataColumn("RisBody");
                        dt_yzxx.Columns.Add(RisBody);
                        DataColumn UpdateUser = new DataColumn("UpdateUser");
                        dt_yzxx.Columns.Add(UpdateUser);

                        XmlDocument p1 = new XmlDocument();
                        p1.LoadXml(xn2["AdmInfo"]["AdmRecord"]["HISOrders"].OuterXml);
                        //医嘱信息
                        XmlNodeList ppplist2 = p1.SelectNodes("/HISOrders/Order");

                        foreach (XmlNode xn3 in ppplist2)
                        {
                            DataRow dr_yzxx = dt_yzxx.NewRow();
                            dt_yzxx.Rows.Add(dr_yzxx);

                            dr_yzxx["OrdRowid"]   = xn3["OrdRowid"].InnerText.Trim();
                            dr_yzxx["OrdName"]    = xn3["OrdName"].InnerText.Trim();
                            dr_yzxx["OrdNum"]     = xn3["OrdNum"].InnerText.Trim();
                            dr_yzxx["ItemPrice"]  = xn3["ItemPrice"].InnerText.Trim();
                            dr_yzxx["BillStatus"] = xn3["BillStatus"].InnerText.Trim();
                            dr_yzxx["ApplyDate"]  = xn3["ApplyDate"].InnerText.Trim();
                            dr_yzxx["AppTime"]    = xn3["AppTime"].InnerText.Trim();
                            dr_yzxx["OrdStatus"]  = xn3["OrdStatus"].InnerText.Trim();
                            dr_yzxx["OrdLoc"]     = xn3["OrdLoc"].InnerText.Trim();
                            dr_yzxx["RisBody"]    = xn3["RisBody"].InnerText.Trim();
                            dr_yzxx["UpdateUser"] = xn3["UpdateUser"].InnerText.Trim();

                            if (dr["F_YZID"].ToString().Trim() == "")
                            {
                                dr["F_YZID"] = xn3["OrdRowid"].InnerText.Trim();
                            }
                            else
                            {
                                dr["F_YZID"] = dr["F_YZID"] + "^" + xn3["OrdRowid"].InnerText.Trim();
                            }
                        }

                        if (isFY == "1")
                        {
                            xy2yShowFY xy = new xy2yShowFY(dt_yzxx);
                            xy.ShowDialog();
                        }

                        //-返回xml----------------------------------------------------


                        string xml = "<?xml version=" + (char)34 + "1.0" + (char)34 + " encoding=" + (char)34 + "gbk" + (char)34 + "?>";
                        xml = xml + "<LOGENE>";
                        xml = xml + "<row ";
                        try
                        {
                            xml = xml + "病人编号=" + (char)34 + dt_sqd.Rows[0]["F_BRBH"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "病人编号=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "就诊ID=" + (char)34 + dt_sqd.Rows[0]["F_YZID"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "就诊ID=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "申请序号=" + (char)34 + "" + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "申请序号=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "门诊号=" + (char)34 + kh.Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "门诊号=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------

                        try
                        {
                            xml = xml + "住院号=" + (char)34 + dt_sqd.Rows[0]["F_ZYh"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "住院号=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------

                        try
                        {
                            xml = xml + "姓名=" + (char)34 + dt_sqd.Rows[0]["F_XM"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "姓名=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "性别=" + (char)34 + dt_sqd.Rows[0]["F_XB"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "性别=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "年龄=" + (char)34 + dt_sqd.Rows[0]["F_NL"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "年龄=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "婚姻=" + (char)34 + dt_sqd.Rows[0]["F_HY"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "婚姻=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "地址=" + (char)34 + dt_sqd.Rows[0]["F_DZ"].ToString().Trim() + (char)34 + "   ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "地址=" + (char)34 + "" + (char)34 + "   ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "电话=" + (char)34 + dt_sqd.Rows[0]["F_DH"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "电话=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "病区=" + (char)34 + dt_sqd.Rows[0]["F_BQ"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "病区=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "床号=" + (char)34 + dt_sqd.Rows[0]["F_CH"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "床号=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "身份证号=" + (char)34 + dt_sqd.Rows[0]["F_SFZH"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "身份证号=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "民族=" + (char)34 + dt_sqd.Rows[0]["F_MZ"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "民族=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        xml = xml + "职业=" + (char)34 + "" + (char)34 + " ";
                        //----------------------------------------------------------
                        try
                        {
                            if (dt_sqd.Rows[0]["F_brlb"].ToString().Trim() == "住院")
                            {
                                xml = xml + "送检科室=" + (char)34 + dt_sqd.Rows[0]["F_SJKS"].ToString().Trim() + (char)34 + " ";
                            }
                            else
                            {
                                xml = xml + "送检科室=" + (char)34 + "门诊" + (char)34 + " ";
                            }
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "送检科室=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------

                        try
                        {
                            xml = xml + "送检医生=" + (char)34 + "" + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            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 + dt_sqd.Rows[0]["F_MZH"].ToString().Trim() + (char)34 + " ";
                        //----------------------------------------------------------
                        xml = xml + "备用1=" + (char)34 + "" + (char)34 + " ";
                        //----------------------------------------------------------
                        xml = xml + "备用2=" + (char)34 + "" + (char)34 + " ";
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "费别=" + (char)34 + "" + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "费别=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "病人类别=" + (char)34 + dt_sqd.Rows[0]["F_brlb"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "病人类别=" + (char)34 + "" + (char)34 + " ";
                        }
                        xml = xml + "/>";
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "<临床病史><![CDATA[" + dt_sqd.Rows[0]["F_LCZL"].ToString().Trim() + "]]></临床病史>";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "<临床病史><![CDATA[" + "" + "]]></临床病史>";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "<临床诊断><![CDATA[" + dt_sqd.Rows[0]["F_LCZD"].ToString().Trim() + "]]></临床诊断>";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.Message.ToString();
                            xml = xml + "<临床诊断><![CDATA[" + "" + "]]></临床诊断>";
                        }
                        xml = xml + "</LOGENE>";

                        if (Debug == "1")
                        {
                            log.WriteMyLog(xml);
                        }

                        if (exp.Trim() != "")
                        {
                            log.WriteMyLog(exp.Trim());
                        }

                        return(xml);
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show("提取信息出错,请重新操作");
                        log.WriteMyLog("xml解析错误---" + e.Message.ToString());
                        return("0");
                    }
                }

                else
                {
                    MessageBox.Show("无此" + Sslbx);
                    return("0");
                }
            }
            return("0");
        }
Example #3
0
        public static string ptxml(string Sslbx, string Ssbz, string Debug)
        {
            if (Sslbx != "")
            {
                string err     = "";
                string tqbblb  = ZGQClass.getSZ_String(Sslbx, "tqbblb", "1");
                string yhmc    = f.ReadString("yh", "yhmc", "").Replace("\0", "").Trim();
                string odbcsql = ZGQClass.getSZ_String(Sslbx, "odbcsql", "Data Source=ORCL_100;User ID=jk_ycxd;Password=123");
                string Sslbx1  = Sslbx;
                if (Sslbx == "申请单号" || Sslbx == "标本条码号")
                {
                    OracleDB_ZGQ oracledb = new OracleDB_ZGQ();


                    string sqdh = "";

                    if (Sslbx == "标本条码号")
                    {
                        //通过标本条码号获取申请单号
                        DataTable dt_bblb = new DataTable();
                        dt_bblb = oracledb.Oracle_DataAdapter(odbcsql, "select *  from portal_his.emr_jcsq_blmx  where tmh='" + Ssbz + "'", ref err);
                        if (dt_bblb == null)
                        {
                            MessageBox.Show("查询此标本条码号的记录异常:" + err.Trim());
                            log.WriteMyLog("查询此标本条码号的记录异常:" + err.Trim() + "\r\n" + "select *  from portal_his.emr_jcsq_blmx  where tmh='" + Ssbz + "'");
                            return("0");
                        }

                        if (dt_bblb.Rows.Count > 0)
                        {
                            sqdh = dt_bblb.Rows[0]["sqdh"].ToString().Trim();
                        }
                        else
                        {
                            MessageBox.Show("未查询到此标本条码号的记录" + err.Trim());
                            log.WriteMyLog("未查询到此标本条码号的记录" + err.Trim() + "\r\n" + "select *  from portal_his.emr_jcsq_blmx  where tmh='" + Ssbz + "'");
                            return("0");
                        }
                    }
                    if (Sslbx == "申请单号")
                    {
                        sqdh = Ssbz;
                    }
                    err = "";
                    DataTable dt_sqd = new DataTable();

                    string sql_sqd = "select emr_jcsq.*,ksmc from portal_his.emr_jcsq,portal_his.gy_ksdm where  portal_his.emr_jcsq.kdks = portal_his.gy_ksdm.ksdm  and  sqdh='" + sqdh + "'";
                    dt_sqd = oracledb.Oracle_DataAdapter(odbcsql, sql_sqd, ref err);

                    if (dt_sqd == null)
                    {
                        MessageBox.Show("查询申请单的记录异常:" + err.Trim() + "");
                        log.WriteMyLog("查询申请单的记录异常:" + err.Trim() + "\r\n" + sql_sqd);
                        return("0");
                    }

                    if (dt_sqd.Rows.Count <= 0)
                    {
                        MessageBox.Show("未查询到申请单的记录" + err.Trim());
                        log.WriteMyLog("未查询到申请单的记录" + err.Trim() + "\r\n" + sql_sqd);
                        return("0");
                    }


                    string exp = "";
                    //-返回xml----------------------------------------------------
                    try
                    {
                        string xml = "<?xml version=" + (char)34 + "1.0" + (char)34 + " encoding=" + (char)34 + "gbk" + (char)34 + "?>";
                        xml = xml + "<LOGENE>";
                        xml = xml + "<row ";
                        try
                        {
                            xml = xml + "病人编号=" + (char)34 + dt_sqd.Rows[0]["BRID"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "病人编号=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        xml = xml + "就诊ID=" + (char)34 + "" + (char)34 + " ";

                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "申请序号=" + (char)34 + dt_sqd.Rows[0]["sqdh"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "申请序号=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        string brlb = dt_sqd.Rows[0]["jzlx"].ToString().Trim();
                        if (brlb == "1")
                        {
                            brlb = "门诊";
                        }
                        if (brlb == "2")
                        {
                            brlb = "住院";
                        }


                        try
                        {
                            if (brlb != "住院")
                            {
                                xml = xml + "门诊号=" + (char)34 + dt_sqd.Rows[0]["patientid"].ToString().Trim() + (char)34 + " ";
                            }
                            else
                            {
                                xml = xml + "门诊号=" + (char)34 + "" + (char)34 + " ";
                            }
                        }

                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "门诊号=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------

                        try
                        {
                            if (brlb == "住院")
                            {
                                xml = xml + "住院号=" + (char)34 + dt_sqd.Rows[0]["patientid"].ToString().Trim() + (char)34 + " ";
                            }
                            else
                            {
                                xml = xml + "住院号=" + (char)34 + "" + (char)34 + " ";
                            }
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "住院号=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------

                        try
                        {
                            xml = xml + "姓名=" + (char)34 + dt_sqd.Rows[0]["brxm"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "姓名=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------1男2女
                        try
                        {
                            string xb = dt_sqd.Rows[0]["brxb"].ToString().Trim();

                            if (xb == "1")
                            {
                                xb = "男";
                            }
                            else if (xb == "2")
                            {
                                xb = "女";
                            }
                            else
                            {
                                xb = "";
                            }
                            xml = xml + "性别=" + (char)34 + xb + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "性别=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "年龄=" + (char)34 + dt_sqd.Rows[0]["brnl"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "年龄=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "婚姻=" + (char)34 + "" + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "婚姻=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "地址=" + (char)34 + "" + (char)34 + "   ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "地址=" + (char)34 + "" + (char)34 + "   ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "电话=" + (char)34 + dt_sqd.Rows[0]["lxdh"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "电话=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "病区=" + (char)34 + "" + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "病区=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "床号=" + (char)34 + dt_sqd.Rows[0]["brch"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "床号=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "身份证号=" + (char)34 + "" + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "身份证号=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "民族=" + (char)34 + "" + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "民族=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "职业=" + (char)34 + "" + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "职业=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "送检科室=" + (char)34 + dt_sqd.Rows[0]["KSMC"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "送检科室=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------

                        try
                        {
                            xml = xml + "送检医生=" + (char)34 + dt_sqd.Rows[0]["sjys"].ToString().Trim() + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "送检医生=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------

                        xml = xml + "收费=" + (char)34 + "" + (char)34 + " ";
                        //----------------------------------------------------------
                        ///////////////////////////
                        string BBLB_XML = "";
                        string bbmc     = "";
                        if (tqbblb == "1")
                        {
                            //通过申请单号获取标本明细
                            err = "";
                            DataTable dt_bblb = new DataTable();
                            dt_bblb = oracledb.Oracle_DataAdapter(odbcsql, "select  *  from portal_his.emr_jcsq_blmx where sqdh='" + dt_sqd.Rows[0]["sqdh"].ToString().Trim() + "'", ref err);
                            if (dt_bblb == null)
                            {
                                MessageBox.Show("查询此申请单标本明细的记录异常:" + err.Trim());
                                log.WriteMyLog("查询此申请单标本明细的记录异常:" + err.Trim() + "\r\n" + "select  *  from portal_his.emr_jcsq_blmx where sqdh='" + dt_sqd.Rows[0]["sqdh"].ToString().Trim() + "'");
                                tqbblb = "0";
                            }
                            else
                            {
                                if (dt_bblb.Rows.Count > 0)
                                {
                                    BBLB_XML = "<BBLB>";
                                    try
                                    {
                                        for (int x = 0; x < dt_bblb.Rows.Count; x++)
                                        {
                                            try
                                            {
                                                BBLB_XML = BBLB_XML + "<row ";
                                                BBLB_XML = BBLB_XML + "F_BBXH=" + (char)34 + dt_bblb.Rows[x]["plxh"].ToString().Trim() + (char)34 + " ";
                                                BBLB_XML = BBLB_XML + "F_BBTMH=" + (char)34 + dt_bblb.Rows[x]["tmh"].ToString().Trim() + (char)34 + " ";
                                                BBLB_XML = BBLB_XML + "F_BBMC=" + (char)34 + dt_bblb.Rows[x]["bbmc"].ToString().Trim() + (char)34 + " ";
                                                BBLB_XML = BBLB_XML + "F_CQBW=" + (char)34 + dt_bblb.Rows[x]["bbbw"].ToString().Trim() + (char)34 + " ";
                                                BBLB_XML = BBLB_XML + "F_BZ=" + (char)34 + "" + (char)34 + " ";
                                                BBLB_XML = BBLB_XML + "F_LTSJ=" + (char)34 + dt_bblb.Rows[x]["bbsl"].ToString().Trim() + (char)34 + " ";
                                                BBLB_XML = BBLB_XML + "F_GDSJ=" + (char)34 + "" + (char)34 + " ";
                                                BBLB_XML = BBLB_XML + "F_JSSJ=" + (char)34 + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + (char)34 + " ";
                                                BBLB_XML = BBLB_XML + "F_JSY=" + (char)34 + yhmc + (char)34 + " ";
                                                BBLB_XML = BBLB_XML + "F_BBZT=" + (char)34 + "" + (char)34 + " ";
                                                BBLB_XML = BBLB_XML + "F_BBPJ=" + (char)34 + "" + (char)34 + " ";
                                                BBLB_XML = BBLB_XML + "F_PJR=" + (char)34 + "" + (char)34 + " ";
                                                BBLB_XML = BBLB_XML + "F_PJSJ=" + (char)34 + "" + (char)34 + " ";
                                                BBLB_XML = BBLB_XML + "/>";
                                                bbmc     = bbmc + " " + dt_bblb.Rows[x]["bbmc"].ToString().Trim();
                                            }
                                            catch (Exception eee)
                                            {
                                                MessageBox.Show("解析标本列表信息异常:" + eee.Message);
                                                tqbblb = "0";
                                                break;
                                            }
                                        }
                                    }
                                    catch (Exception e3)
                                    {
                                        MessageBox.Show("获取标本名称异常:" + e3.Message);
                                        tqbblb = "0";
                                    }

                                    BBLB_XML = BBLB_XML + "</BBLB>";
                                }
                                else
                                {
                                    MessageBox.Show("此申请单无标本条码信息" + err.Trim());

                                    log.WriteMyLog("此申请单无标本条码信息" + err.Trim() + "\r\n" + "select  *  from portal_his.emr_jcsq_blmx where sqdh='" + dt_sqd.Rows[0]["sqdh"].ToString().Trim() + "'");

                                    tqbblb = "0";
                                }
                            }
                        }


                        xml = xml + "标本名称=" + (char)34 + bbmc.Trim() + (char)34 + " ";
                        //----------------------------------------------------------

                        xml = xml + "送检医院=" + (char)34 + "本院" + (char)34 + " ";
                        //----------------------------------------------------------
                        xml = xml + "医嘱项目=" + (char)34 + dt_sqd.Rows[0]["sqxm"].ToString().Trim() + (char)34 + " ";
                        //----------------------------------------------------------
                        xml = xml + "备用1=" + (char)34 + (char)34 + " ";
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "备用2=" + (char)34 + "" + (char)34 + " ";
                        }
                        catch (Exception ee4)
                        {
                            log.WriteMyLog(ee4.Message);
                            xml = xml + "备用2=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "费别=" + (char)34 + "" + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "费别=" + (char)34 + "" + (char)34 + " ";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "病人类别=" + (char)34 + brlb + (char)34 + " ";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "病人类别=" + (char)34 + "" + (char)34 + " ";
                        }
                        xml = xml + "/>";
                        //----------------------------------------------------------

                        string bszy   = "病史摘要:" + dt_sqd.Rows[0]["bszy"].ToString().Trim() + "\r\n";
                        string zyjcjg = "主要检查结果:" + dt_sqd.Rows[0]["zyjcjg"].ToString().Trim() + "\r\n";
                        string ssjl   = "手术记录及内镜所见" + dt_sqd.Rows[0]["ssjl"].ToString().Trim() + "\r\n";


                        try
                        {
                            xml = xml + "<临床病史><![CDATA[" + bszy + zyjcjg + ssjl + "]]></临床病史>";//.Replace("\"", "&quot;")
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "<临床病史><![CDATA[" + "" + "]]></临床病史>";
                        }
                        //----------------------------------------------------------
                        try
                        {
                            xml = xml + "<临床诊断><![CDATA[" + dt_sqd.Rows[0]["jbmc"].ToString().Trim() + "]]></临床诊断>";
                        }
                        catch (Exception ee)
                        {
                            exp = exp + ee.ToString();
                            xml = xml + "<临床诊断><![CDATA[" + "" + "]]></临床诊断>";
                        }



                        if (tqbblb == "1")
                        {
                            xml = xml + BBLB_XML;
                        }

                        xml = xml + "</LOGENE>";

                        if (Debug == "1" && exp.Trim() != "")
                        {
                            log.WriteMyLog(exp.Trim());
                            log.WriteMyLog(xml);
                        }

                        return(xml);
                    }
                    catch (Exception e2)
                    {
                        MessageBox.Show("程序异常:" + e2.Message);
                        return("0");
                    }
                }
                else
                {
                    MessageBox.Show("无此识别号:" + Sslbx1);
                    return("0");
                }
            }
            else
            {
                MessageBox.Show("识别号不能为空:" + Sslbx);
                return("0");
            }
        }
Example #4
0
        private void button3_Click(object sender, EventArgs e)
        {
            StringReader  xmlstr = null;
            XmlTextReader xmread = null;

            xmlstr = new StringReader(textBox4.Text);
            xmread = new XmlTextReader(xmlstr);
            XmlDocument readxml2 = new XmlDocument();

            try
            {
                readxml2.Load(xmread);
            }
            catch (Exception e2)
            {
                log.WriteMyLog("读XML失败:" + e2.Message.ToString());
                return;
            }
            XmlNamespaceManager nsMgr = new XmlNamespaceManager(readxml2.NameTable);

            nsMgr.AddNamespace("ns", "http://chas.hit.com/transport/integration/common/msg");


            XmlNode xmlok_DATA = null;

            // XmlDocument xd2 = new XmlDocument();
            try
            {
                xmlok_DATA = readxml2.SelectSingleNode("/ns:QueryPatientResponse/ns:respHeader", nsMgr);
            }
            catch (Exception xmlok_e)
            {
                MessageBox.Show("提取基本信息失败:解析DATA异常:" + xmlok_e.Message);
                return;
            }
            MessageBox.Show("1");
            string ResultCode = xmlok_DATA["respCode"].InnerText.Trim(); MessageBox.Show("1");
            string ErrorMsg   = xmlok_DATA["respMessage"].InnerText.Trim();

            MessageBox.Show(ErrorMsg);
            if (ResultCode != "000000")
            {
                MessageBox.Show("提取基本信息失败::" + ErrorMsg);
                return;
            }
            MessageBox.Show("3");
            xmlok_DATA = readxml2.SelectSingleNode("/ns:QueryPatientResponse/ns:patient", nsMgr);

            if (xmlok_DATA["name"].InnerText == "")
            {
                MessageBox.Show("提取基本信息失败:info为空");
                return;
            }



            MessageBox.Show("4");
            string exp = "";
            //-返回xml----------------------------------------------------

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

            xml = xml + "<LOGENE>";
            xml = xml + "<row ";
            try
            {
                xml = xml + "病人编号=" + (char)34 + xmlok_DATA["encounterNo"].InnerText.Trim() + (char)34 + " ";
            }
            catch (Exception ee)
            {
                xml = xml + "病人编号=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------
            try
            {
                xml = xml + "就诊ID=" + (char)34 + "" + (char)34 + " ";
            }
            catch (Exception ee)
            {
                exp = exp + ee.ToString();
                xml = xml + "就诊ID=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------
            try
            {
                xml = xml + "申请序号=" + (char)34 + "" + (char)34 + " ";
            }
            catch (Exception ee)
            {
                exp = exp + ee.ToString();
                xml = xml + "申请序号=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------
            try
            {
                xml = xml + "门诊号=" + (char)34 + "" + (char)34 + " ";
            }
            catch (Exception ee)
            {
                exp = exp + ee.ToString();
                xml = xml + "门诊号=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------

            try
            {
                xml = xml + "住院号=" + (char)34 + xmlok_DATA["patientNo"].InnerText.Trim() + (char)34 + " ";
            }
            catch (Exception ee)
            {
                exp = exp + ee.ToString();
                xml = xml + "住院号=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------

            try
            {
                xml = xml + "姓名=" + (char)34 + xmlok_DATA["name"].InnerText.Trim() + (char)34 + " ";
            }
            catch (Exception ee)
            {
                exp = exp + ee.ToString();
                xml = xml + "姓名=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------
            try
            {
                xml = xml + "性别=" + (char)34 + xmlok_DATA["sexName"].InnerText.Trim() + (char)34 + " ";
            }
            catch
            {
                xml = xml + "性别=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------
            try
            {
                xml = xml + "年龄=" + (char)34 + ZGQClass.CsrqToAge(xmlok_DATA["birthday"].InnerText.Trim()) + (char)34 + " ";
            }
            catch
            {
                xml = xml + "年龄=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------
            try
            {
                xml = xml + "婚姻=" + (char)34 + "" + (char)34 + " ";
            }
            catch
            {
                xml = xml + "婚姻=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------
            try
            {
                xml = xml + "地址=" + (char)34 + xmlok_DATA["phone"].InnerText.Trim() + "^" + (char)34 + " ";
            }
            catch (Exception ee)
            {
                exp = exp + ee.ToString();
                xml = xml + "地址=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------
            try
            {
                xml = xml + "电话=" + (char)34 + xmlok_DATA["address"].InnerText.Trim() + (char)34 + " ";
            }
            catch (Exception ee)
            {
                exp = exp + ee.ToString();
                xml = xml + "电话=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------
            try
            {
                xml = xml + "病区=" + (char)34 + xmlok_DATA["wardName"].InnerText.Trim() + (char)34 + " ";
            }
            catch (Exception ee)
            {
                exp = exp + ee.ToString();
                xml = xml + "病区=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------
            try
            {
                xml = xml + "床号=" + (char)34 + xmlok_DATA["bedName"].InnerText.Trim() + (char)34 + " ";
            }
            catch (Exception ee)
            {
                exp = exp + ee.ToString();
                xml = xml + "床号=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------
            try
            {
                xml = xml + "身份证号=" + (char)34 + xmlok_DATA["idCardNo"].InnerText.Trim() + (char)34 + " ";
            }
            catch (Exception ee)
            {
                exp = exp + ee.ToString();
                xml = xml + "身份证号=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------
            try
            {
                xml = xml + "民族=" + (char)34 + "" + (char)34 + " ";
            }
            catch
            {
                xml = xml + "民族=" + (char)34 + "" + (char)34 + " ";
            }

            //----------------------------------------------------------
            try
            {
                xml = xml + "职业=" + (char)34 + "" + (char)34 + " ";
            }
            catch
            {
                xml = xml + "职业=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------
            try
            {
                xml = xml + "送检科室=" + (char)34 + xmlok_DATA["departmentName"].InnerText.Trim() + (char)34 + " ";
            }
            catch (Exception ee)
            {
                exp = exp + ee.ToString();
                xml = xml + "送检科室=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------

            try
            {
                xml = xml + "送检医生=" + (char)34 + xmlok_DATA["chargeDoctorName"].InnerText.Trim() + (char)34 + " ";
            }
            catch (Exception ee)
            {
                exp = exp + ee.ToString();
                xml = xml + "送检医生=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------

            xml = xml + "收费=" + (char)34 + "" + (char)34 + " ";
            //----------------------------------------------------------
            xml = xml + "标本名称=" + (char)34 + "" + (char)34 + " ";
            //----------------------------------------------------------
            try
            {
                xml = xml + "送检医院=" + (char)34 + xmlok_DATA["hospitalName"].InnerText.Trim() + (char)34 + " ";
            }
            catch
            {
                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 + " ";
            //----------------------------------------------------------
            try
            {
                xml = xml + "费别=" + (char)34 + "" + (char)34 + " ";
            }
            catch (Exception ee)
            {
                exp = exp + ee.ToString();
                xml = xml + "费别=" + (char)34 + "" + (char)34 + " ";
            }
            //----------------------------------------------------------
            try
            {
                string brlb = xmlok_DATA["chargeDoctorName"].InnerText.Trim();
                if (brlb == "ECTY.IP.0000")
                {
                    brlb = "住院";
                }
                else if (brlb == "ECTY.OP.0000")
                {
                    brlb = "门诊";
                }
                else if (brlb == "ECTY.HLC.0000")
                {
                    brlb = "体检";
                }
                else if (brlb == "ECTY.AEU.0000")
                {
                    brlb = "急诊";
                }
                else
                {
                    brlb = "住院";
                }

                xml = xml + "病人类别=" + (char)34 + brlb + (char)34 + " ";
            }
            catch
            {
                xml = xml + "病人类别=" + (char)34 + "住院" + (char)34 + " ";
            }
            xml = xml + "/>";
            //----------------------------------------------------------
            try
            {
                xml = xml + "<临床病史><![CDATA[" + "" + "]]></临床病史>";
            }
            catch (Exception ee)
            {
                exp = exp + ee.ToString();
                xml = xml + "<临床病史><![CDATA[" + "" + "]]></临床病史>";
            }
            //----------------------------------------------------------
            try
            {
                xml = xml + "<临床诊断><![CDATA[" + "" + "]]></临床诊断>";
            }
            catch (Exception ee)
            {
                exp = exp + ee.ToString();
                xml = xml + "<临床诊断><![CDATA[" + "" + "]]></临床诊断>";
            }
            xml = xml + "</LOGENE>";


            MessageBox.Show(xml);
            return;



            //   XmlNode xmlok_DATA = null;
            XmlDocument xd2 = new XmlDocument();

            try
            {
                xd2.LoadXml(textBox4.Text.Trim());
                xmlok_DATA = xd2.SelectSingleNode("/Response");
            }
            catch (Exception xmlok_e)
            {
                MessageBox.Show("解析XML异常:" + xmlok_e.Message);
                return;
            }
            if (xmlok_DATA["ResultCode"].InnerText.Trim() != "0")
            {
                MessageBox.Show("获取数据失败:" + xmlok_DATA["ErrorMsg"].InnerText.Trim());
                return;
            }

            XmlNodeList xnl = xd2.SelectNodes("/Response/FindOrds/FindOrd");



            foreach (XmlNode xn2 in xnl)
            {
                //PatInfo 病人信息
                MessageBox.Show(xn2["PatInfo"]["Name"].InnerText);

                //AdmInfo/AdmRecord 科室信息
                MessageBox.Show(xn2["AdmInfo"]["AdmRecord"]["AdmDR"].InnerText);

                //AdmInfo/AdmRecord/HISOrders/Order收费信息 循环
                XmlNodeList xnl2 = xn2.SelectNodes("/AdmInfo/AdmRecord/HISOrders/Order");

                //AdmInfo/AdmRecord/HISOrders/Order收费信息 循环


                XmlDocument p1 = new XmlDocument();
                p1.LoadXml(xn2["AdmInfo"]["AdmRecord"]["HISOrders"].OuterXml);
                //医嘱信息
                XmlNodeList ppplist2 = p1.SelectNodes("/HISOrders/Order");

                foreach (XmlNode xn3 in ppplist2)
                {
                    MessageBox.Show(xn3["OrdName"].InnerText);
                }
            }
        }
Example #5
0
        private static string jxhl7(string rtn_msg, string Ssbz, string Sslbx, string isbrxx, string WebUrl, string debug, string BBXml, string BBmc)
        {
            string  yh    = f.ReadString("yh", "yhmc", "0");
            int     xh    = 0;
            PT_XML  px    = new PT_XML();
            readhl7 r7    = new readhl7();
            int     count = 0;

            try
            {
                r7.Adt01(rtn_msg, ref count);

                if (r7.MSA[1].Trim() == "AA")
                {
                    try
                    {
                        if (count > 1)
                        {
                            DataTable  dt  = new DataTable();
                            DataColumn dc0 = new DataColumn("序号");
                            dt.Columns.Add(dc0);
                            DataColumn dc1 = new DataColumn("申请序号");
                            dt.Columns.Add(dc1);
                            DataColumn dc2 = new DataColumn("姓名");
                            dt.Columns.Add(dc2);
                            DataColumn dc3 = new DataColumn("病人类别");
                            dt.Columns.Add(dc3);

                            DataColumn dc4 = new DataColumn("送检科室");
                            dt.Columns.Add(dc4);
                            DataColumn dc5 = new DataColumn("送检医生");
                            dt.Columns.Add(dc5);

                            DataColumn dc6 = new DataColumn("医嘱项目");
                            dt.Columns.Add(dc6);
                            DataColumn dc7 = new DataColumn("费用");
                            dt.Columns.Add(dc7);
                            DataColumn dc8 = new DataColumn("标本名称");
                            dt.Columns.Add(dc8);


                            for (int x = 0; x < count; x++)
                            {
                                DataRow dr1 = dt.NewRow();
                                dt.Rows.Add(dr1);
                                dt.Rows[x][0] = x;

                                //申请序号
                                dt.Rows[x][1] = r7.ORC[x, 2].Trim();
                                //姓名
                                dt.Rows[x][2] = r7.PID[5].Split('^')[0].Trim();
                                //病人类型
                                dt.Rows[x][3] = r7.QRF[4].Trim();
                                if (dt.Rows[x][3].ToString() == "I")
                                {
                                    dt.Rows[x][3] = "住院";
                                }
                                else
                                {
                                    dt.Rows[x][3] = "门诊";
                                }

                                //科室
                                dt.Rows[x][4] = r7.ORC[xh, 13].Trim().Split('^')[0];
                                //医生
                                dt.Rows[x][5] = r7.ORC[x, 12].Trim();
                                //项目
                                dt.Rows[x][6] = r7.OBR[x, 4].Trim();
                                //费用
                                dt.Rows[x][7] = r7.OBR[x, 23].Trim();
                                //标本名称
                                string bbmc = r7.OBR[x, 15].Trim();
                                if (bbmc.Trim() == "^")
                                {
                                    bbmc = "";
                                }
                                dt.Rows[x][8] = bbmc;
                            }
                            Frm_FJSFYBJY ffj = new Frm_FJSFYBJY(dt, "30^80^80^40^120^100^250^70^150");
                            ffj.ShowDialog();
                            if (ffj.xh == "")
                            {
                                MessageBox.Show("未选择病人检查记录");
                                return("0");
                            }
                            xh = int.Parse(ffj.xh);
                        }

                        px.myDictionary["姓名"] = r7.PID[5].Split('^')[0].Trim();

                        string xb = r7.PID[8].Trim();
                        if (xb == "F")
                        {
                            xb = "女";
                        }
                        else if (xb.Trim() == "M")
                        {
                            xb = "男";
                        }
                        else
                        {
                            xb = "女";
                        }
                        px.myDictionary["性别"] = xb;

                        string brlb = r7.QRF[4].Trim();
                        if (brlb == "I")
                        {
                            brlb = "住院";
                        }
                        else
                        {
                            brlb = "门诊";
                        }

                        px.myDictionary["病人类别"] = brlb;

                        px.myDictionary["出生日期"] = r7.PID[7].Trim();
                        if (r7.PID[13].Trim() != "")
                        {
                            px.myDictionary["地址"] = r7.PID[11].Trim();
                        }
                        if (r7.PID[11].Trim() != "")
                        {
                            px.myDictionary["电话"] = "^" + r7.PID[13].Trim();
                        }

                        string hy = r7.PID[15].Trim();
                        switch (hy)
                        {
                        case "D": hy = "离婚"; break;

                        case "M": hy = "已婚"; break;

                        case "W": hy = "丧偶"; break;

                        case "V": hy = "未婚"; break;

                        default: hy = ""; break;
                        }
                        px.myDictionary["婚姻"] = hy;



                        foreach (string pid3 in r7.PID[3].Trim().Split('~'))
                        {
                            try
                            {
                                //身份证号
                                if (pid3.Split('^')[4] == "PN")
                                {
                                    px.myDictionary["身份证号"] = pid3.Split('^')[0].Trim();
                                }
                            }
                            catch
                            {
                            }
                            try
                            {
                                //PI  patientid
                                if (pid3.Split('^')[4] == "PI")
                                {
                                    px.myDictionary["病人编号"] = pid3.Split('^')[0].Trim();
                                }
                            }
                            catch
                            {
                            }
                            try
                            {
                                //病案号
                                if (pid3.Split('^')[4] == "MR")
                                {
                                    px.myDictionary["民族"] = pid3.Split('^')[0].Trim();
                                }
                            }
                            catch
                            {
                            }

                            try
                            {
                                //医保号
                                if (pid3.Split('^')[4] == "VN")
                                {
                                    px.myDictionary["就诊ID"] = pid3.Split('^')[0].Trim();
                                }
                            }
                            catch
                            {
                            }
                        }

                        if (px.myDictionary["民族"].Trim() == "")
                        {
                            px.myDictionary["民族"] = px.myDictionary["就诊ID"].Substring(0, px.myDictionary["就诊ID"].Length - 3);
                        }

                        string bah = px.myDictionary["民族"];
                        if (brlb == "门诊")
                        {
                            px.myDictionary["门诊号"] = bah;
                        }
                        if (brlb == "住院")
                        {
                            px.myDictionary["住院号"] = bah;
                        }


                        px.myDictionary["床号"] = r7.NTE[3].Trim();

                        px.myDictionary["送检科室"] = r7.ORC[xh, 13].Trim().Split('^')[0];

                        px.myDictionary["病区"] = r7.ORC[xh, 13].Trim().Split('^')[0];


                        px.myDictionary["申请序号"] = r7.ORC[xh, 2].Trim();
                        px.myDictionary["送检医生"] = r7.ORC[xh, 12].Trim().Split('^')[1].Trim();

                        string sqx = r7.OBR[0, 2].Trim();

                        px.myDictionary["医嘱项目"] = r7.OBR[xh, 4].Trim();


                        string bbmc1 = r7.OBR[xh, 15].Trim();
                        if (bbmc1.Trim() == "^")
                        {
                            bbmc1 = "";
                        }
                        px.myDictionary["标本名称"] = bbmc1;

                        px.myDictionary["收费"] = "";// r7.OBR[xh, 23].Trim();
                        //try
                        //{
                        //    px.myDictionary["临床病史"] = r7.OBR[xh, 46].Trim().Split('~')[1].Replace("2^", "").Trim();
                        //}
                        //catch
                        //{
                        //    px.myDictionary["临床病史"] = "";
                        //}

                        foreach (string lczd in r7.OBR[xh, 46].Trim().Split('~'))
                        {
                            //lczd
                            try
                            {
                                if (lczd.Split('^')[0] == "6")
                                {
                                    px.myDictionary["临床诊断"] = lczd.Split('^')[1];
                                }
                            }
                            catch
                            {
                            }
                            //主诉
                            try
                            {
                                if (lczd.Split('^')[0] == "1")
                                {
                                    px.myDictionary["临床病史"] = px.myDictionary["临床病史"] + lczd.Split('^')[1];
                                }
                            }
                            catch
                            {
                            }
                            // 病史
                            try
                            {
                                if (lczd.Split('^')[0] == "2")
                                {
                                    px.myDictionary["临床病史"] = px.myDictionary["临床病史"] + lczd.Split('^')[1];
                                }
                            }
                            catch
                            {
                            }
                        }

                        if (px.myDictionary["年龄"].Trim() == "")
                        {
                            px.myDictionary["年龄"] = ZGQClass.CsrqToAge(px.myDictionary["出生日期"]);
                        }

                        string exep = "";
                        //   MessageBox.Show(px.rtn_XML(ref exep));

                        //获取标本列表
                        if (BBXml.Trim() == "")
                        {
                            if (tqbblb == "1")
                            {
                                string applyNo      = "";
                                string patientId    = "";
                                string visitNo      = "";
                                string visitType    = "";
                                string examItemCode = "";
                                string examItemName = "";
                                BBXml = GetBbxx(px.myDictionary["申请序号"].Trim(), "", WebUrl, debug, ref applyNo, ref patientId, ref visitNo, ref visitType, ref examItemCode, ref examItemName, ref BBmc);
                            }
                        }

                        if (BBmc != "")
                        {
                            px.myDictionary["标本名称"] = BBmc;
                        }

                        return(px.rtn_XML(BBXml, ref exep));
                    }
                    catch (Exception e2)
                    {
                        MessageBox.Show(e2.Message);
                        return("0");
                    }
                }
                else
                {
                    //取基本信息
                    if (isbrxx == "1")
                    {
                        if (debug == "1")
                        {
                            log.WriteMyLog("未取得申请单信息,提取病人基本信息");
                        }

                        if (Sslbx.Trim() == "住院号" || Sslbx.Trim() == "就诊号")
                        {
                            string rtn_msg2 = "";
                            if (Sslbx.Trim() == "住院号")
                            {
                                //if (isbrxx.Trim() != "1")
                                //{
                                //    MessageBox.Show(r7.MSA[1].Trim() + "|" + r7.MSA[3].Trim());
                                //    return "0";
                                //}
                                string XML2 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><root><visitNo></visitNo><inpNo>" + Ssbz + "</inpNo><patientId></patientId><wardCode></wardCode><deptCode></deptCode></root>";
                                rtn_msg2 = rtn_CallInterface("XML", "GetPatientInHospital", XML2, "", WebUrl, debug);
                            }
                            else
                            {
                                //if (isbrxx.Trim() != "1")
                                //{
                                //    MessageBox.Show(r7.MSA[1].Trim() + "|" + r7.MSA[3].Trim());
                                //    return "0";
                                //}

                                string XML2 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><root><icCardNo>" + Ssbz + "</icCardNo><executeDept></executeDept></root>";
                                rtn_msg2 = rtn_CallInterface("XML", "GetDispPatientInfo", XML2, "", WebUrl, debug);
                            }



                            if (rtn_msg2 == "")
                            {
                                return("0");
                            }


                            readhl7 rr7 = new readhl7();
                            int     xy  = 0;
                            rr7.Adt01(rtn_msg2, ref xy);
                            if (rr7.MSA[1].Trim() != "AA")
                            {
                                MessageBox.Show(rr7.MSA[3].Trim());

                                return("0");
                            }
                            else
                            {
                                XmlNode     xmlok = null;
                                XmlDocument xd    = new XmlDocument();
                                try
                                {
                                    xd.LoadXml(rtn_msg2);
                                    xmlok = xd.SelectSingleNode("/root/patients");
                                    if (xmlok.InnerXml.Trim() != "")
                                    {
                                        DataSet      ds1 = new DataSet();
                                        StringReader sr  = new StringReader(xmlok.InnerXml);
                                        XmlReader    xr  = new XmlTextReader(sr);
                                        ds1.ReadXml(xr);

                                        px.myDictionary["姓名"] = ds1.Tables[0].Rows[0]["patientName"].ToString().Trim();
                                        string xb = ds1.Tables[0].Rows[0]["patientSex"].ToString().Trim();
                                        if (xb == "1")
                                        {
                                            xb = "女";
                                        }
                                        else if (xb.Trim() == "0")
                                        {
                                            xb = "男";
                                        }
                                        else
                                        {
                                            xb = "";
                                        }
                                        px.myDictionary["性别"] = xb;
                                        if (Sslbx.Trim() == "住院号")
                                        {
                                            px.myDictionary["病人类别"] = "住院";
                                            px.myDictionary["就诊ID"] = ds1.Tables[0].Rows[0]["visitCount"].ToString().Trim();
                                            px.myDictionary["住院号"]  = ds1.Tables[0].Rows[0]["visitNo"].ToString().Trim();
                                            px.myDictionary["床号"]   = ds1.Tables[0].Rows[0]["bedCode"].ToString().Trim();
                                            px.myDictionary["病区"]   = ds1.Tables[0].Rows[0]["wardName"].ToString().Trim();
                                        }
                                        else
                                        {
                                            px.myDictionary["病人类别"] = "门诊";
                                            px.myDictionary["门诊号"]  = ds1.Tables[0].Rows[0]["icCardNo"].ToString().Trim();
                                            px.myDictionary["病区"]   = ds1.Tables[0].Rows[0]["deptName"].ToString().Trim();
                                        }
                                        if (ds1.Tables[0].Rows[0]["patientAge"].ToString().Trim() != "")
                                        {
                                            try
                                            {
                                                px.myDictionary["年龄"] = ds1.Tables[0].Rows[0]["patientAge"].ToString().Trim() + ds1.Tables[0].Rows[0]["ageUnit"].ToString().Trim();
                                            }
                                            catch
                                            {
                                                px.myDictionary["年龄"] = ds1.Tables[0].Rows[0]["patientAge"].ToString().Trim();
                                            }
                                        }
                                        px.myDictionary["地址"]   = "电话:" + ds1.Tables[0].Rows[0]["telephone"].ToString().Trim();
                                        px.myDictionary["电话"]   = "^地址:";
                                        px.myDictionary["病人编号"] = ds1.Tables[0].Rows[0]["patientId"].ToString().Trim();
                                        px.myDictionary["送检科室"] = ds1.Tables[0].Rows[0]["deptName"].ToString().Trim();

                                        px.myDictionary["申请序号"] = "";
                                        px.myDictionary["送检医生"] = ds1.Tables[0].Rows[0]["doctorInCharge"].ToString().Trim().Split('/')[0].Trim();
                                        px.myDictionary["费别"]   = ds1.Tables[0].Rows[0]["rateTypeName"].ToString().Trim();
                                        try
                                        {
                                            px.myDictionary["临床诊断"] = ds1.Tables[0].Rows[0]["diagnosisname"].ToString().Trim();
                                        }
                                        catch
                                        {
                                            px.myDictionary["临床诊断"] = "";
                                        }

                                        string exep = "";
                                        return(px.rtn_XML(ref exep));
                                    }
                                    else
                                    {
                                        MessageBox.Show("未能查询到病人记录");
                                        return("0");
                                    }
                                }
                                catch (Exception ee)
                                {
                                    MessageBox.Show("XML解析错误:" + ee.Message);
                                    log.WriteMyLog(rtn_msg2 + "--" + ee.Message);
                                    return("0");
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show(r7.MSA[1].Trim() + "|" + r7.MSA[3].Trim());
                    }


                    return("0");
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
                return("0");
            }
        }
Example #6
0
        public static string ptxml(string Sslbx, string Ssbz, string debug)
        {
            if (Sslbx.Trim() == "")
            {
                MessageBox.Show("无此" + Sslbx);
                return("0");
            }

            #region 获取SZ或T_SZ配置


            string xtdm   = f.ReadString(Sslbx, "xtdm", "2060000").Replace("\0", "").Trim();
            string WebUrl = f.ReadString(Sslbx, "WebUrl", "http://223.220.200.45:1506/services/WSInterface?wsdl").Replace("\0", "").Trim();
            debug = f.ReadString(Sslbx, "debug", "").Replace("\0", "").Trim();

            string certificate = f.ReadString(Sslbx, "certificate", "ZmmJ9RMCKAUxFsiwl/08iiA3J17G0OpI").Replace("\0", "").Trim();
            #endregion



            #region 提取基本信息
            string OSQ = "";
            if (Sslbx == "卡号")
            {
                if (Ssbz.Length > 19)
                {
                    try
                    {
                        Ssbz = Ssbz.Substring(9, 10);
                    }
                    catch
                    {
                        log.WriteMyLog("截取卡号异常Substring(9, 10):" + Ssbz);
                    }
                }
                if (debug == "1")
                {
                    log.WriteMyLog("卡号:" + Ssbz);
                }

                string rtn = SP_SELECT.ptxml2(Sslbx, Ssbz, debug, "");
                if (rtn != "0")
                {
                    return(rtn);
                }

                if (debug == "1")
                {
                    log.WriteMyLog("未查询到申请单记录,获取基本信息");
                }

                OSQ = "<root><patientId></patientId><visitNo>" + Ssbz + "</visitNo></root>";
            }
            else
            if (Sslbx == "门诊号")
            {
                string rtn = SP_SELECT.ptxml2(Sslbx, Ssbz, debug, "");
                if (rtn != "0")
                {
                    return(rtn);
                }

                if (debug == "1")
                {
                    log.WriteMyLog("未查询到申请单记录,获取基本信息");
                }

                OSQ = "<root><patientId></patientId><visitNo>" + Ssbz + "</visitNo></root>";
            }
            else
            if (Sslbx == "住院号")
            {
                string rtn = SP_SELECT.ptxml2(Sslbx, Ssbz, debug, "");
                if (rtn != "0")
                {
                    return(rtn);
                }

                if (debug == "1")
                {
                    log.WriteMyLog("未查询到申请单记录,获取基本信息");
                }

                OSQ = "<root><patientId></patientId><visitNo>" + Ssbz + "</visitNo></root>";
            }
            else
            {
                MessageBox.Show("无此识别类型" + Sslbx);
                return("0");
            }

            aydefyweb.WSInterface ayd2yy = new LGHISJKZGQ.aydefyweb.WSInterface();
            if (WebUrl.Trim() != "")
            {
                ayd2yy.Url = WebUrl;
            }

            string msgHeader = "<?xml version=\"1.0\" encoding=\"utf-8\"?><root><serverName>GetPatientBaseInfoIndex</serverName>"
                               + "<format>xml</format><callOperator></callOperator><certificate>" + certificate + "</certificate></root>";

            if (debug == "1")
            {
                log.WriteMyLog("入参:msgHeader:" + msgHeader + "\r\nmsgBody" + OSQ);
            }


            try
            {
                string rtn = "";
                try
                {
                    rtn = ayd2yy.CallInterface(msgHeader, OSQ);
                }
                catch (Exception e1)
                {
                    MessageBox.Show("连接webservice异常:" + e1.Message);
                    return("0");
                }
                if (debug == "1")
                {
                    log.WriteMyLog("返回:" + rtn);
                }

                if (rtn == "<?xml version=\"1.0\" encoding=\"utf-8\"?><root/>")
                {
                    MessageBox.Show("未查询到病人信息");
                    return("0");
                }

                PT_XML px = new PT_XML();


                XmlNode     xmlok = null;
                XmlDocument xd    = new XmlDocument();
                try
                {
                    xd.LoadXml(rtn);
                    xmlok = xd.SelectSingleNode("/root/patients/patient");
                }
                catch
                {
                    MessageBox.Show("未查询到病人信息");
                    return("0");
                }


                px.myDictionary["姓名"] = xmlok["patientName"].InnerText;
                string xb = xmlok["patientSex"].InnerText;
                if (xb == "1")
                {
                    xb = "女";
                }
                else if (xb.Trim() == "0")
                {
                    xb = "男";
                }
                else
                {
                    xb = "";
                }
                px.myDictionary["性别"] = xb;

                if (Sslbx.Trim() == "住院号")
                {
                    px.myDictionary["病人类别"] = "住院";
                    px.myDictionary["住院号"]  = xmlok["visitNo"].InnerText;
                    try
                    {
                        px.myDictionary["送检科室"] = xmlok["admissionDept"].InnerText;
                    }
                    catch
                    {
                    }
                    px.myDictionary["就诊ID"] = xmlok["visitNum"].InnerText;
                }
                else
                {
                    px.myDictionary["病人类别"] = "门诊";
                    px.myDictionary["门诊号"]  = xmlok["visitNo"].InnerText;
                    try
                    {
                        px.myDictionary["送检科室"] = xmlok["cureDept"].InnerText;
                    }
                    catch
                    {
                    }
                    if (Sslbx.Trim() == "卡号")
                    {
                        px.myDictionary["就诊ID"] = Ssbz;
                    }
                }


                px.myDictionary["年龄"]   = ZGQClass.CsrqToAge(xmlok["patientBirthdate"].InnerText);
                px.myDictionary["地址"]   = xmlok["commPostCode"].InnerText;
                px.myDictionary["电话"]   = xmlok["telephone"].InnerText;
                px.myDictionary["病人编号"] = xmlok["patientId"].InnerText;

                px.myDictionary["申请序号"] = "";
                px.myDictionary["送检医生"] = "";
                px.myDictionary["费别"]   = "";
                px.myDictionary["临床诊断"] = "";
                px.myDictionary["民族"]   = "";
                px.myDictionary["身份证号"] = xmlok["identityNo"].InnerText;

                string exep = "";
                return(px.rtn_XML(ref exep));
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);

                return("0");
            }

            #endregion
        }
Example #7
0
        //获取门诊病人基本信息
        private static string getmzbrxx(string fid, string putcmsg, string debug, int ljfs)
        {
            if (debug == "1")
            {
                log.WriteMyLog("入参:" + putcmsg);
            }

            string getcmsg = "";
            string err_msg = "";
            bool   rtn     = false;

            if (ljfs == 0)
            {
                try
                {
                    rtn = MQ(fid, putcmsg, debug, ref getcmsg);
                }
                catch (Exception e1)
                {
                    MessageBox.Show(e1.Message);
                    return("0");
                }
            }
            else
            {
                EHSBMQWeb.Service ehsb = new LGHISJKZGQ.EHSBMQWeb.Service();
                if (weburl.Trim() != "")
                {
                    ehsb.Url = weburl;
                }
                try
                {
                    rtn = ehsb.GETMQ(fid, putcmsg, ref getcmsg, ref err_msg);
                }
                catch (Exception e1)
                {
                    MessageBox.Show(e1.Message);
                    return("0");
                }
            }


            if (!rtn)
            {
                MessageBox.Show(err_msg);
                return("0");
            }
            if (debug == "1")
            {
                log.WriteMyLog("返回:" + getcmsg);
            }

            if (getcmsg.Trim() == "")
            {
                MessageBox.Show("提取失败,返回为空");
                return("0");
            }
            string RetCon = "";

            string RetCode = "";

            string bobys = "";

            XmlNode     xmlok = null;
            XmlNodeList xmlNL = null;
            XmlDocument xd    = new XmlDocument();

            try
            {
                xd.LoadXml(getcmsg);
                xmlok = xd.SelectSingleNode("/ESBEntry/RetInfo");

                RetCon  = xmlok["RetCon"].InnerText;
                RetCode = xmlok["RetCode"].InnerText;
                if (RetCode != "1")
                {
                    MessageBox.Show(RetCon);
                    return("0");
                }


                xmlNL = xd.SelectNodes("/ESBEntry/MsgInfo/Msg");
                foreach (XmlNode xn in xmlNL)
                {
                    XmlNode xmlok_DATA = null;

                    try
                    {
                        xd.LoadXml(xn.InnerText);
                        xmlok_DATA = xd.SelectSingleNode("/body");
                    }
                    catch
                    {
                    }

                    bobys = bobys + xmlok_DATA.InnerXml;
                }
            }
            catch (Exception e1)
            {
                MessageBox.Show("提取信息异常,解析返回值异常:" + e1.Message);
                return("0");
            }


            //转成dataset
            XmlNode xmlok_DATA2 = null;

            try
            {
                xd.LoadXml("<body>" + bobys + "</body>");
                xmlok_DATA2 = xd.SelectSingleNode("/body");
            }
            catch (Exception xmlok_e)
            {
                MessageBox.Show("解析DATA异常:" + xmlok_e.Message);
                return("0");
            }
            if (xmlok_DATA2.InnerXml.Trim() == "")
            {
                MessageBox.Show("未找到对应的记录!");
                return("0");
            }
            DataSet ds1 = new DataSet();

            try
            {
                StringReader sr = new StringReader(xmlok_DATA2.OuterXml);
                XmlReader    xr = new XmlTextReader(sr);
                ds1.ReadXml(xr);
            }
            catch (Exception eee)
            {
                MessageBox.Show("XML转dataset异常:" + eee.Message);
                return("0");
            }

            if (ds1.Tables[0].Rows.Count <= 0)
            {
                MessageBox.Show("未查询到此病人信息");
                return("0");
            }


            int xh = 0;


            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 + ds1.Tables[0].Rows[xh]["SICK_ID"].ToString().Trim() + (char)34 + " ";
            xml = xml + "就诊ID=" + (char)34 + ds1.Tables[0].Rows[xh]["IC_CARD_ID"].ToString().Trim() + (char)34 + " ";
            xml = xml + "申请序号=" + (char)34 + "" + (char)34 + " ";


            xml = xml + "门诊号=" + (char)34 + ds1.Tables[0].Rows[xh]["IC_CARD_ID"].ToString().Trim() + (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]["NAME"].ToString().Trim() + (char)34 + " ";

            string xb = ds1.Tables[0].Rows[xh]["SEX"].ToString().Trim();

            if (xb == "0")
            {
                xb = "男";
            }
            else
            if (xb == "1")
            {
                xb = "女";
            }
            else
            {
                xb = "";
            }
            xml = xml + "性别=" + (char)34 + xb + (char)34 + " ";

            string nl = ZGQClass.CsrqToAge(ds1.Tables[0].Rows[xh]["BIRTHDATE"].ToString().Trim());

            xml = xml + "年龄=" + (char)34 + nl + (char)34 + " ";
            xml = xml + "婚姻=" + (char)34 + "" + (char)34 + " ";
            xml = xml + "地址=" + (char)34 + ds1.Tables[0].Rows[xh]["COMMUNICATE_ADDRESS"].ToString().Trim() + (char)34 + " ";
            xml = xml + "电话=" + (char)34 + ds1.Tables[0].Rows[xh]["FAMILY_PHONE"].ToString().Trim() + (char)34 + " ";
            xml = xml + "身份证号=" + (char)34 + ds1.Tables[0].Rows[xh]["ID_CARD_NO"].ToString().Trim() + (char)34 + " ";
            xml = xml + "民族=" + (char)34 + ds1.Tables[0].Rows[xh]["NATION"].ToString().Trim() + (char)34 + " ";
            xml = xml + "职业=" + (char)34 + ds1.Tables[0].Rows[xh]["PROFESSION"].ToString().Trim() + (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 + "" + (char)34 + " ";
            xml = xml + "备用1=" + (char)34 + (char)34 + " ";
            xml = xml + "备用2=" + (char)34 + (char)34 + " ";
            xml = xml + "费别=" + (char)34 + ds1.Tables[0].Rows[xh]["RATE_TYPE"].ToString().Trim() + (char)34 + " ";

            xml = xml + "病人类别=" + (char)34 + "门诊" + (char)34 + " ";
            xml = xml + "/>";
            xml = xml + "<临床病史><![CDATA[" + "" + "]]></临床病史>";
            xml = xml + "<临床诊断><![CDATA[" + "" + "]]></临床诊断>";
            xml = xml + "</LOGENE>";


            return(xml);
        }
Example #8
0
        //获取病人基本信息
        private static string getzybrxx(string fid, string putcmsg, string debug, ref PT_XML pt, int ljfs)
        {
            if (debug == "1")
            {
                log.WriteMyLog("入参:" + putcmsg);
            }

            string getcmsg = "";
            string err_msg = "";
            bool   rtn     = false;

            if (ljfs == 0)
            {
                try
                {
                    rtn = MQ(fid, putcmsg, debug, ref getcmsg);
                }
                catch (Exception e1)
                {
                    MessageBox.Show(e1.Message);
                    return("0");
                }
            }
            else
            {
                EHSBMQWeb.Service ehsb = new LGHISJKZGQ.EHSBMQWeb.Service();
                if (weburl.Trim() != "")
                {
                    ehsb.Url = weburl;
                }
                try
                {
                    rtn = ehsb.GETMQ(fid, putcmsg, ref getcmsg, ref err_msg);
                }
                catch (Exception e1)
                {
                    MessageBox.Show(e1.Message);
                    return("0");
                }
            }


            if (!rtn)
            {
                MessageBox.Show(err_msg);
                return("0");
            }
            if (debug == "1")
            {
                log.WriteMyLog("返回:" + getcmsg);
            }

            if (getcmsg.Trim() == "")
            {
                MessageBox.Show("提取失败,返回为空");
                return("0");
            }


            string RetCon  = "";
            string Msg     = "";
            string RetCode = "";

            XmlNode     xmlok     = null;
            XmlNode     xmlok_msg = null;
            XmlDocument xd        = new XmlDocument();

            try
            {
                xd.LoadXml(getcmsg);
                xmlok     = xd.SelectSingleNode("/ESBEntry/RetInfo");
                xmlok_msg = xd.SelectSingleNode("/ESBEntry/MsgInfo");
                RetCon    = xmlok["RetCon"].InnerText;
                RetCode   = xmlok["RetCode"].InnerText;
                Msg       = xmlok_msg["Msg"].InnerText;
            }
            catch (Exception e1)
            {
                MessageBox.Show("提取住院信息异常,解析返回值异常:" + e1.Message);
                return("0");
            }

            if (RetCode != "1")
            {
                MessageBox.Show(RetCon);
                return("0");
            }

            StringReader  xmlstr = null;
            XmlTextReader xmread = null;

            xmlstr = new StringReader(Msg);
            xmread = new XmlTextReader(xmlstr);
            XmlDocument readxml2 = new XmlDocument();

            try
            {
                readxml2.Load(xmread);
            }
            catch (Exception e2)
            {
                MessageBox.Show("读XML失败:" + e2.Message);
                return("0");
            }
            XmlNamespaceManager nsMgr = new XmlNamespaceManager(readxml2.NameTable);

            nsMgr.AddNamespace("ns", "urn:hl7-org:v3");


            XmlNode ppp = readxml2.SelectSingleNode("/ns:ClinicalDocument/ns:id", nsMgr);

            //////姓名
            try
            {
                ppp = readxml2.SelectSingleNode("/ns:ClinicalDocument/ns:recordTarget/ns:patientRole/ns:patient/ns:name", nsMgr);
                pt.myDictionary["姓名"] = ppp.InnerText;
            }
            catch
            {
            }

            //性别
            try
            {
                ppp = readxml2.SelectSingleNode("/ns:ClinicalDocument/ns:recordTarget/ns:patientRole/ns:patient/ns:administrativeGenderCode", nsMgr);
                pt.myDictionary["性别"] = ppp.Attributes["displayName"].Value;
            }
            catch
            {
            }
            //出身日期
            try
            {
                ppp = readxml2.SelectSingleNode("/ns:ClinicalDocument/ns:recordTarget/ns:patientRole/ns:patient/ns:birthTime", nsMgr);
                pt.myDictionary["出生日期"] = ppp.Attributes["value"].Value;
            }
            catch
            {
            }
            ///婚姻\
            try
            {
                ppp = readxml2.SelectSingleNode("/ns:ClinicalDocument/ns:recordTarget/ns:patientRole/ns:patient/ns:maritalStatusCode", nsMgr);
                pt.myDictionary["婚姻"] = ppp.Attributes["displayName"].Value;
            }
            catch
            {
            }
            //民族
            try
            {
                ppp = readxml2.SelectSingleNode("/ns:ClinicalDocument/ns:recordTarget/ns:patientRole/ns:patient/ns:ethnicGroupCode", nsMgr);
                pt.myDictionary["民族"] = ppp.Attributes["displayName"].Value;
            }
            catch
            {
            }

            //////电话
            try
            {
                ppp = readxml2.SelectSingleNode("/ns:ClinicalDocument/ns:recordTarget/ns:patientRole/ns:telecom", nsMgr);
                pt.myDictionary["电话"] = ppp.Attributes["value"].Value;
            }
            catch
            {
            }
            //地址
            try
            {
                ppp = readxml2.SelectSingleNode("/ns:ClinicalDocument/ns:recordTarget/ns:patientRole/ns:addr/ns:state", nsMgr);
                pt.myDictionary["地址"] = ppp.InnerText;
            }
            catch
            {
            }
            //身份证
            try
            {
                ppp = readxml2.SelectSingleNode("/ns:ClinicalDocument/ns:recordTarget/ns:patientRole/ns:patient/ns:id", nsMgr);
                pt.myDictionary["身份证号"] = ppp.Attributes["extension"].InnerText;
            }
            catch
            {
            }
            //年龄
            try
            {
                ppp = readxml2.SelectSingleNode("/ns:ClinicalDocument/ns:recordTarget/ns:patientRole/ns:patient/ns:age", nsMgr);
                pt.myDictionary["年龄"] = ppp.Attributes["value"].InnerText + ppp.Attributes["unit"].InnerText;
            }
            catch
            {
            }

            //病区
            try
            {
                ppp = readxml2.SelectSingleNode("/ns:ClinicalDocument/ns:componentOf/ns:encompassingEncounter/ns:location/ns:healthCareFacility/ns:serviceProviderOrganization/ns:asOrganizationPartOf/ns:wholeOrganization/ns:asOrganizationPartOf/ns:wholeOrganization/ns:name", nsMgr);
                pt.myDictionary["病区"] = ppp.InnerText;
            }
            catch
            {
            }
            //科室
            try
            {
                ppp = readxml2.SelectSingleNode("/ns:ClinicalDocument/ns:componentOf/ns:encompassingEncounter/ns:location/ns:healthCareFacility/ns:serviceProviderOrganization/ns:asOrganizationPartOf/ns:wholeOrganization/ns:asOrganizationPartOf/ns:wholeOrganization/ns:asOrganizationPartOf/ns:wholeOrganization/ns:name", nsMgr);
                pt.myDictionary["送检科室"] = ppp.InnerText;
            }
            catch
            {
            }
            //医生
            try
            {
                ppp = readxml2.SelectSingleNode("/ns:ClinicalDocument/ns:author/ns:assignedAuthor/ns:assignedPerson/ns:name", nsMgr);
                pt.myDictionary["送检医生"] = ppp.InnerText;
            }
            catch
            {
            }
            //床号
            try
            {
                ppp = readxml2.SelectSingleNode("/ns:ClinicalDocument/ns:componentOf/ns:encompassingEncounter/ns:location/ns:healthCareFacility/ns:serviceProviderOrganization/ns:asOrganizationPartOf/ns:wholeOrganization/ns:id", nsMgr);
                pt.myDictionary["床号"] = ppp.Attributes["extension"].Value;
            }
            catch
            {
            }
            try
            {
                XmlNodeList ppplist = readxml2.SelectNodes("/ns:ClinicalDocument/ns:recordTarget/ns:patientRole/ns:id", nsMgr);
                foreach (XmlNode ppp2 in ppplist)
                {
                    if (ppp2.Attributes["root"].Value == "2.16.156.10011.1.12")
                    {
                        pt.myDictionary["住院号"] = ppp2.Attributes["extension"].Value.ToString();
                    }
                    if (ppp2.Attributes["root"].Value == "2.16.156.10011.1.19")
                    {
                        //就诊卡号
                        pt.myDictionary["就诊ID"] = ppp2.Attributes["extension"].Value.ToString();
                    }
                    //if (ppp2.Attributes["root"].Value == "2.16.156.10011.1.13")
                    //{
                    //    //病案号
                    //       pt.myDictionary["病人编号"] = + ppp2.Attributes["extension"].Value.ToString();
                    //}
                    if (ppp2.Attributes["root"].Value == "2.16.156.10011.1.100")
                    {
                        //padid
                        pt.myDictionary["病人编号"] = ppp2.Attributes["extension"].Value.ToString();
                    }
                    //if (ppp2.Attributes["root"].Value == "2.16.156.10011.1.13")
                    //{
                    //    //门诊号
                    //   pt.myDictionary["门诊号"]=ppp2.Attributes["extension"].Value.ToString();

                    //}
                }

                //ppplist = readxml2.SelectNodes("/ns:ClinicalDocument/ns:component/ns:structuredBody/ns:component/ns:section/ns:entry/ns:observation", nsMgr);

                //foreach (XmlNode ppp2 in ppplist)
                //{
                //    //住院次数
                //    if (ppp2["code"].Attributes["code"].Value.ToString() == "DE02.10.090.00")
                //    {
                //        pt.myDictionary["就诊ID"] = ppp2["value"].Attributes["value"].Value.ToString();
                //        break;

                //    }


                //}
            }
            catch
            {
            }
            string xb = pt.myDictionary["性别"].Trim();

            if (xb == "1")
            {
                xb = "男";
            }
            else if (xb == "2")
            {
                xb = "女";
            }
            pt.myDictionary["性别"]   = xb;
            pt.myDictionary["病人类别"] = "住院";
            if (pt.myDictionary["年龄"].Trim() == "")
            {
                pt.myDictionary["年龄"] = ZGQClass.CsrqToAge(pt.myDictionary["出生日期"]);
            }
            if (pt.myDictionary["姓名"].Trim() == "")
            {
                MessageBox.Show("提取数据错误");
                return("0");
            }


            string ex  = "";
            string xml = pt.rtn_XML(ref ex);

            if (ex.Trim() != "")
            {
                log.WriteMyLog(ex);
            }

            return(xml);
        }