예제 #1
0
파일: GUAHAOYY.cs 프로젝트: radtek/WCF
        public override void ProcessMessage()
        {
            OutObject = new GUAHAOYY_OUT();
            string yuyueLx      = InObject.YUYUELX;
            string jiuzhenkLx   = InObject.JIUZHENKLX;                           //就诊卡类型
            string jiuzhenKh    = InObject.JIUZHENKH;                            //就诊卡号
            string zhengjianLx  = InObject.ZHENGJIANLX;                          //证件类型
            string zhengjianHm  = InObject.ZHENGJIANHM;                          //证件号码
            string xingMing     = InObject.XINGMING;                             //姓名
            string yizhoupbId   = InObject.YIZHOUPBID;                           //一周排班id;
            string dangtianpbId = InObject.DANGTIANPBID;                         //当天排班id
            string riQi         = InObject.RIQI;                                 //日期
            string guahaoBc     = InObject.GUAHAOBC;                             //挂号班次
            string guahaoLb     = InObject.GUAHAOLB;                             //挂号类别
            string keshiDm      = InObject.KESHIDM;                              //科室代码
            string yishengDm    = InObject.YISHENGDM;                            //医生代码
            string guahaoXh     = InObject.GUAHAOXH;                             //挂号序号
            string yuyueLy      = InObject.YUYUELY;                              //预约来源
            string lianxiDh     = InObject.LIANXIDH;                             //手机号码
            string bingrenId    = InObject.BINGRENID;                            //病人ID
            string xingBie      = InObject.XINGBIE;                              //性别
            string FenYuanDM    = InObject.BASEINFO.FENYUANDM;                   //分院代码
            string beiZhu       = InObject.BEIZHU;                               //备注

            string czygh     = ConfigurationManager.AppSettings["JRCaoZuoYGH"];  //接入操作员工号
            string yuYueCZFS = ConfigurationManager.AppSettings["GUAHAOYYCZFS"]; //挂号预约处理方式

            if (!string.IsNullOrEmpty(yuYueCZFS) && yuYueCZFS == "1")
            {
                #region  兴悦城业务处理
                #region 基本入参判断
                //if (string.IsNullOrEmpty(zhengjianHm)) {
                //    throw new Exception("证件号码不能为空!");
                //}
                if (string.IsNullOrEmpty(beiZhu))
                {
                    beiZhu = string.Empty;
                }

                if (string.IsNullOrEmpty(xingMing))
                {
                    throw new Exception("姓名不能为空!");
                }

                if (string.IsNullOrEmpty(xingBie))
                {
                    throw new Exception("性别不能为空!");
                }

                if (string.IsNullOrEmpty(lianxiDh))
                {
                    throw new Exception("联系电话不能为空!");
                }

                if (string.IsNullOrEmpty(guahaoBc))
                {
                    throw new Exception("挂号班次不能为空!请传入1 上午,2 下午!");
                }
                else if (guahaoBc != "1" && guahaoBc != "2")
                {
                    throw new Exception("挂号班次不能为空!请传入1 上午,2 下午!");
                }

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

                if (string.IsNullOrEmpty(yuyueLx))
                {
                    yuyueLx = ConfigurationManager.AppSettings["GuaHaoYYLX"];//预约类型
                }
                #endregion

                string sXingBie = string.Empty;
                switch (xingBie)
                {
                case "0":
                    sXingBie = "未知";
                    break;

                case "1":
                    sXingBie = "男";
                    break;

                case "2":
                    sXingBie = "女";
                    break;

                default:
                    sXingBie = "其它";
                    break;
                }

                string chuShenRQ = "null";
                if (!string.IsNullOrEmpty(zhengjianHm))
                {
                    chuShenRQ = string.Format("to_date('{0}','yyyy-mm-dd')", zhengjianHm.Substring(6, 8).Insert(4, "-").Insert(7, "-"));
                }

                string    houzhensj   = "select kaishisj,jieshusj from v_mz_houzhensj where paibanid = '{0}' and (shangxiawbz = '{1}') and (qishighxh>= '{2}' and jieshughxh <= '{2}')";
                DataTable dtHouZhensj = DBVisitor.ExecuteTable(string.Format(houzhensj, dangtianpbId, guahaoBc == "1" ? "0" : "1", guahaoXh));
                string    kaishisj    = string.Empty;
                string    jieshusj    = string.Empty;
                if (dtHouZhensj != null && dtHouZhensj.Rows.Count > 0)
                {
                    kaishisj = dtHouZhensj.Rows[0]["kaishisj"].ToString();
                    jieshusj = dtHouZhensj.Rows[0]["jieshusj"].ToString();
                }

                string PaiBanHYXX = @"select * from v_mz_guahaoyyxh_qbhy where paibanid = '{0}' and guahaoyyxh = '{1}' and shangxiawbz = '{2}'and yuanquid = '{3}' ";

                DataTable dtPBHYXX = DBVisitor.ExecuteTable(string.Format(PaiBanHYXX, dangtianpbId, guahaoXh, guahaoBc == "1" ? "0" : "1", FenYuanDM));
                if (dtPBHYXX == null || dtPBHYXX.Rows.Count <= 0)
                {
                    throw new Exception("未找到有效的号源信息!");
                }

                //号源占用判断
                DataTable dtYYYXX = DBVisitor.ExecuteTable(string.Format("select * from v_mz_guahaoyyxh_yshyh where paibanid = '{0}' and guahaoyyxh = '{1}' and shangxiawbz = '{2}' and yuanquid = '{3}' ", dangtianpbId, guahaoXh, ((guahaoBc == "1") ? 0 : 1), FenYuanDM));
                if (dtYYYXX.Rows.Count > 0)
                {
                    throw new Exception("该时间段已被预约,请选择其它时间段!");
                }

                string quHaoMM = DBVisitor.ExecuteScalar("select LPAD(seq_gy_jiuzhenyy.nextval,10,'0') from dual").ToString();

                string bingrenid = DBVisitor.ExecuteScalar(string.Format("select nvl(bingrenid,'') from gy_bingrenxx where xingming = '{0}' and xingbie = '{1}' and  jiatingdh = '{2}' ", xingMing, sXingBie, lianxiDh)).ToString();

                string insertYYXX = @"insert into gy_jiuzhenyy (jiuzhenyyid,yuyuesj,yisehngid,keshiid,xingming,
                                            shuruma1,shuruma2,shuruma3,xingbie,chushengrq,dianhua,
                                            yuyuerq,jiuzhenbz,jiluren,jieshusj,zuofeibz,yuyuely,beizhu,bingrenid,chuzhenbz )
                                            values( '{0}','{1}','{2}','{3}','{4}',
                                            fun_gy_getshuruma1('{4}',50),fun_gy_getshuruma2('{4}',50),fun_gy_getshuruma3('{4}',50),'{5}',{6},'{7}',
                                            to_date('{8}','yyyy-mm-dd'),'0','{9}','{10}','0','{11}','{12}','{13}',{14} )";
                DBVisitor.ExecuteNonQuery(string.Format(insertYYXX, quHaoMM, kaishisj, yishengDm, keshiDm,
                                                        xingMing, sXingBie, chuShenRQ, lianxiDh, riQi, InObject.BASEINFO.CAOZUOYDM, jieshusj, yuyueLx, beiZhu,
                                                        bingrenid, string.IsNullOrEmpty(bingrenid)?1:0));
                OutObject.GUAHAOXH  = guahaoXh;
                OutObject.JIUZHENSJ = Unity.getJiuZhenSJD(yishengDm, keshiDm.ToString(), guahaoXh, yuyueLx, ((guahaoBc == "1") ? 0 : 1), guahaoLb, riQi);
                OutObject.QUHAOMM   = quHaoMM;
                #endregion
            }
            else
            {
                #region 标准his4业务处理

                #region 基本入参判断
                if (string.IsNullOrEmpty(InObject.BASEINFO.CAOZUOYDM))
                {
                    throw new Exception("非法操作员,无法进行预约操作!");
                }
                if (!string.IsNullOrEmpty(czygh) && !czygh.Contains("^" + InObject.BASEINFO.CAOZUOYDM + "^"))
                {
                    throw new Exception("非法操作员,无法进行预约操作!");
                }


                //预约类型
                if (string.IsNullOrEmpty(yuyueLx))
                {
                    yuyueLx = ConfigurationManager.AppSettings["GuaHaoYYLX"];//预约类型
                }

                //性别
                if (string.IsNullOrEmpty(xingBie))
                {
                    xingBie = "未知";
                }
                else if (xingBie == "1")
                {
                    xingBie = "男";
                }
                else if (xingBie == "2")
                {
                    xingBie = "女";
                }
                else if (xingBie == "9")
                {
                    xingBie = "其他";
                }
                else
                {
                    xingBie = "";
                }

                if (!string.IsNullOrEmpty(zhengjianHm))
                {
                    zhengjianHm = zhengjianHm.ToUpper();
                }

                //姓名
                if (string.IsNullOrEmpty(xingMing))
                {
                    throw new Exception("姓名不能为空!");
                }
                //就诊卡号
                if (string.IsNullOrEmpty(jiuzhenKh) && string.IsNullOrEmpty(zhengjianHm) && string.IsNullOrEmpty(bingrenId))
                {
                    throw new Exception("就诊卡号和证件号码不能同时为空!");
                }

                //排班id
                if (string.IsNullOrEmpty(dangtianpbId))
                {
                    throw new Exception("排班信息获取失败,请重新尝试挂号!");
                }
                //预约日期
                if (string.IsNullOrEmpty(riQi))
                {
                    throw new Exception("预约日期获取失败,请重新尝试挂号!");
                }
                //挂号班次
                if (string.IsNullOrEmpty(guahaoBc))
                {
                    throw new Exception("挂号班次获取失败,请重新尝试挂号!");
                }
                //挂号类别
                if (string.IsNullOrEmpty(guahaoLb))
                {
                    throw new Exception("挂号类别获取失败,请重新尝试挂号!");
                }
                //科室代码
                if (string.IsNullOrEmpty(keshiDm))
                {
                    throw new Exception("科室信息获取失败,请重新尝试挂号!");
                }
                //挂号序号
                if (string.IsNullOrEmpty(guahaoXh))
                {
                    throw new Exception("预约挂号序号获取失败,请重新尝试挂号!");
                }
                //联系电话
                if (string.IsNullOrEmpty(lianxiDh))
                {
                    throw new Exception("联系电话获取失败,请重新尝试挂号!");
                }

                if (string.IsNullOrEmpty(yishengDm))
                {
                    yishengDm = "*";
                }

                if (string.IsNullOrEmpty(yuyueLy))
                {
                    yuyueLy = ConfigurationManager.AppSettings["GuaHaoYYLY"];
                    if (string.IsNullOrEmpty(yuyueLy))
                    {
                        yuyueLy = "7";
                    }
                }
                #endregion



                string chushengrq  = "";
                string xuexing     = "";
                string hunyin      = "";
                string zhiye       = "";
                string guoji       = "";
                string minzu       = "";
                string jiwangshi   = "";
                string guominshi   = "";
                string jiatingdz   = "";
                string lianxirdh   = "";
                string lianxiren   = "";
                string dianhua     = "";
                string houzhenkssj = "";
                string houzhenjssj = "";
                if (!string.IsNullOrEmpty(jiuzhenKh) || !string.IsNullOrEmpty(zhengjianHm) || !string.IsNullOrEmpty(bingrenId))
                {
                    //获取病人个人信息
                    StringBuilder sbSql = new StringBuilder("select a.jiuzhenkh,a.shenfenzh,xingbie, to_char(a.chushengrq,'yyyy-mm-dd') chushengrq,a.bingrenid, a.xuexing,a.hunyin,");
                    sbSql.Append(" a.zhiye,a.guoji,a.minzu,a.jiwangshi,a.guominshi,a.jiatingdz,a.lianxirdh,a.lianxiren,a.dianhua,a.lianxidh ");
                    sbSql.Append("from gy_v_bingrenxx a where ((a.jiuzhenkh is not null and  a.jiuzhenkh = '" + jiuzhenKh + "') or (a.yibaokh is not null and   a.yibaokh = '" + jiuzhenKh + "') or  (a.bingrenid is not null and a.bingrenid ='" + bingrenId + "') or (a.shenfenzh is not null and a.shenfenzh = '" + zhengjianHm + "'))   order by a.yibaokh asc, a.xiugaisj desc ");
                    DataTable dt = DBVisitor.ExecuteTable(sbSql.ToString());
                    if (dt.Rows.Count > 0)
                    {
                        jiuzhenKh   = dt.Rows[0]["jiuzhenkh"].ToString();
                        bingrenId   = dt.Rows[0]["bingrenid"].ToString();
                        zhengjianHm = dt.Rows[0]["shenfenzh"].ToString();
                        chushengrq  = dt.Rows[0]["chushengrq"].ToString();
                        xuexing     = dt.Rows[0]["xuexing"].ToString();
                        hunyin      = dt.Rows[0]["hunyin"].ToString();
                        zhiye       = dt.Rows[0]["zhiye"].ToString();
                        guoji       = dt.Rows[0]["guoji"].ToString();
                        minzu       = dt.Rows[0]["minzu"].ToString();
                        jiwangshi   = dt.Rows[0]["jiwangshi"].ToString();
                        guominshi   = dt.Rows[0]["guominshi"].ToString();
                        jiatingdz   = dt.Rows[0]["jiatingdz"].ToString();
                        lianxirdh   = dt.Rows[0]["lianxirdh"].ToString();
                        lianxiren   = dt.Rows[0]["lianxiren"].ToString();
                        dianhua     = dt.Rows[0]["dianhua"].ToString();
                        xingBie     = dt.Rows[0]["xingbie"].ToString();
                        if (string.IsNullOrEmpty(lianxiDh))
                        {
                            lianxiDh = string.IsNullOrEmpty(dianhua) ? dt.Rows[0]["lianxidh"].ToString() : dianhua;
                        }
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(zhengjianHm))
                        {
                            throw new Exception("证件号码不能为空!");
                        }
                    }
                }

                if (bingrenId == "null" || bingrenId == "Null" || bingrenId == "NULL")
                {
                    bingrenId = string.Empty;
                }

                #region 科室可预约年龄判断
                if (!Unity.shiFouKeGHNianLin(keshiDm, zhengjianHm))
                {
                    throw new Exception("年龄条件不符合,不能在本科室挂号/预约!");
                }
                #endregion
                #region 科室可预约性别判断
                if (!Unity.shiFouKeGHXingBie(keshiDm, zhengjianHm))
                {
                    throw new Exception("性别条件不符合,不能在本科室挂号/预约!");
                }
                #endregion

                #region 获取候诊时间
                string guaHaoHYMS = ConfigurationManager.AppSettings["GuaHaoYMS"];//挂号号源模式
                if (!string.IsNullOrEmpty(guaHaoHYMS) && guaHaoHYMS == "1")
                {
                }
                else
                {
                    OutObject.JIUZHENSJ = Unity.getJiuZhenSJD(yishengDm, keshiDm.ToString(), guahaoXh, yuyueLx, ((guahaoBc == "1") ? 0 : 1), guahaoLb, riQi);
                }
                if (OutObject.JIUZHENSJ.Contains("-"))
                {
                    houzhenkssj = OutObject.JIUZHENSJ.Split('-')[0];
                    houzhenjssj = OutObject.JIUZHENSJ.Split('-')[1];
                }
                #endregion


                //拼装交易字符串(2014-07-08,参考来源:his4.GHPKG.P_GH_BOOK)
                string jiaoyiZfc = bingrenId;                                    //外部病人ID为空
                jiaoyiZfc += "|" + jiuzhenKh;                                    //就诊卡号
                jiaoyiZfc += "|";                                                //医保卡号
                jiaoyiZfc += "|" + xingMing;                                     //姓名
                jiaoyiZfc += "|" + xingBie;                                      //性别
                jiaoyiZfc += "|" + zhengjianHm;                                  //证件号码
                jiaoyiZfc += "|" + chushengrq;                                   //出身日期
                jiaoyiZfc += "|" + xuexing;                                      //血型
                jiaoyiZfc += "|" + hunyin.Replace('|', '-');                     //婚姻状况
                jiaoyiZfc += "|" + zhiye;                                        //职业
                jiaoyiZfc += "|" + guoji;                                        //国籍
                jiaoyiZfc += "|" + minzu;                                        //民族
                jiaoyiZfc += "|" + jiwangshi;                                    //既往史
                jiaoyiZfc += "|" + guominshi;                                    //过敏史
                jiaoyiZfc += "|" + jiatingdz;                                    //家庭地址为空
                jiaoyiZfc += "|" + lianxiDh;                                     //联系电话
                jiaoyiZfc += "|" + lianxiren;                                    //联系人
                jiaoyiZfc += "|" + lianxiDh;                                     //联系电话
                jiaoyiZfc += "|" + (guahaoBc == "1" ? "S" : "X") + dangtianpbId; //排版ID
                jiaoyiZfc += "|2";                                               //排班模式
                jiaoyiZfc += "|" + riQi;                                         //就诊日期
                jiaoyiZfc += "|" + yuyueLx;                                      //预约类型
                jiaoyiZfc += "|" + yuyueLy;                                      //记录来源
                jiaoyiZfc += "|" + guahaoXh;                                     //预约挂号就诊序号
                jiaoyiZfc += "|";
                jiaoyiZfc += "|";
                jiaoyiZfc += "|" + InObject.BASEINFO.CAOZUOYDM;
                jiaoyiZfc += "|" + String.Empty; //yuyuehao 取号密码字段
                jiaoyiZfc += "|" + lianxiDh;     //家庭电话
                jiaoyiZfc += "|";                //单位电话
                jiaoyiZfc += "|" + houzhenkssj;  //候诊开始时间
                jiaoyiZfc += "|" + houzhenjssj;  //候诊结束时间

                //提交预约号-------------------------------------------------------------------------------------------
                OracleParameter[] paramJiaoYi = new OracleParameter[3];
                paramJiaoYi[0]           = new OracleParameter("PRM_JIAOYIZFC", OracleType.VarChar);
                paramJiaoYi[0].Value     = jiaoyiZfc;
                paramJiaoYi[0].Direction = ParameterDirection.Input;
                paramJiaoYi[1]           = new OracleParameter("PRM_APPCODE", OracleType.Number);
                paramJiaoYi[1].Value     = null;
                paramJiaoYi[1].Direction = ParameterDirection.Output;
                paramJiaoYi[2]           = new OracleParameter("PRM_DATABUFFER", OracleType.VarChar);
                paramJiaoYi[2].Value     = null;
                paramJiaoYi[2].Size      = 2000;
                paramJiaoYi[2].Direction = ParameterDirection.Output;

                log.InfoFormat("{0}", "执行存储过程:PKG_MZ_YUYUE.PRC_GY_TIJIAOYUYUEXX \r\nPRM_JIAOYIZFC:" + jiaoyiZfc + "\r\n");

                string        returnValue = string.Empty;
                DbTransaction transaction = null;
                DbConnection  conn        = DBVisitor.Connection;
                try
                {
                    transaction = conn.BeginTransaction();
                    DBVisitor.ExecuteProcedure("PKG_MZ_YUYUE.PRC_GY_TIJIAOYUYUEXX", paramJiaoYi, transaction);
                }
                catch (Exception ex)
                {
                    if (transaction != null)
                    {
                        transaction.Rollback();
                        conn.Close();
                    }
                    throw new Exception(ex.Message);
                }
                //--------------------------------------------------------------------------------------------------
                //String filePath = System.Environment.CurrentDirectory; //取当前系统路径
                string errMsg = string.Empty;
                returnValue = paramJiaoYi[2].Value.ToString();
                if (!returnValue.Contains("|"))
                {
                    transaction.Rollback();
                    conn.Close();
                    throw new Exception(returnValue);
                }

                if (returnValue.Length > 3 && returnValue.Substring(0, 3).ToUpper() == "ERR")//获取信息错误
                {
                    errMsg = returnValue.Substring(returnValue.IndexOf('|') + 1);
                    transaction.Rollback();
                    conn.Close();
                    throw new Exception(errMsg);
                }
                else
                {
                    string yuYueHao = string.Empty;
                    if (returnValue.Contains("|"))
                    {
                        yuYueHao = returnValue.Split('|')[1];
                        //此处需要处理返回成功的xml
                        OutObject.QUHAOMM  = yuYueHao;
                        OutObject.GUAHAOXH = guahaoXh;

                        transaction.Commit();
                        conn.Close();
                    }
                    else
                    {
                        transaction.Rollback();
                        conn.Close();
                        throw new Exception("存储过程返回值格式有误!");
                    }
                }
                #endregion
            }
        }
예제 #2
0
        public override void ProcessMessage()
        {
            OutObject = new YUYUEJLCX_OUT();
            string jiuzhenKh = InObject.JIUZHENKH;                               //就诊卡号

            string xingMing    = InObject.XINGMING;                              //姓名
            string zhengjianHm = InObject.ZHENGJIANHM;                           //证件号码
            string lianxiDh    = InObject.LIANXIDH;                              //联系电话
            string yuyuerq     = InObject.YUYUERQ;                               //预约日期
            string quHaoZt     = InObject.QUHAOZT;                               //取号状态

            string yuYueCZFS = ConfigurationManager.AppSettings["GUAHAOYYCZFS"]; //挂号预约处理方式

            if (!string.IsNullOrEmpty(yuYueCZFS) && yuYueCZFS == "1")
            {
                if (string.IsNullOrEmpty(lianxiDh))
                {
                    throw new Exception("联系电话不能为空!");
                }
                string    yyjlcx = @"  select xingming,jiuzhenyyid yuyueid,jiuzhenyyid quhaomm,yishengid yishengdm,(select zhigongxm from gy_zhigongxx where zhigongid = a.yishengid ) yishengxm,keshiid keshidm,(select keshimc from gy_keshi where keshiid = a.keshiid) keshimc,to_char(yuyuesj,'yyyy-mm-dd') riqi,
                            to_Char(yuyuesj,'hh24:mi:ss') jiuzhensj,guahaoyyxh guahaoxh,decode(shangxiawbz,0,1,2) guahaobc,DIANHUA,YUYUEZT,CAOZUORQ,paibanid,beizhu  from v_mz_guahaoyyxh_yshyh  a  where dianhua = '{0}' ";
                DataTable dtYYJL = DBVisitor.ExecuteTable(string.Format(yyjlcx, lianxiDh));

                if (dtYYJL.Rows.Count <= 0)
                {
                    throw new Exception("未找到预约记录!");
                }

                for (int i = 0; i < dtYYJL.Rows.Count; i++)
                {
                    YUYUEXX yuyuexx = new YUYUEXX();
                    yuyuexx.BINGRENXM = dtYYJL.Rows[i]["xingming"].ToString();  //病人姓名
                    yuyuexx.YUYUEID   = dtYYJL.Rows[i]["yuyueid"].ToString();   //预约ID
                    yuyuexx.QUHAOMM   = dtYYJL.Rows[i]["quhaomm"].ToString();   //取号密码
                    yuyuexx.GUAHAOBC  = dtYYJL.Rows[i]["guahaobc"].ToString();  //挂号班次
                    yuyuexx.GUAHAOXH  = dtYYJL.Rows[i]["guahaoxh"].ToString();  //挂号序号
                    yuyuexx.JIUZHENSJ = dtYYJL.Rows[i]["jiuzhensj"].ToString(); //就诊时间
                    yuyuexx.KESHIDM   = dtYYJL.Rows[i]["keshidm"].ToString();   //科室代码
                    yuyuexx.KESHIMC   = dtYYJL.Rows[i]["keshimc"].ToString();   //科室名称
                    yuyuexx.YISHENGDM = dtYYJL.Rows[i]["yishengdm"].ToString(); //医生代码
                    yuyuexx.YISHENGXM = dtYYJL.Rows[i]["yishengxm"].ToString(); //医生姓名
                    yuyuexx.RIQI      = dtYYJL.Rows[i]["riqi"].ToString();      //就诊日期
                    yuyuexx.YUYUESJ   = dtYYJL.Rows[i]["caozuorq"].ToString();
                    yuyuexx.YUYUEZT   = dtYYJL.Rows[i]["yuyuezt"].ToString();
                    yuyuexx.BEIZHU    = dtYYJL.Rows[i]["beizhu"].ToString();
                    if (yuyuexx.YUYUEZT == "0")
                    {
                        yuyuexx.YUYUEZTSM = "未挂号";
                    }
                    else if (yuyuexx.YUYUEZT == "1")
                    {
                        yuyuexx.YUYUEZTSM = "已挂号";
                    }
                    else if (yuyuexx.YUYUEZT == "2")
                    {
                        yuyuexx.YUYUEZTSM = "预约取消";
                    }
                    else if (yuyuexx.YUYUEZT == "3")
                    {
                        yuyuexx.YUYUEZTSM = "预约过期";
                    }

                    string paiBanID = dtYYJL.Rows[i]["paibanid"].ToString();
                    OutObject.YUYUEMX.Add(yuyuexx);
                }
            }
            else
            {
                #region 标准his4业务流程

                #endregion
                #region 入参判断
                if (string.IsNullOrEmpty(jiuzhenKh) && string.IsNullOrEmpty(zhengjianHm))
                {
                    throw new Exception("就诊卡号和证件号码不能同时为空");
                }
                //if (string.IsNullOrEmpty(lianxiDh))
                //{
                //    throw new Exception("联系电话不能为空");
                //}
                #endregion
                StringBuilder sbSql = new StringBuilder("select a.yuyueid, a.yuyuezt,to_char(a.caozuorq,'yyyy-mm-dd hh24:mi:ss') caozuorq, a.yuyuehao quhaomm,decode(a.shangxiawbz,'0','上午','1','下午','其他') guahaobc,a.guahaoxh, ");
                sbSql.Append("to_char(a.yuyuesj,'yyyy-mm-dd hh24:mi:ss') jiuzhensj,a.yuyueks keshidm,a.yuyueksmc keshimc,a.paibanid, ");       //
                sbSql.Append("a.yuyueys yishengdm,a.yuyueysxm yishengxm,to_char(a.yuyuesj,'yyyy-mm-dd') riqi from mz_guahaoyy a  WHERE 1=1 "); //
                if (!string.IsNullOrEmpty(jiuzhenKh))
                {
                    sbSql.Append("and a.jiuzhenkh='" + jiuzhenKh + "' ");
                }
                //if (jiuzhenkLx != string.Empty)
                //    sbSql.Append("and a.jiuzhenkLx='" + jiuzhenkLx + "' ");//?
                if (!string.IsNullOrEmpty(xingMing))
                {
                    sbSql.Append("and a.xingming ='" + xingMing + "' ");
                }
                if (!string.IsNullOrEmpty(zhengjianHm))
                {
                    sbSql.Append("and a.shenfenzh ='" + zhengjianHm + "' ");
                }
                if (!string.IsNullOrEmpty(lianxiDh))
                {
                    sbSql.Append("and a.lianxirdh ='" + lianxiDh + "' ");
                }
                if (!string.IsNullOrEmpty(yuyuerq))
                {
                    sbSql.Append(" and to_char(a.yuyuesj,'yyyy-mm-dd') ='" + yuyuerq + "' ");
                }
                if (quHaoZt != "4")
                {
                    if (!string.IsNullOrEmpty(quHaoZt))
                    {
                        sbSql.Append(" and a.yuyuezt =" + quHaoZt + " ");
                    }
                }
                sbSql.Append(" order by a.caozuorq desc ");
                DataTable dt = DBVisitor.ExecuteTable(sbSql.ToString());
                if (dt.Rows.Count == 0)
                {
                    throw new Exception("未找到预约记录");
                }
                else
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        YUYUEXX yuyuexx = new YUYUEXX();
                        yuyuexx.YUYUEID   = dt.Rows[i]["yuyueid"].ToString();   //预约ID
                        yuyuexx.QUHAOMM   = dt.Rows[i]["quhaomm"].ToString();   //取号密码
                        yuyuexx.GUAHAOBC  = dt.Rows[i]["guahaobc"].ToString();  //挂号班次
                        yuyuexx.GUAHAOXH  = dt.Rows[i]["guahaoxh"].ToString();  //挂号序号
                        yuyuexx.JIUZHENSJ = dt.Rows[i]["jiuzhensj"].ToString(); //就诊时间
                        yuyuexx.KESHIDM   = dt.Rows[i]["keshidm"].ToString();   //科室代码
                        yuyuexx.KESHIMC   = dt.Rows[i]["keshimc"].ToString();   //科室名称
                        yuyuexx.YISHENGDM = dt.Rows[i]["yishengdm"].ToString(); //医生代码
                        yuyuexx.YISHENGXM = dt.Rows[i]["yishengxm"].ToString(); //医生姓名
                        yuyuexx.RIQI      = dt.Rows[i]["riqi"].ToString();      //就诊日期
                        yuyuexx.YUYUESJ   = dt.Rows[i]["caozuorq"].ToString();
                        yuyuexx.YUYUEZT   = dt.Rows[i]["yuyuezt"].ToString();
                        if (yuyuexx.YUYUEZT == "0")
                        {
                            yuyuexx.YUYUEZTSM = "未挂号";
                        }
                        else if (yuyuexx.YUYUEZT == "1")
                        {
                            yuyuexx.YUYUEZTSM = "已挂号";
                        }
                        else if (yuyuexx.YUYUEZT == "2")
                        {
                            yuyuexx.YUYUEZTSM = "预约取消";
                        }
                        else if (yuyuexx.YUYUEZT == "3")
                        {
                            yuyuexx.YUYUEZTSM = "预约过期";
                        }

                        string    paiBanID     = dt.Rows[i]["paibanid"].ToString();
                        string    shouFeiXMSql = "select zhenliaofxm,guahaofxm from mz_v_guahaopb_ex_zzj where paibanid = '{0}' ";
                        DataTable dtShouFeiXM  = DBVisitor.ExecuteTable(string.Format(shouFeiXMSql, paiBanID));
                        if (dtShouFeiXM.Rows.Count > 0)
                        {
                            string zhenLiaoFXM = dtShouFeiXM.Rows[0]["zhenliaofxm"].ToString();
                            string guaHaoFXM   = dtShouFeiXM.Rows[0]["guahaofxm"].ToString();
                            yuyuexx.GUAHAOF   = Unity.GetXiangMuFY(guaHaoFXM);
                            yuyuexx.ZHENLIAOF = Unity.GetXiangMuFY(zhenLiaoFXM);
                        }

                        OutObject.YUYUEMX.Add(yuyuexx);
                    }
                }
            }
        }
예제 #3
0
파일: RENYUANZC.cs 프로젝트: radtek/WCF
        public override void ProcessMessage()
        {
            string jiuzhenkLx    = InObject.JIUZHENKLX;         //就诊卡类型
            string jiuzhenKh     = InObject.JIUZHENKH;          //就诊卡号
            string bingrenLb     = InObject.BINGRENLB;          //病人类别
            string yibaokLx      = InObject.YIBAOKLX;           //医保卡类型
            string yibaokXx      = InObject.YIBAOKXX;           //医保卡信息
            string yibaokh       = InObject.YIBAOKH;            //医保卡号
            string gerenBh       = InObject.GERENBH;            //个人编号
            string bingliBh      = InObject.BINGLIBH;           //病历本号
            string xingMing      = InObject.XINGMING;           //姓名
            string xingBie       = InObject.XINGBIE;            //性别
            string minZu         = InObject.MINZU;              //民族
            string chushengRq    = InObject.CHUSHENGRQ;         //出生日期 YYYT-MM-DD
            string zhengjianLx   = InObject.ZHENGJIANLX;        //证件类型
            string zhengjianHm   = InObject.ZHENGJIANHM;        //证件号码
            string danweiLx      = InObject.DANWEILX;           //单位类型
            string danweiBh      = InObject.DANWEIBH;           //单位编号
            string danweiMc      = InObject.DANWEIMC;           //单位名称
            string jiatingZz     = InObject.JIATINGZZ;          //家庭住址
            string renyuanLb     = InObject.RENYUANLB;          //人员类别
            string lianxiDh      = InObject.LIANXIDH;           //联系电话
            string yinhangKh     = InObject.YINHANGKH;          //银行卡号
            string qianyueBz     = InObject.QIANYUEBZ;          //签约标识
            string yiliaoLb      = InObject.YILIAOLB;           //医疗类别
            string jiesuanLb     = InObject.JIESUANLB;          //结算类别
            string yibaokMm      = InObject.YIBAOKMM;           //医保卡密码
            string photo         = InObject.PHOTO;              //照片 二进制码流
            string shifouYk      = InObject.SHIFOUYK;           //是否有卡
            string bangdingYhk   = InObject.BANGDINGYHK;        //绑定银行卡
            string zhongduansbXx = InObject.ZHONGDUANSBXX;      //终端识别信息
            string bingrenXz     = InObject.BINGRENXZ;          //病人性质
            string chongzhiJe    = InObject.CHONGZHIJE;         //充值金额
            string zhifuFs       = InObject.ZHIFUFS;            //支付方式
            string jiandangRen   = InObject.BASEINFO.CAOZUOYDM; //建档人工号
            string caozuoRq      = InObject.BASEINFO.CAOZUORQ;  //操作日期
            string empiId        = InObject.EMPIID;             //实名制认证标识

            OutObject = new RENYUANZC_OUT();

            int  JIUZHENKCD   = Convert.ToInt32(ConfigurationManager.AppSettings["JIUZHENKCD"]);   //就诊卡默认长度
            char JIUZHENKTCZF = string.IsNullOrEmpty(ConfigurationManager.AppSettings["JIUZHENKTCZF"]) ? '0' :
                                ConfigurationManager.AppSettings["JIUZHENKTCZF"].ToCharArray()[0]; //就诊卡填充字符

            #region 基本入参判断
            if (string.IsNullOrEmpty(jiuzhenKh) && string.IsNullOrEmpty(yibaokh))
            {
                throw new Exception("就诊卡号和医保卡号不能同时为空!");
            }

            if (string.IsNullOrEmpty(jiuzhenKh))
            {
                jiuzhenKh = yibaokh;
            }

            if (string.IsNullOrEmpty(zhengjianHm))
            {
                throw new Exception("证件号码不能为空!");
            }

            if (string.IsNullOrEmpty(xingMing))
            {
                throw new Exception("病人姓名不能为空!");
            }
            if (string.IsNullOrEmpty(xingBie))
            {
                throw new Exception("病人性别不能为空!");
            }

            if (string.IsNullOrEmpty(chushengRq))
            {
                throw new Exception("出生日期不能为空!");
            }

            if (string.IsNullOrEmpty(jiatingZz))
            {
                throw new Exception("家庭住址不能为空!");
            }
            if (string.IsNullOrEmpty(lianxiDh))
            {
                throw new Exception("联系电话不能为空!");
            }
            #endregion

            #region 检查档案状态


            StringBuilder sbSql = new StringBuilder("select a.bingrenid,a.jiuzhenkh ,a.xingming ");
            sbSql.Append("from gy_v_bingrenxx a ,gy_zijinzh b where a.bingrenid = b.bingrenid(+) ");

            #region 就诊卡自动长度补全
            if (JIUZHENKCD > 0)
            {
                if (jiuzhenKh.Length < JIUZHENKCD)
                {
                    jiuzhenKh = jiuzhenKh.PadLeft(JIUZHENKCD, JIUZHENKTCZF);
                }
            }
            #endregion
            sbSql.Append(" and (a.jiuzhenkh='" + jiuzhenKh + "' or a.yibaokh='" + yibaokh + "' or nvl(a.shenfenzh,'*') = '" + zhengjianHm + "' ) ");
            sbSql.Append(" order by a.yibaokh asc, a.xiugaisj desc ");
            #endregion

            DataTable dtRenYuanXX = DBVisitor.ExecuteTable(sbSql.ToString());
            if (dtRenYuanXX == null || dtRenYuanXX.Rows.Count <= 0)
            {
                #region 建档

                string sqlStr     = "select FUN_GY_GETORDER('1', 'GY_BINGRENXX', 10) as bingrenid from dual ";
                string bingrenId  = DBVisitor.ExecuteScalar(sqlStr).ToString();
                string shoukuanRq = Convert.ToDateTime(caozuoRq).ToString("yyyy-MM-dd HH:mm:ss");
                string jiaoyanMa  = Unity.GetMD5(bingrenId + Convert.ToSingle(chongzhiJe).ToString("f4") + shoukuanRq + "1" + jiandangRen).ToLower();

                //医保卡信息特殊处理
                if (!string.IsNullOrEmpty(yibaokXx) && yibaokXx.Contains('$'))
                {
                    yibaokXx = yibaokXx.Replace('$', '&');
                }

                #region 医保病人需要转化获取所需的性质ID
                //联众医保yibaobrxz不填,要在包里取//add by renj
                //if (bingrenLb != "1")
                //{
                //    string sqlYb = string.Format("select xingzhiid from gy_feiyongxz where feiyonglb='{0}' and yibaobrxz='{1}'", bingrenLb, bingrenXz);
                //    bingrenXz = new DBServer().GetCurrData(sqlYb);
                //}
                #endregion
                #region 性别信息转换
                if (xingBie == "0")
                {
                    xingBie = "未知";
                }
                else if (xingBie == "1")
                {
                    xingBie = "男";
                }
                else if (xingBie == "2")
                {
                    xingBie = "女";
                }
                else
                {
                    xingBie = "其他";
                }
                #endregion

                #region 入参信息拼装
                //病人性质? 建档人?
                //数据库包中有建档自动开启电子账户功能 可通过注释包语句进行该功能的关闭
                string tradeMsgList = jiuzhenkLx + "|" + jiuzhenKh + "|" + bingrenLb + "|" + yibaokLx + "|" + yibaokXx + "|" + yibaokh + "|"
                                      + gerenBh + "|" + bingliBh + "|" + xingMing + "|" + xingBie + "|" + minZu + "|" + chushengRq + "|"
                                      + zhengjianLx + "|" + zhengjianHm + "|" + danweiLx + "|" + danweiBh + "|" + danweiMc + "|" + jiatingZz + "|"
                                      + renyuanLb + "|" + lianxiDh + "|" + yinhangKh + "|" + qianyueBz + "|" + yiliaoLb + "|" + jiesuanLb + "|"
                                      + yibaokMm + "|" + photo + "|" + shifouYk + "|" + bangdingYhk + "|" + zhongduansbXx + "|" + jiandangRen + "|"
                                      + chongzhiJe + "|" + bingrenId + "|" + zhifuFs + "|" + shoukuanRq + "|" + jiaoyanMa + "|" + bingrenXz + "|";

                //LogHelper.WriteLog(typeof(GG_JiaoYiBLL), "建档交易入参:" + tradeMsgList);//交易入参日志
                #endregion

                OracleParameter[] paramJiaoYi = new OracleParameter[3];
                paramJiaoYi[0]           = new OracleParameter("PRM_MSG", OracleType.VarChar);
                paramJiaoYi[0].Value     = tradeMsgList;
                paramJiaoYi[0].Direction = ParameterDirection.Input;
                paramJiaoYi[1]           = new OracleParameter("PRM_APPCODE", OracleType.Number);
                paramJiaoYi[1].Value     = null;
                paramJiaoYi[1].Direction = ParameterDirection.Output;
                paramJiaoYi[2]           = new OracleParameter("PRM_OUTBUFFER", OracleType.VarChar);
                paramJiaoYi[2].Value     = null;
                paramJiaoYi[2].Size      = 2000;
                paramJiaoYi[2].Direction = ParameterDirection.Output;

                string        returnValue = string.Empty;
                DbTransaction transaction = null;
                DbConnection  conn        = DBVisitor.Connection;
                try
                {
                    transaction = conn.BeginTransaction();
                    DBVisitor.ExecuteProcedure("PKG_GY_YINYIJK.PRC_BINGRENJD", paramJiaoYi, transaction);
                }
                catch (Exception ex)
                {
                    if (transaction != null)
                    {
                        transaction.Rollback();
                        //transaction.Connection.Close();
                    }
                    throw new Exception(ex.Message);
                }
                returnValue = paramJiaoYi[1].Value.ToString();
                string returnMsg = paramJiaoYi[2].Value.ToString();
                string zhanghuId = string.Empty;
                if (returnValue == "1")//建档及生成虚拟账户成功
                {
                    transaction.Commit();
                    //transaction.Connection.Close();
                    //zhanghuId = returnMsg.Split('|')[1];//账户ID
                    //此处需要处理返回成功的xml
                    OutObject.JIUZHENKH = jiuzhenKh;
                    OutObject.BINGRENID = bingrenId;
                    //OutObject.XUNIZH = zhanghuId;
                }
                else
                {
                    transaction.Rollback();
                    //transaction.Connection.Close();
                    throw new Exception(returnMsg);
                }
                #endregion
            }
            else
            {
                if (InObject.XINGMING != dtRenYuanXX.Rows[0]["xingming"].ToString())
                {
                    throw new Exception("该卡号和病人姓名不匹配,请核查!");
                }

                OutObject.JIUZHENKH = dtRenYuanXX.Rows[0]["jiuzhenkh"].ToString();
                OutObject.BINGRENID = dtRenYuanXX.Rows[0]["bingrenid"].ToString();
            }

            if (!string.IsNullOrEmpty(OutObject.BINGRENID) && !string.IsNullOrEmpty(empiId))
            {
                DBVisitor.ExecuteNonQuery(string.Format(" update gy_bingrenxx set empiid ='{0}' where bingrenid = '{1}' ", empiId, OutObject.BINGRENID));
            }
        }
예제 #4
0
        public override void ProcessMessage()
        {
            OutObject = new MENZHENFYMX_OUT();
            string jiuZhenKH  = InObject.JIUZHENKH;                               //就诊卡号
            string jiuZhenKLX = InObject.JIUZHENKLX;                              //就诊卡类型
            string bingRenLB  = InObject.BINGRENLB;                               //病人类别
            string bingRenXZ  = InObject.BINGRENXZ;                               //病人性质
            string chaXunFS   = InObject.CHAXUNFS;                                //查询方式

            string fenYuanDM   = InObject.BASEINFO.FENYUANDM;                     //分院代码
            string MZFYXXKYQHQ = ConfigurationManager.AppSettings["MZFYXXKYQHQ"]; //门诊费用明细 是否可以跨院区获取

            string fenYuanCXXX = string.Empty;

            #region 基础入参判断
            //就诊卡号
            if (string.IsNullOrEmpty(jiuZhenKH) && string.IsNullOrEmpty(InObject.BINGRENID))
            {
                throw new Exception("就诊卡号和病人ID不能同时为空!");
            }

            if (string.IsNullOrEmpty(MZFYXXKYQHQ))
            {
                MZFYXXKYQHQ = "0";
            }
            if (MZFYXXKYQHQ == "1")
            {
                fenYuanCXXX = string.Format(" and a.yuanquid = '{0}' ", fenYuanDM);
            }

            ////就诊卡类型
            //if (string.IsNullOrEmpty(jiuZhenKH))
            //{
            //    throw new Exception("就诊卡类型获取失败");
            //}

            ////病人类别
            //if (string.IsNullOrEmpty(bingRenLB))
            //{
            //    throw new Exception("病人类别获取失败");
            //}

            ////病人性质
            //if (string.IsNullOrEmpty(bingRenXZ))
            //{
            //    throw new Exception("病人性质获取失败");
            //}
            #endregion
            DataTable dt = null;
            #region 获取病人信息
            if (string.IsNullOrEmpty(InObject.BINGRENID))
            {
                dt = DBVisitor.ExecuteTable(string.Format("select bingrenid from gy_v_bingrenxx where jiuzhenkh = '{0}' or  yibaokh = '{0}' order by yibaokh asc, xiugaisj desc ", jiuZhenKH));
            }
            else
            {
                dt = DBVisitor.ExecuteTable(string.Format("select bingrenid from gy_v_bingrenxx where bingrenid ='{0}' order by yibaokh asc, xiugaisj desc ", InObject.BINGRENID));
            }
            string bingRenID = "";
            if (dt != null && dt.Rows.Count <= 0)
            {
                throw new Exception("病人信息获取错误");
            }
            else
            {
                bingRenID = dt.Rows[0]["bingrenid"].ToString();
            }
            #endregion

            #region 获取费用信息
            if (chaXunFS == "1")
            {
                #region 通过处方id和医技id进行检索费用明细
                string chuFangID = InObject.CHUFANGID;
                string yiJiID    = InObject.YIJIID;

                if (string.IsNullOrEmpty(chuFangID) && string.IsNullOrEmpty(yiJiID))
                {
                    throw new Exception("检索模式一(通过处方/医技id检索)时,处方id和医技id不能同时为空");
                }

                #region 获取处方数据
                if (!(string.IsNullOrEmpty(chuFangID)))
                {
                    chuFangID = chuFangID.Replace('|', ',');
                    //获取处方明细sql
                    StringBuilder sqlBuf = new StringBuilder();
                    sqlBuf.Append("select RPAD(nvl(a.kongzhisx,'0000'),4,'0') as kongzhisx,a.chufangid chufangxh,d.chufangmxid mingxixh,a.feiyonglb feiyonglx,l.yaopinid xiangmuxh,")
                    .Append("l.chandi xiangmucddm,l.yaopinmc xiangmumc,l.yaopinlx xiangmugl,m.daimamc xiangmuglmc,l.yaopingg xiangmugg,")
                    .Append("l.jixing xiangmujx,l.jiliangdw xiangmudw,l.candimc xiangmucdmc,l.baozhuangliang baozhuangsl,l.baozhuangdw,")
                    .Append("l.zuixiaodw zuixiaojldw,'' danciyl,'' yongliangdw,null meitiancs,d.yongyaots,l.fufangbz danfufbz,")
                    .Append("d.chufangts2 zhongcaoyts,d.jiesuanjia danjia,d.shuliang,d.jiesuanje jine,d.yibaodj,d.yibaodm,d.yibaozfbl,")
                    .Append("d.xianjia xiangmuxj,d.zifeije,d.zilije,d.shenpibh,d.zifeibz,0 teshuyybz,d.yibaoxx yibaoxmfzxx,d.yicijl dancisl,")
                    .Append("d.pinci pinlvsz,a.kaidanks kaidanksdm,a.kaidanksmc kaidanksmc,a.kaidanys kaidanysdm,a.kaidanysxm kaidanysxm,")
                    .Append("d.zifubl,to_char(a.kaidanriq,'yyyy-mm-dd hh24:mm:ss') kaidanrq,l.daguigid yaopindggxh,'' yaopindggcd,null yaopindggsl")
                    .Append("from mz_chufang1 a,gy_feiyonglb b,mz_chufang2 d,gy_yaopincdjg2 l,gy_xiangmulx m")
                    .Append("where b.leibieid(+)=a.feiyonglb and d.chufangid = a.chufangid {2} and a.bingrenid = '{0}' ")
                    .Append("and l.jiageid = d.jiageid and m.daimaid(+) = l.yaopinlx and a.chufangid in ({1})");

                    dt = DBVisitor.ExecuteTable(string.Format(sqlBuf.ToString(), bingRenID, chuFangID, fenYuanCXXX));

                    if (dt.Rows.Count > 0)
                    {
                        #region 费用明细拼装
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            var temp = new MENZHENFYXX();
                            temp.CHUFANGLX   = "1";                                  //处方类型
                            temp.CHUFANGXH   = dt.Rows[i]["CHUFANGXH"].ToString();   //处方序号
                            temp.MINGXIXH    = dt.Rows[i]["MINGXIXH"].ToString();    //明细序号
                            temp.FEIYONGLX   = dt.Rows[i]["FEIYONGLX"].ToString();   //费用类型
                            temp.XIANGMUXH   = dt.Rows[i]["XIANGMUXH"].ToString();   //项目序号
                            temp.XIANGMUCDDM = dt.Rows[i]["XIANGMUCDDM"].ToString(); //项目产品代码
                            temp.XIANGMUMC   = dt.Rows[i]["XIANGMUMC"].ToString();   //项目名称
                            temp.XIANGMUGL   = dt.Rows[i]["XIANGMUGL"].ToString();   //项目归类
                            temp.XIANGMUGLMC = dt.Rows[i]["XIANGMUGLMC"].ToString(); //项目归类名称
                            temp.XIANGMUGG   = dt.Rows[i]["XIANGMUGG"].ToString();   //项目规格
                            temp.XIANGMUJX   = dt.Rows[i]["XIANGMUJX"].ToString();   //项目剂型
                            temp.XIANGMUDW   = dt.Rows[i]["XIANGMUDW"].ToString();   //项目单位
                            temp.XIANGMUCDMC = dt.Rows[i]["XIANGMUCDMC"].ToString(); //项目产地名称
                            temp.BAOZHUANGSL = dt.Rows[i]["BAOZHUANGSL"].ToString(); //包装数量
                            temp.BAOZHUANGDW = dt.Rows[i]["BAOZHUANGDW"].ToString(); //包装单位
                            temp.ZUIXIAOJLDW = dt.Rows[i]["ZUIXIAOJLDW"].ToString(); //最小剂量单位
                            temp.DANCIYL     = dt.Rows[i]["DANCIYL"].ToString();     //单次用量
                            temp.YONGLIANGDW = dt.Rows[i]["YONGLIANGDW"].ToString(); //用量单位
                            temp.MEITIANCS   = dt.Rows[i]["MEITIANCS"].ToString();   //每天次数
                            temp.YONGYAOTS   = dt.Rows[i]["YONGYAOTS"].ToString();   //用药天数
                            temp.DANFUFBZ    = dt.Rows[i]["DANFUFBZ"].ToString();    //单复方标志
                            temp.ZHONGCAOYTS = dt.Rows[i]["ZHONGCAOYTS"].ToString(); //中草药贴数
                            temp.DANJIA      = dt.Rows[i]["DANJIA"].ToString();      //单价
                            temp.SHULIANG    = dt.Rows[i]["SHULIANG"].ToString();    //数量
                            temp.JINE        = dt.Rows[i]["JINE"].ToString();        //金额
                            temp.YIBAODJ     = dt.Rows[i]["YIBAODJ"].ToString();     //医保等级
                            temp.YIBAODM     = dt.Rows[i]["YIBAODM"].ToString();     //医保代码
                            temp.YIBAOZFBL   = dt.Rows[i]["YIBAOZFBL"].ToString();   //医保自负比例
                            temp.XIANGMUXJ   = dt.Rows[i]["XIANGMUXJ"].ToString();   //项目限价
                            temp.ZIFEIJE     = dt.Rows[i]["ZIFEIJE"].ToString();     //自费金额
                            temp.ZILIJE      = dt.Rows[i]["ZILIJE"].ToString();      //自理金额
                            temp.SHENGPIBH   = dt.Rows[i]["SHENGPIBH"].ToString();   //审批编号
                            temp.ZIFEIBZ     = dt.Rows[i]["ZIFEIBZ"].ToString();     //自费标志
                            temp.TESHUYYBZ   = dt.Rows[i]["TESHUYYBZ"].ToString();   //特殊用药标志
                            temp.YIBAOXMFZXX = dt.Rows[i]["YIBAOXMFZXX"].ToString(); //医保项目辅助信息
                            temp.DANCISL     = dt.Rows[i]["DANCISL"].ToString();     //单次数量
                            temp.PINLVSZ     = dt.Rows[i]["PINLVSZ"].ToString();     //频率数值
                            temp.KAIDANKSDM  = dt.Rows[i]["KAIDANKSDM"].ToString();  //开单科室代码
                            temp.KAIDANKSMC  = dt.Rows[i]["KAIDANKSMC"].ToString();  //开单科室名称
                            temp.KAIDANYSDM  = dt.Rows[i]["KAIDANYSDM"].ToString();  //开单医生代码
                            temp.KAIDANYSXM  = dt.Rows[i]["KAIDANYSXM"].ToString();  //开单医生姓名
                            temp.ZIFUBL      = dt.Rows[i]["ZIFUBL"].ToString();      //自负比例
                            temp.KAIDANRQ    = dt.Rows[i]["KAIDANRQ"].ToString();    //开单日期
                            temp.YAOPINDGGXH = dt.Rows[i]["YAOPINDGGXH"].ToString(); //药品大规格序号
                            temp.YAOPINDGGCD = dt.Rows[i]["YAOPINDGGCD"].ToString(); //药品大规格产地
                            temp.YAOPINDGGSL = dt.Rows[i]["YAOPINDGGSL"].ToString(); //药品大规格数量
                            temp.KONGZHISX   = dt.Rows[i]["kongzhisx"].ToString();
                            switch (temp.KONGZHISX)
                            {
                            case "0100":
                                temp.KONGZHISX   = "02";
                                temp.KONGZHISXMC = "特病";
                                break;

                            case "0010":
                                temp.KONGZHISX   = "03";
                                temp.KONGZHISXMC = "生育";
                                break;

                            default:
                                temp.KONGZHISX   = "00";
                                temp.KONGZHISXMC = "普通";
                                break;
                            }
                            OutObject.FEIYONGMX.Add(temp);
                        }
                        #endregion
                    }
                }
                #endregion

                #region 获取医技数据
                if (!(string.IsNullOrEmpty(yiJiID)))
                {
                    yiJiID.Replace('|', ',');
                    StringBuilder sqlBuf = new StringBuilder();
                    sqlBuf.Append("select nvl(RPAD(nvl(a.kongzhisx,(select RPAD(nvl(cf.kongzhisx, '0000'), 4, '0') From mz_chufang1 cf where cf.chufangid = a.guanlianid)),4,'0'),'0000') as kongzhisx,")
                    .Append("a.yijiid chufangxh,d.yijimxid mingxixh,a.feiyonglb feiyonglx, l.shoufeixmid xiangmuxh,'' xiangmucddm, ")
                    .Append("l.shoufeixmmc xiangmumc,'' xiangmugl,'' XIANGMUGLMC,'' xiangmugg,null xiangmujx,l.jijiadw xiangmudw, ")
                    .Append("'' xiangmucdmc,null baozhuangsl,'' baozhuangdw,'' zuixiaojldw,'' danciyl,'' yongliangdw, ")
                    .Append("null meitiancs,null yongyaots,null danfufbz,null zhongcaoyts, d.jiesuanjia danjia,d.shuliang,d.jiesuanje jine,d.yibaodj, ")
                    .Append("d.yibaodm,d.yibaozfbl,d.xianjia xiangmuxj,d.zifeije,d.zilije,d.shenpibh,d.zifeibz,0 teshuyybz,d.yibaoxx yibaoxmfzxx,d.shuliang dancisl, ")
                    .Append("null pinlvsz,a.kaidanks kaidanksdm,a.kaidanksmc kaidanksmc,a.kaidanys kaidanysdm,a.kaidanysxm kaidanysxm,d.zifubl, ")
                    .Append("to_char(a.kaidanrq,'yyyy-mm-dd hh24:mi:ss')kaidanrq,'' yaopindggxh,'' yaopindggcd,null yaopindggsl ")
                    .Append("from mz_yiji1 a,gy_feiyonglb b,mz_yiji2 d,gy_shoufeixm l ")
                    .Append("where b.leibieid(+)=a.feiyonglb ")
                    .Append("and d.yijiid=a.yijiid and l.shoufeixmid = d.shoufeixm and  a.bingrenid = '{0}'")
                    .Append("and a.yijiid in ({1}) {2} ;");

                    dt = DBVisitor.ExecuteTable(string.Format(sqlBuf.ToString(), bingRenID, chuFangID, fenYuanCXXX));

                    if (dt.Rows.Count > 0)
                    {
                        #region 费用明细拼装
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            var temp = new MENZHENFYXX();
                            temp.CHUFANGLX   = "0";                                  //处方类型
                            temp.CHUFANGXH   = dt.Rows[i]["CHUFANGXH"].ToString();   //处方序号
                            temp.MINGXIXH    = dt.Rows[i]["MINGXIXH"].ToString();    //明细序号
                            temp.FEIYONGLX   = dt.Rows[i]["FEIYONGLX"].ToString();   //费用类型
                            temp.XIANGMUXH   = dt.Rows[i]["XIANGMUXH"].ToString();   //项目序号
                            temp.XIANGMUCDDM = dt.Rows[i]["XIANGMUCDDM"].ToString(); //项目产品代码
                            temp.XIANGMUMC   = dt.Rows[i]["XIANGMUMC"].ToString();   //项目名称
                            temp.XIANGMUGL   = dt.Rows[i]["XIANGMUGL"].ToString();   //项目归类
                            temp.XIANGMUGLMC = dt.Rows[i]["XIANGMUGLMC"].ToString(); //项目归类名称
                            temp.XIANGMUGG   = dt.Rows[i]["XIANGMUGG"].ToString();   //项目规格
                            temp.XIANGMUJX   = dt.Rows[i]["XIANGMUJX"].ToString();   //项目剂型
                            temp.XIANGMUDW   = dt.Rows[i]["XIANGMUDW"].ToString();   //项目单位
                            temp.XIANGMUCDMC = dt.Rows[i]["XIANGMUCDMC"].ToString(); //项目产地名称
                            temp.BAOZHUANGSL = dt.Rows[i]["BAOZHUANGSL"].ToString(); //包装数量
                            temp.BAOZHUANGDW = dt.Rows[i]["BAOZHUANGDW"].ToString(); //包装单位
                            temp.ZUIXIAOJLDW = dt.Rows[i]["ZUIXIAOJLDW"].ToString(); //最小剂量单位
                            temp.DANCIYL     = dt.Rows[i]["DANCIYL"].ToString();     //单次用量
                            temp.YONGLIANGDW = dt.Rows[i]["YONGLIANGDW"].ToString(); //用量单位
                            temp.MEITIANCS   = dt.Rows[i]["MEITIANCS"].ToString();   //每天次数
                            temp.YONGYAOTS   = dt.Rows[i]["YONGYAOTS"].ToString();   //用药天数
                            temp.DANFUFBZ    = dt.Rows[i]["DANFUFBZ"].ToString();    //单复方标志
                            temp.ZHONGCAOYTS = dt.Rows[i]["ZHONGCAOYTS"].ToString(); //中草药贴数
                            temp.DANJIA      = dt.Rows[i]["DANJIA"].ToString();      //单价
                            temp.SHULIANG    = dt.Rows[i]["SHULIANG"].ToString();    //数量
                            temp.JINE        = dt.Rows[i]["JINE"].ToString();        //金额
                            temp.YIBAODJ     = dt.Rows[i]["YIBAODJ"].ToString();     //医保等级
                            temp.YIBAODM     = dt.Rows[i]["YIBAODM"].ToString();     //医保代码
                            temp.YIBAOZFBL   = dt.Rows[i]["YIBAOZFBL"].ToString();   //医保自负比例
                            temp.XIANGMUXJ   = dt.Rows[i]["XIANGMUXJ"].ToString();   //项目限价
                            temp.ZIFEIJE     = dt.Rows[i]["ZIFEIJE"].ToString();     //自费金额
                            temp.ZILIJE      = dt.Rows[i]["ZILIJE"].ToString();      //自理金额
                            temp.SHENGPIBH   = dt.Rows[i]["SHENGPIBH"].ToString();   //审批编号
                            temp.ZIFEIBZ     = dt.Rows[i]["ZIFEIBZ"].ToString();     //自费标志
                            temp.TESHUYYBZ   = dt.Rows[i]["TESHUYYBZ"].ToString();   //特殊用药标志
                            temp.YIBAOXMFZXX = dt.Rows[i]["YIBAOXMFZXX"].ToString(); //医保项目辅助信息
                            temp.DANCISL     = dt.Rows[i]["DANCISL"].ToString();     //单次数量
                            temp.PINLVSZ     = dt.Rows[i]["PINLVSZ"].ToString();     //频率数值
                            temp.KAIDANKSDM  = dt.Rows[i]["KAIDANKSDM"].ToString();  //开单科室代码
                            temp.KAIDANKSMC  = dt.Rows[i]["KAIDANKSMC"].ToString();  //开单科室名称
                            temp.KAIDANYSDM  = dt.Rows[i]["KAIDANYSDM"].ToString();  //开单医生代码
                            temp.KAIDANYSXM  = dt.Rows[i]["KAIDANYSXM"].ToString();  //开单医生姓名
                            temp.ZIFUBL      = dt.Rows[i]["ZIFUBL"].ToString();      //自负比例
                            temp.KAIDANRQ    = dt.Rows[i]["KAIDANRQ"].ToString();    //开单日期
                            temp.YAOPINDGGXH = dt.Rows[i]["YAOPINDGGXH"].ToString(); //药品大规格序号
                            temp.YAOPINDGGCD = dt.Rows[i]["YAOPINDGGCD"].ToString(); //药品大规格产地
                            temp.YAOPINDGGSL = dt.Rows[i]["YAOPINDGGSL"].ToString(); //药品大规格数量
                            temp.KONGZHISX   = dt.Rows[i]["kongzhisx"].ToString();
                            switch (temp.KONGZHISX)
                            {
                            case "0100":
                                temp.KONGZHISX   = "02";
                                temp.KONGZHISXMC = "特病";
                                break;

                            case "0010":
                                temp.KONGZHISX   = "03";
                                temp.KONGZHISXMC = "生育";
                                break;

                            default:
                                temp.KONGZHISX   = "00";
                                temp.KONGZHISXMC = "普通";
                                break;
                            }
                            OutObject.FEIYONGMX.Add(temp);
                        }
                        #endregion
                    }
                }
                #endregion
                #endregion
            }
            else
            {
                #region 普通方式检索费用明细
                #region 获取处方医技有效天数
                //1手工处方2手工医技3电子处方4电子检验检查其他5处置6体检接口7代收挂号诊疗费中间用|分隔;0无穷天
                string youxiaoTs   = Unity.GetYouXiaoTs();
                string chuFangYXTS = youxiaoTs.Split('|')[0].ToString(); //处方有效天数
                string yiJiYXTS    = youxiaoTs.Split('|')[1].ToString(); //医技有效天数
                #endregion

                #region 获取处方数据
                StringBuilder sqlBufCF = new StringBuilder();
                sqlBufCF.Append(@"select chufanglx,shoufeibz,jiaoyilx,chongxiaobz,bingrenid,
                                         yuanquid,kongzhisx,chufangxh,mingxixh,feiyonglx,
                                         xiangmuxh,xiangmucddm,xiangmumc,xiangmugl,xiangmuglmc,
                                         xiangmugg,xiangmujx,xiangmudw,xiangmucdmc,baozhuangsl,
                                         baozhuangdw,zuixiaojldw,danciyl,yongliangdw,meitiancs,
                                         yongyaots,danfufbz,zhongcaoyts,danjia,shuliang,
                                         jine,yibaodj,yibaodm,yibaozfbl,xiangmuxj,
                                         zifeije,zilije,shenpibh,zifeibz,teshuyybz,
                                         yibaoxmfzxx,dancisl,pinlvsz,kaidanksdm,kaidanksmc,
                                         kaidanysdm,kaidanysxm,zifubl,to_char(kaidanrq,'yyyy-mm-dd hh24:mi:ss') kaidanrq,yaopindggxh,
                                         yaopindggcd,yaopindggsl 
                                from v_mz_shoufeixx_zzj a where a.shoufeibz=0 and a.jiaoyilx=1 and a.chongxiaobz = 0 and a.chufanglx = 1 and a.bingrenid = '{0}' {2} ");
                if (!string.IsNullOrEmpty(chuFangYXTS) && chuFangYXTS != "0")
                {
                    sqlBufCF.Append("and a.KAIDANRQ > sysdate- {1} ");
                }
                dt = DBVisitor.ExecuteTable(string.Format(sqlBufCF.ToString(), bingRenID, chuFangYXTS, fenYuanCXXX));

                if (dt.Rows.Count > 0)
                {
                    #region 费用明细拼装
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        var temp = new MENZHENFYXX();
                        temp.CHUFANGLX   = dt.Rows[i]["chufanglx"].ToString();   //处方类型
                        temp.CHUFANGXH   = dt.Rows[i]["CHUFANGXH"].ToString();   //处方序号
                        temp.MINGXIXH    = dt.Rows[i]["MINGXIXH"].ToString();    //明细序号
                        temp.FEIYONGLX   = dt.Rows[i]["FEIYONGLX"].ToString();   //费用类型
                        temp.XIANGMUXH   = dt.Rows[i]["XIANGMUXH"].ToString();   //项目序号
                        temp.XIANGMUCDDM = dt.Rows[i]["XIANGMUCDDM"].ToString(); //项目产品代码
                        temp.XIANGMUMC   = dt.Rows[i]["XIANGMUMC"].ToString();   //项目名称
                        temp.XIANGMUGL   = dt.Rows[i]["XIANGMUGL"].ToString();   //项目归类
                        temp.XIANGMUGLMC = dt.Rows[i]["XIANGMUGLMC"].ToString(); //项目归类名称
                        temp.XIANGMUGG   = dt.Rows[i]["XIANGMUGG"].ToString();   //项目规格
                        temp.XIANGMUJX   = dt.Rows[i]["XIANGMUJX"].ToString();   //项目剂型
                        temp.XIANGMUDW   = dt.Rows[i]["XIANGMUDW"].ToString();   //项目单位
                        temp.XIANGMUCDMC = dt.Rows[i]["XIANGMUCDMC"].ToString(); //项目产地名称
                        temp.BAOZHUANGSL = dt.Rows[i]["BAOZHUANGSL"].ToString(); //包装数量
                        temp.BAOZHUANGDW = dt.Rows[i]["BAOZHUANGDW"].ToString(); //包装单位
                        temp.ZUIXIAOJLDW = dt.Rows[i]["ZUIXIAOJLDW"].ToString(); //最小剂量单位
                        temp.DANCIYL     = dt.Rows[i]["DANCIYL"].ToString();     //单次用量
                        temp.YONGLIANGDW = dt.Rows[i]["YONGLIANGDW"].ToString(); //用量单位
                        temp.MEITIANCS   = dt.Rows[i]["MEITIANCS"].ToString();   //每天次数
                        temp.YONGYAOTS   = dt.Rows[i]["YONGYAOTS"].ToString();   //用药天数
                        temp.DANFUFBZ    = dt.Rows[i]["DANFUFBZ"].ToString();    //单复方标志
                        temp.ZHONGCAOYTS = dt.Rows[i]["ZHONGCAOYTS"].ToString(); //中草药贴数
                        temp.DANJIA      = dt.Rows[i]["DANJIA"].ToString();      //单价
                        temp.SHULIANG    = dt.Rows[i]["SHULIANG"].ToString();    //数量
                        temp.JINE        = dt.Rows[i]["JINE"].ToString();        //金额
                        temp.YIBAODJ     = dt.Rows[i]["YIBAODJ"].ToString();     //医保等级
                        temp.YIBAODM     = dt.Rows[i]["YIBAODM"].ToString();     //医保代码
                        temp.YIBAOZFBL   = dt.Rows[i]["YIBAOZFBL"].ToString();   //医保自负比例
                        temp.XIANGMUXJ   = dt.Rows[i]["XIANGMUXJ"].ToString();   //项目限价
                        temp.ZIFEIJE     = dt.Rows[i]["ZIFEIJE"].ToString();     //自费金额
                        temp.ZILIJE      = dt.Rows[i]["ZILIJE"].ToString();      //自理金额
                        //temp.SHENGPIBH = dt.Rows[i]["SHENGPIBH"].ToString(); //审批编号
                        temp.ZIFEIBZ     = dt.Rows[i]["ZIFEIBZ"].ToString();     //自费标志
                        temp.TESHUYYBZ   = dt.Rows[i]["TESHUYYBZ"].ToString();   //特殊用药标志
                        temp.YIBAOXMFZXX = dt.Rows[i]["YIBAOXMFZXX"].ToString(); //医保项目辅助信息
                        temp.DANCISL     = dt.Rows[i]["DANCISL"].ToString();     //单次数量
                        temp.PINLVSZ     = dt.Rows[i]["PINLVSZ"].ToString();     //频率数值
                        temp.KAIDANKSDM  = dt.Rows[i]["KAIDANKSDM"].ToString();  //开单科室代码
                        temp.KAIDANKSMC  = dt.Rows[i]["KAIDANKSMC"].ToString();  //开单科室名称
                        temp.KAIDANYSDM  = dt.Rows[i]["KAIDANYSDM"].ToString();  //开单医生代码
                        temp.KAIDANYSXM  = dt.Rows[i]["KAIDANYSXM"].ToString();  //开单医生姓名
                        temp.ZIFUBL      = dt.Rows[i]["ZIFUBL"].ToString();      //自负比例
                        temp.KAIDANRQ    = dt.Rows[i]["KAIDANRQ"].ToString();    //开单日期
                        temp.YAOPINDGGXH = dt.Rows[i]["YAOPINDGGXH"].ToString(); //药品大规格序号
                        temp.YAOPINDGGCD = dt.Rows[i]["YAOPINDGGCD"].ToString(); //药品大规格产地
                        temp.YAOPINDGGSL = dt.Rows[i]["YAOPINDGGSL"].ToString(); //药品大规格数量
                        temp.KONGZHISX   = dt.Rows[i]["kongzhisx"].ToString();
                        switch (temp.KONGZHISX)
                        {
                        case "0100":
                            temp.KONGZHISX   = "02";
                            temp.KONGZHISXMC = "特病";
                            break;

                        case "0010":
                            temp.KONGZHISX   = "03";
                            temp.KONGZHISXMC = "生育";
                            break;

                        default:
                            temp.KONGZHISX   = "00";
                            temp.KONGZHISXMC = "普通";
                            break;
                        }
                        OutObject.FEIYONGMX.Add(temp);
                    }
                    #endregion
                }
                #endregion

                #region 获取医技数据
                StringBuilder sqlBufYJ = new StringBuilder();
                sqlBufYJ.Append(@"select chufanglx,shoufeibz,jiaoyilx,chongxiaobz,bingrenid,
                                         yuanquid,kongzhisx,chufangxh,mingxixh,feiyonglx,
                                         xiangmuxh,xiangmucddm,xiangmumc,xiangmugl,xiangmuglmc,
                                         xiangmugg,xiangmujx,xiangmudw,xiangmucdmc,baozhuangsl,
                                         baozhuangdw,zuixiaojldw,danciyl,yongliangdw,meitiancs,
                                         yongyaots,danfufbz,zhongcaoyts,danjia,shuliang,
                                         jine,yibaodj,yibaodm,yibaozfbl,xiangmuxj,
                                         zifeije,zilije,shenpibh,zifeibz,teshuyybz,
                                         yibaoxmfzxx,dancisl,pinlvsz,kaidanksdm,kaidanksmc,
                                         kaidanysdm,kaidanysxm,zifubl,to_char(kaidanrq,'yyyy-mm-dd hh24:mi:ss') kaidanrq,yaopindggxh,
                                         yaopindggcd,yaopindggsl 
                                from v_mz_shoufeixx_zzj a where a.shoufeibz=0 and a.jiaoyilx=1 and a.chongxiaobz = 0 and a.chufanglx = 0 and a.bingrenid = '{0}' {2}  ");
                if (!string.IsNullOrEmpty(yiJiYXTS) && yiJiYXTS != "0")
                {
                    sqlBufYJ.Append("and a.KAIDANRQ > sysdate-{1} ");
                }

                dt = DBVisitor.ExecuteTable(string.Format(sqlBufYJ.ToString(), bingRenID, yiJiYXTS, fenYuanCXXX));

                if (dt.Rows.Count > 0)
                {
                    #region 费用明细拼装
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        var temp = new MENZHENFYXX();
                        temp.CHUFANGLX   = dt.Rows[i]["chufanglx"].ToString();   //处方类型
                        temp.CHUFANGXH   = dt.Rows[i]["CHUFANGXH"].ToString();   //处方序号
                        temp.MINGXIXH    = dt.Rows[i]["MINGXIXH"].ToString();    //明细序号
                        temp.FEIYONGLX   = dt.Rows[i]["FEIYONGLX"].ToString();   //费用类型
                        temp.XIANGMUXH   = dt.Rows[i]["XIANGMUXH"].ToString();   //项目序号
                        temp.XIANGMUCDDM = dt.Rows[i]["XIANGMUCDDM"].ToString(); //项目产品代码
                        temp.XIANGMUMC   = dt.Rows[i]["XIANGMUMC"].ToString();   //项目名称
                        temp.XIANGMUGL   = dt.Rows[i]["XIANGMUGL"].ToString();   //项目归类
                        temp.XIANGMUGLMC = dt.Rows[i]["XIANGMUGLMC"].ToString(); //项目归类名称
                        temp.XIANGMUGG   = dt.Rows[i]["XIANGMUGG"].ToString();   //项目规格
                        temp.XIANGMUJX   = dt.Rows[i]["XIANGMUJX"].ToString();   //项目剂型
                        temp.XIANGMUDW   = dt.Rows[i]["XIANGMUDW"].ToString();   //项目单位
                        temp.XIANGMUCDMC = dt.Rows[i]["XIANGMUCDMC"].ToString(); //项目产地名称
                        temp.BAOZHUANGSL = dt.Rows[i]["BAOZHUANGSL"].ToString(); //包装数量
                        temp.BAOZHUANGDW = dt.Rows[i]["BAOZHUANGDW"].ToString(); //包装单位
                        temp.ZUIXIAOJLDW = dt.Rows[i]["ZUIXIAOJLDW"].ToString(); //最小剂量单位
                        temp.DANCIYL     = dt.Rows[i]["DANCIYL"].ToString();     //单次用量
                        temp.YONGLIANGDW = dt.Rows[i]["YONGLIANGDW"].ToString(); //用量单位
                        temp.MEITIANCS   = dt.Rows[i]["MEITIANCS"].ToString();   //每天次数
                        temp.YONGYAOTS   = dt.Rows[i]["YONGYAOTS"].ToString();   //用药天数
                        temp.DANFUFBZ    = dt.Rows[i]["DANFUFBZ"].ToString();    //单复方标志
                        temp.ZHONGCAOYTS = dt.Rows[i]["ZHONGCAOYTS"].ToString(); //中草药贴数
                        temp.DANJIA      = dt.Rows[i]["DANJIA"].ToString();      //单价
                        temp.SHULIANG    = dt.Rows[i]["SHULIANG"].ToString();    //数量
                        temp.JINE        = dt.Rows[i]["JINE"].ToString();        //金额
                        temp.YIBAODJ     = dt.Rows[i]["YIBAODJ"].ToString();     //医保等级
                        temp.YIBAODM     = dt.Rows[i]["YIBAODM"].ToString();     //医保代码
                        temp.YIBAOZFBL   = dt.Rows[i]["YIBAOZFBL"].ToString();   //医保自负比例
                        temp.XIANGMUXJ   = dt.Rows[i]["XIANGMUXJ"].ToString();   //项目限价
                        temp.ZIFEIJE     = dt.Rows[i]["ZIFEIJE"].ToString();     //自费金额
                        temp.ZILIJE      = dt.Rows[i]["ZILIJE"].ToString();      //自理金额
                        //temp.SHENGPIBH = dt.Rows[i]["SHENGPIBH"].ToString(); //审批编号
                        temp.ZIFEIBZ     = dt.Rows[i]["ZIFEIBZ"].ToString();     //自费标志
                        temp.TESHUYYBZ   = dt.Rows[i]["TESHUYYBZ"].ToString();   //特殊用药标志
                        temp.YIBAOXMFZXX = dt.Rows[i]["YIBAOXMFZXX"].ToString(); //医保项目辅助信息
                        temp.DANCISL     = dt.Rows[i]["DANCISL"].ToString();     //单次数量
                        temp.PINLVSZ     = dt.Rows[i]["PINLVSZ"].ToString();     //频率数值
                        temp.KAIDANKSDM  = dt.Rows[i]["KAIDANKSDM"].ToString();  //开单科室代码
                        temp.KAIDANKSMC  = dt.Rows[i]["KAIDANKSMC"].ToString();  //开单科室名称
                        temp.KAIDANYSDM  = dt.Rows[i]["KAIDANYSDM"].ToString();  //开单医生代码
                        temp.KAIDANYSXM  = dt.Rows[i]["KAIDANYSXM"].ToString();  //开单医生姓名
                        temp.ZIFUBL      = dt.Rows[i]["ZIFUBL"].ToString();      //自负比例
                        temp.KAIDANRQ    = dt.Rows[i]["KAIDANRQ"].ToString();    //开单日期
                        temp.YAOPINDGGXH = dt.Rows[i]["YAOPINDGGXH"].ToString(); //药品大规格序号
                        temp.YAOPINDGGCD = dt.Rows[i]["YAOPINDGGCD"].ToString(); //药品大规格产地
                        temp.YAOPINDGGSL = dt.Rows[i]["YAOPINDGGSL"].ToString(); //药品大规格数量
                        temp.KONGZHISX   = dt.Rows[i]["kongzhisx"].ToString();
                        switch (temp.KONGZHISX)
                        {
                        case "0100":
                            temp.KONGZHISX   = "02";
                            temp.KONGZHISXMC = "特病";
                            break;

                        case "0010":
                            temp.KONGZHISX   = "03";
                            temp.KONGZHISXMC = "生育";
                            break;

                        default:
                            temp.KONGZHISX   = "00";
                            temp.KONGZHISXMC = "普通";
                            break;
                        }
                        OutObject.FEIYONGMX.Add(temp);
                    }
                    #endregion
                }
                #endregion
                #endregion
            }

            #region 获取医保自负比例

            #endregion
            if (OutObject.FEIYONGMX != null)
            {
                OutObject.FEIYONGMXTS = OutObject.FEIYONGMX.Count;
            }
            else
            {
                OutObject.FEIYONGMXTS = 0;
            }
            #endregion

            #region 获取疾病信息
            StringBuilder sqlBufJBXX = new StringBuilder(); //疾病信息
            sqlBufJBXX.Append("select jibingid jibingdm,icd10 jibingicd,jibingmc,'' jibingms from gy_jibingdm where jibingid in (  ")
            .Append("select SUBSTR(a.linchuangzd,0,INSTR(a.linchuangzd,'|',1,1)-1) from zj_jiuzhenxx a ,mz_guahao1 b where a.yuanquid = '{0}' ")
            .Append("and a.guahaoid = b.guahaoid and a.linchuangzd is not null and a.bingrenid = '{1}' ) ");
            dt = DBVisitor.ExecuteTable(string.Format(sqlBufJBXX.ToString(), fenYuanDM, bingRenID));

            if (dt.Rows.Count <= 0)
            {
                #region 获取默认疾病信息

                //var jbxx = new JIBINGXX();
                //jbxx.JIBINGDM = dt.Rows[i]["JIBINGDM"].ToString();//疾病代码
                //jbxx.JIBINGICD = dt.Rows[i]["JIBINGICD"].ToString();//疾病ICD
                //jbxx.JIBINGMC = dt.Rows[i]["JIBINGMC"].ToString();//疾病名称
                //jbxx.JIBINGMS = dt.Rows[i]["JIBINGMS"].ToString();//疾病描述
                //OutObject.JIBINGMX.Add(jbxx);
                #endregion
            }
            else if (dt.Rows.Count > 0)
            {
                #region 疾病信息拼装
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var jbxx = new JIBINGXX();
                    jbxx.JIBINGDM  = dt.Rows[i]["JIBINGDM"].ToString();  //疾病代码
                    jbxx.JIBINGICD = dt.Rows[i]["JIBINGICD"].ToString(); //疾病ICD
                    jbxx.JIBINGMC  = dt.Rows[i]["JIBINGMC"].ToString();  //疾病名称
                    jbxx.JIBINGMS  = dt.Rows[i]["JIBINGMS"].ToString();  //疾病描述
                    OutObject.JIBINGMX.Add(jbxx);
                }
                #endregion
            }
            #endregion

            //医疗类别
            OutObject.YILIAOLB = InObject.YILIAOLB;
        }
예제 #5
0
        public override void ProcessMessage()
        {
            OutObject = new YIYUANPAIBANXX_OUT();
            string guaHaoFS  = InObject.GUAHAOFS;  //1 挂号 2 预约
            string riQi      = InObject.RIQI;      //日期
            string guaHaoBC  = InObject.GUAHAOBC;  //挂号班次 0 全天 1上午 2下午
            string keShiDM   = InObject.KESHIDM;   //科室代码
            string yiShengDM = InObject.YISHENGDM; //医生代码
            string guaHaoLB  = InObject.GUAHAOLB;  //挂号类别
            string yuYueLX   = InObject.YUYUELX;   //预约类型

            #region 基本入参判断
            if (string.IsNullOrEmpty(guaHaoFS))
            {
                throw new Exception("挂号方式不能为空!");
            }
            else if (guaHaoFS != "1" && guaHaoFS != "2")
            {
                throw new Exception("请传入正确的挂号方式,1 当天挂号 2 挂号预约!");
            }

            if (string.IsNullOrEmpty(guaHaoBC))
            {
                throw new Exception("挂号班次不能为空!");
            }
            else if (guaHaoBC != "0" && guaHaoBC != "1" && guaHaoBC != "2")
            {
                throw new Exception("请传入正确的挂号班次,0 全天 1 上午 2 下午");
            }

            if (guaHaoFS == "2" && string.IsNullOrEmpty(yuYueLX))
            {
                yuYueLX = ConfigurationManager.AppSettings["GuaHaoYYLX"];
            }

            if (guaHaoFS == "1" && string.IsNullOrEmpty(riQi))
            {
                riQi = DateTime.Now.ToString("yyyy-MM-dd");
            }
            #endregion
            StringBuilder sqlPaiBanXX = new StringBuilder();
            if (guaHaoFS == "1")
            {
                #region 当天挂号
                if (guaHaoBC == "0")
                {
                    sqlPaiBanXX.Append(" select * from ( ");
                }
                if (guaHaoBC == "1" || guaHaoBC == "0")
                {
                    sqlPaiBanXX.Append(" select A.PAIBANID,to_Char(A.RIQI,'yyyy-mm-dd') as PAIBANRQ,a.GUAHAOLB,1 as GUAHAOBC,A.KESHIID,C.keshimc,NVL(A.WEIZHI,C.weizhism) as JIUZHENDD, ");
                    sqlPaiBanXX.Append(" c.keshizl as KESHIJS,nvl(a.YISHENGID,'*') as YISHENGDM,nvl(d.zhigongxm,'普通') as YISHENGXM , e.daimamc as YISHENGZC,a.ZHENLIAOFXM,a.GUAHAOFXM, ");
                    sqlPaiBanXX.Append(" NVL(a.SHANGWUXH,0) AS HAOYUANZS,NVL(a.SHANGWUXH,0)-NVL(a.SHANGWUYGH,0) AS SHENGYUHY ,'' as YUYUELX ");
                    sqlPaiBanXX.Append(" from mz_v_guahaopb_ex_zzj a ,v_gy_keshi c,v_gy_zhigongxx d , ");
                    sqlPaiBanXX.Append(" (select * from gy_daima where daimalb='0072') e  ");
                    sqlPaiBanXX.Append(" where a.keshiid=c.keshiid and d.zhigongid(+) = a.YISHENGID and e.daimaid(+) = d.zhicheng  ");

                    sqlPaiBanXX.Append(" and to_char(a.riqi,'yyyy-mm-dd')='" + riQi + "' ");
                    sqlPaiBanXX.Append("  and a.shangwuxh > 0 ");
                    if (!string.IsNullOrEmpty(keShiDM))
                    {
                        sqlPaiBanXX.Append(" and nvl(a.keshiid,'*') = '" + keShiDM + "' ");
                    }
                    if (!string.IsNullOrEmpty(yiShengDM))
                    {
                        sqlPaiBanXX.Append(" and nvl(a.yishengid,'*') = '" + yiShengDM + "' ");
                    }
                    if (!string.IsNullOrEmpty(guaHaoLB) && guaHaoLB != "0")
                    {
                        sqlPaiBanXX.Append(" and a.guahaolb = " + guaHaoLB + " ");
                    }
                }
                if (guaHaoBC == "0")
                {
                    sqlPaiBanXX.Append(" union all ");
                }
                if (guaHaoBC == "2" || guaHaoBC == "0")
                {
                    sqlPaiBanXX.Append(" select A.PAIBANID,to_Char(A.RIQI,'yyyy-mm-dd') as PAIBANRQ,a.GUAHAOLB,2 as GUAHAOBC,A.KESHIID,C.keshimc,NVL(A.WEIZHI,C.weizhism) as JIUZHENDD, ");
                    sqlPaiBanXX.Append(" c.keshizl as KESHIJS,nvl(a.YISHENGID,'*') as YISHENGDM,nvl(d.zhigongxm,'普通') as YISHENGXM , e.daimamc as YISHENGZC,a.ZHENLIAOFXM,a.GUAHAOFXM, ");
                    sqlPaiBanXX.Append(" NVL(a.XIAWUXH,0) AS HAOYUANZS,NVL(a.XIAWUXH,0)-NVL(a.XIAWUYGH,0) AS SHENGYUHY, '' as YUYUELX ");
                    sqlPaiBanXX.Append(" from mz_v_guahaopb_ex_zzj a ,v_gy_keshi c,v_gy_zhigongxx d , ");
                    sqlPaiBanXX.Append(" (select * from gy_daima where daimalb='0072') e  ");
                    sqlPaiBanXX.Append(" where a.keshiid=c.keshiid and d.zhigongid(+) = a.YISHENGID and e.daimaid(+) = d.zhicheng  ");

                    sqlPaiBanXX.Append(" and to_char(a.riqi,'yyyy-mm-dd')='" + riQi + "' ");
                    sqlPaiBanXX.Append("  and a.xiawuxh > 0 ");

                    if (!string.IsNullOrEmpty(keShiDM))
                    {
                        sqlPaiBanXX.Append(" and nvl(a.keshiid,'*') = '" + keShiDM + "' ");
                    }
                    if (!string.IsNullOrEmpty(yiShengDM))
                    {
                        sqlPaiBanXX.Append(" and nvl(a.yishengid,'*') = '" + yiShengDM + "' ");
                    }
                    if (!string.IsNullOrEmpty(guaHaoLB) && guaHaoLB != "0")
                    {
                        sqlPaiBanXX.Append(" and a.guahaolb = " + guaHaoLB + " ");
                    }
                }
                if (guaHaoBC == "0")
                {
                    sqlPaiBanXX.Append(" ) ");
                }
                #endregion
            }

            if (guaHaoFS == "2")
            {
                #region 预约挂号
                if (guaHaoBC == "0")
                {
                    sqlPaiBanXX.Append(" select * from ( ");
                }
                if (guaHaoBC == "1" || guaHaoBC == "0")
                {
                    sqlPaiBanXX.Append(" select A.PAIBANID,to_Char(A.RIQI,'yyyy-mm-dd') as PAIBANRQ,a.GUAHAOLB,1 as GUAHAOBC,A.KESHIID,C.keshimc,NVL(A.WEIZHI,C.weizhism) as JIUZHENDD, ");
                    sqlPaiBanXX.Append(" c.keshizl as KESHIJS,nvl(a.YISHENGID,'*') as YISHENGDM,nvl(d.zhigongxm,'普通') as YISHENGXM , e.daimamc as YISHENGZC,a.ZHENLIAOFXM,a.GUAHAOFXM, ");
                    sqlPaiBanXX.Append(" NVL(f.shangwuyyxh,0) AS HAOYUANZS,NVL(f.shangwuyyxh,0)-NVL(f.shangwuyyyh,0) AS SHENGYUHY ,f.yuyuelx as YUYUELX ");
                    sqlPaiBanXX.Append(" from mz_v_guahaopb_ex_zzj a ,v_gy_keshi c,v_gy_zhigongxx d , ");
                    sqlPaiBanXX.Append(" (select * from gy_daima where daimalb='0072') e ,v_mz_guahaoyyxh f  ");
                    sqlPaiBanXX.Append(" where a.keshiid=c.keshiid and d.zhigongid(+) = a.YISHENGID and e.daimaid(+) = d.zhicheng and a.PAIBANID = f.paibanid  ");

                    if (string.IsNullOrEmpty(riQi))
                    {
                        //挂号预约可预约当天号源 0 不启用 1 启用
                        if (ConfigurationManager.AppSettings["GuaHaoYYDTHY"] == "1")
                        {
                            sqlPaiBanXX.Append(" and a.riqi >= trunc(sysdate) ");
                        }
                        else
                        {
                            sqlPaiBanXX.Append(" and a.riqi > trunc(sysdate) ");
                        }
                    }
                    else
                    {
                        sqlPaiBanXX.Append(" and to_char(a.riqi,'yyyy-mm-dd')='" + riQi + "' ");
                    }
                    sqlPaiBanXX.Append(" and f.yuyuelx in (" + yuYueLX + ") ");
                    sqlPaiBanXX.Append("  and a.shangwuxh > 0 and f.shangwuyyxh > 0 ");
                    if (!string.IsNullOrEmpty(keShiDM))
                    {
                        sqlPaiBanXX.Append(" and nvl(a.keshiid,'*') = '" + keShiDM + "' ");
                    }
                    if (!string.IsNullOrEmpty(yiShengDM))
                    {
                        sqlPaiBanXX.Append(" and nvl(a.yishengid,'*') = '" + yiShengDM + "' ");
                    }
                    if (!string.IsNullOrEmpty(guaHaoLB) && guaHaoLB != "0")
                    {
                        sqlPaiBanXX.Append(" and a.guahaolb = " + guaHaoLB + " ");
                    }
                }
                if (guaHaoBC == "0")
                {
                    sqlPaiBanXX.Append(" union all ");
                }
                if (guaHaoBC == "2" || guaHaoBC == "0")
                {
                    sqlPaiBanXX.Append(" select A.PAIBANID,to_Char(A.RIQI,'yyyy-mm-dd') as PAIBANRQ,a.GUAHAOLB,2 as GUAHAOBC,A.KESHIID,C.keshimc,NVL(A.WEIZHI,C.weizhism) as JIUZHENDD, ");
                    sqlPaiBanXX.Append(" c.keshizl as KESHIJS,nvl(a.YISHENGID,'*') as YISHENGDM,nvl(d.zhigongxm,'普通') as YISHENGXM , e.daimamc as YISHENGZC,a.ZHENLIAOFXM,a.GUAHAOFXM, ");
                    sqlPaiBanXX.Append(" NVL(f.xiawuyyxh,0) AS HAOYUANZS,NVL(f.xiawuyyxh,0)-NVL(f.xiawuyyyh,0) AS SHENGYUHY ,f.yuyuelx as YUYUELX ");
                    sqlPaiBanXX.Append(" from mz_v_guahaopb_ex_zzj a ,v_gy_keshi c,v_gy_zhigongxx d , ");
                    sqlPaiBanXX.Append(" (select * from gy_daima where daimalb='0072') e ,v_mz_guahaoyyxh f  ");
                    sqlPaiBanXX.Append(" where a.keshiid=c.keshiid and d.zhigongid(+) = a.YISHENGID and e.daimaid(+) = d.zhicheng and a.PAIBANID = f.paibanid  ");

                    if (string.IsNullOrEmpty(riQi))
                    {
                        sqlPaiBanXX.Append(" and a.riqi > sysdate ");
                    }
                    else
                    {
                        sqlPaiBanXX.Append(" and to_char(a.riqi,'yyyy-mm-dd')='" + riQi + "' ");
                    }
                    sqlPaiBanXX.Append(" and f.yuyuelx in (" + yuYueLX + ") ");
                    sqlPaiBanXX.Append("  and a.xiawuxh > 0  and f.xiawuyyxh > 0 ");
                    if (!string.IsNullOrEmpty(keShiDM))
                    {
                        sqlPaiBanXX.Append(" and nvl(a.keshiid,'*') = '" + keShiDM + "' ");
                    }
                    if (!string.IsNullOrEmpty(yiShengDM))
                    {
                        sqlPaiBanXX.Append(" and nvl(a.yishengid,'*') = '" + yiShengDM + "' ");
                    }
                    if (!string.IsNullOrEmpty(guaHaoLB) && guaHaoLB != "0")
                    {
                        sqlPaiBanXX.Append(" and a.guahaolb = " + guaHaoLB + " ");
                    }
                }
                if (guaHaoBC == "0")
                {
                    sqlPaiBanXX.Append(" ) ");
                }
                sqlPaiBanXX.Append(" order by paibanrq,paibanid,guahaobc ");
                #endregion
            }

            DataTable dtPaiBanXX = DBVisitor.ExecuteTable(sqlPaiBanXX.ToString());

            for (int i = 0; i < dtPaiBanXX.Rows.Count; i++)
            {
                PAIBANXX pbxx = new PAIBANXX();
                pbxx.PAIBANID  = dtPaiBanXX.Rows[i]["PAIBANID"].ToString();  //排班ID
                pbxx.PAIBANRQ  = dtPaiBanXX.Rows[i]["PAIBANRQ"].ToString();  //排班日期
                pbxx.GUAHAOLB  = dtPaiBanXX.Rows[i]["GUAHAOLB"].ToString();  //挂号类别
                pbxx.GUAHAOBC  = dtPaiBanXX.Rows[i]["GUAHAOBC"].ToString();  //挂号班次
                pbxx.KESHIDM   = dtPaiBanXX.Rows[i]["KESHIID"].ToString();   //科室代码
                pbxx.KESHIMC   = dtPaiBanXX.Rows[i]["keshimc"].ToString();   //科室名称
                pbxx.JIUZHENDD = dtPaiBanXX.Rows[i]["JIUZHENDD"].ToString(); //就诊地点(科室位置)
                pbxx.KESHIJS   = dtPaiBanXX.Rows[i]["KESHIJS"].ToString();   //科室介绍
                pbxx.YISHENGDM = dtPaiBanXX.Rows[i]["YISHENGDM"].ToString(); //医生代码
                pbxx.YISHENGXM = dtPaiBanXX.Rows[i]["YISHENGXM"].ToString(); //医生姓名
                pbxx.YISHENGZC = dtPaiBanXX.Rows[i]["YISHENGZC"].ToString(); //医生职称
                string zlfxm = dtPaiBanXX.Rows[i]["ZHENLIAOFXM"].ToString(); //诊疗费
                pbxx.ZHENLIAOF = Unity.GetXiangMuFY(zlfxm);
                string ghfxm = dtPaiBanXX.Rows[i]["GUAHAOFXM"].ToString();   //挂号费
                pbxx.GUAHAOF   = Unity.GetXiangMuFY(ghfxm);
                pbxx.HAOYUANZS = dtPaiBanXX.Rows[i]["HAOYUANZS"].ToString(); //号源总数
                pbxx.SHENGYUHY = dtPaiBanXX.Rows[i]["SHENGYUHY"].ToString(); //剩余号源
                if (Convert.ToInt32(pbxx.HAOYUANZS) <= 0)
                {
                    pbxx.SHENGYUHY = "-1";
                }

                pbxx.HAOYUANZS = Convert.ToInt32(pbxx.HAOYUANZS) < 0 ? "0" : pbxx.HAOYUANZS;
                pbxx.SHENGYUHY = Convert.ToInt32(pbxx.SHENGYUHY) < 0 ? "0" : pbxx.SHENGYUHY;
                pbxx.GUAHAOFS  = guaHaoFS;
                pbxx.YUYUELX   = dtPaiBanXX.Rows[i]["YUYUELX"].ToString();//预约类型
                OutObject.PAIBANMX.Add(pbxx);
            }

            if (OutObject.PAIBANMX.Count <= 0)
            {
                throw new Exception("未找到排班信息!");
            }
        }
예제 #6
0
파일: CHONGZHI.cs 프로젝트: radtek/WCF
        public override void ProcessMessage()
        {
            OutObject = new CHONGZHI_OUT();
            string jiuzhenKh   = InObject.JIUZHENKH;
            string jiuzhenkLx  = InObject.JIUZHENKLX;
            string xingMing    = InObject.XINGMING;
            string zhengjianHm = InObject.ZHENGJIANHM;
            string lianxiDh    = InObject.LIANXIDH;
            string chongzhiJe  = InObject.CHONGZHIJE;
            string zhifuFs     = InObject.ZHIFUFS;
            string jiandangRen = InObject.BASEINFO.CAOZUOYDM;                                     //建档人工号
            string caozuoRq    = InObject.BASEINFO.CAOZUORQ;                                      //操作日期
            string yuanQuDM    = InObject.BASEINFO.FENYUANDM;                                     //分院代码
            string YINHANGKXX  = InObject.YINGHANGKXX;
            int    JIUZHENKCD  = Convert.ToInt32(ConfigurationManager.AppSettings["JIUZHENKCD"]); //就诊卡默认长度

            #region 基本入参判断
            if (string.IsNullOrEmpty(yuanQuDM))
            {
                throw new Exception("院区代码不能为空!");
            }
            //就诊卡号
            if (string.IsNullOrEmpty(jiuzhenKh))
            {
                throw new Exception(string.Format("就诊卡号获取失败!"));
            }
            //支付方式
            if (string.IsNullOrEmpty(zhifuFs))
            {
                throw new Exception(string.Format("支付方式获取失败!"));
            }
            //充值金额
            if (string.IsNullOrEmpty(zhifuFs))
            {
                throw new Exception(string.Format("充值金额获取失败!"));
            }

            if (string.IsNullOrEmpty(caozuoRq) || caozuoRq.Length != 19)
            {
                caozuoRq = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
            }
            #endregion

            if (JIUZHENKCD > 0)
            {
                if (jiuzhenKh.Length < JIUZHENKCD)
                {
                    jiuzhenKh = jiuzhenKh.PadLeft(JIUZHENKCD, '0');
                }
            }

            string brxxSql = "select bingrenid, ZIJINZHQYBZ,xingMing,nvl(shenfenzh,'') as zhengjianHm,"
                             + "nvl(lianxirdh,'') as lianxiDh from gy_bingrenxx where jiuzhenkh='" + jiuzhenKh + "'";
            DataTable dtBrxx    = DBVisitor.ExecuteTable(brxxSql);
            string    qiyongBz  = string.Empty;
            string    bingrenId = string.Empty;
            string    jiaoyiMa  = string.Empty;//交易码
            if (dtBrxx.Rows.Count > 0)
            {
                qiyongBz    = dtBrxx.Rows[0]["ZIJINZHQYBZ"].ToString();
                bingrenId   = dtBrxx.Rows[0]["bingrenid"].ToString();
                zhengjianHm = dtBrxx.Rows[0]["zhengjianHm"].ToString();
                xingMing    = dtBrxx.Rows[0]["xingMing"].ToString();
                lianxiDh    = dtBrxx.Rows[0]["lianxiDh"].ToString();
            }



            jiaoyiMa = Unity.GetMD5(bingrenId + Convert.ToSingle(chongzhiJe).ToString("f4") + caozuoRq + "1" + jiandangRen).ToLower();
            if (qiyongBz == "1")
            {
                if (zhifuFs == "10" || zhifuFs == "15")
                {
                    DataTable dtXLH = DBVisitor.ExecuteTable("Select seq_gy_posjiaoyixx.nextval POSXH From Dual");
                    if (dtXLH.Rows.Count > 0)
                    {
                        string POSJIAOYIXXID = dtXLH.Rows[0]["POSXH"].ToString();
                        YINHANGKXX += "#" + POSJIAOYIXXID;
                    }
                }
                else if (zhifuFs == "21")
                {
                    //DataTable dtXLH = DBVisitor.ExecuteTable("Select S_ZFB_JYLSH.nextval ZFBXH From Dual");
                    //if (dtXLH.Rows.Count > 0)
                    //{
                    string ZFBJIAOYIXXID = "808";//dtXLH.Rows[0]["ZFBXH"].ToString();
                    YINHANGKXX += "#" + ZFBJIAOYIXXID + "#" + InObject.BASEINFO.FENYUANDM;
                    //}
                }
                string jiaoyiMsg = jiuzhenKh + "|" + jiuzhenkLx + "|" + xingMing + "|" + zhengjianHm + "|" + lianxiDh + "|" +
                                   chongzhiJe + "|" + zhifuFs + "|" + caozuoRq + "|" + jiandangRen + "|" + jiaoyiMa + "|";
                if (!string.IsNullOrEmpty(YINHANGKXX))
                {
                    jiaoyiMsg += YINHANGKXX + "|";
                }
                else
                {
                    jiaoyiMsg += "|";
                }
                jiaoyiMsg += yuanQuDM + "|";
                //WcfCommon.writeLog(WcfCommon.LOGTYPE_SQLLOG, OutObject.GetType().Name.ToString(), "院内账户充值存储过程入参:" + jiaoyiMsg, messageId);
                //账户充值-------------------------------------------------------------------------------------------

                OracleParameter[] paramJiaoYi = new OracleParameter[3];
                paramJiaoYi[0]           = new OracleParameter("PRM_MSG", OracleType.VarChar);
                paramJiaoYi[0].Value     = jiaoyiMsg;
                paramJiaoYi[0].Direction = ParameterDirection.Input;
                paramJiaoYi[1]           = new OracleParameter("PRM_APPCODE", OracleType.Number);
                paramJiaoYi[1].Value     = null;
                paramJiaoYi[1].Direction = ParameterDirection.Output;
                paramJiaoYi[2]           = new OracleParameter("PRM_OUTBUFFER", OracleType.VarChar);
                paramJiaoYi[2].Value     = null;
                paramJiaoYi[2].Size      = 2000;
                paramJiaoYi[2].Direction = ParameterDirection.Output;

                DbTransaction transaction = null;
                DbConnection  conn        = DBVisitor.Connection;
                try
                {
                    transaction = conn.BeginTransaction();
                    DBVisitor.ExecuteProcedure("PKG_GY_YINYIJK.PRC_ZZSF_DIANZIZHCZ", paramJiaoYi, transaction);//院内账户充值
                }
                catch (Exception ex)
                {
                    if (transaction != null)
                    {
                        transaction.Rollback();
                        conn.Close();
                    }
                    throw new Exception(string.Format(ex.Message));
                }
                //--------------------------------------------------------------------------------------------------
                string returnValue = paramJiaoYi[1].Value.ToString();
                string returnMsg   = paramJiaoYi[2].Value.ToString();
                if (returnValue == "1")//
                {
                    transaction.Commit();
                    conn.Close();
                    OutObject.ZHANGHUYE = returnMsg;
                }
                else
                {
                    transaction.Rollback();
                    conn.Close();
                    throw new Exception(returnMsg);
                }
            }
            else
            {
                throw new Exception("请先开通院内账户");
            }
        }
예제 #7
0
        public override void ProcessMessage()
        {
            OutObject = new GUAHAOYYQH_OUT();
            string jiuzhenkLx = InObject.JIUZHENKLX;
            string jiuzhenKh  = InObject.JIUZHENKH;
            string quhaomm    = InObject.QUHAOMM;
            string caozuoyDm  = InObject.BASEINFO.CAOZUOYDM;
            string caozuoyXm  = InObject.BASEINFO.CAOZUOYXM;
            string caozuoRq   = InObject.BASEINFO.CAOZUORQ;
            string daiShouFY  = InObject.DAISHOUFY;
            string yuYueLY    = InObject.YUYUELY;

            #region 基本信息有效性判断
            if (string.IsNullOrEmpty(daiShouFY))
            {//默认不代收
                daiShouFY = "0";
            }

            if (string.IsNullOrEmpty(jiuzhenkLx))
            {
                throw new Exception("卡类型获取失败,请重新尝试挂号!");
            }
            if (string.IsNullOrEmpty(jiuzhenKh))
            {
                throw new Exception("就诊卡号获取失败,请重新尝试挂号!");
            }
            if (string.IsNullOrEmpty(quhaomm))
            {
                throw new Exception("取号密码获取失败,请重新尝试挂号!");
            }
            #endregion


            StringBuilder sbSql = new StringBuilder();
            sbSql.Append(" select b.guahaolb guahaolb ,c.daimamc guahaolbmc,b.keshiid,a.yuyueksmc keshimc ,b.yishengid,to_char(a.yuyuesj,'yyyy-mm-dd')  riqi,a.shangxiawbz guahaobc, ");
            sbSql.Append(" a.guahaoxh guahaoxh ,b.weizhi jiuzhendd,b.paibanid,a.yuyuehao ,a.yuyuelx,a.yuyueid,nvl(b.zhenliaofxm,'*') as zhenliaofxm ,nvl(b.guahaofxm,'*') as guahaofxm ");
            sbSql.Append(" from mz_guahaoyy a,mz_v_guahaopb_ex_zzj b,(select * from gy_daima where daimalb='0025' and zuofeibz='0') c  where a.paibanid = b.paibanid  and b.guahaolb = c.daimaid ");
            sbSql.Append(" and a.yuyuehao = '" + quhaomm + "' and ((a.xingming in( select xingming from gy_bingrenxx where jiuzhenkh = '" + jiuzhenKh + "')) or (a.jiuzhenkh = '" + jiuzhenKh + "'))  ");
            DataTable dt = DBVisitor.ExecuteTable(sbSql.ToString());
            if (dt.Rows.Count > 0)
            {
                OutObject.GUAHAOLB     = dt.Rows[0]["GUAHAOLB"].ToString();
                OutObject.GUAHAOLBMC   = dt.Rows[0]["GUAHAOLBMC"].ToString();
                OutObject.KESHIDM      = dt.Rows[0]["KESHIID"].ToString();
                OutObject.KESHIMC      = dt.Rows[0]["KESHIMC"].ToString();
                OutObject.DANGTIANPBID = dt.Rows[0]["PAIBANID"].ToString();
                OutObject.YUYUEID      = dt.Rows[0]["YUYUEID"].ToString();
                OutObject.YISHENGDM    = dt.Rows[0]["YISHENGID"].ToString();
                OutObject.RIQI         = dt.Rows[0]["RIQI"].ToString();
                OutObject.GUAHAOBC     = dt.Rows[0]["guahaobc"].ToString();
                OutObject.JIUZHENDD    = dt.Rows[0]["jiuzhendd"].ToString();
                OutObject.GUAHAOXH     = dt.Rows[0]["guahaoxh"].ToString();
                OutObject.YUYUEHAO     = dt.Rows[0]["YUYUEHAO"].ToString();
                string zhenLiaoXmXh = dt.Rows[0]["zhenliaofxm"].ToString();
                string guaHaoXmXh   = dt.Rows[0]["guahaofxm"].ToString();
                if (!string.IsNullOrEmpty(zhenLiaoXmXh) && zhenLiaoXmXh != "*")
                {//诊疗项目信息
                    MENZHENFYXX fyxx = getXiangMuXX(zhenLiaoXmXh);
                    if (fyxx != null)
                    {
                        OutObject.FEIYONGMX.Add(fyxx);
                    }
                }
                if (!string.IsNullOrEmpty(guaHaoXmXh) && guaHaoXmXh != "*")
                {//挂号项目信息
                    MENZHENFYXX fyxx = getXiangMuXX(guaHaoXmXh);
                    if (fyxx != null)
                    {
                        OutObject.FEIYONGMX.Add(fyxx);
                    }
                }
                string ysdm = string.IsNullOrEmpty(OutObject.YISHENGDM)?"*":OutObject.YISHENGDM;
                OutObject.JIUZHENSJ = Unity.getJiuZhenSJD(ysdm, OutObject.KESHIDM, OutObject.GUAHAOXH, dt.Rows[0]["YUYUELX"].ToString(), ((OutObject.GUAHAOBC == "1") ? 0 : 1), OutObject.GUAHAOLB, OutObject.RIQI);

                //获取医生姓名
                if (!string.IsNullOrEmpty(OutObject.YISHENGDM) && OutObject.YISHENGDM != "*")
                {
                    DataTable dtYs = DBVisitor.ExecuteTable("select xm from gy_zgxx where zgid ='" + OutObject.YISHENGDM + "' ");
                    //WcfCommon.writeLog(WcfCommon.LOGTYPE_SQLLOG, OutObject.GetType().Name.ToString(), "挂号信息查询:" + OutObject.YISHENGDM + ":医生信息:" + "select xm from gy_zgxx where zgid ='" + OutObject.YISHENGDM + "' ", messageId);
                    if (dtYs.Rows.Count > 0)
                    {
                        OutObject.YISHENGXM = dtYs.Rows[0]["XM"].ToString();
                    }
                }
            }
            else
            {
                throw new Exception("取号密码错误或没有该预约记录!");
            }
        }