25 lines
1.6 KiB
Mathematica
25 lines
1.6 KiB
Mathematica
SRSAVG ;BIR/MAM - CALCULATE AVG OPERATION TIME ;18 JAN 1990 8:00 AM
|
|
;;3.0; Surgery ;**12,13,142**;24 Jun 93
|
|
I 'SRSPEC S SRAVG="" Q
|
|
I 'SRSCPT S SRAVG="" Q
|
|
I '$D(^SRO(131.25,SRSPEC,1,SRSCPT,0)) S SRAVG="" Q
|
|
S SRAV=^SRO(131.25,SRSPEC,1,SRSCPT,0),SRMIN=$P(SRAV,"^",2),SRNUM=$P(SRAV,"^",3),SRAV=SRMIN/SRNUM,SRAV=SRAV\1
|
|
S SRAV1=SRAV#60,SRAV=SRAV\60 S:SRAV1?1N SRAV1=0_SRAV1 S SRAVG=SRAV_":"_SRAV1
|
|
Q
|
|
TASK ; nightly task to update average times
|
|
S X1=DT,X2=-14 D C^%DTC S DATE=X,SRSDATE=DATE-.0001,END=DATE+.9999
|
|
F S SRSDATE=$O(^SRF("AC",SRSDATE)) Q:'SRSDATE!(SRSDATE>END) S SRTN=0 F S SRTN=$O(^SRF("AC",SRSDATE,SRTN)) Q:'SRTN D UPDATE
|
|
K SRTN D ^SRSKILL
|
|
Q
|
|
UPDATE ; update operation times
|
|
S SRSPEC=$P(^SRF(SRTN,0),"^",4),SRSCPT=$P($G(^SRO(136,SRTN,0)),"^",2)
|
|
S SR(.2)=$S($D(^SRF(SRTN,.2)):^(.2),1:""),SRIN=$P(SR(.2),"^",2),SROUT=$P(SR(.2),"^",3)
|
|
I SRSPEC=""!(SRSCPT="")!(SRIN="")!(SROUT="") Q
|
|
S X=SRIN,X1=SROUT,Y=$E(X1_"000",9,10)-$E(X_"000",9,10)*60+$E(X1_"00000",11,12)-$E(X_"00000",11,12),X2=X,X=$P(X,".",1)'=$P(X1,".",1) D ^%DTC:X S SRTIME=X*1440+Y
|
|
I '$D(^SRO(131.25,SRSPEC,0)) K DD,DO S DIC="^SRO(131.25,",DIC(0)="L",DLAYGO=131.25,(X,DINUM)=SRSPEC D FILE^DICN K DIC,DLAYGO
|
|
I '$D(^SRO(131.25,SRSPEC,1)) S ^SRO(131.25,SRSPEC,1,0)="^131.251PA^0^0"
|
|
S $P(^SRO(131.25,SRSPEC,1,0),"^",4)=$P(^SRO(131.25,SRSPEC,1,0),"^",4)+1 I SRSCPT>$P(^SRO(131.25,SRSPEC,1,0),"^",3) S $P(^(0),"^",3)=SRSCPT
|
|
I '$D(^SRO(131.25,SRSPEC,1,SRSCPT,0)) S ^SRO(131.25,SRSPEC,1,SRSCPT,0)=SRSCPT_"^"_SRTIME_"^"_1 Q
|
|
S $P(^SRO(131.25,SRSPEC,1,SRSCPT,0),"^",2)=$P(^SRO(131.25,SRSPEC,1,SRSCPT,0),"^",2)+SRTIME,$P(^(0),"^",3)=$P(^(0),"^",3)+1
|
|
Q
|