source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RABUL.m@ 841

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

initial load of WorldVistAEHR

File size: 2.8 KB
Line 
1RABUL ;HISC/FPT,GJC AISC/DMK-Generate 'RAD/NUC MED REQUEST CANCELLED' or 'RAD/NUC MED REQUEST HELD' Bulletin ;9/9/94 09:53
2 ;;5.0;Radiology/Nuclear Medicine;**2,15,75**;Mar 16, 1998;Build 4
3 ; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 ; The variables DA and RAOSTS must be defined.
5 ; The variable DA must be greater than 0, and RAOSTS must
6 ; equal 1 (cancelled) or 3 (held) for the RAD/NUC MED REQUEST CANCELLED
7 ; or the RAD/NUC MED REQUEST HELD bulletin to execute.
8 ; Called from: ^DD(75.1,5,0) fifth piece
9 ; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10 ; ***** Variable List *****
11 ; 'RADFN' -> IEN of the patient in the PATIENT file (2)
12 ; 'RAFN1' -> internal format of a FM date/time data element
13 ; 'RAFN2' -> FM data definition for RAFN1, used in XTERNAL^RAUTL5
14 ; 'Z' -> Zero node of the RADIOLOGY/NUCLEAR MEDICINE ORDERS
15 ; file (75.1)
16 ; Format: Data to be fired;local var name;XMB array representation
17 ; Patient ; RANAME ; XMB(1) <---> Req. Physician ; RARPHY ; XMB(5)
18 ; Patient SSN ; RASSN ; XMB(2) <---> Req. Location ; RARLOC ; XMB(6)
19 ; Procedure ; RAPNAM ; XMB(3) <---> Reason ; RARCR ; XMB(7)
20 ; Date Desired ; RADTDS ; XMB(4) <---> Current User ; RAUSER ; XMB(8)
21 ;
22EN(RAX) ; Pass in the request status (RAX)
23 ; also called during request status edit.
24 Q:+$G(DA)'>0
25 Q:+$G(RAOSTS)'=1&(+$G(RAOSTS)'=3)
26 N RADFN,RADTDS,RAFN1,RAFN2,RASSN,RAUSER,RAXMB,Z
27 S RAXMB="RAD/NUC MED REQUEST",Z=$G(^RAO(75.1,DA,0))
28 S (RADFN,RANAME)=+$P(Z,U)
29 S RANAME=$S($D(^DPT(RANAME,0)):$P(^(0),U),1:"Unknown")
30 S RASSN=$$SSN^RAUTL(),RAPNAM=+$P(Z,U,2)
31 S RAPNAM=$S($D(^RAMIS(71,RAPNAM,0)):$P(^(0),U),1:"Unknown")
32 S RARLOC=+$P(Z,U,22)
33 S RARLOC=$S($D(^SC(RARLOC,0)):$P(^(0),U),1:"Unknown")
34 S RAFN1=$P(Z,U,21),RAFN2=$P($G(^DD(75.1,21,0)),U,2)
35 S RADTDS=$$XTERNAL^RAUTL5(RAFN1,RAFN2)
36 S:RADTDS']"" RADTDS="Unknown" S RARPHY=+$P(Z,U,14)
37 S RARPHY=$S($D(^VA(200,RARPHY,0)):$P(^(0),U),1:"Unknown")
38 S RARCR=+$P(Z,U,10)
39 S RARCR=$S($D(^RA(75.2,RARCR,0)):$P(^(0),U),1:"Unknown")
40 S:RARCR="Unknown" RARCR=$S($P(Z,U,27)]"":$P(Z,U,27),1:"Unknown")
41 S RAUSER=$S($D(^VA(200,DUZ,0)):$P(^(0),U),1:"Unknown")
42 ; --- P75 define the REASON FOR STUDY ---
43 S RASTYREA=$P($G(^RAO(75.1,DA,.1)),U)
44 S:RASTYREA="" RASTYREA="Unknown" ;req'd if missing error
45 ;
46 S XMB(1)=RANAME,XMB(2)=RASSN,XMB(3)=RAPNAM,XMB(4)=RASTYREA,XMB(5)=RADTDS
47 S XMB(6)=RARPHY,XMB(7)=RARLOC,XMB(8)=RARCR,XMB(9)=RAUSER
48 S XMB=RAXMB_$S(RAX=1:" CANCELLED",1:" HELD")
49 D ^XMB:$D(^XMB(3.6,"B",XMB))
50 K RANAME,RAPNAM,RARLOC,RARPHY,RARCR,RASTYREA,XMB,XMB0,XMC0,XMDT,XMM,XMMG
51 Q
52OE3(DA) ; Trigger the Rad/Nuc Med Request Cancelled bulletin when
53 ; the order is discontinued through CPRS (frontdoor).
54 ; Input: DA-ien of the Rad/Nuc Med order record
55 S RAOSTS=$P($G(^RAO(75.1,DA,0)),"^",5)
56 I RAOSTS'=1 K RAOSTS Q ; status must be discontinued
57 D EN(RAOSTS) K RAOSTS
58 Q
Note: See TracBrowser for help on using the repository browser.