Example #1
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 #2
0
        public static string return_xml(DataSet ds, string Sslbx, string brlb_1)
        {
            try
            {
                PT_XML pt = new PT_XML();
                pt.myDictionary["病人编号"] = ds.Tables[0].Rows[0]["patientid"].ToString().Trim();
                pt.myDictionary["就诊ID"] = ""; ds.Tables[0].Rows[0]["cardno"].ToString().Trim();
                pt.myDictionary["申请序号"] = ds.Tables[0].Rows[0]["sendno"].ToString().Trim();

                if (Sslbx == "住院申请号" || Sslbx == "住院号" || Sslbx.Contains("住院"))
                {
                    pt.myDictionary["门诊号"] = "";
                    pt.myDictionary["住院号"] = ds.Tables[0].Rows[0]["hospno"].ToString().Trim();
                }
                else
                {
                    pt.myDictionary["门诊号"] = ds.Tables[0].Rows[0]["hospno"].ToString().Trim();
                    pt.myDictionary["住院号"] = "";
                }

                pt.myDictionary["姓名"] = ds.Tables[0].Rows[0]["patname"].ToString().Trim();

                string xb = ds.Tables[0].Rows[0]["sex"].ToString().Trim();
                if (xb == "1")
                {
                    xb = "男";
                }
                else if (xb == "2")
                {
                    xb = "女";
                }
                else
                {
                    xb = "";
                }
                pt.myDictionary["性别"]   = xb;
                pt.myDictionary["年龄"]   = ds.Tables[0].Rows[0]["age"].ToString().Trim() + ds.Tables[0].Rows[0]["ageunit"].ToString().Trim();
                pt.myDictionary["婚姻"]   = "";
                pt.myDictionary["地址"]   = ds.Tables[0].Rows[0]["address"].ToString().Trim();
                pt.myDictionary["电话"]   = ds.Tables[0].Rows[0]["phone"].ToString().Trim();
                pt.myDictionary["病区"]   = ds.Tables[0].Rows[0]["bqmc"].ToString().Trim();
                pt.myDictionary["床号"]   = ds.Tables[0].Rows[0]["bedno"].ToString().Trim();
                pt.myDictionary["身份证号"] = ds.Tables[0].Rows[0]["idnum"].ToString().Trim();
                pt.myDictionary["民族"]   = ds.Tables[0].Rows[0]["Nation"].ToString().Trim();;
                pt.myDictionary["职业"]   = ds.Tables[0].Rows[0]["career"].ToString().Trim();
                pt.myDictionary["送检科室"] = ds.Tables[0].Rows[0]["deptName"].ToString().Trim();
                pt.myDictionary["送检医生"] = ds.Tables[0].Rows[0]["todoc"].ToString().Trim();
                pt.myDictionary["收费"]   = "";
                pt.myDictionary["标本名称"] = "";
                pt.myDictionary["送检医院"] = "本院";
                pt.myDictionary["医嘱项目"] = "";
                pt.myDictionary["备用1"]  = "";
                pt.myDictionary["备用2"]  = "";
                pt.myDictionary["费别"]   = "";
                if (brlb_1 == "1")
                {
                    pt.myDictionary["病人类别"] = "住院";
                }
                else if (brlb_1 == "3")
                {
                    pt.myDictionary["病人类别"] = "体检";
                }
                else
                {
                    pt.myDictionary["病人类别"] = "门诊";
                }

                pt.myDictionary["临床病史"] = "";
                try
                {
                    pt.myDictionary["临床诊断"] = ds.Tables[0].Rows[0]["ClincName"].ToString().Trim();
                }
                catch
                {
                }

                string ex = "";
                return(pt.rtn_XML(ref ex));
            }
            catch (Exception e)
            {
                MessageBox.Show("解析xml异常:" + e.Message);
                return("0");
            }
        }
Example #3
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 #4
0
        public static string ptxml(string Sslbx, string Ssbz, string Debug)
        {
            string pathWEB = f.ReadString(Sslbx, "url", "http://10.1.1.71/webapp/PathologyService.asmx").Trim(); //获取sz.ini中设置的webservicesurl
            string debug   = f.ReadString(Sslbx, "debug", "");
            string yq      = f.ReadString(Sslbx, "yq", "2");

            if (yq.Trim() == "十梓街")
            {
                yq = "1";
            }
            if (yq.Trim() == "平江")
            {
                yq = "2";
            }

            if (Sslbx != "")
            {
                if (Sslbx == "住院号" || Sslbx == "门诊号" || Sslbx == "发票号" || Sslbx == "十梓街住院号" || Sslbx == "十梓街门诊号" || Sslbx == "十梓街发票号" || Sslbx == "平江住院号" || Sslbx == "平江门诊号" || Sslbx == "平江发票号")
                {
                    string Request_xml = "";
                    if (Sslbx == "住院号")
                    {
                        Request_xml = "<Request>"
                                      + "<yq>" + yq + "</yq>"
                                      + "<paitent_id></paitent_id>"
                                      + "<real_no></real_no>"
                                      + "<inpatient_no>" + Ssbz.Trim() + "</inpatient_no>"              //住院号
                                      + "</Request>";
                    }

                    if (Sslbx == "门诊号")
                    {
                        Request_xml = "<Request>"
                                      + "<yq>" + yq + "</yq>"                           //院区(1:十梓街;2:平江)
                                      + "<paitent_id>" + Ssbz.Trim() + "</paitent_id>"  //门诊号(必填)
                                      + "<real_no></real_no>"                           //发票号(可选)
                                      + "<inpatient_no></inpatient_no>"
                                      + "</Request>";
                    }

                    if (Sslbx == "发票号")
                    {
                        Request_xml = "<Request>"
                                      + "<yq>" + yq + "</yq>"                    //院区(1:十梓街;2:平江)
                                      + "<paitent_id></paitent_id>"              //门诊号(必填)
                                      + "<real_no>" + Ssbz.Trim() + "</real_no>" //发票号(可选)
                                      + "<inpatient_no></inpatient_no>"
                                      + "</Request>";
                    }

                    if (Sslbx == "十梓街住院号")
                    {
                        Request_xml = "<Request>"
                                      + "<yq>1</yq>"
                                      + "<paitent_id></paitent_id>"
                                      + "<real_no></real_no>"
                                      + "<inpatient_no>" + Ssbz.Trim() + "</inpatient_no>"                      //住院号
                                      + "</Request>";
                    }

                    if (Sslbx == "十梓街门诊号")
                    {
                        Request_xml = "<Request>"
                                      + "<yq>1</yq>"                                    //院区(1:十梓街;2:平江)
                                      + "<paitent_id>" + Ssbz.Trim() + "</paitent_id>"  //门诊号(必填)
                                      + "<real_no></real_no>"                           //发票号(可选)
                                      + "<inpatient_no></inpatient_no>"
                                      + "</Request>";
                    }

                    if (Sslbx == "十梓街发票号")
                    {
                        Request_xml = "<Request>"
                                      + "<yq>1</yq>"                             //院区(1:十梓街;2:平江)
                                      + "<paitent_id></paitent_id>"              //门诊号(必填)
                                      + "<real_no>" + Ssbz.Trim() + "</real_no>" //发票号(可选)
                                      + "<inpatient_no></inpatient_no>"
                                      + "</Request>";
                    }

                    if (Sslbx == "平江住院号")
                    {
                        Request_xml = "<Request>"
                                      + "<yq>2</yq>"
                                      + "<paitent_id></paitent_id>"
                                      + "<real_no></real_no>"
                                      + "<inpatient_no>" + Ssbz.Trim() + "</inpatient_no>"                      //住院号
                                      + "</Request>";
                    }

                    if (Sslbx == "平江门诊号")
                    {
                        Request_xml = "<Request>"
                                      + "<yq>2</yq>"                                    //院区(1:十梓街;2:平江)
                                      + "<paitent_id>" + Ssbz.Trim() + "</paitent_id>"  //门诊号(必填)
                                      + "<real_no></real_no>"                           //发票号(可选)
                                      + "<inpatient_no></inpatient_no>"
                                      + "</Request>";
                    }

                    if (Sslbx == "平江发票号")
                    {
                        Request_xml = "<Request>"
                                      + "<yq>2</yq>"                             //院区(1:十梓街;2:平江)
                                      + "<paitent_id></paitent_id>"              //门诊号(必填)
                                      + "<real_no>" + Ssbz.Trim() + "</real_no>" //发票号(可选)
                                      + "<inpatient_no></inpatient_no>"
                                      + "</Request>";
                    }

                    if (Request_xml.Trim() == "")
                    {
                        MessageBox.Show("传出参数为空"); return("0");
                    }


                    jssfyweb.PathologyService sfysev = new jssfyweb.PathologyService();
                    sfysev.Url = pathWEB;

                    if (debug == "1")
                    {
                        log.WriteMyLog("传入参数XMl:" + Request_xml);
                    }

                    string Response_xml = "";
                    try
                    {
                        Response_xml = sfysev.GetPatientInfo(Request_xml);
                    }
                    catch (Exception e1)
                    {
                        MessageBox.Show("提取信息异常:" + e1.Message);
                        log.WriteMyLog("提取信息异常:" + sfysev.Url + "\r\n" + e1.Message);
                        return("0");
                    }
                    if (debug == "1")
                    {
                        log.WriteMyLog("返回XMl:" + Response_xml);
                    }

                    if (Response_xml == "")
                    {
                        MessageBox.Show("返回XML数据为空,提取信息失败"); return("0");
                    }
                    //-------------------------------

                    XmlNode     xmlok = null;
                    XmlDocument xd    = new XmlDocument();
                    try
                    {
                        xd.LoadXml(Response_xml);
                        xmlok = xd.SelectSingleNode("/Response");
                    }
                    catch (Exception e2)
                    {
                        if (debug == "1")
                        {
                            log.WriteMyLog("XML解析错误:" + e2.Message);
                        }
                        MessageBox.Show("XML解析错误:" + e2.Message);
                        return("0");
                    }

                    //-返回xml----------------------------------------------------
                    PT_XML px = new PT_XML();
                    try
                    {
                        px.myDictionary["病人编号"] = xmlok["bl_no"].InnerText;

                        if (Sslbx.Contains("发票号"))
                        {
                            px.myDictionary["就诊ID"] = Ssbz.Trim();
                        }
                        else
                        {
                            px.myDictionary["就诊ID"] = "";
                        }
                        px.myDictionary["申请序号"] = "";

                        if (Sslbx.Contains("门诊号"))
                        {
                            px.myDictionary["门诊号"] = xmlok["patient_id"].InnerText;
                            px.myDictionary["住院号"] = "";
                        }
                        else
                        {
                            px.myDictionary["门诊号"] = "";
                            px.myDictionary["住院号"] = xmlok["inpatient_no"].InnerText;
                        }

                        px.myDictionary["姓名"] = xmlok["name"].InnerText;
                        px.myDictionary["年龄"] = xmlok["age"].InnerText + "岁";
                        px.myDictionary["性别"] = xmlok["sex"].InnerText;

                        if (px.myDictionary["性别"].Trim() == "1")
                        {
                            px.myDictionary["性别"] = "男";
                        }
                        if (px.myDictionary["性别"].Trim() == "2")
                        {
                            px.myDictionary["性别"] = "女";
                        }

                        px.myDictionary["婚姻"] = xmlok["marry"].InnerText;
                        if (px.myDictionary["婚姻"] == "1")
                        {
                            px.myDictionary["婚姻"] = "已婚";
                        }
                        if (px.myDictionary["婚姻"] == "2")
                        {
                            px.myDictionary["婚姻"] = "未婚";
                        }
                        if (px.myDictionary["婚姻"] == "3")
                        {
                            px.myDictionary["婚姻"] = "丧偶";
                        }
                        if (px.myDictionary["婚姻"] == "4")
                        {
                            px.myDictionary["婚姻"] = "离异";
                        }
                        if (px.myDictionary["婚姻"] == "5")
                        {
                            px.myDictionary["婚姻"] = "其他";
                        }


                        px.myDictionary["地址"] = xmlok["address"].InnerText;
                        px.myDictionary["电话"] = xmlok["mobile"].InnerText;
                        try
                        {
                            px.myDictionary["病区"] = xmlok["ward_name"].InnerText;
                            px.myDictionary["床号"] = xmlok["bed_no"].InnerText;
                        }
                        catch
                        {
                        }

                        px.myDictionary["身份证号"] = xmlok["social_no"].InnerText;
                        px.myDictionary["民族"]   = "";// xmlok["nation"].InnerText;
                        px.myDictionary["职业"]   = xmlok["occupation"].InnerText;

                        if (Sslbx.Contains("门诊号"))
                        {
                            px.myDictionary["送检科室"] = xmlok["unit_name"].InnerText;
                        }
                        else
                        {
                            px.myDictionary["送检科室"] = "";
                        }


                        px.myDictionary["送检医生"] = "";
                        px.myDictionary["收费"]   = "";
                        px.myDictionary["标本名称"] = "";
                        px.myDictionary["送检医院"] = "本院";
                        px.myDictionary["医嘱项目"] = "";
                        px.myDictionary["备用1"]  = "";
                        px.myDictionary["备用2"]  = "";

                        try
                        {
                            px.myDictionary["费别"] = xmlok["response_type"].InnerText;
                        }
                        catch
                        {
                            try
                            {
                                px.myDictionary["费别"] = xmlok["responce_type"].InnerText;
                            }
                            catch
                            {
                            }
                        }
                        if (px.myDictionary["费别"].Trim() == "9")
                        {
                            px.myDictionary["费别"] = "医保";
                        }
                        if (px.myDictionary["费别"].Trim() == "1")
                        {
                            px.myDictionary["费别"] = "自费";
                        }

                        px.myDictionary["病人类别"] = xmlok["type"].InnerText;
                        if (px.myDictionary["病人类别"].Trim() == "1")
                        {
                            px.myDictionary["病人类别"] = "门诊";
                        }
                        if (px.myDictionary["病人类别"].Trim() == "2")
                        {
                            px.myDictionary["病人类别"] = "住院";
                        }

                        px.myDictionary["临床病史"] = xmlok["medical_record"].InnerText;
                        px.myDictionary["临床诊断"] = xmlok["diag_name"].InnerText;


                        if (px.myDictionary["姓名"].Trim() == "")
                        {
                            MessageBox.Show("未查询到相关记录数据"); return("0");
                        }

                        string exep = "";
                        return(px.rtn_XML(ref exep));
                    }
                    catch (Exception ee4)
                    {
                        MessageBox.Show(ee4.Message);
                        if (Debug == "1")
                        {
                            log.WriteMyLog("生成xml异常:" + ee4.Message);
                        }
                        return("0");
                    }
                }
                else
                {
                    MessageBox.Show("无此" + Sslbx);
                    return("0");
                }
            }
            else
            {
                MessageBox.Show("Sslbx不能为空");
                return("0");
            }
        }
Example #5
0
        //private static string jxhl7(string rtn_msg, string Ssbz)
        //{

        //    PT_XML px = new PT_XML();
        //    readhl7 r7 = new readhl7();
        //    r7.Adt01(rtn_msg);
        //    try
        //    {
        //        if (r7.MSA[1].Trim() == "AA")
        //        {
        //            try
        //            {
        //                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();

        //                //地址电话位置互换
        //                px.myDictionary["地址"] ="电话:"+ r7.PID[13].Trim() + "^";// r7.PID[11].Trim();

        //                px.myDictionary["电话"] ="地址:"+ r7.PID[11].Trim();

        //                px.myDictionary["婚姻"] = r7.PID[15].Trim();

        //                px.myDictionary["就诊ID"] = r7.PID[17].Trim();//医保卡号

        //                px.myDictionary["病人编号"] = r7.PID[3].Trim().Split('^')[0].Trim();

        //                if (brlb == "门诊")
        //                    px.myDictionary["门诊号"] = Ssbz;
        //                else
        //                    px.myDictionary["住院号"] = Ssbz;
        //                try
        //                {
        //                    px.myDictionary["身份证号"] = r7.PID[3].Trim().Split('^')[8].Trim().Split('~')[1].Trim();
        //                }
        //                catch
        //                {
        //                    px.myDictionary["身份证号"] = "";
        //                }

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

        //                if (brlb == "门诊")
        //                px.myDictionary["送检科室"] = r7.ORC[13].Trim();

        //                px.myDictionary["病区"] = r7.ORC[13].Trim();

        //                px.myDictionary["申请序号"] = r7.ORC[2].Trim();

        //                px.myDictionary["申请医生"] = r7.ORC[12].Trim().Split('^')[1].Trim();

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

        //                px.myDictionary["标本名称"] = r7.OBR[15].Trim();

        //                px.myDictionary["收费"] = r7.OBR[23].Trim();

        //                px.myDictionary["临床病史"] = r7.OBR[46].Trim();

        //                px.myDictionary["临床诊断"] = r7.DG1[3].Split('^')[1].Trim();

        //                string exep = "";
        //                return px.rtn_XML(ref exep);
        //            }
        //            catch(Exception e2)
        //            {
        //                MessageBox.Show(e2.ToString());
        //                return "0";
        //            }
        //        }
        //        else
        //        {
        //                MessageBox.Show(r7.MSA[1].Trim() + "|" + r7.MSA[3].Trim());
        //                return "0";
        //        }
        //    }
        //    catch(Exception  ee)
        //    {
        //        MessageBox.Show(ee.ToString());
        //        return "0";

        //    }
        //}

        private static string jxhl7(string rtn_msg, string Ssbz, string Sslbx)
        {
            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 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);
                            DataColumn dc9 = new DataColumn("收费");
                            dt.Columns.Add(dc9);
                            DataColumn dc10 = new DataColumn("标本名称");
                            dt.Columns.Add(dc10);
                            DataColumn dc11 = new DataColumn("临床诊断");
                            dt.Columns.Add(dc11);

                            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.PID[5].Split('^')[0].Trim();
                                // dt.Rows[x][2] = r7.PID[8].Trim();


                                dt.Rows[x][2] = r7.QRF[4].Trim();
                                if (dt.Rows[x][2].ToString() == "I")
                                {
                                    dt.Rows[x][2] = "住院";
                                }
                                else
                                {
                                    dt.Rows[x][2] = "门诊";
                                }
                                dt.Rows[x][3]  = r7.PID[3].Trim().Split('^')[0].Trim();
                                dt.Rows[x][4]  = r7.ORC[x, 13].Trim();
                                dt.Rows[x][5]  = r7.ORC[x, 12].Trim();
                                dt.Rows[x][6]  = r7.ORC[x, 2].Trim();
                                dt.Rows[x][7]  = r7.OBR[x, 4].Trim();
                                dt.Rows[x][8]  = r7.OBR[x, 23].Trim();
                                dt.Rows[x][9]  = r7.OBR[x, 15].Trim();
                                dt.Rows[x][10] = r7.DG1[x, 3].Trim();
                                // MessageBox.Show(x.ToString()+"&"+r7.DG1[x,1].Trim()+"/"+r7.DG1[x,2].Trim()+"/"+r7.DG1[x,3].Trim()+"/"+r7.DG1[x,4].Trim());
                            }
                            Frm_FJSFYBJY ffj = new Frm_FJSFYBJY(dt, "30^80^50^100^100^100^100^150^40^100^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();
                        px.myDictionary["地址"]   = "电话:" + r7.PID[13].Trim() + "^";// r7.PID[11].Trim();
                        px.myDictionary["电话"]   = "地址:" + r7.PID[11].Trim();
                        px.myDictionary["婚姻"]   = r7.PID[15].Trim();
                        //px.myDictionary["就诊ID"] = r7.PID[17].Trim();//医保卡号

                        px.myDictionary["病人编号"] = r7.PID[3].Trim().Split('^')[0].Trim();
                        if (brlb == "门诊")
                        {
                            px.myDictionary["门诊号"]  = Ssbz;                            //卡号       // r7.PID[3].Split('^')[1].Trim();
                            px.myDictionary["就诊ID"] = r7.PID[3].Split('^')[1].Trim();; //门诊流水号
                        }
                        if (brlb == "住院")
                        {
                            px.myDictionary["住院号"]  = r7.PID[3].Split('^')[1].Trim();
                            px.myDictionary["就诊ID"] = r7.PID[17].Trim();//医保卡号
                        }
                        try
                        {
                            px.myDictionary["身份证号"] = r7.PID[3].Trim().Split('^')[8].Trim().Split('~')[1].Trim();
                        }
                        catch
                        {
                            px.myDictionary["身份证号"] = "";
                        }
                        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[0, 12].Trim().Split('^')[1].Trim();

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

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

                        px.myDictionary["标本名称"] = r7.OBR[xh, 15].Trim();

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

                        try
                        {
                            px.myDictionary["临床诊断"] = r7.DG1[xh, 3].Split('^')[1].Trim();
                        }
                        catch
                        {
                            px.myDictionary["临床诊断"] = r7.DG1[xh, 3].Trim();
                        }
                        string exep = "";
                        //   MessageBox.Show(px.rtn_XML(ref exep));

                        return(px.rtn_XML(ref exep));
                    }
                    catch (Exception e2)
                    {
                        MessageBox.Show(e2.ToString());
                        return("0");
                    }
                }
                else
                {
                    if (Sslbx.Trim() == "住院号" || Sslbx.Trim() == "卡号")
                    {
                        string rtn_msg2 = "";
                        if (Sslbx.Trim() == "住院号")
                        {
                            string isbrxx = f.ReadString(Sslbx, "isbrxx", "1").Replace("\0", "").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, "", "FHcsj1KMiIZrotKcdKfy4vzmPhE8GRpr");
                        }
                        else
                        {
                            string isbrxx = f.ReadString(Sslbx, "isbrxx", "1").Replace("\0", "").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><icCardNo>" + Ssbz + "</icCardNo><executeDept></executeDept></root>";
                            rtn_msg2 = rtn_CallInterface("XML", "GetDispPatientInfo", XML2, "", "FHcsj1KMiIZrotKcdKfy4vzmPhE8GRpr");
                        }



                        if (rtn_msg2 == "")
                        {
                            return("0");
                        }
                        if (rtn_msg2.Contains("error") && !rtn_msg2.Contains("|"))
                        {
                            MessageBox.Show(rtn_msg2);
                            log.WriteMyLog(rtn_msg2);
                            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.ToString());
                                log.WriteMyLog(rtn_msg2 + "--" + ee.ToString());
                                return("0");
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show(r7.MSA[1].Trim() + "|" + r7.MSA[3].Trim());
                    }


                    return("0");
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.ToString());
                return("0");
            }
        }
Example #6
0
        public static string ptxml(string Sslbx, string Ssbz, string debug)
        {
            debug = f.ReadString(Sslbx, "debug", "");
            int ljfs = f.ReadInteger(Sslbx, "ljfs", 1);

            weburl = f.ReadString(Sslbx, "wsurl", "");

            if (Sslbx != "")
            {
                if (Sslbx == "门诊号(新)")
                {
                    string putcmsg = "<ESBEntry><AccessControl><UserName></UserName><Password></Password><Fid>BS10020</Fid></AccessControl><MessageHeader><Fid>BS10020</Fid><SourceSysCode>S45</SourceSysCode><TargetSysCode>S01</TargetSysCode><MsgDate>" + DateTime.Now.AddDays(-15).ToString("yyyy-MM-dd HH:mm:ss") + "</MsgDate></MessageHeader><MsgInfo><onceFlag>0</onceFlag><startNum></startNum><endNum></endNum><Msg></Msg><query item=\"IC_CARD_ID\" compy=\"=\" value=\"'" + Ssbz + "'\" splice=\"and\"/><order item=\"\" sort=\"\"/></MsgInfo></ESBEntry>";

                    return(getmzbrxx("BS10020", putcmsg, debug, ljfs));
                }
                if (Sslbx == "住院号(新)")
                {
                    PT_XML pt      = new PT_XML();
                    string putcmsg = "<ESBEntry><AccessControl><UserName></UserName><Password></Password><Fid>BS10001</Fid></AccessControl><MessageHeader><Fid>BS10001</Fid><SourceSysCode>S45</SourceSysCode><TargetSysCode>S01</TargetSysCode><MsgDate>" + DateTime.Now.AddDays(-15).ToString("yyyy-MM-dd HH:mm:ss") + "</MsgDate></MessageHeader><MsgInfo><onceFlag>0</onceFlag><startNum></startNum><endNum></endNum><Msg></Msg><query item=\"Pat_Admit_ID\" compy=\" like \" value=\"'" + Ssbz + "%'\" splice=\"and\"/><order item=\"\" sort=\"\"/></MsgInfo></ESBEntry>";

                    return(getzybrxx("BS10001", putcmsg, debug, ref pt, ljfs));
                }


                if (Sslbx == "住院号(申请)" || Sslbx == "住院号")
                {
                    string putcmsg = "<ESBEntry><MessageHeader><Fid>BS25016</Fid><SourceSysCode>S45</SourceSysCode><TargetSysCode>S01</TargetSysCode><MsgDate>" + DateTime.Now.AddDays(-15).ToString("yyyy-MM-dd HH:mm:ss") + "</MsgDate></MessageHeader><MsgInfo><Msg> and  residence_no like '" + Ssbz + "%'</Msg></MsgInfo></ESBEntry>";

                    string rtnxml = getsqdxx("BS25016", putcmsg, debug, ljfs, Ssbz);
                    if (debug == "1")
                    {
                        log.WriteMyLog("返回的xml字符串:" + rtnxml);
                    }
                    return(rtnxml);
                }
                if (Sslbx == "卡号" || Sslbx == "门诊号(申请)" || Sslbx == "门诊号")
                {
                    string putcmsg = "<ESBEntry><MessageHeader><Fid>BS25017</Fid><SourceSysCode>S45</SourceSysCode><TargetSysCode>S01</TargetSysCode><MsgDate>" + DateTime.Now.AddDays(-15).ToString("yyyy-MM-dd HH:mm:ss") + "</MsgDate></MessageHeader><MsgInfo><Msg> and  ic_card_id= '" + Ssbz + "' </Msg></MsgInfo></ESBEntry>";
                    string rtnxml  = getsqdxx("BS25017", putcmsg, debug, ljfs, Ssbz);
                    if (debug == "1")
                    {
                        log.WriteMyLog("返回的xml字符串:" + rtnxml);
                    }
                    return(rtnxml);
                }
                if (Sslbx == "住院申请号")
                {
                    string putcmsg = "<ESBEntry><MessageHeader><Fid>BS25016</Fid><SourceSysCode>S45</SourceSysCode><TargetSysCode>S01</TargetSysCode><MsgDate>" + DateTime.Now.AddDays(-15).ToString("yyyy-MM-dd HH:mm:ss") + "</MsgDate></MessageHeader><MsgInfo><Msg> and  apply_no= '" + Ssbz + "'</Msg></MsgInfo></ESBEntry>";
                    string rtnxml  = getsqdxx("BS25016", putcmsg, debug, ljfs, Ssbz);
                    if (debug == "1")
                    {
                        log.WriteMyLog("返回的xml字符串:" + rtnxml);
                    }
                    return(rtnxml);
                }
                if (Sslbx == "门诊申请号")
                {
                    string putcmsg = "<ESBEntry><MessageHeader><Fid>BS25017</Fid><SourceSysCode>S45</SourceSysCode><TargetSysCode>S01</TargetSysCode><MsgDate>" + DateTime.Now.AddDays(-15).ToString("yyyy-MM-dd HH:mm:ss") + "</MsgDate></MessageHeader><MsgInfo><Msg> and  apply_no= '" + Ssbz + "'</Msg></MsgInfo></ESBEntry>";
                    string rtnxml  = getsqdxx("BS25017", putcmsg, debug, ljfs, Ssbz);
                    if (debug == "1")
                    {
                        log.WriteMyLog("返回的xml字符串:" + rtnxml);
                    }
                    return(rtnxml);
                }
                if (Sslbx == "门诊列表")
                {
                    fzs2y_mzlb mzlb = new fzs2y_mzlb();
                    if (mzlb.ShowDialog() == DialogResult.Yes)
                    {
                        string IC_CARD_ID = mzlb.IC_CARD_ID;
                        if (IC_CARD_ID.Trim() == "")
                        {
                            MessageBox.Show("所选择的病人卡号为空,无法获取信息!");
                            return("0");
                        }
                        else
                        {
                            string putcmsg = "<ESBEntry><MessageHeader><Fid>BS25017</Fid><SourceSysCode>S45</SourceSysCode><TargetSysCode>S01</TargetSysCode><MsgDate>" + DateTime.Now.AddDays(-15).ToString("yyyy-MM-dd HH:mm:ss") + "</MsgDate></MessageHeader><MsgInfo><Msg> and  ic_card_id= '" + IC_CARD_ID + "'</Msg></MsgInfo></ESBEntry>";
                            string rtnxml  = getsqdxx("BS25017", putcmsg, debug, ljfs, Ssbz);
                            if (debug == "1")
                            {
                                log.WriteMyLog("返回的xml字符串:" + rtnxml);
                            }
                            return(rtnxml);
                        }
                    }
                    else
                    {
                        MessageBox.Show("未选择病人,无法获取信息!");
                        return("0");
                    }
                }
                else
                {
                    MessageBox.Show("无此" + Sslbx);
                }
                return("0");
            }
            else
            {
                MessageBox.Show("识别号不能为空");
                return("0");
            }
        }
Example #7
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);
        }