source: WorldVistAEHR/trunk/r/UTILIZATION_MGMT_ROLLUP_LOCAL-IBQ/IBQLD1A.m@ 1154

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

initial load of WorldVistAEHR

File size: 2.3 KB
Line 
1IBQLD1A ;LEB/MRY - ACUTE/NON-ACUTE DOWNLOAD ; 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 ; -- called from IBQLR1
5PRINT D SVCTAB^IBQLR1B S (IBTEXT,IBDATA,IBTS,IBQUIT,IBHDR,IBSVC)="",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 S:IBTY="S" IBHDR1="SERVICE" S:IBTY="T" IBHDR1="TREATING SPECIALTY.(SERVICE)"
9 ;
10 F S IBSVC=$O(^TMP("IBQLD1",$J,IBSVC)) Q:IBSVC="" D TS Q:IBQUIT
11 G END
12TS F S IBTS=$O(^TMP("IBQLD1",$J,IBSVC,IBTS)) Q:IBTS="" D Q:IBQUIT
13 .I IBTS=999 S IBSUBH=$S($D(IBSVC(IBSVC)):IBSVC(IBSVC),1:IBSVC("UNK"))
14 .E S IBSUBH=IBTS_",("_$S($D(IBSVC(IBSVC)):IBSVC(IBSVC),1:IBSVC("UNK"))_")"
15 .I IBTY="I",'$D(IBTS(IBTS)) Q
16 .D PLINE
17 .F IBDAY=1,2 D Q:IBQUIT
18 ..S (IBCAT,IBCATF)=""
19 ..F S IBCAT=$O(^TMP("IBQLD1",$J,IBSVC,IBTS,IBDAY,IBCAT)) Q:IBCAT="" D Q:IBQUIT
20 ...I $E(IBCAT,1)="C" D ACUTE
21 ...I $E(IBCAT,1)="R" D REASON
22 Q
23 ;
24END K IBTS,IBTEXT,IBDATA,IBQUIT,IBHDR,IBMONTH,IBMD,IBMTH,IBCAT,MSTRING,N,I,X,IBDAY,IBRES,IBCATF
25 Q
26ACUTE ;
27 S IBMONTH=""
28 I IBDAY=2&('IBCATF) W !,"CONTINUED STAY DAYS" S IBCATF=1
29 S IBMONTH="" F S IBMONTH=$O(IBMONTH(IBMONTH)) Q:'IBMONTH D Q:IBQUIT
30 .S IBRES=$G(^TMP("IBQLD1",$J,IBSVC,IBTS,IBDAY,IBCAT,IBMONTH)) S:'IBRES IBRES=0 D MDATA
31 D PLINE Q:IBQUIT
32 Q
33REASON ;
34 S IBREA=""
35 W:IBDAY=1 !,"REASONS FOR NON-ACUTE ADMISSIONS" W:IBDAY=2 !,"REASONS FOR NON-ACUTE STAY DAYS"
36 F S IBREA=$O(^TMP("IBQLD1",$J,IBSVC,IBTS,IBDAY,IBCAT,IBREA)) Q:'IBREA D Q:IBQUIT
37 .S IBMONTH="" F S IBMONTH=$O(IBMONTH(IBMONTH)) Q:'IBMONTH D Q:IBQUIT
38 ..S IBRES=$G(^TMP("IBQLD1",$J,IBSVC,IBTS,IBDAY,IBCAT,IBREA,IBMONTH)) S:'IBRES IBRES=0 D MDATA
39 .D PLINE Q:IBQUIT
40 Q
41MDATA ;
42 S IBMTH=+$E(IBMONTH,4,5),IBMD=$P(MSTRING,"^",IBMTH)
43 F I=1:1 S X=$P(IBTEXT,"^",I) Q:X=""!(X=IBMD)
44 I X'="" D
45 .S $P(IBDATA,"^",I)=IBRES
46 .S $P(IBDATA,"^",1)=$S(IBCAT="CNTA":"ACUTE",IBCAT="CNTN":"NON-ACUTE",IBCAT="REA":IBREA,1:"")
47 Q
48 ;
49PLINE ;
50 I $G(IBCAT)="" D
51 .W !!,IBSUBH,! S IBDATA=IBTEXT
52 W !,IBDATA
53 Q
54 ;
55MONTH ;
56 S MSTRING="JAN^FEB^MAR^APR^MAY^JUN^JUL^AUG^SEP^OCT^NOV^DEC",X=""
57 F I=1:1 S X=$O(IBMONTH(X)) Q:'X D
58 .S IBTEXT=IBTEXT_$P(MSTRING,"^",+$E(X,4,5))_"^"
59 S IBTEXT="ADMISSIONS^"_IBTEXT
60 Q
Note: See TracBrowser for help on using the repository browser.