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

IBTOSUM.m

Go to the documentation of this file.
  1. IBTOSUM ;ALB/AAS - CLAIMS TRACKING BILLING INFORMATION PRINT ; 29-OCT-93
  1. ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94
  1. ;
  1. % I '$D(DT) D DT^DICRW
  1. W !!,"MCCR/UR Summary Report",!!
  1. S IBQUIT=0
  1. ;
  1. ; -- print either by admissions or discharges
  1. SORT ; -- ask how they want it sorted
  1. N DIR
  1. S DIR(0)="SOBA^A:Admissions;D:Discharges"
  1. S DIR("A")="Print Report By [A]dmissions [D]ischarges: "
  1. S DIR("B")="D"
  1. S DIR("?",1)="This summary report may be prepared by either Admissions or Discharges."
  1. S DIR("?",2)="If you choose by discharge the report will contain information on all"
  1. S DIR("?",3)="claims tracking information for the discharges that fall in the date"
  1. S DIR("?",4)="Range. That is, all reviews for discharges found in the date range"
  1. S DIR("?",5)="will be included in the report. If you choose by Admissions all"
  1. S DIR("?",6)="reviews found in the date range will be included but the reviews"
  1. S DIR("?",7)="may be for cases not related to the admissions."
  1. S DIR("?",8)=" "
  1. S DIR("?")="If you want to know the total reviews done during a date range sort by admissions. If you want to know the total reviews done on the discharges for a date range sort by Discharges"
  1. D ^DIR K DIR
  1. S IBSORT=Y I "AD"'[Y!($D(DIRUT)) G END
  1. ;
  1. ; -- get date range
  1. W ! D DATE^IBOUTL
  1. I IBBDT=""!(IBEDT="") G END
  1. ;
  1. DEV ; -- select device, run option
  1. W ! S %ZIS="QM" D ^%ZIS G:POP END
  1. I $D(IO("Q")) S ZTRTN="RPT^IBTOSUM",ZTSAVE("IB*")="",ZTDESC="IB - MCCR/UR Summary Report" D ^%ZTLOAD K IO("Q"),ZTSK D HOME^%ZIS G END
  1. U IO
  1. ;
  1. RPT ; -- entry point from task man
  1. ; store data in ^tmp($j,"IBTOSUM",N)
  1. K ^TMP($J)
  1. S IBQUIT=0,IBPAG=0,Y=DT D D^DIQ S IBHDT=Y
  1. F I=0:1:13 S IBCNT(I)=0
  1. F I=20,21,80,81,82,99 S IBCNT(I)=0
  1. F I=0:1:4 S IBCNT(30+I)=0
  1. I IBSORT="A" D ADM
  1. I IBSORT="D" D DIS
  1. D CHK^IBTOSUM2
  1. I $G(ZTSTOP) G END
  1. ;
  1. D PRINT^IBTOSUM2
  1. ;
  1. END ; -- Clean up
  1. W !
  1. I $D(IBCNT(1)),$E(IOST,1,2)="C-" D PAUSE^VALM1
  1. K ^TMP($J)
  1. I $D(ZTQUEUED) S ZTREQ="@" Q
  1. D ^%ZISC
  1. K X,X1,X2,X3,Y,%ZIS,POP,DA,DIRUT,DUOUT,IBRATE,IBBBS,IBSORT,IBC,IBPCNT,IBDCNT,IBMAX,IBCDT
  1. K IBDT,IBBDT,IBEDT,IBQUIT,IBPAG,IBHDT,IBCNT,IBSPEC,IBINS,IBAC,IBPEN,IBPEND,IBTRN,IBTRND,IBTRC,IBTRCD,DFN,DGPM,IBNOD,IBDAY,IBFAC,IBSITE,IBSNM,X,Y,I,J
  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 DA=0 F S DA=$O(^DGPM("AMV1",IBDT,DFN,DA)) Q:'DA D PROC
  1. ..Q
  1. .Q
  1. Q
  1. ;
  1. DIS ; -- count discharges
  1. D CHK^IBTOSUM2 I $G(ZTSTOP) Q
  1. S IBDT=IBBDT-.000000001
  1. F S IBDT=$O(^DGPM("AMV3",IBDT)) Q:'IBDT!(IBDT>(IBEDT+.24)) D
  1. .S DFN=0 F S DFN=$O(^DGPM("AMV3",IBDT,DFN)) Q:'DFN D
  1. ..S DA=0 F S DA=$O(^DGPM("AMV3",IBDT,DFN,DA)) Q:'DA D PROC
  1. ..Q
  1. .Q
  1. Q
  1. ;
  1. PROC ; -- Process each admission or discharge
  1. S DGPM=$P($G(^DGPM(DA,0)),"^",14)
  1. S IBCNT(1)=IBCNT(1)+1 ; count of admsisions or discharges
  1. S IBTRN=$O(^IBT(356,"AD",DGPM,0))
  1. Q:'IBTRN
  1. ;
  1. S IBTRND=$G(^IBT(356,+IBTRN,0)) ;W !,IBTRND
  1. Q:'$P(IBTRND,"^",20) ; must be an active visit
  1. ;
  1. Q:'$$INSURED^IBCNS1(DFN,IBDT) ; must be insured for visit to count
  1. ;
  1. S IBCNT(2)=IBCNT(2)+1 ; count of insured admissions or discharges discharges
  1. ;
  1. S IBCNT(3,+$P(IBTRND,"^",19))=$G(IBCNT(3,+$P(IBTRND,"^",19)))+1 ;count of billable
  1. ;
  1. S X=$P($G(^IBT(356,+IBTRN,1)),"^",7) I X>3 S IBCNT(4)=IBCNT(4)+1
  1. I X="",$P(IBTRND,"^",24),'$P(IBTRND,"^",19) S IBCNT(4)=IBCNT(4)+1 ;reviews required
  1. ;
  1. I $$APPEAL(IBTRN) S IBCNT(80)=IBCNT(80)+1
  1. ;
  1. K IBDCNT,IBPCNT
  1. S IBTRC=0 F S IBTRC=$O(^IBT(356.2,"C",IBTRN,IBTRC)) Q:'IBTRC D RCNT^IBTOSUM1
  1. S:$D(IBPCNT(IBTRN)) IBCNT(99)=IBCNT(99)+1
  1. S:$O(IBPCNT(IBTRN,+$O(IBPCNT(IBTRN,0)))) IBCNT(13)=IBCNT(13)+1 ;more than one policy per case
  1. Q
  1. ;
  1. APPEAL(IBTRN) ; -- was this case appealed:
  1. ;
  1. N A,X
  1. S A=0
  1. I 'IBTRN G APPEALQ
  1. S X=$O(^IBE(356.11,"ACODE",60,0)) ; initial appeal
  1. I $O(^IBT(356.2,"ATRTP",IBTRN,X,0)) S A=1 G APPEALQ
  1. S X=$O(^IBE(356.11,"ACODE",65,0)) ; subsequent appeal
  1. I $O(^IBT(356.2,"ATRTP",IBTRN,X,0)) S A=1 G APPEALQ
  1. APPEALQ Q A