VistA-FOIAVistA/r/SURGERY-SR/SROPAC0.m

38 lines
2.3 KiB
Mathematica

SROPAC0 ;B'HAM ISC/MAM - DAILY ACTIVITY REPORT ; [ 07/27/98 2:33 PM ]
;;3.0; Surgery ;**34,50**;24 Jun 93
S SRSOUT=0 D HDR^SROPAC1
S SROR=0 F S SROR=$O(^TMP("SRACT",$J,SROR)) Q:SROR=""!(SRSOUT) D ROOM S SRSDATE=0 F S SRSDATE=$O(^TMP("SRACT",$J,SROR,SRSDATE)) Q:'SRSDATE!(SRSOUT) D CASE
I '$D(^TMP("SRACT",$J)) W $$NODATA^SROUTL0()
Q
CASE S SRTN=0 F S SRTN=$O(^TMP("SRACT",$J,SROR,SRSDATE,SRTN)) Q:'SRTN!(SRSOUT) D SET
Q
SET ;
S DFN=$P(^SRF(SRTN,0),"^") D DEM^VADPT
S SRNM=VADM(1) I $L(SRNM)>23 S SRNM=$P(SRNM,",")_","_$E($P(SRNM,",",2))
K SRSLOC I $D(^DPT(DFN,.1)) S SRSLOC=$P(^(.1),"^") I $D(^DPT(DFN,.101)) S SRSLOC=SRSLOC_" "_$P(^(.101),"^")
I '$D(SRSLOC) S SRSLOC="OUTPATIENT"
S (SRSUR,SRFST,SRATT,SRAN1,SRAN2)="",SR(.1)=$S($D(^SRF(SRTN,.1)):^(.1),1:""),SR(.3)=$S($D(^SRF(SRTN,.3)):^(.3),1:"")
S SRSUR=$P(SR(.1),"^",4),SRATT=$P(SR(.1),"^",13),SRFST=$P(SR(.1),"^",5),SRAN1=$P(SR(.3),"^",4),SRAN2=$P(SR(.3),"^") 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:SRAN1'="" SRAN1=$P(^VA(200,SRAN1,0),"^") S:SRAN2'="" SRAN2=$P(^VA(200,SRAN2,0),"^")
F USER="SRSUR","SRFST","SRATT","SRAN1","SRAN2" S:'$D(@USER) @USER="" I @USER]"" S @USER=$P(@USER,",")_","_$E($P(@USER,",",2))
S SRDIAG=$S($D(^SRF(SRTN,34)):$P(^(34),"^"),1:"")
OPS S SROPER=$P(^SRF(SRTN,"OP"),"^"),OPER=0 F I=0:0 S OPER=$O(^SRF(SRTN,13,OPER)) Q:OPER="" D OTHER
K SROP,MM,MMM S:$L(SROPER)<50 SROP(1)=SROPER I $L(SROPER)>49 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
S SRINTIME=$P(^SRF(SRTN,.2),"^",10),SROUTIME=$P(^(.2),"^",12)
S Y=SRINTIME D D^DIQ S SRINTIME=$E(SRINTIME,4,5)_"/"_$E(SRINTIME,6,7)_" "_$P(Y,"@",2)
I 'SROUTIME S SROUTIME="-----"
I SROUTIME S Y=SROUTIME D D^DIQ S SROUTIME=$E(SROUTIME,4,5)_"/"_$E(SROUTIME,6,7)_" "_$P(Y,"@",2)
D ^SROPAC1
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 SROP(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROP(M))+$L(MM)'<50 S SROP(M)=SROP(M)_MM_" ",SROPER=MMM
Q
ROOM I $Y+9>IOSL D PAGE^SROPAC1 Q
W !!,"OPERATING ROOM: "_SROR,!
Q