Oracle 下醫囑執行函數

來源:互聯網
上載者:User

//***********************************************************************
//函數名稱: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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.