Пример #1
0
        public void pathtohis(string blh, string bgzt)
        {
            dbbase.odbcdb aa = new odbcdb("DSN=pathnet;UID=pathnet;PWD=4s3c2a1p", "", "");

            string jsyz = f.ReadString("BLKJXKH", "jsyzlx", "深切,白片,连切").Replace("\0", "").Trim();
            string tjyz = f.ReadString("BLKJXKH", "tjyzlx", "免疫组化,特殊检查").Replace("\0", "").Trim();

            jsyz = jsyz.Replace(",", "','");
            tjyz = tjyz.Replace(",", "','");


            string err       = "";
            string BL_constr = f.ReadString("BLKJXKH", "odbc", "Data Source=.;Initial Catalog=pathnet;User Id=pathnet;Password=4s3c2a1p;").Replace("\0", "").Trim();;
            SqlDB  sqldb     = new SqlDB();

            DataTable dt_bg = new DataTable();

            dt_bg = sqldb.DataAdapter(BL_constr, "select F_BLH,F_BGYS,F_FZYS,F_SHYS,F_BGZT,F_SQXH,F_BGLRY,F_JSY from T_jcxx where F_blh='" + blh + "'", ref err);
            if (dt_bg == null)
            {
                //("bingli查询数据错误:"+err);
                return;
            }
            if (dt_bg.Rows.Count <= 0)
            {
                log.WriteMyLog(blh + "未查询到记录");
                return;
            }



            string sqxh = dt_bg.Rows[0]["F_sqxh"].ToString().Trim();

            string bgys  = dt_bg.Rows[0]["F_bgys"].ToString().Trim();
            string fzys  = dt_bg.Rows[0]["F_fzys"].ToString().Trim();
            string shys  = dt_bg.Rows[0]["F_shys"].ToString().Trim();
            string bgzt2 = dt_bg.Rows[0]["F_bgzt"].ToString().Trim();


            if (sqxh == "")
            {
                aa.ExecuteSQL("update T_JCXX_JXKH set F_bz='申请序号为空不处理',F_FSZT='不处理'  where F_blh='" + blh + "'  ");
                return;
            }

            if (bgzt == "SH" && bgzt2 != "已审核")
            {
                aa.ExecuteSQL("update T_JCXX_JXKH set F_bz='报告未审核不处理',F_FSZT='不处理'  where F_blh='" + blh + "' and  F_BGZT='已审核'");
                return;
            }
            string rpt_xml = "";

            if (bgzt == "QXSH")
            {
                rpt_xml = rpt_xml + "<ExamBLItemList>"
                          + "<CheckFlow>" + sqxh + "</CheckFlow>"
                          + "<ExamGroup>" + blh + "</ExamGroup>"
                          + "<ScheduledDate></ScheduledDate>"
                          + "<Note></Note>"
                          + "<Operator></Operator>"
                          + "<OperatorDate>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</OperatorDate>"
                          + "<Status>0</Status>"
                          + "<Notice></Notice>"
                          + "<ExamAddress></ExamAddress>"
                          + "</ExamBLItemList>";

                log.WriteMyLog(blh + ":" + rpt_xml);

                rpt_xml = "<Request><ExamStatusBL><ExamBLList>" + rpt_xml + "</ExamBLList></ExamStatusBL></Request>";
                string rtn_xml = "";
                try
                {
                    xyfyWeb.DHCPisXiangYaOne xyfy = new xyfyWeb.DHCPisXiangYaOne();
                    xyfy.Url = "http://192.168.2.51:57772/csp/dhcens/DHC.Pis.XiangYaOne.BS.Web.cls";
                    string pathweburl = f.ReadString("savetohis", "wsurl", "");
                    if (pathweburl.Trim() != "")
                    {
                        xyfy.Url = pathweburl;
                    }

                    rtn_xml = xyfy.DhcService("ExamStatusBL", rpt_xml);
                }
                catch (Exception ee4)
                {
                    log.WriteMyLog(ee4.Message.ToString());
                    aa.ExecuteSQL("update T_JCXX_JXKH set F_bz='连接webservice异常:" + ee4.Message + "',F_FSZT='未处理'  where F_blh='" + blh + "' and F_BGZT='取消审核' ");
                    return;
                }
                try
                {
                    XmlDataDocument xd = new XmlDataDocument();
                    xd.LoadXml(rtn_xml);
                    XmlNode xn = xd.SelectSingleNode("/Response/ExamStatusBLReturn");

                    if (xn["Returncode"].InnerText.ToString() == "0")
                    {
                        log.WriteMyLog(xn["ResultContent"].InnerText.ToString() + ":" + rtn_xml);
                        aa.ExecuteSQL("update T_JCXX_JXKH set F_bz='',F_FSZT='已处理'  where F_blh='" + blh + "' and F_BGZT='取消审核' ");
                    }
                    else
                    {
                        log.WriteMyLog(xn["ResultContent"].InnerText.ToString() + ":" + rtn_xml);
                        aa.ExecuteSQL("update T_JCXX_JXKH set F_bz='" + xn["ResultContent"].InnerText.ToString() + "',F_FSZT='未处理'  where F_blh='" + blh + "' and F_BGZT='取消审核' ");
                    }
                }
                catch (Exception ee3)
                {
                    log.WriteMyLog(ee3.Message.ToString() + ":" + rtn_xml);
                    aa.ExecuteSQL("update T_JCXX_JXKH set F_bz='" + ee3.Message + "',F_FSZT='未处理'  where F_blh='" + blh + "' and F_BGZT='取消审核' ");
                    return;
                }


                return;
            }

            if (bgzt == "SH")
            {
                //用户工号
                DataTable Dt_YH = new DataTable();
                Dt_YH = sqldb.DataAdapter(BL_constr, "select F_YHBH,F_YHMC,F_YH_BY1,F_YH_BY2 from T_YH ", ref err);



                try
                {
                    //报告
                    #region
                    //报告医生

                    if (dt_bg.Rows[0]["F_bgys"].ToString().Trim() != "")
                    {
                        string[] bgyss   = dt_bg.Rows[0]["F_bgys"].ToString().Trim().Split('/');
                        string   BGYSXML = "";
                        foreach (string f_bgys in bgyss)
                        {
                            if (f_bgys != "")
                            {
                                string bgysBH = Get_YHBH(f_bgys, Dt_YH);
                                if (bgysBH != "")
                                {
                                    if (BGYSXML == "")
                                    {
                                        BGYSXML = bgysBH + "#1";
                                    }
                                    else
                                    {
                                        BGYSXML = BGYSXML + "," + bgysBH + "#1";
                                    }
                                }
                            }
                        }
                        rpt_xml = rpt_xml + "<ExamBLItemList>"
                                  + "<CheckFlow>" + sqxh + "</CheckFlow>"
                                  + "<ExamGroup>" + blh + "</ExamGroup>"
                                  + "<ScheduledDate></ScheduledDate>"
                                  + "<Note></Note>"
                                  + "<Operator>" + BGYSXML + "</Operator>"
                                  + "<OperatorDate>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</OperatorDate>"
                                  + "<Status>4</Status>"
                                  + "<Notice>1</Notice>"
                                  + "<ExamAddress></ExamAddress>"
                                  + "</ExamBLItemList>";
                    }

                    //复诊医生
                    if (dt_bg.Rows[0]["F_fzys"].ToString().Trim() != "")
                    {
                        string[] fzyss   = dt_bg.Rows[0]["F_fzys"].ToString().Trim().Split('/');
                        string   FZYSXML = "";
                        foreach (string f_fzys in fzyss)
                        {
                            if (f_fzys != "")
                            {
                                string fzysBH = Get_YHBH(f_fzys, Dt_YH);
                                if (FZYSXML == "")
                                {
                                    FZYSXML = fzysBH + "#1";
                                }
                                else
                                {
                                    FZYSXML = FZYSXML + "," + fzysBH + "#1";
                                }
                            }
                        }
                        rpt_xml = rpt_xml + "<ExamBLItemList>"
                                  + "<CheckFlow>" + sqxh + "</CheckFlow>"
                                  + "<ExamGroup>" + blh + "</ExamGroup>"
                                  + "<ScheduledDate></ScheduledDate>"
                                  + "<Note></Note>"
                                  + "<Operator>" + FZYSXML + "</Operator>"
                                  + "<OperatorDate>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</OperatorDate>"
                                  + "<Status>4</Status>"
                                  + "<Notice>2</Notice>"
                                  + "<ExamAddress></ExamAddress>"
                                  + "</ExamBLItemList>";
                    }

                    //审核医生
                    string shysBH = Get_YHBH(shys, Dt_YH);
                    rpt_xml = rpt_xml + "<ExamBLItemList>"
                              + "<CheckFlow>" + sqxh + "</CheckFlow>"
                              + "<ExamGroup>" + blh + "</ExamGroup>"
                              + "<ScheduledDate></ScheduledDate>"
                              + "<Note></Note>"
                              + "<Operator>" + shys + "</Operator>"
                              + "<OperatorDate>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</OperatorDate>"
                              + "<Status>4</Status>"
                              + "<Notice>3</Notice>"
                              + "<ExamAddress></ExamAddress>"
                              + "</ExamBLItemList>";

                    //录入员
                    if (dt_bg.Rows[0]["F_BGLRY"].ToString().Trim() != "")
                    {
                        string[] LRY     = dt_bg.Rows[0]["F_BGLRY"].ToString().Trim().Split('/');
                        string   LRY_XML = "";
                        foreach (string F_LRY in LRY)
                        {
                            if (F_LRY != "")
                            {
                                string LRYBH = Get_YHBH(F_LRY, Dt_YH);
                                if (LRY_XML == "")
                                {
                                    LRY_XML = LRYBH + "#1";
                                }
                                else
                                {
                                    LRY_XML = LRY_XML + "," + LRYBH + "#1";
                                }
                            }
                        }
                        rpt_xml = rpt_xml + "<ExamBLItemList>"
                                  + "<CheckFlow>" + sqxh + "</CheckFlow>"
                                  + "<ExamGroup>" + blh + "</ExamGroup>"
                                  + "<ScheduledDate></ScheduledDate>"
                                  + "<Note></Note>"
                                  + "<Operator>" + LRY_XML + "</Operator>"
                                  + "<OperatorDate>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</OperatorDate>"
                                  + "<Status>4</Status>"
                                  + "<Notice>11</Notice>"
                                  + "<ExamAddress></ExamAddress>"
                                  + "</ExamBLItemList>";
                    }

                    #endregion

                    //登记
                    #region

                    string jsy = dt_bg.Rows[0]["F_JSY"].ToString().Trim();
                    if (jsy != "")
                    {
                        string jsyBH = Get_YHBH(jsy, Dt_YH);
                        rpt_xml = rpt_xml + "<ExamBLItemList>"
                                  + "<CheckFlow>" + sqxh + "</CheckFlow>"
                                  + "<ExamGroup>" + blh + "</ExamGroup>"
                                  + "<ScheduledDate></ScheduledDate>"
                                  + "<Note></Note>"
                                  + "<Operator>" + jsyBH + "#1</Operator>"
                                  + "<OperatorDate>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</OperatorDate>"
                                  + "<Status>4</Status>"
                                  + "<Notice>4</Notice>"
                                  + "<ExamAddress></ExamAddress>"
                                  + "</ExamBLItemList>";
                    }


                    #endregion

                    //取材
                    #region
                    DataTable dt_qc = new DataTable();
                    dt_qc = sqldb.DataAdapter(BL_constr, "select F_QCYS,F_JLY  from T_QCMX where F_blh='" + blh + "'", ref err);
                    if (dt_qc == null)
                    {
                    }
                    else if (dt_qc.Rows.Count <= 0)
                    {
                    }
                    else
                    {
                        DataView dv_qc = dt_qc.DefaultView;

                        DataTable dt_qcys = dv_qc.ToTable(true, "F_QCYS");
                        DataTable dt_jly  = dv_qc.ToTable(true, "F_JLY");


                        //取材医生
                        string qcys_xml = "";
                        for (int x = 0; x < dt_qcys.Rows.Count; x++)
                        {
                            string qcys = dt_qcys.Rows[x]["F_QCYS"].ToString();
                            if (qcys != "")
                            {
                                dv_qc.RowFilter = " F_QCYS='" + qcys + "'";

                                string    qcysBH   = Get_YHBH(qcys, Dt_YH);
                                DataTable dt_count = dv_qc.ToTable();
                                if (qcys_xml == "")
                                {
                                    qcys_xml = qcysBH + "#" + dt_count.Rows.Count.ToString();
                                }
                                else
                                {
                                    qcys_xml = qcys_xml + "," + qcysBH + "#" + dt_count.Rows.Count.ToString();
                                }
                            }
                        }
                        if (qcys_xml != "")
                        {
                            rpt_xml = rpt_xml + "<ExamBLItemList>"
                                      + "<CheckFlow>" + sqxh + "</CheckFlow>"
                                      + "<ExamGroup>" + blh + "</ExamGroup>"
                                      + "<ScheduledDate></ScheduledDate>"
                                      + "<Note></Note>"
                                      + "<Operator>" + qcys_xml + "</Operator>"
                                      + "<OperatorDate>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</OperatorDate>"
                                      + "<Status>1</Status>"
                                      + "<Notice>5</Notice>"
                                      + "<ExamAddress></ExamAddress>"
                                      + "</ExamBLItemList>";
                        }

                        //取材录入员
                        string jly_xml = "";
                        for (int x = 0; x < dt_jly.Rows.Count; x++)
                        {
                            string jly = dt_jly.Rows[x]["F_JLY"].ToString();
                            if (jly != "")
                            {
                                dv_qc.RowFilter = " F_JLY='" + jly + "'";
                                DataTable dt_count = dv_qc.ToTable();
                                string    jlyBH    = Get_YHBH(jly, Dt_YH);
                                if (jly_xml == "")
                                {
                                    jly_xml = jlyBH + "#" + dt_count.Rows.Count.ToString();
                                }
                                else
                                {
                                    jly_xml = jly_xml + "," + jlyBH + "#" + dt_count.Rows.Count.ToString();
                                }
                            }
                        }
                        if (jly_xml != "")
                        {
                            rpt_xml = rpt_xml + "<ExamBLItemList>"
                                      + "<CheckFlow>" + sqxh + "</CheckFlow>"
                                      + "<ExamGroup>" + blh + "</ExamGroup>"
                                      + "<ScheduledDate></ScheduledDate>"
                                      + "<Note></Note>"
                                      + "<Operator>" + jly_xml + "</Operator>"
                                      + "<OperatorDate>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</OperatorDate>"
                                      + "<Status>1</Status>"
                                      + "<Notice>6</Notice>"
                                      + "<ExamAddress></ExamAddress>"
                                      + "</ExamBLItemList>";
                        }
                    }
                    #endregion


                    //包埋
                    #region
                    DataTable dt_bm = new DataTable();
                    dt_bm = sqldb.DataAdapter(BL_constr, "select F_CZY,F_LKH  from T_LK where F_blh='" + blh + "'", ref err);
                    if (dt_bm == null)
                    {
                    }

                    else if (dt_bm.Rows.Count <= 0)
                    {
                    }
                    else
                    {
                        DataView dv_bm = dt_bm.DefaultView;

                        DataTable dt_bmczy = dv_bm.ToTable(true, "F_CZY");


                        //包埋操作员
                        string BM_xml = "";
                        for (int x = 0; x < dt_bmczy.Rows.Count; x++)
                        {
                            string bmczy = dt_bmczy.Rows[x]["F_CZY"].ToString();
                            if (bmczy != "")
                            {
                                dv_bm.RowFilter = " F_CZY='" + bmczy + "'";
                                DataTable dt_count = dv_bm.ToTable();
                                string    bmczyBH  = Get_YHBH(bmczy, Dt_YH);
                                if (BM_xml == "")
                                {
                                    BM_xml = bmczyBH + "#" + dt_count.Rows.Count.ToString();
                                }
                                else
                                {
                                    BM_xml = BM_xml + "," + bmczyBH + "#" + dt_count.Rows.Count.ToString();
                                }
                            }
                        }
                        if (BM_xml != "")
                        {
                            rpt_xml = rpt_xml + "<ExamBLItemList>"
                                      + "<CheckFlow>" + sqxh + "</CheckFlow>"
                                      + "<ExamGroup>" + blh + "</ExamGroup>"
                                      + "<ScheduledDate></ScheduledDate>"
                                      + "<Note></Note>"
                                      + "<Operator>" + BM_xml + "</Operator>"
                                      + "<OperatorDate>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</OperatorDate>"
                                      + "<Status>1</Status>"
                                      + "<Notice>5</Notice>"
                                      + "<ExamAddress></ExamAddress>"
                                      + "</ExamBLItemList>";
                        }
                    }
                    #endregion

                    //切片
                    #region
                    DataTable dt_qp = new DataTable();
                    dt_qp = sqldb.DataAdapter(BL_constr, "select F_CZY,F_RWLY  from T_QP where F_blh='" + blh + "' and   F_RWLY not  in ('" + tjyz + "')  and   F_RWLY not  in ('" + jsyz + "') ", ref err);
                    if (dt_qp == null)
                    {
                    }

                    else if (dt_qp.Rows.Count <= 0)
                    {
                    }
                    else
                    {
                        DataView  dv_qp    = dt_qp.DefaultView;
                        DataTable dt_qpczy = dv_qp.ToTable(true, "F_CZY");

                        //切片操作员
                        string QP_XML = "";
                        for (int x = 0; x < dt_qpczy.Rows.Count; x++)
                        {
                            string qpczy = dt_qpczy.Rows[x]["F_CZY"].ToString();
                            if (qpczy != "")
                            {
                                dv_qp.RowFilter = " F_CZY='" + qpczy + "'";
                                DataTable dt_count = dv_qp.ToTable();
                                string    qpczyBH  = Get_YHBH(qpczy, Dt_YH);
                                if (QP_XML == "")
                                {
                                    QP_XML = qpczyBH + "#" + dt_count.Rows.Count.ToString();
                                }
                                else
                                {
                                    QP_XML = QP_XML + "," + qpczyBH + "#" + dt_count.Rows.Count.ToString();
                                }
                            }
                        }
                        if (QP_XML != "")
                        {
                            rpt_xml = rpt_xml + "<ExamBLItemList>"
                                      + "<CheckFlow>" + sqxh + "</CheckFlow>"
                                      + "<ExamGroup>" + blh + "</ExamGroup>"
                                      + "<ScheduledDate></ScheduledDate>"
                                      + "<Note></Note>"
                                      + "<Operator>" + QP_XML + "</Operator>"
                                      + "<OperatorDate>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</OperatorDate>"
                                      + "<Status>1</Status>"
                                      + "<Notice>8</Notice>"
                                      + "<ExamAddress></ExamAddress>"
                                      + "</ExamBLItemList>";
                        }
                    }

                    #endregion

                    //技术医嘱操作员
                    #region
                    DataTable dt_jsyzqp = new DataTable();
                    dt_jsyzqp = sqldb.DataAdapter(BL_constr, "select F_CZY,F_RWLY  from T_QP where F_blh='" + blh + "' and F_RWLY in ('" + jsyz + "')", ref err);
                    if (dt_jsyzqp == null)
                    {
                    }

                    else if (dt_jsyzqp.Rows.Count <= 0)
                    {
                    }
                    else
                    {
                        DataView  dv_qp    = dt_jsyzqp.DefaultView;
                        DataTable dt_qpczy = dv_qp.ToTable(true, "F_CZY");

                        //切片操作员
                        string QP_XML = "";
                        for (int x = 0; x < dt_qpczy.Rows.Count; x++)
                        {
                            string qpczy = dt_qpczy.Rows[x]["F_CZY"].ToString();
                            if (qpczy != "")
                            {
                                dv_qp.RowFilter = " F_CZY='" + qpczy + "'";
                                DataTable dt_count = dv_qp.ToTable();
                                string    qpczyBH  = Get_YHBH(qpczy, Dt_YH);
                                if (QP_XML == "")
                                {
                                    QP_XML = qpczyBH + "#" + dt_count.Rows.Count.ToString();
                                }
                                else
                                {
                                    QP_XML = QP_XML + "," + qpczyBH + "#" + dt_count.Rows.Count.ToString();
                                }
                            }
                        }
                        if (QP_XML != "")
                        {
                            rpt_xml = rpt_xml + "<ExamBLItemList>"
                                      + "<CheckFlow>" + sqxh + "</CheckFlow>"
                                      + "<ExamGroup>" + blh + "</ExamGroup>"
                                      + "<ScheduledDate></ScheduledDate>"
                                      + "<Note></Note>"
                                      + "<Operator>" + QP_XML + "</Operator>"
                                      + "<OperatorDate>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</OperatorDate>"
                                      + "<Status>4</Status>"
                                      + "<Notice>9</Notice>"
                                      + "<ExamAddress></ExamAddress>"
                                      + "</ExamBLItemList>";
                        }
                    }

                    #endregion

                    //特检医嘱操作员
                    #region
                    DataTable dt_tjyzqp = new DataTable();
                    dt_tjyzqp = sqldb.DataAdapter(BL_constr, "select F_CZY,F_RWLY  from T_QP where F_blh='" + blh + "' and F_RWLY in ('" + tjyz + "')", ref err);
                    if (dt_tjyzqp == null)
                    {
                    }

                    else if (dt_tjyzqp.Rows.Count <= 0)
                    {
                    }
                    else
                    {
                        DataView  dv_qp    = dt_tjyzqp.DefaultView;
                        DataTable dt_qpczy = dv_qp.ToTable(true, "F_CZY");

                        //切片操作员
                        string QP_XML = "";
                        for (int x = 0; x < dt_qpczy.Rows.Count; x++)
                        {
                            string qpczy = dt_qpczy.Rows[x]["F_CZY"].ToString();
                            if (qpczy != "")
                            {
                                dv_qp.RowFilter = " F_CZY='" + qpczy + "'";
                                DataTable dt_count = dv_qp.ToTable();
                                string    qpczyBH  = Get_YHBH(qpczy, Dt_YH);
                                if (QP_XML == "")
                                {
                                    QP_XML = qpczyBH + "#" + dt_count.Rows.Count.ToString();
                                }
                                else
                                {
                                    QP_XML = QP_XML + "," + qpczyBH + "#" + dt_count.Rows.Count.ToString();
                                }
                            }
                        }
                        if (QP_XML != "")
                        {
                            rpt_xml = rpt_xml + "<ExamBLItemList>"
                                      + "<CheckFlow>" + sqxh + "</CheckFlow>"
                                      + "<ExamGroup>" + blh + "</ExamGroup>"
                                      + "<ScheduledDate></ScheduledDate>"
                                      + "<Note></Note>"
                                      + "<Operator>" + QP_XML + "</Operator>"
                                      + "<OperatorDate>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "</OperatorDate>"
                                      + "<Status>4</Status>"
                                      + "<Notice>10</Notice>"
                                      + "<ExamAddress></ExamAddress>"
                                      + "</ExamBLItemList>";
                        }
                    }

                    #endregion
                }
                catch (Exception ee2)
                {
                    log.WriteMyLog(blh + ":" + ee2.Message);

                    aa.ExecuteSQL("update T_JCXX_JXKH set F_bz='" + ee2.Message + "',F_FSZT='未处理'  where F_blh='" + blh + "' and F_BGZT='已审核' ");

                    return;
                }
                string rtn_xml = "";
                log.WriteMyLog(blh + ":" + rpt_xml);

                rpt_xml = "<Request><ExamStatusBL><ExamBLList>" + rpt_xml + "</ExamBLList></ExamStatusBL></Request>";

                try
                {
                    xyfyWeb.DHCPisXiangYaOne xyfy = new xyfyWeb.DHCPisXiangYaOne();
                    xyfy.Url = "http://192.168.2.51:57772/csp/dhcens/DHC.Pis.XiangYaOne.BS.Web.cls";
                    string pathweburl = f.ReadString("savetohis", "wsurl", "");
                    if (pathweburl.Trim() != "")
                    {
                        xyfy.Url = pathweburl;
                    }

                    rtn_xml = xyfy.DhcService("ExamStatusBL", rpt_xml);
                }
                catch (Exception ee4)
                {
                    log.WriteMyLog(ee4.Message.ToString());
                    aa.ExecuteSQL("update T_JCXX_JXKH set F_bz='连接webservice异常:" + ee4.Message + "',F_FSZT='未处理'  where F_blh='" + blh + "' and F_BGZT='已审核' ");
                    return;
                }
                try
                {
                    XmlDataDocument xd = new XmlDataDocument();
                    xd.LoadXml(rtn_xml);
                    XmlNode xn = xd.SelectSingleNode("/Response/ExamStatusBLReturn");

                    if (xn["Returncode"].InnerText.ToString() == "0")
                    {
                        log.WriteMyLog(xn["ResultContent"].InnerText.ToString() + ":" + rtn_xml);
                        aa.ExecuteSQL("update T_JCXX_JXKH set F_bz='',F_FSZT='已处理'  where F_blh='" + blh + "' and F_BGZT='已审核' ");
                    }
                    else
                    {
                        log.WriteMyLog(xn["ResultContent"].InnerText.ToString() + ":" + rtn_xml);
                        aa.ExecuteSQL("update T_JCXX_JXKH set F_bz='" + xn["ResultContent"].InnerText.ToString() + "',F_FSZT='未处理'  where F_blh='" + blh + "' and F_BGZT='已审核' ");
                    }
                }
                catch (Exception ee3)
                {
                    log.WriteMyLog(ee3.Message.ToString() + ":" + rtn_xml);
                    aa.ExecuteSQL("update T_JCXX_JXKH set F_bz='" + ee3.Message + "',F_FSZT='未处理'  where F_blh='" + blh + "' and F_BGZT='已审核' ");
                    return;
                }
            }
        }
Пример #2
0
        public void pathtohis(string blh, string yymc)
        {
            string debug = f.ReadString("savetohis", "debug", "");

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

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

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

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

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


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

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

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

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

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

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

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

                #region  回传体检报告

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

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

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

                    #endregion

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

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

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

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

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

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

                    int z = db_tj.ExecuteNonQuery(odbc_tj, sql_insert, ref errMsg);
                    if (z > 0)
                    {
                        if (debug == "1")
                        {
                            log.WriteMyLog("写入数据库成功");
                        }
                        aa.ExecuteSQL("update  T_JCXX  set F_TJXTBJ='2'  where F_BLH='" + blh + "'");
                    }
                    else
                    {
                        log.WriteMyLog("写入数据失败:" + errMsg);
                    }
                }
                #endregion
                return;
            }
        }