source: WorldVistAEHR/trunk/r/UTILIZATION_MGMT_ROLLUP_LOCAL-IBQ/IBQLR4A.m@ 703

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

initial load of WorldVistAEHR

File size: 2.8 KB
Line 
1IBQLR4A ;LEB/MRY - ACUTE/NON-ACUTE REPORT ; 13-JUL-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 ; -- called from IBQLR1
5PRINT S (IBTEXT,IBDATA,IBQUIT,IBHDR,IBDIAG)="",IBPAG=0 D MONTH
6 ; -- call to return header dates, IBTDT, IBDRNG
7 D DTC^IBQLPL2
8 S IBHDR="UTILIZATION MANAGEMENT",IBHDR2="ACUTE AND NON-ACUTE REPORT FOR "_IBDRNG,IBHDR1="ADMITTING DIAGNOSIS"
9 ;
10 I '$D(^TMP("IBQLR4",$J)) D HDR W !!,?20,"<<< NO PATIENTS TO PRINT >>>" Q
11DIAG F S IBDIAG=$O(^TMP("IBQLR4",$J,IBDIAG)) Q:IBDIAG="" D Q:IBQUIT
12 .S IBSUBH="ADMITTING DIAGNOSIS: "_IBDIAG
13 .D PLINE
14 .F IBDAY=1,2 D Q:IBQUIT
15 ..S (IBCAT,IBCATF)=""
16 ..F S IBCAT=$O(^TMP("IBQLR4",$J,IBDIAG,IBDAY,IBCAT)) Q:IBCAT="" D Q:IBQUIT
17 ...I $E(IBCAT,1)="C" D ACUTE
18 ...I $E(IBCAT,1)="R" D REASON
19 Q
20 ;
21END K IBTS,IBTEXT,IBDATA,IBQUIT,IBHDR,IBMONTH,IBMD,IBMTH,IBCAT,MSTRING,N,I,X,IBDAY,IBRES,IBCATF
22 Q
23ACUTE ;
24 S IBMONTH=""
25 I IBDAY=2&('IBCATF) W !,?3,"CONTINUED STAY REVIEWS" S IBCATF=1
26 S IBMONTH="" F S IBMONTH=$O(IBMONTH(IBMONTH)) Q:'IBMONTH D Q:IBQUIT
27 .S IBRES=$G(^TMP("IBQLR4",$J,IBDIAG,IBDAY,IBCAT,IBMONTH)) S:'IBRES IBRES=0 D MDATA
28 D PLINE Q:IBQUIT
29 Q
30REASON ;
31 S IBREA=""
32 W:IBDAY=1 !,?3,"REASONS FOR NON-ACUTE ADMISSIONS" W:IBDAY=2 !,?3,"REASONS FOR NON-ACUTE CONTINUED STAYS"
33 F S IBREA=$O(^TMP("IBQLR4",$J,IBDIAG,IBDAY,IBCAT,IBREA)) Q:'IBREA D Q:IBQUIT
34 .S IBMONTH="" F S IBMONTH=$O(IBMONTH(IBMONTH)) Q:'IBMONTH D Q:IBQUIT
35 ..S IBRES=$G(^TMP("IBQLR4",$J,IBDIAG,IBDAY,IBCAT,IBREA,IBMONTH)) S:'IBRES IBRES=0 D MDATA
36 .D PLINE Q:IBQUIT
37 Q
38MDATA ;
39 S IBMTH=+$E(IBMONTH,4,5),IBMD=$P(MSTRING,"^",IBMTH)
40 F I=1:1 S X=$P(IBTEXT,",",I) Q:X=""!(X=IBMD)
41 I X'="" D
42 .S $P(IBDATA,",",I)=IBRES
43 .;.S $P(IBDATA,",",I)=$S($E(IBCAT,1)="C":^TMP("IBQLR4",$J,IBDIAG,IBDAY,IBCAT,IBMONTH),$E(IBCAT,1)="R":^TMP("IBQLR4",$J,IBDIAG,IBDAY,IBCAT,IBREA,IBMONTH),1:"")
44 .S $P(IBDATA,",",1)=$S(IBCAT="CNTA":"ACUTE",IBCAT="CNTN":"NON-ACUTE",IBCAT="REA":IBREA,1:"")
45 Q
46 ;
47PLINE ;
48 I IBPAG=0 D HDR
49 I $G(IBCAT)="" D
50 .W !!,IBSUBH,! S IBDATA=IBTEXT
51 F I=1:1 Q:$P(IBDATA,",",I)="" D
52 .I I=1 W ! W:$G(IBCAT)="" ?3 W:$G(IBCAT)'="" ?5 W $P(IBDATA,","),?30
53 .E W $J($P(IBDATA,",",I),3)_" "
54 D CHKL Q:IBQUIT
55 Q
56HDR ; -- print headers
57 W:$E(IOST,1,2)["C-"!(IBPAG>0) @IOF S IBPAG=IBPAG+1
58 W !,IBTDT,?(IOM-$L(IBHDR)/2),IBHDR,?(IOM-10),"PAGE ",IBPAG
59 W !?(IOM-$L(IBHDR1)/2),IBHDR1,!,?(IOM-$L(IBHDR2)/2),IBHDR2
60 W !,$TR($J("",IOM)," ","-")
61 Q
62 ;
63CHKL ; -- check end of page
64 I IOSL<($Y+5),$E(IOST,1,2)="C-" D PAUSE^VALM1 S:$D(DIRUT) IBQUIT=1 Q:IBQUIT W @IOF D HDR Q
65 I $E(IOST,1,2)'="C-",IOSL<($Y+5) D HDR
66 Q
67 ;
68MONTH ;
69 S MSTRING="JAN^FEB^MAR^APR^MAY^JUN^JUL^AUG^SEP^OCT^NOV^DEC",X=""
70 F I=1:1 S X=$O(IBMONTH(X)) Q:'X D
71 .S IBTEXT=IBTEXT_$P(MSTRING,"^",+$E(X,4,5))_","
72 S IBTEXT="ADMISSION REVIEWS"_","_IBTEXT
73 Q
Note: See TracBrowser for help on using the repository browser.