Oracle doctor's advice execution function _ Oracle Application _ script house

Source: Internet
Author: User
Oracle doctor's advice execution function

Oracle doctor's advice execution function

//************************************** *********************************
// Function name: of_zy_yzfy for n_medicare_minihis
// Function Description: Submit the doctor's advice when the doctor's advice is entered
// Function parameters:
// 1. S_yb_zy_yzfy astr_jyxx medical order fee information
// Function return: (BOOLEAN)
// Author: annicybc time: 2006/03/22
//************************************** *********************************
// ================================================ ==========================================================
// Transaction function description:
//------------------------------------------------------------------------------
// Entry parameter (Data)
// Null ~ Null ~ Null ~ Blank + hospitalization number submitted for this medical order + List of Medical Order fees for this medical order ZYMX (separated by %)
// Medical bill list ZYMX
// ([] Indicates that repeatable records can be repeated. The two repeated records are also separated by %) =
// Number of details submitted this time % [Detailed serial number (N20) + visiting type (11 outpatient, 21 inpatient, char (2) +
// Return sign (1 return sign, 0 normal, char (1) + category sign (1 drug, 2 diagnosis and treatment, char (1) +
// Project center end no. (Varchar (20) + project hospital end code (Varchar (20) + project hospital end name (varchar (40) +
// Project hospital end specification (varchar (30) + project hospital end unit (varchar (8) + doctor's date (DATETIME) +
// Doctor's name (varchar (20) + project unit price (N () + project quantity (N (), negative at the time of withdrawal) + project number (1) +
// Project amount (N (10, 4) + self-bearing ratio (N (5, 4) + single compound sign (C1)]
//------------------------------------------------------------------------------
// Message)
// Transaction result ~ Error message + null ~ Null ~ Empty + List of hospitalization numbers that cannot be saved + List of cost sequential numbers that cannot be saved (separated by %)
// ================================================ ==========================================================

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 Prescription2 = '', Prescription2 ='', Prescription3 =''
String indexes, ls_jzlx, ls_tybz, numbers, ls_yzrq, ls_ysxm, Ls_xmdj, Ls_xmsl, Ls_xmts, Ls_xmje, Ls_zfbl, and Baidu


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 = "An error occurred while applying for a transaction number! "
Return false
End if

// Obtain the detailed data generated after executing the doctor's order corresponding to the hospitalization number
// Drugs
Select count (*) into: li_detailsum from zy_sfmx where zyhm =: ls_zyhm and ybtj = '0' using sqlhis;
DECLARE SFMX CURSOR
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 (. fyrq, 'yyyy. mm. dd'), to_char (c. ysxm), to_char (. fydj, '2017. 0000 '), to_char (. fysl, '2017. 0000 '), to_char (1), to_char (. fydj *. fysl, '2017. 0000 '), to_char (. 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 // drug
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
Prefill = prefill + 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 = prefill + 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 = prefill + 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) + "~~ "+ Preprocessor
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) // unpack data
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 = "failed to upload medical insurance data !~ N ~ N "+ lpData
Return false
End if

If trim (ls_wfbc_zyhlb) <> ''then
Of_checkout2 (ls_wfbc_zyhlb, ref ls_checkdata2) // break down the hospitalization numbers that cannot be saved
For h = 1 to Upperbound (ls_checkdata2)
Astr_jyxx.outzyhm [I + h-1] = long (ls_checkdata2 [h]) // encapsulate hospitalization numbers consecutively to avoid Overwriting
Next
End if
If trim (ls_wfbc_yzlslb) <> ''then
Of_checkout2 (ls_wfbc_yzlslb, ref ls_checkdata2) // List of Medical Order serial numbers that cannot be saved
For h = 1 to Upperbound (ls_checkdata2)
Astr_jyxx.outyzls [I + int (j/10) + 1 + h-1-1] = long (ls_checkdata2 [h]) // sequential medical order number encapsulation to avoid Overwriting
Next
End if
If trim (ls_wfbc_fylslb) <> ''then
Of_checkout2 (ls_wfbc_fylslb, ref ls_checkdata2) // You can describe the list of fee serial numbers that cannot be saved.
For I = 1 to Upperbound (ls_checkdata2)
Astr_jyxx.outfyls [I + int (j/10) + 1 + h-1-1] = long (ls_checkdata2 [I]) // continuously encapsulate the billing serial number to avoid Overwriting
Next
End if

End if

Choose case li_Rtn
Case-1
Is_Error = "failed to upload medical insurance data !~ N ~ N "+ lpData
Return false
Case-2
Is_Error = "failed to upload medical insurance data! At least one hospitalization number fails to be verified because it is not in hospital ~ N ~ N "+ lpData
Return false
Case-3
Is_Error = "failed to upload medical insurance data! At least one charge details cannot be saved ~ N ~ N "+ lpData
Return false
End choose

If li_Rtn <0 then
Is_Error = "failed to upload medical insurance data !~ N ~ N "+ lpData
Return false
End if
///////
END IF
NEXT
NEXT

RETURN True

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.