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

IBTOUR1.m

Go to the documentation of this file.
  1. IBTOUR1 ;ALB/AAS - CLAIMS TRACKING UR/ACTIVITY REPORT ; 27-OCT-93
  1. ;;Version 2.0 ; INTEGRATED BILLING ;**56**; 21-MAR-94
  1. ;
  1. % ;
  1. ; ibcnt(1) = total count of admissions
  1. ; ibcnt(1,1) = total count of admissions to nhcu
  1. ; ibcnt(1,2) = total count of admissions to domiciliary
  1. ; ibcnt(2) = total count of insured admissions
  1. ; ibcnt(3,0) = total count of billable admissions
  1. ; ibcnt(3,n) = count of non-billable admissions by reason (n)
  1. ; ibcnt(4) = count of admissions requiring reviews
  1. ; ibcnt(5) = admissions with pre-cert and follow-up
  1. ; ibcnt(6) = no pre-cert but active monitoring required
  1. ; ibcnt(7) = new closed cases = discharged, or no next rev. date, or ur not required
  1. ; ibcnt(7,0) = new cases closed, billable
  1. ; ibcnt(7,1) = new cases closed, not billable
  1. ; ibcnt(8) = new cases open (not closed)
  1. ;
  1. ; ibcnt(9) = previous case (find in REV), adm prior to begin date
  1. ; ibcnt(9,0) = cases closed billable
  1. ; ibcnt(9,1) = cases closed non-billable
  1. ; ibcnt(9,2) = previous cases still open
  1. ;
  1. ; ^tmp($j,"ibtour", $s(pt. name/specialty/review date) ,pt. name,sort3,ibtrc)=^ibt(ibtrc,0)
  1. ; ^tmp($j,"ibtour1",specialty)=days approved, days denied, $approved, $denied)
  1. ;
  1. BLD ; -- build data
  1. ;initialize summary array
  1. F I=1:1:11 S IBCNT(I)=0 I I=7!(I=9) F J=0:1:2 S IBCNT(I,J)=0
  1. F I=40:1:52 S IBCNT(I)=0 I I=45 F J=1:1:3 S IBCNT(I,J)=0
  1. ;
  1. D ADM
  1. D:IBSORT'="H" IREV^IBTOUR2,ISUB
  1. D:IBSORT'="I" HREV^IBTOUR2,HSUB^IBTOUR5
  1. Q
  1. ;
  1. ADM ; -- count admission
  1. D CHK^IBTOSUM2 I $G(ZTSTOP) Q
  1. S IBDT=IBBDT-.000000001
  1. F S IBDT=$O(^DGPM("AMV1",IBDT)) Q:'IBDT!(IBDT>(IBEDT+.24)) D
  1. .S DFN=0 F S DFN=$O(^DGPM("AMV1",IBDT,DFN)) Q:'DFN D
  1. ..S DGPM=0 F S DGPM=$O(^DGPM("AMV1",IBDT,DFN,DGPM)) Q:'DGPM D
  1. ...S IBCNT(1)=IBCNT(1)+1 ; count of admissions
  1. ...I $P($G(^DIC(42,+$P(^DGPM(DGPM,0),"^",6),0)),"^",3)="NH" S IBCNT(1,1)=$G(IBCNT(1,1))+1 ; count nhcu admissions
  1. ...I $P($G(^DIC(42,+$P(^DGPM(DGPM,0),"^",6),0)),"^",3)="D" S IBCNT(1,2)=$G(IBCNT(1,2))+1 ; count domiciliary admissions
  1. ...S IBTRN=$O(^IBT(356,"AD",DGPM,0))
  1. ...Q:'IBTRN
  1. ...S IBTRND=$G(^IBT(356,+IBTRN,0))
  1. ...Q:'$P(IBTRND,"^",20)
  1. ...S X=$P($G(^IBT(356,+IBTRN,1)),"^",7) I X>3 S IBCNT(4)=IBCNT(4)+1,^TMP($J,"IBTOUR0",IBTRN)=IBTRN ;reviews required
  1. ...I X="",$P(IBTRND,"^",24),'$P(IBTRND,"^",19) S IBCNT(4)=IBCNT(4)+1,^TMP($J,"IBTOUR0",IBTRN)=IBTRN
  1. ...;
  1. ...S IBINS=$$INSURED^IBCNS1(DFN,IBDT) I IBINS S IBCNT(2)=IBCNT(2)+1 ; count of insured admissions
  1. ...I IBINS S IBCNT(3,+$P(IBTRND,"^",19))=$G(IBCNT(3,+$P(IBTRND,"^",19)))+1 ;count of NOT Billable by reason billable
  1. Q
  1. ;
  1. ISUB ; -- count subtotals for cases reviewed
  1. N IBTRN,IBCLOS,DGPM,IBTPREV
  1. S IBTRN="" F S IBTRN=$O(^TMP($J,"IBTOUR0",IBTRN)) Q:'IBTRN D
  1. .S IBTRND=$G(^IBT(356,+IBTRN,0))
  1. .Q:'$P(IBTRND,"^",20) ;inactive case
  1. .Q:$P(IBTRND,"^",8) ;rx fill, don't count
  1. .S DGPM=$P($G(^IBT(356,+IBTRN,0)),"^",5)
  1. .S IBCLOS=$$CLOSED(DGPM,IBTRN)
  1. .S IBTPREV=0 I $P($G(^IBT(356,+IBTRN,0)),"^",6)<IBBDT S IBTPREV=1
  1. .I $P(IBTRND,"^",4) S IBCNT(10)=IBCNT(10)+1
  1. .D CASE
  1. .Q
  1. Q
  1. ;
  1. CASE ; -- figure out case summary
  1. N I,J,IBPRE,IBFOL
  1. I IBTPREV D PREV
  1. S (IBFOL,IBPRE)=0
  1. I $O(^IBT(356.2,"APRE",IBTRN))'="" S IBPRE=1 ; is precert number
  1. S IBPCODE=$O(^IBE(356.11,"ACODE",10,0)) ; precert tracking type
  1. S IBCCODE=$O(^IBE(356.11,"ACODE",30,0)) ; cont. stay tracking type
  1. ;
  1. I 'IBPRE S IBTRC=$O(^IBT(356.2,"ATRTP",IBTRN,IBPCODE,0)) I IBTRC,$P($G(^IBT(356.2,+IBTRC,0)),"^",19)=10 S IBPRE=1
  1. ;
  1. S IBX=$P($G(^IBT(356,+IBTRN,1)),"^",7) I 'IBX D
  1. .I $O(^IBT(356.2,"ATRTP",IBTRN,IBCCODE,0)) S IBFOL=1
  1. .I IBPRE,IBFOL S IBCNT(5)=IBCNT(5)+1 ; adm with precert and follow up
  1. .I 'IBPRE,IBFOL S IBCNT(6)=IBCNT(6)+1 ; adm w/o precert but cont. monitor
  1. I IBX>4 S IBCNT(5)=IBCNT(5)+1
  1. I IBX=4 S IBCNT(6)=IBCNT(6)=1
  1. ;
  1. I IBCLOS S IBCNT(7,$S($P(IBTRND,"^",19):1,1:0))=IBCNT(7,$S($P(IBTRND,"^",19):1,1:0))+1,IBCNT(7)=IBCNT(7)+1
  1. ;
  1. I 'IBTPREV S IBX=$P($G(^IBT(356,+IBTRN,1)),"^",7) I IBX,IBX<4 S IBCNT(4)=IBCNT(4)+1 ; new case rev not required, but done.
  1. ;
  1. I 'IBCLOS,'IBTPREV S IBCNT(8)=IBCNT(8)+1 ;new cases still open
  1. I '$P(IBTRND,"^",5),$P(^IBE(356.6,+$P(IBTRND,"^",18),0),"^",8)=5 S IBCNT(11)=IBCNT(11)+1
  1. CASEQ Q
  1. ;
  1. CLOSED(DGPM,IBTRN) ; -- is case closed
  1. N IBI,IBJ,IBCLOSE
  1. S IBCLOSE=0
  1. I $P($G(^DGPM(+DGPM,0)),"^",17) S IBCLOSE=1 G CLOSEDQ ; - discharged
  1. I '$P($G(^IBT(356,+IBTRN,0)),"^",24) S IBCLOSE=1 G CLOSEDQ ; ur no longer required
  1. ;
  1. ; -- see if any reviews are still pending
  1. S IBCLOSE=1,IBI=0 F S IBI=$O(^IBT(356.2,"C",+IBTRN,IBI)) Q:'IBI I $P(^IBT(356.2,IBI,0),"^",24)>IBEDT S IBCLOSE=0 Q
  1. ;
  1. CLOSEDQ Q IBCLOSE
  1. ;
  1. PREV ; -- previous case
  1. Q:'$G(IBTPREV)
  1. I $P(IBTRND,"^",4)!($P(IBTRND,"^",8))!($P(IBTRND,"^",9)) Q ; only count previous admissions
  1. S IBCNT(9)=IBCNT(9)+1 ; number of previous cases
  1. I 'IBCLOS S IBCNT(9,2)=IBCNT(9,2)+1 ; still open
  1. I IBCLOS S IBCNT(9,$S($P(IBTRND,"^",19):1,1:0))=IBCNT(9,$S($P(IBTRND,"^",19):1,1:0))+1 ;closed and billable or not
  1. Q