- VPSRLBLS ;DALOIFO/GT,SLOIFO/BT - PATIENT LABELS RPC;07/15/14 15:30
- ;;1.0;VA POINT OF SERVICE (KIOSKS);**4**;Jul 15,2014;Build 27
- ;;Per VHA Directive 2004-038, this routine should not be modified.
- ;
- ; External Reference DBIA#
- ; ------------------------
- ; #10035 - ^DPT( references (Supported)
- ; #2119 - OPEN^%ZISUTL, USE^%ZISUTL, CLOSE^%ZISUTL (Supported)
- ; #5904 - START^DGPLBL call (Private)
- ;
- QUIT
- ;
- PRINT(VPSRSLT,VPSTYP,VPSNUM,VPSLOC,VPSLBCNT,VPSLPL,VPSIO) ;VPS PRINT PATIENT LABEL
- ;This RPC provide a patient demographics label that includes Patient Name,SSN,
- ;DOB and an optional inpatient location (ward and bed).
- ;INPUT
- ; VPSTYP Patients ID Type - SSN or DFN OR ICN OR VIC/CAC (REQUIRED)
- ; VPSNUM Parameter Value - patient SSN OR DFN OR ICN OR VIC/CAC (REQUIRED)
- ; VPSLOC include location flag (0 or 1)
- ; VPSLBCNT label count from 1 to 250
- ; VPSLPL lines per label can contain (6-25)
- ; VPSIO output device name
- ;OUTPUT
- ; VPSRSLT 0 (Successful)
- ; -1^Failure Message
- ;
- ; -- Get DFN based on Patienr ID Type and Value pair
- S VPSRSLT=$$GETDFN^VPSPRINT($G(VPSTYP),$G(VPSNUM))
- QUIT:+VPSRSLT=-1 VPSRSLT
- N VPSDFN S VPSDFN=VPSRSLT
- ;
- ; -- Check Input parameters
- S VPSRSLT=$$VALIDATE(VPSDFN,$G(VPSLOC),$G(VPSLBCNT),$G(VPSLPL),$G(VPSIO))
- QUIT:+VPSRSLT=-1
- ;
- ; -- Setup handle for output device and open the device.
- D OPEN^%ZISUTL("PATIENTLABEL",VPSIO)
- I POP S VPSRSLT=-1_U_"DEVICE IN USE - TRY AGAIN LATER" QUIT
- ;
- ; -- Print Wristband
- D USE^%ZISUTL("PATIENTLABEL")
- N $ETRAP,$ESTACK S $ETRAP="D ETRAP^VPSRLBLS QUIT"
- N DGDFNS S DGDFNS(VPSDFN)=""
- N DGLOC S DGLOC=VPSLOC
- N DGLBCNT S DGLBCNT=VPSLBCNT
- N DGLPL S DGLPL=VPSLPL
- N VPSSSN S VPSSSN=$P(^DPT(VPSDFN,0),U,9)
- D START^DGPLBL ; All the DG vars are required
- ;
- ; -- close output devcie
- D CLOSE^%ZISUTL("PATIENTLABEL")
- ;
- S VPSRSLT=0
- QUIT VPSRSLT
- ;
- VALIDATE(VPSDFN,DGLOC,DGLBCNT,DGLPL,VPSIO) ; Check Input Parameters
- ;INPUT
- ; VPSDFN Patient DFN (Must be VALID)
- ; DGLOC include location flag (0 or 1)
- ; DGLBCNT label count from 1 to 250
- ; DGLPL lines per label can contain (6-25)
- ; VPSIO output device ien
- ;RETURN
- ; successful : ""
- ; failed : -1^exception message
- ;
- ; -- check Include Ward Location input parameter
- QUIT:$G(DGLOC)="" "-1"_U_"INPUT PARAMETER 'INCLUDE WARD LOCATION FLAG' NOT SENT"
- QUIT:(DGLOC<0)!(DGLOC>1) "-1"_U_"INVALID VALUE FOR 'INCLUDE WARD LOCATION FLAG'. VALID NUMBER SHOULD BE 0 OR 1"
- ;
- ; -- check label count
- QUIT:$G(DGLBCNT)="" "-1"_U_"INPUT PARAMETER 'LABEL COUNT' NOT SENT"
- QUIT:(DGLBCNT<1)!(DGLBCNT>250) "-1"_U_"INVALID VALUE FOR 'LABEL COUNT'. VALID NUMBER IS BETWEEN 1 to 250"
- ;
- ; -- check number of lines/label
- QUIT:$G(DGLPL)="" "-1"_U_"INPUT PARAMETER 'LINES/LABEL' NOT SENT"
- QUIT:(DGLPL<6)!(DGLPL>25) "-1"_U_"INVALID VALUE FOR 'LINES/LABEL'. VALID NUMBER IS BETWEEN 6 to 25"
- ;
- ; -- check device
- N MSG S MSG=$$DEVEXIST^VPSPRINT($G(VPSIO))
- QUIT:+MSG=-1 MSG
- ;
- QUIT ""
- ;
- ETRAP ; ERROR TRAP during printing patient label
- S VPSRSLT="-1^"_$$EC^%ZOSV
- D CLOSE^%ZISUTL("PATIENTLABEL")
- QUIT
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVPSRLBLS 3218 printed Feb 19, 2025@00:09:50 Page 2
- VPSRLBLS ;DALOIFO/GT,SLOIFO/BT - PATIENT LABELS RPC;07/15/14 15:30
- +1 ;;1.0;VA POINT OF SERVICE (KIOSKS);**4**;Jul 15,2014;Build 27
- +2 ;;Per VHA Directive 2004-038, this routine should not be modified.
- +3 ;
- +4 ; External Reference DBIA#
- +5 ; ------------------------
- +6 ; #10035 - ^DPT( references (Supported)
- +7 ; #2119 - OPEN^%ZISUTL, USE^%ZISUTL, CLOSE^%ZISUTL (Supported)
- +8 ; #5904 - START^DGPLBL call (Private)
- +9 ;
- +10 QUIT
- +11 ;
- PRINT(VPSRSLT,VPSTYP,VPSNUM,VPSLOC,VPSLBCNT,VPSLPL,VPSIO) ;VPS PRINT PATIENT LABEL
- +1 ;This RPC provide a patient demographics label that includes Patient Name,SSN,
- +2 ;DOB and an optional inpatient location (ward and bed).
- +3 ;INPUT
- +4 ; VPSTYP Patients ID Type - SSN or DFN OR ICN OR VIC/CAC (REQUIRED)
- +5 ; VPSNUM Parameter Value - patient SSN OR DFN OR ICN OR VIC/CAC (REQUIRED)
- +6 ; VPSLOC include location flag (0 or 1)
- +7 ; VPSLBCNT label count from 1 to 250
- +8 ; VPSLPL lines per label can contain (6-25)
- +9 ; VPSIO output device name
- +10 ;OUTPUT
- +11 ; VPSRSLT 0 (Successful)
- +12 ; -1^Failure Message
- +13 ;
- +14 ; -- Get DFN based on Patienr ID Type and Value pair
- +15 SET VPSRSLT=$$GETDFN^VPSPRINT($GET(VPSTYP),$GET(VPSNUM))
- +16 if +VPSRSLT=-1
- QUIT VPSRSLT
- +17 NEW VPSDFN
- SET VPSDFN=VPSRSLT
- +18 ;
- +19 ; -- Check Input parameters
- +20 SET VPSRSLT=$$VALIDATE(VPSDFN,$GET(VPSLOC),$GET(VPSLBCNT),$GET(VPSLPL),$GET(VPSIO))
- +21 if +VPSRSLT=-1
- QUIT
- +22 ;
- +23 ; -- Setup handle for output device and open the device.
- +24 DO OPEN^%ZISUTL("PATIENTLABEL",VPSIO)
- +25 IF POP
- SET VPSRSLT=-1_U_"DEVICE IN USE - TRY AGAIN LATER"
- QUIT
- +26 ;
- +27 ; -- Print Wristband
- +28 DO USE^%ZISUTL("PATIENTLABEL")
- +29 NEW $ETRAP,$ESTACK
- SET $ETRAP="D ETRAP^VPSRLBLS QUIT"
- +30 NEW DGDFNS
- SET DGDFNS(VPSDFN)=""
- +31 NEW DGLOC
- SET DGLOC=VPSLOC
- +32 NEW DGLBCNT
- SET DGLBCNT=VPSLBCNT
- +33 NEW DGLPL
- SET DGLPL=VPSLPL
- +34 NEW VPSSSN
- SET VPSSSN=$PIECE(^DPT(VPSDFN,0),U,9)
- +35 ; All the DG vars are required
- DO START^DGPLBL
- +36 ;
- +37 ; -- close output devcie
- +38 DO CLOSE^%ZISUTL("PATIENTLABEL")
- +39 ;
- +40 SET VPSRSLT=0
- +41 QUIT VPSRSLT
- +42 ;
- VALIDATE(VPSDFN,DGLOC,DGLBCNT,DGLPL,VPSIO) ; Check Input Parameters
- +1 ;INPUT
- +2 ; VPSDFN Patient DFN (Must be VALID)
- +3 ; DGLOC include location flag (0 or 1)
- +4 ; DGLBCNT label count from 1 to 250
- +5 ; DGLPL lines per label can contain (6-25)
- +6 ; VPSIO output device ien
- +7 ;RETURN
- +8 ; successful : ""
- +9 ; failed : -1^exception message
- +10 ;
- +11 ; -- check Include Ward Location input parameter
- +12 if $GET(DGLOC)=""
- QUIT "-1"_U_"INPUT PARAMETER 'INCLUDE WARD LOCATION FLAG' NOT SENT"
- +13 if (DGLOC<0)!(DGLOC>1)
- QUIT "-1"_U_"INVALID VALUE FOR 'INCLUDE WARD LOCATION FLAG'. VALID NUMBER SHOULD BE 0 OR 1"
- +14 ;
- +15 ; -- check label count
- +16 if $GET(DGLBCNT)=""
- QUIT "-1"_U_"INPUT PARAMETER 'LABEL COUNT' NOT SENT"
- +17 if (DGLBCNT<1)!(DGLBCNT>250)
- QUIT "-1"_U_"INVALID VALUE FOR 'LABEL COUNT'. VALID NUMBER IS BETWEEN 1 to 250"
- +18 ;
- +19 ; -- check number of lines/label
- +20 if $GET(DGLPL)=""
- QUIT "-1"_U_"INPUT PARAMETER 'LINES/LABEL' NOT SENT"
- +21 if (DGLPL<6)!(DGLPL>25)
- QUIT "-1"_U_"INVALID VALUE FOR 'LINES/LABEL'. VALID NUMBER IS BETWEEN 6 to 25"
- +22 ;
- +23 ; -- check device
- +24 NEW MSG
- SET MSG=$$DEVEXIST^VPSPRINT($GET(VPSIO))
- +25 if +MSG=-1
- QUIT MSG
- +26 ;
- +27 QUIT ""
- +28 ;
- ETRAP ; ERROR TRAP during printing patient label
- +1 SET VPSRSLT="-1^"_$$EC^%ZOSV
- +2 DO CLOSE^%ZISUTL("PATIENTLABEL")
- +3 QUIT