BPSOSQA ;BHAM ISC/FCS/DRS/DLF - ECME background, Part 1 ;06/02/2004
;;1.0;E CLAIMS MGMT ENGINE;**1,5,7,8,10**;JUN 2004;Build 27
;;Per VHA Directive 2004-038, this routine should not be modified.
Q
;
; ONE59 - Validate BPS Transaction data
; Input
; IEN59 - BPS Transaction
;
ONE59(IEN59) ;EP - from BPSOSIZ
; Process this one IEN59
;
; Initialize variables
N RTN,X1,REQTYPE,ERRNO,ERRMSG
S RTN=$T(+0),X1=$G(^BPST(IEN59,1)),REQTYPE=$P($G(^BPST(IEN59,0)),U,15)
;
; Create log entry
; Needed for Turn-Around Stats - Do NOT delete/alter!!
D LOG^BPSOSL(IEN59,$T(+0)_"-Validating the BPS Transaction")
;
; Validate that there is a request type
I REQTYPE="" D ERROR^BPSOSU(RTN,IEN59,109,"Request Type not found in Transaction ") G END
;
S (ERRNO,ERRMSG)=""
I REQTYPE="C" D I ERRNO D ERROR^BPSOSU(RTN,IEN59,ERRNO,ERRMSG) G END
. N RX,RXR
. S RX=$P(X1,U,11),RXR=$P(X1,U)
. I RX="" S ERRNO=108,ERRMSG="Prescription Number not found in Transaction" Q
. I RXR="" S ERRNO=107,ERRMSG="Fill Number not found in Transaction" Q
. I $$RXAPI1^BPSUTIL1(RX,.01,"I")="" S ERRNO=101,ERRMSG="Missing RX # field .01" Q
. I RXR,$$RXSUBF1^BPSUTIL1(RX,52,52.1,RXR,.01,"I")="" S ERRNO=102,ERRMSG="Missing RX Refill field .01" Q
;
; Check for missing patient
I '$P(^BPST(IEN59,0),U,6) D ERROR^BPSOSU(RTN,IEN59,103,"Patient missing from BPS Transaction") G END
;
; Check for missing division
I '$P(X1,U,4) D ERROR^BPSOSU(RTN,IEN59,104,"Division missing from BPS Transaction") G END
;
; Check for missing BPS Pharmacy
I '$P(X1,U,7)="" D ERROR^BPSOSU(RTN,IEN59,105,"ECME Pharmacy missing from BPS Transaction") G END
;
; Check for missing insurance node
I '$D(^BPST(IEN59,10,1,0)) D ERROR^BPSOSU(RTN,IEN59,106,"Missing Insurance in BPST("_IEN59_",10,1,0)") G END
;
; If we got this far, we did not get an error
; Change status to 30 (Waiting for packet build)
D SETSTAT^BPSOSU(IEN59,30)
;
END ; Common exit point
;
; Log payer sequence
N BPSCOB
S BPSCOB=$$COB59^BPSUTIL2(IEN59),BPSCOB=$S(BPSCOB=2:"-Secondary",BPSCOB=3:"-Tertiary",1:"-Primary"),BPSCOB=BPSCOB_" Insurance"
D LOG^BPSOSL(IEN59,$T(+0)_BPSCOB)
;
; Log the contents of Transaction record
D LOG^BPSOSL(IEN59,$T(+0)_"-Contents of ^BPST("_IEN59_"):")
D LOG59(IEN59)
;
; If there are claims at 30%, fire up the packet process
I $O(^BPST("AD",30,0)) D TASK
Q
;
;
LOG59(IEN59) ; Log the IEN59 array
N A
M A=^BPST(IEN59)
D LOGARRAY^BPSOSL(IEN59,"A")
Q
;
TASK ;EP - from BPSOSQ2,BPSOSQ4,BPSOSRB
N X,%DT,Y S X="N",%DT="ST" D ^%DT
D TASKAT(Y)
Q
;
TASKAT(ZTDTH) ;EP - from BPSOSQ4 (requeue if insurer is sleeping)
N ZTRTN,ZTIO
S ZTRTN="PACKETS^BPSOSQ2",ZTIO=""
D ^%ZTLOAD
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HBPSOSQA 2747 printed Nov 22, 2024@17:02:05 Page 2
BPSOSQA ;BHAM ISC/FCS/DRS/DLF - ECME background, Part 1 ;06/02/2004
+1 ;;1.0;E CLAIMS MGMT ENGINE;**1,5,7,8,10**;JUN 2004;Build 27
+2 ;;Per VHA Directive 2004-038, this routine should not be modified.
+3 QUIT
+4 ;
+5 ; ONE59 - Validate BPS Transaction data
+6 ; Input
+7 ; IEN59 - BPS Transaction
+8 ;
ONE59(IEN59) ;EP - from BPSOSIZ
+1 ; Process this one IEN59
+2 ;
+3 ; Initialize variables
+4 NEW RTN,X1,REQTYPE,ERRNO,ERRMSG
+5 SET RTN=$TEXT(+0)
SET X1=$GET(^BPST(IEN59,1))
SET REQTYPE=$PIECE($GET(^BPST(IEN59,0)),U,15)
+6 ;
+7 ; Create log entry
+8 ; Needed for Turn-Around Stats - Do NOT delete/alter!!
+9 DO LOG^BPSOSL(IEN59,$TEXT(+0)_"-Validating the BPS Transaction")
+10 ;
+11 ; Validate that there is a request type
+12 IF REQTYPE=""
DO ERROR^BPSOSU(RTN,IEN59,109,"Request Type not found in Transaction ")
GOTO END
+13 ;
+14 SET (ERRNO,ERRMSG)=""
+15 IF REQTYPE="C"
Begin DoDot:1
+16 NEW RX,RXR
+17 SET RX=$PIECE(X1,U,11)
SET RXR=$PIECE(X1,U)
+18 IF RX=""
SET ERRNO=108
SET ERRMSG="Prescription Number not found in Transaction"
QUIT
+19 IF RXR=""
SET ERRNO=107
SET ERRMSG="Fill Number not found in Transaction"
QUIT
+20 IF $$RXAPI1^BPSUTIL1(RX,.01,"I")=""
SET ERRNO=101
SET ERRMSG="Missing RX # field .01"
QUIT
+21 IF RXR
IF $$RXSUBF1^BPSUTIL1(RX,52,52.1,RXR,.01,"I")=""
SET ERRNO=102
SET ERRMSG="Missing RX Refill field .01"
QUIT
End DoDot:1
IF ERRNO
DO ERROR^BPSOSU(RTN,IEN59,ERRNO,ERRMSG)
GOTO END
+22 ;
+23 ; Check for missing patient
+24 IF '$PIECE(^BPST(IEN59,0),U,6)
DO ERROR^BPSOSU(RTN,IEN59,103,"Patient missing from BPS Transaction")
GOTO END
+25 ;
+26 ; Check for missing division
+27 IF '$PIECE(X1,U,4)
DO ERROR^BPSOSU(RTN,IEN59,104,"Division missing from BPS Transaction")
GOTO END
+28 ;
+29 ; Check for missing BPS Pharmacy
+30 IF '$PIECE(X1,U,7)=""
DO ERROR^BPSOSU(RTN,IEN59,105,"ECME Pharmacy missing from BPS Transaction")
GOTO END
+31 ;
+32 ; Check for missing insurance node
+33 IF '$DATA(^BPST(IEN59,10,1,0))
DO ERROR^BPSOSU(RTN,IEN59,106,"Missing Insurance in BPST("_IEN59_",10,1,0)")
GOTO END
+34 ;
+35 ; If we got this far, we did not get an error
+36 ; Change status to 30 (Waiting for packet build)
+37 DO SETSTAT^BPSOSU(IEN59,30)
+38 ;
END ; Common exit point
+1 ;
+2 ; Log payer sequence
+3 NEW BPSCOB
+4 SET BPSCOB=$$COB59^BPSUTIL2(IEN59)
SET BPSCOB=$SELECT(BPSCOB=2:"-Secondary",BPSCOB=3:"-Tertiary",1:"-Primary")
SET BPSCOB=BPSCOB_" Insurance"
+5 DO LOG^BPSOSL(IEN59,$TEXT(+0)_BPSCOB)
+6 ;
+7 ; Log the contents of Transaction record
+8 DO LOG^BPSOSL(IEN59,$TEXT(+0)_"-Contents of ^BPST("_IEN59_"):")
+9 DO LOG59(IEN59)
+10 ;
+11 ; If there are claims at 30%, fire up the packet process
+12 IF $ORDER(^BPST("AD",30,0))
DO TASK
+13 QUIT
+14 ;
+15 ;
LOG59(IEN59) ; Log the IEN59 array
+1 NEW A
+2 MERGE A=^BPST(IEN59)
+3 DO LOGARRAY^BPSOSL(IEN59,"A")
+4 QUIT
+5 ;
TASK ;EP - from BPSOSQ2,BPSOSQ4,BPSOSRB
+1 NEW X,%DT,Y
SET X="N"
SET %DT="ST"
DO ^%DT
+2 DO TASKAT(Y)
+3 QUIT
+4 ;
TASKAT(ZTDTH) ;EP - from BPSOSQ4 (requeue if insurer is sleeping)
+1 NEW ZTRTN,ZTIO
+2 SET ZTRTN="PACKETS^BPSOSQ2"
SET ZTIO=""
+3 DO ^%ZTLOAD
+4 QUIT