PXRMDBLD ; SLC/PJH - Reminder Dialog Generation. ;05/13/2009
;;2.0;CLINICAL REMINDERS;**12**;Feb 04, 2005;Build 73
;
;Called from PXRMGEDT
;
START ;
N ANS,DIC,DNAME,LIT,LIT1,MSG,NAME,REDO,REM,RLNK,RNAME,ORY
N PXRMENAB,PXRMLINK,PXRMREPL,PXRMREM
;Prompt for auto or manual addition
S ANS="" D ASK(.ANS) Q:$D(DUOUT)!$D(DTOUT)
;Auto
I ANS="Y" D AUTO Q
;Manual
I ANS'="Y" D ADD^PXRMDEDT
END Q
;
;Called by protocol PXRM DIALOG ADD
;----------------------------------
ADD(PXRMITEM) ;
N ANS,DNAME,DTOUT,DUOUT
S VALMBCK="R"
W IORESET
W !,PXRMHD
S DNAME=""
D ASK^PXRMDBLD(.ANS) Q:$D(DTOUT)!$D(DUOUT)
I ANS="Y" D AUTOP(PXRMITEM)
Q
;
;Ask autogenerate/manual
;-----------------------
ASK(YESNO) ;
N X,Y,TEXT,DIR
K DIROUT,DIRUT,DTOUT,DUOUT
S DIR(0)="YA0"
S DIR("A")="GENERATE DIALOG AUTOMATICALLY: "
S DIR("B")="N"
S DIR("?")="Enter Y or N. For detailed help type ??"
S DIR("??")=U_"D HELP^PXRMDBLD(1)"
D ^DIR K DIR
I $D(DIROUT) S DTOUT=1
I $D(DTOUT)!($D(DUOUT)) Q
S YESNO=$E(Y(0))
Q
;
;Source reminder for auto-generate
;---------------------------------
AUTO S DIC("A")="SELECT REMINDER TO GENERATE DIALOG FROM: "
S LIT1="You must select a reminder!"
D SEL(811.9,"AEQMZ",.PXRMREM)
Q:$D(DTOUT)!$D(DUOUT)
S REM=$P(PXRMREM(1),U),DNAME=""
;Display related dialogs
D DISP(REM)
;Promt for type of generate
D AUTOP(REM)
Q
;
;Autogenerate prompts
;--------------------
AUTOP(REM) ;
S RNAME=$P($G(^PXD(811.9,REM,0)),U)
F D Q:$D(DUOUT)!$D(DTOUT)!(DNAME]"")
.N CONFIRM,X,Y,DIR,DA
.K DIROUT,DIRUT,DTOUT,DUOUT
.S DIR(0)="F"_U_"3:40"_U_"K:(X?.N)!'(X'?1P.E) X"
.S DIR("A")="ENTER A UNIQUE DIALOG NAME"
.S DIR("B")=RNAME
.S DIR("?")="Select a unique name for the generated dialog."
.S DIR("??")=U_"D HELP^PXRMDBLD(6)"
.D ^DIR K DIR
.I $D(DIROUT) S DTOUT=1
.I $D(DTOUT)!($D(DUOUT)) Q
.I Y["""" D EN^DDIOL(" name cannot contain quotes!") Q
.I $D(^PXRMD(801.41,"B",Y)) D Q:$G(DTOUT)=1
..D CONFIRM(.CONFIRM,Y) I CONFIRM="Y" D Q:$G(DTOUT)=1
...S DA=$O(^PXRMD(801.41,"B",Y,""))
...I $P($G(^PXRMD(801.41,DA,0)),U,3)="" D Q:$G(DTOUT)=1
....W !!,"THE CURRENT DIALOG IS ENABLED PLEASE DISABLE IT BEFORE "
....W "CONTINING." H 2 S DTOUT=1 Q
..I '$$OVER(Y) S DTOUT=1 Q
..S Y=$$NAME^PXRMDCPY(DA,Y)
..;If this is the linked reminder clear it
..I $P($G(^PXD(811.9,REM,51)),U)=$G(DA) S $P(^PXD(811.9,REM,51),U)=""
.;Option to LINK DIALOG to REMINDER if reminder is not linked already
.S RLNK=$P($G(^PXD(811.9,REM,51)),U),PXRMLINK=0
.I 'RLNK D LINK(.PXRMLINK) Q:$D(DTOUT)!$D(DUOUT)
.;Option to enable dialog
.D ENABLE(.PXRMENAB) Q:$D(DTOUT)!$D(DUOUT)
.;Option to replace existing dialog elements
.D REPL(.PXRMREPL) Q:$D(DTOUT)!$D(DUOUT)
.;Use name entered
.S DNAME=Y
;
Q:$D(DUOUT)!$D(DTOUT)
;Build dialog
N CHECK D BUILD^PXRMDBL1(REM,DNAME,.CHECK)
D FINDCHCK(DNAME)
Q
;
;Display dialogs autogenerated from this reminder
;------------------------------------------------
DISP(RIEN) ;
N ARRAY,DSUB,FIRST
;Get Autogenerated dialogs
S FIRST=1,DSUB=""
F S DSUB=$O(^PXRMD(801.41,"AG",RIEN,DSUB)) Q:'DSUB D
.I FIRST W !!,"Associated Dialogs:" S FIRST=0
.W ?25,$P($G(^PXRMD(801.41,DSUB,0)),U),!
Q
;
;Disable generated dialog
;------------------------
ENABLE(YESNO) ;
N X,Y,TEXT,DIR
K DIROUT,DIRUT,DTOUT,DUOUT
S DIR(0)="YA0"
S DIR("A")="ENABLE DIALOG: "
S DIR("B")="NO"
S DIR("?")="Enter Y or N. For detailed help type ??"
S DIR("??")=U_"D HELP^PXRMDBLD(4)"
D ^DIR K DIR
I $D(DIROUT) S DTOUT=1
I $D(DTOUT)!($D(DUOUT)) Q
S YESNO=$E(Y(0))
Q
;
FINDCHCK(DNAME) ;
W !!,"Scanning dialog "_DNAME_" for inactived findings."
N CNT,DIALIEN,DIEN,DLGARR,ERRCNT,ERRMSG,FAIL,NAME,STDFILES
N STRTEXT,TEXT,TYPE,WRITMSG
;
S WRITMSG=0
D DIALDSAR^PXRMFRPT(.STDFILES) I '$D(STDFILES) Q
S DIALIEN=$O(^PXRMD(801.41,"B",DNAME,"")) Q:DIALIEN'>0
S ERRCNT=0,CNT=0,FAIL=0
S STRTEXT(1)="Dialog "_DNAME_" contains errors. Review the dialog before using it in CPRS."
D BUILDMSG^PXRMDLRP(.STRTEXT,.CNT,.TEXT)
;
;build array of dialog items
D DITEMAR^PXRMDLRP(DIALIEN,.DLGARR,.ERRCNT,.ERRMSG,.FAIL)
;
;bad data format in the dialog
I FAIL="F" D Q
.D BUILDMSG^PXRMDLRP(.ERRMSG,.CNT,.TEXT)
.D EN^DDIOL(.TEXT)
.H 2
;
;scan for inactive finding items, checks against standardized files
S DIEN=0 F S DIEN=$O(DLGARR(DIEN)) Q:DIEN'>0 D
.K ERRMSG
.I $$DISABCHK^PXRMDLG6(DIEN,.STDFILES,.ERRMSG)=1 Q
.;
.S NAME=$P($G(^PXRMD(801.41,DIEN,0)),U)
.S TYPE=$$EXTERNAL^DILFD(801.41,4,"",$P($G(^PXRMD(801.41,DIEN,0)),U,4))
.S $P(^PXRMD(801.41,DIEN,0),U,3)=1
.S STRTEXT(1)="Dialog "_TYPE_" "_NAME_" has been marked disable for the following reason(s)."
.D BUILDMSG^PXRMDLRP(.STRTEXT,.CNT,.TEXT)
.D BUILDMSG^PXRMDLRP(.ERRMSG,.CNT,.TEXT)
.S WRITMSG=1
;
I WRITMSG=1 D EN^DDIOL(.TEXT) H 2
Q
;Link dialog to reminder
;-----------------------
LINK(YESNO) ;
N X,Y,TEXT,DIR
K DIROUT,DIRUT,DTOUT,DUOUT
S DIR(0)="YA0"
S DIR("A")="LINK DIALOG TO REMINDER: "
S DIR("B")="YES"
S DIR("?")="Enter Y or N. For detailed help type ??"
S DIR("??")=U_"D HELP^PXRMDBLD(5)"
D ^DIR K DIR
I $D(DIROUT) S DTOUT=1
I $D(DTOUT)!($D(DUOUT)) Q
S YESNO=$E(Y(0))
Q
;
;Option to override existing dialog
;----------------------------------
OVER(DNAME) ;
N DIR,X,Y
S DIR(0)="Y",DIR("B")="NO"
S DIR("A")="OVERWRITE EXISTING REMINDER DIALOG "
S DIR("?")="Enter Y or N. For detailed help type ??"
S DIR("??")=U_"D HELP^PXRMDBLD(2)"
D ^DIR K DIR
I $D(DIROUT) S DTOUT=1
I $D(DTOUT)!($D(DUOUT)) Q 0
Q $S(Y(0)="YES":1,1:0)
;
;Option to replace existing dialog elements
;------------------------------------------
REPL(INP) ;
N DIR,X,Y
S DIR(0)="Y",DIR("B")="NO"
S DIR("A")="REPLACE ANY EXISTING DIALOG ELEMENTS"
S DIR("?")="Enter Y or N. For detailed help type ??"
S DIR("??")=U_"D HELP^PXRMDBLD(3)"
D ^DIR K DIR
I $D(DIROUT) S DTOUT=1
I $D(DTOUT)!($D(DUOUT)) Q
S INP=$S(Y(0)="YES":1,1:0)
Q
;
;Reminder selection
;------------------
SEL(FILE,MODE,ARRAY) ;
N X,Y,CNT
K DIROUT,DIRUT,DTOUT,DUOUT
S CNT=0
W !
F D Q:$D(DTOUT) Q:$D(DUOUT) Q:CNT>0 Q:(Y=-1)&(CNT>0)
.S DIC=FILE,DIC(0)=MODE
.D ^DIC
.I X=(U_U) S DTOUT=1
.I '$D(DTOUT),('$D(DUOUT)) D
..I +Y'=-1 D Q
...S CNT=CNT+1,ARRAY(CNT)=Y_U_Y(0,0)_U_$P(Y(0),U,3)
..W:CNT=0 !,LIT1
.K DIC
Q
;
CONFIRM(YESNO,NAME) ;
N X,Y,TEXT,DIR
K DIROUT,DIRUT,DTOUT,DUOUT
S DIR(0)="YA0"
S DIR("A")="YOU ARE ABOUT TO OVERWRITE THE EXISTING DIALOG "_NAME_" CONTINUE? "
S DIR("B")="N"
S DIR("?")="Enter Y or N. For detailed help type ??"
S DIR("??")=U_"D HELP^PXRMDBLD(1)"
D ^DIR K DIR
I $D(DIROUT) S DTOUT=1
I $D(DTOUT)!($D(DUOUT)) Q
S YESNO=$E(Y(0))
Q
;
;General help text routine.
;--------------------------
HELP(CALL) ;
N HTEXT
N DIWF,DIWL,DIWR,IC
S DIWF="C75",DIWL=0,DIWR=75
;
I CALL=1 D
.S HTEXT(1)="Enter Yes to generate reminder dialog automatically for a"
.S HTEXT(2)="selected reminder. Enter No to create a reminder dialog"
.S HTEXT(3)="using the standard fileman edit."
I CALL=2 D
.S HTEXT(1)="Enter Yes to replace the existing reminder dialog."
.S HTEXT(2)="Enter No to return and enter an alternative dialog name."
I CALL=3 D
.S HTEXT(1)="For each FINDING ITEM on the reminder a dialog element"
.S HTEXT(2)="will be created. A separate DIALOG ELEMENT is created for"
.S HTEXT(3)="each enabled RESOLUTION STATUS in the FINDING TYPE"
.S HTEXT(4)="PARAMETERS for this finding type. The dialog element is"
.S HTEXT(5)="unique for finding type, finding item name and resolution"
.S HTEXT(6)="status name."
.S HTEXT(7)="e.g. VM WEIGHT DONE will be generated for the finding item"
.S HTEXT(8)=" vitals measurement/weight."
.S HTEXT(9)=""
.S HTEXT(10)="Enter Yes to rebuild all dialog elements used by this"
.S HTEXT(11)="reminder overwriting any existing modifications."
.S HTEXT(12)=""
.S HTEXT(13)="Enter No to use existing dialog elements if they exist."
.S HTEXT(14)="New dialog elements will be created if they don't already"
.S HTEXT(15)="exist."
I CALL=4 D
.S HTEXT(1)="Enter Yes to create a dialog enabled for use in CPRS."
.S HTEXT(2)="Enter No to create a dialog disabled for CPRS."
I CALL=5 D
.S HTEXT(1)="If the source reminder is not linked to any other dialog"
.S HTEXT(2)="enter Yes to link the reminder to the generated dialog."
.S HTEXT(3)="Enter No if no link should be made."
I CALL=6 D
.S HTEXT(1)="Enter the name of the dialog. The default is the reminder"
.S HTEXT(2)="name. If the name of an existing dialog is specified the"
.S HTEXT(3)="option to override the existing dialog will be given."
K ^UTILITY($J,"W")
S IC=""
F S IC=$O(HTEXT(IC)) Q:IC="" D
. S X=HTEXT(IC)
. D ^DIWP
W !
S IC=0
F S IC=$O(^UTILITY($J,"W",0,IC)) Q:IC="" D
. W !,^UTILITY($J,"W",0,IC,0)
K ^UTILITY($J,"W")
W !
Q
PXRMDBLD ; SLC/PJH - Reminder Dialog Generation. ;05/13/2009
+1 ;;2.0;CLINICAL REMINDERS;**12**;Feb 04, 2005;Build 73
+2 ;
+3 ;Called from PXRMGEDT
+4 ;
START ;
+1 NEW ANS,DIC,DNAME,LIT,LIT1,MSG,NAME,REDO,REM,RLNK,RNAME,ORY
+2 NEW PXRMENAB,PXRMLINK,PXRMREPL,PXRMREM
+3 ;Prompt for auto or manual addition
+4 SET ANS=""
DO ASK(.ANS)
IF $DATA(DUOUT)!$DATA(DTOUT)
QUIT
+5 ;Auto
+6 IF ANS="Y"
DO AUTO
QUIT
+7 ;Manual
+8 IF ANS'="Y"
DO ADD^PXRMDEDT
END QUIT
+1 ;
+2 ;Called by protocol PXRM DIALOG ADD
+3 ;----------------------------------
ADD(PXRMITEM) ;
+1 NEW ANS,DNAME,DTOUT,DUOUT
+2 SET VALMBCK="R"
+3 WRITE IORESET
+4 WRITE !,PXRMHD
+5 SET DNAME=""
+6 DO ASK^PXRMDBLD(.ANS)
IF $DATA(DTOUT)!$DATA(DUOUT)
QUIT
+7 IF ANS="Y"
DO AUTOP(PXRMITEM)
+8 QUIT
+9 ;
+10 ;Ask autogenerate/manual
+11 ;-----------------------
ASK(YESNO) ;
+1 NEW X,Y,TEXT,DIR
+2 KILL DIROUT,DIRUT,DTOUT,DUOUT
+3 SET DIR(0)="YA0"
+4 SET DIR("A")="GENERATE DIALOG AUTOMATICALLY: "
+5 SET DIR("B")="N"
+6 SET DIR("?")="Enter Y or N. For detailed help type ??"
+7 SET DIR("??")=U_"D HELP^PXRMDBLD(1)"
+8 DO ^DIR
KILL DIR
+9 IF $DATA(DIROUT)
SET DTOUT=1
+10 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+11 SET YESNO=$EXTRACT(Y(0))
+12 QUIT
+13 ;
+14 ;Source reminder for auto-generate
+15 ;---------------------------------
AUTO SET DIC("A")="SELECT REMINDER TO GENERATE DIALOG FROM: "
+1 SET LIT1="You must select a reminder!"
+2 DO SEL(811.9,"AEQMZ",.PXRMREM)
+3 IF $DATA(DTOUT)!$DATA(DUOUT)
QUIT
+4 SET REM=$PIECE(PXRMREM(1),U)
SET DNAME=""
+5 ;Display related dialogs
+6 DO DISP(REM)
+7 ;Promt for type of generate
+8 DO AUTOP(REM)
+9 QUIT
+10 ;
+11 ;Autogenerate prompts
+12 ;--------------------
AUTOP(REM) ;
+1 SET RNAME=$PIECE($GET(^PXD(811.9,REM,0)),U)
+2 FOR
Begin DoDot:1
+3 NEW CONFIRM,X,Y,DIR,DA
+4 KILL DIROUT,DIRUT,DTOUT,DUOUT
+5 SET DIR(0)="F"_U_"3:40"_U_"K:(X?.N)!'(X'?1P.E) X"
+6 SET DIR("A")="ENTER A UNIQUE DIALOG NAME"
+7 SET DIR("B")=RNAME
+8 SET DIR("?")="Select a unique name for the generated dialog."
+9 SET DIR("??")=U_"D HELP^PXRMDBLD(6)"
+10 DO ^DIR
KILL DIR
+11 IF $DATA(DIROUT)
SET DTOUT=1
+12 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+13 IF Y[""""
DO EN^DDIOL(" name cannot contain quotes!")
QUIT
+14 IF $DATA(^PXRMD(801.41,"B",Y))
Begin DoDot:2
+15 DO CONFIRM(.CONFIRM,Y)
IF CONFIRM="Y"
Begin DoDot:3
+16 SET DA=$ORDER(^PXRMD(801.41,"B",Y,""))
+17 IF $PIECE($GET(^PXRMD(801.41,DA,0)),U,3)=""
Begin DoDot:4
+18 WRITE !!,"THE CURRENT DIALOG IS ENABLED PLEASE DISABLE IT BEFORE "
+19 WRITE "CONTINING."
HANG 2
SET DTOUT=1
QUIT
End DoDot:4
IF $GET(DTOUT)=1
QUIT
End DoDot:3
IF $GET(DTOUT)=1
QUIT
+20 IF '$$OVER(Y)
SET DTOUT=1
QUIT
+21 SET Y=$$NAME^PXRMDCPY(DA,Y)
+22 ;If this is the linked reminder clear it
+23 IF $PIECE($GET(^PXD(811.9,REM,51)),U)=$GET(DA)
SET $PIECE(^PXD(811.9,REM,51),U)=""
End DoDot:2
IF $GET(DTOUT)=1
QUIT
+24 ;Option to LINK DIALOG to REMINDER if reminder is not linked already
+25 SET RLNK=$PIECE($GET(^PXD(811.9,REM,51)),U)
SET PXRMLINK=0
+26 IF 'RLNK
DO LINK(.PXRMLINK)
IF $DATA(DTOUT)!$DATA(DUOUT)
QUIT
+27 ;Option to enable dialog
+28 DO ENABLE(.PXRMENAB)
IF $DATA(DTOUT)!$DATA(DUOUT)
QUIT
+29 ;Option to replace existing dialog elements
+30 DO REPL(.PXRMREPL)
IF $DATA(DTOUT)!$DATA(DUOUT)
QUIT
+31 ;Use name entered
+32 SET DNAME=Y
End DoDot:1
IF $DATA(DUOUT)!$DATA(DTOUT)!(DNAME]"")
QUIT
+33 ;
+34 IF $DATA(DUOUT)!$DATA(DTOUT)
QUIT
+35 ;Build dialog
+36 NEW CHECK
DO BUILD^PXRMDBL1(REM,DNAME,.CHECK)
+37 DO FINDCHCK(DNAME)
+38 QUIT
+39 ;
+40 ;Display dialogs autogenerated from this reminder
+41 ;------------------------------------------------
DISP(RIEN) ;
+1 NEW ARRAY,DSUB,FIRST
+2 ;Get Autogenerated dialogs
+3 SET FIRST=1
SET DSUB=""
+4 FOR
SET DSUB=$ORDER(^PXRMD(801.41,"AG",RIEN,DSUB))
IF 'DSUB
QUIT
Begin DoDot:1
+5 IF FIRST
WRITE !!,"Associated Dialogs:"
SET FIRST=0
+6 WRITE ?25,$PIECE($GET(^PXRMD(801.41,DSUB,0)),U),!
End DoDot:1
+7 QUIT
+8 ;
+9 ;Disable generated dialog
+10 ;------------------------
ENABLE(YESNO) ;
+1 NEW X,Y,TEXT,DIR
+2 KILL DIROUT,DIRUT,DTOUT,DUOUT
+3 SET DIR(0)="YA0"
+4 SET DIR("A")="ENABLE DIALOG: "
+5 SET DIR("B")="NO"
+6 SET DIR("?")="Enter Y or N. For detailed help type ??"
+7 SET DIR("??")=U_"D HELP^PXRMDBLD(4)"
+8 DO ^DIR
KILL DIR
+9 IF $DATA(DIROUT)
SET DTOUT=1
+10 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+11 SET YESNO=$EXTRACT(Y(0))
+12 QUIT
+13 ;
FINDCHCK(DNAME) ;
+1 WRITE !!,"Scanning dialog "_DNAME_" for inactived findings."
+2 NEW CNT,DIALIEN,DIEN,DLGARR,ERRCNT,ERRMSG,FAIL,NAME,STDFILES
+3 NEW STRTEXT,TEXT,TYPE,WRITMSG
+4 ;
+5 SET WRITMSG=0
+6 DO DIALDSAR^PXRMFRPT(.STDFILES)
IF '$DATA(STDFILES)
QUIT
+7 SET DIALIEN=$ORDER(^PXRMD(801.41,"B",DNAME,""))
IF DIALIEN'>0
QUIT
+8 SET ERRCNT=0
SET CNT=0
SET FAIL=0
+9 SET STRTEXT(1)="Dialog "_DNAME_" contains errors. Review the dialog before using it in CPRS."
+10 DO BUILDMSG^PXRMDLRP(.STRTEXT,.CNT,.TEXT)
+11 ;
+12 ;build array of dialog items
+13 DO DITEMAR^PXRMDLRP(DIALIEN,.DLGARR,.ERRCNT,.ERRMSG,.FAIL)
+14 ;
+15 ;bad data format in the dialog
+16 IF FAIL="F"
Begin DoDot:1
+17 DO BUILDMSG^PXRMDLRP(.ERRMSG,.CNT,.TEXT)
+18 DO EN^DDIOL(.TEXT)
+19 HANG 2
End DoDot:1
QUIT
+20 ;
+21 ;scan for inactive finding items, checks against standardized files
+22 SET DIEN=0
FOR
SET DIEN=$ORDER(DLGARR(DIEN))
IF DIEN'>0
QUIT
Begin DoDot:1
+23 KILL ERRMSG
+24 IF $$DISABCHK^PXRMDLG6(DIEN,.STDFILES,.ERRMSG)=1
QUIT
+25 ;
+26 SET NAME=$PIECE($GET(^PXRMD(801.41,DIEN,0)),U)
+27 SET TYPE=$$EXTERNAL^DILFD(801.41,4,"",$PIECE($GET(^PXRMD(801.41,DIEN,0)),U,4))
+28 SET $PIECE(^PXRMD(801.41,DIEN,0),U,3)=1
+29 SET STRTEXT(1)="Dialog "_TYPE_" "_NAME_" has been marked disable for the following reason(s)."
+30 DO BUILDMSG^PXRMDLRP(.STRTEXT,.CNT,.TEXT)
+31 DO BUILDMSG^PXRMDLRP(.ERRMSG,.CNT,.TEXT)
+32 SET WRITMSG=1
End DoDot:1
+33 ;
+34 IF WRITMSG=1
DO EN^DDIOL(.TEXT)
HANG 2
+35 QUIT
+36 ;Link dialog to reminder
+37 ;-----------------------
LINK(YESNO) ;
+1 NEW X,Y,TEXT,DIR
+2 KILL DIROUT,DIRUT,DTOUT,DUOUT
+3 SET DIR(0)="YA0"
+4 SET DIR("A")="LINK DIALOG TO REMINDER: "
+5 SET DIR("B")="YES"
+6 SET DIR("?")="Enter Y or N. For detailed help type ??"
+7 SET DIR("??")=U_"D HELP^PXRMDBLD(5)"
+8 DO ^DIR
KILL DIR
+9 IF $DATA(DIROUT)
SET DTOUT=1
+10 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+11 SET YESNO=$EXTRACT(Y(0))
+12 QUIT
+13 ;
+14 ;Option to override existing dialog
+15 ;----------------------------------
OVER(DNAME) ;
+1 NEW DIR,X,Y
+2 SET DIR(0)="Y"
SET DIR("B")="NO"
+3 SET DIR("A")="OVERWRITE EXISTING REMINDER DIALOG "
+4 SET DIR("?")="Enter Y or N. For detailed help type ??"
+5 SET DIR("??")=U_"D HELP^PXRMDBLD(2)"
+6 DO ^DIR
KILL DIR
+7 IF $DATA(DIROUT)
SET DTOUT=1
+8 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT 0
+9 QUIT $SELECT(Y(0)="YES":1,1:0)
+10 ;
+11 ;Option to replace existing dialog elements
+12 ;------------------------------------------
REPL(INP) ;
+1 NEW DIR,X,Y
+2 SET DIR(0)="Y"
SET DIR("B")="NO"
+3 SET DIR("A")="REPLACE ANY EXISTING DIALOG ELEMENTS"
+4 SET DIR("?")="Enter Y or N. For detailed help type ??"
+5 SET DIR("??")=U_"D HELP^PXRMDBLD(3)"
+6 DO ^DIR
KILL DIR
+7 IF $DATA(DIROUT)
SET DTOUT=1
+8 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+9 SET INP=$SELECT(Y(0)="YES":1,1:0)
+10 QUIT
+11 ;
+12 ;Reminder selection
+13 ;------------------
SEL(FILE,MODE,ARRAY) ;
+1 NEW X,Y,CNT
+2 KILL DIROUT,DIRUT,DTOUT,DUOUT
+3 SET CNT=0
+4 WRITE !
+5 FOR
Begin DoDot:1
+6 SET DIC=FILE
SET DIC(0)=MODE
+7 DO ^DIC
+8 IF X=(U_U)
SET DTOUT=1
+9 IF '$DATA(DTOUT)
IF ('$DATA(DUOUT))
Begin DoDot:2
+10 IF +Y'=-1
Begin DoDot:3
+11 SET CNT=CNT+1
SET ARRAY(CNT)=Y_U_Y(0,0)_U_$PIECE(Y(0),U,3)
End DoDot:3
QUIT
+12 IF CNT=0
WRITE !,LIT1
End DoDot:2
+13 KILL DIC
End DoDot:1
IF $DATA(DTOUT)
QUIT
IF $DATA(DUOUT)
QUIT
IF CNT>0
QUIT
IF (Y=-1)&(CNT>0)
QUIT
+14 QUIT
+15 ;
CONFIRM(YESNO,NAME) ;
+1 NEW X,Y,TEXT,DIR
+2 KILL DIROUT,DIRUT,DTOUT,DUOUT
+3 SET DIR(0)="YA0"
+4 SET DIR("A")="YOU ARE ABOUT TO OVERWRITE THE EXISTING DIALOG "_NAME_" CONTINUE? "
+5 SET DIR("B")="N"
+6 SET DIR("?")="Enter Y or N. For detailed help type ??"
+7 SET DIR("??")=U_"D HELP^PXRMDBLD(1)"
+8 DO ^DIR
KILL DIR
+9 IF $DATA(DIROUT)
SET DTOUT=1
+10 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+11 SET YESNO=$EXTRACT(Y(0))
+12 QUIT
+13 ;
+14 ;General help text routine.
+15 ;--------------------------
HELP(CALL) ;
+1 NEW HTEXT
+2 NEW DIWF,DIWL,DIWR,IC
+3 SET DIWF="C75"
SET DIWL=0
SET DIWR=75
+4 ;
+5 IF CALL=1
Begin DoDot:1
+6 SET HTEXT(1)="Enter Yes to generate reminder dialog automatically for a"
+7 SET HTEXT(2)="selected reminder. Enter No to create a reminder dialog"
+8 SET HTEXT(3)="using the standard fileman edit."
End DoDot:1
+9 IF CALL=2
Begin DoDot:1
+10 SET HTEXT(1)="Enter Yes to replace the existing reminder dialog."
+11 SET HTEXT(2)="Enter No to return and enter an alternative dialog name."
End DoDot:1
+12 IF CALL=3
Begin DoDot:1
+13 SET HTEXT(1)="For each FINDING ITEM on the reminder a dialog element"
+14 SET HTEXT(2)="will be created. A separate DIALOG ELEMENT is created for"
+15 SET HTEXT(3)="each enabled RESOLUTION STATUS in the FINDING TYPE"
+16 SET HTEXT(4)="PARAMETERS for this finding type. The dialog element is"
+17 SET HTEXT(5)="unique for finding type, finding item name and resolution"
+18 SET HTEXT(6)="status name."
+19 SET HTEXT(7)="e.g. VM WEIGHT DONE will be generated for the finding item"
+20 SET HTEXT(8)=" vitals measurement/weight."
+21 SET HTEXT(9)=""
+22 SET HTEXT(10)="Enter Yes to rebuild all dialog elements used by this"
+23 SET HTEXT(11)="reminder overwriting any existing modifications."
+24 SET HTEXT(12)=""
+25 SET HTEXT(13)="Enter No to use existing dialog elements if they exist."
+26 SET HTEXT(14)="New dialog elements will be created if they don't already"
+27 SET HTEXT(15)="exist."
End DoDot:1
+28 IF CALL=4
Begin DoDot:1
+29 SET HTEXT(1)="Enter Yes to create a dialog enabled for use in CPRS."
+30 SET HTEXT(2)="Enter No to create a dialog disabled for CPRS."
End DoDot:1
+31 IF CALL=5
Begin DoDot:1
+32 SET HTEXT(1)="If the source reminder is not linked to any other dialog"
+33 SET HTEXT(2)="enter Yes to link the reminder to the generated dialog."
+34 SET HTEXT(3)="Enter No if no link should be made."
End DoDot:1
+35 IF CALL=6
Begin DoDot:1
+36 SET HTEXT(1)="Enter the name of the dialog. The default is the reminder"
+37 SET HTEXT(2)="name. If the name of an existing dialog is specified the"
+38 SET HTEXT(3)="option to override the existing dialog will be given."
End DoDot:1
+39 KILL ^UTILITY($JOB,"W")
+40 SET IC=""
+41 FOR
SET IC=$ORDER(HTEXT(IC))
IF IC=""
QUIT
Begin DoDot:1
+42 SET X=HTEXT(IC)
+43 DO ^DIWP
End DoDot:1
+44 WRITE !
+45 SET IC=0
+46 FOR
SET IC=$ORDER(^UTILITY($JOB,"W",0,IC))
IF IC=""
QUIT
Begin DoDot:1
+47 WRITE !,^UTILITY($JOB,"W",0,IC,0)
End DoDot:1
+48 KILL ^UTILITY($JOB,"W")
+49 WRITE !
+50 QUIT