Home > Database > Mysql Tutorial > Oracle 下医嘱执行函数_Oracle应用_脚本之家

Oracle 下医嘱执行函数_Oracle应用_脚本之家

WBOY
Release: 2016-06-07 18:05:04
Original
1557 people have browsed it

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 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 lpData[1] = "$$~~~~~~" + ls_zyhm + "~~" + char(j) + "~~" + Prescription
ELSEIF J 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 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 is_Error = "上传医保数据失败!~n~n" + lpData
return false
end if
///////
END IF
NEXT
NEXT

RETURN True

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template