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

IBQLD1A.m

Go to the documentation of this file.
  1. IBQLD1A ;LEB/MRY - ACUTE/NON-ACUTE DOWNLOAD ; 17-MAY-95
  1. ;;1.0;UTILIZATION MGMT ROLLUP LOCAL;;Oct 01, 1995
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ; -- called from IBQLR1
  1. PRINT D SVCTAB^IBQLR1B S (IBTEXT,IBDATA,IBTS,IBQUIT,IBHDR,IBSVC)="",IBPAG=0 D MONTH
  1. ; -- call to return header dates, IBTDT, IBDRNG
  1. D DTC^IBQLPL2
  1. S IBHDR="UTILIZATION MANAGEMENT",IBHDR2="ACUTE AND NON-ACUTE REPORT FOR "_IBDRNG S:IBTY="S" IBHDR1="SERVICE" S:IBTY="T" IBHDR1="TREATING SPECIALTY.(SERVICE)"
  1. ;
  1. F S IBSVC=$O(^TMP("IBQLD1",$J,IBSVC)) Q:IBSVC="" D TS Q:IBQUIT
  1. G END
  1. TS F S IBTS=$O(^TMP("IBQLD1",$J,IBSVC,IBTS)) Q:IBTS="" D Q:IBQUIT
  1. .I IBTS=999 S IBSUBH=$S($D(IBSVC(IBSVC)):IBSVC(IBSVC),1:IBSVC("UNK"))
  1. .E S IBSUBH=IBTS_",("_$S($D(IBSVC(IBSVC)):IBSVC(IBSVC),1:IBSVC("UNK"))_")"
  1. .I IBTY="I",'$D(IBTS(IBTS)) Q
  1. .D PLINE
  1. .F IBDAY=1,2 D Q:IBQUIT
  1. ..S (IBCAT,IBCATF)=""
  1. ..F S IBCAT=$O(^TMP("IBQLD1",$J,IBSVC,IBTS,IBDAY,IBCAT)) Q:IBCAT="" D Q:IBQUIT
  1. ...I $E(IBCAT,1)="C" D ACUTE
  1. ...I $E(IBCAT,1)="R" D REASON
  1. Q
  1. ;
  1. END K IBTS,IBTEXT,IBDATA,IBQUIT,IBHDR,IBMONTH,IBMD,IBMTH,IBCAT,MSTRING,N,I,X,IBDAY,IBRES,IBCATF
  1. Q
  1. ACUTE ;
  1. S IBMONTH=""
  1. I IBDAY=2&('IBCATF) W !,"CONTINUED STAY DAYS" S IBCATF=1
  1. S IBMONTH="" F S IBMONTH=$O(IBMONTH(IBMONTH)) Q:'IBMONTH D Q:IBQUIT
  1. .S IBRES=$G(^TMP("IBQLD1",$J,IBSVC,IBTS,IBDAY,IBCAT,IBMONTH)) S:'IBRES IBRES=0 D MDATA
  1. D PLINE Q:IBQUIT
  1. Q
  1. REASON ;
  1. S IBREA=""
  1. W:IBDAY=1 !,"REASONS FOR NON-ACUTE ADMISSIONS" W:IBDAY=2 !,"REASONS FOR NON-ACUTE STAY DAYS"
  1. F S IBREA=$O(^TMP("IBQLD1",$J,IBSVC,IBTS,IBDAY,IBCAT,IBREA)) Q:'IBREA D Q:IBQUIT
  1. .S IBMONTH="" F S IBMONTH=$O(IBMONTH(IBMONTH)) Q:'IBMONTH D Q:IBQUIT
  1. ..S IBRES=$G(^TMP("IBQLD1",$J,IBSVC,IBTS,IBDAY,IBCAT,IBREA,IBMONTH)) S:'IBRES IBRES=0 D MDATA
  1. .D PLINE Q:IBQUIT
  1. Q
  1. MDATA ;
  1. S IBMTH=+$E(IBMONTH,4,5),IBMD=$P(MSTRING,"^",IBMTH)
  1. F I=1:1 S X=$P(IBTEXT,"^",I) Q:X=""!(X=IBMD)
  1. I X'="" D
  1. .S $P(IBDATA,"^",I)=IBRES
  1. .S $P(IBDATA,"^",1)=$S(IBCAT="CNTA":"ACUTE",IBCAT="CNTN":"NON-ACUTE",IBCAT="REA":IBREA,1:"")
  1. Q
  1. ;
  1. PLINE ;
  1. I $G(IBCAT)="" D
  1. .W !!,IBSUBH,! S IBDATA=IBTEXT
  1. W !,IBDATA
  1. Q
  1. ;
  1. MONTH ;
  1. S MSTRING="JAN^FEB^MAR^APR^MAY^JUN^JUL^AUG^SEP^OCT^NOV^DEC",X=""
  1. F I=1:1 S X=$O(IBMONTH(X)) Q:'X D
  1. .S IBTEXT=IBTEXT_$P(MSTRING,"^",+$E(X,4,5))_"^"
  1. S IBTEXT="ADMISSIONS^"_IBTEXT
  1. Q