source: WorldVistAEHR/trunk/r/SURGERY-SR/SROMORT.m@ 1150

Last change on this file since 1150 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.3 KB
RevLine 
[613]1SROMORT ;B'HAM ISC/MAM - MORTALITY REPORT ; [ 10/01/98 12:55 PM ]
2 ;;3.0; Surgery ;**5,34,50**;24 Jun 93
3BEG ; entry when queued
4 U IO N SRFRTO K ^TMP("SR",$J) S (SRHDR,SRSOUT)=0,PAGE=1
5 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
6 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
7 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
8 I '$D(^TMP("SR",$J)) K SRSS D HDR W !!,"No mortalities for the selected date range.",!
9END ;
10 W:$E(IOST)="P" @IOF K ^TMP("SR",$J) I $D(ZTQUEUED) Q:$G(ZTSTOP) S ZTREQ="@" Q
11 I $E(IOST)'="P",'SRSOUT W !!,"Press RETURN to continue " R X:DTIME
12 D ^%ZISC K SRTN D ^SRSKILL W @IOF
13 Q
14MORE 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
15 Q
16SEARCH ; search for procedures
17 S X1=SRSD1,X2=-30 D C^%DTC S SRCUTDT=X
18 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
19 Q
20UTIL ; set ^TMP
21 I '$D(^SRF(SRTN,.2)) Q
22 I $P(^SRF(SRTN,.2),"^",12)="" Q
23 S Y=$P(^SRF(SRTN,0),"^",4) S SRSS=$S(Y:$P(^SRO(137.45,Y,0),"^"),1:"SURGICAL SPECIALTY NOT ENTERED")
24 S ^TMP("SR",$J,SRSS,SRSDATE,DFN)=SRSD1_"^"_SRTN
25 Q
26HDR ; print heading
27 I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
28 W:$Y @IOF W !,?(132-$L(SRINST)\2),SRINST,?120,"PAGE ",PAGE,!,?58,"SURGICAL SERVICE",?100,"REVIEWED BY: ",!,?58,"MORTALITY REPORT",?100,"DATE REVIEWED: "
29 W !,?(132-$L(SRFRTO)\2),SRFRTO,?100,SRPRINT
30 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 "="
31 I $D(SRSS) W !,?(132-$L(SRSS)\2),SRSS,! F LINE=1:1:132 W "-"
32 S PAGE=PAGE+1,SRHDR=1
33 Q
34OTHER ; other operations
35 S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SRTN,13,OPER,0),"^"))>250 S SRLONG=0,OPER=999,SROPERS=" ..."
36 I SRLONG S SROPERS=$P(^SRF(SRTN,13,OPER,0),"^")
37 S SROPER=SROPER_$S(SROPERS=" ...":SROPERS,1:", "_SROPERS)
38 Q
39PRINT ; print mortality information
40 I $Y+5>IOSL D PAGE Q:SRSOUT
41 S Y=SRSDATE D D^DIQ S SRSDT=$E(Y,1,12),(Y,SRAD)=SRDEAD D D^DIQ S SRSDEAD=$E(Y,1,12)
42 D DEM^VADPT S SRNAME=VADM(1),SSN=VA("PID")
43OPS S SROPER=$P(^SRF(SRTN,"OP"),"^"),OPER=0 F I=0:0 S OPER=$O(^SRF(SRTN,13,OPER)) Q:OPER="" D OTHER
44 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=""
45 S (SRAUT,SRPTF)=""
46 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")
47 S:SRAUT="" SRAUT="NOT AVAILABLE"
48 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)
49 Q
50LOOP ; break procedure if greater than 55 characters
51 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
52 Q
53PAGE I $E(IOST)'="P",SRHDR W !!,"Press RETURN to continue, or '^' to quit: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
54 D HDR
55 Q
Note: See TracBrowser for help on using the repository browser.