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

IBCF23.m

Go to the documentation of this file.
  1. IBCF23 ;ALB/ARH - HCFA 1500 19-90 DATA (block 24, procs and charges) ;12-JUN-93
  1. ;;2.0;INTEGRATED BILLING;**52,80,106,122,51,152,137,402,432,488,547,592**;21-MAR-94;Build 58
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ;requires IBIFN,IB(0),IB("U"),IB("U1"), returns # of line items in IBFLD(24)
  1. ;rev code array: IBRC("proc^division^basc flag^bedsection^rev code^unit chrg^Rx seq #")=units
  1. ;proc array: IBCP(initial print ord)=proc date^proc^division^basc flag^dx^pos^tos^modifier^unit chrg^purch chrg amt^anesthesia mins^emerg indicator
  1. ; IBCP(initial print order,seq #)=auxillary data
  1. ;proc array: IBSS("proc^division^basc flag^dx^pos^tos^modifier^unit chrg^Rx seq #")=lowest inital print order
  1. ;print order array: IBPO(final print ord,emerg indicator,initial print order)=""
  1. ;print array: IBFLD(24,I)=begin dt^end dt^pos^tos^proc^dx^unit chrg^units^modifier pointer ien(s) separated by commas^purch chrg amt^anesthesia mins^emerg indicator
  1. ; IBFLD(24,I,"AUX")=[auxillary data]
  1. ; = "AUX" node of proc entry
  1. ; IBFLD(24,I,"RX")= soft link to file 362.4 or null
  1. ; if service is Rx, but no soft link
  1. ;
  1. ;charge item link: IBLINK(CPT IFN in multiple,RCIFN) = proc^division^basc flag^bedsection^rev code^unit chrg^rx seq #
  1. ;
  1. ; dx's used in arrays are ref #s
  1. ; IB*547 added backwards compatibility so that MRAs and EOBs would still roll/split procedures the same way as when the claim
  1. ; was created. Any claim transmitted before IB*547 was installed will roll/split the original way and any new
  1. ; claim or claim transmitted after IB*547 was transmitted will roll/split the new way.
  1. ; When updating in the future care must be taken to disable/remove older code so that only new changes are
  1. ; affected by the IBNWPTCH variable.
  1. ;
  1. RVC ; charges array
  1. D RVCE(,IBIFN)
  1. Q
  1. ;
  1. RVCE(IBXIEN,IBIFN) ;Entry for EDI formatter call (IBXIEN will be defined)
  1. ; IBIFN required
  1. N IBRC,IBCP,IBSS,IBSSO,IBSS1,IBPO,IBLINK,IBLINK1,IBLINKRX,IBK,IBAUXLN
  1. ;JWS;IB*2.0*592;US131
  1. N IBI,IBJ,IB11,IBLN,IBPDT,IBCHARG,IBMOD,IBPC,IBRX,IBRXF,IBPO2A,IBAUX,IBNWPTCH,IBDEN,IBDEN1,IBDEND
  1. ;
  1. ; IB*547/TAZ - Add IBNWPTCH variable.
  1. S IBRX=0,IBNWPTCH=$$IBNWPTCH^IBCF23A(IBIFN,"IB*2.0*547")
  1. S IBI=0 F S IBI=$O(^DGCR(399,IBIFN,"RC",IBI)) Q:'IBI S IBLN=^(IBI,0) D
  1. . S IBSS="",IBPC=0 F IBJ=6,7,0,5,1,2,14 S IBPC=IBPC+1 S:IBJ $P(IBSS,U,IBPC,IBPC+1)=($P(IBLN,U,IBJ)_U)
  1. . I $P(IBSS,U,2)="" S $P(IBSS,U,2)=$P(^DGCR(399,IBIFN,0),U,22)
  1. . I +IBSS S $P(IBSS,U)=$P(IBSS,U)_";ICPT("
  1. . S $P(IBSS,U,3)=$S($D(^DGCR(399,"ASC1",+$P(IBLN,U,6),IBIFN,IBI)):1,1:"")
  1. . I +$P(IBLN,U,10)=3 D Q ; Rx
  1. .. I '$P(IBLN,U,15) S IBRX=IBRX+1,$P(IBSS,U,8)=(100+IBRX)
  1. .. I $P(IBLN,U,15) S $P(IBSS,U,8)=$P(IBLN,U,15)
  1. .. S IBRC(IBSS,"RX")=$P(IBLN,U,11)_U_IBI_U_$P(IBLN,U,15)
  1. .. S IBRC(IBSS)=$G(IBRC(IBSS))+1
  1. . ;
  1. . S IBRC(IBSS)=$G(IBRC(IBSS))+$P(IBLN,U,3) ; total units for similar RC
  1. . I "4"[+$P(IBLN,U,10),$P(IBLN,U,11) D ; Soft-link proc with the rev cd
  1. .. S IBLINK(+$P(IBLN,U,11),IBI)=IBSS
  1. .. S $P(IBLINK(+$P(IBLN,U,11),IBI),U,7)=$P(IBLN,U,14)
  1. . I $P(IBLN,U,10) D
  1. .. S IBLINK1(IBSS,IBI)=$P(IBLN,U,10)_U_+$P(IBLN,U,11)
  1. . S IBRC(IBSS,"LNK")=IBI
  1. ;
  1. S IBSSO="" F S IBSSO=$O(IBRC(IBSSO)) Q:IBSSO="" I $D(IBRC(IBSSO,"RX")) D
  1. . S IBSS=IBSSO,IBI=$P(IBRC(IBSSO,"RX"),U,2),IB11=$P(IBRC(IBSSO,"RX"),U,3)
  1. . S IBRC(IBSSO)=1,IBLINKRX($S($P(IBSSO,U)>0:$P(IBSSO,U),$P($G(^DGCR(399,IBIFN,"CP",+IB11,0)),U)'="":$P(^(0),U),1:0),+IB11,+IBRC(IBSSO,"RX"))=IBSSO K IBRC(IBSSO,"RX")
  1. ;
  1. D PRC^IBCF23A ; Extract procedures
  1. PO ; print order array w/chrgs
  1. ; combine multiple entries of same proc onto one line item via print order
  1. ;if both have print orders defined then they should not be combined onto one line item
  1. ;"proc^division^basc^dx^pos^tos^modifier(s)^unit chrg^purchased chg" must all be the same as well as the emergency indicator and all 'aux flds'
  1. N IBP,Z,IBPO11
  1. ;IB*547/TAZ - set entire node into IBSS for post IB*547 claims
  1. ;S IBPO="" F S IBPO=$O(IBCP(IBPO)) Q:'IBPO S IBCP=IBCP(IBPO),IBSS=$P(IBCP,U,2,9),IBSS1="*"_$G(IBCP(IBPO,"AUX")),IBAUX=0 D
  1. S IBPO="" F S IBPO=$O(IBCP(IBPO)) Q:'IBPO S IBCP=IBCP(IBPO),IBSS=$P(IBCP,U,2,$S(IBNWPTCH:$L(IBCP,U),1:9)),IBSS1="*"_$G(IBCP(IBPO,"AUX")),IBAUX=0 D
  1. . I $D(IBSS(IBSS)),'$D(IBCP(IBPO,"RX")),IBPO>1000 D Q ; combine lines
  1. .. I 'IBAUX S IBAUX=$$AUXOK^IBCF23A(.IBSS,IBSS1)
  1. .. S IBPO1=$S(IBAUX:IBSS(IBSS,IBAUX),1:IBPO)
  1. .. I 'IBAUX S Z=+$O(IBSS(IBSS,"A"),-1)+1,IBSS(IBSS,Z)=IBPO
  1. .. I IBPO>1000!(IBPO1>1000) S IBPO(IBPO1,+$P(IBCP,U,12),IBPO)="" D
  1. ... I $O(IBCP(IBPO,"L",0)) S Z=$O(IBCP(IBPO,"L",0)),IBPO(IBPO1,+$P(IBCP,U,12),IBPO,"L",Z)=IBCP(IBPO,"L",Z) K IBCP(IBPO,"L",Z)
  1. . S IBAUX=+$O(IBSS(IBSS,"A"),-1)+1,IBSS(IBSS,"AUX-X",IBAUX)=IBSS1
  1. . S IBSS(IBSS,IBAUX)=+IBPO,IBPO(+IBPO,+$P(IBCP,U,12),IBPO)=""
  1. . S Z=0 F S Z=$O(IBCP(IBPO,Z)) Q:'Z S IBPO(+IBPO,+$P(IBCP,U,12),IBPO,Z)=""
  1. . I $O(IBCP(IBPO,"L",0)) S Z=$O(IBCP(IBPO,"L",0)),IBPO(+IBPO,+$P(IBCP,U,12),IBPO,"L",Z)=IBCP(IBPO,"L",Z) K IBCP(IBPO,"L",Z)
  1. . S IBSS(IBSS,IBAUX,"AUX")=IBSS1,IBPO(+IBPO,+$P(IBCP,U,12),IBPO,"AUX")=$E(IBSS1,2,$L(IBSS1))
  1. . I $D(IBCP(IBPO,"RX")) S IBPO(+IBPO,+$P(IBCP,U,12),IBPO,"RX")=IBCP(IBPO,"RX"),IBSS(IBSS,IBAUX,"RX")=IBCP(IBPO)
  1. . ;JWS;IB*2.0*592;US131
  1. . I $D(IBCP(IBPO,"DEND")) S IBPO(+IBPO,+$P(IBCP,U,12),IBPO,"DEND")=IBCP(IBPO,"DEND")
  1. . I $D(IBCP(IBPO,"DEN")) S IBPO(+IBPO,+$P(IBCP,U,12),IBPO,"DEN")=IBCP(IBPO,"DEN")
  1. . I $D(IBCP(IBPO,"DEN1")) M IBPO(+IBPO,+$P(IBCP,U,12),IBPO,"DEN1")=IBCP(IBPO,"DEN1")
  1. . ;end ;JWS;IB*2.0*592;US131;
  1. ; Find any remaining rev codes w/units that ref existing procedures
  1. S IBP(0)=0
  1. F IBP=3,2 Q:$G(IBP(0)) S IBRV="" F S IBRV=$O(IBRC(IBRV)) Q:IBRV="" I IBRV,IBRC(IBRV) D
  1. . S IBSS1=$O(IBSS($P(IBRV,U,1,IBP))) Q:$P(IBRV,U,1,IBP)'=$P(IBSS1,U,1,IBP)
  1. . S IBP(0)=1,Z=0
  1. . F S Z=$O(IBSS(IBSS1,Z)) Q:'Z I $G(IBSS(IBSS1,Z)) D Q
  1. .. I $D(IBCP(IBSS(IBSS1,Z))),$P(IBCP(IBSS(IBSS1,Z)),U,9)=$P(IBSS1,U,8) D
  1. ... N Q,Q0
  1. ... ; S Q=$O(IBCP(""),-1)+1,Q0=$P(IBCP(IBSS(IBSS1,Z)),U,12) ; WCJ;IB*488
  1. ... S Q=IBSS(IBSS1,Z),Q0=$P(IBCP(IBSS(IBSS1,Z)),U,12) ; WCJ;IB*488
  1. ... ;M IBPO(Q,$P(IBCP(IBSS(IBSS1,Z)),U,12),Q)=IBPO(IBSS(IBSS1,Z),$P(IBCP(IBSS(IBSS1,Z)),U,12),IBSS(IBSS1,Z)),IBCP(Q)=IBCP(IBSS(IBSS1,Z)) ; WCJ;IB*488
  1. ... ;S $P(IBCP(Q),U,9)=$P(IBRV,U,6) ; WCJ;IB*488
  1. ... ;F Z0=1:1:(IBRC(IBRV)-1) S IBPO(Q,Q0,Q+(Z0*.01))=IBPO(Q,Q0,Q) I Z0=99,(IBRC(IBRV)'=100) S IBPO(Q,Q0,Q_".991")=(IBRC(IBRV)-1)_"^99" Q ; Only put first 99 in array
  1. ... F Z0=1:1:(IBRC(IBRV)) S IBPO(Q,Q0,Q+(Z0*.001))=IBPO(Q,Q0,Q) ; changing to .001 allows us up to 999 and the units field only allows 800. ; WCJ;IB*488
  1. ... S IBRC(IBRV)=0
  1. ;
  1. PRTARR ;print proc array
  1. S IBREV="",IBPO1="",IBI=0 F S IBPO1=$O(IBPO(IBPO1)) Q:IBPO1="" D
  1. . ;JWS;IB*2.0*592; NEED TO CLEAR IBDEN1 array
  1. . K IBRXF,IBDEN1
  1. . S IBEMG="" F S IBEMG=$O(IBPO(IBPO1,IBEMG)) Q:IBEMG=""!("01"'[IBEMG) S IBPO2="" D
  1. .. S IBDT1=99999999,IBDT2="",(IBMIN,IBUNIT)=0,(IBCHARG,IBAUX)=""
  1. .. F S IBPO2=$O(IBPO(IBPO1,IBEMG,IBPO2)) Q:IBPO2="" D
  1. ... I IBPO2#1=.991 D Q:IBPO2#1=.991
  1. .... N Z
  1. .... S Z=$G(IBPO(IBPO1,IBEMG,IBPO2)) Q:'Z
  1. .... I ($P(Z,U,2)+1)>Z Q
  1. .... S $P(IBPO(IBPO1,IBEMG,IBPO2),U,2)=($P(Z,U,2)+1),IBPO2=(IBPO2\1)_".99"
  1. ... S Z=0 F S Z=$O(IBPO(IBPO1,IBEMG,IBPO2,Z)) Q:'Z S IBUNIT=IBUNIT+1
  1. ... I $D(IBCP(IBPO1)) S IBPO11=IBPO1
  1. ... S IBPO2A=$S($D(IBCP(IBPO2\1)):IBPO2\1,'$D(IBCP(IBPO2)):IBPO11,1:IBPO2)
  1. ... S IBCHARG=$P(IBCP(IBPO2A),U,9),IBPCHG=$P(IBCP(IBPO2A),U,10)
  1. ... ; I IBCHARG<10000,IBCHARG*(IBUNIT+1)'<10000 D Q ;$9,999 limit per line ;WCJ IB*488
  1. ... I IBCHARG<10000000,IBCHARG*(IBUNIT+1)'<10000000 D Q ; increased to $9,999,999 charge limit per line since that is printed form space limit ;WCJ IB*488
  1. .... N Z S Z=$O(IBPO(IBPO1\1+1),-1),Z=Z+$S(IBPO1+.001'=Z:.001,1:0) M IBPO(Z,IBEMG,IBPO2)=IBPO(IBPO1,IBEMG,IBPO2) K IBPO(IBPO1,IBEMG,IBPO2)
  1. ... S IBUNIT=IBUNIT+1,IBSS=IBCP(IBPO2A),IBMIN=IBMIN+$P(IBSS,U,11)
  1. ... S IBSS=$G(IBSS)_U_$G(IBCP(IBPO2A,"LNK"))
  1. ... S Z=$O(IBPO(IBPO1,IBEMG,IBPO2,"L",0)) I Z D
  1. .... S Z0=0
  1. .... F Z=Z:1 Q:'$O(IBPO(IBPO1,IBEMG,IBPO2,"L",0))!(Z0=IBUNIT) I $D(IBPO(IBPO1,IBEMG,IBPO2,"L",Z)) S IBSS("L",Z)=IBPO(IBPO1,IBEMG,IBPO2,"L",Z),Z0=Z0+1 K IBPO(IBPO1,IBEMG,IBPO2,"L",Z)
  1. ... S:IBDT1>+IBSS IBDT1=+IBSS S:IBDT2<+IBSS IBDT2=+IBSS
  1. .. S IBAUX=$G(IBCP(IBPO1,"AUX")) S:$D(IBCP(IBPO1,"RX")) IBRXF=IBCP(IBPO1,"RX")
  1. .. ;JWS;IB*2.0*592;US131
  1. .. S IBDEN=$G(IBCP(IBPO1,"DEN"))
  1. .. S IBDEND=$G(IBCP(IBPO1,"DEND"))
  1. .. I $D(IBCP(IBPO1,"DEN1")) M IBDEN1=IBCP(IBPO1,"DEN1")
  1. .. ;end ;JWS;IB*2.0*592;US131
  1. .. I IBUNIT D B24^IBCF23A
  1. .. K IBRXF
  1. ;
  1. ;print any chrgs not associated with a proc (ie. not enough procs or proc not in "CP" level)
  1. S IBRV="" F S IBRV=$O(IBRC(IBRV)) Q:IBRV="" I +IBRC(IBRV) D D B24^IBCF23A K IBRXF
  1. . S IBUNIT=+IBRC(IBRV),IBCHARG=$P(IBRV,U,6),IBDT1=+IB("U"),IBDT2=$P(IB("U"),U,2),IBREV=$P(IBRV,U,5),IBEMG=0,IBAUX=""
  1. . S IBSS="^"_$S(+IBRV:$P(IBRV,U),1:$P($G(^DGCR(399.1,+$P(IBRV,U,4),0)),U))
  1. . S IBSS=$G(IBSS)_U_$$RC2CP^IBCEF22(IBIFN,+$G(IBRC(IBRV,"LNK")))
  1. . S Z=$O(IBLINK1(IBRV,0)) I Z D
  1. .. S Z0=0
  1. .. F Z=Z:1 Q:'$O(IBLINK1(IBRV,0))!(Z0=IBUNIT) I $D(IBLINK1(IBRV,Z)) S IBSS("L",Z)=IBLINK1(IBRV,Z),Z0=Z0+1 K IBLINK1(IBRV,Z)
  1. ;
  1. OFFSET ;
  1. S IBFLD(24)=IBI ;line item count
  1. K IBRC,IBCP,IBSS,IBPO,IBPO1,IBPO2,IBLN,IBRV,IBRV1,IBPDT,IBDT1,IBDT2,IBCHARG,IBMIN,IBUNIT,IBREV,IBLINK,IBLINK1,IBEMG,IBPCHG,Z
  1. Q
  1. ;
  1. DATE(X) ; Fm dt in X ==> YYYYMMDD
  1. Q $$DT^IBCEFG1(X,,"D8")
  1. ;
  1. B24 ; Moved to IBCF23A for space
  1. D B24^IBCF23A
  1. Q
  1. ;