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

RAUTL6.m

Go to the documentation of this file.
  1. RAUTL6 ;HISC/GJC-Utility Routine ;2/19/98 10:52
  1. ;;5.0;Radiology/Nuclear Medicine;;Mar 16, 1998
  1. VARACC(DUZ) ; This subroutine will determine the Imaging Location,
  1. ; Imaging Type, and the Divisional access for a specific individual.
  1. ; Divisional Access as well as Imaging Type Access is derived from
  1. ; the Imaging Locs assigned to each Rad/Nuc Med user. If the user
  1. ; holds the RA ALLOC key, that user has access to all Imaging Locs.
  1. ; This in turn implies that the user has all Divisional and Imaging
  1. ; Type access related to each specific Imaging Location.
  1. ;
  1. Q:'+$G(DUZ) N RADIV,RAIMG,RAINDX,RAKEY,RALOC,RAMGRKEY
  1. S RAMGRKEY=0
  1. ;
  1. ; *** RA ALLOC Key Holder ***
  1. ; If a RA ALLOC holder, set up Imaging Loc access from file 200.
  1. ; Format: RACCESS(DUZ,"LOC",IEN of 79.1)=.01 of 79.1, IEN of file 44^.01 of 44
  1. ;
  1. I $D(^XUSEC("RA ALLOC",DUZ)) S RAMGRKEY=1 D
  1. . S RAINDX=0
  1. . F S RAINDX=$O(^RA(79.1,RAINDX)) Q:RAINDX'>0 D
  1. .. S RALOC(0)=$G(^RA(79.1,RAINDX,0)),RALOC(1)=+$P(RALOC(0),U)
  1. .. Q:RALOC(1)'>0 S RALOC(44)=$P($G(^SC(RALOC(1),0)),U)
  1. .. S RACCESS(DUZ,"LOC",RAINDX)=RALOC(1)_"^"_RALOC(44)
  1. .. Q
  1. . K RALOC
  1. . Q
  1. ;
  1. ; *** Imaging Location Access ***
  1. ; If not a RA ALLOC holder, set up Imaging Loc access from file 200.
  1. ; Format: RACCESS(DUZ,"LOC",IEN of 79.1)=.01 of 79.1, IEN of file 44^.01 of 44
  1. ;
  1. I 'RAMGRKEY,($D(^VA(200,DUZ,"RAL",0))),(+$O(^VA(200,DUZ,"RAL",0))) D
  1. . S RAINDX=0
  1. . F S RAINDX=$O(^VA(200,DUZ,"RAL",RAINDX)) Q:RAINDX'>0 D
  1. .. S RALOC(0)=$G(^VA(200,DUZ,"RAL",RAINDX,0)),RALOC(1)=+$P(RALOC(0),U)
  1. .. Q:RALOC(1)'>0 S RALOC(44)=+$P($G(^RA(79.1,RALOC(1),0)),U)
  1. .. S RACCESS(DUZ,"LOC",RALOC(1))=RALOC(44)_"^"_$P($G(^SC(RALOC(44),0)),U)
  1. .. Q
  1. . Q
  1. ;
  1. ; *** Division Access ***
  1. ; Format: RACCESS(DUZ,"DIV",IEN of 79,IEN of 79.1)="DIV";1 of file 79.1, pntr to file 4^.01 of 4
  1. ; NOTE: The first piece of the "DIV" node is a pntr to 79 (Rad Div)
  1. ; This value is DINUMED with file 4.
  1. ;
  1. ; Division is found in the Imaging Location file, ^RA(79.1
  1. ; it is the first piece of the "DIV" node. RAINDX is the IEN
  1. ; of ^RA(79.1
  1. I $D(RACCESS(DUZ,"LOC")) D
  1. . S RAINDX=0
  1. . F S RAINDX=$O(RACCESS(DUZ,"LOC",RAINDX)) Q:RAINDX'>0 D
  1. .. S RADIV(0)=$G(^RA(79.1,RAINDX,"DIV")),RADIV(1)=+$P(RADIV(0),U)
  1. .. Q:RADIV(1)'>0 S RADIV(2)=+$P($G(^RA(79,RADIV(1),0)),U)
  1. .. S RACCESS(DUZ,"DIV",RADIV(1),RAINDX)=RADIV(2)_"^"_$P($G(^DIC(4,RADIV(2),0)),U)
  1. .. Q
  1. . Q
  1. ;
  1. ; *** Imaging Type Access ***
  1. ; Format: RACCESS(DUZ,"IMG",IEN of 79.2,IEN of 79.1)=^.01 of 79.2
  1. ; NOTE: The sixth piece of the "zero" node is a pntr to 79.2 (Img Type)
  1. ;
  1. ; Imaging Type is found in the Imaging Location file (#79.1)
  1. ; it is the sixth piece of the "zero" node. RAINDX is the IEN
  1. ; of ^RA(79.1
  1. I $D(RACCESS(DUZ,"LOC")) D
  1. . S RAINDX=0
  1. . F S RAINDX=$O(RACCESS(DUZ,"LOC",RAINDX)) Q:RAINDX'>0 D
  1. .. S RAIMG(0)=$G(^RA(79.1,RAINDX,0)),RAIMG(1)=+$P(RAIMG(0),U,6)
  1. .. Q:RAIMG(1)'>0 S RAIMG(2)=$P($G(^RA(79.2,RAIMG(1),0)),U)
  1. .. S RACCESS(DUZ,"IMG",RAIMG(1),RAINDX)="^"_RAIMG(2)
  1. .. Q
  1. . Q
  1. Q
  1. DSPDIV ; Display 'Divisional Access' data
  1. N X0,X1,Y0,Y1,Y2,Y3 S X0=0,Y3=1
  1. I '$D(RACCESS(RADUZ,"DIV")) D Q
  1. . W !?5,"Access to Radiology/Nuclear Medicine Divisional data is not "
  1. . W "authorized.",$C(7)
  1. S Y1="<<< Divisions Included >>>"
  1. W !?5,Y1
  1. F S X0=$O(RACCESS(RADUZ,"DIV",X0)) Q:X0'>0 D
  1. . S X1=$O(RACCESS(RADUZ,"DIV",X0,0)) Q:X1'>0
  1. . S Y0=$G(RACCESS(RADUZ,"DIV",X0,X1)) Q:Y0']""
  1. . S Y2=$P(Y0,U,2) D PRINT
  1. . Q
  1. W !
  1. Q
  1. DSPIMG ; Display 'Imaging Type' data
  1. N X0,X1,Y0,Y1,Y2,Y3 S X0=0,Y3=1
  1. I '$D(RACCESS(RADUZ,"IMG")) D Q
  1. . W !?5,"Access to Imaging Type data is not authorized."
  1. . W $C(7)
  1. S Y1="<<< Imaging Types Included >>>"
  1. W !?5,Y1
  1. F S X0=$O(RACCESS(RADUZ,"IMG",X0)) Q:X0'>0 D
  1. . S X1=0
  1. . F S X1=$O(RACCESS(RADUZ,"IMG",X0,X1)) Q:X1'>0 D
  1. .. S Y0=$G(RACCESS(RADUZ,"IMG",X0,X1)) Q:Y0']""
  1. .. S Y2=$P(Y0,U,2) D PRINT
  1. .. Q
  1. . Q
  1. W !
  1. Q
  1. DSPLOC ; Display 'Imaging Location' data
  1. N X0,Y0,Y1,Y2,Y3 S X0=0,Y3=1
  1. I '$D(RACCESS(RADUZ,"LOC")) D Q
  1. . W !?5,"Access to Imaging Location data is not authorized.",$C(7)
  1. S Y1="<<< Locations Included >>>"
  1. W !?5,Y1
  1. F S X0=$O(RACCESS(RADUZ,"LOC",X0)) Q:X0'>0 D
  1. . S Y0=$G(RACCESS(RADUZ,"LOC",X0)) Q:Y0']""
  1. . S Y2=$P(Y0,U,2) D PRINT
  1. . Q
  1. W !
  1. Q
  1. PRINT ; Print out data
  1. S Y3='Y3
  1. I 'Y3 W !?5,Y2
  1. E W ?45,Y2
  1. Q
  1. DIVSION(RADATE,RALIFN) ; Determine the division associated with the Requesting
  1. ; Location on a Rad/Nuc Med Order. Use the PIMS utilities in VASITE.
  1. ; Returns an institution file ptr value or -1 if the division
  1. ; could not be determined.
  1. ; Input - RADATE=a valid FileMan date (internal format)
  1. ; defaults to DT if passed in null
  1. ; RALIFN=Req. Location from Rad/Nuc Med Order.
  1. ; Output - RA1DIV=valid pointer the the Institution File, else -1
  1. N RA1DIV S:$G(RADATE)="" RADATE=DT
  1. ; note: field 3.5 in file 44 is named DIVISION & is a pntr to file 40.8
  1. S RA1DIV=+$$SITE^VASITE(RADATE,+$$GET1^DIQ(44,RALIFN,3.5,"I"))
  1. ; if $$SITE^VASITE fails, return the medical center division of the
  1. ; primary medical center division (this is a ptr to file 40.8)
  1. S:RA1DIV=-1 RA1DIV=+$$SITE^VASITE(RADATE,+$$PRIM^VASITE(RADATE))
  1. Q RA1DIV