_oracle application of Oracle doctor's order execution function

Source: Internet
Author: User

//***********************************************************************
Function name: Of_zy_yzfy for N_medicare_minihis
Function Note: The doctor's advice should be submitted to the doctor after entry
Function arguments:
1.s_yb_zy_yzfy Astr_jyxx doctor's order fee information
function return: (BOOLEAN)
Author: annicybc Time: 2006/03/22
//***********************************************************************
//==============================================================================
Transaction function Description:
//------------------------------------------------------------------------------
Entry parameters (data)
Empty ~ Empty ~ empty + the hospitalization number of the present medical advice + the doctor's order fee list zymx (separated by%)
List of Doctor's order fees ZYMX
([] It is possible to repeat and repeat the two records separated by a%) =
The submission detail number%%[detail serial number (N20) + Doctor type (11 outpatient, 21 hospitalization, char (2)) +
Drug withdrawal sign (1 off, 0 normal, char (1)) + category mark (1 drugs, 2 clinics, char (1)) +
Project Center End Number (Varchar (20)) + Project Hospital-side Code (VARCHAR (20)) + Project Hospital End name (Varchar (40)) +
Project Hospital-side specification (varchar (30)) + Project Hospital end Unit (varchar (8)) + Doctor's Day (DATETIME) +
Doctor's name (varchar (20)) + Item Price (n (12,4)) + Item quantity (n (12,4), negative when returning medicine) + Project Sticker (fill 1) +
Project Amount (n (10,4)) + Ego ratio (n (5,4)) + single Compound logo (C1)]
//------------------------------------------------------------------------------
Export parameters (message)
Transaction Result ~ Error message + Empty ~ Empty ~ Empty + Unable to save list of hospitalization numbers + cannot save the list of rates (% separated by the list)
//==============================================================================

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 =-1 Then
Is_error = "Failed to apply for transaction number!"
return False
End If

The detailed data resulting from the execution of the doctor's order after the hospital number is taken
Drug
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 (), 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//drugs
Select NVL (YPMC, ' none '), NVL (Ypgg, ' none '), 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//fee
Select NVL (FYMC, ' none ')
Into:ls_xmyymc
From Gy_fyml
where ybbh=:ls_xmzxbh and fyxh =: LS_XMYYBM using Sqlhis;
Ls_xmyygg= ' None '
ls_dffbz= ' 0 '
Ls_xmyydw= ' None '
End If
CHOOSE case Int (J/10) +1
Case 1
prescription = prescription + trim (LS_LSXH) + "percent%" +trim (LS_JZLX) + "percent" +trim (LS_TYBZ) + "percent" +trim (LS_LBBZ) + "%" +&
Trim (LS_XMZXBH) + "percent%" +trim (LS_XMYYBM) + "percent%" +trim (LS_XMYYMC) + "percent%" +trim (ls_xmyygg) + "%" +trim (LS_XMYYDW) +&
"Percent" +trim (LS_YZRQ) + "%" +trim (LS_YSXM) + "%" +trim (LS_XMDJ) + "%" +trim (LS_XMSL) + "%" +trim (LS_XMTS) + "%" +&
Trim (Ls_xmje) + "percent%" +trim (LS_ZFBL) + "%" +trim (LS_DFFBZ);
Case 2
Prescription2 = prescription + Trim (LS_LSXH) + "percent%" +trim (LS_JZLX) + "percent" +trim (LS_TYBZ) + "percent" +trim (LS_LBBZ) + "%" +&
Trim (LS_XMZXBH) + "percent%" +trim (LS_XMYYBM) + "percent%" +trim (LS_XMYYMC) + "percent%" +trim (ls_xmyygg) + "%" +trim (LS_XMYYDW) +&
"Percent" +trim (LS_YZRQ) + "%" +trim (LS_YSXM) + "%" +trim (LS_XMDJ) + "%" +trim (LS_XMSL) + "%" +trim (LS_XMTS) + "%" +&
Trim (Ls_xmje) + "percent%" +trim (LS_ZFBL) + "%" +trim (LS_DFFBZ);
Case ELSE
Prescription3 = prescription + Trim (LS_LSXH) + "percent%" +trim (LS_JZLX) + "percent" +trim (LS_TYBZ) + "percent" +trim (LS_LBBZ) + "%" +&
Trim (LS_XMZXBH) + "percent%" +trim (LS_XMYYBM) + "percent%" +trim (LS_XMYYMC) + "percent%" +trim (ls_xmyygg) + "%" +trim (LS_XMYYDW) +&
"Percent" +trim (LS_YZRQ) + "%" +trim (LS_YSXM) + "%" +trim (LS_XMDJ) + "%" +trim (LS_XMSL) + "%" +trim (LS_XMTS) + "%" +&
Trim (Ls_xmje) + "percent%" +trim (LS_ZFBL) + "%" +trim (LS_DFFBZ);
End CHOOSE
J + +
LOOP
Close SFMX;

IF J < ten THEN
LPDATA[1] = "$$~~~~~~" + ls_zyhm + "~ ~" + char (j) + "~" + prescription
ELSEIF J < 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)//Data unpack
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 = "Upload health care data failed!~n~n" + lpdata
return False
End If

If Trim (LS_WFBC_ZYHLB) <> ' Then
Of_checkout2 (Ls_wfbc_zyhlb,ref ls_checkdata2)//decomposing the hospital number that cannot be saved
For h = 1 to Upperbound (LS_CHECKDATA2)
Astr_jyxx.outzyhm[i+h-1] = Long (ls_checkdata2[h])//The hospitalization number is continuously encapsulated to avoid covering
Next
End If
If Trim (ls_wfbc_yzlslb) <> ' Then
Of_checkout2 (Ls_wfbc_yzlslb,ref ls_checkdata2)//decomposition cannot be saved by the list of prescribed water numbers
For h = 1 to Upperbound (LS_CHECKDATA2)
Astr_jyxx.outyzls[i+int (J/10) +1+h-1-1] = Long (LS_CHECKDATA2[H))//The serial number of the doctor's order is encapsulated continuously to avoid covering
Next
End If
If Trim (ls_wfbc_fylslb) <> ' Then
Of_checkout2 (Ls_wfbc_fylslb,ref ls_checkdata2)//decomposition cannot save the cost of the serial number list
For i = 1 to Upperbound (LS_CHECKDATA2)
Astr_jyxx.outfyls[i+int (J/10) +1+h-1-1] = Long (ls_checkdata2[i))//will be the cost of serial package, avoid overwriting
Next
End If

End If

Choose Case Li_rtn
Case-1
Is_error = "Upload health care data failed!~n~n" + lpdata
return False
Case-2
Is_error = "Failed to upload health care data!" At least one hospitalization number failed to check out because it was not in hospital ~n~n "+ lpdata
return False
Case-3
Is_error = "Upload health care data failed!" At least one expense detail cannot be saved ~n~n "+ lpdata
return False
End Choose

If Li_rtn<0 Then
Is_error = "Upload health care data failed!~n~n" + lpdata
return False
End If
///////
End IF
NEXT
NEXT

Return True

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.