SRSUPC ;B'HAM ISC/MAM - UPDATE CANCEL REASON & DATE; [ 01/31/01 8:59 AM ]
;;3.0; Surgery ;**100**;24 Jun 93
PAT ;
W @IOF S DIC=2,DIC(0)="QEAMZ",DIC("A")="Update Cancellation Information for which Patient: " D ^DIC K DIC G:Y'>0 END S DFN=+Y
D DEM^VADPT S SRNAME=VADM(1)
W ! S (SROP,CNT)=0 F S SROP=$O(^SRF("B",DFN,SROP)) Q:'SROP S SRSDATE=$P(^SRF(SROP,0),"^",9) D LIST
I '$D(SRCASE(1)) W !!,"There are no cancelled cases for "_SRNAME_"." G END
OPT R !!!,"Select Operation: ",OPT:DTIME I '$T!("^"[OPT) K SRTN G END
I OPT["?"!('$D(SRCASE(OPT))) W !!,"Enter the number of the desired operation" G OPT
S SROP=SRCASE(OPT),SRSDATE=$P(^SRF(SROP,0),"^",9),SRSDATE=$E(SRSDATE,4,5)_"-"_$E(SRSDATE,6,7)_"-"_$E(SRSDATE,2,3)
W @IOF,!,VADM(1),?32,VA("PID"),?50,"Case # ",SROP,!!,SRSDATE D CASE W !!
I $$LOCK^SROUTL(SROP) S DIE=130,DA=SRCASE(OPT),DR="17T;18T;67T" D ^DIE,UNLOCK^SROUTL(SROP)
END W !!,"Press RETURN to continue " R X:DTIME
W @IOF K SROP D ^SRSKILL
Q
LOOP ; break operation name if longer than 65 characters
S SROPS(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROPS(M))+$L(MM)'<65 S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
Q
OTHER ; other operations
S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SROP,13,SROTHER,0),"^"))>235 S SRLONG=0,SROTHER=999,SROPERS=" ..."
I SRLONG S SROPERS=$P(^SRF(SROP,13,SROTHER,0),"^")
S SROPER=SROPER_$S(SROPERS=" ...":SROPERS,1:", "_SROPERS)
Q
LIST ;
S SRCAN=0
I $D(^SRF(SROP,30)),$P(^(30),"^")'="" S SRCAN=1
I $D(^SRF(SROP,31)),$P(^(31),"^",8)'="" S SRCAN=1
I 'SRCAN Q
S CNT=CNT+1,SRCASE(CNT)=SROP
W !,CNT_". "_$E(SRSDATE,4,5)_"-"_$E(SRSDATE,6,7)_"-"_$E(SRSDATE,2,3)
CASE S SROPER=$P(^SRF(SROP,"OP"),"^") I $O(^SRF(SROP,13,0)) S SROTHER=0 F I=0:0 S SROTHER=$O(^SRF(SROP,13,SROTHER)) Q:'SROTHER D OTHER
D ^SROP1 K SROPS,MM,MMM S:$L(SROPER)<65 SROPS(1)=SROPER I $L(SROPER)>64 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
W ?14,SROPS(1) I $D(SROPS(2)) W !,?14,SROPS(2) I $D(SROPS(3)) W !,?14,SROPS(3) W:$D(SROPS(4)) !,?14,SROPS(4) W:$D(SROPS(5)) !,?14,SROPS(5)
SRSUPC ;B'HAM ISC/MAM - UPDATE CANCEL REASON & DATE; [ 01/31/01 8:59 AM ]
+1 ;;3.0; Surgery ;**100**;24 Jun 93
PAT ;
+1 WRITE @IOF
SET DIC=2
SET DIC(0)="QEAMZ"
SET DIC("A")="Update Cancellation Information for which Patient: "
DO ^DIC
KILL DIC
IF Y'>0
GOTO END
SET DFN=+Y
+2 DO DEM^VADPT
SET SRNAME=VADM(1)
+3 WRITE !
SET (SROP,CNT)=0
FOR
SET SROP=$ORDER(^SRF("B",DFN,SROP))
IF 'SROP
QUIT
SET SRSDATE=$PIECE(^SRF(SROP,0),"^",9)
DO LIST
+4 IF '$DATA(SRCASE(1))
WRITE !!,"There are no cancelled cases for "_SRNAME_"."
GOTO END
OPT READ !!!,"Select Operation: ",OPT:DTIME
IF '$TEST!("^"[OPT)
KILL SRTN
GOTO END
+1 IF OPT["?"!('$DATA(SRCASE(OPT)))
WRITE !!,"Enter the number of the desired operation"
GOTO OPT
+2 SET SROP=SRCASE(OPT)
SET SRSDATE=$PIECE(^SRF(SROP,0),"^",9)
SET SRSDATE=$EXTRACT(SRSDATE,4,5)_"-"_$EXTRACT(SRSDATE,6,7)_"-"_$EXTRACT(SRSDATE,2,3)
+3 WRITE @IOF,!,VADM(1),?32,VA("PID"),?50,"Case # ",SROP,!!,SRSDATE
DO CASE
WRITE !!
+4 IF $$LOCK^SROUTL(SROP)
SET DIE=130
SET DA=SRCASE(OPT)
SET DR="17T;18T;67T"
DO ^DIE
DO UNLOCK^SROUTL(SROP)
END WRITE !!,"Press RETURN to continue "
READ X:DTIME
+1 WRITE @IOF
KILL SROP
DO ^SRSKILL
+2 QUIT
LOOP ; break operation name if longer than 65 characters
+1 SET SROPS(M)=""
FOR LOOP=1:1
SET MM=$PIECE(SROPER," ")
SET MMM=$PIECE(SROPER," ",2,200)
IF MMM=""
QUIT
IF $LENGTH(SROPS(M))+$LENGTH(MM)'<65
QUIT
SET SROPS(M)=SROPS(M)_MM_" "
SET SROPER=MMM
+2 QUIT
OTHER ; other operations
+1 SET SRLONG=1
IF $LENGTH(SROPER)+$LENGTH($PIECE(^SRF(SROP,13,SROTHER,0),"^"))>235
SET SRLONG=0
SET SROTHER=999
SET SROPERS=" ..."
+2 IF SRLONG
SET SROPERS=$PIECE(^SRF(SROP,13,SROTHER,0),"^")
+3 SET SROPER=SROPER_$SELECT(SROPERS=" ...":SROPERS,1:", "_SROPERS)
+4 QUIT
LIST ;
+1 SET SRCAN=0
+2 IF $DATA(^SRF(SROP,30))
IF $PIECE(^(30),"^")'=""
SET SRCAN=1
+3 IF $DATA(^SRF(SROP,31))
IF $PIECE(^(31),"^",8)'=""
SET SRCAN=1
+4 IF 'SRCAN
QUIT
+5 SET CNT=CNT+1
SET SRCASE(CNT)=SROP
+6 WRITE !,CNT_". "_$EXTRACT(SRSDATE,4,5)_"-"_$EXTRACT(SRSDATE,6,7)_"-"_$EXTRACT(SRSDATE,2,3)
CASE SET SROPER=$PIECE(^SRF(SROP,"OP"),"^")
IF $ORDER(^SRF(SROP,13,0))
SET SROTHER=0
FOR I=0:0
SET SROTHER=$ORDER(^SRF(SROP,13,SROTHER))
IF 'SROTHER
QUIT
DO OTHER
+1 DO ^SROP1
KILL SROPS,MM,MMM
IF $LENGTH(SROPER)<65
SET SROPS(1)=SROPER
IF $LENGTH(SROPER)>64
SET SROPER=SROPER_" "
FOR M=1:1
DO LOOP
IF MMM=""
QUIT
+2 WRITE ?14,SROPS(1)
IF $DATA(SROPS(2))
WRITE !,?14,SROPS(2)
IF $DATA(SROPS(3))
WRITE !,?14,SROPS(3)
IF $DATA(SROPS(4))
WRITE !,?14,SROPS(4)
IF $DATA(SROPS(5))
WRITE !,?14,SROPS(5)