Oracle 下医嘱执行函数
//***********************************************************************
//函数名称:of_zy_yzfy for n_medicare_minihis
//功能说明:医嘱录入后执行时提交医嘱
//函数参数:
// 1.s_yb_zy_yzfy astr_jyxx 医嘱费用信息
//函数返回: (boolean)
//作者:annicybc 时间:2006/03/22
//***********************************************************************
//==============================================================================
// 交易函数说明:
//------------------------------------------------------------------------------
// 入口参数(data)
// 空~空~空~空 + 本次提交医嘱的住院号+ 该住院号的医嘱费用列表zymx(用%%分隔)
//医嘱费用列表zymx
//([]表示可以重复,重复的两条纪录之间也以%%分隔)=
//本次提交明细条数%%[明细序号(n20)+就诊类型(11门诊,21住院,char(2))+
//退药标志(1退药,0正常,char(1))+类别标志(1药品,2诊疗,char(1))+
//项目中心端编号(varchar(20))+项目医院端编码(varchar(20))+项目医院端名称(varchar(40))+
//项目医院端规格(varchar(30))+项目医院端单位(varchar(8))+医嘱日期(datetime)+
//医生姓名(varchar(20))+项目单价(n(12,4))+项目数量(n(12,4),退药时为负数)+项目贴数(填1)+
//项目金额(n(10,4))+自负比例(n(5,4))+单复方标志(c1)]
//------------------------------------------------------------------------------
// 出口参数(message)
// 交易结果~错误信息+空~空~空 + 无法保存的住院号列表 + 无法保存的费用流水号列表(列表间%%分隔)
//==============================================================================
string lpdata[3]
string lpmessage = space(3000),ls_data2=space(3000)
string ls_checkdata[],ls_checkdata2[]
integer li_rtn,i=1,j=1,k=1,h=1,li_detailsum
string ls_zyhm='',ls_wfbc_zyhlb='',ls_wfbc_yzlslb='',ls_wfbc_fylslb='',ls_yzfylb=''
string prescription = '',prescription2 = '',prescription3 = ''
string ls_lsxh,ls_jzlx,ls_tybz,ls_lbbz,ls_xmzxbh,ls_xmyybm,ls_xmyymc,ls_xmyygg,ls_xmyydw,ls_yzrq,ls_ysxm,ls_xmdj,ls_xmsl,ls_xmts,ls_xmje,ls_zfbl,ls_dffbz
for i = 1 to upperbound(astr_jyxx.inzyhm)
ls_zyhm = trim(string(astr_jyxx.inzyhm[i]))
if of_get_tradeid(33) = -1 then
is_error = "申请交易号失败!"
return false
end if
//取到该住院号对应的医嘱执行后产生的明细数据
//药品
select count(*) into :li_detailsum from zy_sfmx where zyhm = :ls_zyhm and ybtj = '0' using sqlhis;
declare sfmx cursor for
select lsxh from zy_sfmx where zyhm = :ls_zyhm and ybtj = '0' using sqlhis;
open sfmx;
j = 1
do while j <= li_detailsum
fetch sfmx into :ls_lsxh;
// ln_lsxh,ls_jzlx,ls_tybz,ls_lbbz,ls_xmzxbh,ls_xmyybm,"ls_xmyymc","ls_xmyygg",
//"ls_xmyydw",ldt_yzrq,ls_ysxm,ln_xmdj,ln_xmsl,ln_xmts,ln_xmje,ln_zfbl,ls_dffbz
select to_char(a.lsxh),to_char(21),to_char(0),to_char(a.xmlx),to_char(a.ybxh),to_char(a.xmxh),
to_char(a.fyrq,'yyyy.mm.dd'),to_char(c.ysxm),to_char(a.fydj,'99999990.0000'),to_char(a.fysl,'99999990.0000'),to_char(1),to_char(a.fydj*a.fysl,'999990.0000'),to_char(a.zfbl,'0.0000'),to_char(b.dffbz)
into :ls_lsxh,:ls_jzlx,:ls_tybz,:ls_lbbz,:ls_xmzxbh,:ls_xmyybm,
:ls_yzrq,:ls_ysxm,:ls_xmdj,:ls_xmsl,:ls_xmts,:ls_xmje,:ls_zfbl
from zy_sfmx a,gy_ypml b,gy_ysml c
where a.zyhm = :ls_zyhm and a.ybtj = '0' and a.xmlx = 1 and a.xmxh = b.ypxh and a.kzys = c.ysdm
order by lsxh
using sqlhis;
if ls_lbbz='1' then//药品
select nvl(ypmc,'无'),nvl(ypgg,'无'),to_char(dffbz,'0'),to_char(zydw)
into :ls_xmyymc,:ls_xmyygg,:ls_dffbz,:ls_xmyydw
from gy_ypml
where ybbh=:ls_xmzxbh and ypxh = :ls_xmyybm
using sqlhis;
elseif ls_lbbz='2' then//费用
select nvl(fymc,'无')
into :ls_xmyymc
from gy_fyml
where ybbh=:ls_xmzxbh and fyxh = :ls_xmyybm using sqlhis;
ls_xmyygg='无'
ls_dffbz='0'
ls_xmyydw='无'
end if
choose case int(j/10)+1
case 1
prescription = prescription + trim(ls_lsxh)+"%%"+trim(ls_jzlx)+"%%"+trim(ls_tybz)+"%%"+trim(ls_lbbz)+"%%"+&
trim(ls_xmzxbh)+"%%"+trim(ls_xmyybm)+"%%"+trim(ls_xmyymc)+"%%"+trim(ls_xmyygg)+"%%"+trim(ls_xmyydw)+&
"%%"+trim(ls_yzrq)+"%%"+trim(ls_ysxm)+"%%"+trim(ls_xmdj)+"%%"+trim(ls_xmsl)+"%%"+trim(ls_xmts)+"%%"+&
trim(ls_xmje)+"%%"+trim(ls_zfbl)+"%%"+trim(ls_dffbz);
case 2
prescription2 = prescription + trim(ls_lsxh)+"%%"+trim(ls_jzlx)+"%%"+trim(ls_tybz)+"%%"+trim(ls_lbbz)+"%%"+&
trim(ls_xmzxbh)+"%%"+trim(ls_xmyybm)+"%%"+trim(ls_xmyymc)+"%%"+trim(ls_xmyygg)+"%%"+trim(ls_xmyydw)+&
"%%"+trim(ls_yzrq)+"%%"+trim(ls_ysxm)+"%%"+trim(ls_xmdj)+"%%"+trim(ls_xmsl)+"%%"+trim(ls_xmts)+"%%"+&
trim(ls_xmje)+"%%"+trim(ls_zfbl)+"%%"+trim(ls_dffbz);
case else
prescription3 = prescription + trim(ls_lsxh)+"%%"+trim(ls_jzlx)+"%%"+trim(ls_tybz)+"%%"+trim(ls_lbbz)+"%%"+&
trim(ls_xmzxbh)+"%%"+trim(ls_xmyybm)+"%%"+trim(ls_xmyymc)+"%%"+trim(ls_xmyygg)+"%%"+trim(ls_xmyydw)+&
"%%"+trim(ls_yzrq)+"%%"+trim(ls_ysxm)+"%%"+trim(ls_xmdj)+"%%"+trim(ls_xmsl)+"%%"+trim(ls_xmts)+"%%"+&
trim(ls_xmje)+"%%"+trim(ls_zfbl)+"%%"+trim(ls_dffbz);
end choose
j++
loop
close sfmx;
if j < 10 then
lpdata[1] = "$$~~~~~~" + ls_zyhm + "~~" + char(j) + "~~" + prescription
elseif j < 20 then
lpdata[2] = "$$~~~~~~" + ls_zyhm + "~~" + char(j - 10) + "~~" + prescription2
else
lpdata[3] = "$$~~~~~~" + ls_zyhm + "~~" + char(j - 20) + "~~" + prescription3
end if
for k = 1 to 3
if isnull( lpdata[k] ) = false then
li_rtn = f_userbargaingapply(33,uniquelytradeid,lpdata[k],lpmessage,ls_data2)
///////
lpmessage = of_dataunwrap(lpmessage) //数据解包
of_checkout(lpmessage,ref ls_checkdata)
lpdata[i]=lpmessage
if li_rtn < 0 then
if upperbound(ls_checkdata) = 6 then
ls_wfbc_zyhlb = ls_checkdata[4]
ls_wfbc_yzlslb = ls_checkdata[5]
ls_wfbc_fylslb = ls_checkdata[6]
elseif upperbound(ls_checkdata) = 1 then
is_error = "上传医保数据失败!~n~n" + lpdata
return false
end if
if trim(ls_wfbc_zyhlb) <> '' then
of_checkout2(ls_wfbc_zyhlb,ref ls_checkdata2)//分解无法保存的住院号
for h = 1 to upperbound(ls_checkdata2)
astr_jyxx.outzyhm[i+h-1] = long(ls_checkdata2[h])//将住院号连续封装,避免覆盖
next
end if
if trim(ls_wfbc_yzlslb) <> '' then
of_checkout2(ls_wfbc_yzlslb,ref ls_checkdata2)//分解无法保存的医嘱流水号列表
for h = 1 to upperbound(ls_checkdata2)
astr_jyxx.outyzls[i+int(j/10)+1+h-1-1] = long(ls_checkdata2[h]) //将医嘱流水号连续封装,避免覆盖
next
end if
if trim(ls_wfbc_fylslb) <> '' then
of_checkout2(ls_wfbc_fylslb,ref ls_checkdata2)//分解无法保存的费用流水号列表
for i = 1 to upperbound(ls_checkdata2)
astr_jyxx.outfyls[i+int(j/10)+1+h-1-1] = long(ls_checkdata2[i])//将费用流水号连续封装,避免覆盖
next
end if
end if
choose case li_rtn
case -1
is_error = "上传医保数据失败!~n~n" + lpdata
return false
case -2
is_error = "上传医保数据失败!至少有一个住院号由于不在住院中而校验失败~n~n" + lpdata
return false
case -3
is_error = "上传医保数据失败!至少有一条费用明细不能保存~n~n" + lpdata
return false
end choose
if li_rtn<0 then
is_error = "上传医保数据失败!~n~n" + lpdata
return false
end if
///////
end if
next
next
return true
推荐阅读
-
Oracle 下医嘱执行函数
-
Linux下通过gettimeofday函数获取程序段执行时间【推荐】
-
linux下使用gettimeofday函数获取程序执行时间
-
Oracle 下医嘱执行函数
-
jQuery下Ajax 执行回调函数的原理success、error、complete
-
“<”,javasciprt下jquery函数$.post执行无响应的原因
-
Oracle 下医嘱执行函数_Oracle应用_脚本之家
-
解决火狐浏览器下JS setTimeout函数不兼容失效不执行的方法_javascript技巧
-
解决windows下npm安装的模块执行报错:无法将“cnpm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。
-
Linux下用SHELL脚本执行带输入输出参数的ORACLE存储过程并得到结果