source: FOIAVistA/trunk/r/UTILIZATION_MGMT_ROLLUP_LOCAL-IBQ/IBQLR4.m@ 1770

Last change on this file since 1770 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.2 KB
Line 
1IBQLR4 ;LEB/MRY - ACUTE/NON-ACUTE REPORT ; 17-MAY-95
2 ;;1.0;UTILIZATION MGMT ROLLUP LOCAL;;Oct 01, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 I '$D(DT) D DT^DICRW
6DATE W ! D DATE^IBOUTL
7 I IBBDT=""!(IBEDT="") G END
8 S X1=IBEDT,X2=IBBDT D ^%DTC I X>365 W !,"<<< please report 1 years of information only. >>>" G DATE
9DIAG S DIR(0)="SA^A:All Admitting Diagnosis;I:Individual Admitting Diagnosis",DIR("A")="Display ALL or INDIVIDUAL Admitting Diagnosis? [A/I]: "
10 D ^DIR G:$D(DUOUT)!($D(DTOUT)) END K DIR
11 S IBTY=Y G:IBTY="A" DEV
12 S DIR(0)="SA^R:Range;E:Exact Match",DIR("A")="Search by Range or Exact Match? [R/E]: "
13 D ^DIR G:$D(DUOUT)!($D(DTOUT)) END K DIR
14 S IBTY1=Y G:IBTY1="E" DIAGI
15 S DIC="^ICD9(",DIC(0)="AMEQZ"
16 S DIC("A")="Start with ADMITTING DIAGNOSIS: " D ^DIC G END:Y'>0 S DG1=Y(0,0),DG1=$E(DG1,1,$L(DG1)-1)_$C($A(DG1,$L(DG1))-1)_"zzzzzz"
17F S DIC("A")="Go to ADMITTING DIAGNOSIS: " D ^DIC Q:Y'>0 S DG6=Y(0,0) I DG6']DG1 W !,"Must be after start code",! G F
18 G DEV
19DIAGI S DIR(0)="PO^80:AEQMZ",DIR("A")="Enter ADMITTING DIAGNOSIS"
20 D ^DIR G:$D(DUOUT)!($D(DTOUT)) END K DIR I X="" G:$O(IBDIAG(""))="" DIAGI G DEV
21 S IBDIAG(Y(0,0))="" G DIAGI
22DEV ; -- select device, run option
23 W ! S %ZIS="QM" D ^%ZIS G:POP END
24 I $D(IO("Q")) F I="DG1","DG6","IBTY","IBBDT","IBEDT","IBDIAG(","IBTY1" S ZTSAVE(I)=""
25 I $D(IO("Q")) S ZTRTN="START^IBQLR4",ZTDESC="UM - ACUTE REPORT" D ^%ZTLOAD K IO("Q"),ZTSK D HOME^%ZIS G END
26 U IO
27 ;
28START ;
29 K ^TMP("IBQLR4",$J) S IBDDT=IBBDT-.01,(IBPAG,IBQUIT,IBMCT)=0
30 F S IBDDT=$O(^IBQ(538,"ADIS",IBDDT)) Q:'IBDDT!(IBDDT>IBEDT) D
31 .S IBMONTH=$E(IBDDT,1,5) I '$D(IBMONTH(IBMONTH)) S IBMONTH(IBMONTH)="",IBMCT=IBMCT+1
32 .S IBTRN="" F S IBTRN=$O(^IBQ(538,"ADIS",IBDDT,IBTRN)) Q:'IBTRN D DATA
33 ;
34 I $$STOP,$G(ZTSTOP) G END
35 D PRINT^IBQLR4A
36END ; -- Clean up
37 W ! K ^TMP("IBQLR4",$J),IB,IBMONTH,IBDDT,IBBDT,IBEDT,IBTRN,IBTRND,IBTY,IBTEXT,IBDATA,IBHDR,IBQUIT,IBPAG,IBTRV,IBMONTH,MSTRING,IBREA,I,N,X,IBRES,IBCAT,IBMTH,IBMD,IBDIAG
38 I $D(ZTQUEUED) S ZTREQ="@" Q
39 D ^%ZISC
40 Q
41 ;
42DATA ;
43 ; -- get Admission Review info.
44 D ADMIT^IBQL538 S IBQUIT=""
45 S IBDIAG=IB(.04),IBDIAG1=" "_IBDIAG Q:IBDIAG="" I IBTY="I" D Q:IBQUIT
46 .I IBTY1="E",($D(IBDIAG(IBDIAG))) Q
47 .I IBTY1="R",(IBDIAG]DG1)&(IBDIAG']DG6) Q
48 .S IBQUIT=1
49 ; -- count acute admissions
50 I IB("ACUTE ADMISSION") D
51 .S ^($E(IBDDT,1,5))=$G(^TMP("IBQLR4",$J,IBDIAG1,1,"CNTA",$E(IBDDT,1,5)))+1
52 ; -- count non-acute admissions
53 E D
54 .S ^($E(IBDDT,1,5))=$G(^TMP("IBQLR4",$J,IBDIAG1,1,"CNTN",$E(IBDDT,1,5)))+1
55 .F I=1:1 S IBR=$P(IB(1.03)," ",I) Q:'IBR S ^($E(IBDDT,1,5))=$G(^TMP("IBQLR4",$J,IBDIAG1,1,"REA",IBR,$E(IBDDT,1,5)))+1
56 ; --continued stay days
57 S IBTRV=0 F S IBTRV=$O(^IBQ(538,IBTRN,13,IBTRV)) Q:'IBTRV D
58 .D STAY^IBQL538
59 .I IB("ACUTE STAY") D
60 ..S ^($E(IBDDT,1,5))=$G(^TMP("IBQLR4",$J,IBDIAG1,2,"CNTA",$E(IBDDT,1,5)))+1
61 .E D
62 ..S ^($E(IBDDT,1,5))=$G(^TMP("IBQLR4",$J,IBDIAG1,2,"CNTN",$E(IBDDT,1,5)))+1
63 ..F I=1:1 S IBR=$P(IB(13.06)," ",I) Q:'IBR S ^($E(IBDDT,1,5))=$G(^TMP("IBQLR4",$J,IBDIAG1,2,"REA",IBR,$E(IBDDT,1,5)))+1
64 Q
65 ;
66STOP() ; determine if user has requested the queued report to stop
67 I $D(ZTQUEUED),$$S^%ZTLOAD S ZTSTOP=1 K ZTEQ I $G(IBPAG) W !,"***TASK STOPPED BY USER***"
68 Q +$G(ZTSTOP)
Note: See TracBrowser for help on using the repository browser.