source: FOIAVistA/tag/r/SURGERY-SR/SRSAVG.m@ 1767

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

initial load of FOIAVistA 6/30/08 version

File size: 1.6 KB
Line 
1SRSAVG ;BIR/MAM - CALCULATE AVG OPERATION TIME ;18 JAN 1990 8:00 AM
2 ;;3.0; Surgery ;**12,13,142**;24 Jun 93
3 I 'SRSPEC S SRAVG="" Q
4 I 'SRSCPT S SRAVG="" Q
5 I '$D(^SRO(131.25,SRSPEC,1,SRSCPT,0)) S SRAVG="" Q
6 S SRAV=^SRO(131.25,SRSPEC,1,SRSCPT,0),SRMIN=$P(SRAV,"^",2),SRNUM=$P(SRAV,"^",3),SRAV=SRMIN/SRNUM,SRAV=SRAV\1
7 S SRAV1=SRAV#60,SRAV=SRAV\60 S:SRAV1?1N SRAV1=0_SRAV1 S SRAVG=SRAV_":"_SRAV1
8 Q
9TASK ; nightly task to update average times
10 S X1=DT,X2=-14 D C^%DTC S DATE=X,SRSDATE=DATE-.0001,END=DATE+.9999
11 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
12 K SRTN D ^SRSKILL
13 Q
14UPDATE ; update operation times
15 S SRSPEC=$P(^SRF(SRTN,0),"^",4),SRSCPT=$P($G(^SRO(136,SRTN,0)),"^",2)
16 S SR(.2)=$S($D(^SRF(SRTN,.2)):^(.2),1:""),SRIN=$P(SR(.2),"^",2),SROUT=$P(SR(.2),"^",3)
17 I SRSPEC=""!(SRSCPT="")!(SRIN="")!(SROUT="") Q
18 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
19 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
20 I '$D(^SRO(131.25,SRSPEC,1)) S ^SRO(131.25,SRSPEC,1,0)="^131.251PA^0^0"
21 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
22 I '$D(^SRO(131.25,SRSPEC,1,SRSCPT,0)) S ^SRO(131.25,SRSPEC,1,SRSCPT,0)=SRSCPT_"^"_SRTIME_"^"_1 Q
23 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
24 Q
Note: See TracBrowser for help on using the repository browser.