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

IBAECO.m

Go to the documentation of this file.
  1. IBAECO ;ALB/BGA - LONG TERM CARE OUTPATIENT TRACKER ;16-OCT-01
  1. ;;2.0;INTEGRATED BILLING;**164,171,176,188,312,454**;21-MAR-94;Build 4
  1. ;;Per VHA DIRECTIVE 10-93-142, this routine should not be modified.
  1. ;
  1. ; Comment- This routine is invoked via the appointment driver ^IBAMTS
  1. ; This program checks for check outs and determines if
  1. ; the person checking out is ELIGIBLE for Long Term Care
  1. ; and determines if the encounter was related to LTC.
  1. ; If the episode of care is related to LTC and the patient
  1. ; is eligible to receive care and is compliant with all
  1. ; the LTC business rules than the entry is added to
  1. ; the LTC transaction file #351.8.
  1. ;
  1. ; Determine if this encounter has a status of checked out
  1. EN N IBEVT,IBEV0,DFN,IBSDHDL,IBORG,IBOE,IBLTCST,IBCL,IBDT,IBST,IBM
  1. N IBSWINFO S IBSWINFO=$$SWSTAT^IBBAPI() ;IB*2.0*312
  1. S IBSDHDL=0
  1. ;
  1. ; === ON/OFF Switch by date if before 11/15/06 software will not run
  1. ; === IBALTC=0 the Encounter is not LTC Billable pass to MT Module
  1. ; === IBALTC=1 Encounter is LTC Billable do NOT Pass to MTC
  1. ;
  1. S IBALTC=0
  1. ;I DT<$$STDATE^IBAECU1() Q ;quit if today<effective date
  1. F S IBSDHDL=$O(^TMP("SDEVT",$J,IBSDHDL)) Q:'IBSDHDL D
  1. . S IBORG=0 F S IBORG=$O(^TMP("SDEVT",$J,IBSDHDL,IBORG)) Q:'IBORG D
  1. . . S IBOE=0 F S IBOE=$O(^TMP("SDEVT",$J,IBSDHDL,IBORG,"SDOE",IBOE)) Q:'IBOE S IBEVT=$G(^(IBOE,0,"AFTER")),IBEV0=$G(^("BEFORE")) D
  1. . . . ;
  1. . . . Q:$P(IBEVT,U,6) ; do not evaluate sibling encounters
  1. . . . Q:$P(IBEVT,U,12)=8 ; do not evaluate inpatient encounters
  1. . . . ;
  1. . . . ; set variables
  1. . . . S DFN=$P(IBEVT,U,2),IBDT=$S(+IBEVT:+IBEVT,1:+IBEV0),IBST=$P(IBEVT,U,3)
  1. . . . Q:IBDT<$$STDATE^IBAECU1
  1. . . . Q:'DFN!('IBDT)
  1. . . . ;
  1. . . . ; Do NOT PROCESS on VistA if IBDT>=Switch Eff Date ;CCR-930
  1. . . . I +IBSWINFO,(IBDT+1)>$P(IBSWINFO,"^",2) Q ;IB*2.0*312
  1. . . . ;
  1. . . . ; stop code preset and LTC event?
  1. . . . I 'IBST Q
  1. . . . I '$$LTCSTOP^IBAECU(IBST) Q
  1. . . . ;
  1. . . . ; set flag to stop MT billing
  1. . . . S IBALTC=1
  1. . . . ;
  1. . . . ; LTC patient check
  1. . . . S IBLTCST=+$$LTCST^IBAECU(DFN,IBDT\1,1)
  1. . . . ;
  1. . . . ; are they exempt from non-institutional LTC because of CD status?
  1. . . . I $$CDEXMPT^IBAECU(DFN,IBDT\1) Q
  1. . . . ;
  1. . . . ; no 1010EC on file
  1. . . . I IBLTCST=0 D D XMNOEC^IBAECU(DFN,.IBDT,.IBM) Q
  1. . . . . S IBM(1)="",IBM(2)=" Event Type: Outpatient Encounter"
  1. . . . . S IBM(3)="",IBM(4)="Event Action: "_$S($P(IBEV0,"^",12)'=2&($P(IBEVT,"^",12)=2):"Checked Out",IBEVT&(IBEV0):"Edited",IBEV0:"Deleted",1:"Added")
  1. . . . . S IBM(5)="",IBM(6)=" Location: "_$S($P(IBEVT,"^",4):$P($G(^SC(+$P(IBEVT,"^",4),0)),"^"),$P(IBEVO,"^",4):$P($G(^SC(+$P(IBEVO,"^",4),0)),"^"),1:"")
  1. . . . ;
  1. . . . ; is this a back billing issue, if so, send message and quit
  1. . . . I $$LASTMJ^IBAECU()>0,$$LASTMJ^IBAECU()>IBDT D D XMBACK^IBAECU(DFN,.IBM) Q
  1. . . . . S IBM(1)="An Outpatient Encounter was "_$S(IBEVT&(IBEV0):"Edited",IBEV0:"Deleted",1:"Added")_"."
  1. . . . . S IBM(2)="This may result in a Back Billing issue for LTC. You should review the"
  1. . . . . S IBM(3)="patient's records for "_$$FMTE^XLFDT(IBDT)_" to ensure correct billing."
  1. . . . . S IBM(4)="LTC Billing Clock and LTC charges may have to be manually adjusted."
  1. . . . ;
  1. . . . ; add LTC clock/update last event date (if not LTC exempt)
  1. . . . I IBLTCST=2 S IBCL=$$CLOCK^IBAECU(DFN,IBDT\1)
  1. . . . ;
  1. ;
  1. Q
  1. ;
  1. CALC ; used to calculate the outpatient charge
  1. ; variables needed DFN, IBLTCST, IBCHG, IBFR
  1. ; this will adjust IBCHG so the patient is not above their calculated
  1. ; copay cap for the month.
  1. N IBTYP,IBT
  1. ;
  1. ; find all LTC charges and set flag to determine inpt or opt
  1. ; cap to be used.
  1. D TOT^IBAECU
  1. ;
  1. W !!," Calculated Monthly Copay Cap Type to be used: ",$S(IBTYP="I":"IN",1:"OUT"),"PATIENT"
  1. W !," Calculated Monthly Copay Cap is: $ ",$FN($P(IBLTCST,"^",$S(IBTYP="I":3,1:5)),",",2)
  1. W !," Total previously billed: $ ",$FN(IBT,",",2)
  1. ;
  1. I IBCHG+IBT>$P(IBLTCST,"^",$S(IBTYP="I":3,1:5)) S IBCHG=$P(IBLTCST,"^",$S(IBTYP="I":3,1:5))-IBT
  1. ;
  1. ; check for negative $ amount cap
  1. I $P(IBLTCST,"^",$S(IBTYP="I":3,1:5))<0 S IBCHG=0
  1. ;
  1. Q