SROAPCA1 ;BIR/MAM - PRINT CARDIAC CATH INFO ;02/05/08
;;3.0; Surgery ;**38,63,71,88,95,125,142,153,166**;24 Jun 93;Build 6
N SRX F I=200:1:202,206,208,209,202.1 S SRA(I)=$G(^SRF(SRTN,I))
I $Y+14>IOSL D PAGE^SROAPCA I SRSOUT Q
D LAB^SROAPCA4
I $Y+16>IOSL D PAGE^SROAPCA I SRSOUT Q
S Y=$P(SRA(209),"^",4),SRAO(1)=$S(Y="C":"CATH",Y="I":"IVUS",Y="B":"BOTH",Y="NS":" NS",1:"")_"^476"
S Y=$P(SRA(206),"^",24),SRX=357,SRAO(2)=$$OUT(SRX,Y)_"^"_SRX
S Y=$P(SRA(206),"^",25),SRX=358,SRAO(3)=$$OUT(SRX,Y)_"^"_SRX
S Y=$P(SRA(206),"^",26),SRX=359,SRAO(4)=$$OUT(SRX,Y)_"^"_SRX
S Y=$P(SRA(206),"^",27),SRX=360,SRAO(5)=$$OUT(SRX,Y)_"^"_SRX
S NYUK=$P(SRA(206),"^",30) D LV S SRAO(6)=SHEMP_"^363"
S Y=$P(SRA(206),"^",9),SRX=415,SRAO(7)=$$OUT(SRX,Y)_"^"_SRX
S Y=$P(SRA(209),"^",5),SRX=477,SRAO(8)=$$OUT(SRX,Y)_"^"_SRX
S Y=$P(SRA(206),"^",28),SRX=361,SRAO(9)=$$OUT(SRX,Y)_"^"_SRX
S Y=$P(SRA(206),"^",33),SRX=362.1,SRAO(10)=$$OUT(SRX,Y)_"^"_SRX
S Y=$P(SRA(206),"^",34),SRX=362.2,SRAO(11)=$$OUT(SRX,Y)_"^"_SRX
S Y=$P(SRA(206),"^",35),SRX=362.3,SRAO(12)=$$OUT(SRX,Y)_"^"_SRX
S Y=$P(SRA(209),"^",6),SRX=478,SRAO(13)=$$OUT(SRX,Y)_"^"_SRX
S Y=$P(SRA(209),"^",7),SRX=479,SRAO(14)=$$OUT(SRX,Y)_"^"_SRX
S Y=$P(SRA(209),"^",8),SRX=480,SRAO(15)=$$OUT(SRX,Y)_"^"_SRX
W !!,"IV. CARDIAC CATHETERIZATION AND ANGIOGRAPHIC DATA"
S Y=$P($G(^SRF(SRTN,207)),"^",21) I Y>1 D DT S Y=X
D NS W !,"Cardiac Catheterization Date: ",$E(Y,1,8)
W !,"Procedure:",?26,$P(SRAO(1),"^"),?41,"Native Coronaries:"
S SRX=$P(SRAO(2),"^") W !,"LVEDP:",?26,$J(SRX,3) D MMHG
S SRX=$P(SRAO(9),"^") W ?41,"Left Main Stenosis:",?71,$J(SRX,3) I SRX?1.3N W "%"
S SRX=$P(SRAO(3),"^") W !,"Aortic Systolic Pressure:",?26,$J(SRX,3) D MMHG
S SRX=$P(SRAO(10),"^") W ?41,"LAD Stenosis:",?71,$J(SRX,3) I SRX?1.3N W "%"
S SRX=$P(SRAO(11),"^") W !,?41,"Right Coronary Stenosis:",?71,$J(SRX,3) I SRX?1.3N W "%"
W !,"For patients having right heart cath:" S SRX=$P(SRAO(12),"^") W ?41,"Circumflex Stenosis:",?71,$J(SRX,3) I SRX?1.3N W "%"
;
S SRX=$P(SRAO(4),"^") W !,"PA Systolic Pressure:",?26,$J(SRX,3) D MMHG
S SRX=$P(SRAO(5),"^") W !,"PAW Mean Pressure:",?26,$J(SRX,3) D MMHG
W ?41,"If a Re-do, indicate stenosis",!,?44," in graft to:"
S SRX=$P(SRAO(13),"^") W !,?41,"LAD:",?71,$J(SRX,3) I SRX?1.3N W "%"
S SRX=$P(SRAO(14),"^") W !,?41,"Right coronary (include PDA): ",$J(SRX,3) I SRX?1.3N W "%"
S SRX=$P(SRAO(15),"^") W !,?41,"Circumflex:",?71,$J(SRX,3) I SRX?1.3N W "%"
W !,LN
W !,"LV Contraction Grade (from contrast or radionuclide angiogram or 2D Echo):",!,?7,"Grade",?17,"Ejection Fraction Range",?51,"Definition"
W !,?8,$P(SRAO(6),"^")
W !,LN,!,"Mitral Regurgitation:",?26,$P(SRAO(7),"^")
W !,"Aortic stenosis:",?26,$P(SRAO(8),"^")
I $Y+14>IOSL D PAGE^SROAPCA I SRSOUT Q
K SRAO S Y=$P(SRA(206),"^",31),SRX=364,SRAO(1)=$$OUT(SRX,Y)_"^"_SRX
S Y=$P($G(^SRF(SRTN,1.1)),"^",3),SRX=1.13,SRAO(2)=$$OUT(SRX,Y)_"^"_SRX
S Y=$P(SRA(208),"^",12),SRX=414,SRAO(3)=$$OUT(SRX,Y)_"^"_SRX
S Y=$P(SRA(206),"^",32),SRX=364.1 D DT S SRAO("1A")=X_"^"_SRX
S Y=$P(SRA(208),"^",13),SRX=414.1 D DT S SRAO("3A")=X_"^"_SRX
S Y=$P($G(^SRF(SRTN,.2)),"^",2),SRX=.22 D DT S SRAO(0)=X_"^"_SRX
W !!,"V. OPERATIVE RISK SUMMARY DATA" S X=$P(SRAO(0),"^") W ?40,"(Operation Began: "_X_")"
W !,?5,"Physician's Preoperative" S Y=$P($G(^SRF(SRTN,.2)),"^",3) D DT W ?40,"(Operation Ended: "_X_")"
W !,?7,"Estimate of Operative Mortality: "_$P(SRAO(1),"^") I $P(SRAO(1),"^")'=""&($P(SRAO(1),"^")'="NS") W "%"
S X=$P(SRAO("1A"),"^") I X'="" W ?57,"("_X_")"
W !,?5,"ASA Classification:",?35,$P(SRAO(2),"^")
S X=$P(SRAO(3),"^") W !,?5,"Surgical Priority:",?($S($L(X)>10:24,1:35)),X S X=$P(SRAO("3A"),"^") I X'="" W ?57,"("_X_")"
S X=$P($G(^SRO(136,SRTN,0)),"^",2) I X S Y=$P($$CPT^ICPTCOD(X),"^",2) D SSPRIN^SROCPT0 S X=Y
S X=$S(X'="":X,1:"CPT Code Missing")
W !,?5,"Principal CPT Code:",?35,X,!,?5,"Other Procedures CPT Codes: "
S CNT=32,OTH=0 F S OTH=$O(^SRO(136,SRTN,3,OTH)) Q:'OTH S CPT=$P($G(^SRO(136,SRTN,3,OTH,0)),"^") D
.I CPT S Y=$P($$CPT^ICPTCOD(CPT),"^",2) S SRDA=OTH D SSOTH^SROCPT0 S CPT=Y
.S:CPT="" CPT="NONE" S CNT=CNT+3
.I CNT+$L(CPT)'>80 W:CNT>35 ";" W ?(CNT),CPT S CNT=CNT+$L(CPT) Q
.W !,?35,CPT S CNT=35+$L(CPT)
W !,?5,"Preoperative Risk Factors: "
I $G(^SRF(SRTN,206.1))'="" S SRQ=0 S X=$G(^SRF(SRTN,206.1)) 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),!,?5 S X=$E(X,J+1,Z),Z=$L(X),I=0,LINE=LINE+1 I Z<SRL W X S SRQ=1 Q
I $Y+20>IOSL D PAGE^SROAPCA I SRSOUT Q
K SRA,SRAO D ^SROAPCA2
Q
YN ; store answer
S SHEMP=$S(NYUK="NS":"NS",NYUK="N":"NO",NYUK="Y":"YES",1:"")
Q
DT I 'Y S X="" Q
S Z=$E($P(Y,".",2),1,4),Z=Z_"0000",Z=$E(Z,1,4),X=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3)_" "_$E(Z,1,2)_":"_$E(Z,3,4)
Q
OUT(SRFLD,SRY) ; get data in output form
N C,Y
S Y=SRY,C=$P(^DD(130,SRFLD,0),"^",2) D:Y'="" Y^DIQ
I Y="NO STUDY" S Y="NS" Q Y
Q Y
MMHG I SRX="NO STUDY"!(SRX="NS") Q
W " mm Hg"
Q
NS S Y=$S(Y="NS":"NO STUDY",1:Y)
Q
LV K SHEMP S SHEMP=$S(NYUK="I":" I > or = 0.55 NORMAL",NYUK="II":"II 0.45-0.54 MILD DYSFUNCTION",1:NYUK)
Q:SHEMP'=NYUK S SHEMP=$S(NYUK="III":"III 0.35-0.44 MODERATE DYSFUNCTION",1:NYUK)
Q:SHEMP'=NYUK S SHEMP=$S(NYUK="IIIa":"IIIa 0.40-0.44 MODERATE DYSFUNCTION A",1:NYUK)
Q:SHEMP'=NYUK S SHEMP=$S(NYUK="IIIb":"IIIb 0.35-0.39 MODERATE DYSFUNCTION B",1:NYUK)
Q:SHEMP'=NYUK S SHEMP=$S(NYUK="IV":"IV 0.25-0.34 SEVERE DYSFUNCTION",NYUK="V":" V <0.25 VERY SEVERE DYSFUNCTION",NYUK="NS":"NO LV STUDY",1:"")
Q
SROAPCA1 ;BIR/MAM - PRINT CARDIAC CATH INFO ;02/05/08
+1 ;;3.0; Surgery ;**38,63,71,88,95,125,142,153,166**;24 Jun 93;Build 6
+2 NEW SRX
FOR I=200:1:202,206,208,209,202.1
SET SRA(I)=$GET(^SRF(SRTN,I))
+3 IF $Y+14>IOSL
DO PAGE^SROAPCA
IF SRSOUT
QUIT
+4 DO LAB^SROAPCA4
+5 IF $Y+16>IOSL
DO PAGE^SROAPCA
IF SRSOUT
QUIT
+6 SET Y=$PIECE(SRA(209),"^",4)
SET SRAO(1)=$SELECT(Y="C":"CATH",Y="I":"IVUS",Y="B":"BOTH",Y="NS":" NS",1:"")_"^476"
+7 SET Y=$PIECE(SRA(206),"^",24)
SET SRX=357
SET SRAO(2)=$$OUT(SRX,Y)_"^"_SRX
+8 SET Y=$PIECE(SRA(206),"^",25)
SET SRX=358
SET SRAO(3)=$$OUT(SRX,Y)_"^"_SRX
+9 SET Y=$PIECE(SRA(206),"^",26)
SET SRX=359
SET SRAO(4)=$$OUT(SRX,Y)_"^"_SRX
+10 SET Y=$PIECE(SRA(206),"^",27)
SET SRX=360
SET SRAO(5)=$$OUT(SRX,Y)_"^"_SRX
+11 SET NYUK=$PIECE(SRA(206),"^",30)
DO LV
SET SRAO(6)=SHEMP_"^363"
+12 SET Y=$PIECE(SRA(206),"^",9)
SET SRX=415
SET SRAO(7)=$$OUT(SRX,Y)_"^"_SRX
+13 SET Y=$PIECE(SRA(209),"^",5)
SET SRX=477
SET SRAO(8)=$$OUT(SRX,Y)_"^"_SRX
+14 SET Y=$PIECE(SRA(206),"^",28)
SET SRX=361
SET SRAO(9)=$$OUT(SRX,Y)_"^"_SRX
+15 SET Y=$PIECE(SRA(206),"^",33)
SET SRX=362.1
SET SRAO(10)=$$OUT(SRX,Y)_"^"_SRX
+16 SET Y=$PIECE(SRA(206),"^",34)
SET SRX=362.2
SET SRAO(11)=$$OUT(SRX,Y)_"^"_SRX
+17 SET Y=$PIECE(SRA(206),"^",35)
SET SRX=362.3
SET SRAO(12)=$$OUT(SRX,Y)_"^"_SRX
+18 SET Y=$PIECE(SRA(209),"^",6)
SET SRX=478
SET SRAO(13)=$$OUT(SRX,Y)_"^"_SRX
+19 SET Y=$PIECE(SRA(209),"^",7)
SET SRX=479
SET SRAO(14)=$$OUT(SRX,Y)_"^"_SRX
+20 SET Y=$PIECE(SRA(209),"^",8)
SET SRX=480
SET SRAO(15)=$$OUT(SRX,Y)_"^"_SRX
+21 WRITE !!,"IV. CARDIAC CATHETERIZATION AND ANGIOGRAPHIC DATA"
+22 SET Y=$PIECE($GET(^SRF(SRTN,207)),"^",21)
IF Y>1
DO DT
SET Y=X
+23 DO NS
WRITE !,"Cardiac Catheterization Date: ",$EXTRACT(Y,1,8)
+24 WRITE !,"Procedure:",?26,$PIECE(SRAO(1),"^"),?41,"Native Coronaries:"
+25 SET SRX=$PIECE(SRAO(2),"^")
WRITE !,"LVEDP:",?26,$JUSTIFY(SRX,3)
DO MMHG
+26 SET SRX=$PIECE(SRAO(9),"^")
WRITE ?41,"Left Main Stenosis:",?71,$JUSTIFY(SRX,3)
IF SRX?1.3N
WRITE "%"
+27 SET SRX=$PIECE(SRAO(3),"^")
WRITE !,"Aortic Systolic Pressure:",?26,$JUSTIFY(SRX,3)
DO MMHG
+28 SET SRX=$PIECE(SRAO(10),"^")
WRITE ?41,"LAD Stenosis:",?71,$JUSTIFY(SRX,3)
IF SRX?1.3N
WRITE "%"
+29 SET SRX=$PIECE(SRAO(11),"^")
WRITE !,?41,"Right Coronary Stenosis:",?71,$JUSTIFY(SRX,3)
IF SRX?1.3N
WRITE "%"
+30 WRITE !,"For patients having right heart cath:"
SET SRX=$PIECE(SRAO(12),"^")
WRITE ?41,"Circumflex Stenosis:",?71,$JUSTIFY(SRX,3)
IF SRX?1.3N
WRITE "%"
+31 ;
+32 SET SRX=$PIECE(SRAO(4),"^")
WRITE !,"PA Systolic Pressure:",?26,$JUSTIFY(SRX,3)
DO MMHG
+33 SET SRX=$PIECE(SRAO(5),"^")
WRITE !,"PAW Mean Pressure:",?26,$JUSTIFY(SRX,3)
DO MMHG
+34 WRITE ?41,"If a Re-do, indicate stenosis",!,?44," in graft to:"
+35 SET SRX=$PIECE(SRAO(13),"^")
WRITE !,?41,"LAD:",?71,$JUSTIFY(SRX,3)
IF SRX?1.3N
WRITE "%"
+36 SET SRX=$PIECE(SRAO(14),"^")
WRITE !,?41,"Right coronary (include PDA): ",$JUSTIFY(SRX,3)
IF SRX?1.3N
WRITE "%"
+37 SET SRX=$PIECE(SRAO(15),"^")
WRITE !,?41,"Circumflex:",?71,$JUSTIFY(SRX,3)
IF SRX?1.3N
WRITE "%"
+38 WRITE !,LN
+39 WRITE !,"LV Contraction Grade (from contrast or radionuclide angiogram or 2D Echo):",!,?7,"Grade",?17,"Ejection Fraction Range",?51,"Definition"
+40 WRITE !,?8,$PIECE(SRAO(6),"^")
+41 WRITE !,LN,!,"Mitral Regurgitation:",?26,$PIECE(SRAO(7),"^")
+42 WRITE !,"Aortic stenosis:",?26,$PIECE(SRAO(8),"^")
+43 IF $Y+14>IOSL
DO PAGE^SROAPCA
IF SRSOUT
QUIT
+44 KILL SRAO
SET Y=$PIECE(SRA(206),"^",31)
SET SRX=364
SET SRAO(1)=$$OUT(SRX,Y)_"^"_SRX
+45 SET Y=$PIECE($GET(^SRF(SRTN,1.1)),"^",3)
SET SRX=1.13
SET SRAO(2)=$$OUT(SRX,Y)_"^"_SRX
+46 SET Y=$PIECE(SRA(208),"^",12)
SET SRX=414
SET SRAO(3)=$$OUT(SRX,Y)_"^"_SRX
+47 SET Y=$PIECE(SRA(206),"^",32)
SET SRX=364.1
DO DT
SET SRAO("1A")=X_"^"_SRX
+48 SET Y=$PIECE(SRA(208),"^",13)
SET SRX=414.1
DO DT
SET SRAO("3A")=X_"^"_SRX
+49 SET Y=$PIECE($GET(^SRF(SRTN,.2)),"^",2)
SET SRX=.22
DO DT
SET SRAO(0)=X_"^"_SRX
+50 WRITE !!,"V. OPERATIVE RISK SUMMARY DATA"
SET X=$PIECE(SRAO(0),"^")
WRITE ?40,"(Operation Began: "_X_")"
+51 WRITE !,?5,"Physician's Preoperative"
SET Y=$PIECE($GET(^SRF(SRTN,.2)),"^",3)
DO DT
WRITE ?40,"(Operation Ended: "_X_")"
+52 WRITE !,?7,"Estimate of Operative Mortality: "_$PIECE(SRAO(1),"^")
IF $PIECE(SRAO(1),"^")'=""&($PIECE(SRAO(1),"^")'="NS")
WRITE "%"
+53 SET X=$PIECE(SRAO("1A"),"^")
IF X'=""
WRITE ?57,"("_X_")"
+54 WRITE !,?5,"ASA Classification:",?35,$PIECE(SRAO(2),"^")
+55 SET X=$PIECE(SRAO(3),"^")
WRITE !,?5,"Surgical Priority:",?($SELECT($LENGTH(X)>10:24,1:35)),X
SET X=$PIECE(SRAO("3A"),"^")
IF X'=""
WRITE ?57,"("_X_")"
+56 SET X=$PIECE($GET(^SRO(136,SRTN,0)),"^",2)
IF X
SET Y=$PIECE($$CPT^ICPTCOD(X),"^",2)
DO SSPRIN^SROCPT0
SET X=Y
+57 SET X=$SELECT(X'="":X,1:"CPT Code Missing")
+58 WRITE !,?5,"Principal CPT Code:",?35,X,!,?5,"Other Procedures CPT Codes: "
+59 SET CNT=32
SET OTH=0
FOR
SET OTH=$ORDER(^SRO(136,SRTN,3,OTH))
IF 'OTH
QUIT
SET CPT=$PIECE($GET(^SRO(136,SRTN,3,OTH,0)),"^")
Begin DoDot:1
+60 IF CPT
SET Y=$PIECE($$CPT^ICPTCOD(CPT),"^",2)
SET SRDA=OTH
DO SSOTH^SROCPT0
SET CPT=Y
+61 IF CPT=""
SET CPT="NONE"
SET CNT=CNT+3
+62 IF CNT+$LENGTH(CPT)'>80
IF CNT>35
WRITE ";"
WRITE ?(CNT),CPT
SET CNT=CNT+$LENGTH(CPT)
QUIT
+63 WRITE !,?35,CPT
SET CNT=35+$LENGTH(CPT)
End DoDot:1
+64 WRITE !,?5,"Preoperative Risk Factors: "
+65 IF $GET(^SRF(SRTN,206.1))'=""
SET SRQ=0
SET X=$GET(^SRF(SRTN,206.1))
IF $LENGTH(X)<49
WRITE X,!
IF $LENGTH(X)>48
SET Z=$LENGTH(X)
Begin DoDot:1
+66 IF X'[" "
WRITE ?25,X
QUIT
+67 SET I=0
SET LINE=1
FOR
SET SRL=$SELECT(LINE=1:48,1:80)
Begin DoDot:2
+68 IF $EXTRACT(X,1,SRL)'[" "
WRITE X,!
SET SRQ=1
QUIT
+69 SET J=SRL-I
SET Y=$EXTRACT(X,J)
SET I=I+1
IF Y=" "
WRITE $EXTRACT(X,1,J-1),!,?5
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
+70 IF $Y+20>IOSL
DO PAGE^SROAPCA
IF SRSOUT
QUIT
+71 KILL SRA,SRAO
DO ^SROAPCA2
+72 QUIT
YN ; store answer
+1 SET SHEMP=$SELECT(NYUK="NS":"NS",NYUK="N":"NO",NYUK="Y":"YES",1:"")
+2 QUIT
DT IF 'Y
SET X=""
QUIT
+1 SET Z=$EXTRACT($PIECE(Y,".",2),1,4)
SET Z=Z_"0000"
SET Z=$EXTRACT(Z,1,4)
SET X=$EXTRACT(Y,4,5)_"/"_$EXTRACT(Y,6,7)_"/"_$EXTRACT(Y,2,3)_" "_$EXTRACT(Z,1,2)_":"_$EXTRACT(Z,3,4)
+2 QUIT
OUT(SRFLD,SRY) ; get data in output form
+1 NEW C,Y
+2 SET Y=SRY
SET C=$PIECE(^DD(130,SRFLD,0),"^",2)
IF Y'=""
DO Y^DIQ
+3 IF Y="NO STUDY"
SET Y="NS"
QUIT Y
+4 QUIT Y
MMHG IF SRX="NO STUDY"!(SRX="NS")
QUIT
+1 WRITE " mm Hg"
+2 QUIT
NS SET Y=$SELECT(Y="NS":"NO STUDY",1:Y)
+1 QUIT
LV KILL SHEMP
SET SHEMP=$SELECT(NYUK="I":" I > or = 0.55 NORMAL",NYUK="II":"II 0.45-0.54 MILD DYSFUNCTION",1:NYUK)
+1 IF SHEMP'=NYUK
QUIT
SET SHEMP=$SELECT(NYUK="III":"III 0.35-0.44 MODERATE DYSFUNCTION",1:NYUK)
+2 IF SHEMP'=NYUK
QUIT
SET SHEMP=$SELECT(NYUK="IIIa":"IIIa 0.40-0.44 MODERATE DYSFUNCTION A",1:NYUK)
+3 IF SHEMP'=NYUK
QUIT
SET SHEMP=$SELECT(NYUK="IIIb":"IIIb 0.35-0.39 MODERATE DYSFUNCTION B",1:NYUK)
+4 IF SHEMP'=NYUK
QUIT
SET SHEMP=$SELECT(NYUK="IV":"IV 0.25-0.34 SEVERE DYSFUNCTION",NYUK="V":" V <0.25 VERY SEVERE DYSFUNCTION",NYUK="NS":"NO LV STUDY",1:"")
+5 QUIT