source: WorldVistAEHR/trunk/r/E_CLAIMS_MGMT_ENGINE-BPS/BPSOSQG.m@ 1504

Last change on this file since 1504 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.9 KB
Line 
1BPSOSQG ;BHAM ISC/FCS/DRS/FLS - form transmission packets ;06/01/2004
2 ;;1.0;E CLAIMS MGMT ENGINE;**1,5**;JUN 2004;Build 45
3 ;;Per VHA Directive 2004-038, this routine should not be modified.
4 Q
5 ;
6 ; PACKET
7 ; Calls BPSOSCA to get claims data (BPS array)
8 ; Calls BPSECA1 to create packet
9 ; Calls CHOP^BPSECMC2 to send packet to HL7 application
10 ;
11PACKET() ;EP - BPSOSQ2
12 ; packetize one prescription (and possibly more prescriptions
13 ; for the same patient, if they're ready now.)
14 ; Called from BPSOSQ2,
15 ; which gave us RXILIST(IEN59) array of claims to packetize.
16 ;
17 N CLAIMIEN,ERROR,FIRST59
18 ;
19 ; Get first transaction from list
20 S FIRST59=$O(RXILIST(0))
21 ;
22 ; If it's a reversal, we already have an ^BPSC(, which was
23 ; created by the call to BPSECA8, way back at the beginning.
24 ; So, unlike claims, we need only the NCPDP formatting for it
25 ; by creating CLAIMIEN array and jumping to POINTM
26 I $G(^BPST(FIRST59,4)) D G POINTM
27 . ; Mimic a few things that are set up in the code we're skipping
28 . S CLAIMIEN=$P(^BPST(FIRST59,4),U)
29 . S CLAIMIEN(CLAIMIEN)=""
30 ;
31 ; DMB - This code will only be executed if there is more than one
32 ; transaction in RXILIST. This will not happen for the VA but leave
33 ; functionality in case we bundle claims later
34 I $O(RXILIST($O(RXILIST("")))) D
35 . D LOG2LIST^BPSOSL($T(+0)_"-Packetizing - we have more than one claim:")
36 . N I,X,Y S (X,Y)=""
37 . F I=1:1 S X=$O(RXILIST(X)) Q:'X D
38 . . S $P(Y,", ",I-1#4+1)=X
39 . . I I#4=0 D LOG2LIST^BPSOSL(Y) S Y=""
40 . I Y]"" D LOG2LIST^BPSOSL(Y)
41 ;
42 ; BPSOSCA calls BPSOSCB,BPSOSCC,BPSOSCD to set up BPS(*) and
43 ; then calls BPSOSCE to create claims in 9002313.02
44 ; BPSOSCA expects RXILIST(*) to be defined and will return
45 ; ERROR - any error encountered
46 ; CLAIMIEN - last claim created
47 ; CLAIMIEN(CLAIMIEN) - the list of all claims created
48 S ERROR=$$EN^BPSOSCA(.CLAIMIEN)
49 I ERROR D LOG2LIST^BPSOSL($T(+0)_"-ERROR="_ERROR_" returned from BPSOSCA")
50 I $G(CLAIMIEN)<1 Q $S(ERROR:ERROR,1:"300^No Claim IEN returned by BPSOSCA")
51 ;
52 ; POINTM will create the claims packet and put them in XTMP
53POINTM ; Reversals are joining again here
54 N VAMSG,IEN59,ERROR
55 ;
56 ; CLAIMIEN(*) = a list of CLAIMIENs that were generated from
57 ; all the prescriptions that might have been bundled together.
58 ; So we must loop through that list.
59 ; Currently, VA does not bundle claims. If it does so,
60 ; we may want to change error handling.
61 S ERROR=0,CLAIMIEN=""
62 F S CLAIMIEN=$O(CLAIMIEN(CLAIMIEN)) Q:CLAIMIEN="" D
63 . S IEN59=$O(^BPST("AE",CLAIMIEN,""))
64 . I IEN59="" S IEN59=$O(^BPST("AER",CLAIMIEN,""))
65 . I IEN59="" S ERROR="500^Transaction IEN not determined for "_CLAIMIEN Q
66 . D SETSTAT^BPSOSU(IEN59,50)
67 . K VAMSG
68 . D LOG2CLM^BPSOSL(CLAIMIEN,$T(+0)_"-Packet being built for Claim ID "_$P(^BPSC(CLAIMIEN,0),U))
69 . D ASCII^BPSECA1(CLAIMIEN,.VAMSG)
70 . I '$G(VAMSG("HLS",0)) S ERROR="501^Claim packet not built for "_$P($G(^BPSC(CLAIMIEN,0)),U,1) Q
71 . D CHOP^BPSECMC2(.VAMSG,CLAIMIEN,IEN59)
72 Q ERROR
Note: See TracBrowser for help on using the repository browser.