source: WorldVistAEHR/trunk/r/SURGERY-SR/SROAR2.m@ 1720

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

initial load of WorldVistAEHR

File size: 3.0 KB
Line 
1SROAR2 ;BIR/MAM - ANNUAL REPORT, ONE SPECIALTY ;11/17/99 6:46 AM
2 ;;3.0; Surgery ;**34,60,50,88,127,142**;24 Jun 93
3 S SRSP=$P(^SRO(137.45,SRSS,0),"^"),(GRAND,GMAJ,GMIN,GMAS,GMAR,GMIS,GMIR)=0,PAGE=1 K ^TMP("SR",$J)
4 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
5 W !,?(132-$L(SRSP)\2),SRSP,! F LINE=1:1:132 W "-"
6 S (TOTAL,TOTMAJ,TOTMIN,TOTMAS,TOTMAR,TOTMIS,TOTMIR)=0
7 S SRCPT=0 F S SRCPT=$O(^TMP("SR",$J,SRSS,SRCPT)) D:SRCPT="" TOTS Q:SRCPT="" D OUT
8 Q
9HDR ; print heading
10 I $D(ZTQUEUED) D ^SROSTOP Q:SRHALT
11 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:"
12 W !,?(132-$L(SRFRTO)\2),SRFRTO,?100,SRPRINT
13 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 "-"
14 S PAGE=PAGE+1
15 Q
16OUT ; print info
17 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 "-"
18 S SRCPT("NAME")=SRCPT_" "_^TMP("SR",$J,SRSS,SRCPT)
19 S (MAJS,MAJR,MINS,MINR)=0
20 I $D(^TMP("SR",$J,SRSS,SRCPT,"J","S")) S MAJS=^("S")
21 I $D(^TMP("SR",$J,SRSS,SRCPT,"J","R")) S MAJR=^("R")
22 I $D(^TMP("SR",$J,SRSS,SRCPT,"N","S")) S MINS=^("S")
23 I $D(^TMP("SR",$J,SRSS,SRCPT,"N","R")) S MINR=^("R")
24 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
25 W !,SRCPT("NAME"),?50,SUBT,?68,MAJS,?77,MAJR,?88,MAJT,?103,MINS,?112,MINR,?124,MINT
26 Q
27SET ; set local variables
28 Q:'$D(^SRF(SRTN,.2)) I $P(^SRF(SRTN,.2),"^",12)="" Q
29 I $D(^SRF(SRTN,30)),$P(^(30),"^")'="" Q
30 I $D(^SRF(SRTN,31)),$P(^(31),"^",8)'="" Q
31 S SR(0)=^SRF(SRTN,0),X=$P(SR(0),"^",4) Q:'X S SRSPEC=X I SRSPEC'=SRSS Q
32 K CPT S SRMAJ=$P(SR(0),"^",3) S:SRMAJ="" SRMAJ="N"
33 S SRATT=$P($G(^SRF(SRTN,.1)),"^",3) S:SRATT="" SRATT="R"
34 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)
35 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)
36 S CPT=0 F S CPT=$O(CPT(CPT)) Q:CPT="" I CPT(CPT)'="" D SETUTL
37 Q
38SETUTL ; set ^TMP("SR",$J)
39 S SRCPT=$P(CPT(CPT),"^"),FLAG=0
40 I $D(^TMP("SR",$J,SRSPEC,SRCPT,SRMAJ,SRATT)) S ^TMP("SR",$J,SRSPEC,SRCPT,SRMAJ,SRATT)=^TMP("SR",$J,SRSPEC,SRCPT,SRMAJ,SRATT)+1,FLAG=1
41 I FLAG Q
42 S ^TMP("SR",$J,SRSPEC,SRCPT,SRMAJ,SRATT)=1,^TMP("SR",$J,SRSPEC,SRCPT)=$P(CPT(CPT),"^",2)
43 Q
44TOTS W !!! F I=1:1:132 W "="
45 D:$Y+5>IOSL HDR Q:SRHALT W !,"TOTALS FOR "_SRSP_": ",?50,TOTAL,?68,TOTMAS,?77,TOTMAR,?88,TOTMAJ,?103,TOTMIS,?112,TOTMIR,?124,TOTMIN,! F LINE=1:1:132 W "="
46GRAND S GRAND=GRAND+TOTAL,GMAS=GMAS+TOTMAS,GMAR=GMAR+TOTMAR,GMIS=GMIS+TOTMIS,GMIR=GMIR+TOTMIR,GMAJ=GMAJ+TOTMAJ,GMIN=GMIN+TOTMIN
47 Q
Note: See TracBrowser for help on using the repository browser.