AGMPPRST ;GDIT/HS/SWH-Production Status Check; SEP 20, 2017
;;7.2;IHS PATIENT REGISTRATION;**6**;SEP 28, 2017 ;Build 23
Q
;
;
CHKPRST ;Check the latest status information within the ^AGMPPRST global.
L +^AGMPPSCH:5 Q:'$T ;DO NOT START IF ALREADY RUNNING
I $G(^AGMPPRST("STOP")) Q ;If the 'STOP' global is populated we'll not send any alerts.
H 5 ;we hang for 5 seconds to insure the Task running at the same time in the Ensemble MPI namespace has compled.
I $D(^AGMPPRST("Status")) D Q ;If there is a 'Status' entry within the Global continue.
.I $G(^AGMPPRST("Status"))="Running" D Q ;If the 'Status' is set to Running we clear out the saved alert entries.
..S ^AGMPPRST("LastAlertType")=""
..S ^AGMPPRST("LastAlertDate")=""
.S TCRNTDT=$P($H,",")
.I $G(^AGMPPRST("Status"))=$G(^AGMPPRST("LastAlertType")) D Q ;If the last alert status is the same as the current alert status.
..I TCRNTDT>$G(^AGMPPRST("LastAlertDate")) D SNDN(TCRNTDT) ; If the current date is greater than the last sent date we send another alert.
.D SNDN(TCRNTDT) ;If we get here the production status isn't running and the last alert type wasn't the current production status
L -^AGMPPSCH
Q
;
;
SNDN(PDATE) ;Send an notification using the NOTIF routine of the AGMPIHLIO file.
D NOTIF^AGMPIHLO("","The MPI Production status: "_^AGMPPRST("Status")_" : "_PDATE)
S ^AGMPPRST("LastAlertDate")=PDATE ;Set the alert date to the date sent in.
S ^AGMPPRST("LastAlertType")=^AGMPPRST("Status") ;Set the alert type to the current status.
Q
;
;
AGMPPRST ;GDIT/HS/SWH-Production Status Check; SEP 20, 2017
+1 ;;7.2;IHS PATIENT REGISTRATION;**6**;SEP 28, 2017 ;Build 23
+2 QUIT
+3 ;
+4 ;
CHKPRST ;Check the latest status information within the ^AGMPPRST global.
+1 ;DO NOT START IF ALREADY RUNNING
LOCK +^AGMPPSCH:5
IF '$TEST
QUIT
+2 ;If the 'STOP' global is populated we'll not send any alerts.
IF $GET(^AGMPPRST("STOP"))
QUIT
+3 ;we hang for 5 seconds to insure the Task running at the same time in the Ensemble MPI namespace has compled.
HANG 5
+4 ;If there is a 'Status' entry within the Global continue.
IF $DATA(^AGMPPRST("Status"))
Begin DoDot:1
+5 ;If the 'Status' is set to Running we clear out the saved alert entries.
IF $GET(^AGMPPRST("Status"))="Running"
Begin DoDot:2
+6 SET ^AGMPPRST("LastAlertType")=""
+7 SET ^AGMPPRST("LastAlertDate")=""
End DoDot:2
QUIT
+8 SET TCRNTDT=$PIECE($HOROLOG,",")
+9 ;If the last alert status is the same as the current alert status.
IF $GET(^AGMPPRST("Status"))=$GET(^AGMPPRST("LastAlertType"))
Begin DoDot:2
+10 ; If the current date is greater than the last sent date we send another alert.
IF TCRNTDT>$GET(^AGMPPRST("LastAlertDate"))
DO SNDN(TCRNTDT)
End DoDot:2
QUIT
+11 ;If we get here the production status isn't running and the last alert type wasn't the current production status
DO SNDN(TCRNTDT)
End DoDot:1
QUIT
+12 LOCK -^AGMPPSCH
+13 QUIT
+14 ;
+15 ;
SNDN(PDATE) ;Send an notification using the NOTIF routine of the AGMPIHLIO file.
+1 DO NOTIF^AGMPIHLO("","The MPI Production status: "_^AGMPPRST("Status")_" : "_PDATE)
+2 ;Set the alert date to the date sent in.
SET ^AGMPPRST("LastAlertDate")=PDATE
+3 ;Set the alert type to the current status.
SET ^AGMPPRST("LastAlertType")=^AGMPPRST("Status")
+4 QUIT
+5 ;
+6 ;