- 浏览: 260249 次
- 性别:
- 来自: 杭州
文章分类
最新评论
-
18335864773:
用pageoffice 把.不需要文件的上传下载, 直接在线打 ...
java 动态生成多个excel文件打成zip包供用户下载 -
xhgrid:
请问,exportUtils能提供参考吗?
java 动态生成多个excel文件打成zip包供用户下载 -
alranger:
在页面上加上这一段代码,根本就没有用啊!有其他的解决办法吗?
解决Ext在ie9报错:不支持extjs对象的“createContextualFragment属性或方法 -
yzzanson:
还有reportViews这个对象的基本组成
java 动态生成多个excel文件打成zip包供用户下载 -
yzzanson:
你好 你的ExportUtil代码能参考下吗?
java 动态生成多个excel文件打成zip包供用户下载
哎 数据库好菜.....写个存储过程写了好久才写出来(还是别人的帮忙),所以做做笔记。
查询分页:
create or replace procedure
--住院病人费用清单
SP_PATIENT_CHARGE_BILL(v_begDate in varchar2,--输入参数
v_endDate in varchar2,--输入参数
v_inhos in varchar2,--输入参数
v_start in number,--输入参数
v_limit in number,--输入参数
v_result out sghis.his_brsf.HIS_CURSOR) is --输出参数(游标)
begin
open v_result for
select * from (select row_.*, rownum rownum_ from (--这句是为了分页
select invoice_name as invoice_code,
fee_name,
spe,
amount,
unit,
price,
taxmoney,
date1 || '至' || date2 as exec_time,
remark
from (select case sort_id when '01' then '01' when '70' then '01' else sort_id end as invoice_code,
bb.pham_name as fee_name,
bb.packing as spe,
aa.amount,
bb.split_unit as unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2) end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
nvl(sum(amount), 0) as amount,
avg(price) as price,
nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(list_date, 'yyyy-mm-dd')) as date1,
max(to_char(list_date, 'yyyy-mm-dd')) as date2
from sghis.ih_advice_fee r
where pham_sign = '0'
and to_char(pay_date, 'yyyy-mm-dd') >= v_begDate
and to_char(pay_date, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and pay_sign = '1'
group by fee_code, price) aa,
sghis.pa_pham_info bb
where aa.fee_code = bb.pham_code(+)
union all
select case sort_id when '01' then '01'when '70' then '01' else sort_id end as invoice_code,
bb.pham_name as fee_name,
bb.packing as spe,
aa.amount,
bb.split_unit as unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2)end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
-1 * nvl(sum(amount), 0) as amount,
avg(price) as price,
-1 * nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(deal_time, 'yyyy-mm-dd')) as date1,
max(to_char(deal_time, 'yyyy-mm-dd')) as date2
from sghis.ih_advice_fee_self t
where pham_sign = '0'
and to_char(deal_time, 'yyyy-mm-dd') >= v_begDate
and to_char(deal_time, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and cancel_sign = '1'
and (deal_sign = '0' or deal_sign = '2')
group by fee_code, price) aa,
sghis.pa_pham_info bb
where aa.fee_code = bb.pham_code(+)
union all
select bb.invoice_code,
bb.item_name as fee_name,
bb.spe,
aa.amount,
bb.unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2) end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
nvl(sum(amount), 0) as amount,
avg(price) as price,
nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(list_date, 'YYYY-MM-DD')) as date1,
max(to_char(list_date, 'YYYY-MM-DD')) as date2
from sghis.ih_advice_fee
where to_char(pay_date, 'yyyy-mm-dd') >= v_begDate
and to_char(pay_date, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and pham_sign = '1'
and pay_sign = '1'
group by fee_code, price) aa,
sghis.hd_price_dict bb
where aa.fee_code = bb.item_code(+)
union all
select bb.invoice_code,
bb.item_name as fee_name,
bb.spe,
aa.amount,
bb.unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2) end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
-1 * nvl(sum(amount), 0) as amount,
avg(price) as price,
-1 * nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(deal_time, 'yyyy-mm-dd')) as date1,
max(to_char(deal_time, 'yyyy-mm-dd')) as date2
from sghis.ih_advice_fee_self
where to_char(deal_time, 'yyyy-mm-dd') >= v_begDate
and to_char(deal_time, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and pham_sign = '1'
and cancel_sign = '1'
and (deal_sign = '0' or deal_sign = '2')
group by fee_code, price) aa,
sghis.hd_price_dict bb
where aa.fee_code = bb.item_code(+)) a,
sghis.hd_invoice_dict d
where a.invoice_code = d.invoice_code(+)
order by a.invoice_code, a.fee_code
) row_ where rownum<= v_start+v_limit) where rownum_>v_start;--这句为了分页
end;
查询总记录数:
create or replace procedure
--住院病人费用清单总记录数
SP_PATIENT_CHARGE_BILL_COUNT
( v_begDate in varchar2,
v_endDate in varchar2,
v_inhos in varchar2,
v_count out number) is
begin
select count(*) into v_count --把查出来的总记录数插入到输出参数中
from (select case sort_id when '01' then '01' when '70' then '01' else sort_id end as invoice_code,
bb.pham_name as fee_name,
bb.packing as spe,
aa.amount,
bb.split_unit as unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2) end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
nvl(sum(amount), 0) as amount,
avg(price) as price,
nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(list_date, 'yyyy-mm-dd')) as date1,
max(to_char(list_date, 'yyyy-mm-dd')) as date2
from sghis.ih_advice_fee r
where pham_sign = '0'
and to_char(pay_date, 'yyyy-mm-dd') >= v_begDate
and to_char(pay_date, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and pay_sign = '1'
group by fee_code, price) aa,
sghis.pa_pham_info bb
where aa.fee_code = bb.pham_code(+)
union all
select case sort_id when '01' then '01'when '70' then '01' else sort_id end as invoice_code,
bb.pham_name as fee_name,
bb.packing as spe,
aa.amount,
bb.split_unit as unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2)end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
-1 * nvl(sum(amount), 0) as amount,
avg(price) as price,
-1 * nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(deal_time, 'yyyy-mm-dd')) as date1,
max(to_char(deal_time, 'yyyy-mm-dd')) as date2
from sghis.ih_advice_fee_self t
where pham_sign = '0'
and to_char(deal_time, 'yyyy-mm-dd') >= v_begDate
and to_char(deal_time, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and cancel_sign = '1'
and (deal_sign = '0' or deal_sign = '2')
group by fee_code, price) aa,
sghis.pa_pham_info bb
where aa.fee_code = bb.pham_code(+)
union all
select bb.invoice_code,
bb.item_name as fee_name,
bb.spe,
aa.amount,
bb.unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2) end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
nvl(sum(amount), 0) as amount,
avg(price) as price,
nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(list_date, 'YYYY-MM-DD')) as date1,
max(to_char(list_date, 'YYYY-MM-DD')) as date2
from sghis.ih_advice_fee
where to_char(pay_date, 'yyyy-mm-dd') >= v_begDate
and to_char(pay_date, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and pham_sign = '1'
and pay_sign = '1'
group by fee_code, price) aa,
sghis.hd_price_dict bb
where aa.fee_code = bb.item_code(+)
union all
select bb.invoice_code,
bb.item_name as fee_name,
bb.spe,
aa.amount,
bb.unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2) end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
-1 * nvl(sum(amount), 0) as amount,
avg(price) as price,
-1 * nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(deal_time, 'yyyy-mm-dd')) as date1,
max(to_char(deal_time, 'yyyy-mm-dd')) as date2
from sghis.ih_advice_fee_self
where to_char(deal_time, 'yyyy-mm-dd') >= v_begDate
and to_char(deal_time, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and pham_sign = '1'
and cancel_sign = '1'
and (deal_sign = '0' or deal_sign = '2')
group by fee_code, price) aa,
sghis.hd_price_dict bb
where aa.fee_code = bb.item_code(+)) a,
sghis.hd_invoice_dict d
where a.invoice_code = d.invoice_code(+)
order by a.invoice_code, a.fee_code;
end;
查询分页:
create or replace procedure
--住院病人费用清单
SP_PATIENT_CHARGE_BILL(v_begDate in varchar2,--输入参数
v_endDate in varchar2,--输入参数
v_inhos in varchar2,--输入参数
v_start in number,--输入参数
v_limit in number,--输入参数
v_result out sghis.his_brsf.HIS_CURSOR) is --输出参数(游标)
begin
open v_result for
select * from (select row_.*, rownum rownum_ from (--这句是为了分页
select invoice_name as invoice_code,
fee_name,
spe,
amount,
unit,
price,
taxmoney,
date1 || '至' || date2 as exec_time,
remark
from (select case sort_id when '01' then '01' when '70' then '01' else sort_id end as invoice_code,
bb.pham_name as fee_name,
bb.packing as spe,
aa.amount,
bb.split_unit as unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2) end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
nvl(sum(amount), 0) as amount,
avg(price) as price,
nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(list_date, 'yyyy-mm-dd')) as date1,
max(to_char(list_date, 'yyyy-mm-dd')) as date2
from sghis.ih_advice_fee r
where pham_sign = '0'
and to_char(pay_date, 'yyyy-mm-dd') >= v_begDate
and to_char(pay_date, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and pay_sign = '1'
group by fee_code, price) aa,
sghis.pa_pham_info bb
where aa.fee_code = bb.pham_code(+)
union all
select case sort_id when '01' then '01'when '70' then '01' else sort_id end as invoice_code,
bb.pham_name as fee_name,
bb.packing as spe,
aa.amount,
bb.split_unit as unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2)end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
-1 * nvl(sum(amount), 0) as amount,
avg(price) as price,
-1 * nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(deal_time, 'yyyy-mm-dd')) as date1,
max(to_char(deal_time, 'yyyy-mm-dd')) as date2
from sghis.ih_advice_fee_self t
where pham_sign = '0'
and to_char(deal_time, 'yyyy-mm-dd') >= v_begDate
and to_char(deal_time, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and cancel_sign = '1'
and (deal_sign = '0' or deal_sign = '2')
group by fee_code, price) aa,
sghis.pa_pham_info bb
where aa.fee_code = bb.pham_code(+)
union all
select bb.invoice_code,
bb.item_name as fee_name,
bb.spe,
aa.amount,
bb.unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2) end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
nvl(sum(amount), 0) as amount,
avg(price) as price,
nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(list_date, 'YYYY-MM-DD')) as date1,
max(to_char(list_date, 'YYYY-MM-DD')) as date2
from sghis.ih_advice_fee
where to_char(pay_date, 'yyyy-mm-dd') >= v_begDate
and to_char(pay_date, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and pham_sign = '1'
and pay_sign = '1'
group by fee_code, price) aa,
sghis.hd_price_dict bb
where aa.fee_code = bb.item_code(+)
union all
select bb.invoice_code,
bb.item_name as fee_name,
bb.spe,
aa.amount,
bb.unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2) end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
-1 * nvl(sum(amount), 0) as amount,
avg(price) as price,
-1 * nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(deal_time, 'yyyy-mm-dd')) as date1,
max(to_char(deal_time, 'yyyy-mm-dd')) as date2
from sghis.ih_advice_fee_self
where to_char(deal_time, 'yyyy-mm-dd') >= v_begDate
and to_char(deal_time, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and pham_sign = '1'
and cancel_sign = '1'
and (deal_sign = '0' or deal_sign = '2')
group by fee_code, price) aa,
sghis.hd_price_dict bb
where aa.fee_code = bb.item_code(+)) a,
sghis.hd_invoice_dict d
where a.invoice_code = d.invoice_code(+)
order by a.invoice_code, a.fee_code
) row_ where rownum<= v_start+v_limit) where rownum_>v_start;--这句为了分页
end;
查询总记录数:
create or replace procedure
--住院病人费用清单总记录数
SP_PATIENT_CHARGE_BILL_COUNT
( v_begDate in varchar2,
v_endDate in varchar2,
v_inhos in varchar2,
v_count out number) is
begin
select count(*) into v_count --把查出来的总记录数插入到输出参数中
from (select case sort_id when '01' then '01' when '70' then '01' else sort_id end as invoice_code,
bb.pham_name as fee_name,
bb.packing as spe,
aa.amount,
bb.split_unit as unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2) end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
nvl(sum(amount), 0) as amount,
avg(price) as price,
nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(list_date, 'yyyy-mm-dd')) as date1,
max(to_char(list_date, 'yyyy-mm-dd')) as date2
from sghis.ih_advice_fee r
where pham_sign = '0'
and to_char(pay_date, 'yyyy-mm-dd') >= v_begDate
and to_char(pay_date, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and pay_sign = '1'
group by fee_code, price) aa,
sghis.pa_pham_info bb
where aa.fee_code = bb.pham_code(+)
union all
select case sort_id when '01' then '01'when '70' then '01' else sort_id end as invoice_code,
bb.pham_name as fee_name,
bb.packing as spe,
aa.amount,
bb.split_unit as unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2)end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
-1 * nvl(sum(amount), 0) as amount,
avg(price) as price,
-1 * nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(deal_time, 'yyyy-mm-dd')) as date1,
max(to_char(deal_time, 'yyyy-mm-dd')) as date2
from sghis.ih_advice_fee_self t
where pham_sign = '0'
and to_char(deal_time, 'yyyy-mm-dd') >= v_begDate
and to_char(deal_time, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and cancel_sign = '1'
and (deal_sign = '0' or deal_sign = '2')
group by fee_code, price) aa,
sghis.pa_pham_info bb
where aa.fee_code = bb.pham_code(+)
union all
select bb.invoice_code,
bb.item_name as fee_name,
bb.spe,
aa.amount,
bb.unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2) end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
nvl(sum(amount), 0) as amount,
avg(price) as price,
nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(list_date, 'YYYY-MM-DD')) as date1,
max(to_char(list_date, 'YYYY-MM-DD')) as date2
from sghis.ih_advice_fee
where to_char(pay_date, 'yyyy-mm-dd') >= v_begDate
and to_char(pay_date, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and pham_sign = '1'
and pay_sign = '1'
group by fee_code, price) aa,
sghis.hd_price_dict bb
where aa.fee_code = bb.item_code(+)
union all
select bb.invoice_code,
bb.item_name as fee_name,
bb.spe,
aa.amount,
bb.unit,
case aa.amount when 0 then 0 else round(aa.taxmoney / aa.amount, 2) end as price,
aa.taxmoney,
date1,
date2,
aa.fee_code,
bb.remark as remark
from (select fee_code,
-1 * nvl(sum(amount), 0) as amount,
avg(price) as price,
-1 * nvl(sum(round(amount * price, 2)), 0) as taxmoney,
min(to_char(deal_time, 'yyyy-mm-dd')) as date1,
max(to_char(deal_time, 'yyyy-mm-dd')) as date2
from sghis.ih_advice_fee_self
where to_char(deal_time, 'yyyy-mm-dd') >= v_begDate
and to_char(deal_time, 'yyyy-mm-dd') <= v_endDate
and inhos_no = v_inhos
and pham_sign = '1'
and cancel_sign = '1'
and (deal_sign = '0' or deal_sign = '2')
group by fee_code, price) aa,
sghis.hd_price_dict bb
where aa.fee_code = bb.item_code(+)) a,
sghis.hd_invoice_dict d
where a.invoice_code = d.invoice_code(+)
order by a.invoice_code, a.fee_code;
end;
发表评论
-
oracle建表空间和用户语句
2013-01-29 10:34 1361--创建表空间 CREATE TABLESPACE ... -
ORACLE创建用户和创建数据库的区别
2013-01-29 09:52 1125通俗点说 首先你安装了Oracle,这本身是个软件对吧? 安 ... -
ORA-28002:the password will expire within string days
2012-11-27 10:32 945问题描述: 登陆oracle 11g 提示ERROR:OR ... -
解决 ERROR - ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务
2010-04-13 09:36 1279服务器莫名其妙的报这个错,之前一直正常,从google获取解决 ... -
ORACLE NUMBER类型详解
2009-12-11 09:46 10081>.NUMBER类型细讲: Oracle number ... -
oracle case when与decode语句
2009-10-11 11:26 2162今天遇到sql语句中要判断不知道怎么做,于是找了一下,哈哈or ...
相关推荐
本文实例讲述了Python使用cx_Oracle调用Oracle存储过程的方法。分享给大家供大家参考,具体如下: 这里主要测试在Python中通过cx_Oracle调用PL/SQL。 首先,在数据库端创建简单的存储过程。 create or replace ...
oracle 存储过程实例 oracle存储过程实例
oracle 存储过程导出excel oracle 存储过程导出excel oracle 存储过程导出excel oracle 存储过程导出excel oracle 存储过程导出excel
oracle 存储过程 unwrap 图形解密 工具
ibatis调用oracle存储过程分页
可以将SQL Server存储过程转为oracle存储过程的工具
oracle存储过程加密破解 0
帆软报表调用Oracle存储过程如果存储过程定义中没有参数,但是设计器中缺弹出一个storeParameter1参数的解决插件
oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记oracle存储过程笔记
Oracle存储过程中使用临时表 会话级临时表 事务级临时表
oracle 存储过程批量提交
使用java实现oracle存储过程。 共有3个小例子。实现的功能 1、无返回值的存储过程 如 insert 2、有返回值的存储过程(非列表)select id from tab 3、返回列表 如:select * from tab 顺便鄙视下csdn,作为一个it...
oracle存储过程学习经典入门 非常好的 初学者必看
oracle 存储过程的基本语法 1.基本结构 CREATE OR REPLACE PROCEDURE 存储过程名字 ( 参数1 IN NUMBER, 参数2 IN NUMBER ) IS 变量1 INTEGER :=0; 变量2 DATE; BEGIN END 存储过程名字 2.SELECT INTO ...
oracle 存储过程 函数 dblink 绝对对工作和平时学习有价值的资料。针对个人具体情况做修改即可使用
oracle 存储过程实例 oracle 存储过程实例 oracle 存储过程实例 oracle 存储过程实例
4、开发指南:《Oracle存储过程入门指南&100+种真实业务场景存储过程实例.pdf》,可以帮助初学者系统学习。 5、资源包括“通用存储过程整理” 和 “真实业务存储过程整理” 两部分,通用适合各种系统,可以无缝隙...
行业内Oracle存储过程最基本的开法规范,适合oracle入门小白学习
linux系统中使用shell脚本对oracle存储过程进行编译
Oracle存储过程分页代码 Oracle存储过程分页代码 Oracle存储过程分页代码 Oracle存储过程分页代码 Oracle存储过程分页代码