source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAUTL8.m@ 789

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

initial load of WorldVistAEHR

File size: 8.3 KB
Line 
1RAUTL8 ;HISC/CAH-Utility routines ;10/3/97 16:02
2 ;;5.0;Radiology/Nuclear Medicine;**45,72**;Mar 16, 1998
3 ;
4 ;Called by File 70, Exam subfile, Procedure Fld 2 Input transform
5 ;RA*5*45: modified - logic in PRC1, ASK, ASK1, & MES1 subroutines
6 ; removed - MES subroutine
7 ;RA*5*72 03/23/2006 BAY/GJC/KAM Remedy Call 136200 Correct UNDEF issue
8 ;
9PRC G PRC1:'$D(^RADPT(DA(2),"DT","AP",X)) ; check for C.M. reaction
10 N RADUP S RADUP=+$$DPDT^RAUTL8(X,.DA)
11 I RADUP D ASK Q:'$D(X)
12PRC1 ; Check for C.M. reaction on this patient
13 ; +X is the IEN of the Rad/Nuc Med Procedure in file 71
14 ; RA*5*72 - Changed next line to preserve variables
15 N RAGMRAOR S RAGMRAOR=$$GMRAOR(DA(2)) Q:RAGMRAOR'=1
16 D CONTRAST^RAUTL2(+X) ;displays contrast(s) associated with procedure
17 ;use RAPMSG for CONTRAST REACTION MESSAGE field 25, file 79
18 S RAPMSG=$G(^RA(79,+$P(^RADPT(DA(2),"DT",DA(1),0),"^",3),"CON"))
19 D:RAPMSG'="" EN^DDIOL("..."_RAPMSG_"...","","!?3")
20 D EN^DDIOL("","","!") ;line feed
21 K RAPMSG
22 D:$P($G(^RAMIS(71,+X,0)),U,20)="Y" MES1 ;message only if CM used
23 Q
24ASK ; Prompt user for yes/no response
25 N RAX D EN^DDIOL("Procedure is already entered for this date. Is it ok to continue? No// ","","!!?3")
26ASK1 R RAX:DTIME
27 S:'$T!(RAX="")!(RAX["^")!("Nn"[$E(RAX)) RAX="N"
28 K:RAX="N" X Q:'$D(X)
29 I "Yy"'[$E(RAX) S RAPMSG(1)="Enter 'YES' to register patient for this procedure, or 'NO' to edit the",RAPMSG(2)="above procedure. No// ",RAPMSG(1,"F")="!!?3",RAPMSG(2,"F")="!?3" D EN^DDIOL(.RAPMSG) K RAPMSG G ASK1
30 Q
31 ;
32MES1 ; display procedure acceptance message
33 R !?5,"...Type 'OK' to acknowledge or '^' to select another procedure ==> ",RAX:DTIME
34 S RAX=$$UP^XLFSTR(RAX)
35 I '$T!(RAX["^")!(RAX="OK") K:RAX'="OK" X K RAX,RAI Q
36 G MES1
37 ;
38STATSEL ;Select one or more order statuses
39 ;INPUT VARIABLES:
40 ; RANO() array contains status codes prohibited from selection
41 ;OUTPUT VARIABLES:
42 ; RAST is a string of status codes selected (ex: 1^3^8)
43 ; RAORST() is an array of selected status codes and status names
44 ; (ex: RAORST(1)="DISCONTINUED", RAORST(3)="HOLD", ... )
45 K RAST,RAORST W ! S RAORSTS=$P(^DD(75.1,5,0),U,3) F I=1:1 S X=$P(RAORSTS,";",I) Q:X="" S X1=$P(X,":",1) I '$D(RANO(X1)) S X2=$P(X,":",2),RAORST(X1)=X2
46 W !!,"Select statuses to include on report.",! S X1="" F S X1=$O(RAORST(X1)) Q:X1="" W !?5,$J(X1,2,0)_" "_RAORST(X1)
47STAT W ! K DIR S DIR(0)="L" D ^DIR Q:'$D(Y(0))
48 S RAST="" F I=1:1 S RASTX=$P(Y(0),",",I) Q:RASTX="" I $D(RAORST(RASTX)) S RAST=RAST_"^"_RASTX
49 S RAST=$E(RAST,2,99) I RAST="" W !," ?? Sorry, invalid status selection. Please try again.",! G STAT
50 S I="" F S I=$O(RAORST(I)) Q:I="" I RAST'[I K RAORST(I)
51 K RASTX,I,X,X1,X2 Q
52 ;
53 ;INPUT TRANSFORM FOR SECONDARY INTERPRETING RESIDENT
54S() ; do not enter primary OR SAME SEC in secondary interpreting resident
55 I '$D(X)!('$D(DA(3))) G S2
56 I '$D(^RADPT(DA(3),"DT",DA(2),"P",DA(1),0)) G S2
57 I $D(^RADPT(DA(3),"DT",DA(2),"P",DA(1),"SRR","B",+Y)) Q 0 ;SAME SEC RES
58 I $P(^RADPT(DA(3),"DT",DA(2),"P",DA(1),0),"^",12)=+Y Q 0
59 Q 1
60S2 I '$D(^RADPT(DA(2),"DT",DA(1),"P",DA,0)) Q 0
61 I $D(^RADPT(DA(2),"DT",DA(1),"P",DA,"SRR","B",+Y)) Q 0 ;SAME SEC RES
62 I $P(^RADPT(DA(2),"DT",DA(1),"P",DA,0),"^",12)=+Y Q 0
63 Q 1
64 ;INPUT TRANSFORM FOR SECONDARY INTERPRETING STAFF
65SSR() ; do not enter primary OR SAME SEC in secondary interpreting staff
66 I '$D(X)!('$D(DA(3))) G SSR2
67 I '$D(^RADPT(DA(3),"DT",DA(2),"P",DA(1),0)) G SSR2
68 I $D(^RADPT(DA(3),"DT",DA(2),"P",DA(1),"SSR","B",+Y)) Q 0 ;SAME SEC STF
69 I $P(^RADPT(DA(3),"DT",DA(2),"P",DA(1),0),"^",15)=+Y Q 0
70 Q 1
71SSR2 I '$D(^RADPT(DA(2),"DT",DA(1),"P",DA,0)) Q 0
72 I $D(^RADPT(DA(2),"DT",DA(1),"P",DA,"SSR","B",+Y)) Q 0 ;SAME SEC STF
73 I $P(^RADPT(DA(2),"DT",DA(1),"P",DA,0),"^",15)=+Y Q 0
74 Q 1
75 ;INPUT TRANSFORM FOR PRIMARY INTERPRETING RESIDENT
76 ; *** NOT USED - See EN ***
77PRRS() ; do not enter secondary into primary interpreting resident screen
78 ; called from input transform ^DD(70.03,12,0)
79 I $D(^RADPT(DA(2),"DT",DA(1),"P",DA,"SRR","B",+Y)) Q 0
80 Q 1
81 ;INPUT TRANSFORM FOR PRIMARY INTERPRETING STAFF
82 ; *** NOT USED - See EN ***
83PSRS() ; do not enter secondary into primary interpreting staff screen
84 ; called from input transform ^DD(70.03,15,0)
85 I $D(^RADPT(DA(2),"DT",DA(1),"P",DA,"SSR","B",+Y)) Q 0
86 Q 1
87EN(X,FLD,RA) ;Input transform screen for Primary Staff, Primary Res
88 ;Used by fields 70.03,12 & 70.03,15. If 'Primary' is found in
89 ; the 'Secondary' multiple then delete the 'Secondary' entry.
90 ; X = 'Primary' IEN, FLD = 'Secondary' mult. to check, RA = DA array
91 N DA,DEL,HDR,IEN,NODE,SAVEX,SUBDD,XREF
92 S NODE=$S(FLD=60:"SSR",FLD=70:"SRR",1:""),SAVEX=X
93 S SUBDD=$S(FLD=60:70.11,FLD=70:70.09,1:""),(IEN,DEL)=0
94 I (NODE="")!(X'>0)!(FLD'>0)!(SUBDD'>0) Q
95 F S IEN=$O(^RADPT(RA(2),"DT",RA(1),"P",RA,NODE,"B",X,IEN)) Q:IEN'>0 D
96 . S XREF=0
97 . F S XREF=$O(^DD(SUBDD,.01,1,XREF)) Q:XREF'>0 D
98 .. S (D0,DA(3))=RA(2),(D1,DA(2))=RA(1),(D2,DA(1))=RA,(D3,DA)=IEN,X=SAVEX
99 .. I $G(^DD(SUBDD,.01,1,XREF,2))]"" X ^(2)
100 .. Q
101 . K ^RADPT(RA(2),"DT",RA(1),"P",RA,NODE,IEN,0) S DEL=DEL+1
102 . Q
103 I DEL D
104 . S HDR=$G(^RADPT(RA(2),"DT",RA(1),"P",RA,NODE,0)) Q:HDR=""
105 . S HDR(3)=+$O(^RADPT(RA(2),"DT",RA(1),"P",RA,NODE,0))
106 . S HDR(4)=$P(HDR,U,4)-DEL
107 . S:HDR(3)'>0 HDR(3)="" S:HDR(4)'>0 HDR(4)=""
108 . S $P(^RADPT(RA(2),"DT",RA(1),"P",RA,NODE,0),U,3,4)=HDR(3)_U_HDR(4)
109 . Q
110 S X=SAVEX
111 Q
112DPDT(RAPRC,RAY) ; Check for registration of duplicate procedures on the same
113 ; date/time. Called from PRC above.
114 ; INPUT VARIABLES
115 ; 'RAPRC' --> IEN of the procedure (71)
116 ; 'RAY' --> DA array i.e, DA, DA(1), & DA(2)
117 ; OUTPUT VARIABLES
118 ; 'RAFLG' --> RAFLG=1 procedure registered for this date/time
119 ; --> RAFLG=0 initial registration for procedure@date/time
120 N RA72,RABDT,RACIEN,RAEDT,RAFLG,RAI S RAFLG=0
121 S RABDT=RAY(1)\1,RAEDT=RABDT_".9999",RAI=RABDT-.0000001
122 F S RAI=$O(^RADPT(RAY(2),"DT","AP",RAPRC,RAI)) Q:RAI'>0!(RAI>RAEDT) D Q:RAFLG
123 . Q:RAI=RAY(1) ; At this point our exam status is 'WAITING FOR EXAM'
124 . S RACIEN=$O(^RADPT(RAY(2),"DT","AP",RAPRC,RAI,0)) Q:'RACIEN
125 . S RA72=+$P($G(^RADPT(RAY(2),"DT",RAI,"P",RACIEN,0)),U,3) ;xam stat
126 . S RA72(3)=$P($G(^RA(72,RA72,0)),U,3)
127 . I RA72(3)'=0 S RAFLG=1 ; cancelled exams are not taken into account
128 . Q
129 Q RAFLG
130SCRN(RADA,RARS,Y,RALVL) ; check if the primary or secondary int'ng staff
131 ; or resident has access to a location or locations which have
132 ; an imaging type which match the imaging type of the examination.
133 ; This screen will also check the classification of the individual to
134 ; ensure that they are active and valid for the field being edited.
135 ;
136 ; Called from DD's: ^DD(70.03,12 - ^DD(70.03,15 - ^DD(70.03,60
137 ; ^DD(70.03,70 - ^DD(70.09,.01 - ^DD(70.11,.01
138 ;
139 ; Input variables: RADA-> DA array, maps to RADFN, RADTI & RACNI
140 ; RARS-> Classification: Resident("R") or Staff("S")
141 ; Y-> selected resident/staff
142 ; RALVL-> "PRI"=Primary physician, "SEC"=Secondary
143 ;
144 ; Output variable: $S(1:I-Types & classification match, resident/staff
145 ; ok,0:no match re-select resident/staff)
146 ;
147 I $S('$D(^VA(200,+Y,"RA")):1,'$P(^("RA"),U,3):1,DT'>$P(^("RA"),U,3):1,1:0),($D(^VA(200,"ARC",RARS,+Y)))
148 Q:'$T 0 ; failed the classification part of the screen
149 Q:$D(^XUSEC("RA ALLOC",+Y)) 1 ; Resident/Staff has access to all loc's!
150 N RA7002,RACCESS
151 ; adjust RADA() due Fileman's unpredictable retention of DA() levels
152 I RALVL="SEC" D
153 . I '$D(RADA(3)) S RA7002=$G(^RADPT(RADA(2),"DT",RADA(1),0))
154 . I $D(RADA(3)),(RADA(2)'=RADA(3)) S RA7002=$G(^RADPT(RADA(3),"DT",RADA(2),0))
155 . I $D(RADA(3)),(RADA(2)=RADA(3)) S RA7002=$G(^RADPT(RADA(2),"DT",RADA(1),0))
156 I RALVL="PRI" S RA7002=$G(^RADPT(RADA(2),"DT",RADA(1),0))
157 D VARACC^RAUTL6(+Y) ; set-up access array for selected resident/staff
158 Q:'$D(RACCESS(+Y,"IMG",+$P(RA7002,"^",2))) 0 ; no i-type match
159 Q 1
160 ;
161CMEDIA(RADFN,RADTI,RACNI) ;return the CM used with an exam
162 ;input: RADFN=patient DFN, RADTI=inv. date/time of exam, RACNI=exam IEN
163 ;return: contrast media administered to the patient during an exam
164 N RAI,RAS S RAI=0,RAS=""
165 F S RAI=$O(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"CM",RAI)) Q:'RAI D
166 .S RAI(0)=$P($G(^RADPT(RADFN,"DT",RADTI,"P",RACNI,"CM",RAI,0)),U)
167 .S RAS=RAS_$$EXTERNAL^DILFD(70.3225,.01,"",RAI(0))_", "
168 Q $P(RAS,", ",1,($L(RAS,", ")-1))
169 ;
170GMRAOR(RADA2) ;look for a contrast media reaction
171 N D,D0,D1,D2,D3,DA,DC,DD,DFN,DG,DH,DI,DIC,DIE,DIEDA,DIEL,DIETMP,DIEXREF,DIFLD,DIIENS,DIOV,DIP,DK,DL,DLAYGO,DM,DN,DOV,DP,DQ,DR,X,Y
172 Q $$ORCHK^GMRAOR(RADA2,"CM")
173 ;
Note: See TracBrowser for help on using the repository browser.