Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SROPLSTS

SROPLSTS.m

Go to the documentation of this file.
SROPLSTS ;B'HAM ISC/MAM - LIST OF OPERATIONS BY SERVICE ;09/30/04
 ;;3.0;Surgery;**38,53,50,134,182**;24 Jun 93;Build 49
S1 Q:SRQ  S C=0,SRTS=$P(^SRO(137.45,K,0),"^") I SRUL W ! F LINE=1:1:IOM W "-"
 W !,?1,"*",SRTS,"*" S SRUL=1 Q
SET ; set variables
 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)=""
 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),"^")
 S:SRFST'="" SRFST=$P(^VA(200,SRFST,0),"^") S:SRTWO'="" SRTWO=$P(^VA(200,SRTWO,0),"^")
 S SRABORT=$S($P($G(^SRF(SRTN,30)),"^"):"*ABORTED*",1:"")
OPS 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
 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=""
 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
 D TECH^SROPRIN S SRANES=$S($D(SRTECH):SRTECH,1:"")
 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:"")
PRINT ;
 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)
 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)
 I $D(SROPS(4)) W !,?38,SROPS(4) I $D(SROPS(5)) W !,?38,SROPS(5) I $D(SROPS(6)) W !,?38,SROPS(6)
 Q
HDR ; print heading
 I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRQ=1 Q
 W:$Y @IOF W !,?(132-$L(SRINST)\2),SRINST,?120,"PAGE ",PAGE,!,?58,"SURGICAL SERVICE",?100,"DATE REVIEWED:",!,?52,"LIST OF OPERATIONS BY SERVICE"
 W ?100,"REVIEWED BY:",!,?(132-$L(SRFRTO)\2),SRFRTO,?100,SRPRINT
 W !!,?1,"DATE",?13,"PATIENT",?38,"OPERATION(S)",?90,"PRIMARY SURGEON",?116,"ANESTHESIA",!,"CASE #",?15,"ID#",?90,"FIRST ASSISTANT",?116,"TECHNIQUE",!,?13,"PRIORITY",?90,"SECOND ASSISTANT" W ! F I=1:1:132 W "="
 S PAGE=PAGE+1
 Q
ASK I $E(IOST,1)'="P" W !!,"Press RETURN to continue or '^' to quit.  " R X:DTIME I '$T!(X="^") S SRQ=1 Q
 D HDR Q:SRQ  W:$D(SRTS) !!,?1,"*",SRTS,"*" Q
END W:$E(IOST)="P" @IOF I $D(ZTQUEUED) Q:$G(ZTSTOP)  S ZTREQ="@" Q
 I 'SRQ,($E(IOST)'="P") W !!,"Press RETURN to continue  " R X:DTIME
 D ^SRSKILL K SRTN D ^%ZISC W @IOF
 Q
OTHER ; other operations
 S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SRTN,13,OPER,0),"^"))>250 S SRLONG=0,OPER=999,SROPERS=" ..."
 I SRLONG S SROPERS=$P(^SRF(SRTN,13,OPER,0),"^")
 S SROPER=SROPER_$S(SROPERS=" ...":SROPERS,1:", "_SROPERS)
 Q
LOOP ; break procedure if greater than 50 characters
 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
 Q
1 ; entry when queued
 G:$D(SRZZ) 2 U IO N SRFRTO S (C,K,TC,SRUL)=0 K ^TMP("SR",$J) D HDDT,HDR G:SRQ END
 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)=""
 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
 I 'SRQ D:$Y+8>IOSL ASK G:SRQ END W !!!,"TOTAL OPERATIONS FOR ALL SERVICES: ",TC
 G END
2 ; entry when queued
 U IO N SRFRTO D HDDT,HDR G:SRQ END
 S K=SRT1,(C,SR)=0,N=SRD W !!,?30,"*",SRTS,"*"
 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
 G END
STOT ; print specialty total
 D:$Y+8>IOSL ASK Q:SRQ  W !!,?1,"TOTAL ",SRTS,": ",C
 Q
HDDT ; set up variables common to both reports
 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")
 Q