source: WorldVistAEHR/trunk/r/SURGERY-SR/SRSCHAP.m@ 1042

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

initial load of WorldVistAEHR

File size: 2.7 KB
RevLine 
[613]1SRSCHAP ;B'HAM ISC/MAM - CHAPLAIN'S LIST OF SCHEDULED CASES ; [ 02/19/98 12:29 PM ]
2 ;;3.0; Surgery ;**77**;24 Jun 93
3DT S SRSOUT=0,%DT="AEFX",%DT("A")="List Scheduled Operations for which date ? " D ^%DT G:Y<1 END S SRSDATE=Y
4 K IOP,%ZIS,POP,IO("Q") S %ZIS("A")="Print to device: ",%ZIS="Q" D ^%ZIS G:POP END I $D(IO("Q")) K IO("Q") S ZTSAVE("SRSDATE")=SRSDATE,ZTDESC="SCHEDULED OPERATIONS",ZTRTN="EN^SRSCHAP" D ^%ZTLOAD G END
5EN ; entry when queued
6 U IO S (SROR,SRSOUT)=0 F S SROR=$O(^SRF("AOR",SROR)) Q:'SROR!(SRSOUT) S SRTN=0 F S SRTN=$O(^SRF("AOR",SROR,SRSDATE,SRTN)) Q:'SRTN!(SRSOUT) S SRST=$P($G(^SRF(SRTN,31)),"^",4) I SRST D UTIL
7 D PRINT W:$E(IOST)="P" @IOF I $D(ZTQUEUED) K ^TMP("SR",$J) Q:$G(ZTSTOP) S ZTREQ="@" Q
8END ;
9 S SRPRINT=0 I $E(IOST)="P" S SRPRINT=1
10 I 'SRSOUT,'SRPRINT W !!,"Press RETURN to continue " R X:DTIME
11 K SRTN D ^%ZISC,^SRSKILL W @IOF
12 Q
13LOOP ; break procedure if greater than 65 characters
14 S SROP(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROP(M))+$L(MM)'<65 S SROP(M)=SROP(M)_MM_" ",SROPER=MMM
15 Q
16PAGE I SRHDR,$E(IOST,1)'="P" W !!,"Press RETURN to continue or '^' to quit. " R X:DTIME I '$T!(X="^") S SRSOUT=1 Q
17HDR ; print heading
18 I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
19 W:$Y @IOF W !,?20,"* Scheduled Operations for "_SREL_" *",!,?30,SRDATE,!!,"Start Time",?13,"Patient",?43,"Surgical Specialty",?67,"Ward Location",! F LINE=1:1:80 W "="
20 Q
21UTIL ; set ^TMP("SR")
22 S DFN=$P(^SRF(SRTN,0),"^") D DEM^VADPT S SREL=$P($G(VADM(9)),"^",2) S:SREL="" SREL="UNKNOWN/NO PREFERENCE"
23 S ^TMP("SR",$J,SREL,SRST,SRTN)=""
24 Q
25PRINT ; loop through ^TMP and print cases
26 S (SREL,SRHDR)=0,Y=SRSDATE X ^DD("DD") S SRDATE=Y
27 F S SREL=$O(^TMP("SR",$J,SREL)) Q:SREL=""!(SRSOUT) D:SRHDR PAGE Q:SRSOUT S SRST=0 F S SRST=$O(^TMP("SR",$J,SREL,SRST)) Q:'SRST!(SRSOUT) S SRTN=0 F S SRTN=$O(^TMP("SR",$J,SREL,SRST,SRTN)) Q:'SRTN!(SRSOUT) D OUT
28 Q
29OUT ; output data
30 I 'SRHDR D HDR Q:SRSOUT S SRHDR=1
31 I $Y+5>IOSL D PAGE I SRSOUT Q
32 S SRF(0)=^SRF(SRTN,0),DFN=$P(SRF(0),"^") D DEM^VADPT S SRNAME=VADM(1)
33 S SRSS=$P(SRF(0),"^",4) I SRSS S SRSS=$P(^SRO(137.45,SRSS,0),"^")
34 S:SRSS="" SRSS="NOT ENTERED" S SRSS=$P(SRSS,"(")
35 S SRWARD=$P($G(^DPT(DFN,.1)),"^") I SRWARD="" D WARD
36 S Y=SRST D D^DIQ S SRSST=$P(Y,"@",2)
37 S SROPER=$P(^SRF(SRTN,"OP"),"^") K SROP,MM,MMM S:$L(SROPER)<65 SROP(1)=SROPER I $L(SROPER)>64 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
38 W !,SRSST,?12,SRNAME,?43,SRSS,?67,SRWARD,!,?12,SROP(1) I $D(SROP(2)) W !,?12,SROP(2) I $D(SROP(3)) W !,?12,SROP(3)
39 W ! F LINE=1:1:80 W "-"
40 Q
41WARD ; check for scheduled admission
42 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
43 Q:X=1 S SRWARD="OUTPATIENT"
44 Q
Note: See TracBrowser for help on using the repository browser.