SRSUTL2 ;B'HAM ISC/MAM - MISC. UTILITIES ; [ 04/28/97 1:40 PM ]
;;3.0;Surgery;**34,67,107,211**;24 Jun 93;Build 3
;
; Reference to ^TMP("CSLSUR1" supported by DBIA #3498
;
CANCC ; cancel concurrent cases
I SRSOUT G NOCC
S SRDEAD=0 I $P(^SRO(135,SRSCAN,0),"^",2)="D" S (SRBOTH,SRDEAD)=1 G UPDTCC
W !!,"There is a concurrent case associated with this operation. Do you want to",!,"cancel it also ? YES// " R SRBOTH:DTIME I '$T S SRBOTH="^"
S SRBOTH=$E(SRBOTH) S:SRBOTH="" SRBOTH="Y"
D:SRBOTH="^" NOCC Q:SRBOTH="^" I "YyNn"'[SRBOTH W !!,"If you want to cancel both cases, enter 'YES'. If you answer 'NO', the cases",!,"will no longer be associated with each other" G CANCC
I "Yy"[SRBOTH S SRBOTH=1
I SRBOTH'=1 D NOCC
UPDTCC S SRSCC=1 Q:SRBOTH'=1 S SRTN=$P(^SRF(SRTOLD,"CON"),"^"),DR="17////"_$P(^SRF(SRTOLD,30),"^")_";18////"_SRSCAN_";.02///@",DIE=130,DA=SRTN D ^DIE
D ^SRSCG I $D(SRTNEW) S SRCON=SRTNEW,SRTOLD=SRTN
S SRSDOC=$P(^SRF(SRTN,.1),"^",4),SRSOP=$P(^SRF(SRTN,"OP"),"^"),$P(^SRF(SRTN,31),"^",4)="",$P(^(31),"^",5)=""
Q
NOCC ; no longer concurrent cases
S DA=$P(^SRF(SRTN,"CON"),"^"),DIE=130,DR="35///@" D ^DIE S SROERR=$P(^SRF(SRTN,"CON"),"^") D ^SROERR0 ;SR*3*211
S DA=SRTN,DIE=130,DR="35///@" D ^DIE S SROERR=SRTN,^TMP("CSLSUR1",$J)="" D ^SROERR0 ;SR*3*211
I $D(SRTNEW) S DA=SRTNEW D ^DIE S SROERR=SRTNEW,^TMP("CSLSUR1",$J)="" D ^SROERR0
Q
TIMES ; calculated times
S Z1=X1,Z2=X2 D ^%DTC S Z0=X,X1=Z1-(Z1\1)*10000,X2=Z2-(Z2\1)*10000,Z0=X1\100-(X2\100)+(Z0*24),X1=X1-(X1\100*100),X2=X2-(X2\100*100),X=Z0*60+X1-X2 K Z0,Z1,Z2,X1,X2
Q
MINS ; difference between 2 times in minutes
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 X=X*1440+Y
Q
CAN ; scheduled ?
I $P($G(^SRF(SRTN,31)),"^",4)="" W !!,"This case has not been scheduled."
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSRSUTL2 1895 printed Dec 13, 2024@02:47:53 Page 2
SRSUTL2 ;B'HAM ISC/MAM - MISC. UTILITIES ; [ 04/28/97 1:40 PM ]
+1 ;;3.0;Surgery;**34,67,107,211**;24 Jun 93;Build 3
+2 ;
+3 ; Reference to ^TMP("CSLSUR1" supported by DBIA #3498
+4 ;
CANCC ; cancel concurrent cases
+1 IF SRSOUT
GOTO NOCC
+2 SET SRDEAD=0
IF $PIECE(^SRO(135,SRSCAN,0),"^",2)="D"
SET (SRBOTH,SRDEAD)=1
GOTO UPDTCC
+3 WRITE !!,"There is a concurrent case associated with this operation. Do you want to",!,"cancel it also ? YES// "
READ SRBOTH:DTIME
IF '$TEST
SET SRBOTH="^"
+4 SET SRBOTH=$EXTRACT(SRBOTH)
if SRBOTH=""
SET SRBOTH="Y"
+5 if SRBOTH="^"
DO NOCC
if SRBOTH="^"
QUIT
IF "YyNn"'[SRBOTH
WRITE !!,"If you want to cancel both cases, enter 'YES'. If you answer 'NO', the cases",!,"will no longer be associated with each other"
GOTO CANCC
+6 IF "Yy"[SRBOTH
SET SRBOTH=1
+7 IF SRBOTH'=1
DO NOCC
UPDTCC SET SRSCC=1
if SRBOTH'=1
QUIT
SET SRTN=$PIECE(^SRF(SRTOLD,"CON"),"^")
SET DR="17////"_$PIECE(^SRF(SRTOLD,30),"^")_";18////"_SRSCAN_";.02///@"
SET DIE=130
SET DA=SRTN
DO ^DIE
+1 DO ^SRSCG
IF $DATA(SRTNEW)
SET SRCON=SRTNEW
SET SRTOLD=SRTN
+2 SET SRSDOC=$PIECE(^SRF(SRTN,.1),"^",4)
SET SRSOP=$PIECE(^SRF(SRTN,"OP"),"^")
SET $PIECE(^SRF(SRTN,31),"^",4)=""
SET $PIECE(^(31),"^",5)=""
+3 QUIT
NOCC ; no longer concurrent cases
+1 ;SR*3*211
SET DA=$PIECE(^SRF(SRTN,"CON"),"^")
SET DIE=130
SET DR="35///@"
DO ^DIE
SET SROERR=$PIECE(^SRF(SRTN,"CON"),"^")
DO ^SROERR0
+2 ;SR*3*211
SET DA=SRTN
SET DIE=130
SET DR="35///@"
DO ^DIE
SET SROERR=SRTN
SET ^TMP("CSLSUR1",$JOB)=""
DO ^SROERR0
+3 IF $DATA(SRTNEW)
SET DA=SRTNEW
DO ^DIE
SET SROERR=SRTNEW
SET ^TMP("CSLSUR1",$JOB)=""
DO ^SROERR0
+4 QUIT
TIMES ; calculated times
+1 SET Z1=X1
SET Z2=X2
DO ^%DTC
SET Z0=X
SET X1=Z1-(Z1\1)*10000
SET X2=Z2-(Z2\1)*10000
SET Z0=X1\100-(X2\100)+(Z0*24)
SET X1=X1-(X1\100*100)
SET X2=X2-(X2\100*100)
SET X=Z0*60+X1-X2
KILL Z0,Z1,Z2,X1,X2
+2 QUIT
MINS ; difference between 2 times in minutes
+1 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 X=X*1440+Y
+2 QUIT
CAN ; scheduled ?
+1 IF $PIECE($GET(^SRF(SRTN,31)),"^",4)=""
WRITE !!,"This case has not been scheduled."
+2 QUIT