source: WorldVistAEHR/trunk/r/SURGERY-SR/SROAWL1.m@ 1578

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

initial load of WorldVistAEHR

File size: 6.0 KB
Line 
1SROAWL1 ;BIR/ADM - REPORT OF CASE WORKLOAD TOTALS (CONTINUED) ;02/12/07
2 ;;3.0; Surgery ;**38,47,60,62,68,50,86,88,92,153,160**;24 Jun 93;Build 7
3 ; SRTOTAL(1) = total of all cases completed (excluding aborted cases)
4 ; SRTOTAL(2) = excluded cases
5 ; SRTOTAL(3) = assessed cases
6 ; SRTOTAL(4) = not logged major cases
7 ; SRTOTAL(5) = cardiac cases
8 ; SRTOTAL(6) = non-cardiac cases
9 ; SRTOTAL(7) = assessed cases per day (at 20 days per month)
10 ; SRTOTAL(8) = total major cases
11 ; SRTOTAL(9) = total minor cases
12 ; SRTOTAL(10)= total eligible case based on CPT code
13 ; SRTOTAL(11)= not logged eligible cases
14 ;
15 I SRP U IO
16 N SRDIV,SRMULT S (SRDIV,SRMULT,SRSOUT)=0
17 I SRT S (SRCNT,X)=0 D
18 .F S X=$O(^SRO(133,X)) Q:'X I '$P($G(^SRO(133,X,0)),"^",21) S SRCNT=SRCNT+1,SRDIV(X)=$P(^SRO(133,X,0),"^")
19 .I SRCNT>1 S SRMULT=1
20BEG S SRSDATE=SRDT I SRSEL=1 S X=+$E(SRDT,4,5),X=$S(X'=12:X+1,1:1),Y=$E(SRDT,1,3),Y=$S(X>1:Y,1:Y+1),SRED=Y_$S($L(X)=1:"0"_X,1:X)_"00"
21 I SRSEL=2 S X=$E(SREDT,1,5),SRED=X_"99"
22 K SRTOTAL F I=1:1:11 S SRTOTAL(I)=0
23 N SREXCL F I=0:1:9 S SREXCL(I)=0
24 S:'$D(SRINSTP) SRINSTP="ALL DIVISIONS"
25 I SRSEL=1 D MOS S Y=SRDT X ^DD("DD") S SRM="FOR "_Y,SRTITLE="REPORT OF MONTHLY SURGICAL CASE WORKLOAD"
26 I SRSEL=2 S SRTITLE="REPORT OF SURGICAL CASE WORKLOAD" D
27 .S Y=SRDT X ^DD("DD") S SRM="FOR "_Y_" THROUGH " S Y=SREDT X ^DD("DD") S SRM=SRM_Y
28 F S SRSDATE=$O(^SRF("AC",SRSDATE)) Q:SRSDATE>SRED!'SRSDATE S SRTN=0 F S SRTN=$O(^SRF("AC",SRSDATE,SRTN)) Q:'SRTN I $D(^SRF(SRTN,0)),$$MANDIV^SROUTL0(SRINSTP,SRTN) D CASE
29 F K="C","N" S SRDFN=0 F S SRDFN=$O(^SRF("ARS",K,"I",SRDFN)) Q:'SRDFN S SRTN=0 F S SRTN=$O(^SRF("ARS",K,"I",SRDFN,SRTN)) Q:'SRTN I $D(^SRF(SRTN,0)),$$MANDIV^SROUTL0(SRINSTP,SRTN) D OPDATE
30 I SRSEL=1 S SRTOTAL(7)=SRTOTAL(3)/20 D:'SRP INC D:SRP OUT G:SRSOUT END D:SRT TMIT
31 I SRSEL=2 D OUT
32END K SRINSTP,SRTOTAL,^TMP("SRM",$J) I SRT,SRMULT S SRP=0 S SRDIV=$O(SRDIV(SRDIV)) Q:'SRDIV D SITE,BEG
33 Q
34CASE ; examine case
35 Q:$P($G(^SRF(SRTN,30)),"^")!$P($G(^SRF(SRTN,31)),"^",8)!'($P($G(^SRF(SRTN,.2)),"^",12)!($P($G(^SRF(SRTN,.2)),"^",3)))
36 N SRELIG S SRELIG=""
37 S SRTOTAL(1)=SRTOTAL(1)+1,SRMAJ=$S($P(^SRF(SRTN,0),"^",3)="J":1,1:0) S:SRMAJ SRTOTAL(8)=SRTOTAL(8)+1 I 'SRMAJ S SRTOTAL(9)=SRTOTAL(9)+1
38 I $$XL^SROAX(SRTN) S SRELIG=1,SRTOTAL(10)=SRTOTAL(10)+1
39 S SRA=$G(^SRF(SRTN,"RA")),SRTYPE=$P(SRA,"^",2) S:SRTYPE=""&SRMAJ SRTOTAL(4)=SRTOTAL(4)+1 S:SRTYPE="C" SRTOTAL(5)=SRTOTAL(5)+1
40 I SRTYPE=""&SRELIG S SRTOTAL(11)=SRTOTAL(11)+1
41 S SRASS=$P(SRA,"^",6) D
42 .I SRASS="N" S SRTOTAL(2)=SRTOTAL(2)+1,X=$P(SRA,"^",7) S:X'="" SREXCL(X)=SREXCL(X)+1
43 .I SRASS="Y" S SRTOTAL(3)=SRTOTAL(3)+1
44 I SRTYPE="N",SRASS="Y" S SRTOTAL(6)=SRTOTAL(6)+1
45 Q
46OPDATE ; get date of operation
47 S SRA=$G(^SRF(SRTN,"RA")) I $P(SRA,"^")'="I" K ^SRF("ARS",K,"I",SRDFN,SRTN) Q
48 S SRTYPE=$P(SRA,"^",2) I SRTYPE'=K K ^SRF("ARS",K,"I",SRDFN,SRTN) Q
49 I SRSEL=1 S SRMONTH=$E($P(^SRF(SRTN,0),"^",9),1,5)_"00" I $D(^TMP("SRM",$J,SRMONTH,K)) S ^TMP("SRM",$J,SRMONTH,K)=^TMP("SRM",$J,SRMONTH,K)+1
50 Q
51OUT ; print report
52 W:$Y @IOF W !,?(80-$L(SRINST)\2),SRINST,!,?(80-$L(SRTITLE)\2),SRTITLE,!,?(80-$L(SRM)\2),SRM,!,?15 F I=1:1:50 W "-"
53 W !,?20,"TOTAL CASES PERFORMED",?54,"=",$J(SRTOTAL(1),6),!,?24,"TOTAL ELIGIBLE CASES",?54,"=",$J(SRTOTAL(10),6)
54 ;W !,?24,"TOTAL MAJOR CASES",?54,"=",$J(SRTOTAL(8),6),!,?24,"TOTAL MINOR CASES",?54,"=",$J(SRTOTAL(9),6)
55 W !,?20,"CASES MEETING EXCLUSION CRITERIA",?54,"=",$J(SRTOTAL(2),6)
56 W !,?24,"NON-SURGEON CASE",?54,"=",$J(SREXCL(0),6)
57 W !,?24,"EXCEEDS MAX. ASSESSMENTS",?54,"=",$J(SREXCL(2),6),!,?24,"EXCEEDS MAXIMUM TURPS",?54,"=",$J(SREXCL(3),6)
58 W !,?24,"STUDY CRITERIA",?54,"=",$J(SREXCL(4),6),!,?24,"SCNR WAS ON A/L",?54,"=",$J(SREXCL(6),6)
59 W !,?24,"CONCURRENT CASE",?54,"=",$J(SREXCL(8),6),!,?24,"EXCEEDS MAXIMUM HERNIAS",?54,"=",$J(SREXCL(9),6)
60 W !,?20,"ASSESSED CASES",?54,"=",$J(SRTOTAL(3),6)
61 ;W !,?20,"NOT LOGGED MAJOR CASES",?54,"=",$J(SRTOTAL(4),6)
62 W !,?20,"NOT LOGGED ELIGIBLE CASES",?54,"=",$J(SRTOTAL(11),6)
63 W !,?20,"CARDIAC CASES",?54,"=",$J(SRTOTAL(5),6),!,?20,"NON-CARDIAC CASES",?54,"=",$J(SRTOTAL(6),6)
64 W:SRSEL=1 !,?20,"ASSESSED CASES PER DAY",?54,"=",$J(SRTOTAL(7),9,2) W !,?15 F I=1:1:50 W "-"
65 Q:SRSEL=2 I $E(IOST)="C" D PRESS Q:SRSOUT W @IOF
66INC S (SRCT,SRT1,SRTC)=0 W:SRP !!!!,?12,"NUMBER OF INCOMPLETE ASSESSMENTS REMAINING FOR PAST YEAR",!!,?29,"CARDIAC",?40,"NON-CARDIAC",?56,"TOTAL",!,?29,"-------",?40,"-----------",?56,"-----"
67 S SRMONTH=0,SRSST="" F S SRMONTH=$O(^TMP("SRM",$J,SRMONTH)) Q:'SRMONTH D
68 .I SRP S Y=SRMONTH X ^DD("DD") W !,?19,Y
69 .S SRC=^TMP("SRM",$J,SRMONTH,"C"),SRN=^TMP("SRM",$J,SRMONTH,"N"),SRTO=SRC+SRN,SRCT=SRCT+SRC,SRT1=SRT1+SRN,SRTC=SRTC+SRTO,SRSST=SRSST_SRMONTH_"^"_SRC_"^"_SRN_"^"
70 .W:SRP ?30,$J(SRC,5),?43,$J(SRN,5),?55,$J(SRTO,5)
71 W:SRP !,?29,"-------",?40,"-----------",?56,"-----",!,?30,$J(SRCT,5),?43,$J(SRT1,5),?55,$J(SRTC,5)
72 Q
73TMIT ; transmit report to national database
74 S ISC=0,SRD=^XMB("NETNAME") I $E(SRD,1,3)="FO-"!(SRD["ISC-")!(SRD["ISC.")!(SRD["FORUM")!(SRD["TST")!(SRD[".FO-") S ISC=1
75 K SRMSG S SRSTATN=$P($$SITE^SROVAR,"^",3)_$S(SRDIV:"-"_SRDIV,1:""),SRMSG(1)=SRSTATN_"^"_SRDT_"^"_DT F I=1:1:9 S SRMSG(1)=SRMSG(1)_"^"_SRTOTAL(I)
76 F I=1,2,3,4,6,8,9,0 S SRMSG(1)=SRMSG(1)_"^"_SREXCL(I)
77 I SRDIV S SRMSG(1)=SRMSG(1)_"^"_SRINST_"^"_$$GET1^DIQ(4,SRINSTP,99)
78 S SRMSG(2)=SRSTATN_"^"_SRSST_SREXCL(0)
79 S SRMSG(3)=SRSTATN_"^"_$S($D(SRNOACK):SRNOACK,1:0)_"^"_SRTOTAL(10)_"^"_SRTOTAL(11)
80 S XMDUZ=.5,XMSUB="SURGERY WORKLOAD "_SRM
81 I ISC S XMY("G.RISK ASSESSMENT")=""
82 I 'ISC S (XMY("S.SRAWSERV@FO-HINES.MED.VA.GOV"),XMY("G.SRCOSERV@FO-HINES.MED.VA.GOV"))=""
83 S XMTEXT="SRMSG(" D ^XMD K XMSUB,XMY,XMDUZ,XMTEXT
84 Q
85MOS ; set up array for past 12 months
86 K SRMONTH S SRYR=$E(SRDT,1,3),SRMONTH=+$E(SRDT,4,5)
87 S J=1 F S:$L(SRMONTH)=1 SRMONTH="0"_SRMONTH S SRMONTH(J)=SRYR_SRMONTH_"00" S SRMONTH=+SRMONTH,SRMONTH=$S(SRMONTH=1:12,1:SRMONTH-1),SRYR=$S(SRMONTH=12:SRYR-1,1:SRYR),J=J+1 Q:J>13
88 K ^TMP("SRM",$J) F I=1:1:13 F J="C","N" S ^TMP("SRM",$J,SRMONTH(I),J)=0
89 Q
90PRESS Q:$E(IOST)'="C" K DIR S DIR(0)="E" D ^DIR K DIR I 'Y S SRSOUT=1
91 Q
92SITE S SRINSTP=SRDIV(SRDIV),SRINST=$$GET1^DIQ(4,SRINSTP,.01)
93 Q
Note: See TracBrowser for help on using the repository browser.