| [613] | 1 | IBCIST ;DSI/SLM - ENTRY POINTS FOR CLAIMSMANAGER INTERFACE ;7-MAR-2001 | 
|---|
|  | 2 | ;;2.0;INTEGRATED BILLING;**161**;21-MAR-94 | 
|---|
|  | 3 | ;;Per VHA Directive 10-93-142, this routine should not be modified. | 
|---|
|  | 4 | ; | 
|---|
|  | 5 | ST1 ;add or update in 351.9 | 
|---|
|  | 6 | Q:'$D(IBIFN) | 
|---|
|  | 7 | Q:$$CK1^IBCIUT1(IBIFN)     ; Exit if the bill is not a HCFA-1500 | 
|---|
|  | 8 | K IBCIREDT     ; remove the re-edit flag upon start of bill edit | 
|---|
|  | 9 | ; | 
|---|
|  | 10 | ; If the bill is not editable, then just quit. | 
|---|
|  | 11 | ; This can happen in the IB PRINT BILL option when the user wants to | 
|---|
|  | 12 | ; review the IB screens on a bill that has already been authorized. | 
|---|
|  | 13 | ; esg - 5/22/01 | 
|---|
|  | 14 | ; | 
|---|
|  | 15 | I '$F(".1.","."_$P($G(^DGCR(399,IBIFN,0)),U,13)_".") Q  ;DSI/DJW 3/21/02 | 
|---|
|  | 16 | ; | 
|---|
|  | 17 | I '$D(^IBA(351.9,IBIFN)) D ADD^IBCIADD1 Q | 
|---|
|  | 18 | D UPDT1,OVRDN,UPDT^IBCIADD1 | 
|---|
|  | 19 | ST1Q Q | 
|---|
|  | 20 | ; | 
|---|
|  | 21 | ST2 ;send to claimsmanager | 
|---|
|  | 22 | ;  When calling ST2 the following 4 variables will always be returned: | 
|---|
|  | 23 | ;    IBCISNT  - identifies where it was sent from | 
|---|
|  | 24 | ;    IBCIERR  - error code if error condition | 
|---|
|  | 25 | ;    IBCISTAT - claim status in 351.9 | 
|---|
|  | 26 | ;    IBCIREDT - re-edit flag | 
|---|
|  | 27 | ; | 
|---|
|  | 28 | I '$D(IBIFN) Q                        ; check for ibifn | 
|---|
|  | 29 | I '$D(IBCISNT) Q                      ; check for this variable | 
|---|
|  | 30 | I IBCISNT'=7 D CKFT^IBCIUT1(IBIFN)    ; check for form type change | 
|---|
|  | 31 | I IBCISNT'=7,$$CK1^IBCIUT1(IBIFN) Q   ; check for hcfa 1500 | 
|---|
|  | 32 | I '$D(^IBA(351.9,IBIFN)) Q            ; check for existence in 351.9 | 
|---|
|  | 33 | ; | 
|---|
|  | 34 | NEW IBCIMT | 
|---|
|  | 35 | S IBCIERR="",IBCIREDT=0,IBCIMT=$$ENV^IBCIUT5 | 
|---|
|  | 36 | ; | 
|---|
|  | 37 | ;if claimsmanager not working okay update status and quit | 
|---|
|  | 38 | I '$$CK2^IBCIUT1() D  G ST2Q | 
|---|
|  | 39 | .I IBCISNT=1 S (IBCIST,IBCISTAT)=7 D ST^IBCIUT1(IBCIST) Q | 
|---|
|  | 40 | .I IBCISNT=2 S (IBCIST,IBCISTAT)=7 D ST^IBCIUT1(IBCIST) Q | 
|---|
|  | 41 | .I IBCISNT=3 Q | 
|---|
|  | 42 | .I IBCISNT=4 S (IBCIST,IBCISTAT)=10 D ST^IBCIUT1(IBCIST) Q | 
|---|
|  | 43 | .I IBCISNT=5 S (IBCIST,IBCISTAT)=11 D ST^IBCIUT1(IBCIST) Q | 
|---|
|  | 44 | .I IBCISNT=6 S (IBCIST,IBCISTAT)=7 D ST^IBCIUT1(IBCIST) Q | 
|---|
|  | 45 | ; | 
|---|
|  | 46 | ;normal send | 
|---|
|  | 47 | I IBCISNT=1 D MSG1,SEND D  G ST2Q | 
|---|
|  | 48 | .D UPDT1,UPDT2 | 
|---|
|  | 49 | .I IBCISTAT=6 D MSG3 | 
|---|
|  | 50 | .I IBCISTAT=3 D MSG2 | 
|---|
|  | 51 | .I IBCISTAT=4 D EN^IBCIWK(1) | 
|---|
|  | 52 | ; | 
|---|
|  | 53 | ;multiple send option - not authorized | 
|---|
|  | 54 | I IBCISNT=2 D  G ST2Q | 
|---|
|  | 55 | .I '$$CKLI^IBCIUT1(IBIFN) Q       ; check for line items | 
|---|
|  | 56 | .D SEND | 
|---|
|  | 57 | .D UPDT1,UPDT2 | 
|---|
|  | 58 | .I IBCISTAT=4 D | 
|---|
|  | 59 | ..N IBCIETP | 
|---|
|  | 60 | ..S IBCIETP="" | 
|---|
|  | 61 | ..F  S IBCIETP=$O(^IBA(351.9,IBIFN,1,"B",IBCIETP)) Q:IBCIETP=""  D GENERR^IBCIUT4(IBIFN,IBCIETP) | 
|---|
|  | 62 | ..Q | 
|---|
|  | 63 | ; | 
|---|
|  | 64 | ;test send | 
|---|
|  | 65 | I IBCISNT=3 D  G ST2Q | 
|---|
|  | 66 | .D MSG1,SEND | 
|---|
|  | 67 | .I IBCISTAT=3 D MSG2 | 
|---|
|  | 68 | ; | 
|---|
|  | 69 | ;cancelled | 
|---|
|  | 70 | I IBCISNT=4 D  G ST2Q | 
|---|
|  | 71 | .D COMMENT^IBCIUT7(IBIFN,3) | 
|---|
|  | 72 | .; if the bill has never been sent to CM or if there are currently | 
|---|
|  | 73 | .; no line items on the bill, then just change the status and quit | 
|---|
|  | 74 | .I '$P(^IBA(351.9,IBIFN,0),U,15)!('$$CKLI^IBCIUT1(IBIFN)) D  Q | 
|---|
|  | 75 | ..S IBCIST=9 D ST^IBCIUT1(IBCIST) | 
|---|
|  | 76 | ..D DELTI^IBCIUT4   ;delete temp nodes on a cancel even when not sending to claimsmanager | 
|---|
|  | 77 | .D UPDT1,UPDT2,SEND | 
|---|
|  | 78 | ; | 
|---|
|  | 79 | ;overridden | 
|---|
|  | 80 | I IBCISNT=5 D  G ST2Q | 
|---|
|  | 81 | .D UPDT1,UPDT2,OVRDN1,SEND | 
|---|
|  | 82 | ; | 
|---|
|  | 83 | ;multiple send option - authorized | 
|---|
|  | 84 | I IBCISNT=6 D  G ST2Q | 
|---|
|  | 85 | .I '$$CKLI^IBCIUT1(IBIFN) Q       ; check for line items | 
|---|
|  | 86 | .D UPDT1,UPDT2,SEND | 
|---|
|  | 87 | ; | 
|---|
|  | 88 | ; | 
|---|
|  | 89 | ; Notes about IBCISNT=7 - esg - 1/3/2002 | 
|---|
|  | 90 | ; User changed the form type from a HCFA into a UB and this bill | 
|---|
|  | 91 | ; has been previously sent to ClaimsManager as a HCFA.  So this | 
|---|
|  | 92 | ; bill is currently a UB bill, but we need to send it to | 
|---|
|  | 93 | ; ClaimsManager in order to delete the line items over there. | 
|---|
|  | 94 | ; Ultimately, this bill will get deleted from 351.9, but we have | 
|---|
|  | 95 | ; to send it over there first. | 
|---|
|  | 96 | ; | 
|---|
|  | 97 | I IBCISNT=7 D  G ST2Q | 
|---|
|  | 98 | . I '$$CKLI^IBCIUT1(IBIFN) Q      ; check for line items | 
|---|
|  | 99 | . D SEND | 
|---|
|  | 100 | . Q | 
|---|
|  | 101 | ; | 
|---|
|  | 102 | ; | 
|---|
|  | 103 | ST2Q D CLEAN1^IBCIUT2 K PROBLEM | 
|---|
|  | 104 | Q | 
|---|
|  | 105 | ; | 
|---|
|  | 106 | SEND ; send the bill to claimsmanager | 
|---|
|  | 107 | I $$ASND^IBCIUT2(IBIFN) G SENDX    ; no tcp/ip problems | 
|---|
|  | 108 | D COMERR^IBCIUT4                   ; communications error mail message | 
|---|
|  | 109 | I PROBLEM'=99 D CLRCMQ^IBCIUT6(0)  ; clear CM queue (silent mode) | 
|---|
|  | 110 | SENDX ; | 
|---|
|  | 111 | Q | 
|---|
|  | 112 | ; | 
|---|
|  | 113 | UPDT1 ; update certain fields when editing | 
|---|
|  | 114 | ; update the Date/Time Last Edited field (.08) | 
|---|
|  | 115 | ; update the User Last Edited field (.09) | 
|---|
|  | 116 | ; | 
|---|
|  | 117 | N IENS,FDA | 
|---|
|  | 118 | S IENS=IBIFN_",",FDA(351.9,IENS,.08)=$$NOW^XLFDT,FDA(351.9,IENS,.09)=DUZ | 
|---|
|  | 119 | D FILE^DIE("K","FDA") | 
|---|
|  | 120 | Q | 
|---|
|  | 121 | ; | 
|---|
|  | 122 | UPDT2 ; update certain fields when sending | 
|---|
|  | 123 | ; update the Entered By User field if not there (.07) | 
|---|
|  | 124 | ; update the Date/Time Entered field if not there (.06) | 
|---|
|  | 125 | ; update the number of times sent to ClaimsManager (.04) | 
|---|
|  | 126 | ; update the Date/Time last sent to ClaimsManager (.03) | 
|---|
|  | 127 | ; update the Last Sent By User field (.05) | 
|---|
|  | 128 | ; | 
|---|
|  | 129 | N IENS,FDA,IBCIEB,IBCIDE | 
|---|
|  | 130 | S IENS=IBIFN_"," | 
|---|
|  | 131 | I $P(^IBA(351.9,IBIFN,0),U,7)="" S FDA(351.9,IENS,.07)=DUZ | 
|---|
|  | 132 | I $P(^IBA(351.9,IBIFN,0),U,6)="" S FDA(351.9,IENS,.06)=$$NOW^XLFDT | 
|---|
|  | 133 | S IBCILSI=$$NOW^XLFDT,CTR=$S($P(^IBA(351.9,IBIFN,0),U,4)]"":$P(^(0),U,4),1:0) | 
|---|
|  | 134 | S IBCITSI=CTR+1,FDA(351.9,IENS,.04)=IBCITSI | 
|---|
|  | 135 | S FDA(351.9,IENS,.03)=IBCILSI,FDA(351.9,IENS,.05)=DUZ | 
|---|
|  | 136 | D FILE^DIE("K","FDA") | 
|---|
|  | 137 | Q | 
|---|
|  | 138 | ; | 
|---|
|  | 139 | OVRDN ;clear if overridden | 
|---|
|  | 140 | N IENS,FDA | 
|---|
|  | 141 | I $P(^IBA(351.9,IBIFN,0),U,10)]"" D | 
|---|
|  | 142 | .S IENS=IBIFN_"," | 
|---|
|  | 143 | .S FDA(351.9,IENS,.1)="",FDA(351.9,IENS,.11)="" | 
|---|
|  | 144 | .D FILE^DIE("K","FDA") | 
|---|
|  | 145 | Q | 
|---|
|  | 146 | OVRDN1 ;set if overridden | 
|---|
|  | 147 | N IENS,FDA | 
|---|
|  | 148 | S IENS=IBIFN_"," | 
|---|
|  | 149 | S FDA(351.9,IENS,.1)=1,FDA(351.9,IENS,.11)=DUZ | 
|---|
|  | 150 | D FILE^DIE("K","FDA") | 
|---|
|  | 151 | Q | 
|---|
|  | 152 | MSG1 ;display 'sending to ClaimsManager' message | 
|---|
|  | 153 | W !!,"... ",$S(IBCIMT="T":"TEST-",1:""),"Sending ",$P(^DGCR(399,IBIFN,0),U)," to ClaimsManager" | 
|---|
|  | 154 | Q | 
|---|
|  | 155 | MSG2 ;display 'no errors found' message | 
|---|
|  | 156 | W !!,"No Errors found by ClaimsManager" | 
|---|
|  | 157 | Q | 
|---|
|  | 158 | MSG3 ;display 'comm error' messsage | 
|---|
|  | 159 | W !!,"Communications Error - Not Sent to ClaimsManager" | 
|---|
|  | 160 | W !?3,$P(IBCIERR,U,2) | 
|---|
|  | 161 | I $P(IBCIERR,U,3)'="" D | 
|---|
|  | 162 | . W !?3,$P($P(IBCIERR,U,3)," - ",1) | 
|---|
|  | 163 | . W !?3,$P($P(IBCIERR,U,3,99)," - ",2,99) | 
|---|
|  | 164 | . Q | 
|---|
|  | 165 | Q | 
|---|
|  | 166 | MSG4 ;display 'no line items' message | 
|---|
|  | 167 | W !!,"There are no line items associated with this claim." | 
|---|
|  | 168 | W !!,"ClaimsManager cannot process without line items. Please" | 
|---|
|  | 169 | W !,"enter the line item data and resend." | 
|---|
|  | 170 | Q | 
|---|
|  | 171 | MSG5 ;display 'cancelled' message | 
|---|
|  | 172 | W !!,"... Claim has been CANCELLED in ClaimsManager." | 
|---|
|  | 173 | Q | 
|---|