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

IBAECI.m

Go to the documentation of this file.
  1. IBAECI ;ALB/BGA-LONG TERM CARE INPATIENT TRACKER ; 09-OCT-01
  1. ;;2.0;INTEGRATED BILLING;**164,171,176,198,188**;21-MAR-94
  1. ;; Per VHA Directive 10-93-142, this routine should not be modified
  1. ;
  1. ; This routine is called from ^IBAMTD and tracks all patient movements
  1. ; that are related to Long Term Care (LTC). If the Episode of care is
  1. ; related to LTC the episode of care is stored in ^IBA(351.8 and will
  1. ; be further screen when the Monthly Job is run and than Priced.
  1. ;
  1. ;
  1. EN ; Main Entry Point
  1. ;
  1. ; === When IBALTC=0 episode not LTC billable so passed to MTC Module
  1. ; IBALTC=1 episode is LTC Billable do NOT passed to MTC Module
  1. ;
  1. S IBALTC=0
  1. I $G(DGPMA)="",$G(DGPMP)="" Q
  1. I DT<$$STDATE^IBAECU1() Q ;quit if today<effective date
  1. N IBCL,IBDT,IBDTA,IBLTCST,IBT,IBTS,IBX,IBY,IBZ,IBM,IBV,IBE
  1. ;
  1. S IBV=$S($L($G(DGPMP)):"DGPMP",1:"DGPMA") D:+$G(@IBV)>0
  1. . N IBDT S IBDT=+$G(@IBV)\1
  1. . N VAIP S VAIP("D")=IBDT_.2359 D IN5^VADPT I $P($$TREATSP^IBAECU2($P($G(^DIC(45.7,+VAIP(8),0)),U,2)),"^",1)="L" D BACKBIL Q
  1. . I +$G(VAIP(1))>0 S VAIP(1)=$$ORIGADM^IBAECN1(VAIP(1)) I $$ISLTC4DT^IBAECN1(DFN,+$G(VAIP(1)),IBDT_.2359)=1 D BACKBIL
  1. ; is this related to LTC
  1. S IBX=0 F S IBX=$O(^UTILITY("DGPM",$J,6,IBX)) Q:IBX<1 F IBY="A","P" S IBTS=$P($G(^UTILITY("DGPM",$J,6,IBX,IBY)),"^",9) I IBTS,$$LTCSPEC^IBAECU(+$$FACSPEC^IBAECU(IBTS)) S IBALTC=1
  1. I IBALTC=0 I $D(^UTILITY("DGPM",$J,3)) D
  1. . N VAIN,VAINDT S VAINDT=+$G(@IBV)\1 D INP^VADPT I $P($$TREATSP^IBAECU2($P($G(^DIC(45.7,+VAIN(3),0)),U,2)),"^",1)="L" S IBALTC=1
  1. I 'IBALTC Q
  1. ;
  1. ; get the earliest date of care for this movement
  1. S IBDT=+DGPMA
  1. I DGPMP,(DGPMP<DGPMA!('IBDT)) S IBDT=+DGPMP S IBT=0 F S IBT=$O(^UTILITY($J,IBT)) Q:IBT<1 S IBX=DGPMDA-1 F S IBX=$O(^UTILITY($J,IBT,IBX)) Q:IBX<1 F IBZ="A","P" S IBDTA=+$G(^UTILITY($J,IBT,IBX,IBZ)) I IBDTA<IBDT S IBDT=IBDTA
  1. ;
  1. ; look up this patient's LTC status
  1. S IBLTCST=+$$LTCST^IBAECU(DFN,IBDT\1,1)
  1. ;
  1. ; are they exempt from LTC care?
  1. I IBLTCST=1 S IBALTC=1 Q
  1. ;
  1. ; no 1010EC send message and quit
  1. I IBLTCST=0 D D XMNOEC^IBAECU(DFN,IBDT,.IBE) Q
  1. . S IBV=$S($L($G(DGPMP)):"DGPMP",1:"DGPMA")
  1. . S IBE(1)="",IBE(2)=" Event Type: Inpatient Movement "_$S(IBV="DGPMP"&($G(DGPMA)):"Edited",IBV="DGPMP":"Deleted",1:"Added")
  1. . S IBE(3)="",IBE(4)="Event Action: "_$S($P(@IBV,"^",2)=1:"Admission",$P(@IBV,"^",2)=2:"Transfer",$P(@IBV,"^",2)=3:"Discharge",$P(@IBV,"^",2)=6:"Specialty Change",1:"")
  1. . S IBE(5)="",IBE(6)=" Location: " D
  1. . . I $P(@IBV,"^",6) S IBE(6)=IBE(6)_$P($G(^DIC(42,+$P(@IBV,"^",6),0)),"^") Q
  1. . . I $P(@IBV,"^",14),$P($G(^UTILITY("DGPM",$J,1,$P(@IBV,"^",14),"A")),"^",6) S IBE(6)=IBE(6)_$P($G(^DIC(42,+$P(^("A"),"^",6),0)),"^") Q
  1. . . I $P(@IBV,"^",14),$P($G(^UTILITY("DGPM",$J,1,$P(@IBV,"^",14),"P")),"^",6) S IBE(6)=IBE(6)_$P($G(^DIC(42,+$P(^("P"),"^",6),0)),"^")
  1. . . I $P(@IBV,"^",14),$P($G(^DGPM(+$P(@IBV,"^",14),0)),"^",6) S IBE(6)=IBE(6)_$P($G(^DIC(42,+$P(^(0),"^",6),0)),"^") Q
  1. . . S IBE(6)=IBE(6)_"Unknown"
  1. ;
  1. D BACKBIL
  1. ;
  1. ; flag LTC for current events
  1. S IBCL=$$CLOCK^IBAECU(DFN,$S(IBDT<$$STDATE^IBAECU1:$$STDATE^IBAECU1,1:IBDT\1))
  1. ;
  1. Q
  1. ;
  1. BACKBIL ;called from EN
  1. ; back billing issue? send message and quit
  1. S IBV=$S($L($G(DGPMP)):"DGPMP",1:"DGPMA")
  1. I $$LASTMJ^IBAECU()>0,$E(IBDT,1,5)<$E($$LASTMJ^IBAECU(),1,5) D D XMBACK^IBAECU(DFN,.IBM) Q
  1. . S IBM(1)="A(n) Added." I $D(IBV),$D(@IBV) D
  1. . . S IBM(1)="A(n) "_$S($P(@IBV,"^",2)=1:"Admission",$P(@IBV,"^",2)=2:"Transfer",$P(@IBV,"^",2)=3:"Discharge",$P(@IBV,"^",2)=6:"Specialty Change",1:"")_" was "_$S(IBV="DGPMP"&($G(DGPMA)):"Edited",IBV="DGPMP":"Deleted",1:"Added")_"."
  1. . S IBM(2)=" ",IBM(3)="This may result in a Back Billing issue for LTC. You should review the"
  1. . S IBM(4)="patient's records for "_$$FMTE^XLFDT(IBDT)_" to ensure correct billing."
  1. . S IBM(5)="LTC Billing Clock and LTC charges may have to be manually adjusted."
  1. Q
  1. ;
  1. CALC ; tag for completion of manual adding of inpt charges
  1. ; requires DFN, IBCHG, IBEVDA, IBTO
  1. ;
  1. N IBT,IBTYP,IBLOS,IBZ
  1. ;
  1. ; get the LOS
  1. S IBZ=^IB(+IBEVDA,0),IBLOS=$$LOS^IBCU64($S($$BILDATE^IBAECN1>$P(IBZ,"^",17):$$BILDATE^IBAECN1,1:$P(IBZ,"^",17)),$$LASTDT^IBAECU(IBTO),2,$P($P(IBZ,"^",4),":",2))
  1. ;
  1. ; update the status
  1. S IBLTCST=$$LTCST^IBAECU(DFN,IBTO,IBLOS) I IBLTCST<2 W !!," This patient is not LTC billable on the date." S IBY=-1 Q
  1. ;
  1. ; find the total amount already billed for mo
  1. D TOT^IBAECU
  1. ;
  1. W !!," Calculated Monthly Copay Cap Type to be used: INPATIENT ",$S(IBLOS<181:"< 181",1:"> 180")," days."
  1. W !," Calculated Monthly Copay Cap is: $ ",$FN($P(IBLTCST,"^",$S(IBLOS<181:3,1:4)),",",2)
  1. W !," Total previously billed: $ ",$FN(IBT,",",2)
  1. ;
  1. I IBCHG+IBT>$P(IBLTCST,"^",$S(IBLOS<181:3,1:4)) S IBCHG=$P(IBLTCST,"^",$S(IBLOS<181:3,1:4))-IBT
  1. ;
  1. ; check for negative $ amount cap
  1. I $P(IBLTCST,"^",$S(IBLOS<181:3,1:4))<0 S IBCHG=0
  1. ;
  1. Q