VistA-FOIAVistA/r/SURGERY-SR/SRONAN1.m

52 lines
2.5 KiB
Mathematica

SRONAN1 ;BIR/MAM - ANNUAL REPORT NON-O.R. PROCEDURES ;12/16/98 11:46 AM
;;3.0; Surgery ;**50,88,127,142**;24 Jun 93
;
; Reference to ^ECC(723 supported by DBIA #205
;
K ^TMP("SR",$J) S (SRHDR,SRSUMM,SRSOUT)=0,^TMP("SR",$J)=0
F S SRSD=$O(^SRF("AC",SRSD)) Q:'SRSD!(SRSD>SRED) S SROP=0 F S SROP=$O(^SRF("AC",SRSD,SROP)) Q:'SROP I $P($G(^SRF(SROP,"NON")),"^")="Y",$D(^SRF(SROP,0)),$$DIV^SROUTL0(SROP) D SET
S SRSS=0 F S SRSS=$O(^TMP("SR",$J,SRSS)) Q:SRSS=""!SRSOUT D HDR Q:SRSOUT S SRCPT=0 F S SRCPT=$O(^TMP("SR",$J,SRSS,SRCPT)) Q:SRCPT=""!SRSOUT D PRINT
Q:SRSOUT S SRSUMM=1,SRSS="" D HDR Q:SRSOUT
S SRSS=0 F S SRSS=$O(^TMP("SR",$J,SRSS)) Q:SRSS=""!(SRSOUT) D SUM
W:'SRSOUT !!,?9,"TOTAL NON-O.R. PROCEDURES FOR "_SRSITE("SITE")_": "_^TMP("SR",$J)
Q
SET ; set local variables
I $P($G(^SRF(SROP,30)),"^") Q
S SRSS=$P(^SRF(SROP,"NON"),"^",8),SRCPT=$P($G(^SRO(136,SROP,0)),"^",2) I 'SRCPT Q
S SRSPEC=$S(SRSS:$P(^ECC(723,SRSS,0),"^"),1:"SPECIALTY NOT ENTERED")
D CPT,UTIL S SROTH=0 F S SROTH=$O(^SRO(136,SROP,3,SROTH)) Q:'SROTH S SRCPT=$P($G(^SRO(136,SROP,3,SROTH,0)),"^") I SRCPT D CPT,UTIL
Q
UTIL ; set ^TMP("SR",$J
S ^TMP("SR",$J)=^TMP("SR",$J)+1
I '$D(^TMP("SR",$J,SRSPEC)) S ^TMP("SR",$J,SRSPEC)=0
S ^TMP("SR",$J,SRSPEC)=^TMP("SR",$J,SRSPEC)+1
I '$D(^TMP("SR",$J,SRSPEC,SRCPT)) S ^TMP("SR",$J,SRSPEC,SRCPT)=1 Q
S ^TMP("SR",$J,SRSPEC,SRCPT)=^TMP("SR",$J,SRSPEC,SRCPT)+1
Q
CPT ; get procedure name and code
S X=$$CPT^ICPTCOD(SRCPT,$P(SRED,".")),SROPER=$P(X,"^",3),SRCPT=$P(X,"^",2)_" "_SROPER
Q
PRINT ; print CPT info
I $Y+5>IOSL D HDR Q:SRSOUT
W !,SRCPT,?66,^TMP("SR",$J,SRSS,SRCPT)
Q
SUM ; print summary
I $Y+5>IOSL D HDR Q:SRSOUT
W !,SRSS,?42,"TOTAL NON-O.R. PROCEDURES: ",?67,^TMP("SR",$J,SRSS)
Q
HDR1 ; print heading to screen
I SRHDR W !!!!,"Press RETURN to continue, or '^' to quit: " R X:DTIME I '$T!(X["^") S SRSOUT=1 Q
W @IOF,!,?22,"ANNUAL REPORT OF NON-O.R. PROCEDURES" I SRSUMM W !,?27,"SUMMARY OF ALL SPECIALTIES"
W !,?(80-$L(SRFRTO)\2),SRFRTO,! F LINE=1:1:80 W "="
W:'SRSUMM&(SRSS'="") !!,?(80-$L(SRSS)\2),SRSS,! S SRHDR=1
Q
HDR ; print heading
I $D(ZTQUEUED) D ^SROSTOP I SRHALT S SRSOUT=1 Q
I $E(IOST)'="P" D HDR1 Q
W:$Y @IOF W !,?(80-$L(SRINST)\2),SRINST,?65,"REVIEWED BY:",!,?32,"SURGICAL SERVICE",!,?22,"ANNUAL REPORT OF NON-O.R. PROCEDURES",?65,"DATE REVIEWED:"
I SRSUMM W !,?27,"SUMMARY OF ALL SPECIALTIES"
W !,?(80-$L(SRFRTO)\2),SRFRTO I 'SRSUMM W !!,"CPT - PROCEDURE",?30,"SPECIALTY",?65,"TOTAL"
W ! F LINE=1:1:80 W "="
W:'SRSUMM&(SRSS'="") !!,?(80-$L(SRSS)\2),SRSS,! S SRHDR=1
Q