source: FOIAVistA/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAORD1.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 8.5 KB
Line 
1RAORD1 ;HISC/CAH - AISC/RMO-Request An Exam ; 06/27/07 07:22am
2 ;;5.0;Radiology/Nuclear Medicine;**10,45,41,75,86**;Mar 16, 1998;Build 7
3 ;
4 ;Supported IA #10035 reference to ^DPT(
5 ;Supported IA #10040 reference to ^SC(
6 ;Supported IA #10060 reference to ^VA(200
7 ;Supported IA #2055 reference to $$EXTERNAL^DILFD
8 ;Supported IA #2378 reference to ORCHK^GMRAOR
9 ;Supported IA #10061 reference to ^VADPT
10 ;Supported IA #10112 reference to ^VASITE
11 ;Supported IA #10103 reference to ^XLFDT
12 ;Supported IA #10141 reference to ^XPDUTL
13 ;Supported IA #10009 reference to FILE^DICN
14 ;Supported IA #10018 reference to ^DIE
15 ;
16 ;*Billing Awareness Project:
17 ; RABWDX Array: ICD Diagnosis^SC^AO^IR^EC^MST^HNC
18 ; RABWDX is used in RABWORD* and RABWPCE*.
19 K RABWDX
20 ;*
21 S RAPKG="" N RAPTLKUP,RAGMTS,RACOPYOR
22 G ADDORD:$D(RAVSTFLG)&($D(RALIFN))&($D(RAPIFN))
23 ;
24 I '$D(RAREGFLG),'$D(RAVSTFLG) N RAPTLOCK K RAWARD D G:'RAPTLKUP Q
25PAT .S DIC="^DPT(",DIC(0)="AEMQ" W ! D ^DIC K DIC
26 .I Y<0 S RAPTLKUP=0 Q
27 .S RAPTLOCK=$$LK^RAUTL19(+Y_";DPT(") G:'RAPTLOCK PAT
28 .S (DFN,RADFN)=+Y,(VA200,RAPTLKUP)=1
29 .W ! D IN5^VADPT S:VAIP(1) RAWARD=$P(VAIP(5),"^",2)
30 .D ELIG^RABWORD2
31 .Q
32 ;
33PL ;Ask for the patient location (REQ. LOCATION file: 75.1, field: #22)
34 N RACPRS27 S RACPRS27=$$PATCH^XPDUTL("OR*3.0*243")
35 S DIC("A")="Patient Location: ",DIC("B")=$S($D(RAWARD)#2:RAWARD,1:"")
36 S DIC="^SC(",DIC(0)="AEMQ"
37 ;
38 ;With the installation of RA*5.0*86 and after the implementation of
39 ;CPRS v27 all active locations are eligible for selection regardless
40 ;of patient type.
41 ;
42 ;If RAWARD is defined it is set to the name of the ward; pass either a 0
43 ;or 1.
44 ;Pass either a 0 or 1 as a value for RACPRS27. If 1 then CPRS GUI v27
45 ;(OR*3.0*243) is installed at this facility.
46 S DIC("S")="I $$SCREEN^RAORD1A("_($D(RAWARD)#2)_","_(RACPRS27)_")"
47 ;
48 D ^DIC K DIC K:'$D(RAREGFLG) RAWARD G Q:Y<0 S RALIFN=+Y
49 S DIC("A")="Person Requesting Order: "
50 ;*Billing Awareness Project:
51 S DIC("S")="I $$PROV^RABWORD()"
52 ;Display Service Connected prompts if user is a Provider.
53 S DIC="^VA(200,",DIC(0)="AEMQ",Y=DUZ S:$$PROV^RABWORD DIC("B")=$P(^VA(200,DUZ,0),"^",1)
54 D ^DIC K DIC G Q:Y<0 S RAPIFN=+Y K DD,DO,VA200,VAERR,VAIP G ADDORD:$D(RAVSTFLG)
55 ;
56ENADD ;OE/RR Entry Point for the ACTION Option
57 K ORSTOP,ORTO,ORCOST,ORPURG
58 I '$D(RAPKG) G Q:'$D(ORVP)!('$D(ORL))!('$D(ORNP)) S (DFN,RADFN)=+ORVP,RALIFN=+ORL,RAPIFN=$S(+ORNP:+ORNP,$D(RAPIFN):RAPIFN,1:+ORNP),RAFOERR=""
59 ; RAFOERR is used as a flag to track when a user enters this option
60 ; from OE/RR (frontdoor). If this variable exists when a request is
61 ; being printed, exam information is omitted from the request.
62 S RANME=^DPT(RADFN,0),RASEX=$P(RANME,"^",2),RANME=$P(RANME,"^") D EXAM^RADEM1:'$D(RAREGFLG)&($D(RAPKG)) I '$D(RAREGFLG) S VA200=1 D IN5^VADPT S:VAIP(1) RAWARD=$P(VAIP(5),"^",2)
63 D SAVE ; save off original value of RAMDV!
64 S RAL0=$S($D(^SC(RALIFN,0)):^(0),1:0)
65 S RADIV=+$$SITE^VASITE(DT,+$P(RAL0,"^",15)) S:RADIV<0 RADIV=0
66 S RADIV=$S($D(^RA(79,RADIV,0)):RADIV,1:$O(^RA(79,0)))
67 S RAMDV=$TR($G(^RA(79,+RADIV,.1)),"YyNn","1100")
68 D:'$D(RACAT)#2 ;if not defined, define the variable RACAT
69 .I $D(RAWARD)#2 S RACAT="INPATIENT" Q
70 .N Y S Y=$G(^RADPT(RADFN,0)) I Y="" S RACAT="OUTPATIENT" Q
71 .S RACAT=$$EXTERNAL^DILFD(70,.04,"",$P(Y,U,4))
72 .S:RACAT="" RACAT="OUTPATIENT"
73 .Q
74 ; clear clin hist if:
75 ; rad backdoor, or
76 ; oe/rr's first order (quick or not)
77 I $D(RAPKG) K ^TMP($J,"RAWP")
78 I '$D(RAPKG),$G(XQORS)>1,$G(^TMP("XQORS",$J,XQORS-1,"ITM"))=1 K ^TMP($J,"RAWP")
79 ;
80ADDORD I $D(RADR1) D ALLERGY,CREATE1 G Q
81 ; Set flag variable 'RASTOP' to track if procedure messages (if any)
82 ; have been displayed. Value altered in EN2+1^RAPRI & DISP+12^RAORDU1.
83 D:'$D(VAEL) ELIG^VADPT
84 I $D(^RAO(75.1,"B",RADFN)) D
85 .I '$D(RAVSTFLG) D PREV^RABWORD2 Q
86 .D ADDEXAM^RABWORD2
87 D DISP^RAPRI G:RAIMGTYI'>0 Q
88ADDORD1 W !,"Select Procedure",$S(RACNT:" (1-"_RACNT_") ",1:" "),"or enter '?' for help: "
89 R RARX:DTIME
90 S:'$T RARX="^" G Q:RARX=""!($E(RARX)="^")
91 S:RARX=" " RARX=$S($D(RASX):RASX,1:RARX)
92 I $E(RARX)="?"!(RARX=0)!(RARX=" ")!(RARX?.E1N1"-"1N.E)!(RARX?.E1".".E) D HELP^RAPRI G Q:Y'=1 D DISP1^RAPRI G ADDORD1
93 S RAEXMUL=1 K RAHSMULT
94 F RAJ=1:1 S X=$P(RARX,",",RAJ) Q:X="" S RASTOP=0 W !!!,"Processing procedure: ",$S(+X&(+X'>RACNT):$P($G(RAPRC(X)),"^"),$E(X)'="`":X,1:"") D LOOKUP^RAPRI Q:$D(RAOUT) S:RAPRI>0 RASX="`"_RAPRI D:RAPRI>0 ALLERGY,CREATE Q:$D(RAOUT) K RAPRI
95 I $D(RAREASK),'$D(RAOUT) K RAREASK D DISP1^RAPRI G ADDORD1
96Q ; Kill, unlock if locked, and quit
97 D KILL^RAORD
98 D SAVE ; reset RAMDV to its original value!
99 I $$ORVR^RAORDU()'<3,(+$G(RAPTLOCK)),(+$G(RADFN)) D
100 . D ULK^RAUTL19(RADFN_";DPT(")
101 K:'$D(RAREGFLG)&('$D(RAVSTFLG)) RACAT,RADFN,RANME,RAWARD
102 I '$D(RAPKG) K RAMDIV,RAMDV,RAMLC
103 I $D(RAPKG) K ORIFN,ORIT,ORL,ORNP,ORNS,ORPCL,ORPK,ORPV,ORPURG,ORSTS,ORTX,ORVP,RAPKG
104 K RAHSMULT,RAPOP,RAIMAG,RAREAST,RAREQLOC
105 K C,DI,DIG,DIH,DISYS,DIU,DIW,DIWF,DIWL,DIWR,DIWT,DN,I,ORCHART,POP,RAMDVZZ,RASCI,RASERIES
106 Q
107CREATE S RACT=0 D MODS Q:$D(RAOUT)
108CREATE1 ;ask for the 'Date Desired' req'd P75
109 S RAWHEN=$$DESDT^RAUTL12(RAPRI) S:RAWHEN=-1 RAOUT=1 Q:$D(RAOUT)#2
110 S RAWHEN=$$FMTE^XLFDT(RAWHEN,1) ;convert to external format
111 ; Ask pregnant if age is between 12 & 55. Ask once for mult requests
112 ; RASKPREG is the variable used to track if the pregnant prompt has
113 ; been asked. Ask only once for multiple requests.
114 S:'$D(RASKPREG) RAPREG=$$PREG^RAORD1A(RADFN,$G(DT)),RASKPREG="" Q:$D(RAOUT)
115 ;Reason for Study (req'd) & Clinical History (optional) asked in CH^RAUTL5 P75
116 D CH^RAUTL5 Q:$D(RAOUT) ;RAOUT: defined if Reason for Study is nonexistent
117BAQUES ;*Billing Awareness Project
118 ; Ask Ordering ICD-9 Diagnosis and Related SC/EI/MST/HNC questions.
119 N RADTM D NOW^%DTC S RADTM=%
120 D ASK^RABWORD(RADFN,RADTM)
121 I '$D(RADR1) D DISP^RAORDU1 Q:$D(RAOUT) ; Display Order Responses.
122 S X=RADFN,DIC="^RAO(75.1,",DIC(0)="L",DLAYGO=75.1
123 D FILE^DICN K DIC Q:Y<0 S RAOIFN=+Y K DLAYGO
124 I $D(RAREGFLG)!($D(RAVSTFLG)) S RANUM=$S('$D(RANUM):1,1:RANUM+1),RAORDS(RANUM)=RAOIFN
125 I $D(^RA(79,+RADIV,.1)),$P(^(.1),"^",21)="y" S RALOCFLG=""
126 W ! S DA=RAOIFN,DIE="^RAO(75.1,",DIE("NO^")="OUTOK"
127 S DR=$S($D(RADR1):"[RA QUICK EXAM ORDER]",$D(RADR2):"[RA ORDER EXAM]",$D(RAEXMUL)&($D(RAFIN1)):"[RA QUICK EXAM ORDER]",1:"[RA ORDER EXAM]")
128 ;*Billing Awareness Project
129 ; If Order questions are being Re-Asked then Re-Ask ICD-9 Dx questions
130 I DR="[RA ORDER EXAM]" D ASK^RABWORD(RADFN,RADTM) W !!
131 D ^DIE
132 K DIE("NO^"),DE,DQ,DIE,DR,RADR1,RADR2
133 I $D(RAFIN),$D(^RAO(75.1,RAOIFN,0)) S RAORD0=^(0) D FILEDX^RABWORD(RADFN,RAOIFN) Q:'$D(RAFIN) D SETORD^RAORDU D OERR^RAORDU:'$D(RAPKG) D ^RAORDQ:$D(RAPKG) K RAORD0
134 I '$D(RAFIN) W !?3,$C(7),"Request not complete. Must Delete..." S DA=RAOIFN,DIK="^RAO(75.1," D ^DIK W "...deletion complete!" I $D(RAREGFLG)!($D(RAVSTFLG)) K RAORDS(RANUM)
135 I '$D(RAFIN),('$D(^RAO(75.1,RAOIFN,0))#2) Q ; record deleted!
136 K RAFIN
137 ; check if the 'stat' or 'urgent' alert is to be sent.
138 N RALOC,RAORD0
139 S RAORD0=$G(^RAO(75.1,RAOIFN,0)),RALOC=+$P(RAORD0,"^",20)
140 Q:'RALOC ; if no 'SUBMIT TO' location, can't send stat/urgent alerts
141 I $P(RAORD0,"^",6)=1!(($P(RAORD0,"^",6)=2)&($P(^RA(79.1,RALOC,0),"^",20)="Y")) D
142 .; If 6th piece of RAORD0=1 *stat*, =2 *urgent*
143 .Q:$$ORVR^RAORDU()<3
144 .; needs OE/RR 3.0 or greater for stat/urgent alerts to fire
145 .D OENO^RAUTL19(RAOIFN)
146 .Q
147 Q
148 ;
149MODS ;RAPRI= Procedure IEN, RAIMAG=Imaging Type for the procedure.
150 ;Edited 4/19/94, Type of Imaging is now a multiple in file 71.2. CEW
151 S RAIMAG=+$$ITYPE^RASITE(RAPRI),DIC(0)="AEQMZ",DIC="^RAMIS(71.2,",DIC("A")="Select "_$P($G(^DIC(71.2,0)),"^")_": "
152 S DIC("S")="I +$D(^RAMIS(71.2,""AB"",RAIMAG,+Y)),$S('$G(RASERIES):1,$P(^RAMIS(71.2,+Y,0),U,2)="""":1,1:0),$$INIMOD^RAORD1A($P($G(^RAMIS(71.2,+Y,0)),""^""))"
153 D ^DIC K DIC,RAIMAG S:$D(DTOUT)!($D(DUOUT)) RAOUT=1 Q:$D(RAOUT)!(X="^")!(X="") I Y<1 W $C(7)," ??" G MODS
154 S RACT=RACT+1,RAMOD(RACT)=$P(Y,"^",2) G MODS
155 Q
156 ;
157ALLERGY ; If patient has had a previous contrast media allergic reaction
158 ; check procedure RAPRI for specific contrast media associations
159 ; (new with RA*5*45)
160 Q:'$$ORCHK^GMRAOR(RADFN,"CM")
161 S RAPRI(0)=$G(^RAMIS(71,RAPRI,0))
162 I $P(RAPRI(0),U,6)'="P" D ;not a parent check lone procedure
163 .D CONTRAST^RAUTL2(RAPRI)
164 .Q
165 E S I=0 D ;check descendent procedures for CM
166 .F S I=$O(^RAMIS(71,RAPRI,4,I)) Q:'I D CONTRAST^RAUTL2(+$G(^(I,0)))
167 .K I
168 .Q
169 K RAPRI(0)
170 Q
171SAVE ; Save original value of RAMDV before it is altered in the ENADD sub-
172 ; routine. This code will also reset RAMDV to the sign-on value.
173 Q:'$D(RAPKG) ; entered through OE/RR (RAMDV will not be set)
174 Q:'$D(RAMDV)&('$D(RAMDVZZ)) ;entered through 'Request an Exam' option used stand-alone outside of Rad/NM pkg
175 I '$D(RAMDVZZ) S RAMDVZZ=RAMDV
176 E S RAMDV=RAMDVZZ
177 Q
Note: See TracBrowser for help on using the repository browser.