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

RABUL.m

Go to the documentation of this file.
  1. RABUL ;HISC/FPT,GJC AISC/DMK-Generate 'RAD/NUC MED REQUEST CANCELLED' or 'RAD/NUC MED REQUEST HELD' Bulletin ;9/9/94 09:53
  1. ;;5.0;Radiology/Nuclear Medicine;**2,15,75**;Mar 16, 1998;Build 4
  1. ; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1. ; The variables DA and RAOSTS must be defined.
  1. ; The variable DA must be greater than 0, and RAOSTS must
  1. ; equal 1 (cancelled) or 3 (held) for the RAD/NUC MED REQUEST CANCELLED
  1. ; or the RAD/NUC MED REQUEST HELD bulletin to execute.
  1. ; Called from: ^DD(75.1,5,0) fifth piece
  1. ; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1. ; ***** Variable List *****
  1. ; 'RADFN' -> IEN of the patient in the PATIENT file (2)
  1. ; 'RAFN1' -> internal format of a FM date/time data element
  1. ; 'RAFN2' -> FM data definition for RAFN1, used in XTERNAL^RAUTL5
  1. ; 'Z' -> Zero node of the RADIOLOGY/NUCLEAR MEDICINE ORDERS
  1. ; file (75.1)
  1. ; Format: Data to be fired;local var name;XMB array representation
  1. ; Patient ; RANAME ; XMB(1) <---> Req. Physician ; RARPHY ; XMB(5)
  1. ; Patient SSN ; RASSN ; XMB(2) <---> Req. Location ; RARLOC ; XMB(6)
  1. ; Procedure ; RAPNAM ; XMB(3) <---> Reason ; RARCR ; XMB(7)
  1. ; Date Desired ; RADTDS ; XMB(4) <---> Current User ; RAUSER ; XMB(8)
  1. ;
  1. EN(RAX) ; Pass in the request status (RAX)
  1. ; also called during request status edit.
  1. Q:+$G(DA)'>0
  1. Q:+$G(RAOSTS)'=1&(+$G(RAOSTS)'=3)
  1. N RADFN,RADTDS,RAFN1,RAFN2,RASSN,RAUSER,RAXMB,Z
  1. S RAXMB="RAD/NUC MED REQUEST",Z=$G(^RAO(75.1,DA,0))
  1. S (RADFN,RANAME)=+$P(Z,U)
  1. S RANAME=$S($D(^DPT(RANAME,0)):$P(^(0),U),1:"Unknown")
  1. S RASSN=$$SSN^RAUTL(),RAPNAM=+$P(Z,U,2)
  1. S RAPNAM=$S($D(^RAMIS(71,RAPNAM,0)):$P(^(0),U),1:"Unknown")
  1. S RARLOC=+$P(Z,U,22)
  1. S RARLOC=$S($D(^SC(RARLOC,0)):$P(^(0),U),1:"Unknown")
  1. S RAFN1=$P(Z,U,21),RAFN2=$P($G(^DD(75.1,21,0)),U,2)
  1. S RADTDS=$$XTERNAL^RAUTL5(RAFN1,RAFN2)
  1. S:RADTDS']"" RADTDS="Unknown" S RARPHY=+$P(Z,U,14)
  1. S RARPHY=$S($D(^VA(200,RARPHY,0)):$P(^(0),U),1:"Unknown")
  1. S RARCR=+$P(Z,U,10)
  1. S RARCR=$S($D(^RA(75.2,RARCR,0)):$P(^(0),U),1:"Unknown")
  1. S:RARCR="Unknown" RARCR=$S($P(Z,U,27)]"":$P(Z,U,27),1:"Unknown")
  1. S RAUSER=$S($D(^VA(200,DUZ,0)):$P(^(0),U),1:"Unknown")
  1. ; --- P75 define the REASON FOR STUDY ---
  1. S RASTYREA=$P($G(^RAO(75.1,DA,.1)),U)
  1. S:RASTYREA="" RASTYREA="Unknown" ;req'd if missing error
  1. ;
  1. S XMB(1)=RANAME,XMB(2)=RASSN,XMB(3)=RAPNAM,XMB(4)=RASTYREA,XMB(5)=RADTDS
  1. S XMB(6)=RARPHY,XMB(7)=RARLOC,XMB(8)=RARCR,XMB(9)=RAUSER
  1. S XMB=RAXMB_$S(RAX=1:" CANCELLED",1:" HELD")
  1. D ^XMB:$D(^XMB(3.6,"B",XMB))
  1. K RANAME,RAPNAM,RARLOC,RARPHY,RARCR,RASTYREA,XMB,XMB0,XMC0,XMDT,XMM,XMMG
  1. Q
  1. OE3(DA) ; Trigger the Rad/Nuc Med Request Cancelled bulletin when
  1. ; the order is discontinued through CPRS (frontdoor).
  1. ; Input: DA-ien of the Rad/Nuc Med order record
  1. S RAOSTS=$P($G(^RAO(75.1,DA,0)),"^",5)
  1. I RAOSTS'=1 K RAOSTS Q ; status must be discontinued
  1. D EN(RAOSTS) K RAOSTS
  1. Q