source: WorldVistAEHR/trunk/r/SURGERY-SR/SRSRBS1.m@ 632

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

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1SRSRBS1 ;B'HAM ISC/MAM - REQUESTS BY SERVICE (ALL) ; [ 07/27/98 2:33 PM ]
2 ;;3.0; Surgery ;**50**;24 Jun 93
3 W ! K IOP,%ZIS,POP,IO("Q") S %ZIS("A")="Print the Report on which Device: ",%ZIS="Q" D ^%ZIS G:POP END I $D(IO("Q")) K IO("Q") S ZTDESC="Requests by Service",ZTRTN="SER^SRSRBS1",(ZTSAVE("DT"),ZTSAVE("SRSITE*"))="" D ^%ZTLOAD G END
4SER ; entry when queued
5 S X="T-1" D ^%DT S SRSDATE=Y,(DFN,SRTN,SRQ)=0 K ^TMP("SR",$J)
6 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) S SRS=$S($P(^SRF(SRTN,0),"^",4):$P(^(0),"^",4),1:"") D SETUTL
7WLIST ; get waiting list patients
8 S (COUNT,SRSS)=0
9 F S SRSS=$O(^SRO(133.8,"AWL",SRSS)) Q:'SRSS S SRS=+^SRO(133.8,SRSS,0),SRSDATE=0 F S SRSDATE=$O(^SRO(133.8,"AWL",SRSS,SRSDATE)) Q:'SRSDATE D MOREWL
10UTL ; loop through ^TMP("SR",$J) and print data
11 U IO S (SRS,SRSDATE,SRTN,SRZ)=0
12 F S SRS=$O(^TMP("SR",$J,SRS)) Q:SRS=""!SRQ D PAGE Q:SRQ D HDR F S SRSDATE=$O(^TMP("SR",$J,SRS,SRSDATE)) Q:SRSDATE=""!SRQ F S SRTN=$O(^TMP("SR",$J,SRS,SRSDATE,SRTN)) Q:SRTN=""!SRQ D PRINT
13 I 'SRQ,$E(IOST)'="P" W !!,"Press RETURN to continue " R X:DTIME
14END W:$E(IOST)="P" @IOF I $D(ZTQUEUED) K ^TMP("SR",$J) Q:$G(ZTSTOP) S ZTREQ="@" Q
15 D ^SRSKILL K SRTN D ^%ZISC W @IOF
16 Q
17LOOP ; break procedure if greater than 65 characters
18 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
19 Q
20MOREWL ; continue getting patients on waiting list
21 S SRWL=0 F S SRWL=$O(^SRO(133.8,"AWL",SRSS,SRSDATE,SRWL)) Q:'SRWL S DFN=+^SRO(133.8,SRSS,1,SRWL,0),SRSOP=$P(^(0),"^",2) D SETUTL1
22 Q
23SETUTL ; set ^TMP("SR",$J)
24 S SRS("N")=$S(SRS:$P(^SRO(137.45,SRS,0),"^"),1:"UNKNOWN")
25 D DEM^VADPT S SRNM=VADM(1),SRSSN=VA("PID"),SRSOP=$P(^SRF(SRTN,"OP"),"^"),SRWARD=$S($D(^DPT(DFN,.1)):$P(^(.1),"^"),1:"OUTPATIENT"),Y=SRSDATE D D^DIQ S SRDATE=Y
26 I SRWARD="" D WARD
27 S ^TMP("SR",$J,SRS("N"),SRSDATE,SRTN)=SRDATE_"^"_SRNM_"^"_SRWARD_"^"_SRSOP_"^"_SRSSN
28 Q
29SETUTL1 ; set ^TMP("SR",$J) with waiting list info
30 D DEM^VADPT S SRS("N")=$P(^SRO(137.45,SRS,0),"^"),SRNM=VADM(1),SRSSN=VA("PID"),SRWARD=$S($D(^DPT(DFN,.1)):$P(^(.1),"^"),1:""),COUNT=COUNT+1
31 I SRWARD="" D WARD
32 S ^TMP("SR",$J,SRS("N"),"WL","WL"_COUNT)="WAITING LIST^"_SRNM_"^"_SRWARD_"^"_SRSOP_"^"_SRSSN
33 Q
34PRINT ; print information
35 I $Y+6>IOSL D PAGE Q:SRQ D HDR Q:SRQ
36 S SRZ=1,STBY=^TMP("SR",$J,SRS,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=""
37 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)
38 W ! F LINE=1:1:80 W "-"
39 Q
40HDR ; print heading
41 I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRQ=1 Q
42 W:$Y @IOF W !,?5,"Operative Requests for "_SRS,!!,"Date",?14,"Patient",?45,"Ward Location",!,"Case Number",?14,"ID #",!,?14,"Operative Procedure",! F LINE=1:1:80 W "="
43 Q
44PAGE ; end of screen
45 Q:'SRZ I $E(IOST)'="P" W !!,"Press RETURN to continue or '^' to quit. " R X:DTIME I '$T!(X="^") S SRQ=1
46 Q
47WARD ; check for scheduled admission
48 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
49 Q:X=1 S SRWARD="OUTPATIENT"
50 Q
Note: See TracBrowser for help on using the repository browser.