IBCNIUF ;AITC/TAZ - IIU FILER ;01/14/21 2:23p.m.
;;2.0;INTEGRATED BILLING;**687**;21-MAR-94;Build 88
;;Per VA Directive 6402, this routine should not be modified.
;
;IA/ICR #2990 and #10112 Used in tag TFL
;
Q
;
LOC(DFN,INSCOIEN,IEN312,AUTO,BUFFER,SOI,ICB) ; Entry point to file locally generated data
;INPUT:
; DFN - Pointer to Patient file
; IEN312 - Pointer to the INSURANCE TYPE record
; AUTO - AUTO UPDATE Yes/No
; BUFFER - Pointer to Buffer File
; SOI - Source of Information
; ICB - ICB processed buffer Yes/No
; ICB was set in routine IBCNICB. It will be used to set ICB PROCESSED BUFFER (365.19,1.08)
;
;OUTPUT:
; None
;
N DATA,IBDFDA,IEN,IENS,PIEN,SITE,SITES
;
;If Manila and not participating in IIU, quit and don't file into #365.19
I (+$P($$SITE^VASITE,U,3)=358),$$GET1^DIQ(350.9,"1,",51.33,"I")="N" G LOCQ
;
;Quit if the IIU MASTER SWITCH is off
I $$GET1^DIQ(350.9,1_",",53.01,"I")'="Y" G LOCQ
;
S PIEN=$$GET1^DIQ(36,INSCOIEN_",",3.1,"I") ; payer IEN associated with ins company
S IENS=IEN312_","_DFN_","
;
I '$$OKTOFILE G LOCQ ;Not a valid policy for IIU
;
;Set Header Nodes
S DATA(.01)=DFN
S DATA(.02)=$$NOW^XLFDT
S DATA(.03)="S"
;
;Set SENDER nodes
S DATA(1.01)="W" ;SENDER STATUS
S DATA(1.02)=PIEN ;Pointer to the Payer File (#365.12)
S DATA(1.03)=IEN312 ;Pointer to INSURANCE TYPE subfile (#2.312)
S DATA(1.04)=$G(AUTO,0) ;Auto Updated Yes/No
S DATA(1.05)=$G(BUFFER) ;Pointer to the INSURANCE VERIFICATION PROCESSOR File (#355.33)
I $G(AUTO) D
. S DATA(1.06)=$$GET1^DIQ(2.312,IENS,7.02,"I") ;Subscriber ID to be sent to remote facility
. S DATA(1.07)=$$GET1^DIQ(2.312,IENS,.2,"I") ;Coordination of Benefits to be sent to remote facility
S DATA(1.08)=+$G(ICB) ;ICB Processed Buffer Yes/No
;
; File Main Level Data
S IEN=$$ADD^IBDFDBS(365.19,,.DATA)
K DATA
;
; File VAMC Level
S SITE=0
F S SITE=$O(SITES(SITE)) Q:'SITE D
. N X
. S IBDFDA(1)=IEN
. S DATA(.01)=SITE
. S DATA(.02)="R"
. S DATA(.03)=$$NOW^XLFDT
. S X=$$ADD^IBDFDBS(365.191,.IBDFDA,.DATA)
. K DATA
;
;Send to remote site in real time
D RT^IBCNIUHL(IEN)
;
LOCQ ;Exit Local processing
Q
;====================================
OKTOFILE() ; Confirm that we can/should send to remote facilities
N OK
S OK=0
K SITES ;array of sites that will receive the verified active policy
;
;Check Insurance Co
I "^VACAA-WNR^CAMPLEJEUNE-WNR^IVF-WNR^VHADIRECTIVE1029WNR"[$TR($$GET1^DIQ(36,INSCOIEN_",",.01,"E")," ","") G OKTOFILEQ
;
;Check Payer
I '$$PYRAPP^IBCNEUT5("IIU",PIEN) G OKTOFILEQ ;Payer is not IIU
I $$PYRDEACT^IBCNINSU(PIEN) G OKTOFILEQ ;Payer is Deactivated
;
;Check Patient
I $$GET1^DIQ(2,DFN_",",.6,"I") G OKTOFILEQ ;Is a test patient
I $E($$GET1^DIQ(2,DFN_",",.09,"I")="P") G OKTOFILEQ ;Has Pseudo SSN
;
;Check Policy
I ",INTERFACILITY INS UPDATE,INSURANCE IMPORT,"[(","_SOI_",") G OKTOFILEQ ;Source of Information is IMPORT OR IIU
I '$$ACTIVE() G OKTOFILEQ
I '$$TOP() G OKTOFILEQ
;
;Check Sites
S SITES=$$TFL(DFN,.SITES) ;Build list of remote facilities visited.
I 'SITES G OKTOFILEQ ;No sites were visited
;
;IIU days before sending violated
; check the combination of patient, policy, and facility we sent it to
N DEST,DESTDT,DESTIEN,DESTSTAT,IEN,SHAREDT
; TODAY - IIU MIN DAYS BEFORE SHARING (#53.04) to determine if it is too soon
S SHAREDT=$$FMADD^XLFDT(DT,-$$GET1^DIQ(350.9,1_",",53.04,"I"))
I $D(^IBCN(365.19,"D",DFN,IEN312)) D
. S IEN="" F S IEN=$O(^IBCN(365.19,"D",DFN,IEN312,IEN)) Q:'IEN D
. . S DESTIEN=0 F S DESTIEN=$O(^IBCN(365.19,IEN,1.1,DESTIEN)) Q:'DESTIEN D
. . . S DEST=$$GET1^DIQ(365.191,DESTIEN_","_IEN_",",.01,"I")
. . . S DESTSTAT=$$GET1^DIQ(365.191,DESTIEN_","_IEN_",",.02,"I")
. . . I DESTSTAT="R",$D(SITES(DEST)) K SITES(DEST) S SITES=SITES-1 Q ; waiting to send to site
. . . S DESTDT=$P($$GET1^DIQ(365.191,DESTIEN_","_IEN_",",.03,"I"),".") ;date only
. . . ;
. . . ; SUBTRACT IIU MIN DAYS BEFORE SHARING (#53.04) from Today. If the date is less than DATE/TIME CREATED (#.02) it is too soon.
. . . I SHAREDT<DESTDT K SITES(DEST) S SITES=SITES-1
;
I 'SITES G OKTOFILEQ ;No sites to send to
;
S OK=1
;
OKTOFILEQ ;
Q OK
;
TFL(DFN,IBT,DIR) ; returns treating facility list (pass IBT by reference)
;INPUT:
; DFN - Patient's IEN in the Patient File
; IBT - Array of visited facilities
; DIR - Direction of data flow
; S = Sending
; R = Receiving
;OUTPUT:
; IBT - Array of sites
; Can have multiple entries for Sending
; Will have 1 entry for receiving
; supported references IA #2990 and #10112, value returned is count
; needed to new Y because VAFCTFU1 will kill it
N FTLIEN,IBC,IBZ,IBS,IBFT,Y
;
K IBT
S DIR=$G(DIR,"S")
D TFL^VAFCTFU1(.IBZ,DFN) Q:-$G(IBZ(1))=1 0
; Setup current site and initialize variables
S IBS=+$P($$SITE^VASITE,"^",3),(IBZ,IBC)=0
; Return only remote facilities of certain types:
S IBFT="^VAMC^"
F S IBZ=$O(IBZ(IBZ)) Q:IBZ<1 I +IBZ(IBZ)>0 D
. I (+IBZ(IBZ)=358),$$GET1^DIQ(350.9,"1,",51.33,"I")="N" Q ;Manila is not participating
. S FTLIEN=$$FIND1^DIC(4,,"X",+IBZ(IBZ),"D") I 'FTLIEN Q
. ;If it is the current site and Sending, Q. If receiving set array.
. I +IBZ(IBZ)=IBS Q:(DIR'="R") S IBT(FTLIEN)=IBZ(IBZ),IBC=IBC+1 Q
. ; build array for sending sites
. I DIR="R" Q
. I $$INSTS^IBCNINSL(FTLIEN) S IBT(FTLIEN)=IBZ(IBZ),IBC=IBC+1
Q IBC
;
ACTIVE() ;Check active policy status
N OK,EFFDT,EXPDT
S OK=0
S EFFDT=$$GET1^DIQ(2.312,IENS,8,"I")
S EXPDT=$$GET1^DIQ(2.312,IENS,3,"I")
I 'EFFDT G ACTIVEQ
I EXPDT,(EXPDT<DT) G ACTIVEQ
S OK=1
;
ACTIVEQ ;
Q OK
;
TOP() ;Screen Type of Plan
N GRPIEN,OK,TOP
S OK=0
S GRPIEN=$$GET1^DIQ(2.312,IENS,.18,"I")
S TOP=$$GET1^DIQ(355.3,GRPIEN_",",.09,"E")
I "^ACCIDENT AND HEALTH INSURANCE^AUTOMOBILE^AVIATION TRIP INSURANCE^CATASTROPHIC INSURANCE^"[("^"_TOP_"^") G TOPQ
I "^COINSURANCE^DUAL COVERAGE^INCOME PROTECTION (INDEMNITY)^KEY-MAN HEALTH INSURANCE^"[("^"_TOP_"^") G TOPQ
I "^MEDI-CAL^MEDICAID^MEDICARE/MEDICAID (MEDI-CAL)^NO-FAULT INSURANCE^QUALIFIED IMPAIRMENT INSURANCE^"[("^"_TOP_"^") G TOPQ
I "^SPECIAL CLASS INSURANCE^SPECIAL RISK INSURANCE^SPECIFIED DISEASE INSURANCE^TORT FEASOR^"[("^"_TOP_"^") G TOPQ
I "^VA SPECIAL CLASS^WORKERS' COMPENSATION INSURANCE^"[("^"_TOP_"^") G TOPQ
;
S OK=1
;
TOPQ ;
Q OK
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBCNIUF 6740 printed Dec 13, 2024@02:15:57 Page 2
IBCNIUF ;AITC/TAZ - IIU FILER ;01/14/21 2:23p.m.
+1 ;;2.0;INTEGRATED BILLING;**687**;21-MAR-94;Build 88
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 ;IA/ICR #2990 and #10112 Used in tag TFL
+5 ;
+6 QUIT
+7 ;
LOC(DFN,INSCOIEN,IEN312,AUTO,BUFFER,SOI,ICB) ; Entry point to file locally generated data
+1 ;INPUT:
+2 ; DFN - Pointer to Patient file
+3 ; IEN312 - Pointer to the INSURANCE TYPE record
+4 ; AUTO - AUTO UPDATE Yes/No
+5 ; BUFFER - Pointer to Buffer File
+6 ; SOI - Source of Information
+7 ; ICB - ICB processed buffer Yes/No
+8 ; ICB was set in routine IBCNICB. It will be used to set ICB PROCESSED BUFFER (365.19,1.08)
+9 ;
+10 ;OUTPUT:
+11 ; None
+12 ;
+13 NEW DATA,IBDFDA,IEN,IENS,PIEN,SITE,SITES
+14 ;
+15 ;If Manila and not participating in IIU, quit and don't file into #365.19
+16 IF (+$PIECE($$SITE^VASITE,U,3)=358)
IF $$GET1^DIQ(350.9,"1,",51.33,"I")="N"
GOTO LOCQ
+17 ;
+18 ;Quit if the IIU MASTER SWITCH is off
+19 IF $$GET1^DIQ(350.9,1_",",53.01,"I")'="Y"
GOTO LOCQ
+20 ;
+21 ; payer IEN associated with ins company
SET PIEN=$$GET1^DIQ(36,INSCOIEN_",",3.1,"I")
+22 SET IENS=IEN312_","_DFN_","
+23 ;
+24 ;Not a valid policy for IIU
IF '$$OKTOFILE
GOTO LOCQ
+25 ;
+26 ;Set Header Nodes
+27 SET DATA(.01)=DFN
+28 SET DATA(.02)=$$NOW^XLFDT
+29 SET DATA(.03)="S"
+30 ;
+31 ;Set SENDER nodes
+32 ;SENDER STATUS
SET DATA(1.01)="W"
+33 ;Pointer to the Payer File (#365.12)
SET DATA(1.02)=PIEN
+34 ;Pointer to INSURANCE TYPE subfile (#2.312)
SET DATA(1.03)=IEN312
+35 ;Auto Updated Yes/No
SET DATA(1.04)=$GET(AUTO,0)
+36 ;Pointer to the INSURANCE VERIFICATION PROCESSOR File (#355.33)
SET DATA(1.05)=$GET(BUFFER)
+37 IF $GET(AUTO)
Begin DoDot:1
+38 ;Subscriber ID to be sent to remote facility
SET DATA(1.06)=$$GET1^DIQ(2.312,IENS,7.02,"I")
+39 ;Coordination of Benefits to be sent to remote facility
SET DATA(1.07)=$$GET1^DIQ(2.312,IENS,.2,"I")
End DoDot:1
+40 ;ICB Processed Buffer Yes/No
SET DATA(1.08)=+$GET(ICB)
+41 ;
+42 ; File Main Level Data
+43 SET IEN=$$ADD^IBDFDBS(365.19,,.DATA)
+44 KILL DATA
+45 ;
+46 ; File VAMC Level
+47 SET SITE=0
+48 FOR
SET SITE=$ORDER(SITES(SITE))
if 'SITE
QUIT
Begin DoDot:1
+49 NEW X
+50 SET IBDFDA(1)=IEN
+51 SET DATA(.01)=SITE
+52 SET DATA(.02)="R"
+53 SET DATA(.03)=$$NOW^XLFDT
+54 SET X=$$ADD^IBDFDBS(365.191,.IBDFDA,.DATA)
+55 KILL DATA
End DoDot:1
+56 ;
+57 ;Send to remote site in real time
+58 DO RT^IBCNIUHL(IEN)
+59 ;
LOCQ ;Exit Local processing
+1 QUIT
+2 ;====================================
OKTOFILE() ; Confirm that we can/should send to remote facilities
+1 NEW OK
+2 SET OK=0
+3 ;array of sites that will receive the verified active policy
KILL SITES
+4 ;
+5 ;Check Insurance Co
+6 IF "^VACAA-WNR^CAMPLEJEUNE-WNR^IVF-WNR^VHADIRECTIVE1029WNR"[$TRANSLATE($$GET1^DIQ(36,INSCOIEN_",",.01,"E")," ","")
GOTO OKTOFILEQ
+7 ;
+8 ;Check Payer
+9 ;Payer is not IIU
IF '$$PYRAPP^IBCNEUT5("IIU",PIEN)
GOTO OKTOFILEQ
+10 ;Payer is Deactivated
IF $$PYRDEACT^IBCNINSU(PIEN)
GOTO OKTOFILEQ
+11 ;
+12 ;Check Patient
+13 ;Is a test patient
IF $$GET1^DIQ(2,DFN_",",.6,"I")
GOTO OKTOFILEQ
+14 ;Has Pseudo SSN
IF $EXTRACT($$GET1^DIQ(2,DFN_",",.09,"I")="P")
GOTO OKTOFILEQ
+15 ;
+16 ;Check Policy
+17 ;Source of Information is IMPORT OR IIU
IF ",INTERFACILITY INS UPDATE,INSURANCE IMPORT,"[(","_SOI_",")
GOTO OKTOFILEQ
+18 IF '$$ACTIVE()
GOTO OKTOFILEQ
+19 IF '$$TOP()
GOTO OKTOFILEQ
+20 ;
+21 ;Check Sites
+22 ;Build list of remote facilities visited.
SET SITES=$$TFL(DFN,.SITES)
+23 ;No sites were visited
IF 'SITES
GOTO OKTOFILEQ
+24 ;
+25 ;IIU days before sending violated
+26 ; check the combination of patient, policy, and facility we sent it to
+27 NEW DEST,DESTDT,DESTIEN,DESTSTAT,IEN,SHAREDT
+28 ; TODAY - IIU MIN DAYS BEFORE SHARING (#53.04) to determine if it is too soon
+29 SET SHAREDT=$$FMADD^XLFDT(DT,-$$GET1^DIQ(350.9,1_",",53.04,"I"))
+30 IF $DATA(^IBCN(365.19,"D",DFN,IEN312))
Begin DoDot:1
+31 SET IEN=""
FOR
SET IEN=$ORDER(^IBCN(365.19,"D",DFN,IEN312,IEN))
if 'IEN
QUIT
Begin DoDot:2
+32 SET DESTIEN=0
FOR
SET DESTIEN=$ORDER(^IBCN(365.19,IEN,1.1,DESTIEN))
if 'DESTIEN
QUIT
Begin DoDot:3
+33 SET DEST=$$GET1^DIQ(365.191,DESTIEN_","_IEN_",",.01,"I")
+34 SET DESTSTAT=$$GET1^DIQ(365.191,DESTIEN_","_IEN_",",.02,"I")
+35 ; waiting to send to site
IF DESTSTAT="R"
IF $DATA(SITES(DEST))
KILL SITES(DEST)
SET SITES=SITES-1
QUIT
+36 ;date only
SET DESTDT=$PIECE($$GET1^DIQ(365.191,DESTIEN_","_IEN_",",.03,"I"),".")
+37 ;
+38 ; SUBTRACT IIU MIN DAYS BEFORE SHARING (#53.04) from Today. If the date is less than DATE/TIME CREATED (#.02) it is too soon.
+39 IF SHAREDT<DESTDT
KILL SITES(DEST)
SET SITES=SITES-1
End DoDot:3
End DoDot:2
End DoDot:1
+40 ;
+41 ;No sites to send to
IF 'SITES
GOTO OKTOFILEQ
+42 ;
+43 SET OK=1
+44 ;
OKTOFILEQ ;
+1 QUIT OK
+2 ;
TFL(DFN,IBT,DIR) ; returns treating facility list (pass IBT by reference)
+1 ;INPUT:
+2 ; DFN - Patient's IEN in the Patient File
+3 ; IBT - Array of visited facilities
+4 ; DIR - Direction of data flow
+5 ; S = Sending
+6 ; R = Receiving
+7 ;OUTPUT:
+8 ; IBT - Array of sites
+9 ; Can have multiple entries for Sending
+10 ; Will have 1 entry for receiving
+11 ; supported references IA #2990 and #10112, value returned is count
+12 ; needed to new Y because VAFCTFU1 will kill it
+13 NEW FTLIEN,IBC,IBZ,IBS,IBFT,Y
+14 ;
+15 KILL IBT
+16 SET DIR=$GET(DIR,"S")
+17 DO TFL^VAFCTFU1(.IBZ,DFN)
if -$GET(IBZ(1))=1
QUIT 0
+18 ; Setup current site and initialize variables
+19 SET IBS=+$PIECE($$SITE^VASITE,"^",3)
SET (IBZ,IBC)=0
+20 ; Return only remote facilities of certain types:
+21 SET IBFT="^VAMC^"
+22 FOR
SET IBZ=$ORDER(IBZ(IBZ))
if IBZ<1
QUIT
IF +IBZ(IBZ)>0
Begin DoDot:1
+23 ;Manila is not participating
IF (+IBZ(IBZ)=358)
IF $$GET1^DIQ(350.9,"1,",51.33,"I")="N"
QUIT
+24 SET FTLIEN=$$FIND1^DIC(4,,"X",+IBZ(IBZ),"D")
IF 'FTLIEN
QUIT
+25 ;If it is the current site and Sending, Q. If receiving set array.
+26 IF +IBZ(IBZ)=IBS
if (DIR'="R")
QUIT
SET IBT(FTLIEN)=IBZ(IBZ)
SET IBC=IBC+1
QUIT
+27 ; build array for sending sites
+28 IF DIR="R"
QUIT
+29 IF $$INSTS^IBCNINSL(FTLIEN)
SET IBT(FTLIEN)=IBZ(IBZ)
SET IBC=IBC+1
End DoDot:1
+30 QUIT IBC
+31 ;
ACTIVE() ;Check active policy status
+1 NEW OK,EFFDT,EXPDT
+2 SET OK=0
+3 SET EFFDT=$$GET1^DIQ(2.312,IENS,8,"I")
+4 SET EXPDT=$$GET1^DIQ(2.312,IENS,3,"I")
+5 IF 'EFFDT
GOTO ACTIVEQ
+6 IF EXPDT
IF (EXPDT<DT)
GOTO ACTIVEQ
+7 SET OK=1
+8 ;
ACTIVEQ ;
+1 QUIT OK
+2 ;
TOP() ;Screen Type of Plan
+1 NEW GRPIEN,OK,TOP
+2 SET OK=0
+3 SET GRPIEN=$$GET1^DIQ(2.312,IENS,.18,"I")
+4 SET TOP=$$GET1^DIQ(355.3,GRPIEN_",",.09,"E")
+5 IF "^ACCIDENT AND HEALTH INSURANCE^AUTOMOBILE^AVIATION TRIP INSURANCE^CATASTROPHIC INSURANCE^"[("^"_TOP_"^")
GOTO TOPQ
+6 IF "^COINSURANCE^DUAL COVERAGE^INCOME PROTECTION (INDEMNITY)^KEY-MAN HEALTH INSURANCE^"[("^"_TOP_"^")
GOTO TOPQ
+7 IF "^MEDI-CAL^MEDICAID^MEDICARE/MEDICAID (MEDI-CAL)^NO-FAULT INSURANCE^QUALIFIED IMPAIRMENT INSURANCE^"[("^"_TOP_"^")
GOTO TOPQ
+8 IF "^SPECIAL CLASS INSURANCE^SPECIAL RISK INSURANCE^SPECIFIED DISEASE INSURANCE^TORT FEASOR^"[("^"_TOP_"^")
GOTO TOPQ
+9 IF "^VA SPECIAL CLASS^WORKERS' COMPENSATION INSURANCE^"[("^"_TOP_"^")
GOTO TOPQ
+10 ;
+11 SET OK=1
+12 ;
TOPQ ;
+1 QUIT OK
+2 ;