| 1 | RAO7RCH ;HISC/GJC,FPT-Process Discontinued Message ;9/4/97  09:11
 | 
|---|
| 2 |  ;;5.0;Radiology/Nuclear Medicine;**15**;Mar 16, 1998
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 |  ;------------------------- Variable List -------------------------------
 | 
|---|
| 5 |  ; RADATA=HL7 data minus seg. hdr    RAHDR=Segment header
 | 
|---|
| 6 |  ; RAHLFS="|"                        RAMSG=HL7 message passed in
 | 
|---|
| 7 |  ; RAORC1=order control              RAORC10=entered by (200)
 | 
|---|
| 8 |  ; RAORC16=order control reason      RAORC2=placer order #_"^OR"
 | 
|---|
| 9 |  ; RAORC3=filler order #_"^RA"       RAPID3=patient ID
 | 
|---|
| 10 |  ; RAPID5=patient name (2)           RASEG=message seg. including header
 | 
|---|
| 11 |  ; ----------------------------------------------------------------------
 | 
|---|
| 12 | EN1(RAMSG) ;
 | 
|---|
| 13 |  D BRKOUT^RAO7UTL1
 | 
|---|
| 14 |  ; defines RAORC2, RAORC3, RAPID3, RAPID5, RAMSH3, & RADIV(.119)
 | 
|---|
| 15 |  S (RAERR,RALINEX)=0
 | 
|---|
| 16 |  F  S RALINEX=$O(RAMSG(RALINEX)) Q:RALINEX'>0  D  Q:RAERR
 | 
|---|
| 17 |  . S RASEG=$G(RAMSG(RALINEX)) Q:$P(RASEG,RAHLFS)="MSH"  ; quit if MSH segment
 | 
|---|
| 18 |  . S RAHDR=$P(RASEG,RAHLFS),RADATA=$P(RASEG,RAHLFS,2,999)
 | 
|---|
| 19 |  . D @$S(RAHDR="PID":"PID",RAHDR="ORC":"ORC",1:"ERR")
 | 
|---|
| 20 |  . Q
 | 
|---|
| 21 |  Q
 | 
|---|
| 22 | PID ; breakdown the 'PID' segment
 | 
|---|
| 23 |  S RAERR=$$EN2^RAO7VLD(2,RAPID3,RAPID5) S:RAERR RAERR=2
 | 
|---|
| 24 |  Q
 | 
|---|
| 25 | ORC ; breakdown the 'ORC' segment
 | 
|---|
| 26 |  S RAERR=$$EN3^RAO7VLD(75.1,+RAORC3) S:RAERR RAERR=22 Q:RAERR
 | 
|---|
| 27 |  S RA0=$G(^RAO(75.1,+RAORC3,0))
 | 
|---|
| 28 |  S RASTATUS=+$P(RA0,U,5)
 | 
|---|
| 29 |  I "358"'[$E(RASTATUS) S RAERR=25 Q
 | 
|---|
| 30 |  S RAORC10=$P(RADATA,RAHLFS,10)
 | 
|---|
| 31 |  S RAERR=$$EN3^RAO7VLD(200,+RAORC10) S:RAERR RAERR=4 Q:RAERR
 | 
|---|
| 32 |  S RAORC16=$P($P(RADATA,RAHLFS,16),"^",4) ;Rad Reason file ien
 | 
|---|
| 33 |  S RAORC161=$P($P(RADATA,RAHLFS,16),"^",5) ; Cancel Description
 | 
|---|
| 34 |  D  Q:RAERR
 | 
|---|
| 35 |  .S RANEW(75.1,+RAORC3_",",23)="@"
 | 
|---|
| 36 |  .I RAORC16']"",(RAORC161']"") Q
 | 
|---|
| 37 |  .I RAORC16]"",'$D(^RA(75.2,+RAORC16,0)),RAORC161']"" S RAERR=23 Q
 | 
|---|
| 38 |  .S RANEW(75.1,+RAORC3_",",10)=RAORC16
 | 
|---|
| 39 |  .S RANEW(75.1,+RAORC3_",",27)=RAORC161
 | 
|---|
| 40 |  S RANEW(75.1,+RAORC3_",",5)=1
 | 
|---|
| 41 |  S RANEW(75.1,+RAORC3_",",18)=RALDT
 | 
|---|
| 42 |  Q
 | 
|---|
| 43 | ERR ; error control - file 'soft' errors with CPRS
 | 
|---|
| 44 |  N RAVAR S RAVAR("XQY0")=""
 | 
|---|
| 45 |  D ERR^RAO7UTL("HL7 message missing 'PID' & 'ORC' segments",.RAMSG,.RAVAR)
 | 
|---|
| 46 |  Q
 | 
|---|