source: FOIAVistA/tag/r/SURGERY-SR/SROAT2P.m@ 949

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

initial load of FOIAVistA 6/30/08 version

File size: 3.7 KB
Line 
1SROAT2P ;B'HAM ISC/MAM - ATTENDING SURGEON REPORT (CONT.) ; [ 05/11/04 11:29 AM ]
2 ;;3.0; Surgery ;**52,50,129**;24 Jun 93
3 S (SRHDR,SRSS)=0,SRPAGE=1
4 F S SRSS=$O(^TMP("SR",$J,SRSS)) Q:SRSS=""!(SRSOUT) S (SRHDR,SRNEW)=0 D PAGE S SRATT=0 F S SRATT=$O(^TMP("SR",$J,SRSS,SRATT)) Q:SRATT=""!(SRSOUT) S SRHDR=1 D MORE
5 I '$D(^TMP("SR",$J)) D HDR W $$NODATA^SROUTL0()
6 Q
7MORE S SRATT1="ATTENDING SURGEON: "_$S($E(SRATT,1,3)'="ZZ ":SRATT,1:$E(SRATT,4,99)) D Q:SRSOUT
8 .I 'SRB D:$Y+11>IOSL PAGE Q:SRSOUT D AT
9 .I SRB D:SRNEW PAGE Q:SRSOUT D:'SRNEW AT S SRNEW=1
10 S SRATC="" F S SRATC=$O(^TMP("SR",$J,SRSS,SRATT,SRATC)) Q:SRATC=""!(SRSOUT) S SRSDATE=0 F S SRSDATE=$O(^TMP("SR",$J,SRSS,SRATT,SRATC,SRSDATE)) Q:'SRSDATE D CASE
11 Q
12CASE S SRTN=0 F S SRTN=$O(^TMP("SR",$J,SRSS,SRATT,SRATC,SRSDATE,SRTN)) Q:'SRTN!(SRSOUT) D SET
13 Q
14SET ; print case
15 I $Y+7>IOSL S SRHDR=1 D PAGE Q:SRSOUT
16 K SRCODE S CODE=SRATC I 'CODE S SRCODE="ATTENDING CODE NOT ENTERED"
17 I CODE S Y=CODE,C=$P(^DD(130,.166,0),"^",2) D Y^DIQ S SRCODE=Y
18 S:SRCODE<36 SRCODE(1)=SRCODE I $L(SRCODE)>35 D
19 .N I,J,X,Y S X=SRCODE F I=0:1:34 S J=35-I,Y=$E(X,J) I Y=" " S SRCODE(1)=$E(X,1,J-1) S SRCODE(2)=$E(X,J+1,$L(X)) Q
20 S SRDT=$E(SRSDATE,4,5)_"/"_$E(SRSDATE,6,7)_"/"_$E(SRSDATE,2,3),SR(0)=^SRF(SRTN,0),DFN=$P(SR(0),"^") D DEM^VADPT
21 S SRDIAG=$S($D(^SRF(SRTN,34)):$P(^(34),"^"),1:"POSTOPERATIVE DIAGNOSIS NOT ENTERED")
22 S SR(.1)=$S($D(^SRF(SRTN,.1)):^(.1),1:""),SRSUR=$P(SR(.1),"^",4),SRFST=$P(SR(.1),"^",5),SRTWO=$P(SR(.1),"^",6)
23 I SRSUR S SRSUR=$P(^VA(200,SRSUR,0),"^") I $L(SRSUR)>17 S SRSUR=$P(SRSUR,",")_","_$E($P(SRSUR,",",2))
24 I SRFST S SRFST=$P(^VA(200,SRFST,0),"^") I $L(SRFST)>17 S SRFST=$P(SRFST,",")_","_$E($P(SRFST,",",2))
25 I SRTWO S SRTWO=$P(^VA(200,SRTWO,0),"^") I $L(SRTWO)>17 S SRTWO=$P(SRTWO,",")_","_$E($P(SRTWO,",",2))
26OPS S SROPER=$P(^SRF(SRTN,"OP"),"^"),OPER=0 F I=0:0 S OPER=$O(^SRF(SRTN,13,OPER)) Q:OPER="" D OTHER
27 K SROP,MM,MMM S:$L(SROPER)<55 SROP(1)=SROPER I $L(SROPER)>54 S SROPER=SROPER_" " S SROPER=SROPER_" " F M=1:1 D LOOP Q:MMM=""
28 W !!,SRDT,?12,VADM(1),?50,SRDIAG,?112,SRSUR,!,SRTN,?12,VA("PID"),?50,SROP(1),?112,SRFST,! W:$P($G(^SRF(SRTN,30)),"^") "ABORTED" W ?12,SRCODE(1) W:$D(SROP(2)) ?50,SROP(2) W ?112,SRTWO
29 I $D(SRCODE(2))!$D(SROP(3)) W ! W:$D(SRCODE(2)) ?13,SRCODE(2) W:$D(SROP(3)) ?50,SROP(3)
30 I $D(SROP(4)) W !,?50,SROP(4)
31 Q
32OTHER ; other operations
33 S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SRTN,13,OPER,0),"^"))>240 S SRLONG=0,OPER=999,SROPERS=" ..."
34 I SRLONG S SROPERS=$P(^SRF(SRTN,13,OPER,0),"^")
35 S SROPER=SROPER_$S(SROPERS=" ...":SROPERS,1:", "_SROPERS)
36 Q
37LOOP ; break procedure if greater than 55 characters
38 S SROP(M)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROP(M))+$L(MM)'<55 S SROP(M)=SROP(M)_MM_" ",SROPER=MMM
39 Q
40PAGE I $E(IOST)="P"!('SRFLG) D HDR S SRFLG=1 Q
41 W !!,"Press RETURN to continue, or '^' to quit: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
42 I X["?" W !!,"There are more cases for the date range selected. If you want to continue",!,"listing them, enter RETURN. Enter '^' to exit from this option." G PAGE
43HDR ; print heading
44 I +$Y W @IOF
45 W !,?(132-$L(SRINST)\2),SRINST,?120,"PAGE: ",SRPAGE,!,?58,"SURGICAL SERVICE",?100,"REVIEWED BY: ",!,?54,"ATTENDING SURGEON REPORT",?100,"DATE REVIEWED: "
46 W !,?(132-$L(SRFRTO)\2),SRFRTO,?100,SRPRINT
47 W !!?3,"DATE",?12,"PATIENT",?50,"PRINCIPAL DIAGNOSIS",?112,"SURGEON",!,?2,"CASE #",?14,"ID#",?50,"PRINCIPAL OPERATIVE PROCEDURE",?112,"1ST ASST",!,?12,"ATTENDING CODE",?112,"2ND ASST",! F I=1:1:132 W "="
48 S SRPAGE=SRPAGE+1
49SPEC S SRSSN=$S($E(SRSS,1,2)="ZZ":"SPECIALTY NOT ENTERED",1:SRSS)
50 S SRSS1="" F LINE=1:1:$L(SRSSN) S SRSS1=SRSS1_"="
51 S X=132-$L(SRSSN)\2 W !!,?X,SRSSN,!,?X,SRSS1
52AT I 'SRHDR S SRHDR=1 Q
53 S SRATT2="" F LINE=1:1:$L(SRATT1) S SRATT2=SRATT2_"-"
54 S X=132-$L(SRATT1)\2 W !!,?X,SRATT1,!,?X,SRATT2 S SRHDR=0
55 Q
Note: See TracBrowser for help on using the repository browser.