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

RAORDP.m

Go to the documentation of this file.
RAORDP ;HISC/CAH,FPT AISC/DMK-Log of Pending/Hold Requests ;4/17/96  11:28
 ;;5.0;Radiology/Nuclear Medicine;**15**;Mar 16, 1998
 ;
 ; This report looks at all orders in file 75.1 with status=5 (pending)
 ; or status=3 (hold) and field 21 (Desired Date) within the date range
 ; selected.
 ;
 W !!,"This option will generate a list of requests for a selected date",!,"range with the status of 'PENDING' or 'HOLD'",!
 K DIR S DIR(0)="S^H:HOLD;P:PENDING",DIR("A")="Select REQUEST STATUS",DIR("B")="P" D ^DIR K DIR
 I $D(DIRUT) D KILL Q
 W ! S RAREQSTA=$S(Y="P":5,1:3)
 S RANOSCRN="" D OMA^RAUTL13 K RANOSCRN I '$L($O(RALOC(0)))!($G(RAQUIT)=1) D KILL Q
 S RADDT=1 D DATE^RAUTL K RADDT G KILL:RAPOP S RAOBEG=BEGDATE,RAOEND=ENDDATE+.9 K BEGDATE,ENDDATE
 S ZTRTN="START^RAORDP",ZTSAVE("RALOC(")="",ZTSAVE("RAOBEG")="",ZTSAVE("RAOEND")="",ZTSAVE("RAREQSTA")="" D ZIS^RAUTL G KILL:RAPOP
START ; start report processing
 U IO S QQ="",$P(QQ,"=",80)="=",RALOCNM="",RAOLOC="",RAHDR="LOG OF "_$S(RAREQSTA=5:"PENDING",1:"HOLD")_" REQUESTS",RAHDRDSH="",$P(RAHDRDSH,"-",$L(RAHDR))="-"
 S RAOBEG("X")=+$E(RAOBEG,4,5)_"/"_+$E(RAOBEG,6,7)_"/"_$E(RAOBEG,2,3)
 S RAOEND("X")=+$E(RAOEND,4,5)_"/"_+$E(RAOEND,6,7)_"/"_$E(RAOEND,2,3)
 S X="NOW",%DT="T" D ^%DT D D^RAUTL S RARUNDTE=Y K %DT
 I $D(ZTQUEUED) S ZTREQ="@"
 F  S RALOCNM=$O(RALOC(RALOCNM)) Q:RALOCNM=""  S RA791IEN="" F  S RA791IEN=$O(RALOC(RALOCNM,RA791IEN)) Q:RA791IEN=""  S RALOC1(RA791IEN)=0,RALOCIT(+$P(^RA(79.1,RA791IEN,0),"^",6))=""
 K RALOCNM,RA791IEN S RADFN=0
 F  S RADFN=$O(^RAO(75.1,"AS",RADFN)) Q:'RADFN!($D(RAEOS))  D
 .S RAOIFN=0 F  S RAOIFN=$O(^RAO(75.1,"AS",RADFN,RAREQSTA,RAOIFN)) Q:'RAOIFN!($D(RAEOS))  D
 ..I $D(^RAO(75.1,RAOIFN,0)) S RAO(0)=^(0),RAODT=$P(RAO(0),"^",21),RAILOC=$P(RAO(0),"^",20),RAIMTYP=$P(RAO(0),"^",3) D
 ...I $D(RALOC1(+RAILOC)) D SETTMP Q
 ...I RAILOC="",$D(RALOCIT(+RAIMTYP)) D SETTMP
 I $D(RAEOS) D KILL Q
 S RAILOC=""
 F  S RAILOC=$O(RALOC1(RAILOC)) Q:RAILOC=""!($D(RAEOS))  S RACNT=0 D CONT
KILL W !
 K ^TMP($J,"RA")
 K CNT,DIC,DIROUT,DIRUT,DTOUT,DUOUT,I,QQ,RACNT,RADFN,RADDT,RADLOCS,RADT,RAEOS,RAHDR,RAHDRDSH,RAILOC,RAIMTYP,RALOC,RALOC1,RALOCIT
 K RALOCS,RALOCSAV,RALOCN,RAO,RAOBEG,RAODT,RAOEND,RAOIFN,RAOLOC,RAORD0,RAPOP,RAPR,RAQUIT,RARDT,RAREQSTA,BEGDATE,ENDDATE,RARUNDTE
 K X,Y,RAMES,ZTDESC,ZTRTN,ZTSAVE
 D CLOSE^RAUTL
 K POP,DDH,DISYS,DFN,VAERR
 Q
CONT ;
 I $E(IOST,1,2)="C-",RAOLOC]"",RAOLOC'=RAILOC D EOS Q:$D(RAEOS)
 D HDR Q:$D(RAEOS)
 I +RALOC1(RAILOC)=0 W !?2,"No requests "_$S(RAREQSTA=5:"pending",1:"on hold")_" for "_RAOBEG("X")_" to "_RAOEND("X")_".",! I $E(IOST,1,2)="C-"&($O(RALOC1(RAILOC))]"") D EOS Q:$D(RAEOS)  D  Q
 .S RAOLOC(0)=$O(RALOC1(RAILOC)) S:RAOLOC(0)]"" RAOLOC=RAOLOC(0) K RAOLOC(0)
 S RADT=0 F  S RADT=$O(^TMP($J,"RA",RAILOC,RADT)) Q:'RADT!($D(RAEOS))  D DATE S RADFN=0 F  S RADFN=$O(^TMP($J,"RA",RAILOC,RADT,RADFN)) Q:'RADFN!($D(RAEOS))  D MORE
 Q
MORE S RARDT=0 F  S RARDT=$O(^TMP($J,"RA",RAILOC,RADT,RADFN,RARDT)) Q:'RARDT!($D(RAEOS))  S RAPR=0 F  S RAPR=$O(^TMP($J,"RA",RAILOC,RADT,RADFN,RARDT,RAPR)) Q:'RAPR!($D(RAEOS))  S RAO=0 F  S RAO=$O(^(RAPR,RAO)) Q:'RAO!($D(RAEOS))  D
 .S RAORD0=^RAO(75.1,+RAO,0),RACNT=RACNT+1
 .K RALOCN,RARLOCN
 .D IPOP^RAUTL13
 .D WRT
 Q
WRT ;
 W !,$S($D(^DPT(RADFN,0)):$E($P(^(0),"^"),1,19)_" -"_$E($P(^(0),"^",9),6,9),1:"Unknown"),?26,$S($D(^RAMIS(71,RAPR,0)):$E($P(^(0),"^"),1,24),1:"Unknown"),?52,$E(RALOCN,1,14)
 S Y=$P(RARDT,".") D DD^%DT W ?67,Y
 I $L($G(RARLOCN)) W !?36,"Requesting Loc: ",RARLOCN
 S RAOLOC=RAILOC
 I ($Y+6)>IOSL D EOS Q:$D(RAEOS)  D:RACNT<RALOC1(RAILOC) HDR Q:$D(RAEOS)  I RACNT=RALOC1(RAILOC) S RAOLOC(0)=$O(RALOC1(RAILOC)) S:RAOLOC(0)]"" RAOLOC=RAOLOC(0) K RAOLOC(0)
 Q
HDR ; header
 W:$Y>0 @IOF
 W !?(80-$L(RAHDR)/2),RAHDR
 W !?14,"Includes requests scheduled from ",RAOBEG("X")," to ",RAOEND("X") ;W !?(80-$L(RAHDR)/2),RAHDRDSH
 W !,"IMAGING LOCATION: ",$S('RAILOC:"Unknown",$D(^RA(79.1,RAILOC,0)):$S($D(^SC($P(^(0),"^"),0)):$P(^(0),"^"),1:"Unknown"),1:"Unknown"),?51,"Run Date: ",RARUNDTE,!
 W !,"PATIENT NAME",?30,"PROCEDURE",?52,"PT LOC",?67,"DATE ORDERED",!,QQ,!
 I $D(ZTQUEUED) D STOPCHK^RAUTL9 S:$G(ZTSTOP)=1 RAEOS=""
 Q
DATE ; Output 'Desired Date'
 S Y=RADT D DD^%DT S X=$L(Y)+32 W !!?(80-X/2),"Desired Date (Time optional): ",Y,!?(80-X/2) S Y="",$P(Y,"-",X)="-" W Y,!
 Q
SETTMP ; set-up ^TMP($J
 I $D(ZTQUEUED) D STOPCHK^RAUTL9 S:$G(ZTSTOP)=1 RAEOS="" Q:$D(RAEOS)
 I $S('RAODT:0,'RADFN:0,'$P(RAO(0),"^",16):0,'$P(RAO(0),"^",2):0,1:1),RAODT'<RAOBEG,RAODT'>RAOEND S ^TMP($J,"RA",$S(RAILOC:RAILOC,1:"UNKNOWN"),$P(RAO(0),"^",21),RADFN,$P(RAO(0),"^",16),$P(RAO(0),"^",2),RAOIFN)="" D
 .I RAILOC="" S:'$D(RALOC1("UNKNOWN")) RALOC1("UNKNOWN")=0 S RALOC1("UNKNOWN")=RALOC1("UNKNOWN")+1 Q
 .S:RAILOC>0 RALOC1(RAILOC)=RALOC1(RAILOC)+1
 Q
EOS ; end of screen
 S X=$$EOS^RAUTL5
 S:X=1 RAEOS=""
 Q