source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAO7RON.m@ 1147

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

revised back to 6/30/08 version

File size: 4.3 KB
Line 
1RAO7RON ;HISC/GJC- Request message from OE/RR. (frontdoor) ;2/2/98 12:34
2 ;;5.0;Radiology/Nuclear Medicine;**41,75**;Mar 16, 1998;Build 4
3 ;
4 ;------------------------- Variable List -------------------------------
5 ; RADATA=HL7 data minus seg. hdr RAHDR=Segment header
6 ; RAHLFS="|" RAMSG=HL7 message passed in
7 ; RAOBR12=danger code RAOBR18=modifier
8 ; RAOBR19=hosp. loc. pntr (44) RAOBR30=trans. mode
9 ; RAOBR4=univ. trans. mode RAOBX2=format of observ. value
10 ; RAOBX3=observ. ID RAOBX5=observ. value
11 ; RAORC1=order control RAORC10=entered by (200)
12 ; RAORC11=approving rad/nm phys (for some procedures only)
13 ; RAORC12=ordering provider (200) RAORC15=order effective D/T
14 ; RAORC16=order control reason RAORC2=placer order #_"^OR"
15 ; RAORC3=filler order #_"^RA" RAORC7=start dt/freq. of service
16 ; RAPID3=patient ID RAPID5=patient name (2)
17 ; RAPV119=visit # RAPV12=patient class
18 ; RAPV13=patient location (44) RASEG=message seg. including header
19 ; ----------------------------------------------------------------------
20EN1(RAMSG) ; Pass in the message from RAO7RO. Decipher information.
21 D BRKOUT^RAO7UTL1
22 ; defines RAORC2, RAORC3, RAPID3, RAPID5, RAMSH3 & RADIV(.119)
23 S (RAERR,RAWP,RALINEX)=0,RACLIN="^" K ^TMP("RAWP",$J)
24 F S RALINEX=$O(RAMSG(RALINEX)) Q:RALINEX'>0 D Q:RAERR
25 . S RASEG=$G(RAMSG(RALINEX)) Q:$P(RASEG,RAHLFS)="MSH" ; quit if MSH segment
26 . S RAHDR=$P(RASEG,RAHLFS),RADATA=$P(RASEG,RAHLFS,2,999)
27 . D @$S(RAHDR="PID":"PID",RAHDR="PV1":"PV1",RAHDR="ORC":"ORC",RAHDR="OBR":"OBR^RAO7RON1",RAHDR="OBX":"OBX^RAO7RON1",RAHDR="DG1":"GETCPRS^RABWORD1",RAHDR="ZCL":"GETCPRS^RABWORD1",1:"ERR")
28 . Q
29 S RANEW(75.1,"+1,",18)=RALDT
30 Q
31PID ; breakdown the 'PID' segment
32 S RAERR=$$EN2^RAO7VLD(2,RAPID3,RAPID5) S:RAERR RAERR=2
33 I 'RAERR S RANEW(75.1,"+1,",.01)=RAPID3
34 Q
35PV1 ; breakdown the 'PV1' segment
36 S RAPV12=$P(RADATA,RAHLFS,2)
37 S RAERR=$$EN1^RAO7VLD(75.1,4,"E",RAPV12,"RASULT","") S:RAERR RAERR=27 Q:RAERR
38 S RANEW(75.1,"+1,",4)=RAPV12
39 S RAPV13=$P(RADATA,RAHLFS,3)
40 S RAERR=$$EN3^RAO7VLD(44,+RAPV13) S:RAERR RAERR=3 Q:RAERR
41 S RANEW(75.1,"+1,",22)=+RAPV13
42 I RAPV12="I",$P(^SC($P(RAPV13,U,1),0),U,3)'="W" S RAERR=9 Q:RAERR
43 I RAPV12="O",$P(^SC($P(RAPV13,U,1),0),U,3)="W" S RAERR=9 Q:RAERR
44 S RAPV119=$P(RADATA,RAHLFS,19)
45 Q
46ORC ; breakdown the 'ORC' segment
47 ; RAORC7D is: timestamp HL7 format
48 ; RAORC7P is: priority/urgency
49 S:+RAORC2'>0 RAERR=16 Q:RAERR
50 S RANEW(75.1,"+1,",7)=+RAORC2
51 S RANEW(75.1,"+1,",5)=5
52 S RAORC7=$P(RADATA,RAHLFS,7)
53 S RAORC7D=$P(RAORC7,RAECH(1),4)
54 S RAORC7D=$$FMDATE^HLFNC(RAORC7D)
55 S RAERR=$$EN1^RAO7VLD(75.1,21,"E",RAORC7D,"RASULT","") S:RAERR RAERR=28 Q:RAERR
56 S RANEW(75.1,"+1,",21)=RAORC7D
57 S X=$P(RAORC7,RAECH(1),6)
58 S RAORC7P=$S(X="S":1,X="A":2,X="R":9,1:"") I +RAORC7P'>0 S RAERR=5 Q
59 S RANEW(75.1,"+1,",6)=RAORC7P
60 S RAORC10=$P(RADATA,RAHLFS,10)
61 S RAERR=$$EN3^RAO7VLD(200,RAORC10) S:RAERR RAERR=4 Q:RAERR
62 S RANEW(75.1,"+1,",15)=RAORC10
63 S RAORC11=$P(RADATA,RAHLFS,11) ;approving rad/nm phys for some proc's
64 I $G(RAORC11) S RAERR=$$EN3^RAO7VLD(200,RAORC11) S:RAERR RAERR=36 Q:RAERR
65 I $G(RAORC11) S RANEW(75.1,"+1,",8)=RAORC11
66 S RAORC12=$P(RADATA,RAHLFS,12)
67 S RAERR=$$EN3^RAO7VLD(200,RAORC12) S:RAERR RAERR=6 Q:RAERR
68 S RANEW(75.1,"+1,",14)=RAORC12
69 S RAORC15=$P(RADATA,RAHLFS,15)
70 S RAORC15=$$FMDATE^HLFNC(RAORC15)
71 ;The order entered dt/time validity ck results are ignored because we
72 ;have never been able to determine why FileMan erroneously rejects
73 ;some date/times in a Silent FM call. We now assume this date is OK.
74 S RAERR=$$EN1^RAO7VLD(75.1,16,"E",RAORC15,"RASULT","") S:RAERR RAERR=35
75 ;Q:RAERR
76 I RAERR D S RAERR=0
77 . N I,RAX,RAVARS,RAERRDT
78 . S RAX=$G(^TMP("DIERR",$J,1,"TEXT",1))
79 . S RAERRDT=$$NOW^XLFDT()
80 . F I="RAX","RAORC15","RAERRDT","RAERR" S RAVARS(I)=""
81 . S:$D(X) RAVARS("X")="" S:$D(%DT) RAVARS("%DT")=""
82 . S:$D(%DT(0)) RAVARS("%DT(0)")=""
83 . ;S RAVARS("RAX")="",RAVARS("RAORC15")="",RAVARS("RAERRDT")="",RAVARS("RAERR")=""
84 . D EN^ORERR("RAD MYSTERY ERROR",.RAMSG,.RAVARS)
85 . Q
86 S RANOW=$$NOW^XLFDT() I RANOW<RAORC15 S RAERR=7 Q
87 S RANEW(75.1,"+1,",16)=RAORC15
88 Q
89ERR ; error control - file 'soft' errors with CPRS
90 N RAVAR S RAVAR("XQY0")=""
91 D ERR^RAO7UTL("HL7 message with unknown segment header",.RAMSG,.RAVAR)
92 Q
Note: See TracBrowser for help on using the repository browser.