1 | IBCESRV3 ;ALB/TMP - Server based Auto-update utilities - IB EDI ;03/05/96
|
---|
2 | ;;2.0;INTEGRATED BILLING;**137,155**;21-MAR-94
|
---|
3 | ; IA 4129 for call to DUZ^XUP
|
---|
4 | Q
|
---|
5 | ;
|
---|
6 | EOB835 ; Explanation of Benefits - auto update
|
---|
7 | ; Input expected: IBTDA = the ien of the message entry in file 364.2
|
---|
8 | ;
|
---|
9 | ; This is the background task that is queued to run by TaskManager.
|
---|
10 | ; The call which queues this task is found in TRTN^IBCESRV1 which is
|
---|
11 | ; called by ADD^IBCESRV.
|
---|
12 | ;
|
---|
13 | N IB0,IBBDA,IBBILL,IBMSG,IBFLAG,IBTYP,IBBST,DR,DA,DIE,Z,MRAUSER
|
---|
14 | ;
|
---|
15 | Q:'$G(IBTDA)
|
---|
16 | S IB0=$G(^IBA(364.2,IBTDA,0)),IBBDA=+$P(IB0,U,4) ; Batch ien
|
---|
17 | S IBTYP=$P($G(^IBE(364.3,+$P(IB0,U,2),0)),U) ; IB message type
|
---|
18 | Q:IBTYP'="835EOB"
|
---|
19 | ;
|
---|
20 | ; The MRA Project is using a specific non-human user for all
|
---|
21 | ; 835 EOB/MRA filing processes. Change the DUZ to be this user.
|
---|
22 | ; *** VA SACC approved this exemption 5-June-2003 ***
|
---|
23 | ; *** Integration Agreement 4129 - Activated on 30-June-2003 ***
|
---|
24 | ;
|
---|
25 | S MRAUSER=$$MRAUSR^IBCEMU1()
|
---|
26 | I MRAUSER>0,$$ISITMRA(IBTDA) NEW DUZ D DUZ^XUP(MRAUSER)
|
---|
27 | ;
|
---|
28 | D UPDEOB(IBTDA)
|
---|
29 | ;
|
---|
30 | Q
|
---|
31 | ;
|
---|
32 | UPDEOB(IBTDA) ; Explanation of Benefits or MRA
|
---|
33 | ; Update data base from msg (store EOB in file 361.1)
|
---|
34 | ; IBTDA = ien of message in file 364.2
|
---|
35 | ;
|
---|
36 | N IBBILL,PRCASV,DA,DIE,DR,DA,X,Y,IBFLAG,IB0,IBS
|
---|
37 | N IBEOB,IBAUTO,IBIFN,IBERRMSG
|
---|
38 | ;
|
---|
39 | D UPDMSG^IBCESRV2(IBTDA,"U",0) ; updating data in 364.2
|
---|
40 | S IB0=$G(^IBA(364.2,IBTDA,0))
|
---|
41 | ;
|
---|
42 | I '$P(IB0,U,5) G UPDEOBX ; no transmit bill# in file 364
|
---|
43 | S IBEOB=$$UPDEOB^IBCEOB(IBTDA) ; new entry in file 361.1
|
---|
44 | I 'IBEOB G UPDEOBX ; exit if some failure
|
---|
45 | ;
|
---|
46 | ; update transmission status of transmission Bill# in file 364
|
---|
47 | ; status is closed (code "Z")
|
---|
48 | D BILLSTAC^IBCESRV2($P(IB0,U,5),"Z") ;Upd indiv transmitted bill
|
---|
49 | ;
|
---|
50 | ; Delete the entry from file 364.2
|
---|
51 | D DELMSG^IBCESRV2(IBTDA)
|
---|
52 | ;
|
---|
53 | ; If the EOB is not a Medicare MRA, then we can stop here
|
---|
54 | I $P($G(^IBM(361.1,IBEOB,0)),U,4)'=1 G UPDEOBX
|
---|
55 | ;
|
---|
56 | ; *** Medicare MRA processing ***
|
---|
57 | ;
|
---|
58 | ; update the claim MRA status of the file 399 bill
|
---|
59 | ; to be "C" - Valid MRA received
|
---|
60 | D MRASTAT(IBEOB,"C")
|
---|
61 | ;
|
---|
62 | ; Invoke the EOB criteria check and attempt to create and authorize
|
---|
63 | ; the secondary bill
|
---|
64 | S IBAUTO=$$CRIT^IBCEMQC(IBEOB)
|
---|
65 | I 'IBAUTO D AUTOMSG(IBEOB,$P(IBAUTO,U,2)) G UPDEOBX
|
---|
66 | S IBIFN=$P($G(^IBA(364,+$P(IB0,U,5),0)),U,1) ; bill# from file 364
|
---|
67 | ;
|
---|
68 | ; Process COB, create secondary bill
|
---|
69 | S IBERRMSG=""
|
---|
70 | D AUTOCOB^IBCEMQA(IBIFN,IBEOB,.IBERRMSG)
|
---|
71 | I IBERRMSG'="" D AUTOMSG(IBEOB,IBERRMSG) G UPDEOBX
|
---|
72 | ;
|
---|
73 | ; Authorize the secondary bill
|
---|
74 | D AUTH^IBCEMQA(IBIFN,.IBERRMSG)
|
---|
75 | I IBERRMSG'="" D AUTOMSG(IBEOB,IBERRMSG) G UPDEOBX
|
---|
76 | ;
|
---|
77 | UPDEOBX ;
|
---|
78 | S ZTREQ="@"
|
---|
79 | Q
|
---|
80 | ;
|
---|
81 | AUTOMSG(IBEOB,MSG) ; File the automatic bill generation failure message
|
---|
82 | NEW DIE,DA,DR,D,D0,DI,DIC,DQ,X,Y
|
---|
83 | S IBEOB=+$G(IBEOB),MSG=$G(MSG)
|
---|
84 | I '$D(^IBM(361.1,IBEOB)) G AUMSGX
|
---|
85 | I MSG="" G AUMSGX
|
---|
86 | S DIE=361.1,DA=IBEOB,DR="30.01////"_MSG_";30.02////"_$$NOW^XLFDT
|
---|
87 | D ^DIE
|
---|
88 | AUMSGX ;
|
---|
89 | Q
|
---|
90 | ;
|
---|
91 | MRASTAT(IBEOB,STAT) ; Update the claim MRA status field on the bill
|
---|
92 | ; File 399, Field 24 - CLAIM MRA STATUS
|
---|
93 | NEW DIE,DA,DR,D,D0,DI,DIC,DIG,DIH,DIU,DIV,DQ,X,Y,IBIFN
|
---|
94 | S IBEOB=+$G(IBEOB),STAT=$G(STAT)
|
---|
95 | I '$D(^IBM(361.1,IBEOB)) G MRASTX
|
---|
96 | I STAT="" G MRASTX
|
---|
97 | S IBIFN=+$P($G(^IBM(361.1,IBEOB,0)),U,1)
|
---|
98 | I '$D(^DGCR(399,IBIFN,"TX")) G MRASTX
|
---|
99 | ;
|
---|
100 | S DIE=399,DA=IBIFN,DR="24////"_STAT
|
---|
101 | D ^DIE
|
---|
102 | MRASTX ;
|
---|
103 | Q
|
---|
104 | ;
|
---|
105 | ISITMRA(IBTDA) ; Function to return whether or not this transmission
|
---|
106 | ; is a Medicare MRA or a normal EOB
|
---|
107 | NEW IEN,MRA,STOP,DATA
|
---|
108 | S (IEN,MRA,STOP)=0
|
---|
109 | F S IEN=$O(^IBA(364.2,IBTDA,2,IEN)) Q:'IEN D Q:STOP
|
---|
110 | . S DATA=$$EXT^IBCEMU1($G(^IBA(364.2,IBTDA,2,IEN,0))) Q:DATA=""
|
---|
111 | . I $P(DATA,U,1)'="835EOB" Q
|
---|
112 | . I $P(DATA,U,5)="Y" S MRA=1
|
---|
113 | . S STOP=1
|
---|
114 | . Q
|
---|
115 | ISMRAX ;
|
---|
116 | Q MRA
|
---|
117 | ;
|
---|