- BPSOSU ;BHAM ISC/FCS/DRS/FLS - Common utilities ;06/01/2004
- ;;1.0;E CLAIMS MGMT ENGINE;**1,2,5,7,10,20,27,31**;JUN 2004;Build 16
- ;;Per VA Directive 6402, this routine should not be modified.
- Q
- ; Common utilities called a lot.
- ;
- ; SETSTAT - set status field for ^BPST(IEN59,
- ; Input:
- ; IEN59 - BPS Transaction
- ; STATUS - Value to set into BPS Transaction
- SETSTAT(IEN59,STATUS) ; EP - from many places
- ;
- ; Lock the record - something is very wrong if you can't get the lock
- F L +^BPST(IEN59):300 Q:$T Q:'$$IMPOSS^BPSOSUE("L","RTI","LOCK +^BPST",,"SETSTAT",$T(+0))
- N DIE,DA,DR,X
- S DIE=9002313.59,DA=IEN59,DR="1///"_STATUS_";7///NOW" ; Status and Last Update
- I STATUS=0 S DR=DR_";15///NOW" ; If Status is 0, init START TIME
- D ^DIE
- ;
- ; Verify that there no other statuses in the X-ref
- S X=""
- F S X=$O(^BPST("AD",X)) Q:X="" D
- . I X'=STATUS K ^BPST("AD",X,IEN59)
- I STATUS=99 D STATUS99(IEN59)
- L -^BPST(IEN59)
- Q
- ;
- ; STATUS99 - Special activity when a claim reaches status 99
- ; Input:
- ; IEN59 - BPS Transaction IEN
- STATUS99(IEN59) ;
- N IEN77,BPS57,CLMSTAT,BPNXTREQ,BPSCLNOD,BPTYPE
- ;
- ; check and process non-billable entries - BPS*1*20
- I $P($G(^BPST(IEN59,0)),U,15)="N" D Q
- . D LOG^BPSOSL(IEN59,$T(+0)_"-BPS Transaction non-billable entry has reached a status of 99%")
- . S BPS57=$$NEW57(IEN59) ; copy it over into BPS Log of Transaction file
- . D LOG^BPSOSL(IEN59,$T(+0)_"-Created BPS Log of Transaction record for non-billable entry: "_BPS57)
- . D LOG^BPSOSL(IEN59,$T(+0)_"-BPS Transaction Non-Billable Entry Complete")
- . Q
- ;
- ; Get the current request
- S IEN77=+$$GETRQST^BPSUTIL2(IEN59)
- D LOG^BPSOSL(IEN59,$T(+0)_"-Claim of the request "_IEN77_" has reached 99%")
- ;
- ; Create a copy in the BPS Log of Transaction
- S BPS57=$$NEW57(IEN59)
- D LOG^BPSOSL(IEN59,$T(+0)_"-Created BPS Log of Transaction record "_BPS57)
- ;
- ; This data is needed when closing the claim later but needs to be
- ; read now since $$REQST99^BPSOSRX5 will delete the request as part
- ; of its processing
- S BPSCLNOD=$G(^BPS(9002313.77,IEN77,7))
- S BPTYPE=$P($G(^BPS(9002313.77,IEN77,1)),U,4)
- ;
- ; Get status of the claim
- S CLMSTAT=$$CATEG^BPSOSUC(IEN59)
- S BPNXTREQ=$$REQST99^BPSOSRX5(IEN59,CLMSTAT)
- ;
- ; Check if the BPS Claim should be closed
- I +BPSCLNOD=1,$P(BPSCLNOD,U,2)>0 D
- . N BPSCLA,BPLCK,BPDROP,ERROR,DA,DR,DIE
- . I $$SUCCESS^BPSOSRX7(BPTYPE,CLMSTAT)=0 Q
- . I BPNXTREQ>0 D LOG^BPSOSL(IEN59,$T(+0)_"-Cannot close after reversal due to sequential requests in the queue") Q
- . D LOG^BPSOSL(IEN59,$T(+0)_"-Closing the claim after accepted reversal")
- . S BPSCLA=$$GET1^DIQ(9002313.59,IEN59,3,"I"),BPLCK=0,BPDROP="N"
- . L +^BPSC(BPSCLA):0 I '$T D Q
- . . D LOG^BPSOSL(IEN59,$T(+0)_"-Unable to close claim. Could not lock BPS CLAIMS file.") Q
- . D CLOSE^BPSBUTL(BPSCLA,IEN59,$P(^IBE(356.8,$P(BPSCLNOD,U,2),0),U),0,1,$P(BPSCLNOD,U,3),.ERROR)
- . I $D(ERROR) D Q
- . . D LOG^BPSOSL(IEN59,$T(+0)_"Unable to close Bill in IB. "_ERROR)
- . . L -^BPSC(BPSCLA)
- . S DIE="^BPSC("
- . S DA=BPSCLA
- . S DR="901///1"
- . S DR=DR_";902///"_$$NOW^XLFDT()
- . S DR=DR_";903////"_$$GET1^DIQ(9002313.59,IEN59,13,"I")
- . S DR=DR_";904///"_$P(BPSCLNOD,U,2)
- . S DR=DR_";905////"_BPDROP
- . D ^DIE
- . L -^BPSC(BPSCLA)
- . Q
- ;
- ;
- ; If claims completed normally, log its completion.
- ; Do not log error'ed or stranded claims as we don't want to show these in the
- ; turn-around stats
- ; Needed for Turn-Around Stats - Do NOT delete/alter!!
- I CLMSTAT'["E OTHER",CLMSTAT'["E UNSTRANDED",CLMSTAT'["E REVERSAL UNSTRANDED" D LOG^BPSOSL(IEN59,$T(+0)_"-Claim Complete")
- Q
- ;
- ; NEW57 - Copy the BPS Transaction into BPS Log of Transaction
- ; Input
- ; IEN59 - BPS Transaction
- ; Returns
- ; BPS Log of Transaction IEN
- NEW57(IEN59) ;
- F L +^BPSTL:300 Q:$T Q:'$$IMPOSS^BPSOSUE("L","RTI","LOCK ^BPSTL",,"NEW57",$T(+0))
- ;
- ; Get next record number in BPS Log of Transactions
- NEW57A N N,C
- S N=$P(^BPSTL(0),U,3)+1
- S C=$P(^BPSTL(0),U,4)+1
- S $P(^BPSTL(0),U,3,4)=N_U_C
- I $D(^BPSTL(N)) G NEW57A ; should never happen
- L -^BPSTL
- ;
- ; Merge BPS Transaction into Log of Transactions
- M ^BPSTL(N)=^BPST(IEN59)
- ;
- ; Set MCCF EDI TAS PROGRESS flag to 1
- ; Only if Transaction Type is not Non-Billable
- I $$GET1^DIQ(9002313.59,IEN59,19,"I")'="N" D
- . N BPSA,BPSFN,BPSREC
- . S BPSFN=9002313.57
- . S BPSREC=N_","
- . S BPSA(BPSFN,BPSREC,20)=1
- . D FILE^DIE("","BPSA","")
- ;
- ; Build fileman indices
- D
- . N DIK,DA S DIK="^BPSTL(",DA=N N N D IX1^DIK
- ;
- ; Quit with the new record number
- Q N
- ;
- ; ISREVES - Is this a reversal claim
- ; Input
- ; CLAIMIEN - Pointer to BPS Claims
- ;
- ; Return Value
- ; 1 - Reversal claim
- ; 0 - Not a reversal claim
- ISREVERS(CLAIM) ;
- Q $P($G(^BPSC(CLAIM,100)),"^",3)="B2"
- ;
- ; SETCSTAT - Set the status for every transaction associated with
- ; this claim
- SETCSTAT(CLAIM,STATUS) ;
- N IEN59,INDEX
- ;
- ; Determine correct index
- I $$ISREVERS(CLAIM) S INDEX="AER"
- E S INDEX="AE"
- ;
- ; Loop through the transactions and set the status
- S IEN59=""
- F S IEN59=$O(^BPST(INDEX,CLAIM,IEN59)) Q:IEN59="" D SETSTAT(IEN59,STATUS)
- Q
- ;
- ; ERROR - Handle any errors
- ; Log them into BPS Transactions
- ; Change status to 99
- ; Update the LOG
- ; Increment the statistics
- ; We should be okay for the resubmit flag since the STATUS
- ; will be E OTHER instead of E REVERSAL ACCEPTED
- ; Input
- ; RTN - Routine reporting the error
- ; IEN59 - BPS Transaction
- ; ERROR - Error Number (goes in RESULT CODE)
- ; ERRTEXT - Error Text (goes in RESULT TEXT)
- ;
- ; To prevent conflicts, set the error number to the first digit of
- ; Status and a unique number for the status.
- ERROR(RTN,IEN59,ERROR,ERRTEXT) ;
- ;
- ; Check parameters
- I '$G(IEN59) Q
- I '$G(ERROR) S ERROR=0
- I $G(ERRTEXT)="" S ERRTEXT="ERROR - see LOG"
- ;
- ; Set Error and Error Text in BPS Transaction
- D SETRESU(IEN59,ERROR,ERRTEXT)
- ;
- ; Log Message
- D LOG^BPSOSL(IEN59,RTN_" returned error - "_ERRTEXT)
- ;
- ; Update unbillable count in stats
- D INCSTAT^BPSOSUD("R",1)
- ;
- ; Update Status to complete
- D SETSTAT(IEN59,99)
- Q
- ;
- ; SETRESU - Set Result into ^BPST(IEN59,2)
- ; Input
- ; IEN59 - BPS Transaction IEN
- ; RESULT - Result Code
- ; TEXT - Result Text. Semi-colons (";") should not in the text data as
- ; this is used as a separator between current and previous text
- ; messages. If there is a semi-colon, it is converted to a dash.
- SETRESU(IEN59,RESULT,TEXT) ;
- ;
- ; First, store the Result Code
- S $P(^BPST(IEN59,2),U)=$G(RESULT)
- ;
- ; Second, store the Result Text
- ; Considerations:
- ; Convert any semi-colons to dashes
- ; Add semi-colon delimiter if needed
- ; Truncate data if needed
- I $G(TEXT)]"" D
- . N X
- . S TEXT=$TR(TEXT,";","-")
- . S X=$P(^BPST(IEN59,2),U,2,99)
- . I X]"",$E(X)'=";" S X=";"_X
- . S X=$E(TEXT_X,1,255-$L(RESULT)-1)
- . S $P(^BPST(IEN59,2),U,2)=X
- Q
- ;
- ; SETCRESU - set the result code for every transaction assoc'd with
- ; this claim. Note that this will only work for billing requests (B1)
- ; Input
- ; CLAIMIEN - BPS Claim IEN
- ; RESULT - Result Code
- ; TEXT - Result Text
- SETCRESU(CLAIM,RESULT,TEXT) ;
- N IEN59
- S IEN59=""
- F S IEN59=$O(^BPST("AE",CLAIM,IEN59)) Q:IEN59="" D SETRESU(IEN59,RESULT,$G(TEXT))
- Q
- ;
- ; STATI(X) gives a text version of what status code X means.
- ; For effeciency, put more common ones at the top.
- ; Also note that you should check the display on the stats screen if you
- ; modify any of these.
- STATI(X) ;
- I X=99 Q "Done"
- I X=60 Q "Transmitting"
- I X=0 Q "Waiting to start"
- I X=40 Q "Building the HL7 packet"
- I X=70 Q "Parsing response"
- I X=30 Q "Building the claim"
- I X=10 Q "Building the transaction"
- I X=90 Q "Processing response"
- I X=98 Q "Resubmitting" ; Used only by STATUS^BPSOSRX (Not stored in BPS Transactions)
- I X=50 Q "Preparing for transmit"
- I X=31 Q "Wait for retry (insurer asleep)"
- I X=80 Q "Waiting to process response"
- I X=-99 Q "Waiting for activation (scheduled)" ; Used only by STATUS^BPSOSRX (Not stored in BPS Transactions)
- I X=-98 Q "Cancelled" ; Used only by STATUS^BPSOSRX (Not stored in BPS Transactions)
- I X=-97 Q "Inactive" ; Used only by STATUS^BPSOSRX (Not stored in BPS Transactions)
- I X=-96 Q "Processing request" ; Used only by STATUS^BPSOSRX (Not stored in BPS Transactions)
- Q "?"_X_"?"
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HBPSOSU 8521 printed Jan 18, 2025@02:53:21 Page 2
- BPSOSU ;BHAM ISC/FCS/DRS/FLS - Common utilities ;06/01/2004
- +1 ;;1.0;E CLAIMS MGMT ENGINE;**1,2,5,7,10,20,27,31**;JUN 2004;Build 16
- +2 ;;Per VA Directive 6402, this routine should not be modified.
- +3 QUIT
- +4 ; Common utilities called a lot.
- +5 ;
- +6 ; SETSTAT - set status field for ^BPST(IEN59,
- +7 ; Input:
- +8 ; IEN59 - BPS Transaction
- +9 ; STATUS - Value to set into BPS Transaction
- SETSTAT(IEN59,STATUS) ; EP - from many places
- +1 ;
- +2 ; Lock the record - something is very wrong if you can't get the lock
- +3 FOR
- LOCK +^BPST(IEN59):300
- if $TEST
- QUIT
- if '$$IMPOSS^BPSOSUE("L","RTI","LOCK +^BPST",,"SETSTAT",$TEXT(+0))
- QUIT
- +4 NEW DIE,DA,DR,X
- +5 ; Status and Last Update
- SET DIE=9002313.59
- SET DA=IEN59
- SET DR="1///"_STATUS_";7///NOW"
- +6 ; If Status is 0, init START TIME
- IF STATUS=0
- SET DR=DR_";15///NOW"
- +7 DO ^DIE
- +8 ;
- +9 ; Verify that there no other statuses in the X-ref
- +10 SET X=""
- +11 FOR
- SET X=$ORDER(^BPST("AD",X))
- if X=""
- QUIT
- Begin DoDot:1
- +12 IF X'=STATUS
- KILL ^BPST("AD",X,IEN59)
- End DoDot:1
- +13 IF STATUS=99
- DO STATUS99(IEN59)
- +14 LOCK -^BPST(IEN59)
- +15 QUIT
- +16 ;
- +17 ; STATUS99 - Special activity when a claim reaches status 99
- +18 ; Input:
- +19 ; IEN59 - BPS Transaction IEN
- STATUS99(IEN59) ;
- +1 NEW IEN77,BPS57,CLMSTAT,BPNXTREQ,BPSCLNOD,BPTYPE
- +2 ;
- +3 ; check and process non-billable entries - BPS*1*20
- +4 IF $PIECE($GET(^BPST(IEN59,0)),U,15)="N"
- Begin DoDot:1
- +5 DO LOG^BPSOSL(IEN59,$TEXT(+0)_"-BPS Transaction non-billable entry has reached a status of 99%")
- +6 ; copy it over into BPS Log of Transaction file
- SET BPS57=$$NEW57(IEN59)
- +7 DO LOG^BPSOSL(IEN59,$TEXT(+0)_"-Created BPS Log of Transaction record for non-billable entry: "_BPS57)
- +8 DO LOG^BPSOSL(IEN59,$TEXT(+0)_"-BPS Transaction Non-Billable Entry Complete")
- +9 QUIT
- End DoDot:1
- QUIT
- +10 ;
- +11 ; Get the current request
- +12 SET IEN77=+$$GETRQST^BPSUTIL2(IEN59)
- +13 DO LOG^BPSOSL(IEN59,$TEXT(+0)_"-Claim of the request "_IEN77_" has reached 99%")
- +14 ;
- +15 ; Create a copy in the BPS Log of Transaction
- +16 SET BPS57=$$NEW57(IEN59)
- +17 DO LOG^BPSOSL(IEN59,$TEXT(+0)_"-Created BPS Log of Transaction record "_BPS57)
- +18 ;
- +19 ; This data is needed when closing the claim later but needs to be
- +20 ; read now since $$REQST99^BPSOSRX5 will delete the request as part
- +21 ; of its processing
- +22 SET BPSCLNOD=$GET(^BPS(9002313.77,IEN77,7))
- +23 SET BPTYPE=$PIECE($GET(^BPS(9002313.77,IEN77,1)),U,4)
- +24 ;
- +25 ; Get status of the claim
- +26 SET CLMSTAT=$$CATEG^BPSOSUC(IEN59)
- +27 SET BPNXTREQ=$$REQST99^BPSOSRX5(IEN59,CLMSTAT)
- +28 ;
- +29 ; Check if the BPS Claim should be closed
- +30 IF +BPSCLNOD=1
- IF $PIECE(BPSCLNOD,U,2)>0
- Begin DoDot:1
- +31 NEW BPSCLA,BPLCK,BPDROP,ERROR,DA,DR,DIE
- +32 IF $$SUCCESS^BPSOSRX7(BPTYPE,CLMSTAT)=0
- QUIT
- +33 IF BPNXTREQ>0
- DO LOG^BPSOSL(IEN59,$TEXT(+0)_"-Cannot close after reversal due to sequential requests in the queue")
- QUIT
- +34 DO LOG^BPSOSL(IEN59,$TEXT(+0)_"-Closing the claim after accepted reversal")
- +35 SET BPSCLA=$$GET1^DIQ(9002313.59,IEN59,3,"I")
- SET BPLCK=0
- SET BPDROP="N"
- +36 LOCK +^BPSC(BPSCLA):0
- IF '$TEST
- Begin DoDot:2
- +37 DO LOG^BPSOSL(IEN59,$TEXT(+0)_"-Unable to close claim. Could not lock BPS CLAIMS file.")
- QUIT
- End DoDot:2
- QUIT
- +38 DO CLOSE^BPSBUTL(BPSCLA,IEN59,$PIECE(^IBE(356.8,$PIECE(BPSCLNOD,U,2),0),U),0,1,$PIECE(BPSCLNOD,U,3),.ERROR)
- +39 IF $DATA(ERROR)
- Begin DoDot:2
- +40 DO LOG^BPSOSL(IEN59,$TEXT(+0)_"Unable to close Bill in IB. "_ERROR)
- +41 LOCK -^BPSC(BPSCLA)
- End DoDot:2
- QUIT
- +42 SET DIE="^BPSC("
- +43 SET DA=BPSCLA
- +44 SET DR="901///1"
- +45 SET DR=DR_";902///"_$$NOW^XLFDT()
- +46 SET DR=DR_";903////"_$$GET1^DIQ(9002313.59,IEN59,13,"I")
- +47 SET DR=DR_";904///"_$PIECE(BPSCLNOD,U,2)
- +48 SET DR=DR_";905////"_BPDROP
- +49 DO ^DIE
- +50 LOCK -^BPSC(BPSCLA)
- +51 QUIT
- End DoDot:1
- +52 ;
- +53 ;
- +54 ; If claims completed normally, log its completion.
- +55 ; Do not log error'ed or stranded claims as we don't want to show these in the
- +56 ; turn-around stats
- +57 ; Needed for Turn-Around Stats - Do NOT delete/alter!!
- +58 IF CLMSTAT'["E OTHER"
- IF CLMSTAT'["E UNSTRANDED"
- IF CLMSTAT'["E REVERSAL UNSTRANDED"
- DO LOG^BPSOSL(IEN59,$TEXT(+0)_"-Claim Complete")
- +59 QUIT
- +60 ;
- +61 ; NEW57 - Copy the BPS Transaction into BPS Log of Transaction
- +62 ; Input
- +63 ; IEN59 - BPS Transaction
- +64 ; Returns
- +65 ; BPS Log of Transaction IEN
- NEW57(IEN59) ;
- +1 FOR
- LOCK +^BPSTL:300
- if $TEST
- QUIT
- if '$$IMPOSS^BPSOSUE("L","RTI","LOCK ^BPSTL",,"NEW57",$TEXT(+0))
- QUIT
- +2 ;
- +3 ; Get next record number in BPS Log of Transactions
- NEW57A NEW N,C
- +1 SET N=$PIECE(^BPSTL(0),U,3)+1
- +2 SET C=$PIECE(^BPSTL(0),U,4)+1
- +3 SET $PIECE(^BPSTL(0),U,3,4)=N_U_C
- +4 ; should never happen
- IF $DATA(^BPSTL(N))
- GOTO NEW57A
- +5 LOCK -^BPSTL
- +6 ;
- +7 ; Merge BPS Transaction into Log of Transactions
- +8 MERGE ^BPSTL(N)=^BPST(IEN59)
- +9 ;
- +10 ; Set MCCF EDI TAS PROGRESS flag to 1
- +11 ; Only if Transaction Type is not Non-Billable
- +12 IF $$GET1^DIQ(9002313.59,IEN59,19,"I")'="N"
- Begin DoDot:1
- +13 NEW BPSA,BPSFN,BPSREC
- +14 SET BPSFN=9002313.57
- +15 SET BPSREC=N_","
- +16 SET BPSA(BPSFN,BPSREC,20)=1
- +17 DO FILE^DIE("","BPSA","")
- End DoDot:1
- +18 ;
- +19 ; Build fileman indices
- +20 Begin DoDot:1
- +21 NEW DIK,DA
- SET DIK="^BPSTL("
- SET DA=N
- NEW N
- DO IX1^DIK
- End DoDot:1
- +22 ;
- +23 ; Quit with the new record number
- +24 QUIT N
- +25 ;
- +26 ; ISREVES - Is this a reversal claim
- +27 ; Input
- +28 ; CLAIMIEN - Pointer to BPS Claims
- +29 ;
- +30 ; Return Value
- +31 ; 1 - Reversal claim
- +32 ; 0 - Not a reversal claim
- ISREVERS(CLAIM) ;
- +1 QUIT $PIECE($GET(^BPSC(CLAIM,100)),"^",3)="B2"
- +2 ;
- +3 ; SETCSTAT - Set the status for every transaction associated with
- +4 ; this claim
- SETCSTAT(CLAIM,STATUS) ;
- +1 NEW IEN59,INDEX
- +2 ;
- +3 ; Determine correct index
- +4 IF $$ISREVERS(CLAIM)
- SET INDEX="AER"
- +5 IF '$TEST
- SET INDEX="AE"
- +6 ;
- +7 ; Loop through the transactions and set the status
- +8 SET IEN59=""
- +9 FOR
- SET IEN59=$ORDER(^BPST(INDEX,CLAIM,IEN59))
- if IEN59=""
- QUIT
- DO SETSTAT(IEN59,STATUS)
- +10 QUIT
- +11 ;
- +12 ; ERROR - Handle any errors
- +13 ; Log them into BPS Transactions
- +14 ; Change status to 99
- +15 ; Update the LOG
- +16 ; Increment the statistics
- +17 ; We should be okay for the resubmit flag since the STATUS
- +18 ; will be E OTHER instead of E REVERSAL ACCEPTED
- +19 ; Input
- +20 ; RTN - Routine reporting the error
- +21 ; IEN59 - BPS Transaction
- +22 ; ERROR - Error Number (goes in RESULT CODE)
- +23 ; ERRTEXT - Error Text (goes in RESULT TEXT)
- +24 ;
- +25 ; To prevent conflicts, set the error number to the first digit of
- +26 ; Status and a unique number for the status.
- ERROR(RTN,IEN59,ERROR,ERRTEXT) ;
- +1 ;
- +2 ; Check parameters
- +3 IF '$GET(IEN59)
- QUIT
- +4 IF '$GET(ERROR)
- SET ERROR=0
- +5 IF $GET(ERRTEXT)=""
- SET ERRTEXT="ERROR - see LOG"
- +6 ;
- +7 ; Set Error and Error Text in BPS Transaction
- +8 DO SETRESU(IEN59,ERROR,ERRTEXT)
- +9 ;
- +10 ; Log Message
- +11 DO LOG^BPSOSL(IEN59,RTN_" returned error - "_ERRTEXT)
- +12 ;
- +13 ; Update unbillable count in stats
- +14 DO INCSTAT^BPSOSUD("R",1)
- +15 ;
- +16 ; Update Status to complete
- +17 DO SETSTAT(IEN59,99)
- +18 QUIT
- +19 ;
- +20 ; SETRESU - Set Result into ^BPST(IEN59,2)
- +21 ; Input
- +22 ; IEN59 - BPS Transaction IEN
- +23 ; RESULT - Result Code
- +24 ; TEXT - Result Text. Semi-colons (";") should not in the text data as
- +25 ; this is used as a separator between current and previous text
- +26 ; messages. If there is a semi-colon, it is converted to a dash.
- SETRESU(IEN59,RESULT,TEXT) ;
- +1 ;
- +2 ; First, store the Result Code
- +3 SET $PIECE(^BPST(IEN59,2),U)=$GET(RESULT)
- +4 ;
- +5 ; Second, store the Result Text
- +6 ; Considerations:
- +7 ; Convert any semi-colons to dashes
- +8 ; Add semi-colon delimiter if needed
- +9 ; Truncate data if needed
- +10 IF $GET(TEXT)]""
- Begin DoDot:1
- +11 NEW X
- +12 SET TEXT=$TRANSLATE(TEXT,";","-")
- +13 SET X=$PIECE(^BPST(IEN59,2),U,2,99)
- +14 IF X]""
- IF $EXTRACT(X)'=";"
- SET X=";"_X
- +15 SET X=$EXTRACT(TEXT_X,1,255-$LENGTH(RESULT)-1)
- +16 SET $PIECE(^BPST(IEN59,2),U,2)=X
- End DoDot:1
- +17 QUIT
- +18 ;
- +19 ; SETCRESU - set the result code for every transaction assoc'd with
- +20 ; this claim. Note that this will only work for billing requests (B1)
- +21 ; Input
- +22 ; CLAIMIEN - BPS Claim IEN
- +23 ; RESULT - Result Code
- +24 ; TEXT - Result Text
- SETCRESU(CLAIM,RESULT,TEXT) ;
- +1 NEW IEN59
- +2 SET IEN59=""
- +3 FOR
- SET IEN59=$ORDER(^BPST("AE",CLAIM,IEN59))
- if IEN59=""
- QUIT
- DO SETRESU(IEN59,RESULT,$GET(TEXT))
- +4 QUIT
- +5 ;
- +6 ; STATI(X) gives a text version of what status code X means.
- +7 ; For effeciency, put more common ones at the top.
- +8 ; Also note that you should check the display on the stats screen if you
- +9 ; modify any of these.
- STATI(X) ;
- +1 IF X=99
- QUIT "Done"
- +2 IF X=60
- QUIT "Transmitting"
- +3 IF X=0
- QUIT "Waiting to start"
- +4 IF X=40
- QUIT "Building the HL7 packet"
- +5 IF X=70
- QUIT "Parsing response"
- +6 IF X=30
- QUIT "Building the claim"
- +7 IF X=10
- QUIT "Building the transaction"
- +8 IF X=90
- QUIT "Processing response"
- +9 ; Used only by STATUS^BPSOSRX (Not stored in BPS Transactions)
- IF X=98
- QUIT "Resubmitting"
- +10 IF X=50
- QUIT "Preparing for transmit"
- +11 IF X=31
- QUIT "Wait for retry (insurer asleep)"
- +12 IF X=80
- QUIT "Waiting to process response"
- +13 ; Used only by STATUS^BPSOSRX (Not stored in BPS Transactions)
- IF X=-99
- QUIT "Waiting for activation (scheduled)"
- +14 ; Used only by STATUS^BPSOSRX (Not stored in BPS Transactions)
- IF X=-98
- QUIT "Cancelled"
- +15 ; Used only by STATUS^BPSOSRX (Not stored in BPS Transactions)
- IF X=-97
- QUIT "Inactive"
- +16 ; Used only by STATUS^BPSOSRX (Not stored in BPS Transactions)
- IF X=-96
- QUIT "Processing request"
- +17 QUIT "?"_X_"?"