Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: RAO7OKR

RAO7OKR.m

Go to the documentation of this file.
  1. RAO7OKR ;HISC/GJC-Receive OE/RR accept/reject msg (backdoor) ;1/5/95 08:54
  1. ;;5.0;Radiology/Nuclear Medicine;;Mar 16, 1998
  1. ;
  1. ;------------------------- Variable List -------------------------------
  1. ; RAECH="^~\&" RAECH(1)="^"
  1. ; RAECH(2)="~" RAECH(3)="\"
  1. ; RAECH(4)="&" RAHLFS="|"
  1. ; RAHLFS(0)=50 "|"'s RAERR='0' if msg ok, else '1'
  1. ; RASEG=each node of the message RADATA=node minus the seg. header
  1. ; RAPID3=Pat. Id (IEN in ^DPT) RAPID5=Pat. name (.01 fld of ^DPT)
  1. ; RAORC1=order control RAORC2=placer order # OE/RR (100)
  1. ; RAORC3=filler order # RAD (75.1) RAORC16=order control reason
  1. ; ----------------------------------------------------------------------
  1. EN1(RAMSG) ; Pass in the message from OE/RR. Decipher information.
  1. N RADATA,RAECH,RAORC1,RAORC2,RAORC3,RAORC16,RAPID3,RAPID5
  1. N RAHLFS,RASEG,X S (RAERR,X)=0
  1. D EN1^RAO7UTL ; setup field seperator data (see var list)
  1. F S X=$O(RAMSG(X)) Q:X'>0 D
  1. . S RASEG=$G(RAMSG(X)) Q:$P(RASEG,RAHLFS)="MSH" ; quit if MSH segment
  1. . S RADATA=$P(RASEG,RAHLFS,2,999)
  1. . D @$S($P(RASEG,RAHLFS)="PID":"PID",1:"ORC")
  1. . Q
  1. ; validate data
  1. S RAERR=$$EN3^RAO7VLD(75.1,RAORC3) S:RAERR RAERR=22 Q:RAERR
  1. ; *** quit on non-match of either the patient ien or patient name ***
  1. S RAERR=$$EN2^RAO7VLD(2,RAPID3,RAPID5) S:RAERR RAERR=2 Q:RAERR
  1. ; ***** set flag to '1' if the data was not filed properly *****
  1. S RAERR=$$FILE(RAORC2,RAORC3) S:RAERR RAERR=26
  1. Q
  1. FILE(RAX,RAY) ; File data into 75.1 using FM21 DBS
  1. ; 'RAX' is placer order # (OE/RR), 'RAY' is filler order # (Rad)
  1. ; returns '0' for proper filing, '1' when an error is encountered
  1. N RADBS,RAFDA
  1. ; setup FDA_ROOT for DBS call i.e, RAFDA(file # , ien_"," , fld #)=value
  1. S RAFDA(75.1,RAY_",",7)=RAX
  1. D FILE^DIE("K","RAFDA","RADBS(""ERROR"")")
  1. Q $S($D(RADBS("ERROR","DIERR"))#2:1,1:RAERR)
  1. PID ; breakdown the 'PID' segment
  1. S RAPID3=$P(RADATA,RAHLFS,3),RAPID5=$P(RADATA,RAHLFS,5)
  1. Q
  1. ORC ; breakdown the 'ORC' segment
  1. ; RAORC1 will either be 'NA' number assigned, or 'DE' data errors
  1. S RAORC1=$P(RADATA,RAHLFS),RAORC2=+$P(RADATA,RAHLFS,2)
  1. S RAORC3=+$P(RADATA,RAHLFS,3),RAORC16=$P(RADATA,RAHLFS,16)
  1. Q