SROASSE ;B'HAM ISC/MAM - SELECT ASSESSMENT ; 27 FEB 1992 11:00 am
;;3.0; Surgery ;;24 Jun 93
K SRTN W !! 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 S SRANM=VADM(1)_" "_VA("PID")
START ; start display
G:SRSOUT END W @IOF,!,?1,SRANM
I $D(^DPT(DFN,.35)),$P(^(.35),"^") S SRDT=$P(^(.35),"^") W " * DIED "_$E(SRDT,4,5)_"/"_$E(SRDT,6,7)_"/"_$E(SRDT,2,3)_" *"
W !! S (SRDT,CNT)=0 F I=0:0 S SRDT=$O(^SRF("ADT",DFN,SRDT)) Q:'SRDT!(SRSOUT) S SRASS=0 F I=0:0 S SRASS=$O(^SRF("ADT",DFN,SRDT,SRASS)) Q:'SRASS!($D(SRTN))!(SRSOUT) D LIST
I $D(SRTN) Q
I '$D(SRCASE(1)) W !!,"There are no Surgery Risk Assessments entered for "_VADM(1)_"." Q
OPT W !!!,"Select Surgical Case: " R X:DTIME I '$T!("^"[X) S SRSOUT=1 G END
I '$D(SRCASE(X)) W !!,"Enter the number of the desired assessment." W:$D(SRNEW) " Select '"_CNT_"' to create a",!,"new risk assessment entry." G OPT
S SRTN=+SRCASE(X)
Q
LIST ; list assessments
I $Y+5>IOSL S SRBACK=0 D SEL Q:$D(SRTN)!(SRSOUT) I SRBACK S CNT=0,SRASS=SRCASE(1)-1,SRDT=$P(SRCASE(1),"^",2) W @IOF,!,?1,VADM(1)_" "_VA("PID"),! Q
S CNT=CNT+1,SRSDATE=$P(^SRF(SRASS,0),"^",9)
DISP S SROPER=$P(^SRF(SRASS,"OP"),"^") I $O(^SRF(SRASS,13,0)) S SROTHER=0 F I=0:0 S SROTHER=$O(^SRF(SRASS,13,SROTHER)) Q:'SROTHER D OTHER
S SR("RA")=$G(^SRF(SRASS,"RA")),Z=$P(SR("RA"),"^"),STATUS=$S(Z="I":"INCOMPLETE",Z="C":"COMPLETED",Z="T":"TRANSMITTED",1:"INCOMPLETE")
I "N"[$P(SR("RA"),"^",6) S STATUS="NO ASSESSMENT"
S SROPER=SROPER_" ("_STATUS_")"
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=""
I '$D(SRTN) W CNT_". "
CASE W $E(SRSDATE,4,5)_"-"_$E(SRSDATE,6,7)_"-"_$E(SRSDATE,2,3),?14,SROPS(1) I $D(SROPS(2)) W !,?14,SROPS(2) I $D(SROPS(3)) W !,?14,SROPS(3)
I $D(SROPS(4)) W !,?14,SROPS(4)
I $D(SRTN) Q
W !! S SRCASE(CNT)=SRASS_"^"_SRDT
Q
OTHER ; other operations
S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SRASS,13,SROTHER,0),"^"))>235 S SRLONG=0,SROTHER=999,SROPERS=" ..."
I SRLONG S SROPERS=$P(^SRF(SRASS,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 W:SRSOUT @IOF D ^SRSKILL
Q
SEL ; select case
W !!!,"Select Operation, or enter <RET> to continue listing Procedures: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
I X="" W @IOF,!,?1,VADM(1)_" "_VA("PID"),!! Q
I '$D(SRCASE(X)) W !!,"Please enter the number corresponding to the Surgical Case you want to edit.",!,"If the case desired does not appear, enter <RET> to continue listing",!,"additional cases."
I '$D(SRCASE(X)) W !!,"Press <RET> to continue " R X:DTIME S:'$T SRSOUT=1 S SRBACK=1 Q
S SRTN=+SRCASE(X)
Q
SROASSE ;B'HAM ISC/MAM - SELECT ASSESSMENT ; 27 FEB 1992 11:00 am
+1 ;;3.0; Surgery ;;24 Jun 93
+2 KILL SRTN
WRITE !!
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
+3 SET DFN=+Y
DO DEM^VADPT
SET SRANM=VADM(1)_" "_VA("PID")
START ; start display
+1 IF SRSOUT
GOTO END
WRITE @IOF,!,?1,SRANM
+2 IF $DATA(^DPT(DFN,.35))
IF $PIECE(^(.35),"^")
SET SRDT=$PIECE(^(.35),"^")
WRITE " * DIED "_$EXTRACT(SRDT,4,5)_"/"_$EXTRACT(SRDT,6,7)_"/"_$EXTRACT(SRDT,2,3)_" *"
+3 WRITE !!
SET (SRDT,CNT)=0
FOR I=0:0
SET SRDT=$ORDER(^SRF("ADT",DFN,SRDT))
IF 'SRDT!(SRSOUT)
QUIT
SET SRASS=0
FOR I=0:0
SET SRASS=$ORDER(^SRF("ADT",DFN,SRDT,SRASS))
IF 'SRASS!($DATA(SRTN))!(SRSOUT)
QUIT
DO LIST
+4 IF $DATA(SRTN)
QUIT
+5 IF '$DATA(SRCASE(1))
WRITE !!,"There are no Surgery Risk Assessments entered for "_VADM(1)_"."
QUIT
OPT WRITE !!!,"Select Surgical Case: "
READ X:DTIME
IF '$TEST!("^"[X)
SET SRSOUT=1
GOTO END
+1 IF '$DATA(SRCASE(X))
WRITE !!,"Enter the number of the desired assessment."
IF $DATA(SRNEW)
WRITE " Select '"_CNT_"' to create a",!,"new risk assessment entry."
GOTO OPT
+2 SET SRTN=+SRCASE(X)
+3 QUIT
LIST ; list assessments
+1 IF $Y+5>IOSL
SET SRBACK=0
DO SEL
IF $DATA(SRTN)!(SRSOUT)
QUIT
IF SRBACK
SET CNT=0
SET SRASS=SRCASE(1)-1
SET SRDT=$PIECE(SRCASE(1),"^",2)
WRITE @IOF,!,?1,VADM(1)_" "_VA("PID"),!
QUIT
+2 SET CNT=CNT+1
SET SRSDATE=$PIECE(^SRF(SRASS,0),"^",9)
DISP SET SROPER=$PIECE(^SRF(SRASS,"OP"),"^")
IF $ORDER(^SRF(SRASS,13,0))
SET SROTHER=0
FOR I=0:0
SET SROTHER=$ORDER(^SRF(SRASS,13,SROTHER))
IF 'SROTHER
QUIT
DO OTHER
+1 SET SR("RA")=$GET(^SRF(SRASS,"RA"))
SET Z=$PIECE(SR("RA"),"^")
SET STATUS=$SELECT(Z="I":"INCOMPLETE",Z="C":"COMPLETED",Z="T":"TRANSMITTED",1:"INCOMPLETE")
+2 IF "N"[$PIECE(SR("RA"),"^",6)
SET STATUS="NO ASSESSMENT"
+3 SET SROPER=SROPER_" ("_STATUS_")"
+4 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
+5 IF '$DATA(SRTN)
WRITE CNT_". "
CASE WRITE $EXTRACT(SRSDATE,4,5)_"-"_$EXTRACT(SRSDATE,6,7)_"-"_$EXTRACT(SRSDATE,2,3),?14,SROPS(1)
IF $DATA(SROPS(2))
WRITE !,?14,SROPS(2)
IF $DATA(SROPS(3))
WRITE !,?14,SROPS(3)
+1 IF $DATA(SROPS(4))
WRITE !,?14,SROPS(4)
+2 IF $DATA(SRTN)
QUIT
+3 WRITE !!
SET SRCASE(CNT)=SRASS_"^"_SRDT
+4 QUIT
OTHER ; other operations
+1 SET SRLONG=1
IF $LENGTH(SROPER)+$LENGTH($PIECE(^SRF(SRASS,13,SROTHER,0),"^"))>235
SET SRLONG=0
SET SROTHER=999
SET SROPERS=" ..."
+2 IF SRLONG
SET SROPERS=$PIECE(^SRF(SRASS,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 IF SRSOUT
WRITE @IOF
DO ^SRSKILL
+1 QUIT
SEL ; select case
+1 WRITE !!!,"Select Operation, or enter <RET> to continue listing Procedures: "
READ X:DTIME
IF '$TEST!(X["^")
SET SRSOUT=1
QUIT
+2 IF X=""
WRITE @IOF,!,?1,VADM(1)_" "_VA("PID"),!!
QUIT
+3 IF '$DATA(SRCASE(X))
WRITE !!,"Please enter the number corresponding to the Surgical Case you want to edit.",!,"If the case desired does not appear, enter <RET> to continue listing",!,"additional cases."
+4 IF '$DATA(SRCASE(X))
WRITE !!,"Press <RET> to continue "
READ X:DTIME
IF '$TEST
SET SRSOUT=1
SET SRBACK=1
QUIT
+5 SET SRTN=+SRCASE(X)
+6 QUIT