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

IBATEO.m

Go to the documentation of this file.
  1. IBATEO ;ALB/BGA - TRANSFER PRICING OUTPATIENT TRACKER ; 19-MAR-99
  1. ;;2.0;INTEGRATED BILLING;**115**;21-MAR-94
  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 a Transfer Pricing Patient
  1. ; if TP the routine prices the procedures and files the
  1. ; transaction in 351.61
  1. ;
  1. ; Determine if this encounter has a status of checked out
  1. N IBORG,IBOE,IBEVT,IBEV0,IBERR,IB,IBI,IBDATE,IBRATE,IBPREF,IBPROC
  1. N IBERR,IBQTY,IBATFILE,IBSDHDL,IBPROC,IBSOURCE,IBATIEN,IBOIEN,IBERR2
  1. I '$P($G(^IBE(350.9,1,10)),"^",3) Q ; transfer pricing turned off
  1. S IBSDHDL=0,U="^" 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. . . . Q:$P(IBEVT,U,6) ; do not evaluate sibling encounters
  1. . . . Q:$P(IBEVT,U,12)=8 ; do not evaluate inpatient encounters
  1. . . . ; Check encounter is checked out and is not being tracked in 351.61
  1. . . . ; === NEW Entry
  1. . . . I IBEVT]" ",('$D(^IBAT(351.61,"AD",(IBOE_";SCE(")))),$P(IBEVT,U,12)=2,$$TPP^IBATUTL($P(IBEVT,U,2)) D Q
  1. . . . . K IBPROC,IBERR D IBPRICE(IBOE,IBEVT,.IBPROC,.IBERR)
  1. . . . . Q:$P(IBERR,U)
  1. . . . . ; Pass in (dfn,event date,facility,ibsource,procedure array)
  1. . . . . S IBATFILE=$$OUT^IBATFILE($P(IBEVT,U,2),IBDATE,IBPREF,IBSOURCE,.IBPROC)
  1. . . . . ; Encounter has status of checked out and has an entry in 351.61
  1. . . . . ; and the Encounter has been updated.
  1. . . . I IBEVT]" ",$D(^IBAT(351.61,"AD",(IBOE_";SCE("))),$P(IBEVT,U,12)=2 D Q
  1. . . . . S IBSOURCE=IBOE_";SCE("
  1. . . . . S IBATIEN=$O(^IBAT(351.61,"AD",IBSOURCE,""))
  1. . . . . K IBPROC,IBERR D IBPRICE(IBOE,IBEVT,.IBPROC,.IBERR)
  1. . . . . Q:$P(IBERR,U)
  1. . . . . S IBATFILE=$$UPDATE^IBATFILE(IBATIEN,.IBPROC)
  1. . . . I IBEVT]" ",$D(^IBAT(351.61,"AD",(IBOE_";SCE("))),$P(IBEVT,U,12)'=2 D Q
  1. . . . . I $P(IBEV0,U,12)=2 D Q
  1. . . . . . ; This is the case where I have a check out that has been deleted
  1. . . . . . ; "BEFORE" has a status of checked out the "AFTER" has a status
  1. . . . . . ; of not check out and shows no date for check out process date
  1. . . . . . S IBSOURCE=IBOE_";SCE("
  1. . . . . . S IBATIEN=$O(^IBAT(351.61,"AD",IBSOURCE,""))
  1. . . . . . D CANC^IBATFILE(IBATIEN)
  1. Q
  1. IBPRICE(IBOIEN,IBEVT,IBPROC,IBERR) ;
  1. S IBERR=0
  1. I $G(IBOIEN)<1!($G(IBEVT)<1) S IBERR=1 Q
  1. I '$$TPP^IBATUTL($P(IBEVT,U,2)) S IBERR="1^Not currently a TP patient" Q ; determine if transfer pricing patient
  1. S IBPREF=$$PPF^IBATUTL($P(IBEVT,U,2)) I 'IBPREF S IBERR="1^No pref. facility found" Q
  1. K IB,IBERR2 D GETCPT^SDOE(IBOE,"IB","IBERR2")
  1. I $D(IBERR2) S IBERR="1^No procedures could be found for IBOE="_IBOIEN Q
  1. S IBDATE=$P($P(IBEVT,U),".") I 'IBDATE S IBERR="1^No event date found for IBOE="_IBOIEN Q
  1. S IBSOURCE=IBOE_";SCE("
  1. K IBPROC S IBI=0 F S IBI=$O(IB(IBI)) Q:'IBI D
  1. . S IBRATE=$$OPT^IBATCM($P(IB(IBI),U),IBDATE,IBPREF)
  1. . I '$P(IBRATE,U)!($P(IBRATE,U,4)<1) Q ; could not price the procedure
  1. . S IBRATE=$P(IBRATE,U,4),IBQTY=$P(IB(IBI),U,16)
  1. . S IBPROC($P(IB(IBI),U))=IBQTY_U_IBRATE
  1. I '$D(IBPROC) S IBERR="1^Could not find any procedures for IBOE="_IBOIEN
  1. Q