Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PXRMDLLA

PXRMDLLA.m

Go to the documentation of this file.
PXRMDLLA ;SLC/PJH - REMINDER DIALOG LOADER ;Mar 21, 2022@15:21:03
 ;;2.0;CLINICAL REMINDERS;**6,12,18,26,45,65**;Feb 04, 2005;Build 438
 ;   ICR       API/FILE
 ;  3112       ^GMRD(120.51,
 ;  2263       $$GET^XPAR
 ;
 N DONE,FILE,FIELD,FIND,FINDS,HASVALUE,I,LINK,LINKITEM,LINKTYPE,LINKFUNC,LINKACT
 N NODE,NUM,PAT,PKG,OVALUE,PROMPT,PMPTTYPE,RESULT,RTN,SUB,VAL
 S NUM=0 F  S NUM=$O(^PXRMD(801.41,DITEM,10,NUM)) Q:NUM'>0  D
 . S LINK=$G(^PXRMD(801.41,DITEM,10,NUM,"LINK"))
 . I LINK=""!(+LINK'>0)!(+$P(LINK,U,2)'=1) Q
 . D GETLINK^PXRMDLLB(+LINK,.LINKITEM,.LINKTYPE,.LINKFUNC,.LINKACT)
 . I $P(LINKACT,U)'="" Q
 . I LINKTYPE="ELEMENT" Q
 . S FIND=$P($G(^PXRMD(801.41,+LINKITEM,1)),U,5)
 . I FIND'[801.46 Q
 . S NODE=$G(^PXRMD(801.46,+FIND,0))
 . S PMPTTYPE=$P($G(^PXRMD(801.46,+FIND,2)),U) I PMPTTYPE'>0 Q
 . I $P($G(^PXRMD(801.42,PMPTTYPE,0)),U)'=LINKTYPE Q
 . S PKG=$P(NODE,U,2)
 . ;S PKG=$$EXTERNAL^DILFD(801.46,2,"",$P(NODE,U,2))
 . S FILE=$P(NODE,U,3),FIELD=$P($G(^PXRMD(801.46,+FIND,2)),U,2)
 . ;I $D(^TMP($J,"PXRM GEN FINDING",DLGIEN,PKG,FILE,FIELD)) Q
 . I $G(^TMP($J,"PXRM GEN FINDING",DLGIEN,PKG,FILE,FIELD,ID))'="" Q
 . S OVALUE=""
 . S RTN=$P($G(^PXRMD(801.47,LINKFUNC,0)),U,2,3) Q:$P(RTN,U)=""  Q:$P(RTN,U,2)=""
 . S NUM=0 F  S NUM=$O(^PXRMD(801.48,+LINK,2,NUM)) Q:NUM'>0  D
 . .S NODE=$G(^PXRMD(801.48,+LINK,2,+NUM,0)),SUB=$P(NODE,U),VAL=$P(NODE,U,2) Q:SUB=""  Q:VAL=""
 . .S INPUTS(SUB)=VAL
 . S PAT=0
 . S TEMP="S RET=$$"_RTN_"(.RESULT,PAT,VALUE,OVALUE,.INPUTS)"
 . X TEMP
 . I LINKFUNC>0,RESULT="" Q
 . S ^TMP($J,"PXRM GEN FINDING",DLGIEN,PKG,FILE,FIELD,ID)=RESULT
 Q
 ;
FREC(DFIEN,DFTYP,DITEM,PTDEF,DLGIEN,NDATA) ;Build type 3 record
 N CSARRAY,CSCNT
 N ARRAY,DATANODE,DCAP,DGUI,DFN,NODE,PRINT,OINAME,STATUS,START,STOP
 S PRINT=$S($P($G(^PXRMD(801.41,DLGIEN,"DATA")),U,3)=1:1,1:0)
 ;Dialog type/text and resolution
 S DNAM=$$NAME(DFIEN,DFTYP)
 ;Translate vitals ien to PCE code - This will need a DBIA
 S DCOD=""
 I DPCE="VIT" D
 .S DFIEN=$$GET1^DIQ(120.51,DFIEN,7,"E")
 .;Vitals Caption
 .S DVIT=$P($G(^PXRMD(801.41,DITEM,2)),U,4)
 I DFTYP]"" D
 .S OCNT=OCNT+1
 .S ORY(OCNT)=3_U_DITEM_U_U_DPCE_U_DEXC_U_DFIEN_U_$G(DCOD)_U_DNAM_U_U_DVIT
 .;Get order type for orderable items
 .;DBIA #3110
 .S:DPCE="Q" $P(ORY(OCNT),U,11)=$P($G(^ORD(101.41,DFIEN,0)),U,4)
 .;If mental health check if a GAF score and if MH test is required
 .I DPCE="MH",DFIEN D
 ..;DBIA #5044
 ..I $P($G(^YTT(601.71,DFIEN,0)),U)="GAF" S $P(ORY(OCNT),U,12)=1
 ..;Check to see if the MH test is required
 ..S $P(ORY(OCNT),U,13)=+$P($G(^PXRMD(801.41,DITEM,0)),U,18)
 ..I $P(ORY(OCNT),U,13)=2,$$PATCH^XPDUTL("OR*3.0*243")=0 S $P(ORY(OCNT),U,13)=1
 .;
 .I DPCE="IMM"!(DPCE="SK") D
 ..S DCAP=$P($G(^PXRMD(801.41,DITEM,2)),U,4)
 ..;S $P(ORY(OCNT),U,10)=DCAP
 ..S $P(ORY(OCNT),U,10)=$$CTRL^XMXUTIL1(DCAP)
 ..S $P(ORY(OCNT),U,13)=+$P($G(^PXRMD(801.41,DITEM,"DATA")),U,4)
 .S DATANODE=$G(^PXRMD(801.41,DITEM,"DATA"))
 .;S $P(ORY(OCNT),U,16)=+$P(DATANODE,U,2)
 .S $P(ORY(OCNT),U,16)=+NDATA
 .S $P(ORY(OCNT),U,17)=$P(DATANODE,U)
 .S $P(ORY(OCNT),U,18)=$S($P(^PXRMD(801.41,DITEM,0),U,16)="IMMREAD":1,1:0)
 .;
 .I DPCE="GFIND" D
 ..N FILE,FIELD,ID,NODE,PKGNAME,VALUE,MULVAL,EXIT
 ..;N CID,NDATA,TYPE,VALUE,X
 ..N CID,TYPE,VALUE,X
 ..S NODE(0)=$G(^PXRMD(801.46,DFIEN,0)),NODE(2)=$G(^(2)),NODE(3)=$G(^(3))
 ..S PKG=$P(NODE(0),U,2)
 ..;S PKGNAME=$$EXTERNAL^DILFD(801.46,2,"",$P(NODE(0),U,2))
 ..S FILE=$P(NODE(0),U,3),MULVAL=$P(NODE(3),U)
 ..;S NDATA=+$P(DATANODE,U,2)
 ..F X=1,2 D
 ...S NODE(X)=$G(^PXRMD(801.46,DFIEN,X))
 ...S FIELD=$P(NODE(X),U,2)
 ...I X=1 S VALUE=$S('NDATA:$P(NODE(X),U),1:"")
 ...I FIELD="" Q
 ...I MULVAL="M",'NDATA D
 ....S ID="" F  S ID=$O(^TMP($J,"PXRM GEN FINDING",DLGIEN,PKG,FILE,FIELD,ID)) Q:ID=""!($G(EXIT))  D
 .....I $G(^TMP($J,"PXRM GEN FINDING",DLGIEN,PKG,FILE,FIELD,ID))=VALUE S EXIT=ID
 ....I $G(EXIT) S ID=EXIT
 ...I MULVAL="S",'NDATA S ID=$O(^TMP($J,"PXRM GEN FINDING",DLGIEN,PKG,FILE,FIELD,""))
 ...;Exit Process: If mismatched values on edits
 ...I $G(ID)'="",X=1,$P(NODE(X),U)'="",$P(NODE(X),U)'=$G(^TMP($J,"PXRM GEN FINDING",DLGIEN,PKG,FILE,FIELD,ID)) S $P(ORY(OCNT),U,14)=$G(ID) Q
 ...;Exit Process: If new values on edits
 ...I $G(ID)="",X=1,VALUE'="" S $P(ORY(OCNT),U,14)=$G(^TMP($J,"PXRM GEN FINDING",DLGIEN,PKG,FILE)) Q
 ...;Exit Process: New record
 ...I $G(ID)="",VALUE="",X=1 Q
 ...I $G(ID)="",X=2 Q
 ...;
 ...S $P(ORY(OCNT),U,14)=$G(ID)
 ...S $P(ORY(OCNT),U,15)=$S($G(ID)'="":$G(^TMP($J,"PXRM GEN FINDING",DLGIEN,PKG,FILE,FIELD,ID)),1:VALUE)
 ...;I $D(^TMP($J,"PXRM GEN FINDING",DLGIEN,PKG,FILE))=11 S ^TMP($J,"PXRM GEN FINDING",DLGIEN,PKG,FILE,FIELD)=$G(ID)
 ...;Set default prompt values to be accessed in PROTH line tag
 ...I $P(NODE(2),U)>0,'NDATA,$G(ID)'="" D
 ....S DGUI=$P($G(^PXRMD(801.42,$P(NODE(2),U),0)),U)
 ....I DGUI="GF_PRINT BUTTON",PRINT=0 Q
 ....;S PTDEF(DGUI)=$P(ORY(OCNT),U,15)
 ....S PTDEF(DGUI)=$G(^TMP($J,"PXRM GEN FINDING",DLGIEN,PKG,FILE,FIELD,ID))
 ...;
 ...I $P(ORY(OCNT),U,15)'="",$G(ID)'="" D EXECLINK(DITEM,$P(ORY(OCNT),U,15),ID)
 Q
 ;
GUI(IEN) ;Work out prompt type for PCE
 Q:IEN="" ""
 N SUB S SUB=$P($G(^PXRMD(801.41,IEN,46)),U)
 Q:'SUB ""
 Q $P($G(^PXRMD(801.42,SUB,0)),U)
 ;
LOAD(DITEM,DCUR,DTTYP,DLGIEN,NDATA) ;Load dialog questions into array
 N DARRAY,DCOD,DEXC,DFIND,DFIEN,DFTYP,DNAM,DPCE,DRES,DSEQ,DSUB,DTYP,OCNT
 N DVIT,MAGNODE,NODE,CNT,IDENT,TAXBUILT,TAXNODE,TDX,TPR,TSC,TSEL
 N PTDEF
 N RFVAL,ISIMM,ISSKT
 I +$G(DITEM)'>0 Q
 I $E($G(DLGIEN),1)="R" S DLGIEN=$P($G(^PXD(811.9,$P($G(DLGIEN),"R",2),51)),U)
 E  S DLGIEN=$G(DLGIEN)
 S (ISIMM,ISSKT)=0
 ;DBIA #3110    OR(101.41
 ;
 ;Build list of PCE codes
 S DARRAY("AUTTEDT(")="PED"
 S DARRAY("AUTTEXAM(")="XAM"
 S DARRAY("AUTTHF(")="HF"
 S DARRAY("AUTTIMM(")="IMM"
 S DARRAY("AUTTSK(")="SK"
 ;
 S DARRAY("GMRD(120.51,")="VIT"
 S DARRAY("ORD(101.41,")="Q"
 S DARRAY("YTT(601.71,")="MH"
 ;
 S DARRAY("ICD9(")="POV"
 S DARRAY("ICPT(")="CPT"
 S DARRAY("WV(790.404,")="WH"
 S DARRAY("WV(790.1,")="WHR"
 S DARRAY("PXRMD(801.46,")="GFIND"
 ;
 S DARRAY("PXD(811.2,")="T"
 ;
 ;Get the dialog element
 S OCNT=0
 N TERMNODE,TERMSTAT,TERMOUT
 S DTYP=$P($G(^PXRMD(801.41,DITEM,0)),U,4)
 ;Finding detail
 S DRES=$P($G(^PXRMD(801.41,DITEM,1)),U,3)
 S DFIND=$P($G(^PXRMD(801.41,DITEM,1)),U,5)
 ;check for WH finding
 I $P($G(^PXRMD(801.41,DITEM,0)),U,16)["WH" S DFIND=$G(WHFIND) K WHFIND
 ;
 S DFIEN=$P(DFIND,";"),DFTYP=$P(DFIND,";",2)
 S MAGNODE=""
 S DPCE="",DVIT="" I DFTYP'="" S DPCE=$G(DARRAY(DFTYP))
 ;Exclude from P/N
 S DEXC=$P($G(^PXRMD(801.41,DITEM,2)),U,3)
 ;
 ;Non taxonomy codes (3 - finding record)
 I DPCE="IMM" S ISIMM=1
 I DPCE="SK" S ISSKT=1
 S MAGNODE=$$GETMAG^PXRMDLG6(DFIEN,DFTYP)
 I DPCE'="T" D
 .D FREC(DFIEN,DFTYP,DITEM,.PTDEF,DLGIEN,.NDATA)
 .;S MAGNODE=$$GETMAG^PXRMDLG6(DFIEN,DFTYP)
 ;
 ;Taxonomy codes need expanding (3 - finding record)
 I DPCE="T" D
 .S TAXBUILT=0
 .I $G(DTTYP)="" D
 ..S TAXNODE=$G(^PXRMD(801.41,DITEM,"TAX"))
 ..S TSEL=$P(TAXNODE,U) I TSEL="N" Q
 ..S TDX=$$TOK^PXRMDTAX(DFIEN,"POV")
 ..S TPR=$$TOK^PXRMDTAX(DFIEN,"CPT")
 ..S TSC=$$TOK^PXRMDTAX(DFIEN,"SC")
 ..I TSEL="D" S DTTYP="POV",TAXBUILT=1 Q
 ..I TSEL="P" S DTTYP="CPT",TAXBUILT=1 Q
 ..I TSEL="S" S DTTYP="SC",TAXBUILT=1 Q
 ..I TDX,TPR,TSC Q
 ..I TDX,'TPR,'TSC S DTTYP="POV",TAXBUILT=1 Q
 ..I TPR,'TDX,'TSC S DTTYP="CPT",TAXBUILT=1 Q
 ..I TSC,'TDX,'TPR S DTTYP="SC",TAXBUILT=1 Q
 .I $G(DTTYP)'="" D EXP^PXRMDLLB(DITEM,DFIEN,DCUR,DTTYP,5,NDATA) I TAXBUILT=0 Q
 .D EXPTAX^PXRMDLLB(DITEM,DFIEN,DCUR,NDATA)
 ;
 ;AGP BEGIN MOVE OF ADD FINDINGS
 ;Additional findings
 N FASUB
 S FASUB=0
 F  S FASUB=$O(^PXRMD(801.41,DITEM,3,FASUB)) Q:'FASUB  D
 .;new DPCE here to keep the dialog prompts based off the finding item PCE value
 .N DPCE
 .S DFIND=$P($G(^PXRMD(801.41,DITEM,3,FASUB,0)),U)
 .S DFIEN=$P(DFIND,";"),DFTYP=$P(DFIND,";",2) Q:DFTYP=""  Q:DFIEN=""
 .S DVIT="",DPCE=$G(DARRAY(DFTYP))
 .I DPCE'="",DPCE'="T" D FREC(DFIEN,DFTYP,DITEM,.PTDEF,DLGIEN,NDATA)
 .I DPCE'="",DPCE="T" D
 ..D EXP^PXRMDLLB(DITEM,DFIEN,DCUR,"CPT",3,NDATA)
 ..D EXP^PXRMDLLB(DITEM,DFIEN,DCUR,"POV",3,NDATA)
 ..D EXP^PXRMDLLB(DITEM,DFIEN,DCUR,"SC",3,NDATA)
 ;;AGP END MOVE OF ADD FINDINGS
 ;
 ;Prompt details (4 - prompt records)
 N ARRAY,DTITLE,DREQ,DSEQ,DSSEQ,DSUB,DTYP
 ;If not a taxonomy get prompts from dialog file
 ;I DPCE'="T",'HASVIMM D PROTH(DITEM,"","",.PTDEF,DLGIEN,MAGNODE)
 I DPCE'="T",'ISSKT D PROTH(DITEM,"","",.PTDEF,DLGIEN,MAGNODE,ISIMM)
 ;Check for MST findings
 I (DPCE'="T"),(DFTYP]"") D MST^PXRMDLLB(DFTYP,DFIEN)
 ;If taxonomy use finding parameters (CPT/POV)
 I DPCE="T" D
 .I $G(DTTYP)="",$G(^PXRMD(801.41,DITEM,"TAX"))'="N" Q
 .I MAGNODE'="" D  Q
 ..I $G(DTTYP)'="",$G(DCUR)'="" D PROTH(DITEM,DTTYP,DCUR,.PTDEF,DLGIEN,MAGNODE,0) Q
 ..D PROTH(DITEM,"","",.PTDEF,DLGIEN,MAGNODE,0)
 .I $D(^PXRMD(801.41,DITEM,10,"B"))>0 D  Q
 ..I $G(DTTYP)'="",$G(DCUR)'="" D PROTH(DITEM,DTTYP,DCUR,.PTDEF,DLGIEN,MAGNODE,0) Q
 ..D PROTH(DITEM,"","",.PTDEF,DLGIEN,MAGNODE,0)
 ;Return array of type 4 records
 S DSEQ=""
 F  S DSEQ=$O(ARRAY(DSEQ)) Q:'DSEQ  D
 .S OCNT=OCNT+1
 .S ORY(OCNT)=4_U_DITEM_U_DSEQ_U_ARRAY(DSEQ)
 .S DSSEQ=""
 .S $P(ORY(OCNT),U,20)=$G(NDATA)
 .F  S DSSEQ=$O(ARRAY(DSEQ,DSSEQ)) Q:'DSSEQ  D
 ..S OCNT=OCNT+1
 ..S ORY(OCNT)=4_U_DITEM_U_DSEQ_"."_DSSEQ_U_ARRAY(DSEQ,DSSEQ)
 ..S $P(ORY(OCNT),U,20)=$G(NDATA)
 ;
 ;Get progress note text if defined
 ;Build Alternate progress note text for taxonomies with more then one pick list.
 I DTTYP="" D:'DEXC PTXT(DITEM,.NDATA)
 ;Build Alternate progress note text for taxonomies with one pick list.
 I DPCE="T",DTTYP'="" D:'DEXC PTXT(DITEM,.NDATA)
 Q
 ;
 ;Returns item name
NAME(DFIEN,DFTYP) ;
 Q:DFTYP="" ""
 Q:DFIEN="" ""
 N NAME,FGLOB,POSN
 ;DBIA #4108
 I DFTYP="WV(790.404," S NAME=$P($G(^WV(790.404,DFIEN,0)),U) Q:NAME]"" NAME
 I DFTYP="WV(790.1," S NAME=$G(WHNAME) K WHNAME Q:NAME]"" NAME
 I DFTYP="PXRMD(801.46," S NAME=$P($G(^PXRMD(801.46,DFIEN,0)),U) Q:NAME]"" NAME
 S POSN=2
 S:DFTYP["AUTT" POSN=1 S:DFTYP["AUTTEDT" POSN=4 S:DFTYP["ICD" POSN=3
 S FGLOB=U_DFTYP_DFIEN_",0)",NAME=$P($G(@FGLOB),U,POSN)
 I (POSN>1),NAME="" S NAME=$P($G(@FGLOB),U)
 I NAME="" S NAME=DFIEN
 Q NAME
 ;
PROTH(IEN,DTTYP,DCUR,PTDEF,DLGIEN,MAGNODE,ISIMM) ; Additional prompts defined in 801.41
 N CANSHOW,DDATA,DDEF,DIEN,DEXC,DGUI,DNAME,DOVR,DREQ,DSEQ,DSNL,DSUB,DFTEXT
 N DTXT,DTYP,EVENT,NODE,PRINT,PRINTTYP,SRV,TAX,DVALID
 N LINK,LINKITEM,LINKTYPE,LINKFUNC,LINKACT
 I MAGNODE'="" D
 .S DSEQ=$O(^PXRMD(801.41,IEN,10,"B",""),-1)+1
 .S ARRAY(DSEQ)="UCUM"_U_0_U_""_U_"P"_U_$P(MAGNODE,U,5)_U_1_U_1
 .S $P(ARRAY(DSEQ),U,27)=MAGNODE
 S NODE=$G(^PXRMD(801.41,DLGIEN,"DATA"))
 S CANSHOW=$S($P(NODE,U,3)="D":0,$P(NODE,U,3)="":0,1:1)
 S PRINTTYP=$P(NODE,U,3)
 I CANSHOW=0!(PRINTTYP="S") S PRINTTYP="N"
 ;
 S DSEQ=0
 F  S DSEQ=$O(^PXRMD(801.41,IEN,10,"B",DSEQ)) Q:'DSEQ  D
 .;Get prompts in sequence
 .S DSUB=$O(^PXRMD(801.41,IEN,10,"B",DSEQ,"")) Q:'DSUB
 .S NODE=$G(^PXRMD(801.41,IEN,10,DSUB,0))
 .S EVENT=$S($P(NODE,U,14)'="":$P(NODE,U,14),1:"C")
 .;Quit is prompt is marked disable
 .I $P(NODE,U,13)=1 Q
 .K LINK,LINKITEM,LINKTYPE,LINKFUNC,LINKACT
 .S LINK=$G(^PXRMD(801.41,IEN,10,DSUB,"LINK")) I +LINK>0 D GETLINK^PXRMDLLB(+LINK,.LINKITEM,.LINKTYPE,.LINKFUNC,.LINKACT)
 .;Prompt ien
 .S DIEN=$P($G(^PXRMD(801.41,IEN,10,DSUB,0)),U,2) Q:'DIEN
 .;Ignore disabled components, and those that are not prompts
 .I $$ISDISAB^PXRMDLL(DIEN)=1 Q
 .Q:"PF"'[$P($G(^PXRMD(801.41,DIEN,0)),U,4)
 .;I ISIMM,$P($G(^PXRMD(801.41,DIEN,0)),U,4)'="F" Q
 .;check to make sure prompt is apporiate for the taxonomy encounter type
 .I $G(DTTYP)'="",$G(DCUR)'="",$$TAXPRMPT(DIEN,DTTYP,DCUR)=0 Q
 .;Set defaults to null
 .S DDEF="",DEXC="",DREQ="",DSNL=""
 .;Prompt name and GUI process (quit if null)
 .S DNAME=$P($G(^PXRMD(801.41,DIEN,0)),U),DGUI=$$GUI(DIEN)
 .;I ISIMM,$P($G(^PXRMD(801.41,DIEN,0)),U,4)'="F" Q
 .I ISIMM,DGUI'="IMM_SER" Q
 .I DGUI="GF_PRINT",CANSHOW=0 Q
 .I $G(DGUI)="WH_NOT_PURP" D
 ..S SRV=$$GET1^DIQ(200,DUZ,29,"I")
 ..S PRINTTYP=$$GET^XPAR($G(DUZ)_";VA(200,^SRV.`"_+$G(SRV)_"^DIV^SYS","PXRM WH PRINT NOW",1,"I")
 .;I DGUI="GF_VIEW",$G(PRINTTYP)="" S PRINT=$$GET^XPAR($G(DUZ)_";VA(200,^SRV.`"_+$G(SRV)_"^DIV^SYS","PXRM PRINT/VIEW BUTTON ACTION",1,"I")
 .I DGUI="GF_VIEW" S PRINTTYP="N"
 .;Type Prompt or Forced
 .S DTYP=$P($G(^PXRMD(801.41,DIEN,0)),U,4)
 .I "PF"[DTYP D
 ..;Required/Prompt caption
 ..S DDATA=$G(^PXRMD(801.41,DIEN,2)),DTXT=$P(DDATA,U,4)
 ..;Default value or forced value
 ..S:DTYP="P" DDEF=$P(DDATA,U) S:DTYP="F" DDEF=$P(DDATA,U,2)
 ..I ISIMM,DGUI="IMM_SER",DTYP="P" S DTYP="F"
 ..;Override caption/start new line/exclude PN from dialog file
 ..S DDATA=$G(^PXRMD(801.41,IEN,10,DSUB,0)),DREQ=$P(DDATA,U,9)
 ..S DOVR=$P(DDATA,U,6),DSNL=$P(DDATA,U,7),DEXC=$P(DDATA,U,8)
 ..S DNAME=DTXT I DOVR]"" S DNAME=DOVR
 ..;Convert date to fileman format
 ..I DGUI="VST_DATE",DDEF["T" S DDEF=$$DT^XLFDT()
 .I $G(DGUI)'="",$G(PTDEF(DGUI))'="" S DDEF=PTDEF(DGUI)
 .;I $G(RFVAL)'="" S DDEF=RFVAL K RFVAL
 .I DGUI="DATE" S DVALID=$P(NODE,U,11)
 .S ARRAY(DSEQ)=DGUI_U_DEXC_U_DDEF_U_DTYP_U_DNAME_U_DSNL_U_DREQ_U_$G(DFTEXT)_U_$G(PRINTTYP)_U_$G(LINKITEM)_U_$G(LINKTYPE)_U_$G(DVALID)
 .S $P(ARRAY(DSEQ),U,25)=$P($G(LINKACT),U,2)
 .S $P(ARRAY(DSEQ),U,26)=EVENT
 .;
 .I DGUI="UCUM",MAGNODE'="" S $P(ARRAY(DSEQ),U,27)=$P(MAGNODE,U,1,4)_U_$P(MAGNODE,U,6)
 .;the following section add a comment prompt to the WH review of result
 .;section of the reminder dialog
 .I DGUI="WH_PAP_RESULT",DFTYP="WV(790.1,",DTYP="P" D
 ..N WHCNT,WHFLAG,WHNUM,WHLOOP
 ..S WHNUM=DSEQ+1,WHLOOP=0
 ..F WHLOOP=0 D
 ...S (WHCNT,WHFLAG)=0
 ...F  S WHCNT=$O(^PXRMD(801.41,IEN,10,"B",WHCNT)) Q:'WHCNT!(WHFLAG=1)  D
 ....I WHCNT=WHNUM S WHFLAG=1,WHNUM=WHNUM+1
 ...I WHFLAG=0 S WHLOOP=1
 ..S ARRAY(WHNUM)="COM"_U_U_U_"P"_U_"Comment:"_U_U_U
 .;Additional checkboxes
 .I DGUI="COM",DIEN>1 D
 ..N DSSEQ,DSUB,DTEXT
 ..S DSSEQ=0
 ..F  S DSSEQ=$O(^PXRMD(801.41,DIEN,45,"B",DSSEQ)) Q:'DSSEQ  D
 ...S DSUB=$O(^PXRMD(801.41,DIEN,45,"B",DSSEQ,"")) Q:'DSUB
 ...S DTEXT=$P($G(^PXRMD(801.41,DIEN,45,DSUB,0)),U,2) Q:DTEXT=""
 ...S ARRAY(DSEQ,DSSEQ)=U_DEXC_U_DDEF_U_DTYP_U_DTEXT_U_DSNL_U_DREQ
 Q
 ;
PRTAX(FNODE,RSUB) ;Get all additional fields for this resolution type
 N ACNT,ASUB
 N DDATA,DDEF,DEXC,DGUI,DNAME,DREQ,DSEQ,DSUB,DTYP,PRINT
 S ASUB=0,DSEQ=0
 F  S ASUB=$O(^PXRMD(801.45,FNODE,1,RSUB,5,ASUB)) Q:'ASUB  D
 .S DDATA=$G(^PXRMD(801.45,FNODE,1,RSUB,5,ASUB,0)) Q:DDATA=""
 .;Ignore if disabled
 .I $P(DDATA,U,3)=1 Q
 .S DSUB=$P(DDATA,U) Q:DDATA=""
 .S DSEQ=DSEQ+1
 .;Set defaults to null
 .S DDEF="",DEXC="",DREQ="",DSNL=""
 .;Prompt name and GUI process (quit if null)
 .S DNAME=$P($G(^PXRMD(801.41,DSUB,0)),U),DGUI=$$GUI(DSUB)
 .I $G(DGUI)="WH_NOT_PURP" D
 ..S PRINT=$$GET^XPAR($G(DUZ)_";VA(200,^SRV.`"_+$G(SRV)_"^DIV^SYS","PXRM WH PRINT NOW",1,"I")
 .;Type Prompt or Forced
 .S DTYP=$P($G(^PXRMD(801.41,DSUB,0)),U,4)
 .I DTYP="P" D
 ..S DREQ=$P(DDATA,U,2),DTXT=$P($G(^PXRMD(801.41,DSUB,2)),U,4)
 ..;Override caption/start new line/exclude from PN from finding type
 ..S DOVR=$P(DDATA,U,5),DSNL=$P(DDATA,U,6),DEXC=$P(DDATA,U,7)
 ..S DNAME=DTXT I DOVR]"" S DNAME=DOVR
 ..;Required/Prompt caption
 ..S DDATA=$G(^PXRMD(801.41,DSUB,2))
 .S ARRAY(DSEQ)=DGUI_U_DEXC_U_DDEF_U_DTYP_U_DNAME_U_DSNL_U_DREQ_U_U_$G(PRINT)
 Q
 ;
PTXT(ITEM,NDATA) ;Get progress note (WP) text for type 6 records
 N ARRAY,LAST,NULL,SUB,TEXT,TXTCNT
 S SUB=0
 F  S SUB=$O(^PXRMD(801.41,ITEM,35,SUB)) Q:'SUB  D
 .S ARRAY(SUB)=$G(^PXRMD(801.41,ITEM,35,SUB,0))
 S SUB=0,LAST=0 F  S SUB=$O(ARRAY(SUB)) Q:'SUB  D
 .S TEXT=$G(ARRAY(SUB))
 .S NULL=0 I (TEXT="")!($E(TEXT)=" ") S NULL=1
 .I LAST,'NULL S TEXT="<br>"_TEXT
 .S TEXT=$$STRREP^PXRMUTIL(TEXT,"\\","<br>")
 .S LAST=0 I NULL S TEXT="<br>"_TEXT,LAST=1
 .S OCNT=OCNT+1,ORY(OCNT)=6_U_ITEM_U_U_TEXT_U_$G(NDATA)
 Q
 ;
 ;function to determine if the prompt is valid for the taxonomy encounter type.
TAXPRMPT(DIEN,DTTYP,DCUR) ;
 N FIND,IEN
 S IEN=$P($G(^PXRMD(801.41,DIEN,1)),U,4) I +IEN=0 Q 1
 S FIND=$P($G(^PXRMD(801.45,IEN,0)),U) I FIND="" Q 1
 I FIND=DTTYP Q 1
 Q 0
 ;