PXCOMPACTBKGRND ;ALB/BPA,CMC - Background job routine for COMPACT Act processing ;04/29/2024 4:03OM
;;1.0;PCE PATIENT CARE ENCOUNTER;**240**;Aug 12, 1996;Build 55
; *240* Background routine for COMPACT Act administrative eligibility
;
Q
;
BCKGRDJOB ;
N DFN,ENDDT,PXLASTSEQ,PXEOCNUM,PXTY
;this is a background job that will identify episodes of care that have expired and end them
S DFN=""
F S DFN=$O(^PXCOMP(818,"B",DFN)) Q:DFN="" D
. S PXEOCNUM=$$GETEOC^PXCOMPACT(DFN)
. ;check EOC OPEN/CLOSE flag (1 = open, 0 = closed)
. I $P(^PXCOMP(818,PXEOCNUM,0),"^",2)=0 Q
. ;check if episode is Inpatient or Outpatient
. S PXTY=$P(^PXCOMP(818,PXEOCNUM,0),"^",3)
. I PXTY="" Q
. ;get latest episode of care sequence
. S PXLASTSEQ=$$GETEOCSEQ^PXCOMPACT(DFN)
. ;now verify the corresponding Inpatient/Outpatient benefit end date and compare to today
. I PXTY="I" S ENDDT=$P($G(^PXCOMP(818,PXEOCNUM,10,PXLASTSEQ,0)),"^",4)
. I PXTY="O" S ENDDT=$P($G(^PXCOMP(818,PXEOCNUM,10,PXLASTSEQ,0)),"^",5)
. I ENDDT="" Q
. I DT>ENDDT D
. . D SETENDDT^PXCOMPACT(DFN,ENDDT,"TE",,"Time expired")
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXCOMPACTBKGRND 1129 printed Nov 22, 2024@17:38:31 Page 2
PXCOMPACTBKGRND ;ALB/BPA,CMC - Background job routine for COMPACT Act processing ;04/29/2024 4:03OM
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**240**;Aug 12, 1996;Build 55
+2 ; *240* Background routine for COMPACT Act administrative eligibility
+3 ;
+4 QUIT
+5 ;
BCKGRDJOB ;
+1 NEW DFN,ENDDT,PXLASTSEQ,PXEOCNUM,PXTY
+2 ;this is a background job that will identify episodes of care that have expired and end them
+3 SET DFN=""
+4 FOR
SET DFN=$ORDER(^PXCOMP(818,"B",DFN))
if DFN=""
QUIT
Begin DoDot:1
+5 SET PXEOCNUM=$$GETEOC^PXCOMPACT(DFN)
+6 ;check EOC OPEN/CLOSE flag (1 = open, 0 = closed)
+7 IF $PIECE(^PXCOMP(818,PXEOCNUM,0),"^",2)=0
QUIT
+8 ;check if episode is Inpatient or Outpatient
+9 SET PXTY=$PIECE(^PXCOMP(818,PXEOCNUM,0),"^",3)
+10 IF PXTY=""
QUIT
+11 ;get latest episode of care sequence
+12 SET PXLASTSEQ=$$GETEOCSEQ^PXCOMPACT(DFN)
+13 ;now verify the corresponding Inpatient/Outpatient benefit end date and compare to today
+14 IF PXTY="I"
SET ENDDT=$PIECE($GET(^PXCOMP(818,PXEOCNUM,10,PXLASTSEQ,0)),"^",4)
+15 IF PXTY="O"
SET ENDDT=$PIECE($GET(^PXCOMP(818,PXEOCNUM,10,PXLASTSEQ,0)),"^",5)
+16 IF ENDDT=""
QUIT
+17 IF DT>ENDDT
Begin DoDot:2
+18 DO SETENDDT^PXCOMPACT(DFN,ENDDT,"TE",,"Time expired")
End DoDot:2
End DoDot:1
+19 QUIT
+20 ;