SROMORT ;B'HAM ISC/MAM - MORTALITY REPORT ; [ 10/01/98 12:55 PM ]
;;3.0; Surgery ;**5,34,50**;24 Jun 93
BEG ; entry when queued
U IO N SRFRTO K ^TMP("SR",$J) S (SRHDR,SRSOUT)=0,PAGE=1
S Y=DT X ^DD("DD") S SRPRINT="DATE PRINTED: "_Y S Y=SRSD X ^DD("DD") S SRFRTO="FROM: "_Y_" TO: ",Y=SRED X ^DD("DD") S SRFRTO=SRFRTO_Y
S SRSD1=SRSD-.00001,SRSEDT=SRED+.9999 F S SRSD1=$O(^DPT("AEXP1",SRSD1)) Q:SRSD1>SRSEDT!'SRSD1 S DFN=0 F S DFN=$O(^DPT("AEXP1",SRSD1,DFN)) Q:'DFN D SEARCH
S SRSS=0 F S SRSS=$O(^TMP("SR",$J,SRSS)) Q:SRSS=""!(SRSOUT) D PAGE S SRSDATE=0 F S SRSDATE=$O(^TMP("SR",$J,SRSS,SRSDATE)) Q:'SRSDATE!(SRSOUT) D MORE
I '$D(^TMP("SR",$J)) K SRSS D HDR W !!,"No mortalities for the selected date range.",!
END ;
W:$E(IOST)="P" @IOF K ^TMP("SR",$J) I $D(ZTQUEUED) Q:$G(ZTSTOP) S ZTREQ="@" Q
I $E(IOST)'="P",'SRSOUT W !!,"Press RETURN to continue " R X:DTIME
D ^%ZISC K SRTN D ^SRSKILL W @IOF
Q
MORE S DFN=0 F S DFN=$O(^TMP("SR",$J,SRSS,SRSDATE,DFN)) Q:'DFN!(SRSOUT) S X=^(DFN),SRDEAD=$P(X,"^"),SRTN=$P(X,"^",2) D PRINT
Q
SEARCH ; search for procedures
S X1=SRSD1,X2=-30 D C^%DTC S SRCUTDT=X
S SRTN=0 F S SRTN=$O(^SRF("B",DFN,SRTN)) Q:'SRTN I $$MANDIV^SROUTL0(SRINSTP,SRTN) S SRSDATE=$P(^SRF(SRTN,0),"^",9) I SRSDATE<SRSEDT,SRSDATE>SRCUTDT D UTIL
Q
UTIL ; set ^TMP
I '$D(^SRF(SRTN,.2)) Q
I $P(^SRF(SRTN,.2),"^",12)="" Q
S Y=$P(^SRF(SRTN,0),"^",4) S SRSS=$S(Y:$P(^SRO(137.45,Y,0),"^"),1:"SURGICAL SPECIALTY NOT ENTERED")
S ^TMP("SR",$J,SRSS,SRSDATE,DFN)=SRSD1_"^"_SRTN
Q
HDR ; print heading
I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
W:$Y @IOF W !,?(132-$L(SRINST)\2),SRINST,?120,"PAGE ",PAGE,!,?58,"SURGICAL SERVICE",?100,"REVIEWED BY: ",!,?58,"MORTALITY REPORT",?100,"DATE REVIEWED: "
W !,?(132-$L(SRFRTO)\2),SRFRTO,?100,SRPRINT
W !!!,"OPERATION DATE",?17,"PATIENT",?50,"PRINCIPAL OPERATIVE PROCEDURE",?112,"DATE OF DEATH",!,?17,"ID#",?112,"AUTOPSY (Y/N)",! F LINE=1:1:IOM W "="
I $D(SRSS) W !,?(132-$L(SRSS)\2),SRSS,! F LINE=1:1:132 W "-"
S PAGE=PAGE+1,SRHDR=1
Q
OTHER ; other operations
S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SRTN,13,OPER,0),"^"))>250 S SRLONG=0,OPER=999,SROPERS=" ..."
I SRLONG S SROPERS=$P(^SRF(SRTN,13,OPER,0),"^")
S SROPER=SROPER_$S(SROPERS=" ...":SROPERS,1:", "_SROPERS)
Q
PRINT ; print mortality information
I $Y+5>IOSL D PAGE Q:SRSOUT
S Y=SRSDATE D D^DIQ S SRSDT=$E(Y,1,12),(Y,SRAD)=SRDEAD D D^DIQ S SRSDEAD=$E(Y,1,12)
D DEM^VADPT S SRNAME=VADM(1),SSN=VA("PID")
OPS S SROPER=$P(^SRF(SRTN,"OP"),"^"),OPER=0 F I=0:0 S OPER=$O(^SRF(SRTN,13,OPER)) Q:OPER="" D OTHER
K SROPS,MM,MMM S:$L(SROPER)<55 SROPS(1)=SROPER,SROPS(2)="" I $L(SROPER)>54 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
S (SRAUT,SRPTF)=""
S VAINDT=SRAD-.0001 D INP^VADPT S SRPTF=VAIN(10) I SRPTF S SRAUT=$P($G(^DGPT(SRPTF,70)),"^",3),SRAUT=$S(SRAUT=6:"YES",SRAUT=7:"NO",1:"NOT AVAILABLE")
S:SRAUT="" SRAUT="NOT AVAILABLE"
W !!,SRSDT,?17,SRNAME,?50,SROPS(1),?112,SRSDEAD,!,?17,VA("PID"),?50,SROPS(2),?112,SRAUT I $D(SROPS(3)) W !,?50,SROPS(3) I $D(SROPS(4)) W !,?50,SROPS(4)
Q
LOOP ; break procedure if greater than 55 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)'<55 S SROPS(M)=SROPS(M)_MM_" ",SROPER=MMM
Q
PAGE I $E(IOST)'="P",SRHDR W !!,"Press RETURN to continue, or '^' to quit: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
D HDR
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSROMORT 3404 printed Dec 13, 2024@02:44:10 Page 2
SROMORT ;B'HAM ISC/MAM - MORTALITY REPORT ; [ 10/01/98 12:55 PM ]
+1 ;;3.0; Surgery ;**5,34,50**;24 Jun 93
BEG ; entry when queued
+1 USE IO
NEW SRFRTO
KILL ^TMP("SR",$JOB)
SET (SRHDR,SRSOUT)=0
SET PAGE=1
+2 SET Y=DT
XECUTE ^DD("DD")
SET SRPRINT="DATE PRINTED: "_Y
SET Y=SRSD
XECUTE ^DD("DD")
SET SRFRTO="FROM: "_Y_" TO: "
SET Y=SRED
XECUTE ^DD("DD")
SET SRFRTO=SRFRTO_Y
+3 SET SRSD1=SRSD-.00001
SET SRSEDT=SRED+.9999
FOR
SET SRSD1=$ORDER(^DPT("AEXP1",SRSD1))
if SRSD1>SRSEDT!'SRSD1
QUIT
SET DFN=0
FOR
SET DFN=$ORDER(^DPT("AEXP1",SRSD1,DFN))
if 'DFN
QUIT
DO SEARCH
+4 SET SRSS=0
FOR
SET SRSS=$ORDER(^TMP("SR",$JOB,SRSS))
if SRSS=""!(SRSOUT)
QUIT
DO PAGE
SET SRSDATE=0
FOR
SET SRSDATE=$ORDER(^TMP("SR",$JOB,SRSS,SRSDATE))
if 'SRSDATE!(SRSOUT)
QUIT
DO MORE
+5 IF '$DATA(^TMP("SR",$JOB))
KILL SRSS
DO HDR
WRITE !!,"No mortalities for the selected date range.",!
END ;
+1 if $EXTRACT(IOST)="P"
WRITE @IOF
KILL ^TMP("SR",$JOB)
IF $DATA(ZTQUEUED)
if $GET(ZTSTOP)
QUIT
SET ZTREQ="@"
QUIT
+2 IF $EXTRACT(IOST)'="P"
IF 'SRSOUT
WRITE !!,"Press RETURN to continue "
READ X:DTIME
+3 DO ^%ZISC
KILL SRTN
DO ^SRSKILL
WRITE @IOF
+4 QUIT
MORE SET DFN=0
FOR
SET DFN=$ORDER(^TMP("SR",$JOB,SRSS,SRSDATE,DFN))
if 'DFN!(SRSOUT)
QUIT
SET X=^(DFN)
SET SRDEAD=$PIECE(X,"^")
SET SRTN=$PIECE(X,"^",2)
DO PRINT
+1 QUIT
SEARCH ; search for procedures
+1 SET X1=SRSD1
SET X2=-30
DO C^%DTC
SET SRCUTDT=X
+2 SET SRTN=0
FOR
SET SRTN=$ORDER(^SRF("B",DFN,SRTN))
if 'SRTN
QUIT
IF $$MANDIV^SROUTL0(SRINSTP,SRTN)
SET SRSDATE=$PIECE(^SRF(SRTN,0),"^",9)
IF SRSDATE<SRSEDT
IF SRSDATE>SRCUTDT
DO UTIL
+3 QUIT
UTIL ; set ^TMP
+1 IF '$DATA(^SRF(SRTN,.2))
QUIT
+2 IF $PIECE(^SRF(SRTN,.2),"^",12)=""
QUIT
+3 SET Y=$PIECE(^SRF(SRTN,0),"^",4)
SET SRSS=$SELECT(Y:$PIECE(^SRO(137.45,Y,0),"^"),1:"SURGICAL SPECIALTY NOT ENTERED")
+4 SET ^TMP("SR",$JOB,SRSS,SRSDATE,DFN)=SRSD1_"^"_SRTN
+5 QUIT
HDR ; print heading
+1 IF $DATA(ZTQUEUED)
DO ^SROSTOP
IF SRHALT
SET SRSOUT=1
QUIT
+2 if $Y
WRITE @IOF
WRITE !,?(132-$LENGTH(SRINST)\2),SRINST,?120,"PAGE ",PAGE,!,?58,"SURGICAL SERVICE",?100,"REVIEWED BY: ",!,?58,"MORTALITY REPORT",?100,"DATE REVIEWED: "
+3 WRITE !,?(132-$LENGTH(SRFRTO)\2),SRFRTO,?100,SRPRINT
+4 WRITE !!!,"OPERATION DATE",?17,"PATIENT",?50,"PRINCIPAL OPERATIVE PROCEDURE",?112,"DATE OF DEATH",!,?17,"ID#",?112,"AUTOPSY (Y/N)",!
FOR LINE=1:1:IOM
WRITE "="
+5 IF $DATA(SRSS)
WRITE !,?(132-$LENGTH(SRSS)\2),SRSS,!
FOR LINE=1:1:132
WRITE "-"
+6 SET PAGE=PAGE+1
SET SRHDR=1
+7 QUIT
OTHER ; other operations
+1 SET SRLONG=1
IF $LENGTH(SROPER)+$LENGTH($PIECE(^SRF(SRTN,13,OPER,0),"^"))>250
SET SRLONG=0
SET OPER=999
SET SROPERS=" ..."
+2 IF SRLONG
SET SROPERS=$PIECE(^SRF(SRTN,13,OPER,0),"^")
+3 SET SROPER=SROPER_$SELECT(SROPERS=" ...":SROPERS,1:", "_SROPERS)
+4 QUIT
PRINT ; print mortality information
+1 IF $Y+5>IOSL
DO PAGE
if SRSOUT
QUIT
+2 SET Y=SRSDATE
DO D^DIQ
SET SRSDT=$EXTRACT(Y,1,12)
SET (Y,SRAD)=SRDEAD
DO D^DIQ
SET SRSDEAD=$EXTRACT(Y,1,12)
+3 DO DEM^VADPT
SET SRNAME=VADM(1)
SET SSN=VA("PID")
OPS SET SROPER=$PIECE(^SRF(SRTN,"OP"),"^")
SET OPER=0
FOR I=0:0
SET OPER=$ORDER(^SRF(SRTN,13,OPER))
if OPER=""
QUIT
DO OTHER
+1 KILL SROPS,MM,MMM
if $LENGTH(SROPER)<55
SET SROPS(1)=SROPER
SET SROPS(2)=""
IF $LENGTH(SROPER)>54
SET SROPER=SROPER_" "
FOR M=1:1
DO LOOP
if MMM=""
QUIT
+2 SET (SRAUT,SRPTF)=""
+3 SET VAINDT=SRAD-.0001
DO INP^VADPT
SET SRPTF=VAIN(10)
IF SRPTF
SET SRAUT=$PIECE($GET(^DGPT(SRPTF,70)),"^",3)
SET SRAUT=$SELECT(SRAUT=6:"YES",SRAUT=7:"NO",1:"NOT AVAILABLE")
+4 if SRAUT=""
SET SRAUT="NOT AVAILABLE"
+5 WRITE !!,SRSDT,?17,SRNAME,?50,SROPS(1),?112,SRSDEAD,!,?17,VA("PID"),?50,SROPS(2),?112,SRAUT
IF $DATA(SROPS(3))
WRITE !,?50,SROPS(3)
IF $DATA(SROPS(4))
WRITE !,?50,SROPS(4)
+6 QUIT
LOOP ; break procedure if greater than 55 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)'<55
QUIT
SET SROPS(M)=SROPS(M)_MM_" "
SET SROPER=MMM
+2 QUIT
PAGE IF $EXTRACT(IOST)'="P"
IF SRHDR
WRITE !!,"Press RETURN to continue, or '^' to quit: "
READ X:DTIME
IF '$TEST!(X["^")
SET SRSOUT=1
QUIT
+1 DO HDR
+2 QUIT