IBQLD1 ;LEB/MRY - ACUTE/NON-ACUTE DOWNLOAD ; 17-MAY-95
;;1.0;UTILIZATION MGMT ROLLUP LOCAL;**2**;Oct 01, 1995
;;Per VHA Directive 10-93-142, this routine should not be modified.
;
I '$D(DT) D DT^DICRW
DATE W ! D DATE^IBOUTL
I IBBDT=""!(IBEDT="") G END
S X1=IBEDT,X2=IBBDT D ^%DTC I X>365 W !,"<<< please report 1 years of information only. >>>" G DATE
S (IBQUIT,IBPAG)=0
S DIR(0)="SA^S:Services;T:Treating Specialties;A:Admitting Diagnosis",DIR("A")="Download Services, Treating Specialties, or Admitting Diagnosis? [S/T/A]: "
W ! D ^DIR G:$D(DUOUT)!($D(DTOUT)) END K DIR
S IBTY=Y I IBTY="A" G DIAG^IBQLD4
I IBTY="S" S DIR(0)="SA^A:All Services;I:Individual Services",DIR("A")="Download ALL or INDIVIDUAL Services? [A/I]: "
I IBTY="T" S DIR(0)="SA^A:All Treating Specialties;I:Individual Treating Specialties",DIR("A")="Download ALL or INDIVIDUAL Treating Specialties? [A/I]: "
D ^DIR G:$D(DUOUT)!($D(DTOUT)) END K DIR
S IBTY1=Y G:IBTY1="A" DEV
I IBTY="T" G TSI
SVCI S DIR(0)="42.4,3O",DIR("A")="Enter SERVICE"
D ^DIR G:$D(DUOUT)!($D(DTOUT)) END K DIR I X="" G:$O(IBSVC(""))="" SVCI G DEV
S IBSVC(Y)=Y(0) G SVCI
TSI S DIR(0)="PO^45.7:AEQZ",DIR("A")="Enter TREATING SPECIALTY"
D ^DIR G:$D(DUOUT)!($D(DTOUT)) END K DIR I X="" G:$O(IBTS(""))="" TSI G DEV
S IBTS(Y(0,0))="" G TSI
DEV ; -- select device, run option
W !!,"Set your Device settings to '0;255;9999'"
W ! D ^%ZIS G:POP END
S DIR(0)="FO",DIR("A")="Initiate File Capture Procedure and Press Return" D ^DIR I $D(DTOUT)!$D(DUOUT) G END
W !,"Working...",!
U IO
;
START ;
K ^TMP("IBQLD1",$J) S IBDDT=IBBDT-.01,IBMCT=0
F S IBDDT=$O(^IBQ(538,"ADIS",IBDDT)) Q:'IBDDT!(IBDDT>IBEDT) D
.S IBMONTH=$E(IBDDT,1,5) I '$D(IBMONTH(IBMONTH)) S IBMONTH(IBMONTH)="",IBMCT=IBMCT+1
.S IBTRN="" F S IBTRN=$O(^IBQ(538,"ADIS",IBDDT,IBTRN)) Q:'IBTRN D DATA
;
D PRINT^IBQLD1A
END ; -- Clean up
W ! K ^TMP("IBQLD1",$J),IB,IBMONTH,IBDDT,IBBDT,IBEDT,IBTRN,IBTRND,IBTS,IBTY,IBTEXT,IBDATA,IBHDR,IBQUIT,IBPAG,IBTRV,IBMONTH,MSTRING,IBREA,I,N,X,IBRES,IBCAT,IBMTH,IBMD,IBSVC
I $D(ZTQUEUED) S ZTREQ="@" Q
D ^%ZISC
Q
;
DATA ;
ADMIT ; -- get Admission Review info.
D ADMIT^IBQL538
S IBSVC=IB(1.07),IBTS=IB(.12) S:IBTY="S" IBTS=999 S:IBSVC="" IBSVC="UNK"
I IBTY1="I" G:IBTY="S"&('$D(IBSVC(IBSVC))) STAY G:IBTY="T"&('$D(IBTS(IBTS))) STAY
; -- count acute admissions
I IB("ACUTE ADMISSION") D
.S ^($E(IBDDT,1,5))=$G(^TMP("IBQLD1",$J,IBSVC,IBTS,1,"CNTA",$E(IBDDT,1,5)))+1
; -- count non-acute admissions
E D
.S ^($E(IBDDT,1,5))=$G(^TMP("IBQLD1",$J,IBSVC,IBTS,1,"CNTN",$E(IBDDT,1,5)))+1
.F I=1:1 S IBR=$P(IB(1.03)," ",I) Q:'IBR S ^($E(IBDDT,1,5))=$G(^TMP("IBQLD1",$J,IBSVC,IBTS,1,"REA",IBR,$E(IBDDT,1,5)))+1
STAY ; --continued stay days
S IBTRV=0 F S IBTRV=$O(^IBQ(538,IBTRN,13,IBTRV)) Q:'IBTRV D
.D STAY^IBQL538
.S IBSVC=IB(13.08),IBTS=IB(13.07) S:IBTY="S" IBTS=999 S:IBSVC="" IBSVC="UNK"
.I IBTY1="I" Q:IBTY="S"&('$D(IBSVC(IBSVC))) Q:IBTY="T"&('$D(IBTS(IBTS)))
.I IB("ACUTE STAY") D
..S ^($E(IBDDT,1,5))=$G(^TMP("IBQLD1",$J,IBSVC,IBTS,2,"CNTA",$E(IBDDT,1,5)))+1
.E D
..S ^($E(IBDDT,1,5))=$G(^TMP("IBQLD1",$J,IBSVC,IBTS,2,"CNTN",$E(IBDDT,1,5)))+1
..F I=1:1 S IBR=$P(IB(13.06)," ",I) Q:'IBR S ^($E(IBDDT,1,5))=$G(^TMP("IBQLD1",$J,IBSVC,IBTS,2,"REA",IBR,$E(IBDDT,1,5)))+1
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBQLD1 3320 printed Nov 22, 2024@17:51:04 Page 2
IBQLD1 ;LEB/MRY - ACUTE/NON-ACUTE DOWNLOAD ; 17-MAY-95
+1 ;;1.0;UTILIZATION MGMT ROLLUP LOCAL;**2**;Oct 01, 1995
+2 ;;Per VHA Directive 10-93-142, this routine should not be modified.
+3 ;
+4 IF '$DATA(DT)
DO DT^DICRW
DATE WRITE !
DO DATE^IBOUTL
+1 IF IBBDT=""!(IBEDT="")
GOTO END
+2 SET X1=IBEDT
SET X2=IBBDT
DO ^%DTC
IF X>365
WRITE !,"<<< please report 1 years of information only. >>>"
GOTO DATE
+3 SET (IBQUIT,IBPAG)=0
+4 SET DIR(0)="SA^S:Services;T:Treating Specialties;A:Admitting Diagnosis"
SET DIR("A")="Download Services, Treating Specialties, or Admitting Diagnosis? [S/T/A]: "
+5 WRITE !
DO ^DIR
if $DATA(DUOUT)!($DATA(DTOUT))
GOTO END
KILL DIR
+6 SET IBTY=Y
IF IBTY="A"
GOTO DIAG^IBQLD4
+7 IF IBTY="S"
SET DIR(0)="SA^A:All Services;I:Individual Services"
SET DIR("A")="Download ALL or INDIVIDUAL Services? [A/I]: "
+8 IF IBTY="T"
SET DIR(0)="SA^A:All Treating Specialties;I:Individual Treating Specialties"
SET DIR("A")="Download ALL or INDIVIDUAL Treating Specialties? [A/I]: "
+9 DO ^DIR
if $DATA(DUOUT)!($DATA(DTOUT))
GOTO END
KILL DIR
+10 SET IBTY1=Y
if IBTY1="A"
GOTO DEV
+11 IF IBTY="T"
GOTO TSI
SVCI SET DIR(0)="42.4,3O"
SET DIR("A")="Enter SERVICE"
+1 DO ^DIR
if $DATA(DUOUT)!($DATA(DTOUT))
GOTO END
KILL DIR
IF X=""
if $ORDER(IBSVC(""))=""
GOTO SVCI
GOTO DEV
+2 SET IBSVC(Y)=Y(0)
GOTO SVCI
TSI SET DIR(0)="PO^45.7:AEQZ"
SET DIR("A")="Enter TREATING SPECIALTY"
+1 DO ^DIR
if $DATA(DUOUT)!($DATA(DTOUT))
GOTO END
KILL DIR
IF X=""
if $ORDER(IBTS(""))=""
GOTO TSI
GOTO DEV
+2 SET IBTS(Y(0,0))=""
GOTO TSI
DEV ; -- select device, run option
+1 WRITE !!,"Set your Device settings to '0;255;9999'"
+2 WRITE !
DO ^%ZIS
if POP
GOTO END
+3 SET DIR(0)="FO"
SET DIR("A")="Initiate File Capture Procedure and Press Return"
DO ^DIR
IF $DATA(DTOUT)!$DATA(DUOUT)
GOTO END
+4 WRITE !,"Working...",!
+5 USE IO
+6 ;
START ;
+1 KILL ^TMP("IBQLD1",$JOB)
SET IBDDT=IBBDT-.01
SET IBMCT=0
+2 FOR
SET IBDDT=$ORDER(^IBQ(538,"ADIS",IBDDT))
if 'IBDDT!(IBDDT>IBEDT)
QUIT
Begin DoDot:1
+3 SET IBMONTH=$EXTRACT(IBDDT,1,5)
IF '$DATA(IBMONTH(IBMONTH))
SET IBMONTH(IBMONTH)=""
SET IBMCT=IBMCT+1
+4 SET IBTRN=""
FOR
SET IBTRN=$ORDER(^IBQ(538,"ADIS",IBDDT,IBTRN))
if 'IBTRN
QUIT
DO DATA
End DoDot:1
+5 ;
+6 DO PRINT^IBQLD1A
END ; -- Clean up
+1 WRITE !
KILL ^TMP("IBQLD1",$JOB),IB,IBMONTH,IBDDT,IBBDT,IBEDT,IBTRN,IBTRND,IBTS,IBTY,IBTEXT,IBDATA,IBHDR,IBQUIT,IBPAG,IBTRV,IBMONTH,MSTRING,IBREA,I,N,X,IBRES,IBCAT,IBMTH,IBMD,IBSVC
+2 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
QUIT
+3 DO ^%ZISC
+4 QUIT
+5 ;
DATA ;
ADMIT ; -- get Admission Review info.
+1 DO ADMIT^IBQL538
+2 SET IBSVC=IB(1.07)
SET IBTS=IB(.12)
if IBTY="S"
SET IBTS=999
if IBSVC=""
SET IBSVC="UNK"
+3 IF IBTY1="I"
if IBTY="S"&('$DATA(IBSVC(IBSVC)))
GOTO STAY
if IBTY="T"&('$DATA(IBTS(IBTS)))
GOTO STAY
+4 ; -- count acute admissions
+5 IF IB("ACUTE ADMISSION")
Begin DoDot:1
+6 SET ^($EXTRACT(IBDDT,1,5))=$GET(^TMP("IBQLD1",$JOB,IBSVC,IBTS,1,"CNTA",$EXTRACT(IBDDT,1,5)))+1
End DoDot:1
+7 ; -- count non-acute admissions
+8 IF '$TEST
Begin DoDot:1
+9 SET ^($EXTRACT(IBDDT,1,5))=$GET(^TMP("IBQLD1",$JOB,IBSVC,IBTS,1,"CNTN",$EXTRACT(IBDDT,1,5)))+1
+10 FOR I=1:1
SET IBR=$PIECE(IB(1.03)," ",I)
if 'IBR
QUIT
SET ^($EXTRACT(IBDDT,1,5))=$GET(^TMP("IBQLD1",$JOB,IBSVC,IBTS,1,"REA",IBR,$EXTRACT(IBDDT,1,5)))+1
End DoDot:1
STAY ; --continued stay days
+1 SET IBTRV=0
FOR
SET IBTRV=$ORDER(^IBQ(538,IBTRN,13,IBTRV))
if 'IBTRV
QUIT
Begin DoDot:1
+2 DO STAY^IBQL538
+3 SET IBSVC=IB(13.08)
SET IBTS=IB(13.07)
if IBTY="S"
SET IBTS=999
if IBSVC=""
SET IBSVC="UNK"
+4 IF IBTY1="I"
if IBTY="S"&('$DATA(IBSVC(IBSVC)))
QUIT
if IBTY="T"&('$DATA(IBTS(IBTS)))
QUIT
+5 IF IB("ACUTE STAY")
Begin DoDot:2
+6 SET ^($EXTRACT(IBDDT,1,5))=$GET(^TMP("IBQLD1",$JOB,IBSVC,IBTS,2,"CNTA",$EXTRACT(IBDDT,1,5)))+1
End DoDot:2
+7 IF '$TEST
Begin DoDot:2
+8 SET ^($EXTRACT(IBDDT,1,5))=$GET(^TMP("IBQLD1",$JOB,IBSVC,IBTS,2,"CNTN",$EXTRACT(IBDDT,1,5)))+1
+9 FOR I=1:1
SET IBR=$PIECE(IB(13.06)," ",I)
if 'IBR
QUIT
SET ^($EXTRACT(IBDDT,1,5))=$GET(^TMP("IBQLD1",$JOB,IBSVC,IBTS,2,"REA",IBR,$EXTRACT(IBDDT,1,5)))+1
End DoDot:2
End DoDot:1
+10 QUIT