Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SROAR1

SROAR1.m

Go to the documentation of this file.
SROAR1 ;BIR/MAM - ANNUAL REPORT, ALL SPECIALTIES ;11/17/99  6:25 AM
 ;;3.0; Surgery ;**34,50,88,127,142**;24 Jun 93
 S (GRAND,GMAJ,GMIN,GMAS,GMAR,GMIS,GMIR)=0 K ^TMP("SR",$J) S PAGE=1
 D HDR Q:SRHALT  S SRSDATE=SDATE1 F  S SRSDATE=$O(^SRF("AC",SRSDATE)) Q:SRSDATE>EDATE1!('SRSDATE)!SRHALT  S SRTN=0 F  S SRTN=$O(^SRF("AC",SRSDATE,SRTN)) Q:'SRTN!SRHALT  I $D(^SRF(SRTN,0)),$$DIV^SROUTL0(SRTN) D SET
 S SRSS=0 F  S SRSS=$O(^TMP("SR",$J,SRSS)) Q:SRSS=""!SRHALT  D SPEC S SRCPT=0 F  S SRCPT=$O(^TMP("SR",$J,SRSS,SRCPT)) D:SRCPT="" TOTS Q:SRCPT=""!SRHALT  D OUT
 W !!! F LINE=1:1:132 W "="
 D:$Y+6>IOSL HDR Q:SRHALT  W !!,"TOTAL OPERATIONS:",?50,GRAND,?68,GMAS,?77,GMAR,?88,GMAJ,?103,GMIS,?112,GMIR,?124,GMIN,!! F I=1:1:132 W "="
 Q
SPEC ; specialty heading
 D:$Y+5>IOSL HDR Q:SRHALT  W !,?(132-$L(SRSS)\2),SRSS,! F LINE=1:1:132 W "-"
 S (TOTAL,TOTMAJ,TOTMIN,TOTMAS,TOTMAR,TOTMIS,TOTMIR)=0
 Q
HDR ; print heading
 I $D(ZTQUEUED) D ^SROSTOP Q:SRHALT
 W:$Y @IOF W !,?(132-$L(SRINST)\2),SRINST,?120,"PAGE: "_PAGE,!,?58,"SURGICAL SERVICE",?100,"REVIEWED BY:",!,?48,"ANNUAL REPORT OF SURGICAL PROCEDURES",?100,"DATE REVIEWED:"
 W !,?(132-$L(SRFRTO)\2),SRFRTO,?100,SRPRINT
 W !!,?75,"MAJOR",?110,"MINOR",!,"CPT CODE - OPERATION",?48,"TOTAL",?67,"STAFF",?74,"RESIDENT",?87,"TOTAL",?102,"STAFF",?109,"RESIDENT",?122,"TOTAL",! F I=1:1:132 W "-"
 S PAGE=PAGE+1
 Q
OUT ; print info
 K MAJR,MAJS,MAJT,MINR,MINS,MINT I $Y+5>IOSL D HDR Q:SRHALT  W !,?(132-$L(SRSS)\2),SRSS,! F LINE=1:1:132 W "-"
 S SRCPT("NAME")=SRCPT_" "_^TMP("SR",$J,SRSS,SRCPT)
 S (MAJS,MAJR,MINS,MINR)=0
 I $D(^TMP("SR",$J,SRSS,SRCPT,"J","S")) S MAJS=^("S")
 I $D(^TMP("SR",$J,SRSS,SRCPT,"J","R")) S MAJR=^("R")
 I $D(^TMP("SR",$J,SRSS,SRCPT,"N","S")) S MINS=^("S")
 I $D(^TMP("SR",$J,SRSS,SRCPT,"N","R")) S MINR=^("R")
 S MAJT=MAJR+MAJS,MINT=MINR+MINS,SUBT=MAJT+MINT,TOTAL=TOTAL+SUBT,TOTMAJ=TOTMAJ+MAJT,TOTMIN=TOTMIN+MINT,TOTMAS=TOTMAS+MAJS,TOTMAR=TOTMAR+MAJR,TOTMIS=TOTMIS+MINS,TOTMIR=TOTMIR+MINR
 W !,SRCPT("NAME"),?50,SUBT,?68,MAJS,?77,MAJR,?88,MAJT,?103,MINS,?112,MINR,?124,MINT
 Q
SET ; set local variables
 Q:'$D(^SRF(SRTN,.2))  I $P(^SRF(SRTN,.2),"^",12)="" Q
 I $D(^SRF(SRTN,30)),$P(^(30),"^")'="" Q
 I $D(^SRF(SRTN,31)),$P(^(31),"^",8)'="" Q
 K CPT S SR(0)=^SRF(SRTN,0),SRSS=$P(SR(0),"^",4) S SRSS=$S(SRSS:$P(^SRO(137.45,SRSS,0),"^"),1:"SPECIALTY NOT ENTERED")
 S SRMAJ=$P(SR(0),"^",3) S:SRMAJ="" SRMAJ="N"
 S SRATT=$P($G(^SRF(SRTN,.1)),"^",3) S:SRATT="" SRATT="R"
 S (CPT,CNT)=0 F  S CPT=$O(^SRO(136,SRTN,3,CPT)) Q:CPT=""  S CNT=CNT+1 S Y=$P($G(^SRO(136,SRTN,3,CPT,0)),"^") I Y S X=$$CPT^ICPTCOD(Y,$P(^SRF(SRTN,0),"^",9)),CPT(CNT)=$P(X,"^",2,3)
 S CPT("*")=$P($G(^SRO(136,SRTN,0)),"^",2) I CPT("*")'="" S X=$$CPT^ICPTCOD(CPT("*"),$P(^SRF(SRTN,0),"^",9)),CPT("*")=$P(X,"^",2,3)
 S CPT=0 F  S CPT=$O(CPT(CPT)) Q:CPT=""  I CPT(CPT)'="" D SETUTL
 Q
SETUTL ; set ^TMP("SR",$J)
 S SRCPT=$P(CPT(CPT),"^"),FLAG=0
 I $D(^TMP("SR",$J,SRSS,SRCPT,SRMAJ,SRATT)) S ^TMP("SR",$J,SRSS,SRCPT,SRMAJ,SRATT)=^TMP("SR",$J,SRSS,SRCPT,SRMAJ,SRATT)+1,FLAG=1
 I FLAG Q
 S ^TMP("SR",$J,SRSS,SRCPT,SRMAJ,SRATT)=1,^TMP("SR",$J,SRSS,SRCPT)=$P(CPT(CPT),"^",2)
 Q
TOTS W !!! F I=1:1:132 W "-"
 D:$Y+5>IOSL HDR Q:SRHALT  W !,"TOTALS FOR "_SRSS_": ",?50,TOTAL,?68,TOTMAS,?77,TOTMAR,?88,TOTMAJ,?103,TOTMIS,?112,TOTMIR,?124,TOTMIN,! F LINE=1:1:132 W "-"
GRAND S GRAND=GRAND+TOTAL,GMAS=GMAS+TOTMAS,GMAR=GMAR+TOTMAR,GMIS=GMIS+TOTMIS,GMIR=GMIR+TOTMIR,GMAJ=GMAJ+TOTMAJ,GMIN=GMIN+TOTMIN
 Q