source: WorldVistAEHR/trunk/r/SURGERY-SR/SROCOMP.m@ 1306

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

initial load of WorldVistAEHR

File size: 3.7 KB
Line 
1SROCOMP ;BIR/MAM - VIEW OCCURRENCES ; [ 05/11/04 7:54 AM ]
2 ;;3.0; Surgery ;**37,38,88,129**;24 Jun 93
3 S SRSOUT=0 K SRNEWOP D ^SROPS I '$D(SRTN) S SRSOUT=1 G END
4 S SR(0)=^SRF(SRTN,0),DFN=$P(SR(0),"^") D DEM^VADPT S SRNAME=VADM(1)_" ("_VA("PID")_")"
5 S Y=$P(SR(0),"^",9) D D^DIQ S SRSDATE=$P(Y,"@")_" "_$P(Y,"@",2)
6 S SR(.1)=$G(^SRF(SRTN,.1)),SRSUR=$P(SR(.1),"^",4),SRATT=$P(SR(.1),"^",13)
7 S SRSUR=$S(SRSUR:$P(^VA(200,SRSUR,0),"^"),1:"NOT ENTERED"),SRATT=$S(SRATT:$P(^VA(200,SRATT,0),"^"),1:"NOT ENTERED")
8 S SRATC="",Y=$P($G(^SRF(SRTN,.1)),"^",10) I Y S C=$P(^DD(130,.166,0),"^",2) D Y^DIQ S SRATC=Y
9 I SRATC="" S SRATC="ATTENDING CODE NOT ENTERED"
10 S SROPER=$P(^SRF(SRTN,"OP"),"^"),X=$P(^("OP"),"^",2) I X S CPT=$P($$CPT^ICPTCOD(X),"^",2),Y=CPT D SSPRIN^SROCPT S CPT=Y,SROPER=SROPER_" ("_CPT_")"
11 K SROPS,MM,MMM S:$L(SROPER)<55 SROPS(1)=SROPER I $L(SROPER)>54 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
12 S X=$P($G(^SRF(SRTN,.2)),"^",12) S DIAG=$S(X:"POST",1:"PRE")
13 S SRDIAG=$S(DIAG="POST":$P($G(^SRF(SRTN,34)),"^"),1:$P($G(^SRF(SRTN,33)),"^")) I DIAG="POST" S X=$P($G(^SRF(SRTN,34)),"^",2) I X S ICD=$P(^ICD9(X,0),"^"),SRDIAG=SRDIAG_" ("_ICD_")"
14 I '$L(SRDIAG) S SRDIAG="NOT ENTERED"
15 S (CMP,CNT)=0 F S CMP=$O(^SRF(SRTN,10,CMP)) Q:'CMP S CNT=CNT+1,INTRA(CNT)=$P(^SRF(SRTN,10,CMP,0),"^")_"^"_$P(^(0),"^",6)
16 S (CMP,CNT)=0 F S CMP=$O(^SRF(SRTN,16,CMP)) Q:'CMP S CNT=CNT+1,POST(CNT)=$P(^SRF(SRTN,16,CMP,0),"^")_"^"_$P(^(0),"^",6)_"^"_$P(^(0),"^",7)
17 D HDR
18 W !!,"Date of Operation: ",?21,SRSDATE,!,"Principal Operation: ",?21,SROPS(1) I $D(SROPS(2)) W !,?21,SROPS(2) I $D(SROPS(3)) W !,?21,SROPS(3)
19 W !!,"Surgeon: ",?19,SRSUR,!,"Attending Surgeon: "_SRATT,!,"Attending Code: ",?16,SRATC
20 W !!,"Principal "_$S(DIAG="POST":"Postop",1:"Preop")_" Diagnosis: ",?30,SRDIAG
21 W !!,"Intraoperative Occurrences: " I '$O(INTRA(0)) W "NONE ENTERED"
22 I $O(INTRA(0)) S CMP=0 F S CMP=$O(INTRA(CMP)) Q:'CMP!(SRSOUT) D INTRA
23 G:SRSOUT END W !!,"Postoperative Occurrences: " I '$O(POST(0)) W "NONE ENTERED"
24 I $O(POST(0)) S CMP=0 F S CMP=$O(POST(CMP)) Q:'CMP!(SRSOUT) D POST
25 I SRSOUT G END
26 K SRRET S (RET,CNT)=0 F S RET=$O(^SRF(SRTN,29,RET)) Q:'RET S X=^SRF(SRTN,29,RET,0),Y=$P(X,"^",3) I Y="R" S CNT=CNT+1,SRRET(CNT)=$P(X,"^")
27 I $O(SRRET(0)) D RET W !!,"Related Returns to Surgery: " S RET=0 F S RET=$O(SRRET(RET)) Q:'RET!(SRSOUT) D RELATE
28END I 'SRSOUT W !!,"Press RETURN to continue " R X:DTIME
29 D ^SRSKILL K SRTN W @IOF
30 Q
31LOOP ; break procedure if greater than 55 characters
32 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
33 Q
34RET W !!,"Press RETURN to continue, or '^' to quit: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
35 I X["?" W !!,"Press RETURN to list more information, or '^' to leave this option." G RET
36HDR W @IOF,!,SRNAME,?50,"OCCURRENCES",! F LINE=1:1:80 W "-"
37 Q
38INTRA ; intraop occurrences
39 I $Y+4>IOSL D RET I SRSOUT Q
40 W:CMP>1 ! W ?30,$P(INTRA(CMP),"^") S OUT=$P(INTRA(CMP),"^",2),OUT=$S(OUT="I":"IMPROVED",OUT="W":"WORSE",OUT="D":"DEATH",OUT="U":"UNRESOLVED",1:"NOT ENTERED") W !,?30,"Outcome: "_OUT
41 Q
42POST ; postop occurrences
43 I $Y+4>IOSL D RET I SRSOUT Q
44 W:CMP>1 ! W ?30,$P(POST(CMP),"^") S D=$P(POST(CMP),"^",3) I D S D=" ("_$E(D,4,5)_"/"_$E(D,6,7)_"/"_$E(D,2,3)_")" W D
45 S OUT=$P(POST(CMP),"^",2),OUT=$S(OUT="I":"IMPROVED",OUT="W":"WORSE",OUT="D":"DEATH",OUT="U":"UNRESOLVED",1:"NOT ENTERED") W !,?30,"Outcome: "_OUT
46 Q
47RELATE ; print related returns
48 I $Y+4>IOSL D RET I SRSOUT Q
49 S Y=$P(^SRF(SRRET(RET),0),"^",9),SRSDATE=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3),SROPER=$P(^SRF(SRRET(RET),"OP"),"^")
50 K SROPS,MM,MMM S:$L(SROPER)<55 SROPS(1)=SROPER I $L(SROPER)>54 S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
51 W !,SRSDATE,?10,SROPS(1) I $D(SROPS(2)) W !,?10,SROPS(2) I $D(SROPS(3)) W !,?10,SROPS(3)
52 W !
53 Q
Note: See TracBrowser for help on using the repository browser.