PSJOCERR ;BIR/MV - ERROR HANDLING FOR ORDER CHECKS ;6 Jun 07 / 3:37 PM
;;5.0;INPATIENT MEDICATIONS ;**181,252**;16 DEC 97;Build 69
;
SYS() ;
;If the system is down, pause and continue with Allergy and CPRS OC
I '$$PING^PSJOC() D Q 1
. K ^TMP($J,"PSJPRE")
. D PAUSE^PSJMISC(1,1)
. D GMRAOC^PSJOC
Q 0
DRUG ;
Q
ORDER ;
Q
SETERR(PSJBASE,PSJPON,PSJCODE,PSJDNM) ;
;PSJBASE - Base(Literal value for TMP global)
;PSJPON - 4th pieces pharmacy order #
;PSJCODE - Exception code for a specific error message to be returned
;PSJDNM - Display drug name (DD or AD/SOL)
I $G(PSJBASE)="" Q
I $G(PSJPON)="" Q
I '$G(PSJCODE) Q
S ^TMP($J,PSJBASE,"IN","EXCEPTIONS","DOSE",PSJPON)=PSJCODE_U_$G(PSJDNM)
Q
DSPERR(PSJTYPE) ;Display drug level errors
;PSJTYPE = "DRUGDRUG" or "THERAPY"
;PSJOCER(MSG_TEXT) - Array to keep track of errors that already displayed
;PSJDSPFG - If 1 then display a Pause if an error was displayed.
Q:$G(PSJTYPE)=""
NEW ON,PSJPON,PSJCNT,PSJMSG
S PSJDSPFG=0
S PSJPON="" F S PSJPON=$O(^TMP($J,"PSJPRE","OUT",PSJTYPE,"ERROR",PSJPON)) Q:PSJPON="" D
. F PSJCNT=0:0 S PSJCNT=$O(^TMP($J,"PSJPRE","OUT",PSJTYPE,"ERROR",PSJPON,PSJCNT)) Q:'PSJCNT D
.. S PSJMSG=$G(^TMP($J,"PSJPRE","OUT",PSJTYPE,"ERROR",PSJPON,PSJCNT,"MSG"))
.. S PSJTXT=$G(^TMP($J,"PSJPRE","OUT",PSJTYPE,"ERROR",PSJPON,PSJCNT,"TEXT"))
.. I '$$ERRCHK(PSJMSG_PSJTXT) Q
.. S PSJDSPFG=1
.. K PSJPAUSE
.. I ($Y+6)>IOSL D PAUSE^PSJMISC(1,1) W @IOF
.. I PSJMSG]"" W !! D WRITE^PSJMISC(PSJMSG)
.. I PSJTXT]"" D WRITE^PSJMISC(" Reason(s): "_PSJTXT)
I PSJDSPFG D PAUSE^PSJMISC(1,1) W @IOF
Q
ERRCHK(PSJX) ;
;PSJX - Drug name_Error reason
;Return 1 if this error drug has not displayed to the user.
I $G(PSJX)="" Q 0
I '$D(PSJOCER(PSJX)) S PSJOCER(PSJX)="" Q 1
Q 0
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSJOCERR 1807 printed Dec 13, 2024@02:08:04 Page 2
PSJOCERR ;BIR/MV - ERROR HANDLING FOR ORDER CHECKS ;6 Jun 07 / 3:37 PM
+1 ;;5.0;INPATIENT MEDICATIONS ;**181,252**;16 DEC 97;Build 69
+2 ;
SYS() ;
+1 ;If the system is down, pause and continue with Allergy and CPRS OC
+2 IF '$$PING^PSJOC()
Begin DoDot:1
+3 KILL ^TMP($JOB,"PSJPRE")
+4 DO PAUSE^PSJMISC(1,1)
+5 DO GMRAOC^PSJOC
End DoDot:1
QUIT 1
+6 QUIT 0
DRUG ;
+1 QUIT
ORDER ;
+1 QUIT
SETERR(PSJBASE,PSJPON,PSJCODE,PSJDNM) ;
+1 ;PSJBASE - Base(Literal value for TMP global)
+2 ;PSJPON - 4th pieces pharmacy order #
+3 ;PSJCODE - Exception code for a specific error message to be returned
+4 ;PSJDNM - Display drug name (DD or AD/SOL)
+5 IF $GET(PSJBASE)=""
QUIT
+6 IF $GET(PSJPON)=""
QUIT
+7 IF '$GET(PSJCODE)
QUIT
+8 SET ^TMP($JOB,PSJBASE,"IN","EXCEPTIONS","DOSE",PSJPON)=PSJCODE_U_$GET(PSJDNM)
+9 QUIT
DSPERR(PSJTYPE) ;Display drug level errors
+1 ;PSJTYPE = "DRUGDRUG" or "THERAPY"
+2 ;PSJOCER(MSG_TEXT) - Array to keep track of errors that already displayed
+3 ;PSJDSPFG - If 1 then display a Pause if an error was displayed.
+4 if $GET(PSJTYPE)=""
QUIT
+5 NEW ON,PSJPON,PSJCNT,PSJMSG
+6 SET PSJDSPFG=0
+7 SET PSJPON=""
FOR
SET PSJPON=$ORDER(^TMP($JOB,"PSJPRE","OUT",PSJTYPE,"ERROR",PSJPON))
if PSJPON=""
QUIT
Begin DoDot:1
+8 FOR PSJCNT=0:0
SET PSJCNT=$ORDER(^TMP($JOB,"PSJPRE","OUT",PSJTYPE,"ERROR",PSJPON,PSJCNT))
if 'PSJCNT
QUIT
Begin DoDot:2
+9 SET PSJMSG=$GET(^TMP($JOB,"PSJPRE","OUT",PSJTYPE,"ERROR",PSJPON,PSJCNT,"MSG"))
+10 SET PSJTXT=$GET(^TMP($JOB,"PSJPRE","OUT",PSJTYPE,"ERROR",PSJPON,PSJCNT,"TEXT"))
+11 IF '$$ERRCHK(PSJMSG_PSJTXT)
QUIT
+12 SET PSJDSPFG=1
+13 KILL PSJPAUSE
+14 IF ($Y+6)>IOSL
DO PAUSE^PSJMISC(1,1)
WRITE @IOF
+15 IF PSJMSG]""
WRITE !!
DO WRITE^PSJMISC(PSJMSG)
+16 IF PSJTXT]""
DO WRITE^PSJMISC(" Reason(s): "_PSJTXT)
End DoDot:2
End DoDot:1
+17 IF PSJDSPFG
DO PAUSE^PSJMISC(1,1)
WRITE @IOF
+18 QUIT
ERRCHK(PSJX) ;
+1 ;PSJX - Drug name_Error reason
+2 ;Return 1 if this error drug has not displayed to the user.
+3 IF $GET(PSJX)=""
QUIT 0
+4 IF '$DATA(PSJOCER(PSJX))
SET PSJOCER(PSJX)=""
QUIT 1
+5 QUIT 0