Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: IBFBWL2

IBFBWL2.m

Go to the documentation of this file.
IBFBWL2 ;ALB/PAW-IB BILLING Worklist Expand Item ;30-SEP-2015
 ;;2.0;INTEGRATED BILLING;**554**;21-MAR-94;Build 81
 ;Per VA Directive 6402, this routine should not be modified.
 ;
EN ; -- main entry point for BILLING WORKLIST EXPAND
 D EN^VALM("IB PRECERT WORKLIST EXPAND")
 Q
 ;
HDR ; -- header code
 S VALM("TITLE")=" Expanded NVC"
 Q
 ;
INIT ; -- init variables and list array
 ; input - ^TMP("IBFBWE",$J)=DFN^IBNAME^IBAUTH
 ; output - Expanded worklist screen
 I '$D(^TMP("IBFBWE",$J)) Q
 N CNT,DFN,ECNT,IBFBA,IBNAME,IBAUTH,IBST,LINE,VAEL
 S ECNT=$G(^TMP("IBFBWE",$J))
 S DFN=$P(ECNT,U,1),IBNAME=$P(ECNT,U,2),IBAUTH=$P(ECNT,U,3),IBFBA=$P(ECNT,U,4)
 D BLD
 D GETSC
 D GETSTA
 D GETINS
 D BLDEXP
 S VALMBCK="R"
 Q
 ;
BLD ; build data to display
 N IBARRAY,IB7078,IBCP,IBFBCPT,IBFBCPTD,IBIEN,IBDX1,IBDX2,IBDX3,IBEND,IBENDX,IBFILL,IBFP,IBFPNO,IBICDDX,IBICDDXD,IBINV,IBINVPD,IBMT,IBFPNOT,IBPAYX,IBNPI
 N IBPUR,IBREF,IBREFA,IBREM,IBREM1,IBREMARK,IBRET,IBSS,IBSTX,IBTAX,IBVND,IBVNDA,IBVNPI,IBSSX,IBSSLE
 N IBSSLS,IBVTAX,IBX,IBXX,VA,IBDIV,IBDIV2,IBSTNUM
 S CNT=0
 D ELIG^VADPT
 S IBSSX=$$GET1^DIQ(2,DFN_",",.09,"I"),IBSSLE=$L(IBSSX),IBSSLS=6 I $E(IBSSX,IBSSLE)="P" S IBSSLS=5
 S IBSS=$E(IBNAME,1)_$E(IBSSX,IBSSLS,IBSSLE)
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="PATIENT           : "_IBNAME_" (ID: "_IBSS_")"
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="SSN               : "_IBSSX
 S IBIEN=IBAUTH_","_DFN_","
 S IBDIV=$$GET1^DIQ(161.01,IBIEN_",",101,"E")
 S IBDIV2=$$GET1^DIQ(161.01,IBIEN_",",101,"I")
 S IBSTNUM=$$GET1^DIQ(4,IBDIV2_",",99,"E")
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="DIVISION          : "_IBDIV_" - "_IBSTNUM
 D GETAUTH^IBFBUTIL(IBIEN,"IBARRAY")  ; Call API for Authorization Sub-File (#161.01) fields
 I IBWLTYP="P" D
 . S IBST=$G(IBARRAY(161.01,IBIEN,.01,"I"))
 . S IBEND=$G(IBARRAY(161.01,IBIEN,.02,"I"))
 . S IBSTX=$G(IBARRAY(161.01,IBIEN,.01,"E"))
 . S IBENDX=$G(IBARRAY(161.01,IBIEN,.02,"E"))
 . S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="AUTH DOS RANGE    : "_IBSTX_" - "_IBENDX
 I IBWLTYP="B" D
 . S (IBST,IBINV)=""
 . I IBFBA'="" S IBXX=IBFBA
 . I IBFBA="" D
 .. S IBX="" F  S IBX=$O(^IBFB(360,"C",DFN,IBX)) Q:IBX=""  D
 ... I $$GET1^DIQ(360,IBX_",",.03)=IBAUTH S IBXX=IBX
 . D GETST^IBFBUTIL(IBXX)
 . D GETPAY^IBFBUTIL(IBXX)
 . I IBST'="" S IBSTX=$$FDATE^VALM1(IBST)
 . I $G(IBFPNOT)="CIVIL HOSPITAL" S IBFPNOT=IBFPNOT_" (INPATIENT)"
 . I $G(IBFPNOT)="CONTRACT NURSING HOME" S IBFPNOT=IBFPNOT_" (SKILLED NURSING FACILIY)"
 . S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="INVOICE NVC       : "_$G(IBFPNOT)
 . S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="INVOICE#          : "_IBINV
 . I IBFPNO=2!(IBFPNO=3) S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="SERVICE DATE      : "_$G(IBSTX)
 . I IBFPNO=6!(IBFPNO=7) S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="DOS START DATE    : "_$G(IBSTX)
 . ; I IBFPNO=3 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="VENDOR            : "_$G(IBVNDA)
 . I $G(IBINV)'="" D
 .. S IBPAYX=""
 .. F  S IBPAYX=$O(IBRET(162.03,IBPAYX)) Q:IBPAYX=""  D
 ... I $G(IBRET(162.03,IBPAYX,.01,"I"))'="",IBST'="" D  ; Short description of CPT
 .... S IBFBCPT=IBRET(162.03,IBPAYX,.01,"I")
 .... S IBFBCPTD=$$CPT^ICPTCOD(IBFBCPT,$S($G(IBST)>0:+$G(IBST),1:""),1)
 .... I IBFBCPTD'="" S IBFBCPT=$P(IBFBCPTD,U,2)_" - "_$P(IBFBCPTD,U,3)
 ... ; S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="  SERVICE CPT     : "_$G(IBRET(162.03,IBPAYX,.01,"I"))
 ... S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="  SERVICE CPT     : "_$G(IBFBCPT)
 ... I $D(IBRET(162.03,IBPAYX,2,"I")) S IBINVPD=$FN(IBRET(162.03,IBPAYX,2,"I"),"",2)
 ... S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="  AMOUNT PAID     : "_$G(IBINVPD)
 ... S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="  RENDERING PROV  : "_$G(IBRET(162.03,IBPAYX,63,"I"))
 ... S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="  RENDERING NPI   : "_$G(IBRET(162.03,IBPAYX,64,"I"))
 ... S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="  RENDERING TAX   : "_$G(IBRET(162.03,IBPAYX,65,"I"))
 S IBFP=$G(IBARRAY(161.01,IBIEN,.03,"E"))
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="AUTHORIZATION NVC : "_IBFP
 S IBPUR=$G(IBARRAY(161.01,IBIEN,.07,"E"))
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="PURPOSE OF VISIT  : "_IBPUR
 S IBVND=$G(IBARRAY(161.01,IBIEN,.04,"E"))
 S IBVNDA=$G(IBARRAY(161.01,IBIEN,.04,"I"))
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="NON-VA LOCATION   : "_IBVND
 S IBVNPI=""
 I IBVNDA'="" S IBVNPI=$$GET1^DIQ(161.2,IBVNDA_",",41.01)
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="   NPI#           : "_IBVNPI
 S IBVTAX=""
 I IBVNDA'="" S IBVTAX=$$GET1^DIQ(161.2,IBVNDA_",",42)
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="   TAXONOMY       : "_IBVTAX
 S IB7078=$G(IBARRAY(161.01,IBIEN,.055,"E"))
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="ASSOC 7078/583    : "_IB7078
 S IBREF=$G(IBARRAY(161.01,IBIEN,104,"E"))
 S IBREFA=$G(IBARRAY(161.01,IBIEN,104,"I"))
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="ORDERING PHYSICIAN: "_IBREF
 S IBNPI=""
 I IBREFA'="" S IBNPI=$$GET1^DIQ(200,IBREFA_",",41.99)
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="   NPI#           : "_IBNPI
 ; Placeholder if VA starts to use Taxonomy for VA physicians
 S IBTAX=""
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="   TAXONOMY       : "_IBTAX
 S IBMT=$P($G(VAEL(9)),U,2)
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="MEANS TEST STATUS : "_IBMT
 D DISP^IBARXEU(DFN,IBST,1,"")
 S IBCP=$P($G(X),U,2)
 ; S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="MED COPAY EXEMP ST: "_IBCP
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="RX COPAY EXEMP ST : "_IBCP
 S IBDX1=$G(IBARRAY(161.01,IBIEN,.08,"E"))
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="DIAGNOSIS 1       : "_IBDX1
 S IBDX2=$G(IBARRAY(161.01,IBIEN,.085,"E"))
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="DIAGNOSIS 2       : "_IBDX2
 S IBDX3=$G(IBARRAY(161.01,IBIEN,.086,"E"))
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="DIAGNOSIS 3       : "_IBDX3
 S IBICDDX=$G(IBARRAY(161.01,IBIEN,.087,"E"))
 I $G(IBARRAY(161.01,IBIEN,.087,"I"))'="" D
 . S IBICDDXD=$$ICDDATA^ICDXCODE("10D",IBARRAY(161.01,IBIEN,.087,"I"))
 . S IBICDDXD=$P(IBICDDXD,U,4)
 . I IBICDDXD="" D
 .. S IBICDDXD=$$ICDDATA^ICDXCODE("ICD9",IBARRAY(161.01,IBIEN,.087,"I"),IBST)
 .. S IBICDDXD=$P(IBICDDXD,U,4)
 . I IBICDDXD'="" S IBICDDX=IBICDDX_" - "_IBICDDXD
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="ICD DIAGNOSIS     : "_IBICDDX
 I '$D(IBARRAY(161.01,IBIEN,.021)) S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="AUTH REMARKS      : "
 S IBREM="",IBREM1=1
 F  S IBREM=$O(IBARRAY(161.01,IBIEN,.021,IBREM)) Q:IBREM=""!(IBREM="E")  D
 . S IBREMARK=IBARRAY(161.01,IBIEN,.021,IBREM)
 . I IBREM1 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="AUTH REMARKS      : "_IBREMARK,IBREM1=0
 . E  S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="                  : "_IBREMARK
 Q
 ;
BLDEXP ; Build expand screen 
 D FULL^VALM1
 N IBXX
 S DFN=$P(ECNT,U,1),IBNAME=$P(ECNT,U,2),IBAUTH=$P(ECNT,U,3)
 S VALMCNT=0
 S IBXX=""
 F  S IBXX=$O(^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,IBXX)) Q:+IBXX=0  D
 . S LINE=^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,IBXX)
 . S VALMCNT=VALMCNT+1
 . D SET^VALM10(VALMCNT,LINE,"")
 S VALMCNT=VALMCNT+1
 Q
 ;
GETSC ; Get SC and STA
 N IBD,IBI,IBX,IBY,IBSC,IBSC1,FIRST
 S FIRST=1
 I VAEL(3)=0 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="SERVICE CONNECTED : NO" Q
 S IBSC="SERVICE CONNECTED : "_$P(VAEL(3),U,2)_"%"
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)=IBSC
 I '$O(^DPT(DFN,.372,0)) S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="RATED DISABILITIES: NONE" Q
 S IBI=0 F  S IBI=$O(^DPT(DFN,.372,IBI)) Q:'IBI  D
 . S IBX=$G(^DPT(DFN,.372,IBI,0)),IBY=$G(^DIC(31,+IBX,0))
 . S IBD=$S($P(IBY,U,4)="":$P(IBY,U,1),1:$P(IBY,U,4))_" ("_$P(IBX,U,2)_"%-"_$S(+$P(IBX,U,3):"SC",1:"NSC")_")"
 . I FIRST S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="RATED DISABILITIES: "_IBD,FIRST=0 Q
 . S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="                    "_IBD
 Q
 ;
GETSTA ; Get Special Authority Eligibility
 N IBY,FIRST,FOUND,IBADT,IBARR
 S IBADT=IBST
 S FOUND=0
 S FIRST=1
 D CL^IBACV(DFN,IBADT,"",.IBARR)
 I $D(IBARR(3)) S IBY="SC TREATMENT" D GETSTA1
 I $D(IBARR(7)),+$$CVEDT^IBACV(DFN,IBADT) S IBY="COMBAT VETERAN" D GETSTA1
 I $D(IBARR(1)) S IBY="AGENT ORANGE" D GETSTA1
 I $D(IBARR(2)) S IBY="IONIZING RADIATION" D GETSTA1
 I $D(IBARR(4)) S IBY="SOUTHWEST ASIA" D GETSTA1
 I $D(IBARR(8)) S IBY="PROJECT 112/SHAD" D GETSTA1
 I $D(IBARR(5)) S IBY="MILITARY SEXUAL TRAUMA" D GETSTA1
 I $D(IBARR(6)) S IBY="HEAD/NECK CANCER" D GETSTA1
 I 'FOUND S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="SPECIAL AUTHORITY : NO" Q 
 Q
 ;
GETSTA1 ; Set in ^TMP("IBFBWE",$J)
 I FIRST S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="SPECIAL AUTHORITY : "_IBY,FIRST=0,FOUND=1 Q 
 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="                  : "_IBY
 Q
 ;
GETINS ; Get insurance information
 N EXDTCK,IBEFF,IBEXP,IBGRP,IBINSCO,IBINS0,IBINS1,IBINS7,IBSUB,IBVERBY,IBVERDT,IBX,IBINS,IBINSYES
 D ALL^IBCNS1(DFN,"IBINS")
 S (IBX,IBINSYES)=0
 I '$D(IBINS) S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="INSURANCE         : NO" Q
 F  S IBX=$O(IBINS(IBX)) Q:'IBX  D
 . S IBINS0=IBINS(IBX,0)
 . S IBINS1=IBINS(IBX,1)
 . S IBINS7=$G(IBINS(IBX,7))
 . S IBINSCO=$P(^DIC(36,+IBINS0,0),U,1)
 . S IBSUB=$P(IBINS7,U,1)
 . S IBGRP=$P(IBINS0,U,3)
 . S EXDTCK=+$P(IBINS0,U,4)
 . I EXDTCK,EXDTCK<IBST Q  ; if insurance expired before the from date of auth quit
 . S IBINSYES=1
 . S IBEFF=$$DAT1^IBOUTL($P(IBINS0,U,8))
 . S IBEXP=$$DAT1^IBOUTL($P(IBINS0,U,4))
 . S IBVERDT=$P($G(IBINS1),U,3)
 . S IBVERBY=$P($G(IBINS1),U,4)
 . I IBVERDT'="" S IBVERDT=$$FDATE^VALM1(IBVERDT)
 . I IBVERBY'="" S IBVERBY="BY "_$$GET1^DIQ(200,IBVERBY_", ",.01)
 . S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="INSURANCE         : "_IBINSCO
 . S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="   SUBSCRIBER     : "_IBSUB
 . S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="   GROUP          : "_IBGRP
 . S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="   EFF DATE       : "_IBEFF
 . S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="   EXP DATE       : "_IBEXP
 . S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="   DT LAST VERIF  : "_IBVERDT_"  "_IBVERBY
 I IBINSYES=0 S CNT=CNT+1,^TMP("IBFBWE",$J,IBNAME,DFN,IBAUTH,CNT)="INSURANCE         : NO"
 Q
 ;
REFRESH ; Special Expand Screen Refresh
 K ^TMP("IBFBWE",$J)
 D BLD
 D GETSC
 D GETSTA
 D GETINS
 D BLDEXP
 S VALMBCK="R"
 Q
 ; 
HELP ; -- help code
 N X
 S X="?" D DISP^XQORM1 W !!
 Q
 ;
EXIT ; -- exit code
 K ^TMP("IBFBWE",$J)
 D ^%ZISC
 S VALMBCK="R" Q
 Q