SROPOST2 ;B'HAM ISC/MAM - POST INIT TO CONVERT OPERATION TIMES ; 18 JAN 1990 3:40 PM
;;3.0; Surgery ;**12**;24 Jun 93
I 'SRVER Q
B W !!,"Re-indexing 'B' cross references in site configureable files...."
F SRFILE=131.01,131.9,132,132.05,132.4,133.4,133.6,133.7,135,135.1,135.2,135.3,135.4,138 K ^SRO(SRFILE,"B"),DIK S DIK="^SRO("_SRFILE_",",DIK(1)=".01^B" D ENALL^DIK K DIK
K SRFILE
I $O(^SRO(131.25,0)) Q
W !!,"Version 3.0 of the Surgery software will estimate the average length",!,"of time for a procedure (using CPT code) based on Surgical Specialty ",!,"instead of the individual surgeon. The data in the Surgeon's Operation Times"
W !,"file will be converted and stored in the Operation Times file.",!!
AGAIN K ^TMP("SR",$J) S X1=DT,X2=-12 D C^%DTC S SRSTOP=X
S SRTN=0 F S SRTN=$O(^SRF(SRTN)) Q:'SRTN I $D(^SRF(SRTN,0)) S SRSDATE=$E($P($G(^SRF(SRTN,0)),"^",9),1,7) I SRSDATE,SRSDATE<SRSTOP D UTIL
S SERVICE=0 F S SERVICE=$O(^TMP("SR",$J,SERVICE)) Q:'SERVICE D STUFF
K CPT,I,MIN,SERVICE,SRSDATE,SRSTOP,SRTN,X,X1,^TMP("SR",$J)
Q
UTIL ; find completed cases
I '$D(^SRF(SRTN,.2)) Q
I $P(^SRF(SRTN,0),"^",4)="" Q
S X=$P(^SRF(SRTN,.2),"^",2),X1=$P(^SRF(SRTN,.2),"^",3) Q:X="" I X1="" Q
S CPT=$P(^SRF(SRTN,"OP"),"^",2) I CPT="" Q
MIN S 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 MIN=X*1440+Y
S SERVICE=$P(^SRF(SRTN,0),"^",4) I '$D(^TMP("SR",$J,SERVICE,CPT)) S ^TMP("SR",$J,SERVICE,CPT)=MIN_"^"_1 Q
S $P(^TMP("SR",$J,SERVICE,CPT),"^",2)=$P(^TMP("SR",$J,SERVICE,CPT),"^",2)+1
S $P(^TMP("SR",$J,SERVICE,CPT),"^")=$P(^TMP("SR",$J,SERVICE,CPT),"^")+MIN
Q
STUFF ; stuff entries in file 131.25
I '$D(^SRO(131.25,SERVICE,0)) K DD,DO S DIC="^SRO(131.25,",DIC(0)="L",DLAYGO=131.25,(X,DINUM)=SERVICE D FILE^DICN K DIC,DLAYGO,DINUM
S ^SRO(131.25,SERVICE,1,0)="^131.251PA^0^0"
S CPT=0 F I=0:0 S CPT=$O(^TMP("SR",$J,SERVICE,CPT)) Q:'CPT D CPT
Q
CPT ; stuff CPT info
S ^SRO(131.25,SERVICE,1,CPT,0)=CPT_"^"_^TMP("SR",$J,SERVICE,CPT)
S $P(^SRO(131.25,SERVICE,1,0),"^",3)=CPT,$P(^(0),"^",4)=$P(^(0),"^",4)+1
Q
NEW ; create entry in Surgery Site Parameters file
K DIC,DD,DO,DA,DINUM S DIC="^SRO(133,",DIC(0)="L",DLAYGO=133,X=SRINST D FILE^DICN K DIC,DD,DO,DA,DLAYGO
Q
TIMES ; convert operation times - SR*3*12
D WAIT^DICD K ^SRO(131.25) S ^SRO(131.25,0)="OPERATION TIMES^131.25P^^"
D AGAIN W !!,"Finished"
Q
SROPOST2 ;B'HAM ISC/MAM - POST INIT TO CONVERT OPERATION TIMES ; 18 JAN 1990 3:40 PM
+1 ;;3.0; Surgery ;**12**;24 Jun 93
+2 IF 'SRVER
QUIT
B WRITE !!,"Re-indexing 'B' cross references in site configureable files...."
+1 FOR SRFILE=131.01,131.9,132,132.05,132.4,133.4,133.6,133.7,135,135.1,135.2,135.3,135.4,138
KILL ^SRO(SRFILE,"B"),DIK
SET DIK="^SRO("_SRFILE_","
SET DIK(1)=".01^B"
DO ENALL^DIK
KILL DIK
+2 KILL SRFILE
+3 IF $ORDER(^SRO(131.25,0))
QUIT
+4 WRITE !!,"Version 3.0 of the Surgery software will estimate the average length",!,"of time for a procedure (using CPT code) based on Surgical Specialty ",!,"instead of the individual surgeon. The data in the Surgeon's Operation Times"
+5 WRITE !,"file will be converted and stored in the Operation Times file.",!!
AGAIN KILL ^TMP("SR",$JOB)
SET X1=DT
SET X2=-12
DO C^%DTC
SET SRSTOP=X
+1 SET SRTN=0
FOR
SET SRTN=$ORDER(^SRF(SRTN))
IF 'SRTN
QUIT
IF $DATA(^SRF(SRTN,0))
SET SRSDATE=$EXTRACT($PIECE($GET(^SRF(SRTN,0)),"^",9),1,7)
IF SRSDATE
IF SRSDATE<SRSTOP
DO UTIL
+2 SET SERVICE=0
FOR
SET SERVICE=$ORDER(^TMP("SR",$JOB,SERVICE))
IF 'SERVICE
QUIT
DO STUFF
+3 KILL CPT,I,MIN,SERVICE,SRSDATE,SRSTOP,SRTN,X,X1,^TMP("SR",$JOB)
+4 QUIT
UTIL ; find completed cases
+1 IF '$DATA(^SRF(SRTN,.2))
QUIT
+2 IF $PIECE(^SRF(SRTN,0),"^",4)=""
QUIT
+3 SET X=$PIECE(^SRF(SRTN,.2),"^",2)
SET X1=$PIECE(^SRF(SRTN,.2),"^",3)
IF X=""
QUIT
IF X1=""
QUIT
+4 SET CPT=$PIECE(^SRF(SRTN,"OP"),"^",2)
IF CPT=""
QUIT
MIN SET Y=$EXTRACT(X1_"000",9,10)-$EXTRACT(X_"000",9,10)*60+$EXTRACT(X1_"00000",11,12)-$EXTRACT(X_"00000",11,12)
SET X2=X
SET X=$PIECE(X,".",1)'=$PIECE(X1,".",1)
IF X
DO ^%DTC
SET MIN=X*1440+Y
+1 SET SERVICE=$PIECE(^SRF(SRTN,0),"^",4)
IF '$DATA(^TMP("SR",$JOB,SERVICE,CPT))
SET ^TMP("SR",$JOB,SERVICE,CPT)=MIN_"^"_1
QUIT
+2 SET $PIECE(^TMP("SR",$JOB,SERVICE,CPT),"^",2)=$PIECE(^TMP("SR",$JOB,SERVICE,CPT),"^",2)+1
+3 SET $PIECE(^TMP("SR",$JOB,SERVICE,CPT),"^")=$PIECE(^TMP("SR",$JOB,SERVICE,CPT),"^")+MIN
+4 QUIT
STUFF ; stuff entries in file 131.25
+1 IF '$DATA(^SRO(131.25,SERVICE,0))
KILL DD,DO
SET DIC="^SRO(131.25,"
SET DIC(0)="L"
SET DLAYGO=131.25
SET (X,DINUM)=SERVICE
DO FILE^DICN
KILL DIC,DLAYGO,DINUM
+2 SET ^SRO(131.25,SERVICE,1,0)="^131.251PA^0^0"
+3 SET CPT=0
FOR I=0:0
SET CPT=$ORDER(^TMP("SR",$JOB,SERVICE,CPT))
IF 'CPT
QUIT
DO CPT
+4 QUIT
CPT ; stuff CPT info
+1 SET ^SRO(131.25,SERVICE,1,CPT,0)=CPT_"^"_^TMP("SR",$JOB,SERVICE,CPT)
+2 SET $PIECE(^SRO(131.25,SERVICE,1,0),"^",3)=CPT
SET $PIECE(^(0),"^",4)=$PIECE(^(0),"^",4)+1
+3 QUIT
NEW ; create entry in Surgery Site Parameters file
+1 KILL DIC,DD,DO,DA,DINUM
SET DIC="^SRO(133,"
SET DIC(0)="L"
SET DLAYGO=133
SET X=SRINST
DO FILE^DICN
KILL DIC,DD,DO,DA,DLAYGO
+2 QUIT
TIMES ; convert operation times - SR*3*12
+1 DO WAIT^DICD
KILL ^SRO(131.25)
SET ^SRO(131.25,0)="OPERATION TIMES^131.25P^^"
+2 DO AGAIN
WRITE !!,"Finished"
+3 QUIT