source: WorldVistAEHR/trunk/r/SURGERY-SR/SROPLSTS.m@ 1211

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

initial load of WorldVistAEHR

File size: 4.0 KB
Line 
1SROPLSTS ;B'HAM ISC/MAM - LIST OF OPERATIONS BY SERVICE ;09/30/04
2 ;;3.0; Surgery ;**38,53,50,134**;24 Jun 93
3S1 Q:SRQ S C=0,SRTS=$P(^SRO(137.45,K,0),"^") I SRUL W ! F LINE=1:1:IOM W "-"
4 W !,?1,"*",SRTS,"*" S SRUL=1 Q
5SET ; set variables
6 K SROP S S(0)=^SRF(SRTN,0),DFN=$P(S(0),"^") D DEM^VADPT S SRNM=VADM(1),SRSSN=VA("PID"),SRDT=$P(S(0),"^",9),SROD=$P(S(0),"^",9),(SRSUR,SRATT,SRFST,SRTWO)=""
7 S:$D(^SRF(SRTN,.1)) S(.1)=^(.1),SRSUR=$P(S(.1),"^",4),SRATT=$P(S(.1),"^",13),SRFST=$P(S(.1),"^",5),SRTWO=$P(S(.1),"^",6) S:SRSUR'="" SRSUR=$P(^VA(200,SRSUR,0),"^") S:SRATT'="" SRATT=$P(^VA(200,SRATT,0),"^")
8 S:SRFST'="" SRFST=$P(^VA(200,SRFST,0),"^") S:SRTWO'="" SRTWO=$P(^VA(200,SRTWO,0),"^")
9 S SRABORT=$S($P($G(^SRF(SRTN,30)),"^"):"*ABORTED*",1:"")
10OPS K SROPERS S SROPER=$P(^SRF(SRTN,"OP"),"^"),OPER=0 F I=0:0 S OPER=$O(^SRF(SRTN,13,OPER)) Q:OPER="" D OTHER
11 K SROPS,MM,MMM S:$L(SROPER)<50 SROPS(1)=SROPER I $L(SROPER)>49 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
12 S SROT=0 I $D(^SRF(SRTN,.2)),$P(^(.2),"^",2)]"",$P(^(.2),"^",3)]"" S X=$P(^SRF(SRTN,.2),"^",2),X1=$P(^(.2),"^",3) D MINS^SRSUTL2 S SROT=X
13 D TECH^SROPRIN S SRANES=$S($D(SRTECH):SRTECH,1:"")
14 S A=$P(S(0),"^",10),SRTYPE=$S(A="EL":"ELECTIVE",A="EM":"EMERGENCY",A="A":"ADD ON, NONEMERGENT",A="S":"STANDBY",A="U":"URGENT, ADD TODAY",1:"")
15PRINT ;
16 S Z=0 D:$Y+8>IOSL ASK Q:SRQ W !!,?1,$E(SROD,4,5)_"/"_$E(SROD,6,7)_"/"_$E(SROD,2,3),?13,$E(SRNM,1,26),?38,SROPS(1)
17 W ?90,$E(SRSUR,1,23),?114,$E(SRANES,1,14),!,?1,SRTN,?13,VA("PID") W:$D(SROPS(2)) ?38,SROPS(2) W ?90,$E(SRFST,1,23),?114,"OP TIME: ",SROT," MIN.",!,SRABORT,?13,SRTYPE W:$D(SROPS(3)) ?38,SROPS(3) W ?90,$E(SRTWO,1,23)
18 I $D(SROPS(4)) W !,?38,SROPS(4) I $D(SROPS(5)) W !,?38,SROPS(5) I $D(SROPS(6)) W !,?38,SROPS(6)
19 Q
20HDR ; print heading
21 I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRQ=1 Q
22 W:$Y @IOF W !,?(132-$L(SRINST)\2),SRINST,?120,"PAGE ",PAGE,!,?58,"SURGICAL SERVICE",?100,"DATE REVIEWED:",!,?52,"LIST OF OPERATIONS BY SERVICE"
23 W ?100,"REVIEWED BY:",!,?(132-$L(SRFRTO)\2),SRFRTO,?100,SRPRINT
24 W !!,?1,"DATE",?13,"PATIENT",?38,"OPERATION(S)",?90,"SURGEON",?116,"ANESTHESIA",!,"CASE #",?15,"ID#",?90,"FIRST ASSISTANT",?116,"TECHNIQUE",!,?13,"PRIORITY",?90,"SECOND ASSISTANT" W ! F I=1:1:132 W "="
25 S PAGE=PAGE+1
26 Q
27ASK I $E(IOST,1)'="P" W !!,"Press RETURN to continue or '^' to quit. " R X:DTIME I '$T!(X="^") S SRQ=1 Q
28 D HDR Q:SRQ W:$D(SRTS) !!,?1,"*",SRTS,"*" Q
29END W:$E(IOST)="P" @IOF I $D(ZTQUEUED) Q:$G(ZTSTOP) S ZTREQ="@" Q
30 I 'SRQ,($E(IOST)'="P") W !!,"Press RETURN to continue " R X:DTIME
31 D ^SRSKILL K SRTN D ^%ZISC W @IOF
32 Q
33OTHER ; other operations
34 S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SRTN,13,OPER,0),"^"))>250 S SRLONG=0,OPER=999,SROPERS=" ..."
35 I SRLONG S SROPERS=$P(^SRF(SRTN,13,OPER,0),"^")
36 S SROPER=SROPER_$S(SROPERS=" ...":SROPERS,1:", "_SROPERS)
37 Q
38LOOP ; break procedure if greater than 50 characters
39 S SROPS(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROPS(M))+$L(MM)'<50 S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
40 Q
411 ; entry when queued
42 G:$D(SRZZ) 2 U IO N SRFRTO S (C,K,TC,SRUL)=0 K ^TMP("SR",$J) D HDDT,HDR G:SRQ END
43 F S K=$O(^SRF("ASP",K)) Q:'K!SRQ S N=SRD F S N=$O(^SRF("ASP",K,N)) Q:SRQ!'N!(N>SRED) S SR=0 F S SR=$O(^SRF("ASP",K,N,SR)) Q:'SR!SRQ I $P($G(^SRF(SR,.2)),"^",12),$$DIV^SROUTL0(SR) S ^TMP("SR",$J,K,SR)=""
44 S K=0 F S K=$O(^TMP("SR",$J,K)) Q:'K!SRQ D S1 S SR=0 F S SR=$O(^TMP("SR",$J,K,SR)) D:'SR STOT Q:'SR!SRQ S C=C+1,TC=TC+1,SRTN=SR D SET
45 I 'SRQ D:$Y+8>IOSL ASK G:SRQ END W !!!,"TOTAL OPERATIONS FOR ALL SERVICES: ",TC
46 G END
472 ; entry when queued
48 U IO N SRFRTO D HDDT,HDR G:SRQ END
49 S K=SRT1,(C,SR)=0,N=SRD W !!,?30,"*",SRTS,"*"
50 F S N=$O(^SRF("ASP",K,N)) D:'N!(N>SRED) STOT Q:'N!(N>SRED)!SRQ F S SR=$O(^SRF("ASP",K,N,SR)) Q:'SR!SRQ I $P($G(^SRF(SR,.2)),"^",12),$$DIV^SROUTL0(SR) S SRTN=SR,(C,TC)=C+1 D SET
51 G END
52STOT ; print specialty total
53 D:$Y+8>IOSL ASK Q:SRQ W !!,?1,"TOTAL ",SRTS,": ",C
54 Q
55HDDT ; set up variables common to both reports
56 S PAGE=1,SRQ=0,Y=DT X ^DD("DD") S SRPRINT="DATE PRINTED: "_Y S Y=SRSD X ^DD("DD") S SRFRTO="FROM: "_Y_" TO: ",Y=SRED X ^DD("DD") S SRFRTO=SRFRTO_Y,SRINST=SRSITE("SITE")
57 Q
Note: See TracBrowser for help on using the repository browser.