Exemplo n.º 1
0
        public MENZHENFYXX getXiangMuXX(string xiangMuXH)
        {
            MENZHENFYXX mzfyxx    = null;
            string      mzfyxxSql = "select a.shoufeixmid, a.shoufeixmmc, a.hesuanxm,a.jijiadw,a.danjia1,a.yibaodj,b.hesuanxmmc from gy_shoufeixm a,gy_hesuanxm b where a.hesuanxm = b.hesuanxmid and a.zuofeibz ='0' and shoufeixmid = '{0}' ";

            if (!string.IsNullOrEmpty(xiangMuXH) && xiangMuXH != "*")
            {
                DataTable dtFYXX = DBVisitor.ExecuteTable(string.Format(mzfyxxSql, xiangMuXH));
                if (dtFYXX.Rows.Count > 0)
                {
                    mzfyxx             = new MENZHENFYXX();
                    mzfyxx.XIANGMUXH   = dtFYXX.Rows[0]["shoufeixmid"].ToString(); //项目序号
                    mzfyxx.XIANGMUMC   = dtFYXX.Rows[0]["shoufeixmmc"].ToString(); //项目名称
                    mzfyxx.XIANGMUGL   = dtFYXX.Rows[0]["hesuanxm"].ToString();    //项目归类
                    mzfyxx.XIANGMUGLMC = dtFYXX.Rows[0]["hesuanxmmc"].ToString();  //项目归类名称
                    mzfyxx.XIANGMUDW   = dtFYXX.Rows[0]["jijiadw"].ToString();     //项目单位
                    mzfyxx.DANJIA      = dtFYXX.Rows[0]["danjia1"].ToString();     //单价
                    mzfyxx.SHULIANG    = "1";                                      //数量
                    mzfyxx.FEIYONGLX   = "0";
                    mzfyxx.YIBAODJ     = dtFYXX.Rows[0]["yibaodj"].ToString();     //医保等级
                }
            }
            return(mzfyxx);
        }
Exemplo n.º 2
0
        public override void ProcessMessage()
        {
            this.OutObject = new MENZHENJSMX_OUT();

            string bingRenID   = InObject.BINGRENID;                                                  //病人ID
            string shouFeiID   = InObject.SHOUFEIID;                                                  //收费ID
            string kaiShiRQ    = InObject.KAISHIRQ;                                                   //开始日期
            string jieShuRQ    = InObject.JIESHURQ;                                                   //结束日期
            string yuanQuID    = InObject.BASEINFO.FENYUANDM;                                         //分院代码
            int    menZhenSJFW = -1 * Convert.ToInt32(ConfigurationManager.AppSettings["FeiYongSJ"]); //门诊费用检索默认时间范围

            #region 基础入参判断
            if (string.IsNullOrEmpty(bingRenID))
            {
                throw new Exception("病人信息获取失败!");
            }

            if (string.IsNullOrEmpty(shouFeiID))
            {
                if (string.IsNullOrEmpty(jieShuRQ))
                {
                    jieShuRQ = DateTime.Now.ToString("yyyy-MM-dd");
                }

                if (string.IsNullOrEmpty(kaiShiRQ))
                {
                    kaiShiRQ = DateTime.Now.AddDays(menZhenSJFW).Date.ToString("yyyy-MM-dd");
                }

                string    shouFeiIDSQL = "select shoufeiid,shoufeiren from mz_shoufei1 where bingrenid ='{0}' and shoufeirq between to_date('{1} 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and  to_date('{2} 23:59:59', 'yyyy-mm-dd hh24:mi:ss') order by shoufeirq desc ";
                DataTable dtShouFeiID  = DBVisitor.ExecuteTable(string.Format(shouFeiIDSQL, bingRenID, kaiShiRQ, jieShuRQ));
                if (dtShouFeiID.Rows.Count > 0)
                {
                    for (int i = 0; i < dtShouFeiID.Rows.Count; i++)
                    {
                        shouFeiID += "','" + dtShouFeiID.Rows[i]["shoufeiid"].ToString();
                    }
                    shouFeiID = shouFeiID.Trim('\'').ToString();
                    shouFeiID = shouFeiID.Trim(',').ToString();
                    shouFeiID = shouFeiID.Trim('\'').ToString();
                }
                else
                {
                    OutObject.FEIYONGMXTS = "0".ToString();
                }
            }
            #endregion

            //查询发票号码
            DataTable dt = DBVisitor.ExecuteTable(string.Format("select * from mz_fapiao1 where zuofeibz='0' and shoufeiid in ('{0}')", shouFeiID));

            #region 获取费用明细

            #region 获取处方数据
            StringBuilder sqlBufCF = new StringBuilder();
            sqlBufCF.Append("select a.shoufeiid shoufeiid, RPAD(nvl(a.kongzhisx,'0000'),4,'0') as kongzhisx, a.chufangid chufangxh,d.chufangmxid mingxixh,a.feiyonglb feiyonglx, l.yaopinid xiangmuxh,l.chandi xiangmucddm, ")
            .Append("l.yaopinmc xiangmumc,l.yaopinlx xiangmugl,m.DAIMAMC XIANGMUGLMC,l.yaopingg xiangmugg,l.jixing xiangmujx,l.jiliangdw xiangmudw, ")
            .Append("l.chandimc xiangmucdmc,l.baozhuangliang baozhuangsl,l.baozhuangdw,l.zuixiaodw zuixiaojldw,'' danciyl,'' yongliangdw, ")
            .Append("null meitiancs,d.yongyaots,l.fufangbz danfufbz,d.chufangts2 zhongcaoyts, d.jiesuanjia danjia, ")
            .Append("decode(a.chufanglx,'3',nvl(d.shuliang,0)*nvl(a.chufangts,0),d.shuliang) shuliang,'' SHENGPIBH , ")
            .Append("decode(a.chufanglx,'3',nvl(d.jiesuanje,0)*nvl(a.chufangts,0),d.jiesuanje) jine, ")
            .Append("d.yibaodj,d.yibaodm,d.yibaozfbl,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,d.zifubl,to_char(a.kaidanrq,'yyyy-mm-dd')kaidanrq, ")
            .Append("l.daguigid yaopindggxh,'' yaopindggcd,null yaopindggsl, ")
            .Append("(select  to_char(shoufeirq,'yyyy-mm-dd hh24:mi:ss') from mz_shoufei1 where shoufeiid = a.shoufeiid) as shoufeirq ")
            .Append("from mz_chufang1 a,gy_feiyonglb b,gy_feiyongxz c,mz_chufang2 d,gy_yaopincdjg2 l,gy_xiangmulx m ")
            .Append("where b.leibieid(+)=a.feiyonglb and c.xingzhiid(+)=a.feiyongxz and d.chufangid=a.chufangid and a.bingrenid = '{0}' ")
            .Append("and l.jiageid = d.jiageid and m.DAIMAID(+)=l.yaopinlx and a.shoufeibz=1 and a.jiaoyilx=1 and a.chongxiaobz = 0  ")
            .Append("and a.shoufeiid in ('{1}') ");
            DataTable dtChuFangMX = DBVisitor.ExecuteTable(string.Format(sqlBufCF.ToString(), bingRenID, shouFeiID));

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

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

                    default:
                        temp.KONGZHISX   = "00";
                        temp.KONGZHISXMC = "普通";
                        break;
                    }
                    temp.SHOUFEIID = dtChuFangMX.Rows[i]["shoufeiid"].ToString();
                    //发票号码/发票ID
                    DataRow[] dr = dt.Select("shoufeiid ='" + dtChuFangMX.Rows[i]["shoufeiid"].ToString() + "'");
                    if (dr.Length > 0)
                    {
                        temp.FAPIAOHM = dr[0]["fapiaohm"].ToString();
                        temp.FAPIAOID = dr[0]["fapiaoid"].ToString();
                    }
                    else
                    {
                        temp.FAPIAOHM = "";
                        temp.FAPIAOID = "";
                    }

                    string    shouFeiR   = "select  shoufeiren,jiesuanid,(feiyonghj -zifuje  - zifeije -  zilije) ybje from mz_shoufei1 where shoufeiid='" + dtChuFangMX.Rows[i]["shoufeiid"].ToString() + "'  ";
                    DataTable dtshouFeiR = DBVisitor.ExecuteTable(string.Format(shouFeiR, bingRenID, kaiShiRQ, jieShuRQ));
                    ///操作工号
                    temp.CAOZUOGH = dtshouFeiR.Rows[0]["shoufeiren"].ToString();
                    temp.YBJE     = dtshouFeiR.Rows[0]["ybje"].ToString();
                    ///支付方式
                    DataTable dtZFFS = DBVisitor.ExecuteTable(string.Format("select * from mz_zhifu where jiesuanid='{0}'", dtshouFeiR.Rows[0]["jiesuanid"].ToString()));
                    if (dtZFFS.Rows.Count > 0)
                    {
                        temp.ZHIFUFS = dtZFFS.Rows[0]["zhifufs"].ToString();
                    }
                    else
                    {
                        temp.ZHIFUFS = "";
                    }

                    if (dr.Length > 0)
                    {
                        temp.FAPIAOHM = dr[0]["fapiaohm"].ToString();
                        temp.FAPIAOID = dr[0]["fapiaoid"].ToString();
                    }
                    else
                    {
                        temp.FAPIAOHM = "";
                        temp.FAPIAOID = "";
                    }


                    OutObject.FEIYONGMX.Add(temp);
                }
                #endregion
            }
            #endregion

            #region 获取医技数据
            StringBuilder sqlBufYJ = new StringBuilder();
            sqlBufYJ.Append("select  a.shoufeiid shoufeiid, 0 chufanglx,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, 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, '' SHENGPIBH , ")
            .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')kaidanrq,'' yaopindggxh,'' yaopindggcd,null yaopindggsl, ")
            .Append("(select  to_char(shoufeirq,'yyyy-mm-dd hh24:mi:ss') from mz_shoufei1 where shoufeiid = a.shoufeiid) as shoufeirq ")
            .Append("from mz_yiji1 a,gy_feiyonglb b,gy_feiyongxz c,mz_yiji2 d,gy_shoufeixm l ")
            .Append("where b.leibieid(+)=a.feiyonglb and c.xingzhiid(+)=a.feiyongxz  ")
            .Append("and d.yijiid=a.yijiid and l.shoufeixmid = d.shoufeixm and a.bingrenid = '{0}' ")
            .Append("and a.shoufeibz=1 and a.jiaoyilx=1 and a.chongxiaobz = 0  ")
            .Append("and a.shoufeiid in ('{1}') ");
            DataTable dtYiJiMX = DBVisitor.ExecuteTable(string.Format(sqlBufYJ.ToString(), bingRenID, shouFeiID));

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

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

                    default:
                        temp.KONGZHISX   = "00";
                        temp.KONGZHISXMC = "普通";
                        break;
                    }

                    temp.SHOUFEIID = dtYiJiMX.Rows[i]["shoufeiid"].ToString();
                    //发票号码/发票ID
                    DataRow[] dr = dt.Select("shoufeiid ='" + dtYiJiMX.Rows[i]["shoufeiid"].ToString() + "'");
                    if (dr.Length > 0)
                    {
                        temp.FAPIAOHM = dr[0]["fapiaohm"].ToString();
                        temp.FAPIAOID = dr[0]["fapiaoid"].ToString();
                    }
                    else
                    {
                        temp.FAPIAOHM = "";
                        temp.FAPIAOID = "";
                    }

                    string    shouFeiR   = "select  shoufeiren,jiesuanid ,(feiyonghj -zifuje  - zifeije -  zilije) ybje from mz_shoufei1 where shoufeiid='" + dtYiJiMX.Rows[i]["shoufeiid"].ToString() + "'  ";
                    DataTable dtshouFeiR = DBVisitor.ExecuteTable(string.Format(shouFeiR, bingRenID, kaiShiRQ, jieShuRQ));
                    ///操作工号
                    temp.CAOZUOGH = dtshouFeiR.Rows[0]["shoufeiren"].ToString();
                    temp.YBJE     = dtshouFeiR.Rows[0]["ybje"].ToString();
                    ///支付方式
                    DataTable dtZFFS = DBVisitor.ExecuteTable(string.Format("select * from mz_zhifu where jiesuanid='{0}'", dtshouFeiR.Rows[0]["jiesuanid"].ToString()));
                    if (dtZFFS.Rows.Count > 0)
                    {
                        temp.ZHIFUFS = dtZFFS.Rows[0]["zhifufs"].ToString();
                    }
                    else
                    {
                        temp.ZHIFUFS = "";
                    }


                    OutObject.FEIYONGMX.Add(temp);
                }
                #endregion
            }
            #endregion

            #region 获取挂号数据
            StringBuilder sqlBufGH = new StringBuilder();
            sqlBufGH.Append("select a.shoufeiid shoufeiid, 2 chufanglx,a.guahaoid chufangxh,d.guahaomxid mingxixh,a.feiyonglb feiyonglx,l.shoufeixmid xiangmuxh,")
            .Append("'' xiangmucddm,l.shoufeixmmc xiangmumc,'' xiangmugl,'' XIANGMUGLMC,'' xiangmugg,null xiangmujx, ")
            .Append("l.jijiadw xiangmudw,'' xiangmucdmc,null baozhuangsl,'' baozhuangdw,'' zuixiaojldw,'' danciyl, ")
            .Append("'' yongliangdw,null meitiancs,null yongyaots,null danfufbz,null zhongcaoyts,d.jiesuanjia danjia, ")
            .Append("d.shuliang,d.jiesuanje jine,d.yibaodj,d.yibaodm,d.yibaozfbl,d.xianjia xiangmuxj,d.zifeije,d.zilije, ")
            .Append("d.zifeibz,0 teshuyybz,'' yibaoxmfzxx,d.shuliang dancisl,'' pinlvsz,'' kaidanksdm,'' kaidanksmc, ")
            .Append("a.guahaoren kaidanysdm,a.guahaorxm kaidanysxm,d.zifubl,to_char(a.guahaorq, 'yyyy-mm-dd') kaidanrq, ")
            .Append("'' yaopindggxh,'' yaopindggcd,'' yaopindggsl,'' SHENGPIBH, ")
            .Append("(select  to_char(shoufeirq,'yyyy-mm-dd hh24:mi:ss') from mz_shoufei1 where shoufeiid = a.shoufeiid) as shoufeirq ")
            .Append("from mz_guahao1 a,gy_feiyonglb b,gy_feiyongxz c,mz_guahao2 d,gy_shoufeixm l ")
            .Append(" where b.leibieid(+) = a.feiyonglb and c.xingzhiid(+) = a.feiyongxz and d.guahaoid = a.guahaoid ")
            .Append(" and l.shoufeixmid = d.shoufeixm and a.jiaoyilx = 1 and a.zuofeibz = 0 ")
            .Append("   and a.bingrenid = '{0}' and a.shoufeiid in ('{1}') ");
            DataTable dtGuaHaoMX = DBVisitor.ExecuteTable(string.Format(sqlBufGH.ToString(), bingRenID, shouFeiID));

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

                    temp.SHOUFEIID = dtGuaHaoMX.Rows[i]["shoufeiid"].ToString();
                    //发票号码/发票ID
                    DataRow[] dr = dt.Select("shoufeiid ='" + dtGuaHaoMX.Rows[i]["shoufeiid"].ToString() + "'");
                    if (dr.Length > 0)
                    {
                        temp.FAPIAOHM = dr[0]["fapiaohm"].ToString();
                        temp.FAPIAOID = dr[0]["fapiaoid"].ToString();
                    }
                    else
                    {
                        temp.FAPIAOHM = "";
                        temp.FAPIAOID = "";
                    }

                    string    shouFeiR   = "select  shoufeiren,jiesuanid ,(feiyonghj -zifuje  - zifeije -  zilije) ybje from mz_shoufei1 where shoufeiid='" + dtGuaHaoMX.Rows[i]["shoufeiid"].ToString() + "'  ";
                    DataTable dtshouFeiR = DBVisitor.ExecuteTable(string.Format(shouFeiR, bingRenID, kaiShiRQ, jieShuRQ));
                    ///操作工号
                    temp.CAOZUOGH = dtshouFeiR.Rows[0]["shoufeiren"].ToString();
                    temp.YBJE     = dtshouFeiR.Rows[0]["ybje"].ToString();
                    ///支付方式
                    DataTable dtZFFS = DBVisitor.ExecuteTable(string.Format("select * from mz_zhifu where jiesuanid='{0}'", dtshouFeiR.Rows[0]["jiesuanid"].ToString()));
                    if (dtZFFS.Rows.Count > 0)
                    {
                        temp.ZHIFUFS = dtZFFS.Rows[0]["zhifufs"].ToString();
                    }
                    else
                    {
                        temp.ZHIFUFS = "";
                    }

                    OutObject.FEIYONGMX.Add(temp);
                }
                #endregion
            }
            #endregion
            #endregion
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
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("取号密码错误或没有该预约记录!");
            }
        }