source: WorldVistAEHR/trunk/r/SURGERY-SR/SROICU1.m@ 808

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

initial load of WorldVistAEHR

File size: 2.9 KB
Line 
1SROICU1 ;B'HAM ISC/MAM - UNSCHEDULED ADMISSION TO ICU BY SPECIALTY ; 2 OCT 1990 12:17 PM
2 ;;3.0; Surgery ;**48,106**;24 Jun 93
3 S SRSOUT=0,SRSDATE=SRSD-.0001,SREDT=SRED+.9999,SRSSP="SURGICAL SPECIALTY: "_$P(^SRO(137.45,SRSS,0),"^"),SRCT=0
4 D HDR
5 F S SRSDATE=$O(^SRF("AC",SRSDATE)) Q:'SRSDATE!(SRSDATE>SREDT)!SRSOUT S SRTN=0 F S SRTN=$O(^SRF("AC",SRSDATE,SRTN)) Q:'SRTN!SRSOUT I $D(^SRF(SRTN,0)),$$DIV^SROUTL0(SRTN) D SET
6 I SRCT=0 W !!,"No unscheduled admissions to ICU for selected date range."
7 Q
8SET ; case information
9 S X=$P(^SRF(SRTN,0),"^",4) I X'=SRSS Q
10 I '$D(^SRF(SRTN,.2)) Q
11 I $P(^SRF(SRTN,.2),"^",12)="" Q
12 S SR(.4)=$G(^SRF(SRTN,.4)),SRDISP=$P(SR(.4),"^",3),SRDISP1=$P(SR(.4),"^",6),Y=SRDISP,C=$P(^DD(130,.43,0),"^",2) D:Y'="" Y^DIQ S SRDISP=Y I Y["ICU" Q
13 S Y=SRDISP1,C=$P(^DD(130,.46,0),"^",2) D:Y'="" Y^DIQ S SRDISP1=Y I Y=""!(Y'["ICU") Q
14 S SRDIS=SRDISP_"/"_SRDISP1
15 I $Y+7>IOSL D PAGE I SRSOUT Q
16 S DFN=$P(^SRF(SRTN,0),"^") D DEM^VADPT S SRODATE=$E(SRSDATE,4,5)_"/"_$E(SRSDATE,6,7)_"/"_$E(SRSDATE,2,3)
17 S SRDIAG=$S($D(^SRF(SRTN,34)):$P(^(34),"^"),1:"DIAGNOSIS NOT ENTERED"),SR(.1)=$S($D(^SRF(SRTN,.1)):^(.1),1:""),SRSUR=$P(SR(.1),"^",4),SRATT=$P(SR(.1),"^",13)
18 I SRSUR S SRSUR=$P(^VA(200,SRSUR,0),"^")
19 I SRATT S SRATT=$P(^VA(200,SRATT,0),"^") I $L(SRATT)>18 S SRATT=$P(SRATT,",")_","_$E($P(SRATT,",",2))
20OPS S SROPER=$P(^SRF(SRTN,"OP"),"^"),OPER=0 F I=0:0 S OPER=$O(^SRF(SRTN,13,OPER)) Q:OPER="" D OTHER
21 K SROP,MM,MMM S:$L(SROPER)<50 SROP(1)=SROPER I $L(SROPER)>49 S SROPER=SROPER_" " S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
22 W !,SRODATE,?17,VADM(1),?55,SRDIAG,?110,SRSUR,!,?17,VA("PID"),?55,SROP(1),?110,SRATT,!,?17,SRDIS I $D(SROP(2)) W ?55,SROP(2) I $D(SROP(3)) W !,?55,SROP(3) I $D(SROP(4)) W !,?55,SROP(4)
23 W ! S SRCT=SRCT+1
24 Q
25PAGE I $E(IOST)="P" D HDR Q
26 W !!,"Press RETURN to continue, or '^' to quit: " R X:DTIME I '$T!(X="^") S SRSOUT=1 Q
27 I X["?" W !!,"Press RETURN to continue listing cases, or '^' to exit from this option." G PAGE
28HDR ; print heading
29 I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
30 I $Y W @IOF
31 W !,?(132-$L(SRINST)\2),SRINST,!,?58,"SURGICAL SERVICE",?100,"REVIEWED BY: ",!,?52,"UNSCHEDULED ADMISSIONS TO ICU",?100,"DATE REVIEWED: "
32 W !,?(132-$L(SRSSP)\2),SRSSP,!,?53,"FROM ",$E(SRSD,4,5)_"/"_$E(SRSD,6,7)_"/"_$E(SRSD,2,3)," TO ",$E(SRED,4,5)_"/"_$E(SRED,6,7)_"/"_$E(SRED,2,3)
33 W !!,"DATE",?17,"PATIENT",?55,"POSTOPERATIVE DIAGNOSIS",?110,"SURGEON",!,?17,"PATIENT ID",?55,"OPERATIVE PROCEDURE(S)",?110,"ATTENDING SURGEON",!,?17,"REQ DISPOSITION/POSTOP DISPOSITION"
34 W ! F LINE=1:1:132 W "="
35 Q
36OTHER ; other operations
37 S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SRTN,13,OPER,0),"^"))>240 S SRLONG=0,OPER=999,SROPERS=" ..."
38 I SRLONG S SROPERS=$P(^SRF(SRTN,13,OPER,0),"^")
39 S SROPER=SROPER_$S(SROPERS=" ...":SROPERS,1:", "_SROPERS)
40 Q
41LOOP ; break procedure if greater than 50 characters
42 S SROP(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROP(M))+$L(MM)'<50 S SROP(M)=SROP(M)_MM_" ",SROPER=MMM
43 Q
Note: See TracBrowser for help on using the repository browser.