source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RASTREQ.m@ 619

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

initial load of WorldVistAEHR

File size: 8.0 KB
Line 
1RASTREQ ;HISC/CAH,GJC AISC/MJK-Status Requirements Check Routine ;6/3/98 09:56
2 ;;5.0;Radiology/Nuclear Medicine;**1,10,23,40,56**;Mar 16, 1998;Build 3
3 ;Supported IA #10104 UP^XLFSTR
4 ;Supported IA #1367 LKUP^XPDKEY
5 ;Supported IA #10060 ^VA(200
6 ;Supported IA #10076 ^XUSEC(
7 ; Called by
8 ; (1) Stat Track's [RA STATUS CHANGE]'s fld EXAM STATUS' input transform
9 ; (2) ASK+22^RASTED, if user "^" out of stat trk editing
10 ; (3) Cancel an Exam's [RA CANCEL]'s fld EXAM STATUS' input transform
11 ; (4) Enter Last Past Visit Before DHCP's [RA LAST PAST VISIT]'s ""
12 ;
13 ; Instead of using RAIMGTY, recalculate
14 ; the imaging type using the imaging type on the exam node because
15 ; status updating through report entry/edit, batch verify, and several
16 ; other options is NOT screened by sign-on imaging type, so does not
17 ; stay the same through a user's session.
18 ;
19 ; 'RAMES1' is used to display which Exam Status required fields are
20 ; not populated. This only applies to the 'Status Tracking Of Exams'
21 ; option.
22 ;
23 ; If tracking ^-out, this rtn would be called outside of edt tmpl,
24 ; and thus the DA vars would not be defined, so we need to set them here
25 ;
26 S:'$D(DA)#2 DA=RACNI S:'$D(DA(1))#2 DA(1)=RADTI S:'$D(DA(2))#2 DA(2)=RADFN
27 ; If Fileman enter/edit, we need to define RADFN, RADTI, RACNI so the
28 ; nuc med checks won't bomb
29 S:'$D(RACNI)#2 RACNI=DA S:'$D(RADTI)#2 RADTI=DA(1) S:'$D(RADFN)#2 RADFN=DA(2)
30 ;
31 S RAIMGTYI=+$P($G(^RADPT(DA(2),"DT",DA(1),0)),U,2),RAIMGTYJ=$P($G(^RA(79.2,+RAIMGTYI,0)),U,1),RASAVTYJ=RAIMGTYJ
32 S RAMES1="W:$G(K)=$P($G(^RA(72,+$G(RANXT72),0)),U,3)&('$D(ZTQUEUED)#2) !?3,""No '"",RAZ,""'"",?35,"" entered for this exam.""" ; display if at the ranext exm stat level
33 S RAXX=+$G(X)
34 I '$D(^RA(72,RAXX,0))!(RAIMGTYJ']"") D Q
35 . K X W:'$D(ZTQUEUED)#2 !?3,"Error: cannot determine Imaging Type of exam. Contact IRM."
36 . K RAMES1,RAXX
37 . Q
38 N RA,RASN,RASTI,RADES,RAOKAY,RA3
39 ; RADES = order seq. desired, RAOKAY= actual order seq. okay'd
40 S X1=$G(^RA(72,RAXX,0)),RADES=$P(X1,U,3)
41 I $$LKUP^XPDKEY(+$P(X1,"^",4))]"",'$D(^XUSEC($$LKUP^XPDKEY(+$P(X1,"^",4)),DUZ)) K X W:'$D(ZTQUEUED)#2 !?3,"You do not have the proper access privileges to ",!?3,"change this exam to this status" Q
42 S RAJ=^RADPT(DA(2),"DT",DA(1),"P",DA,0),RAOR=-1
43 S RABEFORE=$P($G(^RA(72,+$P(RAJ,U,3),0)),U,3) ; current order seq
44 ; Don't need to set RAORDIFN,RACS,RAPRIT,RAF5
45 I '$D(^RA(72,"AA",RAIMGTYJ,0,RAXX)) D LOOP^RASTREQ1 S RAIMGTYJ=RASAVTYJ
46 I $D(^RA(72,"AA",RAIMGTYJ,0,RAXX)) D CANCEL^RASTREQ1
47 S RAIMGTYJ=RASAVTYJ
48 ; Can't use X to determine if status change to next was successful
49 ; due to looping thru all status levels for this img type
50 ; chk if calculated order is at NEXT or higher level
51 ; RAAFTER is set in rastreq1; it has 2 meanings :
52 ; upon return from rastreq1, RAAFTER means highest seq order qualified
53 ; upon exit from this rtn, RAAFTER means actual seq order used
54 I RABEFORE<RAAFTER D G MSG
55 . I RADES<RAAFTER S RAOKAY=RADES
56 . E S RAOKAY=RAAFTER
57 . Q
58 I RAAFTER<RABEFORE D G MSG
59 . I RADES<RAAFTER S RAOKAY=RADES
60 . E S RAOKAY=RAAFTER
61 . Q
62 ; at this point RAAFTER=RABEFORE
63 I RADES<RAAFTER S RAOKAY=RADES
64 E S RAOKAY=RABEFORE
65MSG I RAOKAY=RABEFORE K X W:'$D(ZTQUEUED)#2 !?5," ...exam status not changed" G KOUT2
66 S X=$O(^RA(72,"AA",RAIMGTYJ,RAOKAY,0))
67 S:$D(RANEXT) RANEXT=^RA(72,+X,0) ;set existing RANEXT to ok'd status
68 I RAOKAY<RABEFORE W:'$D(ZTQUEUED)#2 !?5," ...exam status backed down to '",$P($G(^RA(72,+X,0)),U),"'" G KOUT2
69 I RAOKAY<RADES W:'$D(ZTQUEUED)#2 !!?5," ...though upgraded, new status level (",$P($G(^RA(72,+$O(^RA(72,"AA",RAIMGTYJ,RAOKAY,0)),0)),U),")",!?5,"is not as high as the desired level (",$P($G(^RA(72,+$O(^RA(72,"AA",RAIMGTYJ,RADES,0)),0)),U),")",!
70KOUT1 ; check for higher qualifying status(es)
71 G:RAOKAY'<RAAFTER!(RAOKAY=9) KOUT2 S RA3=RAOKAY
72 W !!,"This case also qualifies for higher status(es) :",!
73 F S RA3=$O(^RA(72,"AA",RAIMGTYJ,RA3)) Q:RA3="" Q:RA3>RAAFTER W:'$D(ZTQUEUED)#2 ?$X+4,$P($G(^RA(72,$O(^(RA3,0)),0)),U)
74 W:'$D(ZTQUEUED)#2 !!,"Since Status Tracking can only upgrade one status at a time,",!,"please edit this exam again.",!
75KOUT2 S RAAFTER=RAOKAY ;return as actual seq order used, not nec. highest
76 K RAIMGTYI,RAIMGTYJ,RAMES1,RAZ,RAXX,RAJ,RAS,RAK,RAE,X1,RASAVTYJ
77 Q
78 ;
791 ;Technologist Check
80 N DIERR
81 S RA("TECH")="" I $O(^RADPT(DA(2),"DT",DA(1),"P",DA,"TC",0))>0 S RA("TECH")=+^($O(^(0)),0) S RA("TECH")=$$GET1^DIQ(200,RA("TECH")_",",.01)
82 I RA("TECH")']"" K X S RAZ="technologist" X:$D(RAMES1) RAMES1
83 K RA("TECH") Q
84 ;
852 ;Interpreting Physician Check
86 N DIERR
87 I $$GET1^DIQ(200,$P(RAJ,"^",12)_",",.01)="",$$GET1^DIQ(200,$P(RAJ,"^",15)_",",.01)="" K X S RAZ="interpreting staff or resident" X:$D(RAMES1) RAMES1
88 Q
89 ;
903 ;Detailed Procedure Check
91 S RAZ="detailed procedure" I '$D(^RAMIS(71,+$P(RAJ,"^",2),0)) K X X:$D(RAMES1) RAMES1 Q
92 S RAJ1=$G(^RAMIS(71,+$P(RAJ,"^",2),0)) I "DS"'[$P(RAJ1,"^",6) K X X:$D(RAMES1) RAMES1 Q
93 S RAZ="detailed procedure (no CPT code)" I $P(RAJ1,"^",9)']"" K X X:$D(RAMES1) RAMES1 Q
94 Q
95 ;
964 ;Film Data Check
97 I '$O(^RADPT(DA(2),"DT",DA(1),"P",DA,"F",0)) K X S RAZ="film data" X:$D(RAMES1) RAMES1
98 Q
99 ;
1005 ;Diagnostic Code Check
101 I '$D(^RA(78.3,+$P(RAJ,"^",13),0)) K X S RAZ="diagnostic code" X:$D(RAMES1) RAMES1
102 Q
103 ;
1046 ;Camera/Equipment/Room Check
105 S RAE=$S($D(RAMDV):$P(RAMDV,"^",9),1:1) I RAE,'$D(^RA(78.6,+$P(RAJ,"^",18),0)) K X S RAZ="camera/equip/room" X:$D(RAMES1) RAMES1
106 Q
107 ;
10811 ;Report Entered and not just a stub rec for Img/PACS Check
109 I '$D(^RARPT(+$P(RAJ,"^",17),0)) G NORPT
110 ; since there's a rpt ptr, must check if the rpt is just a stub rpt
111 N RA17,RA0 ; use logic from RAREG
112 S RA17=+$P(RAJ,"^",17)
113 I $$STUB^RAEDCN1(RA17) G NORPT ; rpt is an image stub
114 Q
115NORPT ; either no report yet, or report is stub
116 K X S RAZ="report" X:$D(RAMES1) RAMES1
117 Q
118 ;
11912 ;Report Verified Check
120 D 11:$P(RAS,"^",11)'="Y" I $D(^RARPT(+$P(RAJ,"^",17),0)),$P(^(0),"^",5)'="V" K X S RAZ="report verification" X:$D(RAMES1) RAMES1
121 Q
122 ;
12316 ;Impression Entry Check
124 ; In Phase 1, for Elec. filed rpts, skip this even if div. param requires it
125 I $D(^RARPT(+$P(RAJ,"^",17),0)),$P(^(0),"^",5)="EF" Q
126 I $O(^RARPT(+$P(RAJ,"^",17),"I",0))'>0 K X S RAZ="impression" X:$D(RAMES1) RAMES1
127 Q
12813 ;Procedure Modifers Check
129 I '$O(^RADPT(DA(2),"DT",DA(1),"P",DA,"M",0)) K X S RAZ="procedure modifier" X:$D(RAMES1) RAMES1
130 Q
13114 ;CPT Modifiers Check
132 I '$O(^RADPT(DA(2),"DT",DA(1),"P",DA,"CMOD",0)) K X S RAZ="CPT modifiers" X:$D(RAMES1) RAMES1
133 Q
134 ;
135HELP ; Called from 'Help Text' node in DD(70.03,3,4).
136 N E,RA
137 S RAJ=$G(^RADPT(DA(2),"DT",DA(1),"P",DA,0))
138 S RAIMGTYI=+$P($G(^RADPT(DA(2),"DT",DA(1),0)),U,2),RAIMGTYJ=$P($G(^RA(79.2,+RAIMGTYI,0)),U,1)
139 I RAIMGTYJ']"" W !,"ERROR: Cannot determine imaging type of exam!" K FL,K,N,RAIMGTYI,RAIMGTYJ,RAS,RAJ Q
140 W !,"This exam meets the requirements for the following statuses:"
141 F K=0:0 S K=$O(^RA(72,"AA",RAIMGTYJ,K)) Q:K'>0 D
142 . S X="",E=+$O(^RA(72,"AA",RAIMGTYJ,K,0)) Q:E'>0
143 . I $D(^RA(72,E,0)) D
144 .. S RA(0)=$G(^RA(72,E,0)),N=$P(RA(0),U),RAS=$G(^RA(72,E,.1))
145 .. I $L(RAS) D HELP1 I $D(X) W !?10,N S FL="" ;removed D 3, done inside HELP1
146 .. Q
147 . Q
148 W:'$D(FL) !?10,"Does not meet the requirements of any status."
149 W ! K RAS,RAJ,N,K,FL,RAIMGTYI,RAIMGTYJ
150 Q
151HELP1 ; Called from 'HELP' above and 'STUFF^RASTREQ1'
152 ; 'RAJ' -> 0 node of the examination
153 ; 'E' -> ien of the examination status
154 ; Both 'RAJ' & 'E' set in 'HELP' & 'STUFF^RASTREQ1'
155 N RADIO,RADIOUZD,RAS5 S RADIO=$S($G(^RA(72,E,.5))]"":$G(^(.5)),1:"N")
156 S:$P($G(^RA(79.2,+RAIMGTYI,0)),"^",5)="Y" RADIOUZD=""
157 ;
158 ; Phase 1 Outside Reporting 100% outside work, skip all except Diag. Code
159 I $D(^RARPT(+$P(RAJ,"^",17),0)),$P(^(0),"^",5)="EF" S RAS5=$P(RAS,U,5),RAS="",$P(RAS,U,5)=RAS5 K RADIOUZD
160 ;
161 F RAK=1:1 Q:$P(RAS,"^",RAK,99)']"" D:$P(RAS,"^",RAK)="Y" @RAK
162 I $D(X),$P(RAS,"^",3)'="Y",$D(^RA(72,"AA",RAIMGTYJ,9,E)) D 3
163 I $D(X),$P(RAS,"^",16)'="Y",$D(^RA(72,"AA",RAIMGTYJ,9,E)),$D(^RA(79,+$P(^RADPT(DA(2),"DT",DA(1),0),"^",3),.1)),$P(^(.1),"^",16)="Y" D 16
164 I $D(RADIOUZD) D ;if Radiopharm Used, then check req'd NucMed flds
165 . D EN1^RASTREQN(RADIO,RAJ)
166 . I $D(X),($$UP^XLFSTR($P($G(^RA(72,E,.6)),"^",11)="Y")) D EN1^RADOSTIK(RADFN,RADTI,RACNI)
167 . Q
168 Q
Note: See TracBrowser for help on using the repository browser.