source: WorldVistAEHR/trunk/r/SURGERY-SR/SRSRBS.m@ 1764

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

initial load of WorldVistAEHR

File size: 3.8 KB
RevLine 
[613]1SRSRBS ;B'HAM ISC/MAM - REQUESTS BY SERVICE ; [ 07/27/98 2:33 PM ]
2 ;;3.0; Surgery ;**50**;24 Jun 93
3A W !!,"List requests by SPECIALTY or WARD ? SPECIALTY// " R X:DTIME S:'$T X="^" S:X="" X="S"
4 Q:X["^" S X=$E(X) I "SsWw"'[X W !!,"Enter RETURN if you would like to sort requests by SURGICAL SPECIALTY, or ",!,"'WARD' to sort by the WARD location." G A
5 I "Ww"[X G ^SRSRBW
6BEG W !!,"Do you want requests for all surgical specialties ? YES// " R X:DTIME S:'$T X="^" S:X="" X="Y" G:X["^" END
7 S X=$E(X) I "YyNn"'[X W !!,"Enter RETURN if you would like a list of requests for all surgical specialties,",!,"or 'NO' to list the requests for a specific specialty.",! G BEG
8 I "Yy"[X G ^SRSRBS1
9 W ! K DIC S DIC("S")="I '$P(^(0),""^"",3)",DIC=137.45,DIC("A")="List Requests for which Specialty ? ",DIC(0)="QEAMZ" D ^DIC K DIC G:Y<0 END S SRS=+Y,SRS("N")=$P(Y(0),"^"),SRS("C")=$P(Y(0),"^",2)
10 W ! K IOP,%ZIS,POP,IO("Q") S %ZIS("A")="Print the Report on which Device: ",%ZIS="Q" D ^%ZIS G:POP END
11 I $D(IO("Q")) K IO("Q") S ZTDESC="Requests by Service",ZTRTN="SER^SRSRBS",(ZTSAVE("DT"),ZTSAVE("SRS"),ZTSAVE("SRS(""N"")"),ZTSAVE("SRSITE*"))="" D ^%ZTLOAD G END
12SER ; entry when queued
13 S X="T-1" D ^%DT S SRSDATE=Y,(DFN,SRTN,SRQ)=0 K ^TMP("SR",$J)
14 F S SRSDATE=$O(^SRF("AR",SRSDATE)) Q:'SRSDATE F S DFN=$O(^SRF("AR",SRSDATE,DFN)) Q:'DFN F S SRTN=$O(^SRF("AR",SRSDATE,DFN,SRTN)) Q:'SRTN I $$DIV^SROUTL0(SRTN),$P(^SRF(SRTN,0),"^",4)=SRS D SETUTL
15WLIST ; get waiting list patients
16 S (COUNT,SRSDATE)=0
17 S SRSS=$O(^SRO(133.8,"B",SRS,0)) I SRSS F S SRSDATE=$O(^SRO(133.8,"AWL",SRSS,SRSDATE)) Q:'SRSDATE S SRWL=0 F S SRWL=$O(^SRO(133.8,"AWL",SRSS,SRSDATE,SRWL)) Q:'SRWL D SETUTL1
18UTL ; loop through ^TMP("SR",$J) and print data
19 U IO D HDR S (SRSDATE,SRTN)=0 F S SRSDATE=$O(^TMP("SR",$J,SRSDATE)) Q:SRSDATE=""!SRQ F S SRTN=$O(^TMP("SR",$J,SRSDATE,SRTN)) Q:SRTN=""!SRQ D PRINT
20 I 'SRQ,$E(IOST)'="P" W !!,"Press RETURN to continue " R X:DTIME
21END W:$E(IOST)="P" @IOF I $D(ZTQUEUED) K ^TMP("SR",$J) Q:$G(ZTSTOP) S ZTREQ="@" Q
22 D ^SRSKILL K SRTN D ^%ZISC W @IOF
23 Q
24LOOP ; break procedure if greater than 65 characters
25 S SROPS(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROPS(M))+$L(MM)'<65 S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
26 Q
27SETUTL ; set ^TMP("SR",$J)
28 D DEM^VADPT S SRNM=VADM(1),SRSSN=VA("PID"),SRSOP=$P(^SRF(SRTN,"OP"),"^"),SRWARD=$S($D(^DPT(DFN,.1)):$P(^(.1),"^"),1:""),Y=SRSDATE D D^DIQ S SRDATE=Y
29 I SRWARD="" D WARD
30 S ^TMP("SR",$J,SRSDATE,SRTN)=SRDATE_"^"_SRNM_"^"_SRWARD_"^"_SRSOP_"^"_SRSSN
31 Q
32SETUTL1 ; set ^TMP("SR",$J) with waiting list info
33 S DFN=+^SRO(133.8,SRSS,1,SRWL,0),SRSOP=$P(^(0),"^",2)
34 S SRWARD=$S($D(^DPT(DFN,.1)):$P(^(.1),"^"),1:"") D DEM^VADPT S SRNM=VADM(1),SRSSN=VA("PID"),COUNT=COUNT+1
35 I SRWARD="" D WARD
36 S ^TMP("SR",$J,"WL","WL"_COUNT)="WAITING LIST^"_SRNM_"^"_SRWARD_"^"_SRSOP_"^"_SRSSN
37 Q
38PRINT ; print information
39 I $Y+6>IOSL D PAGE Q:SRQ D HDR Q:SRQ
40 S STBY=^TMP("SR",$J,SRSDATE,SRTN),SROPER=$P(STBY,"^",4) K SROPS,MM,MMM S:$L(SROPER)<65 SROPS(1)=SROPER I $L(SROPER)>64 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
41 W !,$P(STBY,"^"),?14,$P(STBY,"^",2),?45,$P(STBY,"^",3),!,SRTN,?14,$P(STBY,"^",5),!,?14,SROPS(1) I $D(SROPS(2)) W !,?14,SROPS(2) I $D(SROPS(3)) W !,?14,SROPS(3)
42 W ! F LINE=1:1:80 W "-"
43 Q
44HDR ; print heading
45 I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRQ=1 Q
46 W:$Y @IOF W !,?5,"Operative Requests for "_SRS("N"),!!,"Date",?14,"Patient",?45,"Ward Location",!,"Case Number",?14,"ID #",!,?14,"Operative Procedure",! F LINE=1:1:80 W "="
47 Q
48PAGE ; end of screen
49 I $E(IOST,1)'="P" W !!,"Press RETURN to continue or '^' to quit. " R X:DTIME I '$T!(X="^") S SRQ=1
50 Q
51WARD ; check for scheduled admission
52 S (X,PEND)=0 F S PEND=$O(^DGS(41.1,"B",DFN,PEND)) Q:'PEND S PDATE=$P(^DGS(41.1,PEND,0),"^",2) I PDATE>DT S SRWARD="ADM. PENDING",X=1
53 Q:X=1 S SRWARD="OUTPATIENT"
54 Q
Note: See TracBrowser for help on using the repository browser.