SROACOP ;BIR/MAM - CARDIAC OPERATIVE RISK SUMMARY ;12/20/07
;;3.0; Surgery ;**38,47,71,88,95,107,100,125,142,153,160,166**;24 Jun 93;Build 6
I '$D(SRTN) W !!,"A Surgery Risk Assessment must be selected prior to using this option.",!!,"Press <RET> to continue " R X:DTIME G END
N SRCSTAT S SRACLR=0,SRSOUT=0,SRSUPCPT=1 D ^SROAUTL
START D:SRACLR RET G:SRSOUT END S SRACLR=0 K SRA,SRAO
F I=206,206.1,208 S SRA(I)=$G(^SRF(SRTN,I))
I $P(SRA(206),"^",41)="" K DA,DIE,DR S DA=SRTN,DIE=130,DR="472////N" D ^DIE K DA,DIE,DR S SRA(206)=$G(^SRF(SRTN,206))
S Y=$P($G(^SRF(SRTN,1.1)),"^",3),C=$P(^DD(130,1.13,0),"^",2) D:Y'="" Y^DIQ S SRAO(2)=Y_"^1.13"
S SRAO(1)=$P(SRA(206),"^",31)_"^364",SRAO(3)=$P(SRA(208),"^",12)_"^414"
S (X,Y)=$P(SRA(206),"^",32) D:Y DT S SRAO("1A")=X_"^364.1"
S Y=$P(SRAO(3),"^") I Y'="" S C=$P(^DD(130,414,0),"^",2) D Y^DIQ S $P(SRAO(3),"^")=Y
S Y=$P(SRA(208),"^",13) D DT S SRAO("3A")=X_"^414.1"
S Y=$P($G(^SRF(SRTN,.2)),"^",2) D DT S SRAO(4)=X_"^.22"
S Y=$P($G(^SRF(SRTN,.2)),"^",3) D DT S SRAO(5)=X_"^.23"
S SRAO(6)=SRA(206.1)_"^430"
S SRCSTAT=">> Coding "_$S($P($G(^SRO(136,SRTN,10)),"^"):"",1:"Not ")_"Complete <<"
S SRPAGE="PAGE: 1" D HDR^SROAUTL S SRAO(7)=""
S (X,X1)=$P(SRAO(1),"^"),X=$S(X?1.3N:X_"%",1:X) W !," 1. Physician's Preoperative Estimate of Operative Mortality: "_X
S X=$P(SRAO("1A"),"^") I X1'=""!(X'="") W !,?3," A. Date/Time Collected: "_X
W !," 2. ASA Classification:",?31,$P(SRAO(2),"^"),!," 3. Surgical Priority:",?31,$P(SRAO(3),"^")
S X=$P(SRAO("3A"),"^") I X'="" W !,?3," A. Date/Time Collected: "_X
W !," 4. Date/Time Operation Began:",?31,$P(SRAO(4),"^"),!," 5. Date/Time Operation Ended:",?31,$P(SRAO(5),"^")
W !," 6. Preoperative Risk Factors: "
I $P(SRAO(6),"^")'="" S SRQ=0 S X=$P(SRAO(6),"^") W:$L(X)<49 X,! I $L(X)>48 S Z=$L(X) D
.I X'[" " W ?25,X Q
.S I=0,LINE=1 F S SRL=$S(LINE=1:48,1:80) D Q:SRQ
..I $E(X,1,SRL)'[" " W X,! S SRQ=1 Q
..S J=SRL-I,Y=$E(X,J),I=I+1 I Y=" " W $E(X,1,J-1),! S X=$E(X,J+1,Z),Z=$L(X),I=0,LINE=LINE+1 I Z<SRL W X S SRQ=1 Q
N SRPROC,SRL S SRL=49 D CPTS^SROAUTL0 W !," 7. CPT Codes (view only):"
F I=1:1 Q:'$D(SRPROC(I)) W:I=1 ?31,SRPROC(I) W:I'=1 !,?31,SRPROC(I)
W ! D CHCK
W !! F MOE=1:1:80 W "-"
ASK W !,"Select Operative Risk Summary Information to Edit: " R X:DTIME I '$T!("^"[X) G END
S:X="a" X="A" I '$D(SRAO(X)),(X'?.N1":".N),(X'="A") D HELP G:SRSOUT END G START
I X="A" S X="1:7"
I X?.N1":".N S Y=$E(X),Z=$P(X,":",2) I Y<1!(Z>7)!(Y>Z) D HELP G:SRSOUT END G START
I X'=7 D HDR^SROAUTL
I X?.N1":".N D RANGE S SROERR=SRTN D ^SROERR0 G START
I $D(SRAO(X))!(X=6) S EMILY=X D S SROERR=SRTN D ^SROERR0 G START
.I $$LOCK^SROUTL(SRTN) W !! D ONE,UNLOCK^SROUTL(SRTN)
END I '$D(SREQST) W @IOF D ^SRSKILL
Q
DT I 'Y S X="" Q
X ^DD("DD") S X=$P(Y,"@")_" "_$P(Y,"@",2)
Q
HELP W @IOF,!!!!,"Enter the number or range of numbers you want to edit. Examples of proper",!,"responses are listed below."
W !!,"1. Enter 'A' to update all information.",!!,"2. Enter the corresponding number to update the information in a particular",!," field. (For example, enter '3' to update Surgical Priority)"
W !!,"3. Enter two numbers separated by a ':' to enter a range of information.",!," (For example, enter '1:2' to update Physician's Preoperative Estimate of",!," Mortality and ASA Classification.)"
W !!,"Press ENTER to continue, or '^' to quit " R X:DTIME I '$T!(X["^") S SRSOUT=1
Q
RANGE ; range of numbers
I $$LOCK^SROUTL(SRTN) D D UNLOCK^SROUTL(SRTN)
.W !! S SHEMP=$P(X,":"),CURLEY=$P(X,":",2) F EMILY=SHEMP:1:CURLEY Q:SRSOUT D ONE
Q
ONE ; edit one item
I EMILY=7 D DISP^SROAUTL0 Q
K DR,DIE S DA=SRTN,DIE=130,DR=$P(SRAO(EMILY),"^",2)
S DR=DR_"T",DIE=130 S DR=DR_$S(EMILY=3:";414.1T",1:"") D ^DIE K DR I $D(Y) S SRSOUT=1
I EMILY=1 D
.I $P(^SRF(SRTN,206),"^",31)="NS" S $P(^SRF(SRTN,206),"^",32)="NS" Q
.S DR="364.1T",DIE=130 D ^DIE K DR I $D(Y) S SRSOUT=1
Q
RET Q:SRSOUT W !!,"Press ENTER to continue, or '^' to quit " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
Q
NOW ; update date/time of estimate of mortality
N X D NOW^%DTC S $P(^SRF(DA,206),"^",32)=$E(%,1,12)
Q
KNOW ; delete date/time of estimate of mortality
S $P(^SRF(DA,206),"^",32)=""
Q
YN ; store answer
S SHEMP=$S(NYUK="NS":"Unknown",NYUK="N":"NO",NYUK="Y":"YES",1:"")
Q
CHCK ;compare dates
N SRINO,SRSP,SREM
S SRSP=$P($G(^SRF(SRTN,208)),"^",13),SRINO=$P($G(^SRF(SRTN,.2)),"^",10),SREM=$P($G(^SRF(SRTN,206)),"^",32)
I SRSP'="",SRINO'="",SRSP'<SRINO W !!,"*** NOTE: D/Time of Surgical Priority should be < the D/Time Patient in OR.***"
I SREM'="",SRINO'="",SREM'<SRINO W !!,"*** NOTE: D/Time of Estimate of Mortality should be < the D/Time PT in OR. ***"
Q
SROACOP ;BIR/MAM - CARDIAC OPERATIVE RISK SUMMARY ;12/20/07
+1 ;;3.0; Surgery ;**38,47,71,88,95,107,100,125,142,153,160,166**;24 Jun 93;Build 6
+2 IF '$DATA(SRTN)
WRITE !!,"A Surgery Risk Assessment must be selected prior to using this option.",!!,"Press <RET> to continue "
READ X:DTIME
GOTO END
+3 NEW SRCSTAT
SET SRACLR=0
SET SRSOUT=0
SET SRSUPCPT=1
DO ^SROAUTL
START IF SRACLR
DO RET
IF SRSOUT
GOTO END
SET SRACLR=0
KILL SRA,SRAO
+1 FOR I=206,206.1,208
SET SRA(I)=$GET(^SRF(SRTN,I))
+2 IF $PIECE(SRA(206),"^",41)=""
KILL DA,DIE,DR
SET DA=SRTN
SET DIE=130
SET DR="472////N"
DO ^DIE
KILL DA,DIE,DR
SET SRA(206)=$GET(^SRF(SRTN,206))
+3 SET Y=$PIECE($GET(^SRF(SRTN,1.1)),"^",3)
SET C=$PIECE(^DD(130,1.13,0),"^",2)
IF Y'=""
DO Y^DIQ
SET SRAO(2)=Y_"^1.13"
+4 SET SRAO(1)=$PIECE(SRA(206),"^",31)_"^364"
SET SRAO(3)=$PIECE(SRA(208),"^",12)_"^414"
+5 SET (X,Y)=$PIECE(SRA(206),"^",32)
IF Y
DO DT
SET SRAO("1A")=X_"^364.1"
+6 SET Y=$PIECE(SRAO(3),"^")
IF Y'=""
SET C=$PIECE(^DD(130,414,0),"^",2)
DO Y^DIQ
SET $PIECE(SRAO(3),"^")=Y
+7 SET Y=$PIECE(SRA(208),"^",13)
DO DT
SET SRAO("3A")=X_"^414.1"
+8 SET Y=$PIECE($GET(^SRF(SRTN,.2)),"^",2)
DO DT
SET SRAO(4)=X_"^.22"
+9 SET Y=$PIECE($GET(^SRF(SRTN,.2)),"^",3)
DO DT
SET SRAO(5)=X_"^.23"
+10 SET SRAO(6)=SRA(206.1)_"^430"
+11 SET SRCSTAT=">> Coding "_$SELECT($PIECE($GET(^SRO(136,SRTN,10)),"^"):"",1:"Not ")_"Complete <<"
+12 SET SRPAGE="PAGE: 1"
DO HDR^SROAUTL
SET SRAO(7)=""
+13 SET (X,X1)=$PIECE(SRAO(1),"^")
SET X=$SELECT(X?1.3N:X_"%",1:X)
WRITE !," 1. Physician's Preoperative Estimate of Operative Mortality: "_X
+14 SET X=$PIECE(SRAO("1A"),"^")
IF X1'=""!(X'="")
WRITE !,?3," A. Date/Time Collected: "_X
+15 WRITE !," 2. ASA Classification:",?31,$PIECE(SRAO(2),"^"),!," 3. Surgical Priority:",?31,$PIECE(SRAO(3),"^")
+16 SET X=$PIECE(SRAO("3A"),"^")
IF X'=""
WRITE !,?3," A. Date/Time Collected: "_X
+17 WRITE !," 4. Date/Time Operation Began:",?31,$PIECE(SRAO(4),"^"),!," 5. Date/Time Operation Ended:",?31,$PIECE(SRAO(5),"^")
+18 WRITE !," 6. Preoperative Risk Factors: "
+19 IF $PIECE(SRAO(6),"^")'=""
SET SRQ=0
SET X=$PIECE(SRAO(6),"^")
IF $LENGTH(X)<49
WRITE X,!
IF $LENGTH(X)>48
SET Z=$LENGTH(X)
Begin DoDot:1
+20 IF X'[" "
WRITE ?25,X
QUIT
+21 SET I=0
SET LINE=1
FOR
SET SRL=$SELECT(LINE=1:48,1:80)
Begin DoDot:2
+22 IF $EXTRACT(X,1,SRL)'[" "
WRITE X,!
SET SRQ=1
QUIT
+23 SET J=SRL-I
SET Y=$EXTRACT(X,J)
SET I=I+1
IF Y=" "
WRITE $EXTRACT(X,1,J-1),!
SET X=$EXTRACT(X,J+1,Z)
SET Z=$LENGTH(X)
SET I=0
SET LINE=LINE+1
IF Z<SRL
WRITE X
SET SRQ=1
QUIT
End DoDot:2
IF SRQ
QUIT
End DoDot:1
+24 NEW SRPROC,SRL
SET SRL=49
DO CPTS^SROAUTL0
WRITE !," 7. CPT Codes (view only):"
+25 FOR I=1:1
IF '$DATA(SRPROC(I))
QUIT
IF I=1
WRITE ?31,SRPROC(I)
IF I'=1
WRITE !,?31,SRPROC(I)
+26 WRITE !
DO CHCK
+27 WRITE !!
FOR MOE=1:1:80
WRITE "-"
ASK WRITE !,"Select Operative Risk Summary Information to Edit: "
READ X:DTIME
IF '$TEST!("^"[X)
GOTO END
+1 IF X="a"
SET X="A"
IF '$DATA(SRAO(X))
IF (X'?.N1":".N)
IF (X'="A")
DO HELP
IF SRSOUT
GOTO END
GOTO START
+2 IF X="A"
SET X="1:7"
+3 IF X?.N1":".N
SET Y=$EXTRACT(X)
SET Z=$PIECE(X,":",2)
IF Y<1!(Z>7)!(Y>Z)
DO HELP
IF SRSOUT
GOTO END
GOTO START
+4 IF X'=7
DO HDR^SROAUTL
+5 IF X?.N1":".N
DO RANGE
SET SROERR=SRTN
DO ^SROERR0
GOTO START
+6 IF $DATA(SRAO(X))!(X=6)
SET EMILY=X
Begin DoDot:1
+7 IF $$LOCK^SROUTL(SRTN)
WRITE !!
DO ONE
DO UNLOCK^SROUTL(SRTN)
End DoDot:1
SET SROERR=SRTN
DO ^SROERR0
GOTO START
END IF '$DATA(SREQST)
WRITE @IOF
DO ^SRSKILL
+1 QUIT
DT IF 'Y
SET X=""
QUIT
+1 XECUTE ^DD("DD")
SET X=$PIECE(Y,"@")_" "_$PIECE(Y,"@",2)
+2 QUIT
HELP WRITE @IOF,!!!!,"Enter the number or range of numbers you want to edit. Examples of proper",!,"responses are listed below."
+1 WRITE !!,"1. Enter 'A' to update all information.",!!,"2. Enter the corresponding number to update the information in a particular",!," field. (For example, enter '3' to update Surgical Priority)"
+2 WRITE !!,"3. Enter two numbers separated by a ':' to enter a range of information.",!," (For example, enter '1:2' to update Physician's Preoperative Estimate of",!," Mortality and ASA Classification.)"
+3 WRITE !!,"Press ENTER to continue, or '^' to quit "
READ X:DTIME
IF '$TEST!(X["^")
SET SRSOUT=1
+4 QUIT
RANGE ; range of numbers
+1 IF $$LOCK^SROUTL(SRTN)
Begin DoDot:1
+2 WRITE !!
SET SHEMP=$PIECE(X,":")
SET CURLEY=$PIECE(X,":",2)
FOR EMILY=SHEMP:1:CURLEY
IF SRSOUT
QUIT
DO ONE
End DoDot:1
DO UNLOCK^SROUTL(SRTN)
+3 QUIT
ONE ; edit one item
+1 IF EMILY=7
DO DISP^SROAUTL0
QUIT
+2 KILL DR,DIE
SET DA=SRTN
SET DIE=130
SET DR=$PIECE(SRAO(EMILY),"^",2)
+3 SET DR=DR_"T"
SET DIE=130
SET DR=DR_$SELECT(EMILY=3:";414.1T",1:"")
DO ^DIE
KILL DR
IF $DATA(Y)
SET SRSOUT=1
+4 IF EMILY=1
Begin DoDot:1
+5 IF $PIECE(^SRF(SRTN,206),"^",31)="NS"
SET $PIECE(^SRF(SRTN,206),"^",32)="NS"
QUIT
+6 SET DR="364.1T"
SET DIE=130
DO ^DIE
KILL DR
IF $DATA(Y)
SET SRSOUT=1
End DoDot:1
+7 QUIT
RET IF SRSOUT
QUIT
WRITE !!,"Press ENTER to continue, or '^' to quit "
READ X:DTIME
IF '$TEST!(X["^")
SET SRSOUT=1
QUIT
+1 QUIT
NOW ; update date/time of estimate of mortality
+1 NEW X
DO NOW^%DTC
SET $PIECE(^SRF(DA,206),"^",32)=$EXTRACT(%,1,12)
+2 QUIT
KNOW ; delete date/time of estimate of mortality
+1 SET $PIECE(^SRF(DA,206),"^",32)=""
+2 QUIT
YN ; store answer
+1 SET SHEMP=$SELECT(NYUK="NS":"Unknown",NYUK="N":"NO",NYUK="Y":"YES",1:"")
+2 QUIT
CHCK ;compare dates
+1 NEW SRINO,SRSP,SREM
+2 SET SRSP=$PIECE($GET(^SRF(SRTN,208)),"^",13)
SET SRINO=$PIECE($GET(^SRF(SRTN,.2)),"^",10)
SET SREM=$PIECE($GET(^SRF(SRTN,206)),"^",32)
+3 IF SRSP'=""
IF SRINO'=""
IF SRSP'<SRINO
WRITE !!,"*** NOTE: D/Time of Surgical Priority should be < the D/Time Patient in OR.***"
+4 IF SREM'=""
IF SRINO'=""
IF SREM'<SRINO
WRITE !!,"*** NOTE: D/Time of Estimate of Mortality should be < the D/Time PT in OR. ***"
+5 QUIT