source: WorldVistAEHR/trunk/r/SURGERY-SR/SROSUR.m@ 1240

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

initial load of WorldVistAEHR

File size: 4.0 KB
RevLine 
[613]1SROSUR ;B'HAM ISC/MAM - SURGEON STAFFING REPORT ; [ 07/27/98 2:33 PM ]
2 ;;3.0; Surgery ;**34,50**;24 Jun 93
3SET ; set variables and print from ^SRF(
4 K CPT,ICD S S(0)=^SRF(M,0),DFN=$P(S(0),"^") D DEM^VADPT S PAT=VADM(1),SSN=VA("PID"),SRTN=M,Y=L D D^DIQ S DATE=Y
5 I $L(PAT)>18 S PAT=$P(PAT,",")_", "_$E($P(PAT,",",2))
6OPS S SROPER=$P(^SRF(SRTN,"OP"),"^"),OPER=0 F S OPER=$O(^SRF(SRTN,13,OPER)) Q:OPER="" D OTHER
7 K SROPS,MM,MMM S:$L(SROPER)<50 SROPS(1)=SROPER I $L(SROPER)>49 S SROPER=SROPER_" " F MAM=1:1 D LOOP Q:MMM=""
8 I $D(^SRF(SRTN,.2)),$P(^(.2),"^",3)'="" S SRDG=34,SRDG1=15
9 I '$D(SRDG) S SRDG=33,SRDG1=14
10 S ICD("*")=$S($D(^SRF(SRTN,SRDG)):$P(^SRF(SRTN,SRDG),"^"),1:""),(CNT,ICD)=0 F I=0:0 S ICD=$O(^SRF(SRTN,SRDG1,ICD)) Q:ICD="" S CNT=CNT+1,ICD(CNT)=$P(^SRF(SRTN,SRDG1,ICD,0),"^")
11 I $Y+7>IOSL D ASK
12 Q:SRF W !,DATE,?23,PAT,?43,SROPS(1),?95,$E(ICD("*"),1,35) S (CPT,ICD)=0
13 W !,SRTN,?23,SSN S ICD=$O(ICD(ICD)) W:$D(SROPS(2)) ?43,SROPS(2) W:ICD ?95,$E(ICD(ICD),1,35) S:ICD ICD=$O(ICD(ICD)) I $D(SROPS(3)) W !,?43,SROPS(3) I ICD W ?95,$E(ICD(ICD),1,35)
14 I 'CPT W:ICD !,?95,$E(ICD(ICD),1,35)
15 W:$D(SROPS(4)) !,?43,SROPS(4) W:$D(SROPS(5)) !,?43,SROPS(5) W:$D(SROPS(6)) !,?43,SROPS(6) W ! Q
16SETUP ; set up ^TMP(
17 I $D(^SRF(SRTN,31)),$P(^(31),"^",8)'="" Q
18 Q:'$D(^SRF(SRTN,.2)) I $P(^(.2),"^",12)="" Q
19 Q:'$D(^SRF(SRTN,.1)) S S(.1)=^(.1),DATE=$P(^SRF(SRTN,0),"^",9),SUR=$P(S(.1),"^",4),ATT=$P(S(.1),"^",13),FRST=$P(S(.1),"^",5),SCND=$P(S(.1),"^",6) S:SUR'="" ^TMP("SRO",$J,$P(^VA(200,SUR,0),"^"),"SUR",DATE,L)=""
20 I $O(^SRF(SRTN,28,0)) D OTHER^SROSUR1
21 S:ATT'="" ^TMP("SRO",$J,$P(^VA(200,ATT,0),"^"),"ATT",DATE,L)="" S:FRST'="" ^TMP("SRO",$J,$P(^VA(200,FRST,0),"^"),"1ST",DATE,L)="" S:SCND'="" ^TMP("SRO",$J,$P(^VA(200,SCND,0),"^"),"2ND",DATE,L)=""
22 Q
23ASK S SRUL=0 I $E(IOST)'="P" W !!,"Press RETURN to continue, or '^' to quit:. " R X:DTIME I '$T!(X="^") S SRF=1 Q
24 D HDR Q
25END D ^SRSKILL K SRTN D ^%ZISC W @IOF
26 Q
27OTHER ; other operations
28 S SRLONG=1 I $L(SROPER)+$L($P(^SRF(SRTN,13,OPER,0),"^"))>250 S SRLONG=0,OPER=999,SROPERS=" ..."
29 I SRLONG S SROPERS=$P(^SRF(SRTN,13,OPER,0),"^")
30 S SROPER=SROPER_$S(SROPERS=" ...":SROPERS,1:", "_SROPERS)
31 Q
32LOOP ; break procedure if greater than 50 characters
33 S SROPS(MAM)="" F LOOP=1:1 S MM=$P(SROPER," "),MMM=$P(SROPER," ",2,200) Q:MMM="" Q:$L(SROPS(MAM))+$L(MM)'<50 S SROPS(MAM)=SROPS(MAM)_MM_" ",SROPER=MMM
34 Q
35ASSTS ;
36 S SROTH=0 F S SROTH=$O(^SRF(SRTN,28,SROTH)) Q:'SROTH S SROTHER=^SRF(SRTN,28,SROTH,0) I SROTHER=SROSUR S SROTHER=$P(^VA(200,SROTHER,0),"^"),^TMP("SRO",$J,SROTHER,"OTH",DATE,SRTN)=""
37 Q
38NAME I SRUL W ! F LINE=1:1:IOM W "-"
39 S SRUL=1 W !!,?50,"** "_J_" **" Q
40ROLE I $Y+5>IOSL D ASK
41 Q:SRF W !!,?50,"ROLE: " W $S(K="1ST":"FIRST ASSISTANT",K="2ND":"SECOND ASSISTANT",K="ATT":"ATTENDING SURGEON",K="OTH":"OTHER ASSISTANT",1:"SURGEON"),!
42 Q
43HDR ; print heading
44 I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRF=1 Q
45 W:$Y @IOF W !,?(132-$L(SRINST)\2),SRINST,?120,"PAGE: "_PAGE,!,?58,"SURGICAL SERVICE",?100,"REVIEWED BY: ",!,?54,"SURGEON STAFFING REPORT",?100,"DATE REVIEWED: "
46 W !,?(132-$L(SRFRTO)\2),SRFRTO,?100,SRPRINT
47 W !!,?1,"DATE/TIME",?23,"PATIENT",?43,"OPERATION(S)",?95,"DIAGNOSIS",!,?1,"CASE #",?23,"ID #",! F LINE=1:1:132 W "="
48 S PAGE=PAGE+1 I $D(J) D NAME,ROLE
49 Q
50EN1 ;
51 U IO N SRFRTO 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
52 K J S (SRF,SRUL)=0,PAGE=1 D HDR S J=SRSD-.0001 K ^TMP("SRO",$J)
53 F S J=$O(^SRF("AC",J)) Q:J>(SRED+.9999)!(J="") S L=0 F S L=$O(^SRF("AC",J,L)) Q:L="" S SRTN=L I $D(^SRF(SRTN,0)),$$DIV^SROUTL0(SRTN) D SETUP
54PRINT ; print from ^TMP(
55 S J=0 F S J=$O(^TMP("SRO",$J,J)) Q:J=""!(SRF) D NAME S K=0 F S K=$O(^TMP("SRO",$J,J,K)) Q:K=""!(SRF) D ROLE S L=0 F S L=$O(^TMP("SRO",$J,J,K,L)) Q:L=""!SRF D PRIN2
56 I '$D(^TMP("SRO",$J)) W $$NODATA^SROUTL0()
57 K ^TMP("SRO",$J) W:$E(IOST)="P" @IOF I $D(ZTQUEUED) Q:$G(ZTSTOP) S ZTREQ="@" Q
58 I $E(IOST)'="P",'SRF W !!,"Press RETURN to continue " R X:DTIME
59 G END
60PRIN2 S M=0 F S M=$O(^TMP("SRO",$J,J,K,L,M)) Q:M=""!SRF S SRTN=M D SET
61 Q
Note: See TracBrowser for help on using the repository browser.