Example #1
0
        public override void ProcessMessage()
        {
            #region sql查询
            var listksxx = DBVisitor.ExecuteModels(SqlLoad.GetFormat(SQ.BASE00008));

            if (listksxx.Count == 0)
            {
                throw new Exception(string.Format("无科室信息!"));
            }
            else
            {
                OutObject = new ZD_KESHIXX_OUT();

                foreach (var bqxx in listksxx)
                {
                    var bingqulb = new KESHIXX();
                    bingqulb.KESHIDM = bqxx.Get("KESHIDM");
                    bingqulb.KESHIMC = bqxx.Get("KESHIMC");
                    OutObject.KESHIMX.Add(bingqulb);
                }
            }
            #endregion
        }
Example #2
0
        public override void ProcessMessage()
        {
            OutObject = new PAIDUIJHCX_OUT();
            string keShiDM      = InObject.KESHIID;
            string paiDuiJHLSJL = ConfigurationManager.AppSettings["PaiDuiJHLSJL"];//排队叫号是否获取历史队列记录

            //KESHIID 不为空时 获取科室名称信息,进行队列检索
            //检索队列为科室类别的数据,是否有可以匹配的内容
            //检索队列为医生类别的数据,是否有可以匹配的内容
            //获取队列号
            //获取队列当前就诊号码(当前就诊号或最后一个就诊号)
            //KESHIID 为空时 获取所有的队列的信息
            //获取队列号 列表
            //循环获取队列当前就诊循环

            if (string.IsNullOrEmpty(paiDuiJHLSJL))
            {
                paiDuiJHLSJL = "0";
            }


            if (!string.IsNullOrEmpty(keShiDM))
            {
                //科室信息
                KESHIXX   ksxx       = new KESHIXX();
                string    keShiXXSql = "select keshimc,keshiid from v_gy_keshi where keshiid = {0}";
                DataTable dtKSXX     = DBVisitor.ExecuteTable(string.Format(keShiXXSql, keShiDM));//科室信息
                if (dtKSXX.Rows.Count > 0)
                {
                    ksxx.KESHIDM = dtKSXX.Rows[0]["keshiid"].ToString();
                    ksxx.KESHIMC = dtKSXX.Rows[0]["keshimc"].ToString();
                }
                //队列
                string duiLieKSSql = "select distinct duilieid from jh_duiliexx where to_char(xitongsj,'yyyy-mm-dd') = '{0}' "
                                     + " and zuofeibz = 0 and duiliebh != 'DBA' and ((duilielbid = '01' and duiliebh ='{1}') or (duilielbid='02' and fuduilm ='{2}'))";
                DataTable dtDuiLieKS = DBVisitor.ExecuteTable(string.Format(duiLieKSSql, DateTime.Now.ToString("yyyy-MM-dd"), keShiDM, ksxx.KESHIMC));
                for (int i = 0; i < dtDuiLieKS.Rows.Count; i++)
                {
                    //队列详细信息
                    string    duiLieID    = dtDuiLieKS.Rows[i]["duilieid"].ToString();
                    string    paiDuiXXSql = "select distinct duilieid,yewuid,yewuxh,decode(shangxiawbz,0,1,1,2,shangxiawbz)  as shangxiawbz from jh_paiduidl where duilieid = '{0}'  and zhuangtaiid = '06' ";
                    DataTable dtPaiDuiXX  = DBVisitor.ExecuteTable(string.Format(paiDuiXXSql, duiLieID));
                    if (dtPaiDuiXX.Rows.Count > 0)
                    {
                        PAIDUIJHXX pdjhxx     = new PAIDUIJHXX();
                        string     duiliexx   = "select * from gy_weizhi a ,jh_duiliexx b where a.weizhiid=b.suozaizj and b.duilieid= '{0}'";
                        DataTable  duiliexxtb = DBVisitor.ExecuteTable(string.Format(duiliexx, duiLieID));
                        if (duiliexxtb.Rows.Count > 0)//就诊位置
                        {
                            pdjhxx.SUOZAIZJ = duiliexxtb.Rows[0]["bieming"].ToString();
                        }
                        else
                        {
                            pdjhxx.SUOZAIZJ = "";
                        }
                        pdjhxx.PAIDUIID   = dtPaiDuiXX.Rows[0]["duilieid"].ToString();                        //排队队列唯一编号
                        pdjhxx.DANGQIANHM = dtPaiDuiXX.Rows[0]["yewuxh"].ToString();                          //业务序号(挂号序号)
                        string GuaHaoId = (dtPaiDuiXX.Rows[0]["yewuid"].ToString()).Split('|')[1].ToString(); //获取挂号ID
                        pdjhxx.SHANGXIAWBZ = dtPaiDuiXX.Rows[0]["shangxiawbz"].ToString();
                        pdjhxx.KESHIDM     = ksxx.KESHIDM;                                                    //科室代码

                        pdjhxx.YISHENGDM = DBVisitor.ExecuteScalar(string.Format("select guahaoys from mz_guahao1 where guahaoid = '{0}'", GuaHaoId)).ToString();
                        pdjhxx.KESHIMC   = DBVisitor.ExecuteScalar(string.Format("select keshimc from v_gy_keshi where keshiid ='{0}'", ksxx.KESHIDM)).ToString();
                        if (!string.IsNullOrEmpty(pdjhxx.YISHENGDM) && pdjhxx.YISHENGDM != "*")
                        {
                            pdjhxx.YISHENGMC = DBVisitor.ExecuteScalar(string.Format("select zhigongxm from v_gy_zhigongxx where zhigongid = '{0}'", pdjhxx.YISHENGDM)).ToString();
                        }
                        OutObject.PAIDUIJHMX.Add(pdjhxx);
                    }
                    else
                    {
                        if (paiDuiJHLSJL == "0")
                        {
                            //结束队列信息
                            string    paiDuiJSXXSql = "select distinct duilieid,yewuid,yewuxh,decode(shangxiawbz,0,1,1,2,shangxiawbz) as shangxiawbz from jh_jieshudl where duilieid = '{0}'";
                            DataTable dtPaiDuiJSXX  = DBVisitor.ExecuteTable(string.Format(paiDuiJSXXSql, duiLieID));
                            if (dtPaiDuiJSXX.Rows.Count > 0)
                            {
                                PAIDUIJHXX pdjhxx     = new PAIDUIJHXX();
                                string     duiliexx   = "select * from gy_weizhi a ,jh_duiliexx b where a.weizhiid=b.suozaizj and b.duilieid= '{0}'";
                                DataTable  duiliexxtb = DBVisitor.ExecuteTable(string.Format(duiliexx, duiLieID));
                                if (duiliexxtb.Rows.Count > 0)//就诊位置
                                {
                                    pdjhxx.SUOZAIZJ = duiliexxtb.Rows[0]["bieming"].ToString();
                                }
                                else
                                {
                                    pdjhxx.SUOZAIZJ = "";
                                }
                                pdjhxx.PAIDUIID   = dtPaiDuiJSXX.Rows[0]["duilieid"].ToString();                        //排队队列唯一编号
                                pdjhxx.DANGQIANHM = dtPaiDuiJSXX.Rows[0]["yewuxh"].ToString();                          //业务序号(挂号序号)
                                string GuaHaoId = (dtPaiDuiJSXX.Rows[0]["yewuid"].ToString()).Split('|')[1].ToString(); //获取挂号ID
                                pdjhxx.SHANGXIAWBZ = dtPaiDuiJSXX.Rows[0]["shangxiawbz"].ToString();
                                pdjhxx.KESHIDM     = ksxx.KESHIDM;
                                pdjhxx.YISHENGDM   = DBVisitor.ExecuteScalar(string.Format("select guahaoys from mz_guahao1 where guahaoid = '{0}'", GuaHaoId)).ToString();
                                pdjhxx.KESHIMC     = DBVisitor.ExecuteScalar(string.Format("select keshimc from v_gy_keshi where keshiid ='{0}'", ksxx.KESHIDM)).ToString();
                                if (!string.IsNullOrEmpty(pdjhxx.YISHENGDM) && pdjhxx.YISHENGDM != "*")
                                {
                                    pdjhxx.YISHENGMC = DBVisitor.ExecuteScalar(string.Format("select zhigongxm from v_gy_zhigongxx where zhigongid = '{0}'", pdjhxx.YISHENGDM)).ToString();
                                }
                                OutObject.PAIDUIJHMX.Add(pdjhxx);
                            }
                        }
                    }
                }
            }
            else
            {
                string    duiLieKSSql = "select distinct duilieid from ( select duilieid ,ruduisj as riqi from jh_paiduidl union all select duilieid ,chuduisj as riqi from jh_jieshudl ) where to_char(riqi,'yyyy-mm-dd') = '{0}'";
                DataTable dtDuiLieXX  = DBVisitor.ExecuteTable(string.Format(duiLieKSSql, DateTime.Now.ToString("yyyy-MM-dd")));

                for (int i = 0; i < dtDuiLieXX.Rows.Count; i++)
                {
                    //队列详细信息
                    string    duiLieID    = dtDuiLieXX.Rows[i]["duilieid"].ToString();
                    string    paiDuiXXSql = "select distinct duilieid,yewuid,yewuxh,decode(shangxiawbz,0,1,1,2,shangxiawbz) as shangxiawbz from jh_paiduidl where duilieid = '{0}'  and zhuangtaiid = '06' ";
                    DataTable dtPaiDuiXX  = DBVisitor.ExecuteTable(string.Format(paiDuiXXSql, duiLieID));
                    if (dtPaiDuiXX.Rows.Count > 0)
                    {
                        PAIDUIJHXX pdjhxx     = new PAIDUIJHXX();
                        string     duiliexx   = "select * from gy_weizhi a ,jh_duiliexx b where a.weizhiid=b.suozaizj and b.duilieid= '{0}'";
                        DataTable  duiliexxtb = DBVisitor.ExecuteTable(string.Format(duiliexx, duiLieID));
                        if (duiliexxtb.Rows.Count > 0)//就诊位置
                        {
                            pdjhxx.SUOZAIZJ = duiliexxtb.Rows[0]["bieming"].ToString();
                        }
                        else
                        {
                            pdjhxx.SUOZAIZJ = "";
                        }
                        pdjhxx.PAIDUIID   = dtPaiDuiXX.Rows[0]["duilieid"].ToString();                        //排队队列唯一编号
                        pdjhxx.DANGQIANHM = dtPaiDuiXX.Rows[0]["yewuxh"].ToString();                          //业务序号(挂号序号)
                        string GuaHaoId = (dtPaiDuiXX.Rows[0]["yewuid"].ToString()).Split('|')[1].ToString(); //获取挂号ID
                        pdjhxx.SHANGXIAWBZ = dtPaiDuiXX.Rows[0]["shangxiawbz"].ToString();
                        pdjhxx.KESHIDM     = DBVisitor.ExecuteScalar(string.Format("select guahaoks from mz_guahao1 where guahaoid = '{0}'", GuaHaoId)).ToString();
                        pdjhxx.YISHENGDM   = DBVisitor.ExecuteScalar(string.Format("select guahaoys from mz_guahao1 where guahaoid = '{0}'", GuaHaoId)).ToString();

                        pdjhxx.KESHIMC = DBVisitor.ExecuteScalar(string.Format("select keshimc from v_gy_keshi where keshiid ='{0}'", pdjhxx.KESHIDM)).ToString();
                        if (!string.IsNullOrEmpty(pdjhxx.YISHENGDM) && pdjhxx.YISHENGDM != "*")
                        {
                            pdjhxx.YISHENGMC = DBVisitor.ExecuteScalar(string.Format("select zhigongxm from v_gy_zhigongxx where zhigongid = '{0}'", pdjhxx.YISHENGDM)).ToString();
                        }
                        OutObject.PAIDUIJHMX.Add(pdjhxx);
                    }
                    else
                    {
                        if (paiDuiJHLSJL == "0")
                        {
                            //结束队列信息
                            string    paiDuiJSXXSql = "select distinct duilieid,yewuid,yewuxh,decode(shangxiawbz,0,1,1,2,shangxiawbz) as shangxiawbz from jh_jieshudl where duilieid = '{0}' ";
                            DataTable dtPaiDuiJSXX  = DBVisitor.ExecuteTable(string.Format(paiDuiJSXXSql, duiLieID));
                            if (dtPaiDuiJSXX.Rows.Count > 0)
                            {
                                PAIDUIJHXX pdjhxx     = new PAIDUIJHXX();
                                string     duiliexx   = "select * from gy_weizhi a ,jh_duiliexx b where a.weizhiid=b.suozaizj and b.duilieid= '{0}'";
                                DataTable  duiliexxtb = DBVisitor.ExecuteTable(string.Format(duiliexx, duiLieID));
                                if (duiliexxtb.Rows.Count > 0)//就诊位置
                                {
                                    pdjhxx.SUOZAIZJ = duiliexxtb.Rows[0]["bieming"].ToString();
                                }
                                else
                                {
                                    pdjhxx.SUOZAIZJ = "";
                                }
                                pdjhxx.PAIDUIID   = dtPaiDuiJSXX.Rows[0]["duilieid"].ToString();                        //排队队列唯一编号
                                pdjhxx.DANGQIANHM = dtPaiDuiJSXX.Rows[0]["yewuxh"].ToString();                          //业务序号(挂号序号)
                                string GuaHaoId = (dtPaiDuiJSXX.Rows[0]["yewuid"].ToString()).Split('|')[1].ToString(); //获取挂号ID
                                pdjhxx.SHANGXIAWBZ = dtPaiDuiJSXX.Rows[0]["shangxiawbz"].ToString();
                                pdjhxx.KESHIDM     = DBVisitor.ExecuteScalar(string.Format("select guahaoks from mz_guahao1 where guahaoid = '{0}'", GuaHaoId)).ToString();
                                pdjhxx.YISHENGDM   = DBVisitor.ExecuteScalar(string.Format("select guahaoys from mz_guahao1 where guahaoid = '{0}'", GuaHaoId)).ToString();

                                pdjhxx.KESHIMC = DBVisitor.ExecuteScalar(string.Format("select keshimc from v_gy_keshi where keshiid ='{0}'", pdjhxx.KESHIDM)).ToString();
                                if (!string.IsNullOrEmpty(pdjhxx.YISHENGDM) && pdjhxx.YISHENGDM != "*")
                                {
                                    pdjhxx.YISHENGMC = DBVisitor.ExecuteScalar(string.Format("select zhigongxm from v_gy_zhigongxx where zhigongid = '{0}'", pdjhxx.YISHENGDM)).ToString();
                                }
                                OutObject.PAIDUIJHMX.Add(pdjhxx);
                            }
                        }
                    }
                }
            }
        }
Example #3
0
        public override void ProcessMessage()
        {
            OutObject = new GUAHAOKSXX_OUT();
            string guahaoFs     = InObject.GUAHAOFS;                                 //挂号方式
            string riQi         = InObject.RIQI;                                     //日期
            string guahaoBc     = InObject.GUAHAOBC;                                 //挂号班次
            string guahaoLb     = InObject.GUAHAOLB;                                 //挂号类别
            string yuanquID     = InObject.BASEINFO.FENYUANDM;                       //分院代码
            string YuYueLx      = ConfigurationManager.AppSettings["GuaHaoYYLX"];
            string guaHaoHYMS   = ConfigurationManager.AppSettings["GuaHaoYMS"];     //挂号号源模式
            string WuPaiBanKSXS = ConfigurationManager.AppSettings["MZKSWPBXSKSXX"]; //无排班时科室显示

            #region 基本信息有效性判断
            //排班号源模式 0或空 有具体号源模式 1 无具体号源模式
            if (string.IsNullOrEmpty(guaHaoHYMS))
            {
                guaHaoHYMS = "0";
            }

            //挂号方式
            if (string.IsNullOrEmpty(guahaoFs))
            {
                throw new Exception("挂号方式获取失败,请重新尝试挂号!");
            }
            else if (!(guahaoFs == "0" || guahaoFs == "1" || guahaoFs == "2"))
            {
                throw new Exception("挂号方式信息错误,必须符合:1挂号 2预约 !");
            }
            //挂号班次
            if (string.IsNullOrEmpty(guahaoBc))
            {
                throw new Exception("挂号方式信息错误,必须符合:0全部 1挂号 2预约 !");
            }
            else if (!(guahaoBc == "0" || guahaoBc == "1" || guahaoBc == "2"))
            {
                throw new Exception("号源时间信息错误,必须符合:0全天 1上午 2下午!");
            }
            //挂号类别
            if (string.IsNullOrEmpty(guahaoLb))
            {
                throw new Exception("挂号类别获取失败,请重新尝试挂号!");
            }

            //挂号日期
            if (string.IsNullOrEmpty(riQi))
            {
                riQi = string.Empty;
            }
            //预约类型
            if (!(string.IsNullOrEmpty(YuYueLx)))
            {
                YuYueLx = YuYueLx.Replace("|", ",");
            }
            //无排班时科室显示
            if (string.IsNullOrEmpty(WuPaiBanKSXS))
            {
                WuPaiBanKSXS = "0";
            }

            #endregion

            #region 获取科室信息语句拼装
            StringBuilder sbSql = new StringBuilder();
            if (guaHaoHYMS == "0")//有具体号源模式
            {
                #region  具体号源

                if (guahaoFs == "1")
                {
                    #region 普通挂号
                    sbSql.Append("select distinct a.keshiid keshidm,b.keshimc,a.weizhi jiuzhendd, b.keshizl keshijs from mz_v_guahaopb_ex_zzj a,v_gy_keshi b where b.keshiid=a.keshiid");
                    //分院代码
                    sbSql.Append(" and a.yuanquid = '" + yuanquID + "' ");
                    //挂号日期
                    if (string.IsNullOrEmpty(riQi))
                    {
                        sbSql.Append("and to_char(a.riqi,'yyyy-mm-dd') ='" + DateTime.Now.ToString("yyyy-MM-dd") + "' ");
                    }
                    else
                    {
                        sbSql.Append("and to_char(a.riqi,'yyyy-mm-dd') ='" + riQi + "' ");
                    }

                    if (ConfigurationManager.AppSettings["XHKSXXXS"] == "1")
                    {
                        //挂号班次
                        if (guahaoBc == "0")//全天
                        {
                            sbSql.Append(" and ((a.shangwuxh>0 ) or (a.xiawuxh>0 )) ");
                        }
                        else if (guahaoBc == "1")//上午
                        {
                            sbSql.Append(" and a.shangwuxh>0 ");
                        }
                        else if (guahaoBc == "2")//下午
                        {
                            sbSql.Append(" and a.xiawuxh>0 ");
                        }
                    }
                    else
                    {
                        //挂号班次
                        if (guahaoBc == "0")//全天
                        {
                            sbSql.Append(" and ((a.shangwuxh>0 and a.shangwuxh > a.shangwuygh) or (a.xiawuxh>0 and a.xiawuxh > a.xiawuygh)) ");
                        }
                        else if (guahaoBc == "1")//上午
                        {
                            sbSql.Append(" and a.shangwuxh>0 and a.shangwuxh > a.shangwuygh ");
                        }
                        else if (guahaoBc == "2")//下午
                        {
                            sbSql.Append(" and a.xiawuxh>0 and a.xiawuxh > a.xiawuygh ");
                        }
                    }
                    //挂号类别
                    if (guahaoLb != "0")
                    {
                        sbSql.Append(" and a.guahaolb='" + guahaoLb + "' ");
                    }
                    #endregion
                }



                if (guahaoFs == "2")
                {
                    #region 预约挂号
                    sbSql.Append("select distinct a.keshiid keshidm,b.keshimc,a.weizhi jiuzhendd, b.keshizl keshijs from mz_v_guahaopb_ex_zzj a,v_gy_keshi b ,v_mz_guahaoyyxh c where b.keshiid=a.keshiid and c.paibanid=a.paibanid");
                    //分院代码
                    sbSql.Append(" and a.yuanquid = '" + yuanquID + "' ");
                    //预约类型
                    sbSql.Append(" and (c.yuyuelx in (" + YuYueLx + ")) ");
                    //挂号日期
                    if (!string.IsNullOrEmpty(riQi))
                    {
                        sbSql.Append(" and to_char(a.riqi,'yyyy-mm-dd') ='" + riQi + "' ");
                    }
                    else
                    {
                        //挂号预约可预约当天号源 0 不启用 1 启用
                        if (ConfigurationManager.AppSettings["GuaHaoYYDTHY"] == "1")
                        {
                            sbSql.Append(" and a.riqi >= trunc(sysdate) ");
                        }
                        else
                        {
                            sbSql.Append(" and a.riqi > trunc(sysdate) ");
                        }
                    }
                    //挂号班次
                    if (guahaoBc == "0")//全天
                    {
                        sbSql.Append(" and (c.shangwuyyxh>0 or c.xiawuyyxh>0) ");
                    }
                    else if (guahaoBc == "1")//上午
                    {
                        sbSql.Append(" and c.shangwuyyxh>0 ");
                    }
                    else if (guahaoBc == "2")//下午
                    {
                        sbSql.Append(" and c.xiawuyyxh>0 ");
                    }
                    //挂号类别
                    if (guahaoLb != "0")
                    {
                        sbSql.Append(" and a.guahaolb='" + guahaoLb + "' ");
                    }
                    #endregion
                }


                #endregion
            }
            else
            {
                #region 无具体号源

                if (guahaoFs == "1" || guahaoFs == "0")
                {
                    #region 普通挂号
                    sbSql.Append("select distinct a.keshiid keshidm,b.keshimc,a.weizhi jiuzhendd, b.keshizl keshijs from mz_v_guahaopb_ex_zzj a,v_gy_keshi b where b.keshiid=a.keshiid");
                    //分院代码
                    sbSql.Append(" and a.yuanquid = '" + yuanquID + "' ");
                    //挂号日期
                    if (string.IsNullOrEmpty(riQi))
                    {
                        sbSql.Append("and to_char(a.riqi,'yyyy-mm-dd') ='" + DateTime.Now.ToString("yyyy-MM-dd") + "' ");
                    }
                    else
                    {
                        sbSql.Append("and to_char(a.riqi,'yyyy-mm-dd') ='" + riQi + "' ");
                    }
                    //挂号班次
                    if (guahaoBc == "0")//全天
                    {
                        sbSql.Append(" and ((a.shangwuxh>0 and a.shangwuxh > a.shangwuygh) or (a.xiawuxh>0 and a.xiawuxh > a.xiawuygh)) ");
                    }
                    else if (guahaoBc == "1")//上午
                    {
                        sbSql.Append(" and a.shangwuxh>0 and a.shangwuxh > a.shangwuygh ");
                    }
                    else if (guahaoBc == "2")//下午
                    {
                        sbSql.Append(" and a.xiawuxh>0 and a.xiawuxh > a.xiawuygh ");
                    }
                    //挂号类别
                    if (guahaoLb != "0")
                    {
                        sbSql.Append(" and a.guahaolb='" + guahaoLb + "' ");
                    }
                    #endregion
                }



                if (guahaoFs == "2")
                {
                    #region 预约挂号
                    sbSql.Append("select distinct a.keshiid keshidm,b.keshimc,a.weizhi jiuzhendd, b.keshizl keshijs from mz_v_guahaopb_ex_zzj a,v_gy_keshi b ,v_mz_guahaoyyxh c where b.keshiid=a.keshiid and c.paibanid=a.paibanid");
                    //分院代码
                    sbSql.Append(" and a.yuanquid = '" + yuanquID + "' ");
                    //预约类型
                    //sbSql.Append(" and (c.yuyuelx in (" + YuYueLx + ")) ");
                    //挂号日期
                    if (!string.IsNullOrEmpty(riQi))
                    {
                        sbSql.Append(" and to_char(a.riqi,'yyyy-mm-dd') ='" + riQi + "' ");
                    }
                    else
                    {
                        sbSql.Append(" and a.riqi > trunc(sysdate) ");
                    }
                    //挂号班次
                    if (guahaoBc == "0")//全天
                    {
                        sbSql.Append(" and ((a.shangwuxh>0 and a.shangwuxh > a.shangwuygh and c.shangwuyyxh>0 ) or (a.xiawuxh>0 and a.xiawuxh > a.xiawuygh and c.xiawuyyxh>0)) ");
                    }
                    else if (guahaoBc == "1")//上午
                    {
                        sbSql.Append(" and a.shangwuxh>0 and a.shangwuxh > a.shangwuygh ");
                        sbSql.Append(" and c.shangwuyyxh>0 ");
                    }
                    else if (guahaoBc == "2")//下午
                    {
                        sbSql.Append(" and a.xiawuxh>0 and a.xiawuxh > a.xiawuygh ");
                        sbSql.Append(" and c.xiawuyyxh>0 ");
                    }
                    //挂号类别
                    if (guahaoLb != "0")
                    {
                        sbSql.Append(" and a.guahaolb='" + guahaoLb + "' ");
                    }
                    #endregion
                }

                #endregion
            }
            //sql日志记录
            //WcfCommon.writeLog(WcfCommon.LOGTYPE_SQLLOG, OutObject.GetType().Name.ToString(), "挂号科室信息查询:" + sbSql.ToString(), messageId);
            #endregion

            #region 获取科室信息
            DataTable dt = DBVisitor.ExecuteTable(sbSql.ToString());
            if (dt.Rows.Count > 0)
            {
                string guahaoFspb = ConfigurationManager.AppSettings["GUAHAOFSPB"];//无排班时科室显示
                //设置固定科室列表显示模式 为1时 所有列表中的科室无论有没有排班都想被返回
                if (WuPaiBanKSXS == "1" && (guahaoFs == "1" || guahaoFspb == "0"))
                {
                    #region 固定科室模式
                    Dictionary <string, KESHIXX> dicKeShiPaiBanXX = new Dictionary <string, KESHIXX>();

                    #region  排班的科室
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        KESHIXX ksxx = new KESHIXX();
                        ksxx.KESHIDM   = dt.Rows[i]["KESHIDM"].ToString();
                        ksxx.KESHIMC   = dt.Rows[i]["KESHIMC"].ToString();
                        ksxx.JIUZHENDD = dt.Rows[i]["JIUZHENDD"].ToString();
                        ksxx.KESHIJS   = dt.Rows[i]["KESHIJS"].ToString();
                        if (!dicKeShiPaiBanXX.ContainsKey(ksxx.KESHIDM))
                        {
                            dicKeShiPaiBanXX.Add(ksxx.KESHIDM, ksxx);
                        }
                    }
                    #endregion


                    //检索固定科室信息列表
                    string    sqlGuDingKSLB = " select a.keshiid,b.keshimc, b.keshizl keshijs,nvl(a.xianshims,2) xianshims ,a.shunxuhao From zzgh_zhichiks a,v_gy_keshi b where a.KESHIID=b.keshiid and  a.zuofeibz = 0 and a.yuanquid = '{0}' order by xianshims asc,shunxuhao asc,b.keshimc asc ";
                    DataTable dtGuDingKSLB  = DBVisitor.ExecuteTable(string.Format(sqlGuDingKSLB, yuanquID));
                    for (int i = 0; i < dtGuDingKSLB.Rows.Count; i++)
                    {
                        string  guDingKeShiID = dtGuDingKSLB.Rows[i]["keshiid"].ToString();   //固定科室代码
                        string  guDingKeShiMC = dtGuDingKSLB.Rows[i]["keshimc"].ToString();   //固定科室名称
                        string  guDingKeShiMS = dtGuDingKSLB.Rows[i]["keshijs"].ToString();   //固定科室简述
                        string  xianShiMS     = dtGuDingKSLB.Rows[i]["xianshims"].ToString(); //显示模式 1 固定显示,2有排班显示
                        string  xianShiSXh    = dtGuDingKSLB.Rows[i]["shunxuhao"].ToString(); //顺序号
                        KESHIXX gdksxx        = new KESHIXX();
                        gdksxx.KESHIDM = guDingKeShiID;
                        gdksxx.KESHIMC = guDingKeShiMC;
                        gdksxx.KESHIJS = guDingKeShiMS;
                        if (dicKeShiPaiBanXX.ContainsKey(guDingKeShiID)) //固定科室是否存在排班
                        {                                                //存在排班
                            KESHIXX ksxx = dicKeShiPaiBanXX[guDingKeShiID];
                            gdksxx.JIUZHENDD   = ksxx.JIUZHENDD;
                            gdksxx.ZHUANGTAIBZ = "0";
                        }
                        else  //不存在排班
                        {
                            gdksxx.ZHUANGTAIBZ = "1";
                            if (xianShiMS == "2")
                            {
                                continue;
                            }
                        }

                        //科室位置信息
                        if (string.IsNullOrEmpty(gdksxx.JIUZHENDD))
                        {
                            string    sqlJZDD = "select weizhism from v_gy_keshi where keshiid ='{0}'";
                            DataTable dtJZDD  = DBVisitor.ExecuteTable(string.Format(sqlJZDD, gdksxx.KESHIDM));
                            if (dtJZDD.Rows.Count > 0)
                            {
                                gdksxx.JIUZHENDD = dtJZDD.Rows[0][0].ToString();
                            }
                        }
                        OutObject.KESHIMX.Add(gdksxx);
                    }
                    #endregion
                }
                else
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        KESHIXX ksxx = new KESHIXX();
                        ksxx.KESHIDM     = dt.Rows[i]["KESHIDM"].ToString();
                        ksxx.KESHIMC     = dt.Rows[i]["KESHIMC"].ToString();
                        ksxx.JIUZHENDD   = dt.Rows[i]["JIUZHENDD"].ToString();
                        ksxx.KESHIJS     = dt.Rows[i]["KESHIJS"].ToString();
                        ksxx.ZHUANGTAIBZ = "0";
                        if (string.IsNullOrEmpty(ksxx.JIUZHENDD))
                        {
                            string    sqlJZDD = "select weizhism from v_gy_keshi where keshiid ='{0}'";
                            DataTable dtJZDD  = DBVisitor.ExecuteTable(string.Format(sqlJZDD, ksxx.KESHIDM));
                            if (dtJZDD.Rows.Count > 0)
                            {
                                ksxx.JIUZHENDD = dtJZDD.Rows[0][0].ToString();
                            }
                        }
                        OutObject.KESHIMX.Add(ksxx);
                    }
                }
            }
            #endregion

            if (OutObject.KESHIMX.Count <= 0)
            {
                throw new Exception("未找到相关科室排班!");
            }
        }