source: WorldVistAEHR/trunk/r/RADIOLOGY_NUCLEAR_MEDICINE-RA/RAUTL6.m@ 1608

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

initial load of WorldVistAEHR

File size: 5.1 KB
Line 
1RAUTL6 ;HISC/GJC-Utility Routine ;2/19/98 10:52
2 ;;5.0;Radiology/Nuclear Medicine;;Mar 16, 1998
3VARACC(DUZ) ; This subroutine will determine the Imaging Location,
4 ; Imaging Type, and the Divisional access for a specific individual.
5 ; Divisional Access as well as Imaging Type Access is derived from
6 ; the Imaging Locs assigned to each Rad/Nuc Med user. If the user
7 ; holds the RA ALLOC key, that user has access to all Imaging Locs.
8 ; This in turn implies that the user has all Divisional and Imaging
9 ; Type access related to each specific Imaging Location.
10 ;
11 Q:'+$G(DUZ) N RADIV,RAIMG,RAINDX,RAKEY,RALOC,RAMGRKEY
12 S RAMGRKEY=0
13 ;
14 ; *** RA ALLOC Key Holder ***
15 ; If a RA ALLOC holder, set up Imaging Loc access from file 200.
16 ; Format: RACCESS(DUZ,"LOC",IEN of 79.1)=.01 of 79.1, IEN of file 44^.01 of 44
17 ;
18 I $D(^XUSEC("RA ALLOC",DUZ)) S RAMGRKEY=1 D
19 . S RAINDX=0
20 . F S RAINDX=$O(^RA(79.1,RAINDX)) Q:RAINDX'>0 D
21 .. S RALOC(0)=$G(^RA(79.1,RAINDX,0)),RALOC(1)=+$P(RALOC(0),U)
22 .. Q:RALOC(1)'>0 S RALOC(44)=$P($G(^SC(RALOC(1),0)),U)
23 .. S RACCESS(DUZ,"LOC",RAINDX)=RALOC(1)_"^"_RALOC(44)
24 .. Q
25 . K RALOC
26 . Q
27 ;
28 ; *** Imaging Location Access ***
29 ; If not a RA ALLOC holder, set up Imaging Loc access from file 200.
30 ; Format: RACCESS(DUZ,"LOC",IEN of 79.1)=.01 of 79.1, IEN of file 44^.01 of 44
31 ;
32 I 'RAMGRKEY,($D(^VA(200,DUZ,"RAL",0))),(+$O(^VA(200,DUZ,"RAL",0))) D
33 . S RAINDX=0
34 . F S RAINDX=$O(^VA(200,DUZ,"RAL",RAINDX)) Q:RAINDX'>0 D
35 .. S RALOC(0)=$G(^VA(200,DUZ,"RAL",RAINDX,0)),RALOC(1)=+$P(RALOC(0),U)
36 .. Q:RALOC(1)'>0 S RALOC(44)=+$P($G(^RA(79.1,RALOC(1),0)),U)
37 .. S RACCESS(DUZ,"LOC",RALOC(1))=RALOC(44)_"^"_$P($G(^SC(RALOC(44),0)),U)
38 .. Q
39 . Q
40 ;
41 ; *** Division Access ***
42 ; Format: RACCESS(DUZ,"DIV",IEN of 79,IEN of 79.1)="DIV";1 of file 79.1, pntr to file 4^.01 of 4
43 ; NOTE: The first piece of the "DIV" node is a pntr to 79 (Rad Div)
44 ; This value is DINUMED with file 4.
45 ;
46 ; Division is found in the Imaging Location file, ^RA(79.1
47 ; it is the first piece of the "DIV" node. RAINDX is the IEN
48 ; of ^RA(79.1
49 I $D(RACCESS(DUZ,"LOC")) D
50 . S RAINDX=0
51 . F S RAINDX=$O(RACCESS(DUZ,"LOC",RAINDX)) Q:RAINDX'>0 D
52 .. S RADIV(0)=$G(^RA(79.1,RAINDX,"DIV")),RADIV(1)=+$P(RADIV(0),U)
53 .. Q:RADIV(1)'>0 S RADIV(2)=+$P($G(^RA(79,RADIV(1),0)),U)
54 .. S RACCESS(DUZ,"DIV",RADIV(1),RAINDX)=RADIV(2)_"^"_$P($G(^DIC(4,RADIV(2),0)),U)
55 .. Q
56 . Q
57 ;
58 ; *** Imaging Type Access ***
59 ; Format: RACCESS(DUZ,"IMG",IEN of 79.2,IEN of 79.1)=^.01 of 79.2
60 ; NOTE: The sixth piece of the "zero" node is a pntr to 79.2 (Img Type)
61 ;
62 ; Imaging Type is found in the Imaging Location file (#79.1)
63 ; it is the sixth piece of the "zero" node. RAINDX is the IEN
64 ; of ^RA(79.1
65 I $D(RACCESS(DUZ,"LOC")) D
66 . S RAINDX=0
67 . F S RAINDX=$O(RACCESS(DUZ,"LOC",RAINDX)) Q:RAINDX'>0 D
68 .. S RAIMG(0)=$G(^RA(79.1,RAINDX,0)),RAIMG(1)=+$P(RAIMG(0),U,6)
69 .. Q:RAIMG(1)'>0 S RAIMG(2)=$P($G(^RA(79.2,RAIMG(1),0)),U)
70 .. S RACCESS(DUZ,"IMG",RAIMG(1),RAINDX)="^"_RAIMG(2)
71 .. Q
72 . Q
73 Q
74DSPDIV ; Display 'Divisional Access' data
75 N X0,X1,Y0,Y1,Y2,Y3 S X0=0,Y3=1
76 I '$D(RACCESS(RADUZ,"DIV")) D Q
77 . W !?5,"Access to Radiology/Nuclear Medicine Divisional data is not "
78 . W "authorized.",$C(7)
79 S Y1="<<< Divisions Included >>>"
80 W !?5,Y1
81 F S X0=$O(RACCESS(RADUZ,"DIV",X0)) Q:X0'>0 D
82 . S X1=$O(RACCESS(RADUZ,"DIV",X0,0)) Q:X1'>0
83 . S Y0=$G(RACCESS(RADUZ,"DIV",X0,X1)) Q:Y0']""
84 . S Y2=$P(Y0,U,2) D PRINT
85 . Q
86 W !
87 Q
88DSPIMG ; Display 'Imaging Type' data
89 N X0,X1,Y0,Y1,Y2,Y3 S X0=0,Y3=1
90 I '$D(RACCESS(RADUZ,"IMG")) D Q
91 . W !?5,"Access to Imaging Type data is not authorized."
92 . W $C(7)
93 S Y1="<<< Imaging Types Included >>>"
94 W !?5,Y1
95 F S X0=$O(RACCESS(RADUZ,"IMG",X0)) Q:X0'>0 D
96 . S X1=0
97 . F S X1=$O(RACCESS(RADUZ,"IMG",X0,X1)) Q:X1'>0 D
98 .. S Y0=$G(RACCESS(RADUZ,"IMG",X0,X1)) Q:Y0']""
99 .. S Y2=$P(Y0,U,2) D PRINT
100 .. Q
101 . Q
102 W !
103 Q
104DSPLOC ; Display 'Imaging Location' data
105 N X0,Y0,Y1,Y2,Y3 S X0=0,Y3=1
106 I '$D(RACCESS(RADUZ,"LOC")) D Q
107 . W !?5,"Access to Imaging Location data is not authorized.",$C(7)
108 S Y1="<<< Locations Included >>>"
109 W !?5,Y1
110 F S X0=$O(RACCESS(RADUZ,"LOC",X0)) Q:X0'>0 D
111 . S Y0=$G(RACCESS(RADUZ,"LOC",X0)) Q:Y0']""
112 . S Y2=$P(Y0,U,2) D PRINT
113 . Q
114 W !
115 Q
116PRINT ; Print out data
117 S Y3='Y3
118 I 'Y3 W !?5,Y2
119 E W ?45,Y2
120 Q
121DIVSION(RADATE,RALIFN) ; Determine the division associated with the Requesting
122 ; Location on a Rad/Nuc Med Order. Use the PIMS utilities in VASITE.
123 ; Returns an institution file ptr value or -1 if the division
124 ; could not be determined.
125 ; Input - RADATE=a valid FileMan date (internal format)
126 ; defaults to DT if passed in null
127 ; RALIFN=Req. Location from Rad/Nuc Med Order.
128 ; Output - RA1DIV=valid pointer the the Institution File, else -1
129 N RA1DIV S:$G(RADATE)="" RADATE=DT
130 ; note: field 3.5 in file 44 is named DIVISION & is a pntr to file 40.8
131 S RA1DIV=+$$SITE^VASITE(RADATE,+$$GET1^DIQ(44,RALIFN,3.5,"I"))
132 ; if $$SITE^VASITE fails, return the medical center division of the
133 ; primary medical center division (this is a ptr to file 40.8)
134 S:RA1DIV=-1 RA1DIV=+$$SITE^VASITE(RADATE,+$$PRIM^VASITE(RADATE))
135 Q RA1DIV
Note: See TracBrowser for help on using the repository browser.