source: FOIAVistA/trunk/r/SURGERY-SR/SRSCDW1.m@ 1169

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

initial load of FOIAVistA 6/30/08 version

File size: 2.9 KB
Line 
1SRSCDW1 ;B'HAM ISC/MAM - SCHEDULED OPERATIONS BY WARD ; [ 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 list on which device: ",%ZIS="Q" D ^%ZIS G:POP END
4 I $D(IO("Q")) K IO("Q") S ZTDESC="SCHEDULED OPERATIONS BY WARD",ZTRTN="SRW^SRSCDW1",(ZTSAVE("SRSDATE"),ZTSAVE("SRSITE*"))="" D ^%ZTLOAD G END
5SRW ; entry when queued
6 U IO S (SROR,SRQ,SRW,SRTN)=0,Y=SRSDATE D D^DIQ S SRDATE=Y
7OR F S SROR=$O(^SRF("AOR",SROR)) Q:'SROR!SRQ I $$ORDIV^SROUTL0(SROR,$G(SRSITE("DIV"))) F S SRTN=$O(^SRF("AOR",SROR,SRSDATE,SRTN)) Q:'SRTN!SRQ I $D(^SRF(SRTN,31)),$P(^(31),"^",4) S SRST=$P(^(31),"^",4) D UTL
8 D PRINT
9 I '$D(^TMP("SR",$J)) D HDR W $$NODATA^SROUTL0()
10END I 'SRQ,$E(IOST)'="P" W !!,"Press RETURN to continue " R X:DTIME
11 W:$E(IOST)="P" @IOF I $D(ZTQUEUED) K ^TMP("SR",$J) Q:$G(ZTSTOP) S ZTREQ="@" Q
12 D ^SRSKILL K SRTN D ^%ZISC W @IOF
13 Q
14LOOP ; break procedure if greater than 65 characters
15 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
16 Q
17ZTSAVE S ZTSAVE("DT")=DT,ZTSAVE("SRW")=SRS,ZTSAVE("SRW(""N"")")=SRW("N"),ZTSAVE("SRSITE*")=""
18HDR ; print heading
19 I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRQ=1 Q
20 S SRZ=1 W:$Y @IOF W !,?20,"* Scheduled Operations for "_SRWARD_" *",!,?30,SRDATE,!!,"Start Time",?12,"Patient",?45,"Operating Room",!,?12,"ID #",?45,"Speciality",! F LINE=1:1:80 W "="
21 Q
22UTL ; set ^TMP("SR",$J)
23 S DFN=$P(^SRF(SRTN,0),"^") D DEM^VADPT S SRNM=VADM(1),SRSSN=VA("PID"),SRWARD=$S($D(^DPT(DFN,.1)):$P(^(.1),"^"),1:""),SRSOP=$P(^SRF(SRTN,"OP"),"^"),SRSS=$P(^SRF(SRTN,0),"^",4) I SRWARD="" D WARD
24 S SROR("N")=$P(^SRS(SROR,0),"^"),SROR("N")=$P(^SC(SROR("N"),0),"^")
25 I SRSS S SRSS=$P(^SRO(137.45,SRSS,0),"^")
26 S Y=SRST D D^DIQ S SRFIND=$F(Y,":"),SRTIME=$S(SRFIND:$E(Y,SRFIND-3,SRFIND+1),1:"")
27 S:SRSS="" SRSS="NOT ENTERED" S SRSS=$P(SRSS,"(")
28 S ^TMP("SR",$J,SRWARD,SROR("N"),SRST)=SRNM_"^"_SRSOP_"^"_SRSS_"^"_SRTIME_"^"_SRSSN
29 Q
30PRINT ; loop through ^TMP and print cases
31 S (SROR,SRWARD,SRST,SRZ)=0
32 F S SRWARD=$O(^TMP("SR",$J,SRWARD)) Q:SRWARD=""!SRQ D:SRZ PAGE Q:SRQ D HDR F S SROR=$O(^TMP("SR",$J,SRWARD,SROR)) Q:SROR=""!SRQ F S SRST=$O(^TMP("SR",$J,SRWARD,SROR,SRST)) Q:'SRST!SRQ D OUT
33 Q
34OUT ; output data
35 I $Y+5>IOSL D PAGE Q:SRQ D HDR Q:SRQ
36 S SR=^TMP("SR",$J,SRWARD,SROR,SRST),SROPER=$P(SR,"^",2) 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(SR,"^",4),?12,$P(SR,"^"),?45,SROR,!,?12,$P(SR,"^",5),?45,$P(SR,"^",3),!,?12,SROPS(1) I $D(SROPS(2)) W !,?12,SROPS(2) I $D(SROPS(3)) W !,?12,SROPS(3)
38 W ! F LINE=1:1:80 W "-"
39 Q
40PAGE I $E(IOST,1)'="P" W !!,"Press RETURN to continue or '^' to quit. " R X:DTIME I '$T!(X="^") S SRQ=1
41 Q
42WARD ; check for scheduled admission
43 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
44 Q:X=1 S SRWARD="OUTPATIENT"
45 Q
Note: See TracBrowser for help on using the repository browser.