RAUTL12 ;HISC/CAH,FPT,GJC-Utility Routine ;12/23/97 09:25
;;5.0;Radiology/Nuclear Medicine;**75**;Mar 16, 1998;Build 4
;
IMGTY(X,Y,Z) ; Determines the Imaging Type
; 'X' -> either 'e', 'l', or 'p'
; 'e' means we determine the Imaging Type from the 'Registered
; Exams' multiple in Rad/Nuc Med Patient file (70)
; 'l' means that we determine the Imaging Type from data in the
; Imaging Locations file (79.1)
; 'p' means that we determine the Imaging Type from data in the
; Rad/Nuc Med Procedures file (71)
;
; 'Y' -> The value of D0 in the above files.
;
; 'Z' -> The value of D1 in the Rad/Nuc Med Patient file (70).
; [ This routine passes back the Imaging Type in the external format ]
N A,B,RAXYZ
I X="e" D
. S A=$G(^RADPT(+$G(Y),"DT",+$G(Z),0)),B=+$P(A,U,2)
. S RAXYZ=$P($G(^RA(79.2,B,0)),U)
. Q
I X="l" D
. S A=$G(^RA(79.1,+$G(Y),0)),B=+$P(A,U,6)
. S RAXYZ=$P($G(^RA(79.2,B,0)),U)
. Q
I X="p" D
. S A=$G(^RAMIS(71,+$G(Y),0)),B=+$P(A,U,12)
. S RAXYZ=$P($G(^RA(79.2,B,0)),U)
. Q
Q RAXYZ
;
LOCK(X,Y) ; Lock the data global
; 'X' is the global root
; 'Y' is the record number
N RALCKFLG,XY
S RADUZ=+$G(DUZ),RALCKFLG=0,XY=X_Y
L +@(XY_")"):5
I '$T S RALCKFLG=1 D
. W !?5,"This record is being edited by another user."
. W !?5,"Try again later!",$C(7)
. Q
E D
. S ^TMP("RAD LOCKS",$J,RADUZ,X,Y)=""
. Q
Q RALCKFLG
;
UNLOCK(X,Y) ; Unlock the data global
N XY S RADUZ=+$G(DUZ),XY=X_Y L -@(XY_")")
K ^TMP("RAD LOCKS",$J,RADUZ,X,Y)
Q
;Output is AMIS Credit Indicator: RABILAT = BILATERAL,
;RAPORT = PORTABLE, and RAOR = OPERATING ROOM.
S RAQI=$P($G(^RAMIS(71.2,RAQI,0)),U,2) S:RAQI="b" RABILAT="" S:RAQI="p" RAPORT="" S:RAQI="o" RAOR=""
Q
;
DESDT(RAPRI) ; Obtain 'Date Desired (NOT appt date)' by DIR call.
; Input: IEN of procedure
; The 'Date Desired' is passed back in internal format.
; 75.1 -> Rad Orders File Fld 21 -> Date desired
N DIR,DIROUT,DIRUT,DUOUT,DTOUT,X,Y
I '$D(RAPKG),($D(ORVP)),($D(ORL)),($D(ORNP)) D PROCMSG^RAUTL5(RAPRI)
F D Q:Y'=""
.S DIR("?",1)="The 'Date Desired' field contains the date for which the rad/nuc med exam"
.S DIR("?",2)="is requested. 'Date Desired' is required and should not be interpreted as"
.S DIR("?")="an appointment date."
.S DIR(0)="75.1,21" D ^DIR
.S:$D(DTOUT)#2!($D(DUOUT)#2) Y=-1
.Q
Q Y
;
PTLOC() ; Current patient location. Used for entry: 'CURRENT PATIENT
; LOCATION' in the Label Print Fields file. (78.7)
; 'X' is the patient's DFN. DFN must be a positive integer.
N %,%H,%I,A,B,C,DFN,VAERR,VAIN,X,Y,Y1,Y2,Y3,Y4,Y5
S Y=$$NOW^XLFDT(),Y1=$P(Y,"."),Y2=$E($P(Y,".",2),1,4)
S Y3=$E(Y1,4,5)_"-"_$E(Y1,6,7)_"-"_(1700+$E(Y1,1,3))
S Y4=$E(Y2,1,2)_":"_$E(Y2,3,4)
S Y5=Y3_"@"_Y4,DFN=+$P($G(^RADPT(+$G(RADFN),0)),"^")
Q:'+$G(DFN) "OP Unknown/"_Y5
D INP^VADPT ; If currently an inpatient, grab the ward.
I $P($G(VAIN(4)),"^",2)]"" D Q Y
. S Y=$E($P($G(VAIN(4)),"^",2),1,15)_"/"_Y5
. Q
; If not currently an inpatient, check if last recorded patient location
; is a ward. If it is a ward or operating room, pass back 'OP Unknown'.
; We do not have the benefit of PIMS updating our Rad/Nuc Med files.
S X=+$P($G(^RADPT(+$G(RADFN),"DT",+$G(RADTI),"P",+$G(RACNI),0)),"^",11)
S A=+$P($G(^RAO(75.1,X,0)),"^",22),B=$G(^SC(A,0)),C=$P(B,"^",3)
Q:B']""!("WOR"[C) "OP Unknown/"_Y5
Q $P(B,"^")_" (Req'g Loc)"
;
IMG() ; Select one/many/all imaging types. This code will be used for ALL
; the options under the Procedure File Listings option as exported by
; Rad/Nuc Med version 5. I-Types are not screened.
; Passes back '1' if I-Type(s) are selected, '0' if nothing selected.
N RADIC,RAQUIT,RAUTIL,X,Y
S RADIC="^RA(79.2,",RADIC(0)="QEAMZ"
S RADIC("A")="Select Imaging Type: ",RADIC("B")="All"
S RAUTIL="RA I-TYPE" W !! D EN1^RASELCT(.RADIC,RAUTIL)
Q $S($D(^TMP($J,"RA I-TYPE"))\10:1,1:0)
;
LOC(RAX) ; Select one/many/all imaging locations. L-Types are not
; screened. Passes back '1' if L-Type(s) are selected, '0' if nothing
; selected. Used for the option: 'Location Parameter List' (4^RASYS)
N RADIC,RAQUIT,RAUTIL,X,Y
S RADIC="^RA(79.1,",RADIC(0)="QEFAMZ"
S RADIC("A")="Select Imaging Location: ",RADIC("B")="All"
S:'RAX RADIC("S")="N RADT S RADT=$P(^(0),""^"",19) I $S('RADT:1,RADT>DT:1,1:0)"
S RAUTIL="RA L-TYPE" W !! D EN1^RASELCT(.RADIC,RAUTIL)
Q $S($D(^TMP($J,"RA L-TYPE"))\10:1,1:0)
RAUTL12 ;HISC/CAH,FPT,GJC-Utility Routine ;12/23/97 09:25
+1 ;;5.0;Radiology/Nuclear Medicine;**75**;Mar 16, 1998;Build 4
+2 ;
IMGTY(X,Y,Z) ; Determines the Imaging Type
+1 ; 'X' -> either 'e', 'l', or 'p'
+2 ; 'e' means we determine the Imaging Type from the 'Registered
+3 ; Exams' multiple in Rad/Nuc Med Patient file (70)
+4 ; 'l' means that we determine the Imaging Type from data in the
+5 ; Imaging Locations file (79.1)
+6 ; 'p' means that we determine the Imaging Type from data in the
+7 ; Rad/Nuc Med Procedures file (71)
+8 ;
+9 ; 'Y' -> The value of D0 in the above files.
+10 ;
+11 ; 'Z' -> The value of D1 in the Rad/Nuc Med Patient file (70).
+12 ; [ This routine passes back the Imaging Type in the external format ]
+13 NEW A,B,RAXYZ
+14 IF X="e"
Begin DoDot:1
+15 SET A=$GET(^RADPT(+$GET(Y),"DT",+$GET(Z),0))
SET B=+$PIECE(A,U,2)
+16 SET RAXYZ=$PIECE($GET(^RA(79.2,B,0)),U)
+17 QUIT
End DoDot:1
+18 IF X="l"
Begin DoDot:1
+19 SET A=$GET(^RA(79.1,+$GET(Y),0))
SET B=+$PIECE(A,U,6)
+20 SET RAXYZ=$PIECE($GET(^RA(79.2,B,0)),U)
+21 QUIT
End DoDot:1
+22 IF X="p"
Begin DoDot:1
+23 SET A=$GET(^RAMIS(71,+$GET(Y),0))
SET B=+$PIECE(A,U,12)
+24 SET RAXYZ=$PIECE($GET(^RA(79.2,B,0)),U)
+25 QUIT
End DoDot:1
+26 QUIT RAXYZ
+27 ;
LOCK(X,Y) ; Lock the data global
+1 ; 'X' is the global root
+2 ; 'Y' is the record number
+3 NEW RALCKFLG,XY
+4 SET RADUZ=+$GET(DUZ)
SET RALCKFLG=0
SET XY=X_Y
+5 LOCK +@(XY_")"):5
+6 IF '$TEST
SET RALCKFLG=1
Begin DoDot:1
+7 WRITE !?5,"This record is being edited by another user."
+8 WRITE !?5,"Try again later!",$CHAR(7)
+9 QUIT
End DoDot:1
+10 IF '$TEST
Begin DoDot:1
+11 SET ^TMP("RAD LOCKS",$JOB,RADUZ,X,Y)=""
+12 QUIT
End DoDot:1
+13 QUIT RALCKFLG
+14 ;
UNLOCK(X,Y) ; Unlock the data global
+1 NEW XY
SET RADUZ=+$GET(DUZ)
SET XY=X_Y
LOCK -@(XY_")")
+2 KILL ^TMP("RAD LOCKS",$JOB,RADUZ,X,Y)
+3 QUIT
+1 ;Output is AMIS Credit Indicator: RABILAT = BILATERAL,
+2 ;RAPORT = PORTABLE, and RAOR = OPERATING ROOM.
+3 SET RAQI=$PIECE($GET(^RAMIS(71.2,RAQI,0)),U,2)
IF RAQI="b"
SET RABILAT=""
IF RAQI="p"
SET RAPORT=""
IF RAQI="o"
SET RAOR=""
+4 QUIT
+5 ;
DESDT(RAPRI) ; Obtain 'Date Desired (NOT appt date)' by DIR call.
+1 ; Input: IEN of procedure
+2 ; The 'Date Desired' is passed back in internal format.
+3 ; 75.1 -> Rad Orders File Fld 21 -> Date desired
+4 NEW DIR,DIROUT,DIRUT,DUOUT,DTOUT,X,Y
+5 IF '$DATA(RAPKG)
IF ($DATA(ORVP))
IF ($DATA(ORL))
IF ($DATA(ORNP))
DO PROCMSG^RAUTL5(RAPRI)
+6 FOR
Begin DoDot:1
+7 SET DIR("?",1)="The 'Date Desired' field contains the date for which the rad/nuc med exam"
+8 SET DIR("?",2)="is requested. 'Date Desired' is required and should not be interpreted as"
+9 SET DIR("?")="an appointment date."
+10 SET DIR(0)="75.1,21"
DO ^DIR
+11 IF $DATA(DTOUT)#2!($DATA(DUOUT)#2)
SET Y=-1
+12 QUIT
End DoDot:1
IF Y'=""
QUIT
+13 QUIT Y
+14 ;
PTLOC() ; Current patient location. Used for entry: 'CURRENT PATIENT
+1 ; LOCATION' in the Label Print Fields file. (78.7)
+2 ; 'X' is the patient's DFN. DFN must be a positive integer.
+3 NEW %,%H,%I,A,B,C,DFN,VAERR,VAIN,X,Y,Y1,Y2,Y3,Y4,Y5
+4 SET Y=$$NOW^XLFDT()
SET Y1=$PIECE(Y,".")
SET Y2=$EXTRACT($PIECE(Y,".",2),1,4)
+5 SET Y3=$EXTRACT(Y1,4,5)_"-"_$EXTRACT(Y1,6,7)_"-"_(1700+$EXTRACT(Y1,1,3))
+6 SET Y4=$EXTRACT(Y2,1,2)_":"_$EXTRACT(Y2,3,4)
+7 SET Y5=Y3_"@"_Y4
SET DFN=+$PIECE($GET(^RADPT(+$GET(RADFN),0)),"^")
+8 IF '+$GET(DFN)
QUIT "OP Unknown/"_Y5
+9 ; If currently an inpatient, grab the ward.
DO INP^VADPT
+10 IF $PIECE($GET(VAIN(4)),"^",2)]""
Begin DoDot:1
+11 SET Y=$EXTRACT($PIECE($GET(VAIN(4)),"^",2),1,15)_"/"_Y5
+12 QUIT
End DoDot:1
QUIT Y
+13 ; If not currently an inpatient, check if last recorded patient location
+14 ; is a ward. If it is a ward or operating room, pass back 'OP Unknown'.
+15 ; We do not have the benefit of PIMS updating our Rad/Nuc Med files.
+16 SET X=+$PIECE($GET(^RADPT(+$GET(RADFN),"DT",+$GET(RADTI),"P",+$GET(RACNI),0)),"^",11)
+17 SET A=+$PIECE($GET(^RAO(75.1,X,0)),"^",22)
SET B=$GET(^SC(A,0))
SET C=$PIECE(B,"^",3)
+18 IF B']""!("WOR"[C)
QUIT "OP Unknown/"_Y5
+19 QUIT $PIECE(B,"^")_" (Req'g Loc)"
+20 ;
IMG() ; Select one/many/all imaging types. This code will be used for ALL
+1 ; the options under the Procedure File Listings option as exported by
+2 ; Rad/Nuc Med version 5. I-Types are not screened.
+3 ; Passes back '1' if I-Type(s) are selected, '0' if nothing selected.
+4 NEW RADIC,RAQUIT,RAUTIL,X,Y
+5 SET RADIC="^RA(79.2,"
SET RADIC(0)="QEAMZ"
+6 SET RADIC("A")="Select Imaging Type: "
SET RADIC("B")="All"
+7 SET RAUTIL="RA I-TYPE"
WRITE !!
DO EN1^RASELCT(.RADIC,RAUTIL)
+8 QUIT $SELECT($DATA(^TMP($JOB,"RA I-TYPE"))\10:1,1:0)
+9 ;
LOC(RAX) ; Select one/many/all imaging locations. L-Types are not
+1 ; screened. Passes back '1' if L-Type(s) are selected, '0' if nothing
+2 ; selected. Used for the option: 'Location Parameter List' (4^RASYS)
+3 NEW RADIC,RAQUIT,RAUTIL,X,Y
+4 SET RADIC="^RA(79.1,"
SET RADIC(0)="QEFAMZ"
+5 SET RADIC("A")="Select Imaging Location: "
SET RADIC("B")="All"
+6 IF 'RAX
SET RADIC("S")="N RADT S RADT=$P(^(0),""^"",19) I $S('RADT:1,RADT>DT:1,1:0)"
+7 SET RAUTIL="RA L-TYPE"
WRITE !!
DO EN1^RASELCT(.RADIC,RAUTIL)
+8 QUIT $SELECT($DATA(^TMP($JOB,"RA L-TYPE"))\10:1,1:0)