BPSOSQF ;BHAM ISC/FCS/DRS/FLS - Insurer asleep - status 31 ;06/01/2004
;;1.0;E CLAIMS MGMT ENGINE;**1,5,7,10**;JUN 2004;Build 27
;;Per VHA Directive 2004-038, this routine should not be modified.
Q
;
; Check for insurer asleep claims
;
STATUS31 ;EP - BPSOSQ2
; Loop through claims at 31%
; Reset to 30% if:
; a) This is a prober and it is time to retry
; b) The insurer is awake
N IEN59,GRPLAN
;
; Make sure we can get the lock
I '$$LOCK59^BPSOSQ2(31) Q
;
; Loop through transactions that are 31%
S IEN59=""
F S IEN59=$O(^BPST("AD",31,IEN59)) Q:'IEN59 D
. ;
. ; Get the Group Plan for the transaction
. S GRPLAN=+$$GETPLN59^BPSUTIL2(IEN59)
. I GRPLAN=0 D LOG^BPSOSL(IEN59,$T(+0)_"-No Group Plan was found") Q
. ;
. ; If this is the prober and it is time to retry, reset the status
. I $$PROBER(GRPLAN)=IEN59,$$RETRY(GRPLAN) D RESET(IEN59,"-Prober Transaction") Q
. ;
. ; If the plan is no longer asleep, reset the status
. I '$$ISASLEEP(GRPLAN) D RESET(IEN59,"-Payer is awake")
;
D UNLOCK59^BPSOSQ2(31)
Q
;
RESET(IEN59,MSG) ;
; Procedure to set status to 30% and log a message
; Input:
; IEN59 - BPS Transaction IEN59
; PROBER - Flag indicating whether this is a prober
I '$G(IEN59) Q
; Clear pointer to Asleep Payer
N DIE,DA,DR,DTOUT
S DIE=9002313.59,DA=IEN59,DR="801///@" D ^DIE
; Set status to 30%
D SETSTAT^BPSOSU(IEN59,30)
; Log message
D LOG^BPSOSL(IEN59,$T(+0)_"-Retrying Asleep Claim"_$G(MSG))
Q
;
ISASLEEP(GRPLAN) ;
; Function to check if Payer is asleep.
; Input:
; GRPLAN = GROUP INSURANCE PLAN file IEN
; Returns:
; 1 = Yes, payer is asleep
; 0 = No, payer is not asleep
I '$G(GRPLAN) Q 0
N BPAIEN,BPSSITE
;
; If the plan is not in the Insurer Asleep file, asleep is off
S BPAIEN=$O(^BPS(9002313.15,"B",GRPLAN,0))
Q:'BPAIEN 0
;
; If the plan is set to ignore, asleep is off
I $$IGNORE(GRPLAN) Q 0
;
; Check is the site parameters have disabled sleep
S BPSSITE=$G(^BPS(9002313.99,1,0))
I '$P(BPSSITE,"^",5)!('$P(BPSSITE,"^",6)) Q 0
;
Q 1
;
IGNORE(GRPLAN) ;
; Function to check if IGNORE ASLEEP flag set for Plan
; Input:
; GRPLAN = Group Insurance Plan file IEN
; Returns:
; 1 = Ignore
; 0 = Don't Ignore
I '$G(GRPLAN) Q 0
N BPAIEN
S BPAIEN=$O(^BPS(9002313.15,"B",GRPLAN,0))
Q:'BPAIEN 0
Q $S($P($G(^BPS(9002313.15,BPAIEN,0)),U,3)=1:1,1:0)
;
PROBER(GRPLAN) ;
; Function to return the PROBER CLAIM for an insurer
; Input:
; GRPLAN = Group Insurance Plan file IEN
; Returns:
; PROBER CLAIM - Pointer to BPS TRANSACTION file
I '$G(GRPLAN) Q ""
N BPAIEN
S BPAIEN=$O(^BPS(9002313.15,"B",GRPLAN,0))
Q:'BPAIEN ""
Q $P($G(^BPS(9002313.15,BPAIEN,0)),U,4)
;
RETRY(GRPLAN) ;
; Function to return a flag indicating whether it is time to rerun the prober
; Input:
; GRPLAN = Group Insurance Plan file IEN
; Returns:
; RETRY = Flag indicating it is time to retry the prober
I '$G(GRPLAN) Q 0
N BPAIEN,RETRY
S BPAIEN=$O(^BPS(9002313.15,"B",GRPLAN,0))
Q:'BPAIEN 0
S RETRY=$$GET1^DIQ(9002313.15,BPAIEN_",",.05,"I")
I RETRY'>$$NOW^XLFDT Q 1
Q 0
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HBPSOSQF 3180 printed Nov 22, 2024@17:02:07 Page 2
BPSOSQF ;BHAM ISC/FCS/DRS/FLS - Insurer asleep - status 31 ;06/01/2004
+1 ;;1.0;E CLAIMS MGMT ENGINE;**1,5,7,10**;JUN 2004;Build 27
+2 ;;Per VHA Directive 2004-038, this routine should not be modified.
+3 QUIT
+4 ;
+5 ; Check for insurer asleep claims
+6 ;
STATUS31 ;EP - BPSOSQ2
+1 ; Loop through claims at 31%
+2 ; Reset to 30% if:
+3 ; a) This is a prober and it is time to retry
+4 ; b) The insurer is awake
+5 NEW IEN59,GRPLAN
+6 ;
+7 ; Make sure we can get the lock
+8 IF '$$LOCK59^BPSOSQ2(31)
QUIT
+9 ;
+10 ; Loop through transactions that are 31%
+11 SET IEN59=""
+12 FOR
SET IEN59=$ORDER(^BPST("AD",31,IEN59))
if 'IEN59
QUIT
Begin DoDot:1
+13 ;
+14 ; Get the Group Plan for the transaction
+15 SET GRPLAN=+$$GETPLN59^BPSUTIL2(IEN59)
+16 IF GRPLAN=0
DO LOG^BPSOSL(IEN59,$TEXT(+0)_"-No Group Plan was found")
QUIT
+17 ;
+18 ; If this is the prober and it is time to retry, reset the status
+19 IF $$PROBER(GRPLAN)=IEN59
IF $$RETRY(GRPLAN)
DO RESET(IEN59,"-Prober Transaction")
QUIT
+20 ;
+21 ; If the plan is no longer asleep, reset the status
+22 IF '$$ISASLEEP(GRPLAN)
DO RESET(IEN59,"-Payer is awake")
End DoDot:1
+23 ;
+24 DO UNLOCK59^BPSOSQ2(31)
+25 QUIT
+26 ;
RESET(IEN59,MSG) ;
+1 ; Procedure to set status to 30% and log a message
+2 ; Input:
+3 ; IEN59 - BPS Transaction IEN59
+4 ; PROBER - Flag indicating whether this is a prober
+5 IF '$GET(IEN59)
QUIT
+6 ; Clear pointer to Asleep Payer
+7 NEW DIE,DA,DR,DTOUT
+8 SET DIE=9002313.59
SET DA=IEN59
SET DR="801///@"
DO ^DIE
+9 ; Set status to 30%
+10 DO SETSTAT^BPSOSU(IEN59,30)
+11 ; Log message
+12 DO LOG^BPSOSL(IEN59,$TEXT(+0)_"-Retrying Asleep Claim"_$GET(MSG))
+13 QUIT
+14 ;
ISASLEEP(GRPLAN) ;
+1 ; Function to check if Payer is asleep.
+2 ; Input:
+3 ; GRPLAN = GROUP INSURANCE PLAN file IEN
+4 ; Returns:
+5 ; 1 = Yes, payer is asleep
+6 ; 0 = No, payer is not asleep
+7 IF '$GET(GRPLAN)
QUIT 0
+8 NEW BPAIEN,BPSSITE
+9 ;
+10 ; If the plan is not in the Insurer Asleep file, asleep is off
+11 SET BPAIEN=$ORDER(^BPS(9002313.15,"B",GRPLAN,0))
+12 if 'BPAIEN
QUIT 0
+13 ;
+14 ; If the plan is set to ignore, asleep is off
+15 IF $$IGNORE(GRPLAN)
QUIT 0
+16 ;
+17 ; Check is the site parameters have disabled sleep
+18 SET BPSSITE=$GET(^BPS(9002313.99,1,0))
+19 IF '$PIECE(BPSSITE,"^",5)!('$PIECE(BPSSITE,"^",6))
QUIT 0
+20 ;
+21 QUIT 1
+22 ;
IGNORE(GRPLAN) ;
+1 ; Function to check if IGNORE ASLEEP flag set for Plan
+2 ; Input:
+3 ; GRPLAN = Group Insurance Plan file IEN
+4 ; Returns:
+5 ; 1 = Ignore
+6 ; 0 = Don't Ignore
+7 IF '$GET(GRPLAN)
QUIT 0
+8 NEW BPAIEN
+9 SET BPAIEN=$ORDER(^BPS(9002313.15,"B",GRPLAN,0))
+10 if 'BPAIEN
QUIT 0
+11 QUIT $SELECT($PIECE($GET(^BPS(9002313.15,BPAIEN,0)),U,3)=1:1,1:0)
+12 ;
PROBER(GRPLAN) ;
+1 ; Function to return the PROBER CLAIM for an insurer
+2 ; Input:
+3 ; GRPLAN = Group Insurance Plan file IEN
+4 ; Returns:
+5 ; PROBER CLAIM - Pointer to BPS TRANSACTION file
+6 IF '$GET(GRPLAN)
QUIT ""
+7 NEW BPAIEN
+8 SET BPAIEN=$ORDER(^BPS(9002313.15,"B",GRPLAN,0))
+9 if 'BPAIEN
QUIT ""
+10 QUIT $PIECE($GET(^BPS(9002313.15,BPAIEN,0)),U,4)
+11 ;
RETRY(GRPLAN) ;
+1 ; Function to return a flag indicating whether it is time to rerun the prober
+2 ; Input:
+3 ; GRPLAN = Group Insurance Plan file IEN
+4 ; Returns:
+5 ; RETRY = Flag indicating it is time to retry the prober
+6 IF '$GET(GRPLAN)
QUIT 0
+7 NEW BPAIEN,RETRY
+8 SET BPAIEN=$ORDER(^BPS(9002313.15,"B",GRPLAN,0))
+9 if 'BPAIEN
QUIT 0
+10 SET RETRY=$$GET1^DIQ(9002313.15,BPAIEN_",",.05,"I")
+11 IF RETRY'>$$NOW^XLFDT
QUIT 1
+12 QUIT 0