PSIVLTR ;BIR/PR-BUILD LABEL TRACKER FOR ACTIVITY LOG ; 15 May 98 / 9:27 AM
;;5.0; INPATIENT MEDICATIONS ;**3**;16 DEC 97
;This routine needs the following parameters:
;TRACK - only defined if label action is dispensed or suspended
; 1=Ind lbs, 2=Sched lbs, 3= Sus lbs, 4= Order act lab
;ACTION - What is being done with the labels
;1=Dispensed, 2=Recycled, 3=Destroyed, 4=Cancelled, 5=Suspended
;PSIVNOL- number of labels being acted on
;DFN - Patient
;ON - Order number
;L +^PS(55,DFN,"IV",0)
S:'$D(^PS(55,DFN,"IV",+ON,"LAB",0)) ^(0)="^55.1111^^" S N=^(0)
F DA=$P(N,U,3)+1 I '$D(^PS(55,DFN,"IV",+ON,"LAB",DA)) S $P(N,U,3)=DA,$P(N,U,4)=$P(N,U,4)+1,^PS(55,DFN,"IV",+ON,"LAB",0)=N Q
D NOW^%DTC D @ACTION G K
;
1 ;Dispensed
S J=DA_U_%_U_ACTION_U_DUZ_U_PSIVNOL_U_TRACK_U_$S('$D(PSIVCT):1,1:0),^PS(55,DFN,"IV",+ON,"LAB",DA,0)=J
Q
;
2 ;Recycled
S J=DA_U_%_U_ACTION_U_DUZ_U_PSIVNOL D ERROR S ^PS(55,DFN,"IV",+ON,"LAB",DA,0)=J
Q
3 ;Destroyed
S J=DA_U_%_U_ACTION_U_DUZ_U_PSIVNOL D ERROR S ^PS(55,DFN,"IV",+ON,"LAB",DA,0)=J
Q
4 ;Cancelled
S J=DA_U_%_U_ACTION_U_DUZ_U_PSIVNOL D ERROR S ^PS(55,DFN,"IV",+ON,"LAB",DA,0)=J
Q
5 ;Suspended
S J=DA_U_%_U_ACTION_U_DUZ_U_PSIVNOL_U_TRACK,^PS(55,DFN,"IV",+ON,"LAB",DA,0)=J
Q
ERROR ;Set piece 8 if user is in the wrong IV room.
I $D(E)&($D(E1)) S $P(J,U,8)=E1_" "_E
Q
K ;
;L -^PS(55,DFN,"IV",0) K DA,J,%,N,TRACK,ACTION
K DA,J,%,N,TRACK,ACTION
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSIVLTR 1448 printed Oct 16, 2024@18:05:09 Page 2
PSIVLTR ;BIR/PR-BUILD LABEL TRACKER FOR ACTIVITY LOG ; 15 May 98 / 9:27 AM
+1 ;;5.0; INPATIENT MEDICATIONS ;**3**;16 DEC 97
+2 ;This routine needs the following parameters:
+3 ;TRACK - only defined if label action is dispensed or suspended
+4 ; 1=Ind lbs, 2=Sched lbs, 3= Sus lbs, 4= Order act lab
+5 ;ACTION - What is being done with the labels
+6 ;1=Dispensed, 2=Recycled, 3=Destroyed, 4=Cancelled, 5=Suspended
+7 ;PSIVNOL- number of labels being acted on
+8 ;DFN - Patient
+9 ;ON - Order number
+10 ;L +^PS(55,DFN,"IV",0)
+11 if '$DATA(^PS(55,DFN,"IV",+ON,"LAB",0))
SET ^(0)="^55.1111^^"
SET N=^(0)
+12 FOR DA=$PIECE(N,U,3)+1
IF '$DATA(^PS(55,DFN,"IV",+ON,"LAB",DA))
SET $PIECE(N,U,3)=DA
SET $PIECE(N,U,4)=$PIECE(N,U,4)+1
SET ^PS(55,DFN,"IV",+ON,"LAB",0)=N
QUIT
+13 DO NOW^%DTC
DO @ACTION
GOTO K
+14 ;
1 ;Dispensed
+1 SET J=DA_U_%_U_ACTION_U_DUZ_U_PSIVNOL_U_TRACK_U_$SELECT('$DATA(PSIVCT):1,1:0)
SET ^PS(55,DFN,"IV",+ON,"LAB",DA,0)=J
+2 QUIT
+3 ;
2 ;Recycled
+1 SET J=DA_U_%_U_ACTION_U_DUZ_U_PSIVNOL
DO ERROR
SET ^PS(55,DFN,"IV",+ON,"LAB",DA,0)=J
+2 QUIT
3 ;Destroyed
+1 SET J=DA_U_%_U_ACTION_U_DUZ_U_PSIVNOL
DO ERROR
SET ^PS(55,DFN,"IV",+ON,"LAB",DA,0)=J
+2 QUIT
4 ;Cancelled
+1 SET J=DA_U_%_U_ACTION_U_DUZ_U_PSIVNOL
DO ERROR
SET ^PS(55,DFN,"IV",+ON,"LAB",DA,0)=J
+2 QUIT
5 ;Suspended
+1 SET J=DA_U_%_U_ACTION_U_DUZ_U_PSIVNOL_U_TRACK
SET ^PS(55,DFN,"IV",+ON,"LAB",DA,0)=J
+2 QUIT
ERROR ;Set piece 8 if user is in the wrong IV room.
+1 IF $DATA(E)&($DATA(E1))
SET $PIECE(J,U,8)=E1_" "_E
+2 QUIT
K ;
+1 ;L -^PS(55,DFN,"IV",0) K DA,J,%,N,TRACK,ACTION
+2 KILL DA,J,%,N,TRACK,ACTION
+3 QUIT