VistA-WorldVistAEHR/r/SURGERY-SR/SROATT1.m

23 lines
1.2 KiB
Mathematica

SROATT1 ;B'HAM ISC/MAM - ATTENDING SURGEON REPORT (1 SPECIALTY) ; [ 05/11/04 2:33 PM ]
;;3.0; Surgery ;**50,129**;24 Jun 93
K ^TMP("SR",$J),^TMP("SRTOT",$J)
S ^TMP("SRTOT",$J)=0,SRSOUT=0,SRSDATE=SRSD-.0001,SREDT=SRED+.9999
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 UTIL
I SRBOTH'=2 D ^SROAT1P
Q:SRSOUT I SRBOTH'=1 D:SRBOTH'=2 RET Q:SRSOUT D ^SROAT1T
Q
UTIL ; set ^TMP
I '$D(^SRF(SRTN,.2)) Q
I '$P(^SRF(SRTN,.2),"^",12) Q
S X=$P(^SRF(SRTN,0),"^",4) I X'=SRSS Q
S SR(.1)=$S($D(^SRF(SRTN,.1)):^(.1),1:""),SRATT=$P(SR(.1),"^",13),SRATT=$S(SRATT:$P(^VA(200,SRATT,0),"^"),1:"ZZ ATTENDING NOT ENTERED")
S SRCODE=$P(SR(.1),"^",10) S:SRCODE="" SRCODE="ZZ"
I '$D(^TMP("SRTOT",$J,SRCODE)) S ^TMP("SRTOT",$J,SRCODE)=0
S ^TMP("SR",$J,SRATT,SRCODE,SRSDATE,SRTN)=""
S ^TMP("SRTOT",$J)=^TMP("SRTOT",$J)+1,^TMP("SRTOT",$J,SRCODE)=^TMP("SRTOT",$J,SRCODE)+1
Q
RET I $E(IOST)="P" Q
W !!,"Press RETURN to continue, or '^' to quit: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
I X["?" W !!,"Enter RETURN to continue with this report, or '^' to quit this option." G RET
Q