source: FOIAVistA/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAO7RO.m@ 1800

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

initial load of FOIAVistA 6/30/08 version

File size: 6.8 KB
Line 
1RAO7RO ;HISC/GJC,FPT-Request message from OE/RR. ;9/11/98 11:56
2 ;;5.0;Radiology/Nuclear Medicine;**1,2,13,15,75**;Mar 16, 1998;Build 4
3 ;
4 ;------------------------- Variable List -------------------------------
5 ; RAFLG=flag indicates ORC reached RAHLFS="|"
6 ; RAMSG=HL7 message passed in RAORD=ORC-1 (Order control)
7 ; RAPLCHLD=Tracks place holder values for adding entries to sub-files
8 ; in the Rad/Nuc Med Orders file.
9 ; RASEG=specific HL7 node X=subscript of HL7 node
10 ; ----------------------------------------------------------------------
11 ;
12EN1(RAMSG) ; Pass in the message from OE/RR. Decipher information.
13 ; new variables for RAO7RO processing
14 N A,AAH,ARR,CHAR,CNT,DFN,ERR,FLG,GMTSTYP,I,J,L,LEN,MSG,RA,RA0
15 N RA7003,RA71,RA713,RA783,RAA,RAB,RAC,RACLIN,RACMCODE,RACMNOR
16 N RACNT,RACOST,RACPT,RACPTIEN,RAD0,RADATA,RADBS,RADC,RADFN,RADUZ
17 N RAECH,RAEMSG,RAERR,RAFDA,RAFLG,RAFNAME,RAFNUM,RAHDR,RAHLFS
18 N RAIEN71,RAIL,RAIMGAB,RAIMGTYI,RAINCR,RAION,RAIT,RALDT,RALINEX,RALOC
19 N RAMFE,RAMODIEN,RAMSH3,RAMULT,RANEW,RANOW,RANSTAT,RAOBR18,RAOBR19
20 N RAOBR30,RAOBR4,RAOBX2,RAOBX3,RAOBX5,RAOIFN,RAORC1,RAORC10,RAORC11
21 N RAORC12,RAORC15,RAORC16,RAORC2,RAORC3,RAORC7,RAORC7D,RAORC7P
22 N RAORD,RAPGE,RAPLCHLD,RAPREG,RAPHYAP,RAPID3,RAPID5,RAPRCTY
23 N RAPV119,RAPV12,RAPV13,RAREA,RARMBED,RASEG,RASTATUS,RASUB
24 N RATSTMP,RAVAR,RAWARD,RAWP,RAX,RAXIT,RAXT71,RAY,RAZ,T1,T2,T3
25 N VAIP,X,Y,Y1,Y2,Y3,Y4,Y5,Z,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
26 S X=^%ZOSF("ERRTN"),@^%ZOSF("TRAP")
27 S (RAFLG,X)=0,RAPLCHLD=1
28 D EN1^RAO7UTL ; setup field seperator data (see var list)
29 S RALDT=$$NOW^XLFDT() ; setup 'Last Activity Date/Time'
30 F S X=$O(RAMSG(X)) Q:X'>0 D Q:RAFLG
31 . S RASEG=$G(RAMSG(X)) Q:$P(RASEG,RAHLFS)'="ORC" ; quit if not ORC
32 . S RAORD=$P(RASEG,RAHLFS,2),RAFLG=1
33 . Q
34 I RAORD'="NW"&(RAORD'="DC")&(RAORD'="NA")&(RAORD'="DE")&(RAORD'="Z@") D BRKOUT^RAO7UTL1,REJ^RAO7OKS("OC","Missing/Invalid Order Control") Q
35 I RAORD="NW" D EN1^RAO7RON(.RAMSG) D
36 .I $G(RAERR) D Q
37 ..S RAERR1="" I RAERR=35 I $G(RANOW) S RAERR1="Now="_RANOW
38 ..I RAERR=35 S RAERR1=RAERR1_" Req Entered Dt="_$G(RAORC15)
39 ..S RAERR=$$EN1^RAO7RO1(RAERR)_" "_$G(RAERR1) K RAERR1
40 ..D REJ^RAO7OKS("OC",RAERR) Q
41 .;if CLINICAL HISTORY was passed from CPRS and it failed the CLINICAL HISTORY data
42 .;requirements, reject the message
43 .I $P(RACLIN,U)=1,$P(RACLIN,U,2)'=1 S RAERR=$$EN1^RAO7RO1(15) D REJ^RAO7OKS("OC",RAERR) Q
44 .K ERR
45 .; Update 'REQUEST STATUS TIMES' multiple if parameter dictates!
46 .I "Yy"[RADIV(.119) D
47 ..; make sure that the activity log place holders differ from the
48 ..; modifiers place holders
49 ..S RAPLCHLD=RAPLCHLD+1
50 ..S RANEW(75.12,"+"_RAPLCHLD_",+1,",.01)=RALDT
51 ..S RANEW(75.12,"+"_RAPLCHLD_",+1,",2)=5
52 ..S RANEW(75.12,"+"_RAPLCHLD_",+1,",3)=+RAORC10
53 ..Q
54 .D UPDATE^DIE("","RANEW","RAORC3","ERR") S RAORC3=+$G(RAORC3(1))
55 .S RAORC3=$G(RAORC3)_"^RA"
56 .I $D(ERR) S RAERR=$$EN1^RAO7RO1(21) D REJ^RAO7OKS("OC",RAERR) Q
57 .D WP^DIE(75.1,+RAORC3_",",400,"K","^TMP(""RAWP"",$J)","ERR")
58 .D ACC^RAO7OKS("OK","","","","")
59 .; Prt request on im'g loc req prtr; if no im'g loc on the HL7 msg
60 .; check for prtr on first entry in Im'g Loc file; if no prtr on
61 .; first entry, don't print request
62 . S RAO751=$G(^RAO(75.1,+RAORC3,0))
63 . D:$P(RAO751,"^",6)=1!($P(RAO751,"^",6)=2) OENO^RAUTL19(+RAORC3)
64 . K RAO751 ; fire off 'stat' or 'urgent' alert if order qualifies
65 . ; print the request
66 . I +RAOBR19(3)>0 S RAION=$P($G(^RA(79.1,+RAOBR19(3),0)),U,16)
67 . ;I +RAOBR19(3)=0 S RAION=$P($G(^RA(79.1,+$O(^RA(79.1,0)),0)),U,16)
68 . I +RAOBR19(3)=0 D S:RAION="" RAION=$P($G(^RA(79.1,+$O(^RA(79.1,0)),0)),U,16)
69 .. S (RALOC,RAION)=""
70 .. ; Get Imaging Type of Procedure..
71 .. S RAIMGTYI=$P(^RAMIS(71,RAOBR4(4),0),U,12) Q:RAIMGTYI=""
72 .. F S RALOC=$O(^RA(79.1,"BIMG",RAIMGTYI,RALOC)) Q:RALOC="" D Q:RAION]""
73 ... ; Find Imaging Location within Imaging Type with Request device..
74 ... Q:$P(^RA(79.1,RALOC,0),U,16)=""
75 ... Q:^RA(79.1,RALOC,"DIV")'=+$$KSP^XUPARAM("INST")
76 ... S RAION=$P(^RA(79.1,RALOC,0),U,16)
77 . I RAION]"" D
78 .. D PSETUP Q:RAION']""
79 .. S ZTDTH=$H,ZTRTN="PRHS^RAO7RO",ZTIO=RAION
80 .. S ZTDESC="Rad/Nuc Med Request print - frontdoor (CPRS)"
81 .. D ^%ZTLOAD,HOME^%ZIS
82 .. K ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
83 .. Q
84 . Q
85 ;
86 I RAORD="Z@" N RAPUROK D EN2^RAO7PURG(.RAMSG) D ; RAPUROK set in
87 . ; EN2^RAO7PURG. If RAPUROK=1 send ok msg, else send reject msg
88 . I $G(RAERR) D REJ^RAO7OKS("ZU","") Q
89 . D:'RAPUROK REJ^RAO7OKS("ZU","")
90 . D:RAPUROK ACC^RAO7OKS("ZR","","","","")
91 . Q
92 I RAORD="DC" D EN1^RAO7RCH(.RAMSG) D
93 .I $G(RAERR) S RAERR=$$EN1^RAO7RO1(RAERR) D REJ^RAO7OKS("UD",RAERR) Q
94 .K ERR D FILE^DIE("K","RANEW","ERR")
95 .I $D(ERR) S RAERR=$$EN1^RAO7RO1(37) D REJ^RAO7OKS("UD",RAERR) Q
96 .D OE3^RABUL(+RAORC3) ; rad/nuc med request cancelled bulletin
97 .I "Yy"[RADIV(.119) D Q:$G(RAERR)
98 ..N ERR
99 ..S ERR=$$EN5^RAO7VLD(+RAORC3,1,+RAORC10,"")
100 ..I +$G(ERR) S RAERR=$$EN1^RAO7RO1(30) D REJ^RAO7OKS("UD",RAERR) Q
101 ..Q
102 .D ACC^RAO7OKS("DR","","","","")
103 .; print out the cancelled request
104 .S RAIMJLOC=+$P($G(^RAO(75.1,+RAORC3,0)),"^",20)
105 .I RAIMJLOC>0 S RAION=$P($G(^RA(79.1,RAIMJLOC,0)),U,24)
106 .I RAIMJLOC=0 S RAION=$P($G(^RA(79.1,+$O(^RA(79.1,0)),0)),U,24)
107 .I RAION]"" D
108 ..D PSETUP Q:RAION']""
109 ..S RACRHD="" ; set the cancelled request flag
110 ..S ZTDESC="Rad/Nuc Med Cancelled Request print - frontdoor (CPRS)"
111 ..S ZTIO=RAION,ZTDTH=$H,ZTRTN="PRHS^RAO7RO",ZTSAVE("RACRHD")=""
112 ..D ^%ZTLOAD,HOME^%ZIS
113 ..K RACRHD,RAIMJLOC,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
114 ..Q
115 .Q
116 ;
117 ;For an order control of: 'NA', we error if one of these three
118 ;conditions are true:
119 ;1) if the ien of the Rad/Nuc Med Order is not valid
120 ;2) patient file pointer (PID3) evaluates to a different
121 ; patient name than the PID5 value
122 ;3) cannot file oerr order ien into file 75.1
123 ;
124 I RAORD="NA" D EN1^RAO7OKR(.RAMSG) I $G(RAERR) D
125 . N RATXT S RATXT="Error for order control: 'NA'"
126 . S:RAERR'?1N.N RAERR="error not found in our error table"
127 . S:RAERR?1N.N RAERR=$$EN1^RAO7RO1(RAERR)
128 . S:$D(XQY0)#2 RAVAR("XQY0")="" S RAVAR("RAERR")=""
129 . D ERR^RAO7UTL(RATXT,.RAMSG,.RAVAR)
130 . Q
131 ;if order control of 'DE', CPRS files data into their OE/RR Errors file
132 ;I RAORD="DE"
133 ;purge DBS specific variables before exiting
134 ;
135PURGE ; kill & quit
136 D CLEAN^DILF
137 K ^TMP("RAWP",$J)
138 Q
139PRHS ; print request and/or health summary
140 U IO D ^RAORD5 ; print the request
141 S:'$D(RACRHD) GMTSTYP=$P($G(^RAMIS(71,+$G(RAOBR4(4)),0)),U,13)
142 I +$G(GMTSTYP) D ; don't print Health Summary with cancelled requests
143 . W:$Y @IOF D ENX^GMTSDVR(RADFN,GMTSTYP)
144 . Q
145 W ! D CLOSE^RAUTL
146 Q
147PSETUP ; Define the variables needed to print cancelled and non-cancelled
148 ; requests from the frontdoor (CPRS).
149 I RAION'?1N.N S RAION=$O(^%ZIS(1,"B",RAION,0)) Q:RAION']""
150 S RAION=$P($G(^%ZIS(1,RAION,0)),"^") Q:RAION']""
151 S RAOIFN=+RAORC3,RAPAGE=0,RAX="",RADFN=RAPID3
152 N RAFOERR S RAFOERR="" ; flag to indicate entry from frontdoor (CPRS)
153 F RAI="RADFN","RAOIFN","RAX","RAPGE","RAOBR4(","RAFOERR" S ZTSAVE(RAI)=""
154 S:$D(RAIL) ZTSAVE("RAIL")=""
155 Q
Note: See TracBrowser for help on using the repository browser.