调存储过程返回list

CREATE OR REPLACE PROCEDURE SP_REPORT_YK_RKHZB(ai_baseid    numeric,
                                               adt_date_b   date,
                                               adt_date_e   date,
                                               ai_tjfs      number,
                                               ai_fsid      number,
                                               ai_forgid    number,
                                               out_cur     out his_zyjs.ref_cur)

 AS
  /************************************************************
  功能:入库汇总统计
  名称:
  参数 ai_baseid 当前科室ID
       as_date_b 统计时间段
       as_date_e 统计时间段
       ai_tjfs 1按入库方式 2按供应商 3 按产地
       ai_fsid 对就方式,对应供应商ID 对应产地ID
  调用:药库管理-统计查询-入库汇总表
  创建:xck 2012-07-07
  *************************************************************/
 
vd_begin   date;
vd_end     date;
 
begin
  vd_begin := to_date(to_char(adt_date_b,'yyyy-mm-dd')||'00:00:00','yyyy-mm-dd hh24:mi:ss');
  vd_end := to_date(to_char(adt_date_e,'yyyy-mm-dd')||'23:59:59','yyyy-mm-dd hh24:mi:ss');
  if ai_tjfs = 1 then
    --按入库方式统计
    open out_cur for
    SELECT pkg_bshis_common.F_GET_ADD('dictorigin',a.tranid,'originname') as tjmc,
           d.typecode,
           d.typename,
           sum(b.actmon) as gjje,
           sum(b.retailmon) as lsje,
           sum(b.retailmon - b.actmon) as ce
      FROM glide_total a,
           glide b,
           dictmedi c,
           dicttype d
     WHERE a.glideid = b.glideid
       and b.mediid = c.mediid
       and c.typeid = d.typecode
       and a.forgid = b.forgid
       and b.forgid = c.forgid
       and c.forgid = d.forgid
       and a.inout = 1
       and a.auditdate >= vd_begin
       and a.auditdate <= vd_end
       and a.baseid = ai_baseid
       and a.forgid = ai_forgid
     GROUP BY a.tranid,d.typecode,d.typename
     order by d.typecode;
  elsif ai_tjfs = 2 then
    --按供应商统计
    open out_cur for
    SELECT pkg_bshis_common.F_GET_ADD('dictoffice',a.fellowid,'officename') as tjmc,
           d.typecode,
           d.typename,
           sum(b.actmon) as gjje,
           sum(b.retailmon) as lsje,
           sum(b.retailmon - b.actmon) as ce
      FROM glide_total a,
           glide b,
           dictmedi c,
           dicttype d
     WHERE a.glideid = b.glideid
       and b.mediid = c.mediid
       and c.typeid = d.typecode
       and a.forgid = b.forgid
       and b.forgid = c.forgid
       and c.forgid = d.forgid
       and a.inout = 1
       and a.auditdate >= vd_begin
       and a.auditdate <= vd_end
       and (a.fellowid = ai_fsid or ai_fsid = 0)
       and a.baseid = ai_baseid
       and a.forgid = ai_forgid
     GROUP BY a.fellowid,d.typecode,d.typename
     order by d.typecode;
 elsif ai_tjfs = 3 then
    --按产地统计
    open out_cur for
    SELECT pkg_bshis_common.F_GET_ADD('echocarry',b.carrid,'carryname') as tjmc,
           d.typecode,
           d.typename,
           sum(b.actmon) as gjje,
           sum(b.retailmon) as lsje,
           sum(b.retailmon - b.actmon) as ce
      FROM glide_total a,
           glide b,
           dictmedi c,
           dicttype d
     WHERE a.glideid = b.glideid
       and b.mediid = c.mediid
       and c.typeid = d.typecode
       and a.forgid = b.forgid
       and b.forgid = c.forgid
       and c.forgid = d.forgid
       and a.inout = 1
       and a.auditdate >= vd_begin
       and a.auditdate <= vd_end
       and (b.carrid = ai_fsid or ai_fsid = 0)
       and a.baseid = ai_baseid
       and a.forgid = ai_forgid
     GROUP BY b.carrid,d.typecode,d.typename
     order by d.typecode;
  end if;
end;

 

 

java 代码---------------------

 

 

<sqlMap>


 <resultMap class="java.util.HashMap" id="out_ResultMap">
     <result column="tjmc" property="tjmc" jdbcType="VARCHAR" />
     <result column="typecode" property="typecode" jdbcType="VARCHAR" />
     <result column="typename" property="typename" jdbcType="VARCHAR" />
     <result column="gjje" property="gjje" jdbcType="DECIMAL" />
     <result column="lsje" property="lsje" jdbcType="DECIMAL" />
     <result column="ce" property="ce" jdbcType="DECIMAL" />
 </resultMap>
 
 <parameterMap id="byinstorageParam" class="java.util.HashMap">
   <parameter property="OFFICEID" jdbcType="NUMBER" mode="IN"/>
   <parameter property="S_DATE" jdbcType="DATE" mode="IN"/>
   <parameter property="E_DATE" jdbcType="DATE" mode="IN"/>
   <parameter property="TJFX" jdbcType="NUMBER" mode="IN"/>
   <parameter property="FSID" jdbcType="NUMBER" mode="IN"/>
   <parameter property="FORGID" jdbcType="NUMBER" mode="IN"/>
   <parameter jdbcType="ORACLECURSOR" mode="OUT"
         property="DATA" javaType="java.sql.ResultSet" resultMap="out_ResultMap"/>
 </parameterMap>
 <procedure id="sp_report_yk_rkhzb" parameterMap="byinstorageParam">
   {call sp_report_yk_rkhzb(?,?,?,?,?,?,?)}
 </procedure> 

</sqlMap>


public List byInstorage(Map map) {
  getSqlMapClientTemplate().queryForObject("INSTORAGESUM.sp_report_yk_rkhzb", map);
  Object data = map.get("DATA");
  return data != null ? (List)data : new ArrayList();
 }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值