PXRMGEV ;SLC/AGP,RFR - Generic entry point to run different Reminder Evaluation ;Apr 07, 2021@13:57
;;2.0;CLINICAL REMINDERS;**45,71**;Feb 04, 2005;Build 43
Q
;
EN(RESULT,INPUT) ;
; INPUT
; INPUT("SUB")=Temp Global Subscript
;
; For Reminder Order Checks:
; INPUT("DFN")=DFN The patient to perform orders checks on.
; INPUT("ROC START")=START Date to start searching for orders; applies to all orders.
; INPUT("ROC STOP")=STOP Date to stop search for orders; applies to all orders.
; INPUT("ROC DISPLAY GROUPS",DG)="" Array of Display Group Names used in searching for orders.
; INPUT("ROC DISPLAY GROUPS",DG,"START")=START
; Date to start searching for orders; applies to orders with this
; display group and overrides "ROC START".
; INPUT("ROC DISPLAY GROUPS",DG,"STOP")=STOP
; Date to stop searching for orders; applies to orders with this
; display group and overrides "ROC STOP".
; INPUT("ROC STATUS",STATUS)="" Array of order status(es) used in searching for orders.
; INPUT("ROC ORDERED WITHIN")="" Flag indicating order date should fall between START and STOP; used
; in searching for orders.
; INPUT("ROC ORDERS",ORDERIEN)="" Array of orders to evaluate Reminder Order Checks for. If defined,
; the inputs of "ROC START", "ROC STOP", "ROC DISPLAY GROUPS",
; "ROC STATUS" and "ROC ORDERED WITHIN" are not needed.
; INPUT("ROC",ROC)="" Array of Reminder Order Check Groups to check for.
; If ROC is ALL, run against ALL order checks.
; INPUT("ROC RETURN TYPE","GROUPS")="" for groups
; ,"RULES")="" for rules
; ,"OI")="" for orderable items
;
; For Reminder List Rules:
; INPUT("LR",LIST RULE NAME)=PNAME^START DATE^END DATE^SECURE^OVERWRITE^RETURN DATA
; LIST RULE NAME Name of the List Rule to evaluate file 810.4
; PNAME Name of the Patient List to create file 810.5
; SECURE 1 or 0 should the list be secure
; OVERWRITE 1 or 0 if an existing patient list with the same name should be overwritten
; START DATE FM date to start the list rule from
; END DATE FM date to end the list rule from
; RETURN DATA 1 or 0 to determine if data should be return with the patient
;
; For Reminder Definitions:
; INPUT("DFN")=DFN The patient to execute the reminder definition for.
; INPUT("REMINDERS",REMINDER)=SAVE_FIEVAL^MAINTENANCE_FORMAT^TODAY
; REMINDER Reminder definition to execute; either the definition's IEN,
; NAME or PRINT NAME
; SAVE_FIEVAL Copy the FIEVAL array into the return TMP global (boolean flag)
; MAINTENANCE_FORMAT How to format the maintenance section that is copied into the return TMP
; global; see the description for the OUTPUT parameter in the MAIN^PXRM
; line tag for acceptable values
; TODAY Date to use for evaluation in FileMan format
;
; OUTPUT
; ^TMP($J,SUB,0)=-1^ERROR MESSAGE There is a problem with the INPUT array.
; ^TMP($J,SUB,0)=1 There is data in the OUTPUT.
; ^TMP($J,SUB,0)=0 There is no data in the OUTPUT.
;
; For Reminder Order Checks:
; ^TMP($J,SUB,ORDER IEN)="Details from EN^ORQ1"^CURRENT AGENT/PROVIDER
; ^TMP($J,SUB,ORDER IEN,"RULES",ORDER CHECK RULE NAME)=""
; ^TMP($J,SUB,ORDER IEN,"GROUPS",ORDER CHECK GROUP NAME)=""
; ^TMP($J,SUB,ORDER IEN,"TX",N)=TEXT <= ORDER TEXT FROM EN^ORQ1
; ^TMP($J,SUB,ORDER IEN,"OI",OI)="Data from OIS^ORX8" <=ORDERABLE ITEMS
;
; For Reminder List Rules:
; ^TMP($J,SUB,LIST RULE NAME,DFN)=""
; ^TMP($J,SUB,RULE,DFN,"DATA",TYPE)=VALUE
; ^TMP($J,SUB,LIST RULE NAME,"PATIENT LIST CREATED")=NAME OF PATIENT LIST, from file 810.4
;
; For Reminder Definitions:
; ^TMP($J,SUB,REMINDER)="STATUS^DUE DATE^LAST DONE"
; ^TMP($J,SUB,REMINDER,"PRINT NAME")=Reminder's print name (or name if print name is null)
; ^TMP($J,SUB,REMINDER,"FIEVAL")=
; Merged copy of the FIEVAL array
; ^TMP($J,SUB,REMINDER,"MAINTENANCE",X)=Line X of the maintenance output
; ^TMP($J,SUB,REMINDER,"FINDINGS",COMPONENT REMINDER)="STATUS^DUE DATE^LAST DONE"
; If REMINDER has the VA-REMINDER DEFINITION computed finding and its
; SAVETEMP parameter value is 1, then data for the COMPONENT REMINDER
; that is executed is returned under this node
; ^TMP($J,SUB,REMINDER,"FINDINGS",COMPONENT REMINDER,"FIEVAL")=
; Merged copy of the FIEVAL array for COMPONENT REMINDER that is
; executed as a finding, where COMPONENT REMINDER is the PRINT
; NAME of that reminder
; ^TMP($J,SUB,REMINDER,"FINDINGS",COMPONENT REMINDER,"MAINTENANCE",X)=
; Line X of the maintenance output for COMPONENT REMINDER that is
; executed as a finding, where COMPONENT REMINDER is the PRINT
; NAME of that reminder
;
; INTERNAL INPUT ARRAY STRUCTURE
; DATA("ROC ORDERS",ORDER IEN (FILE 100))= SET TO ZERO NODE DOCUMENTED IN EN^ORQ1
; DATA("ROC ORDERS",ORDER IEN,"OI",OI)="" OI is the orderable item IEN (file 101.43) for the corresponding order
; DATA("ROC ORDERS",ORDER IEN,"PKG ID")=PACKAGE REFERENCE FIELD (#33)
; DATA("ROC ORDERS",ORDER IEN,"MODIFIERS",N)=EXTERNAL VALUE OF PROMPT WITH ID "MODIFIER"
; DATA("EVAL",TYPE,SUB,PIECE)=VALUE internal format used to updating reminder definition findings
; DATA("EVAL","EVAL DATE")=DATE internal format use to set the reminder evaluation date.
;
N DGIENS,ORDLST,REMTYPE,SUB,DATA
S SUB=$G(INPUT("SUB")) I SUB="" Q
K ^TMP($J,SUB)
S RESULT=$NA(^TMP($J,SUB))
S @RESULT@(0)=0
M DATA=INPUT
;Perform INPUT array checks
I $$CINPUTS(.RESULT,.DATA)=1 Q
I $D(DATA("ROC ORDERS")) D GETOIS^PXRMGEVA(.DATA)
I $D(DATA("ROC DISPLAY GROUPS"))>0 D
.; find display group IEN needed to find orders
.D FINDDGS^PXRMGEVA(.RESULT,.DATA) I '$D(DATA("DG IEN")) D ERROR^PXRMGEVA(.RESULT,"No Display Group Found") Q
.I +$G(@RESULT@(0))<0 Q
.; find orders based off Display Groups and Status
.D GTORDERS^PXRMGEVA(.DATA)
I +$G(@RESULT@(0))<0 Q
D REM^PXRMGEVA(.RESULT,.DATA)
Q
;
CINPUTS(RESULT,INPUT) ;
N DGIEN,FAIL,GNAME,NAME,NODE,ROC,ROCIENS,ROCTYPE,RIEN,%DT,X,Y
I '$D(INPUT("ROC")),'$D(INPUT("REMINDERS")),'$D(INPUT("LR")) D ERROR^PXRMGEVA(.RESULT,"No reminders items defined") Q 1
I '$D(INPUT("LR")) D I +$G(@RESULT@(0))<0 Q 1
.I +$G(INPUT("DFN"))<0 D ERROR^PXRMGEVA(.RESULT,"Patient is not properly defined") Q
.I '$D(^DPT(INPUT("DFN"),0)) D ERROR^PXRMGEVA(.RESULT,"Invalid patient specified") Q
;check order checks array
I $D(INPUT("ROC")) D I +$G(@RESULT@(0))<0 Q 1
.S ROCTYPE="",ROCTYPE("VALID")=0 F S ROCTYPE=$O(INPUT("ROC RETURN TYPE",ROCTYPE)) Q:ROCTYPE="" D
..I "^GROUPS^RULES^GROUPS/RULES^OI^"'[(U_ROCTYPE_U) D ERROR^PXRMGEVA(.RESULT,"Return type must be either GROUPS, RULES, GROUPS/RULES, or OI.") Q
..I "^GROUPS^RULES^GROUPS/RULES^"[(U_ROCTYPE_U) S ROCTYPE("VALID")=1
.Q:+$G(@RESULT@(0))<0
.I 'ROCTYPE("VALID") D ERROR^PXRMGEVA(.RESULT,"A return type of either GROUPS, RULES or GROUPS/RULES is required.") Q
.I $D(INPUT("ROC ORDERS")),$D(INPUT("ROC DISPLAY GROUPS")) D ERROR^PXRMGEVA(.RESULT,"Cannot search for both Orders and Display Groups") Q
.I $D(INPUT("ROC ORDERS")) Q
.I '$D(INPUT("ROC STATUS")) D ERROR^PXRMGEVA(.RESULT,"No statuses or search criteria defined") Q
.I '$D(INPUT("ROC DISPLAY GROUPS")) D ERROR^PXRMGEVA(.RESULT,"No Display Groups define")
.S FAIL=0
.I $D(INPUT("ROC ORDERED WITHIN")) D
..S DGIEN=0 F S DGIEN=$O(INPUT("ROC DISPLAY GROUPS",DGIEN)) Q:DGIEN'>0!(FAIL=1) D
...I +$G(INPUT("ROC DISPLAY GROUPS",DGIEN,"START"))=0 S FAIL=1 Q
...I +$G(INPUT("ROC DISPLAY GROUPS",DGIEN,"STOP"))=0 S FAIL=1 Q
.I FAIL=1 D ERROR^PXRMGEVA(.RESULT,"No search date range defined") Q
.I '$D(INPUT("ROC","ALL")) D
..S GNAME="" F S GNAME=$O(INPUT("ROC",GNAME)) Q:GNAME=""!(FAIL=1) D
...I '$D(^PXD(801,"B",GNAME)) D ERROR^PXRMGEVA(.RESULT,"Reminder Order Check Group: "_GNAME_" not found") S FAIL=1
;check list rule array
I $D(INPUT("LR")) D I +$G(@RESULT@(0))<0 Q 1
. S NAME="" F S NAME=$O(INPUT("LR",NAME)) Q:NAME="" D
. .S NODE=$G(INPUT("LR",NAME))
. .I $P(NODE,U)="" D ERROR^PXRMGEVA(.RESULT,"Patient List Name not define") Q
. .I $P(NODE,U,2)="" D ERROR^PXRMGEVA(.RESULT,"Start Date not define") Q
. .I $P(NODE,U,3)="" D ERROR^PXRMGEVA(.RESULT,"End Date not define") Q
. .I $P(NODE,U,4)="" D ERROR^PXRMGEVA(.RESULT,"Secure not define") Q
. .I $P(NODE,U,5)="" D ERROR^PXRMGEVA(.RESULT,"Overwrite not define")
;check reminder definitions array
I $D(INPUT("REMINDERS")) D I +$G(@RESULT@(0))<0 Q 1
.S NAME="" F S NAME=$O(INPUT("REMINDERS",NAME)) Q:NAME="" D
..S RIEN=0
..I NAME'?1.N D
...S RIEN=+$O(^PXD(811.9,"B",$E(NAME,1,64),0)) Q:RIEN>0
...S RIEN=+$O(^PXD(811.9,"D",$E(NAME,1,35),0))
..I NAME?1.N S RIEN=NAME
..I ('RIEN)!('$D(^PXD(811.9,RIEN,0))) D ERROR^PXRMGEVA(.RESULT,"Reminder definition does not exist") Q
..I $P($G(^PXD(811.9,RIEN,0)),U,6)=1 D ERROR^PXRMGEVA(.RESULT,"The reminder definition is inactive") Q
..S INPUT("REMINDERS",RIEN)=NAME_U_INPUT("REMINDERS",NAME)
..I NAME'=RIEN K INPUT("REMINDERS",NAME)
..S NODE=$G(INPUT("REMINDERS",RIEN)) Q:NODE=""
..I "^0^1^"'[(U_$P(NODE,U,2)_U) D ERROR^PXRMGEVA(.RESULT,"Invalid SAVE_FIEVAL flag; set it to either 0 or 1") Q
..I $P(NODE,U,4)'="" D
...S %DT="",X=$P(NODE,U,4)
...D ^%DT
...I Y=-1 D ERROR^PXRMGEVA(.RESULT,"Invalid value for TODAY") Q
...S $P(INPUT("REMINDERS",RIEN),U,4)=Y
Q 0
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXRMGEV 10396 printed Dec 13, 2024@01:46 Page 2
PXRMGEV ;SLC/AGP,RFR - Generic entry point to run different Reminder Evaluation ;Apr 07, 2021@13:57
+1 ;;2.0;CLINICAL REMINDERS;**45,71**;Feb 04, 2005;Build 43
+2 QUIT
+3 ;
EN(RESULT,INPUT) ;
+1 ; INPUT
+2 ; INPUT("SUB")=Temp Global Subscript
+3 ;
+4 ; For Reminder Order Checks:
+5 ; INPUT("DFN")=DFN The patient to perform orders checks on.
+6 ; INPUT("ROC START")=START Date to start searching for orders; applies to all orders.
+7 ; INPUT("ROC STOP")=STOP Date to stop search for orders; applies to all orders.
+8 ; INPUT("ROC DISPLAY GROUPS",DG)="" Array of Display Group Names used in searching for orders.
+9 ; INPUT("ROC DISPLAY GROUPS",DG,"START")=START
+10 ; Date to start searching for orders; applies to orders with this
+11 ; display group and overrides "ROC START".
+12 ; INPUT("ROC DISPLAY GROUPS",DG,"STOP")=STOP
+13 ; Date to stop searching for orders; applies to orders with this
+14 ; display group and overrides "ROC STOP".
+15 ; INPUT("ROC STATUS",STATUS)="" Array of order status(es) used in searching for orders.
+16 ; INPUT("ROC ORDERED WITHIN")="" Flag indicating order date should fall between START and STOP; used
+17 ; in searching for orders.
+18 ; INPUT("ROC ORDERS",ORDERIEN)="" Array of orders to evaluate Reminder Order Checks for. If defined,
+19 ; the inputs of "ROC START", "ROC STOP", "ROC DISPLAY GROUPS",
+20 ; "ROC STATUS" and "ROC ORDERED WITHIN" are not needed.
+21 ; INPUT("ROC",ROC)="" Array of Reminder Order Check Groups to check for.
+22 ; If ROC is ALL, run against ALL order checks.
+23 ; INPUT("ROC RETURN TYPE","GROUPS")="" for groups
+24 ; ,"RULES")="" for rules
+25 ; ,"OI")="" for orderable items
+26 ;
+27 ; For Reminder List Rules:
+28 ; INPUT("LR",LIST RULE NAME)=PNAME^START DATE^END DATE^SECURE^OVERWRITE^RETURN DATA
+29 ; LIST RULE NAME Name of the List Rule to evaluate file 810.4
+30 ; PNAME Name of the Patient List to create file 810.5
+31 ; SECURE 1 or 0 should the list be secure
+32 ; OVERWRITE 1 or 0 if an existing patient list with the same name should be overwritten
+33 ; START DATE FM date to start the list rule from
+34 ; END DATE FM date to end the list rule from
+35 ; RETURN DATA 1 or 0 to determine if data should be return with the patient
+36 ;
+37 ; For Reminder Definitions:
+38 ; INPUT("DFN")=DFN The patient to execute the reminder definition for.
+39 ; INPUT("REMINDERS",REMINDER)=SAVE_FIEVAL^MAINTENANCE_FORMAT^TODAY
+40 ; REMINDER Reminder definition to execute; either the definition's IEN,
+41 ; NAME or PRINT NAME
+42 ; SAVE_FIEVAL Copy the FIEVAL array into the return TMP global (boolean flag)
+43 ; MAINTENANCE_FORMAT How to format the maintenance section that is copied into the return TMP
+44 ; global; see the description for the OUTPUT parameter in the MAIN^PXRM
+45 ; line tag for acceptable values
+46 ; TODAY Date to use for evaluation in FileMan format
+47 ;
+48 ; OUTPUT
+49 ; ^TMP($J,SUB,0)=-1^ERROR MESSAGE There is a problem with the INPUT array.
+50 ; ^TMP($J,SUB,0)=1 There is data in the OUTPUT.
+51 ; ^TMP($J,SUB,0)=0 There is no data in the OUTPUT.
+52 ;
+53 ; For Reminder Order Checks:
+54 ; ^TMP($J,SUB,ORDER IEN)="Details from EN^ORQ1"^CURRENT AGENT/PROVIDER
+55 ; ^TMP($J,SUB,ORDER IEN,"RULES",ORDER CHECK RULE NAME)=""
+56 ; ^TMP($J,SUB,ORDER IEN,"GROUPS",ORDER CHECK GROUP NAME)=""
+57 ; ^TMP($J,SUB,ORDER IEN,"TX",N)=TEXT <= ORDER TEXT FROM EN^ORQ1
+58 ; ^TMP($J,SUB,ORDER IEN,"OI",OI)="Data from OIS^ORX8" <=ORDERABLE ITEMS
+59 ;
+60 ; For Reminder List Rules:
+61 ; ^TMP($J,SUB,LIST RULE NAME,DFN)=""
+62 ; ^TMP($J,SUB,RULE,DFN,"DATA",TYPE)=VALUE
+63 ; ^TMP($J,SUB,LIST RULE NAME,"PATIENT LIST CREATED")=NAME OF PATIENT LIST, from file 810.4
+64 ;
+65 ; For Reminder Definitions:
+66 ; ^TMP($J,SUB,REMINDER)="STATUS^DUE DATE^LAST DONE"
+67 ; ^TMP($J,SUB,REMINDER,"PRINT NAME")=Reminder's print name (or name if print name is null)
+68 ; ^TMP($J,SUB,REMINDER,"FIEVAL")=
+69 ; Merged copy of the FIEVAL array
+70 ; ^TMP($J,SUB,REMINDER,"MAINTENANCE",X)=Line X of the maintenance output
+71 ; ^TMP($J,SUB,REMINDER,"FINDINGS",COMPONENT REMINDER)="STATUS^DUE DATE^LAST DONE"
+72 ; If REMINDER has the VA-REMINDER DEFINITION computed finding and its
+73 ; SAVETEMP parameter value is 1, then data for the COMPONENT REMINDER
+74 ; that is executed is returned under this node
+75 ; ^TMP($J,SUB,REMINDER,"FINDINGS",COMPONENT REMINDER,"FIEVAL")=
+76 ; Merged copy of the FIEVAL array for COMPONENT REMINDER that is
+77 ; executed as a finding, where COMPONENT REMINDER is the PRINT
+78 ; NAME of that reminder
+79 ; ^TMP($J,SUB,REMINDER,"FINDINGS",COMPONENT REMINDER,"MAINTENANCE",X)=
+80 ; Line X of the maintenance output for COMPONENT REMINDER that is
+81 ; executed as a finding, where COMPONENT REMINDER is the PRINT
+82 ; NAME of that reminder
+83 ;
+84 ; INTERNAL INPUT ARRAY STRUCTURE
+85 ; DATA("ROC ORDERS",ORDER IEN (FILE 100))= SET TO ZERO NODE DOCUMENTED IN EN^ORQ1
+86 ; DATA("ROC ORDERS",ORDER IEN,"OI",OI)="" OI is the orderable item IEN (file 101.43) for the corresponding order
+87 ; DATA("ROC ORDERS",ORDER IEN,"PKG ID")=PACKAGE REFERENCE FIELD (#33)
+88 ; DATA("ROC ORDERS",ORDER IEN,"MODIFIERS",N)=EXTERNAL VALUE OF PROMPT WITH ID "MODIFIER"
+89 ; DATA("EVAL",TYPE,SUB,PIECE)=VALUE internal format used to updating reminder definition findings
+90 ; DATA("EVAL","EVAL DATE")=DATE internal format use to set the reminder evaluation date.
+91 ;
+92 NEW DGIENS,ORDLST,REMTYPE,SUB,DATA
+93 SET SUB=$GET(INPUT("SUB"))
IF SUB=""
QUIT
+94 KILL ^TMP($JOB,SUB)
+95 SET RESULT=$NAME(^TMP($JOB,SUB))
+96 SET @RESULT@(0)=0
+97 MERGE DATA=INPUT
+98 ;Perform INPUT array checks
+99 IF $$CINPUTS(.RESULT,.DATA)=1
QUIT
+100 IF $DATA(DATA("ROC ORDERS"))
DO GETOIS^PXRMGEVA(.DATA)
+101 IF $DATA(DATA("ROC DISPLAY GROUPS"))>0
Begin DoDot:1
+102 ; find display group IEN needed to find orders
+103 DO FINDDGS^PXRMGEVA(.RESULT,.DATA)
IF '$DATA(DATA("DG IEN"))
DO ERROR^PXRMGEVA(.RESULT,"No Display Group Found")
QUIT
+104 IF +$GET(@RESULT@(0))<0
QUIT
+105 ; find orders based off Display Groups and Status
+106 DO GTORDERS^PXRMGEVA(.DATA)
End DoDot:1
+107 IF +$GET(@RESULT@(0))<0
QUIT
+108 DO REM^PXRMGEVA(.RESULT,.DATA)
+109 QUIT
+110 ;
CINPUTS(RESULT,INPUT) ;
+1 NEW DGIEN,FAIL,GNAME,NAME,NODE,ROC,ROCIENS,ROCTYPE,RIEN,%DT,X,Y
+2 IF '$DATA(INPUT("ROC"))
IF '$DATA(INPUT("REMINDERS"))
IF '$DATA(INPUT("LR"))
DO ERROR^PXRMGEVA(.RESULT,"No reminders items defined")
QUIT 1
+3 IF '$DATA(INPUT("LR"))
Begin DoDot:1
+4 IF +$GET(INPUT("DFN"))<0
DO ERROR^PXRMGEVA(.RESULT,"Patient is not properly defined")
QUIT
+5 IF '$DATA(^DPT(INPUT("DFN"),0))
DO ERROR^PXRMGEVA(.RESULT,"Invalid patient specified")
QUIT
End DoDot:1
IF +$GET(@RESULT@(0))<0
QUIT 1
+6 ;check order checks array
+7 IF $DATA(INPUT("ROC"))
Begin DoDot:1
+8 SET ROCTYPE=""
SET ROCTYPE("VALID")=0
FOR
SET ROCTYPE=$ORDER(INPUT("ROC RETURN TYPE",ROCTYPE))
if ROCTYPE=""
QUIT
Begin DoDot:2
+9 IF "^GROUPS^RULES^GROUPS/RULES^OI^"'[(U_ROCTYPE_U)
DO ERROR^PXRMGEVA(.RESULT,"Return type must be either GROUPS, RULES, GROUPS/RULES, or OI.")
QUIT
+10 IF "^GROUPS^RULES^GROUPS/RULES^"[(U_ROCTYPE_U)
SET ROCTYPE("VALID")=1
End DoDot:2
+11 if +$GET(@RESULT@(0))<0
QUIT
+12 IF 'ROCTYPE("VALID")
DO ERROR^PXRMGEVA(.RESULT,"A return type of either GROUPS, RULES or GROUPS/RULES is required.")
QUIT
+13 IF $DATA(INPUT("ROC ORDERS"))
IF $DATA(INPUT("ROC DISPLAY GROUPS"))
DO ERROR^PXRMGEVA(.RESULT,"Cannot search for both Orders and Display Groups")
QUIT
+14 IF $DATA(INPUT("ROC ORDERS"))
QUIT
+15 IF '$DATA(INPUT("ROC STATUS"))
DO ERROR^PXRMGEVA(.RESULT,"No statuses or search criteria defined")
QUIT
+16 IF '$DATA(INPUT("ROC DISPLAY GROUPS"))
DO ERROR^PXRMGEVA(.RESULT,"No Display Groups define")
+17 SET FAIL=0
+18 IF $DATA(INPUT("ROC ORDERED WITHIN"))
Begin DoDot:2
+19 SET DGIEN=0
FOR
SET DGIEN=$ORDER(INPUT("ROC DISPLAY GROUPS",DGIEN))
if DGIEN'>0!(FAIL=1)
QUIT
Begin DoDot:3
+20 IF +$GET(INPUT("ROC DISPLAY GROUPS",DGIEN,"START"))=0
SET FAIL=1
QUIT
+21 IF +$GET(INPUT("ROC DISPLAY GROUPS",DGIEN,"STOP"))=0
SET FAIL=1
QUIT
End DoDot:3
End DoDot:2
+22 IF FAIL=1
DO ERROR^PXRMGEVA(.RESULT,"No search date range defined")
QUIT
+23 IF '$DATA(INPUT("ROC","ALL"))
Begin DoDot:2
+24 SET GNAME=""
FOR
SET GNAME=$ORDER(INPUT("ROC",GNAME))
if GNAME=""!(FAIL=1)
QUIT
Begin DoDot:3
+25 IF '$DATA(^PXD(801,"B",GNAME))
DO ERROR^PXRMGEVA(.RESULT,"Reminder Order Check Group: "_GNAME_" not found")
SET FAIL=1
End DoDot:3
End DoDot:2
End DoDot:1
IF +$GET(@RESULT@(0))<0
QUIT 1
+26 ;check list rule array
+27 IF $DATA(INPUT("LR"))
Begin DoDot:1
+28 SET NAME=""
FOR
SET NAME=$ORDER(INPUT("LR",NAME))
if NAME=""
QUIT
Begin DoDot:2
+29 SET NODE=$GET(INPUT("LR",NAME))
+30 IF $PIECE(NODE,U)=""
DO ERROR^PXRMGEVA(.RESULT,"Patient List Name not define")
QUIT
+31 IF $PIECE(NODE,U,2)=""
DO ERROR^PXRMGEVA(.RESULT,"Start Date not define")
QUIT
+32 IF $PIECE(NODE,U,3)=""
DO ERROR^PXRMGEVA(.RESULT,"End Date not define")
QUIT
+33 IF $PIECE(NODE,U,4)=""
DO ERROR^PXRMGEVA(.RESULT,"Secure not define")
QUIT
+34 IF $PIECE(NODE,U,5)=""
DO ERROR^PXRMGEVA(.RESULT,"Overwrite not define")
End DoDot:2
End DoDot:1
IF +$GET(@RESULT@(0))<0
QUIT 1
+35 ;check reminder definitions array
+36 IF $DATA(INPUT("REMINDERS"))
Begin DoDot:1
+37 SET NAME=""
FOR
SET NAME=$ORDER(INPUT("REMINDERS",NAME))
if NAME=""
QUIT
Begin DoDot:2
+38 SET RIEN=0
+39 IF NAME'?1.N
Begin DoDot:3
+40 SET RIEN=+$ORDER(^PXD(811.9,"B",$EXTRACT(NAME,1,64),0))
if RIEN>0
QUIT
+41 SET RIEN=+$ORDER(^PXD(811.9,"D",$EXTRACT(NAME,1,35),0))
End DoDot:3
+42 IF NAME?1.N
SET RIEN=NAME
+43 IF ('RIEN)!('$DATA(^PXD(811.9,RIEN,0)))
DO ERROR^PXRMGEVA(.RESULT,"Reminder definition does not exist")
QUIT
+44 IF $PIECE($GET(^PXD(811.9,RIEN,0)),U,6)=1
DO ERROR^PXRMGEVA(.RESULT,"The reminder definition is inactive")
QUIT
+45 SET INPUT("REMINDERS",RIEN)=NAME_U_INPUT("REMINDERS",NAME)
+46 IF NAME'=RIEN
KILL INPUT("REMINDERS",NAME)
+47 SET NODE=$GET(INPUT("REMINDERS",RIEN))
if NODE=""
QUIT
+48 IF "^0^1^"'[(U_$PIECE(NODE,U,2)_U)
DO ERROR^PXRMGEVA(.RESULT,"Invalid SAVE_FIEVAL flag; set it to either 0 or 1")
QUIT
+49 IF $PIECE(NODE,U,4)'=""
Begin DoDot:3
+50 SET %DT=""
SET X=$PIECE(NODE,U,4)
+51 DO ^%DT
+52 IF Y=-1
DO ERROR^PXRMGEVA(.RESULT,"Invalid value for TODAY")
QUIT
+53 SET $PIECE(INPUT("REMINDERS",RIEN),U,4)=Y
End DoDot:3
End DoDot:2
End DoDot:1
IF +$GET(@RESULT@(0))<0
QUIT 1
+54 QUIT 0
+55 ;