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
SROATT1 ;B'HAM ISC/MAM - ATTENDING SURGEON REPORT (1 SPECIALTY) ; [ 05/11/04 2:33 PM ]
+1 ;;3.0; Surgery ;**50,129**;24 Jun 93
+2 KILL ^TMP("SR",$JOB),^TMP("SRTOT",$JOB)
+3 SET ^TMP("SRTOT",$JOB)=0
SET SRSOUT=0
SET SRSDATE=SRSD-.0001
SET SREDT=SRED+.9999
+4 FOR
SET SRSDATE=$ORDER(^SRF("AC",SRSDATE))
IF 'SRSDATE!(SRSDATE>SREDT)!(SRSOUT)
QUIT
SET SRTN=0
FOR
SET SRTN=$ORDER(^SRF("AC",SRSDATE,SRTN))
IF 'SRTN!(SRSOUT)
QUIT
IF $DATA(^SRF(SRTN,0))
IF $$DIV^SROUTL0(SRTN)
DO UTIL
+5 IF SRBOTH'=2
DO ^SROAT1P
+6 IF SRSOUT
QUIT
IF SRBOTH'=1
IF SRBOTH'=2
DO RET
IF SRSOUT
QUIT
DO ^SROAT1T
+7 QUIT
UTIL ; set ^TMP
+1 IF '$DATA(^SRF(SRTN,.2))
QUIT
+2 IF '$PIECE(^SRF(SRTN,.2),"^",12)
QUIT
+3 SET X=$PIECE(^SRF(SRTN,0),"^",4)
IF X'=SRSS
QUIT
+4 SET SR(.1)=$SELECT($DATA(^SRF(SRTN,.1)):^(.1),1:"")
SET SRATT=$PIECE(SR(.1),"^",13)
SET SRATT=$SELECT(SRATT:$PIECE(^VA(200,SRATT,0),"^"),1:"ZZ ATTENDING NOT ENTERED")
+5 SET SRCODE=$PIECE(SR(.1),"^",10)
IF SRCODE=""
SET SRCODE="ZZ"
+6 IF '$DATA(^TMP("SRTOT",$JOB,SRCODE))
SET ^TMP("SRTOT",$JOB,SRCODE)=0
+7 SET ^TMP("SR",$JOB,SRATT,SRCODE,SRSDATE,SRTN)=""
+8 SET ^TMP("SRTOT",$JOB)=^TMP("SRTOT",$JOB)+1
SET ^TMP("SRTOT",$JOB,SRCODE)=^TMP("SRTOT",$JOB,SRCODE)+1
+9 QUIT
RET IF $EXTRACT(IOST)="P"
QUIT
+1 WRITE !!,"Press RETURN to continue, or '^' to quit: "
READ X:DTIME
IF '$TEST!(X["^")
SET SRSOUT=1
QUIT
+2 IF X["?"
WRITE !!,"Enter RETURN to continue with this report, or '^' to quit this option."
GOTO RET
+3 QUIT