source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAWKLU.m@ 613

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

initial load of WorldVistAEHR

File size: 8.9 KB
Line 
1RAWKLU ;HISC/GJC-physician workload statistics by wRVU or CPT ;10/26/05 14:57
2 ;;5.0;Radiology/Nuclear Medicine;**64,77,91**;Mar 16, 1998;Build 1
3 ;01/23/08 BAY/KAM Remedy Call 227583 Patch *91 Change RVU Reports to
4 ; use Report End Date instead of Current date when setting
5 ; the flag to determine if necessary to use last year's RVU
6 ; data and retrieve RVU data by Verified date instead of
7 ; Exam date
8 ;09/25/06 KAM/BAY Remedy Call 154793 PATCH *77 RVU with 0 value
9 ; and changed CPT calls from ^ICPTCOD to ^RACPTMSC
10 ; eliminating the need for IA's 1995 amd 1996
11 ;03/28/07 KAM/BAY Remedy Call 179232 Patch RA*5*77
12 ; Add check to see if current RVU data is available and if
13 ; not use previous year RVU data
14 ;
15 ;DBIA#:4799 ($$RVU^FBRVU) return wRVU value for CPT, CPT Mod, & exam
16 ; date/time
17 ;DBIA#:10060 EN1^RASELCT enacts 10060 which allows lookups on the NEW
18 ; PERSON (#200) file
19 ;DBIA#:10063 ($$S^%ZTLOAD)
20 ;DBIA#:10103 ($$FMTE^XLFDT) & ($$NOW^XLFDT)
21 ;DBIA#:10104 ($$CJ^XLFSTR)
22 ;DBIA#:1519 ($$EN^XUTMDEVQ)
23 ;
24EN(RARPTYP,RASCLD) ;Identifies the option that the user wishes to execute.
25 ;input: RARPTYP="CPT" for the CPT workload report -or- "RVU" for
26 ; wRVU workload report. Exit if the value is neither 'CPT'
27 ; or 'RVU'.
28 ; RASCLD=null for the CPT report, zero for non-scaled wRVU, & one
29 ; for the scaled wRVU report.
30 ;
31 I RARPTYP'="CPT",(RARPTYP'="RVU") Q
32 I RARPTYP="CPT",(RASCLD'="") Q
33 K ^TMP($J,"RA STFPHYS"),^TMP("RA STFPHYS-IEN",$J)
34 I RARPTYP="RVU" W !!,"Please note that this report is best suited for display on a 132 column device."
35 ;
36PHYST ;allow the user to select one/many/all physicians
37 ;(w/ staff classification) ;DBIA#: 10060
38 S RADIC="^VA(200,",RADIC(0)="QEAMZ",RAUTIL="RA STFPHYS"
39 S RADIC("A")="Select Physician: ",RADIC("B")="All"
40 S RADIC("S")="I $D(^VA(200,""ARC"",""S"",+Y))\10"
41 W !! D EN1^RASELCT(.RADIC,RAUTIL) K %W,%Y1,DIC,RADIC,RAQUIT,RAUTIL,X,Y
42 ;did the user select physicians to compile data on? if not, quit
43 I $O(^TMP($J,"RA STFPHYS",""))="" D Q
44 .W !!?3,$C(7),"Staff Physician data was not selected."
45 .Q
46 ;
47 ;build a new staff physician array (the other array is subscripted by
48 ;physician name then IEN) subscripting by staff physician IEN this
49 ;allows us to check the IEN of the staff physician selected by the
50 ;user against the IEN of the staff physician on the exam record
51 S X="" F S X=$O(^TMP($J,"RA STFPHYS",X)) Q:X="" D
52 .S Y=0
53 .F S Y=$O(^TMP($J,"RA STFPHYS",X,Y)) Q:'Y S ^TMP("RA STFPHYS-IEN",$J,Y)=""
54 .Q
55 ;
56 K ^TMP($J,"RA STFPHYS") S RADATE=$$FMTE^XLFDT($$NOW^XLFDT\1,1)
57 ;
58STRTDT ;Prompt the user for a starting date (VERIFIED DATE)
59 S RASTART=$$STRTDT^RAWKLU1(RADATE,2110101)
60 I RASTART=-1 D XIT Q
61 S RABGDTI=$P(RASTART,U),RABGDTX=$P(RASTART,U,2),RAMBGDT=RABGDTI-.0001
62 ;need inv. verified date to search ^RARPT("AA",
63 S RAMBGDT=9999999.9999-RAMBGDT
64 K RASTART
65 ;
66ENDDT ;Prompt the user for an ending date (VERIFIED DATE)
67 S RAEND=$$ENDDT^RAWKLU1(RABGDTI,RABGDTX)
68 I RAEND=-1 D XIT Q
69 S RAENDTI=$P(RAEND,U),RAENDTX=$P(RAEND,U,2),RAMENDT=RAENDTI+.9999
70 ;need inv. verified date to search ^RARPT("AA",
71 S RAMENDT=9999999.9999-RAMENDT
72 K RAEND
73 ;
74 F I="RARPTYP","^TMP(""RA STFPHYS-IEN"",$J,","RADATE","RAB*","RAM*","RAE*","RASCLD" S ZTSAVE(I)=""
75 S I="RA print "_$S(RARPTYP="CPT":"CPTs",1:"wRVUs")_" totals for physicians within imaging type"
76 D EN^XUTMDEVQ("START^RAWKLU",I,.ZTSAVE,,1)
77 I +$G(ZTSK)>0 W !!,"Task Number: "_ZTSK,!
78 K I,ZTSAVE,ZTSK
79 Q
80 ;
81START ;check exams based on criteria input by user; physician & exam D/T
82 ;eliminate the exam record is one of the following conditions is true:
83 ;1-the status of the exam is 'Cancelled'
84 ;2-the physician(s) selected are not the primary staff for the exam
85 ;
86 ;03/28/07 KAM/BAY Remedy Call 179232 Added next line
87 S RACYFLG=0
88 ;03/28/07 KAM/BAY RA*5*77/179232 Added Fee Basis Data Check
89 D CHKCY^RAWKLU2
90 S:$D(ZTQUEUED)#2 ZTREQ="@"
91 K ^TMP($J,"RA BY STFPHYS"),^TMP($J,"RA BY I-TYPE")
92 S ^TMP($J,"RA BY I-TYPE")="0^0^0^0^0^0^0^0^0",CNT=0
93 ;define where the totals for imaging type will reside on the globals
94 F RAI="RAD","MRI","CT","US","NM","VAS","ANI","CARD","MAM" S CNT=CNT+1,RAIAB(RAI)=CNT
95 K RAI,CNT S RARPTVDT=RAMBGDT,(RACNT,RAXIT)=0
96 F S RARPTVDT=$O(^RARPT("AA",RARPTVDT),-1) Q:'RARPTVDT!(RARPTVDT<RAMENDT) D Q:RAXIT
97 .S RARPTIEN=0
98 .F S RARPTIEN=$O(^RARPT("AA",RARPTVDT,RARPTIEN)) Q:'RARPTIEN D Q:RAXIT
99 ..S RARPT=$G(^RARPT(RARPTIEN,0)),RADFN=+$P(RARPT,U,2),RADTE=+$P(RARPT,U,3)
100 ..S RADTI=9999999.9999-RADTE,RA7002=$G(^RADPT(RADFN,"DT",RADTI,0))
101 ..Q:$P(RA7002,U,2)="" ;no imaging type defined
102 ..S RAITYP=$P($G(^RA(79.2,$P(RA7002,U,2),0)),U,3) ;abbreviation
103 ..Q:'($D(RAIAB(RAITYP))#2)
104 ..S RACNI=0
105 ..F S RACNI=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI)) Q:'RACNI D Q:RAXIT
106 ...S RA7003=$G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,0)) Q:RA7003="" ;missing exam node
107 ...Q:$P(RA7003,U,17)'=RARPTIEN ;exam references a different report!
108 ...S RACNT=RACNT+1
109 ...;
110 ...;did the user stop the task? Check every five hundred records...
111 ...S:RACNT#500=0 (RAXIT,ZTSTOP)=$$S^%ZTLOAD() Q:RAXIT
112 ...;
113 ...;1-begin exam status check
114 ...Q:$P($G(^RA(72,+$P(RA7003,U,3),0)),U,3)=0 ;cancelled...
115 ...;end exam status check
116 ...;
117 ...;2-begin physician check
118 ...Q:'$P(RA7003,U,15) ;no physician, quit check
119 ...Q:'$D(^TMP("RA STFPHYS-IEN",$J,$P(RA7003,U,15)))#2
120 ...;end physician check
121 ...;
122 ...S RASTAFF=$$EXTERNAL^DILFD(70.03,15,,$P(RA7003,U,15))
123 ...I RARPTYP="CPT" D Q
124 ....;Total the # of CPTs performed by a physician within an i-type;
125 ....;the # on CPTs performed within i-type; the # of procedures
126 ....;performed by physician. all exams are either detailed or series
127 ....;(CPT codes defined) types of procedures.
128 ....D ARY(1)
129 ....Q
130 ...D RVU
131 ...Q
132 ..Q
133 .Q
134 D EN^RAWKLU1 ;output the report
135 D XIT
136 Q
137 ;
138ARY(Y) ;increment the array by one in the case of CPT or by the wRVU
139 ;value
140 ;input: Y=either one when adding the number of CPTs performed by a
141 ; physician, within an i-type or by physician within i-type
142 ; -or- the WRVU value when totaling for the aforementioned criteria
143 ;
144 S $P(^TMP($J,"RA BY STFPHYS",RASTAFF),U,RAIAB(RAITYP))=+$P($G(^TMP($J,"RA BY STFPHYS",RASTAFF)),U,RAIAB(RAITYP))+Y
145 S $P(^TMP($J,"RA BY I-TYPE"),U,RAIAB(RAITYP))=$P(^TMP($J,"RA BY I-TYPE"),U,RAIAB(RAITYP))+Y
146 Q
147 ;
148RVU ;Total the # of wRVUs performed by a physician within an i-type; all
149 ;exams are either detailed or series types of procedures. By definition
150 ;these procedure types MUST have CPT code defined.
151 ;Pass the exam date, CPT, & CPT modifiers into the FEE BASIS function
152 ;to derive the wRVU
153 ;
154 ;get exam date/time
155 N RAXAMDT S RAXAMDT=$P(RA7002,U)
156 ;get the CPT code value
157 S RACPT=$P($G(^RAMIS(71,+$P(RA7003,U,2),0)),U,9) ;pointer to file #81
158 ; 09/27/2006 KAM/BAY Patch RA*5*77 Changed next line to use ^RACPTMSC
159 S RACPT=$P($$NAMCODE^RACPTMSC(RACPT,RAXAMDT),U,1) ;CPT code is 1st pc
160 ;
161 ;get CPT code modifier string
162 S RACPTMOD="",RABILAT=0
163 I $O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"CMOD",0))>0 S RAI=0 D
164 .F S RAI=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"CMOD",RAI)) Q:'RAI D
165 ..S RACPTMOD(0)=+$G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"CMOD",RAI,0))
166 ..;09/27/2006 KAM/BAY RA*5*77 Changed next line to use ^RACPTMSC
167 ..S RA813(0)=$$BASICMOD^RACPTMSC(RACPTMOD(0),RAXAMDT)
168 ..I 'RABILAT,$P(RA813(0),U,2)=50 S RABILAT=1 ;bilateral multiplier=2
169 ..S RACPTMOD=RACPTMOD_$P(RA813(0),U,2)_","
170 ..Q
171 .Q
172 ;get wRVU value from FEE BASIS; returns a string: status^value^message
173 ;where status'=1 means "in error". All exams prior to 1/1/1999 will
174 ;use 1999 wRVU values for their calculations.
175 ;03/28/2007 KAM/BAY Rem Call 179232 Added RACYFLG to $S in next line
176 ;01/23/2008 KAM/BAY RA*5*91 Remedy Call 227583 Changed the next line
177 ; to use the Verified date of the exam date
178 S RAWRVU=$$RVU^FBRVU(RACPT,RACPTMOD,$S((9999999.9999-RARPTVDT)<2990101:2990101,RACYFLG:(9999999.9999-RARPTVDT)-10000,1:(9999999.9999-RARPTVDT)))
179 ; 09/25/2006 KAM/BAY Remedy Call 154793 Correct 0 RVUs
180 I $P(RAWRVU,U,2)=0,RACPTMOD="" D
181 . ;01/23/2008 KAM/BAY RA*5*91 Remedy Call 227583 Changed the next lin
182 . ; to use the Verified date of the exam date
183 . S RAWRVU=$$RVU^FBRVU(RACPT,26,$S((9999999.9999-RARPTVDT)<2990101:2990101,RACYFLG:(9999999.9999-RARPTVDT)-10000,1:(9999999.9999-RARPTVDT)))
184 ;
185 I $P(RAWRVU,U)=1 D
186 .;apply bilateral multiplier if appropriate
187 .S:RABILAT RAWRVU=$P(RAWRVU,U,2)*2
188 .;or not...
189 .S:'RABILAT RAWRVU=$P(RAWRVU,U,2)
190 .I RASCLD S RAWRVU=RAWRVU*$$SFCTR^RAWRVUP($P(RA7002,U,2),RAXAMDT)
191 .Q
192 ;
193 E S RAWRVU=0 ;status some other value than 1; "in error"
194 S:RAWRVU>0 RAWRVU=$J(RAWRVU,1,2) ;do not round the value...
195 D ARY(RAWRVU)
196 K RA813,RABILAT,RACPT,RACPTMOD,RAI,RAWRVU
197 Q
198 ;
199XIT ;kill variables and exit
200 W:$G(ZTSTOP)=1 !,$$CJ^XLFSTR("USER STOPPED PROCESS THROUGH TASKMAN",IOM)
201 K DIRUT,DTOUT,DUOUT,RA7002,RA7003,RABGDTI,RABGDTX,RACNI,RADATE
202 K RADFN,RADTE,RADTI,RAENDTI,RAENDTX,RAIAB,RAITYP,RAMBGDT,RAMENDT
203 K RARPT,RARPTIEN,RARPTVDT,RASTAFF,RAXIT,X,Y,^TMP("RA STFPHYS-IEN",$J)
204 K ^TMP($J,"RA BY STFPHYS"),^TMP($J,"RA BY I-TYPE"),RACYFLG
205 Q
Note: See TracBrowser for help on using the repository browser.