source: FOIAVistA/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAORDP.m@ 811

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

initial load of FOIAVistA 6/30/08 version

File size: 4.7 KB
Line 
1RAORDP ;HISC/CAH,FPT AISC/DMK-Log of Pending/Hold Requests ;4/17/96 11:28
2 ;;5.0;Radiology/Nuclear Medicine;**15**;Mar 16, 1998
3 ;
4 ; This report looks at all orders in file 75.1 with status=5 (pending)
5 ; or status=3 (hold) and field 21 (Desired Date) within the date range
6 ; selected.
7 ;
8 W !!,"This option will generate a list of requests for a selected date",!,"range with the status of 'PENDING' or 'HOLD'",!
9 K DIR S DIR(0)="S^H:HOLD;P:PENDING",DIR("A")="Select REQUEST STATUS",DIR("B")="P" D ^DIR K DIR
10 I $D(DIRUT) D KILL Q
11 W ! S RAREQSTA=$S(Y="P":5,1:3)
12 S RANOSCRN="" D OMA^RAUTL13 K RANOSCRN I '$L($O(RALOC(0)))!($G(RAQUIT)=1) D KILL Q
13 S RADDT=1 D DATE^RAUTL K RADDT G KILL:RAPOP S RAOBEG=BEGDATE,RAOEND=ENDDATE+.9 K BEGDATE,ENDDATE
14 S ZTRTN="START^RAORDP",ZTSAVE("RALOC(")="",ZTSAVE("RAOBEG")="",ZTSAVE("RAOEND")="",ZTSAVE("RAREQSTA")="" D ZIS^RAUTL G KILL:RAPOP
15START ; start report processing
16 U IO S QQ="",$P(QQ,"=",80)="=",RALOCNM="",RAOLOC="",RAHDR="LOG OF "_$S(RAREQSTA=5:"PENDING",1:"HOLD")_" REQUESTS",RAHDRDSH="",$P(RAHDRDSH,"-",$L(RAHDR))="-"
17 S RAOBEG("X")=+$E(RAOBEG,4,5)_"/"_+$E(RAOBEG,6,7)_"/"_$E(RAOBEG,2,3)
18 S RAOEND("X")=+$E(RAOEND,4,5)_"/"_+$E(RAOEND,6,7)_"/"_$E(RAOEND,2,3)
19 S X="NOW",%DT="T" D ^%DT D D^RAUTL S RARUNDTE=Y K %DT
20 I $D(ZTQUEUED) S ZTREQ="@"
21 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))=""
22 K RALOCNM,RA791IEN S RADFN=0
23 F S RADFN=$O(^RAO(75.1,"AS",RADFN)) Q:'RADFN!($D(RAEOS)) D
24 .S RAOIFN=0 F S RAOIFN=$O(^RAO(75.1,"AS",RADFN,RAREQSTA,RAOIFN)) Q:'RAOIFN!($D(RAEOS)) D
25 ..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
26 ...I $D(RALOC1(+RAILOC)) D SETTMP Q
27 ...I RAILOC="",$D(RALOCIT(+RAIMTYP)) D SETTMP
28 I $D(RAEOS) D KILL Q
29 S RAILOC=""
30 F S RAILOC=$O(RALOC1(RAILOC)) Q:RAILOC=""!($D(RAEOS)) S RACNT=0 D CONT
31KILL W !
32 K ^TMP($J,"RA")
33 K CNT,DIC,DIROUT,DIRUT,DTOUT,DUOUT,I,QQ,RACNT,RADFN,RADDT,RADLOCS,RADT,RAEOS,RAHDR,RAHDRDSH,RAILOC,RAIMTYP,RALOC,RALOC1,RALOCIT
34 K RALOCS,RALOCSAV,RALOCN,RAO,RAOBEG,RAODT,RAOEND,RAOIFN,RAOLOC,RAORD0,RAPOP,RAPR,RAQUIT,RARDT,RAREQSTA,BEGDATE,ENDDATE,RARUNDTE
35 K X,Y,RAMES,ZTDESC,ZTRTN,ZTSAVE
36 D CLOSE^RAUTL
37 K POP,DDH,DISYS,DFN,VAERR
38 Q
39CONT ;
40 I $E(IOST,1,2)="C-",RAOLOC]"",RAOLOC'=RAILOC D EOS Q:$D(RAEOS)
41 D HDR Q:$D(RAEOS)
42 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
43 .S RAOLOC(0)=$O(RALOC1(RAILOC)) S:RAOLOC(0)]"" RAOLOC=RAOLOC(0) K RAOLOC(0)
44 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
45 Q
46MORE 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
47 .S RAORD0=^RAO(75.1,+RAO,0),RACNT=RACNT+1
48 .K RALOCN,RARLOCN
49 .D IPOP^RAUTL13
50 .D WRT
51 Q
52WRT ;
53 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)
54 S Y=$P(RARDT,".") D DD^%DT W ?67,Y
55 I $L($G(RARLOCN)) W !?36,"Requesting Loc: ",RARLOCN
56 S RAOLOC=RAILOC
57 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)
58 Q
59HDR ; header
60 W:$Y>0 @IOF
61 W !?(80-$L(RAHDR)/2),RAHDR
62 W !?14,"Includes requests scheduled from ",RAOBEG("X")," to ",RAOEND("X") ;W !?(80-$L(RAHDR)/2),RAHDRDSH
63 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,!
64 W !,"PATIENT NAME",?30,"PROCEDURE",?52,"PT LOC",?67,"DATE ORDERED",!,QQ,!
65 I $D(ZTQUEUED) D STOPCHK^RAUTL9 S:$G(ZTSTOP)=1 RAEOS=""
66 Q
67DATE ; Output 'Desired Date'
68 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,!
69 Q
70SETTMP ; set-up ^TMP($J
71 I $D(ZTQUEUED) D STOPCHK^RAUTL9 S:$G(ZTSTOP)=1 RAEOS="" Q:$D(RAEOS)
72 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
73 .I RAILOC="" S:'$D(RALOC1("UNKNOWN")) RALOC1("UNKNOWN")=0 S RALOC1("UNKNOWN")=RALOC1("UNKNOWN")+1 Q
74 .S:RAILOC>0 RALOC1(RAILOC)=RALOC1(RAILOC)+1
75 Q
76EOS ; end of screen
77 S X=$$EOS^RAUTL5
78 S:X=1 RAEOS=""
79 Q
Note: See TracBrowser for help on using the repository browser.