SROP ;BIR/MAM - SELECT CASE ;08/02/11
;;3.0;Surgery;**7,44,58,64,104,176,177**;24 Jun 93;Build 89
I '$D(^XUSEC("SROEDIT",DUZ))!$D(DUZ("SAV")) K SRNEWOP G ^SROPS
S SRSOUT=0 K DIC S DIC("A")="Select Patient: ",DIC=2,DIC(0)="QEAM" D ^DIC K DIC I Y<0 S SRSOUT=1 G END
S DFN=+Y D DEM^VADPT D HDR
ADT S (SRBACK,SRDT,CNT)=0 F S SRDT=$O(^SRF("ADT",DFN,SRDT)) Q:'SRDT!SRSOUT!$D(SRTN)!SRBACK S SROP=0 F S SROP=$O(^SRF("ADT",DFN,SRDT,SROP)) Q:'SROP!$D(SRTN)!SRSOUT!SRBACK D LIST
G:SRBACK ADT D:SRSOUT HDR I $D(SRTN) G ENTER
S CNT=CNT+1,SRCASE(CNT)="" W !,CNT,". ENTER NEW SURGICAL CASE" S SRNEWOP=1
OPT S SRSOUT=0 W !!!,"Select Operation: " R X:DTIME I '$T!("^"[X) S SRSOUT=1 G END
I '$D(SRCASE(X)) W !!,"Enter the number of the desired operation" W $S('$D(SRNEWOP):".",1:", or '"_CNT_"' to enter a new case.") G OPT
I X=CNT G ^SRONEW
S SRTN=+SRCASE(X) I $P(^SRF(SRTN,0),"^",4)="" D SS^SRSCHUP I SRSOUT G END
ENTER ; edit or delete
;JAS - 7/31/13 - Patch 177 (NEXT LINE)
N SRICDV S SRICDV=$$ICDSTR^SROICD(SRTN)
S SROP=SRTN,SRSDATE=$P(^SRF(SRTN,0),"^",9) D HDR I $E(SRSDATE,1,7)>DT D FUTURE G:SRSOUT END I '$D(SRTN) D HDR G ADT
W !,?1 D CASE W !!,"1. Enter Information",!,"2. Review Information",!,"3. Delete Surgery Case",!!,"Select Number: 1// " R X:DTIME I '$T!(X["^") S SRSOUT=1 G END
S:X="" X=1 I X<1!(X>3)!(X'?.N) D HELP G ENTER
I X=3 D ^SROPDEL G END
I X=2 D RT K DR S ST="REVIEW" D EN2^SROVAR S Q3("VIEW")="",DR="[SROMEN-OPER]",DA=SRTN,DIE=130 D ^SRCUSS K Q3("VIEW") G END
I '$D(^SRF(SRTN,52)),$P($G(^SRF(SRTN,.2)),"^",12)="" S ^SRF(SRTN,52)="0^0^0^0^0^0" ; default flash sterilization fields to zero
D ^SROPCE1
Q
LIST ; list cases
I $P($G(^SRF(SROP,"NON")),"^")="Y" Q
S SRSCAN=1 I $P($G(^SRF(SROP,.2)),"^",10)!$P($G(^SRF(SROP,.2)),"^",12) K SRSCAN
I $D(SRSCAN),$D(^SRF(SROP,30)),$P(^(30),"^") Q
I $D(SRSCAN),$D(^SRF(SROP,31)),$P(^(31),"^",8) Q
I $D(^SRF(SROP,37)),$P(^(37),"^") Q
I $Y+5>IOSL S SRBACK=0 D SEL^SROPER Q:$D(SRTN)!(SRSOUT) D HDR Q:SRBACK
S CNT=CNT+1,SRSDATE=$P(^SRF(SROP,0),"^",9)
W !,CNT_". "
CASE W $E(SRSDATE,4,5)_"-"_$E(SRSDATE,6,7)_"-"_$E(SRSDATE,2,3)
S SROPER=$P(^SRF(SROP,"OP"),"^") I $O(^SRF(SROP,13,0)) S SROTHER=0 F S SROTHER=$O(^SRF(SROP,13,SROTHER)) Q:'SROTHER D OTHER
D ^SROP1,LOCK 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 ! S SRCASE(CNT)=SROP_"^"_SRDT
Q
LOCK ; case locked?
I $D(SRTN),$P($G(^SRF(SRTN,"LOCK")),"^") S SROPER=SROPER_" **LOCKED**"
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
LOOP ; break procedures
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
END K SRTN D ^SRSKILL W @IOF
Q
HELP W !!,"Enter RETURN or '1' to enter or edit information contained within one of the",!,"options found under the Operations Menu. If you want to display a two screen",!,"overview of this case, enter '2'."
W " To delete this case from your records,",!,"enter '3'. Please note that deleting a case will remove EVERYTHING pertaining",!,"to this operative procedure.",!
W !!,"Press RETURN to continue " R X:DTIME
Q
RT ; start RT logging
I $D(XRTL) S XRTN="SROP" D T0^%ZOSV
Q
HDR ; print heading
W @IOF,!,?1,VADM(1)_" "_VA("PID") S X=$P($G(VADM(6)),"^") W:X " * DIED "_$E(X,4,5)_"/"_$E(X,6,7)_"/"_$E(X,2,3)_" *" W !
Q
FUTURE W !,?1 D CASE W !,$C(7) K DIR
S DIR("A",1)=">>> The case you have selected has a future date.",DIR("A")=" Are you sure you have selected the correct case ? ",DIR("B")="NO",DIR(0)="YA" D ^DIR K DIR I $D(DTOUT)!$D(DUOUT) S SRSOUT=1 Q
I 'Y K SRTN Q
D HDR
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSROP 4010 printed Oct 16, 2024@18:45:24 Page 2
SROP ;BIR/MAM - SELECT CASE ;08/02/11
+1 ;;3.0;Surgery;**7,44,58,64,104,176,177**;24 Jun 93;Build 89
+2 IF '$DATA(^XUSEC("SROEDIT",DUZ))!$DATA(DUZ("SAV"))
KILL SRNEWOP
GOTO ^SROPS
+3 SET SRSOUT=0
KILL DIC
SET DIC("A")="Select Patient: "
SET DIC=2
SET DIC(0)="QEAM"
DO ^DIC
KILL DIC
IF Y<0
SET SRSOUT=1
GOTO END
+4 SET DFN=+Y
DO DEM^VADPT
DO HDR
ADT SET (SRBACK,SRDT,CNT)=0
FOR
SET SRDT=$ORDER(^SRF("ADT",DFN,SRDT))
if 'SRDT!SRSOUT!$DATA(SRTN)!SRBACK
QUIT
SET SROP=0
FOR
SET SROP=$ORDER(^SRF("ADT",DFN,SRDT,SROP))
if 'SROP!$DATA(SRTN)!SRSOUT!SRBACK
QUIT
DO LIST
+1 if SRBACK
GOTO ADT
if SRSOUT
DO HDR
IF $DATA(SRTN)
GOTO ENTER
+2 SET CNT=CNT+1
SET SRCASE(CNT)=""
WRITE !,CNT,". ENTER NEW SURGICAL CASE"
SET SRNEWOP=1
OPT SET SRSOUT=0
WRITE !!!,"Select Operation: "
READ X:DTIME
IF '$TEST!("^"[X)
SET SRSOUT=1
GOTO END
+1 IF '$DATA(SRCASE(X))
WRITE !!,"Enter the number of the desired operation"
WRITE $SELECT('$DATA(SRNEWOP):".",1:", or '"_CNT_"' to enter a new case.")
GOTO OPT
+2 IF X=CNT
GOTO ^SRONEW
+3 SET SRTN=+SRCASE(X)
IF $PIECE(^SRF(SRTN,0),"^",4)=""
DO SS^SRSCHUP
IF SRSOUT
GOTO END
ENTER ; edit or delete
+1 ;JAS - 7/31/13 - Patch 177 (NEXT LINE)
+2 NEW SRICDV
SET SRICDV=$$ICDSTR^SROICD(SRTN)
+3 SET SROP=SRTN
SET SRSDATE=$PIECE(^SRF(SRTN,0),"^",9)
DO HDR
IF $EXTRACT(SRSDATE,1,7)>DT
DO FUTURE
if SRSOUT
GOTO END
IF '$DATA(SRTN)
DO HDR
GOTO ADT
+4 WRITE !,?1
DO CASE
WRITE !!,"1. Enter Information",!,"2. Review Information",!,"3. Delete Surgery Case",!!,"Select Number: 1// "
READ X:DTIME
IF '$TEST!(X["^")
SET SRSOUT=1
GOTO END
+5 if X=""
SET X=1
IF X<1!(X>3)!(X'?.N)
DO HELP
GOTO ENTER
+6 IF X=3
DO ^SROPDEL
GOTO END
+7 IF X=2
DO RT
KILL DR
SET ST="REVIEW"
DO EN2^SROVAR
SET Q3("VIEW")=""
SET DR="[SROMEN-OPER]"
SET DA=SRTN
SET DIE=130
DO ^SRCUSS
KILL Q3("VIEW")
GOTO END
+8 ; default flash sterilization fields to zero
IF '$DATA(^SRF(SRTN,52))
IF $PIECE($GET(^SRF(SRTN,.2)),"^",12)=""
SET ^SRF(SRTN,52)="0^0^0^0^0^0"
+9 DO ^SROPCE1
+10 QUIT
LIST ; list cases
+1 IF $PIECE($GET(^SRF(SROP,"NON")),"^")="Y"
QUIT
+2 SET SRSCAN=1
IF $PIECE($GET(^SRF(SROP,.2)),"^",10)!$PIECE($GET(^SRF(SROP,.2)),"^",12)
KILL SRSCAN
+3 IF $DATA(SRSCAN)
IF $DATA(^SRF(SROP,30))
IF $PIECE(^(30),"^")
QUIT
+4 IF $DATA(SRSCAN)
IF $DATA(^SRF(SROP,31))
IF $PIECE(^(31),"^",8)
QUIT
+5 IF $DATA(^SRF(SROP,37))
IF $PIECE(^(37),"^")
QUIT
+6 IF $Y+5>IOSL
SET SRBACK=0
DO SEL^SROPER
if $DATA(SRTN)!(SRSOUT)
QUIT
DO HDR
if SRBACK
QUIT
+7 SET CNT=CNT+1
SET SRSDATE=$PIECE(^SRF(SROP,0),"^",9)
+8 WRITE !,CNT_". "
CASE WRITE $EXTRACT(SRSDATE,4,5)_"-"_$EXTRACT(SRSDATE,6,7)_"-"_$EXTRACT(SRSDATE,2,3)
+1 SET SROPER=$PIECE(^SRF(SROP,"OP"),"^")
IF $ORDER(^SRF(SROP,13,0))
SET SROTHER=0
FOR
SET SROTHER=$ORDER(^SRF(SROP,13,SROTHER))
if 'SROTHER
QUIT
DO OTHER
+2 DO ^SROP1
DO LOCK
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
+3 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)
+4 WRITE !
SET SRCASE(CNT)=SROP_"^"_SRDT
+5 QUIT
LOCK ; case locked?
+1 IF $DATA(SRTN)
IF $PIECE($GET(^SRF(SRTN,"LOCK")),"^")
SET SROPER=SROPER_" **LOCKED**"
+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
LOOP ; break procedures
+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
END KILL SRTN
DO ^SRSKILL
WRITE @IOF
+1 QUIT
HELP WRITE !!,"Enter RETURN or '1' to enter or edit information contained within one of the",!,"options found under the Operations Menu. If you want to display a two screen",!,"overview of this case, enter '2'."
+1 WRITE " To delete this case from your records,",!,"enter '3'. Please note that deleting a case will remove EVERYTHING pertaining",!,"to this operative procedure.",!
+2 WRITE !!,"Press RETURN to continue "
READ X:DTIME
+3 QUIT
RT ; start RT logging
+1 IF $DATA(XRTL)
SET XRTN="SROP"
DO T0^%ZOSV
+2 QUIT
HDR ; print heading
+1 WRITE @IOF,!,?1,VADM(1)_" "_VA("PID")
SET X=$PIECE($GET(VADM(6)),"^")
if X
WRITE " * DIED "_$EXTRACT(X,4,5)_"/"_$EXTRACT(X,6,7)_"/"_$EXTRACT(X,2,3)_" *"
WRITE !
+2 QUIT
FUTURE WRITE !,?1
DO CASE
WRITE !,$CHAR(7)
KILL DIR
+1 SET DIR("A",1)=">>> The case you have selected has a future date."
SET DIR("A")=" Are you sure you have selected the correct case ? "
SET DIR("B")="NO"
SET DIR(0)="YA"
DO ^DIR
KILL DIR
IF $DATA(DTOUT)!$DATA(DUOUT)
SET SRSOUT=1
QUIT
+2 IF 'Y
KILL SRTN
QUIT
+3 DO HDR
+4 QUIT