| 1 | RAUTL00 ;HIRMFO/GJC-Utility Routine (linked to RAUTL0) ;11/14/97  12:01
 | 
|---|
| 2 |  ;;5.0;Radiology/Nuclear Medicine;;Mar 16, 1998
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 | OENOTE ; Fire off OE/RR notification for [abnormal, amended] rad results
 | 
|---|
| 5 |  ; back door fires off this notif. regardless of oe/rr version
 | 
|---|
| 6 |  ; because oe/rr doesn't get abnormal/amended info in HL7 msgs
 | 
|---|
| 7 |  I $$ORVR^RAORDU()=2.5 D
 | 
|---|
| 8 |  . N RAWITCH S X1=$S($D(^RAMIS(71,+$P(X,"^",2),0)):$P(^(0),"^"),1:"")
 | 
|---|
| 9 |  . S ORBPMSG=$S($D(RAAB):"Abnormal ",1:"")_"Imaging Results: "
 | 
|---|
| 10 |  . S:$D(^RAO(75.1,+$P(X,"^",11),0)) ORIFN=+$P(^(0),"^",7)
 | 
|---|
| 11 |  . S RAWITCH=$$OE1009() ; determine OE/RR Notification
 | 
|---|
| 12 |  . Q:RAWITCH=-1  ; invalid OE/RR Notification, quit!
 | 
|---|
| 13 |  . I RAWITCH=53!(+$O(^RARPT(RARPT,"ERR",0))) D
 | 
|---|
| 14 |  .. S:$D(RAAB) ORBPMSG="Amended/"_ORBPMSG
 | 
|---|
| 15 |  .. S:'$D(RAAB) ORBPMSG="Amended "_ORBPMSG
 | 
|---|
| 16 |  .. Q
 | 
|---|
| 17 |  . N RAVAR S RAVAR=$L(ORBPMSG),RAVAR=70-RAVAR
 | 
|---|
| 18 |  . S ORBPMSG=ORBPMSG_$E(X1,1,RAVAR)
 | 
|---|
| 19 |  . S ORNOTE(RAWITCH)=$S($D(ORIFN):1,1:"") D NOTE^ORX3
 | 
|---|
| 20 |  . Q
 | 
|---|
| 21 |  I $$ORVR^RAORDU()'<3 D
 | 
|---|
| 22 |  . ; Recall RADFN, RADTI & RACNI from the RASAVE array
 | 
|---|
| 23 |  . S RADFN=$G(RASAVE("RADFN")),RADTI=$G(RASAVE("RADTI"))
 | 
|---|
| 24 |  . S RACNI=$G(RASAVE("RACNI"))
 | 
|---|
| 25 |  . D OE3(RADFN,RADTI,RACNI,X)
 | 
|---|
| 26 |  . Q
 | 
|---|
| 27 |  Q
 | 
|---|
| 28 | OE1009() ; Determine the notification informing OE/RR
 | 
|---|
| 29 |  ; Output: OE/RR Notification [ ien for ^ORD(100.9, ]
 | 
|---|
| 30 |  N RANOTY ; used to identify type of OE/RR Notification
 | 
|---|
| 31 |  S RANOTY=-1 ; initalize to error condition
 | 
|---|
| 32 |  I $D(RAAB) S RANOTY=25 ; Abnormal Imaging Results
 | 
|---|
| 33 |  E  D
 | 
|---|
| 34 |  . I '+$O(^RARPT(RARPT,"ERR",0))  S RANOTY=22 ; Imaging Results V'fied
 | 
|---|
| 35 |  . E  S RANOTY=$S($$ORVR^RAORDU'<3:53,1:22) ; Imaging Result Amended
 | 
|---|
| 36 |  . Q
 | 
|---|
| 37 |  Q RANOTY
 | 
|---|
| 38 |  ;
 | 
|---|
| 39 | OE3(RADFN,RADTI,RACNI,X) ; Fire off oe/rr notifications, version 3.0+
 | 
|---|
| 40 |  ; Input: 'RADFN': Patient DFN   <->   'RADTI': exam timestamp (inverse)
 | 
|---|
| 41 |  ;        'RACNI': Exam ien      <->   'X'    : exam zero node
 | 
|---|
| 42 |  ; *** 'RARPT' is assumed to exist and be a valid ien in file 74. ***
 | 
|---|
| 43 |  N RA751,RAIENS,RAMSG,RANOTE,RAOIFN,RAREQPHY,X1
 | 
|---|
| 44 |  S X1=$S($D(^RAMIS(71,+$P(X,"^",2),0)):$P(^(0),"^"),1:"")
 | 
|---|
| 45 |  S RA751=$G(^RAO(75.1,+$P(X,"^",11),0))
 | 
|---|
| 46 |  S RAIENS=RADTI_"~"_RACNI
 | 
|---|
| 47 |  I $D(RAAB) D  ; abnormal Dx code associated with report
 | 
|---|
| 48 |  . S:'+$O(^RARPT(RARPT,"ERR",0)) RANOTE="25^Abnormal Imaging Results: "_$E(X1,1,25)
 | 
|---|
| 49 |  . S:+$O(^RARPT(RARPT,"ERR",0)) RANOTE="53^Amended/Abnormal Imaging Results: "_$E(X1,1,20)
 | 
|---|
| 50 |  . Q
 | 
|---|
| 51 |  I '$D(RAAB)  D  ; no abnormal Dx code with this report
 | 
|---|
| 52 |  . S:'+$O(^RARPT(RARPT,"ERR",0)) RANOTE="22^Imaging Results: "_$E(X1,1,30)
 | 
|---|
| 53 |  . S:+$O(^RARPT(RARPT,"ERR",0)) RANOTE="53^Amended Imaging Results: "_$E(X1,1,25)
 | 
|---|
| 54 |  . Q
 | 
|---|
| 55 |  S RAMSG=$P($G(RANOTE),"^",2),RAOIFN=$P(RA751,"^",7),RAREQPHY(+$P(X,"^",14))=""
 | 
|---|
| 56 |  D EN^ORB3(+$G(RANOTE),RADFN,RAOIFN,.RAREQPHY,RAMSG,RAIENS)
 | 
|---|
| 57 |  Q
 | 
|---|