PXRMPTDF ; SLC/PKR/PJH - Reminder Inquiry print template routines. ;03/16/2009
;;2.0;CLINICAL REMINDERS;**4,6,12**;Feb 04, 2005;Build 73
;
;================================================
PFIND ;Print the reminder definition finding multiple.
N DIWF,FIELD,FILENUM,FINDING,FIND0,FIND3,FINDNAM,FL,HFCAT,HFIEN
N IEN1,IND,INT,LEN,NL,OUTPUT,PAD,PADS,PARRAY
N RJC,RFIND,RTERM,SCNT,SIEN,STAT0,TEMP,X
;If called by a FileMan print build the variable pointer list.
I '$D(PXRMFVPL) N PXRMFVPL D BLDRLIST^PXRMVPTR(811.902,.01,.PXRMFVPL)
;No printing is done by PFIND it accumulates all output using ^DIWP.
;The print template outputs the text with ^DIWW.
;Because of the way DIWP works we need to format all the found and
;not found text first and store it in ^TMP.
K ^TMP($J,"W")
S FILENUM="811.902"
S RJC=30,PAD=" ",PADS=""
F IND=1:1:(RJC+2) S PADS=PADS_PAD
S FINDING=0
F S FINDING=$O(^PXD(811.9,D0,20,FINDING)) Q:+FINDING=0 D
.D WPFORMAT(FINDING,20,RJC,1)
.D WPFORMAT(FINDING,20,RJC,2)
K ^UTILITY($J,"W")
S FINDING=0
F S FINDING=$O(^PXD(811.9,D0,25,FINDING)) Q:+FINDING=0 D
. D WPFORMAT(FINDING,25,RJC,1)
. D WPFORMAT(FINDING,25,RJC,2)
S DIWF="C80",DIWL=2
K ^UTILITY($J,"W")
S FINDING=0
F S FINDING=$O(^PXD(811.9,D0,20,FINDING)) Q:+FINDING=0 D
. S FIND0=^PXD(811.9,D0,20,FINDING,0)
. S FIELD=$P(FIND0,U,1)
. S RTERM=FIELD
. S X=" "
. D ^DIWP
. S FINDNAM=$$ENTRYNAM^PXRMPTD2(FIELD)
. I FINDNAM="" S FINDNAM="?"
. S RFIND=$$GENIEN^PXRMPTD2(FINDING)
. S X="---- Begin: "_FINDNAM_RFIND
. D FORMATS^PXRMTEXT(2,75,X,.NL,.OUTPUT)
. F IND=1:1:NL D
.. S X=OUTPUT(IND)
.. I IND=NL S X=X_" ",LEN=75-$L(X) F INT=1:1:LEN S X=X_"-"
.. D ^DIWP
.;
. S X=$$RJ^XLFSTR("Finding Type:",RJC,PAD)
. S X=X_" "_$$FTYPE^PXRMPTD2(FIELD,0)
. D ^DIWP
. I RFIND["HF" D
.. S HFIEN=$P($P($P(RFIND,"HF",2),"(",2),")")
.. S HFCAT=$P($G(^AUTTHF(HFIEN,0)),U,3)
.. S HFCAT=$S(HFCAT="":"UNDEFINED",1:$P($G(^AUTTHF(HFCAT,0)),U,1))
.. S X=$$RJ^XLFSTR("Health Factor Category:",RJC,PAD)
.. S X=X_" "_HFCAT
.. D ^DIWP
.;
. S FIELD=$P(FIND0,U,4)
. I $L(FIELD)>0 D
.. S X=$$RJ^XLFSTR("Match Frequency/Age:",RJC,PAD)
.. S X=X_" "_$$GENFREQ^PXRMPTD2(FIND0)
.. D ^DIWP
.;
. D SFDISP(FIND0,5,6,"Rank Frequency:",RJC,PAD,FILENUM)
. D SFDISP(FIND0,6,7,"Use in Resolution Logic:",RJC,PAD,FILENUM)
. D SFDISP(FIND0,7,8,"Use in Patient Cohort Logic:",RJC,PAD,FILENUM)
. D DATE^PXRMPTD2(FIND0,8,9,"Beginning Date/Time:",RJC,PAD,FILENUM)
. D DATE^PXRMPTD2(FIND0,11,12,"Ending Date/Time:",RJC,PAD,FILENUM)
. D SFDISP(FIND0,14,17,"Occurrence Count:",RJC,PAD,FILENUM)
. D SFDISP(FIND0,9,10,"Use Inactive Problems:",RJC,PAD,FILENUM)
. D SFDISP(FIND0,10,11,"Within Category Rank:",RJC,PAD,FILENUM)
. D SFDISP(FIND0,16,28,"Include Visit Data:",RJC,PAD,FILENUM)
. D SFDISP(FIND0,12,13,"MH Scale:",RJC,PAD,FILENUM)
. D SFDISP(FIND0,13,16,"Rx Type:",RJC,PAD,FILENUM)
. D SFDISP(FIND0,15,27,"Use Start Date:",RJC,PAD,FILENUM)
. I $D(^PXD(811.9,D0,20,FINDING,5,0))=1 D
.. S (SCNT,SIEN)=0
.. F S SIEN=$O(^PXD(811.9,D0,20,FINDING,5,SIEN)) Q:SIEN="" D
... S STAT0=$G(^PXD(811.9,D0,20,FINDING,5,SIEN,0))
... D STATUS(STAT0,"Status List:",RJC) S SCNT=SCNT+1
. S FIND0=$G(^PXD(811.9,D0,20,FINDING,3))
. D SFDISP(FIND0,1,14,"Condition:",RJC,PAD,FILENUM)
. D SFDISP(FIND0,2,15,"Condition Case Sensitive:",RJC,PAD,FILENUM)
. D SFDISP(FIND0,3,18,"Use Status/Cond in Search:",RJC,PAD,FILENUM)
. I $G(^PXD(811.9,D0,20,FINDING,15))'="" D
.. S X=$$RJ^XLFSTR("Computed Finding Parameter:",RJC,PAD)
.. S X=X_" "_$G(^PXD(811.9,D0,20,FINDING,15))
.. D ^DIWP
. D WPOUT(FINDING,20,"Found Text:",RJC,PAD,PADS,1)
. D WPOUT(FINDING,20,"Not Found Text:",RJC,PAD,PADS,2)
. I RTERM["PXRMD(811.5" S IEN1=$P(RTERM,";") D RTERM
. S X="---- End: "_FINDNAM
. D FORMATS^PXRMTEXT(2,75,X,.NL,.OUTPUT)
. F IND=1:1:NL D
.. S X=OUTPUT(IND)
.. I IND=NL S X=X_" ",LEN=75-$L(X) F INT=1:1:LEN S X=X_"-"
.. D ^DIWP
;
;Function Findings
I +$P($G(^PXD(811.9,D0,25,0)),U,4)>0 D
. S X=" "
. D ^DIWP
. S X="Function Findings:"
. D ^DIWP
.;Build the list of findings for this reminder.
. D BLDFLST^PXRMPTL(D0,.FL)
. S FILENUM="811.925",FINDING=0
. F S FINDING=$O(^PXD(811.9,D0,25,FINDING)) Q:+FINDING=0 D
.. S FIND0=$G(^PXD(811.9,D0,25,FINDING,0))
.. S FIND3=$G(^PXD(811.9,D0,25,FINDING,3))
.. I FIND3="" Q
.. S FIELD=$P(FIND0,U,1)
.. S FINDNAM="FF("_FIELD_")"
.. S X=" "
.. D ^DIWP
.. S X=$$RJ^XLFSTR("---- Begin:",12,PAD)
.. S X=X_" "_FINDNAM
.. S LEN=(75-$L(X))
.. F INT=1:1:LEN S X=X_"-"
.. D ^DIWP
..;
.. D SFDISP(FIND3,1,3,"Function String:",RJC,PAD,FILENUM)
.. S X=" Expanded Function String:" D ^DIWP
.. D DISLOGF^PXRMPTL(D0,FINDING,.FL,.PARRAY)
.. S INT=0
.. F S INT=$O(PARRAY(INT)) Q:'INT D
... S X=$J("",6)_PARRAY(INT) D ^DIWP
..;
.. S FIELD=$P(FIND0,U,4)
.. I $L(FIELD)>0 D
... S X=$$RJ^XLFSTR("Match Frequency/Age:",RJC,PAD)
... S X=X_" "_$$GENFREQ^PXRMPTD2(FIND0)
... D ^DIWP
..;
.. D SFDISP(FIND0,5,10,"Rank Frequency:",RJC,PAD,FILENUM)
.. D SFDISP(FIND0,6,11,"Use in Resolution Logic:",RJC,PAD,FILENUM)
.. D SFDISP(FIND0,7,12,"Use in Patient Cohort Logic:",RJC,PAD,FILENUM)
..;
.. D WPOUT(FINDING,25,"Found Text:",RJC,PAD,PADS,1)
.. D WPOUT(FINDING,25,"Not Found Text:",RJC,PAD,PADS,2)
.. S X=$$RJ^XLFSTR("---- End:",10,PADS)
.. S X=X_" "_FINDNAM_" "
.. S LEN=(75-$L(X))
.. F INT=1:1:(LEN) S X=X_"-"
.. D ^DIWP
.. S X=" "
.. D ^DIWP
;
K ^TMP($J,"W")
;^UTILITY($J,"W") will be killed by ^DIWW in the print template.
Q
;
;================================================
RTERM ;Reminder Term
N CNT,RJT,SCNT,SIEN,STAT0,TERM,TERM3,TERMNUM,TERMS
S CNT=0,RJT=RJC+5,TERMNUM="811.52",TERMS=0
F S TERMS=$O(^PXRMD(811.5,IEN1,20,TERMS)) Q:+TERMS=0 D
.S TERM=$G(^PXRMD(811.5,IEN1,20,TERMS,0))
.S TERM3=$G(^PXRMD(811.5,IEN1,20,TERMS,3))
.D SFDISP(TERM,1,.01,"Mapped Finding Item:",RJT,PAD,TERMNUM,CNT)
.D SFDISP(TERM,8,9,"Beginning Date/Time:",RJT,PAD,TERMNUM)
.D SFDISP(TERM,9,10,"Use Inactive Problems:",RJT,PAD,TERMNUM)
.D SFDISP(TERM,11,12,"Ending Date/Time:",RJT,PAD,TERMNUM)
.D SFDISP(TERM,10,11,"Within Category Rank:",RJT,PAD,TERMNUM)
.D SFDISP(TERM,12,13,"MH Scale:",RJT,PAD,TERMNUM)
.D SFDISP(TERM,13,16,"RX Type:",RJT,PAD,TERMNUM)
.D SFDISP(TERM,14,17,"Occurrence Count:",RJT,PAD,TERMNUM)
.I $D(^PXRMD(811.5,IEN1,20,TERMS,5,0))=1 D
..S (SCNT,SIEN)=0
..F S SIEN=$O(^PXRMD(811.5,IEN1,20,TERMS,5,SIEN)) Q:SIEN="" D
...S STAT0=$G(^PXRMD(811.5,IEN1,20,TERMS,5,SIEN,0))
...D STATUS(STAT0,"Status List:",RJT) S SCNT=SCNT+1
.D SFDISP(TERM3,1,14,"Condition:",RJT,PAD,TERMNUM,1)
.D SFDISP(TERM3,2,15,"Condition Case Sensitive:",RJT,PAD,TERMNUM)
.D SFDISP(TERM3,3,18,"Use Status/Cond in Search:",RJT,PAD,TERMNUM)
.I $G(^PXRMD(811.5,IEN1,20,TERMS,15))'="" D
..S X=$$RJ^XLFSTR("Computed Finding Parameter:",RJT,PAD)
..S X=X_" "_$G(^PXRMD(811.5,IEN1,20,TERMS,15))
..D ^DIWP
.S X=""
.D ^DIWP
.S CNT=CNT+1
I CNT=0 D Q
.S X=$$RJ^XLFSTR("RT Mapped Finding:",RJC,PAD)
.S X=X_" No Reminder Finding Found"
.D ^DIWP
Q
;
;================================================
SFDISP(FIND0,PIECE,FLDNUM,TITLE,RJC,PAD,FILENUM,FLG) ;Standard finding
;multiple field display.
N FIELD,FMTSTR,HFCAT,HFIEN,IND,OUTPUT,NAME,NL,TYPE,X
S FMTSTR=RJC_"R1^35L"
S NAME=""
S FIELD=$P(FIND0,U,PIECE)
I (FILENUM="811.52"),(FLDNUM=".01"),(PIECE=1) D
.I FLG=0 D
..S X="" D ^DIWP
..S RTERM=$P($P(RFIND,"=",2),")")_")"
.S TYPE=$$FTYPE^PXRMPTD2(FIELD,1),NAME=$$ENTRYNAM^PXRMPTD2(FIELD)
.S X="Mapped Findings:^"_TYPE_"."_NAME
.D COLFMT^PXRMTEXT(FMTSTR,X,PAD,.NL,.OUTPUT)
.F IND=1:1:NL S X=OUTPUT(IND) D ^DIWP
.I TYPE="HF" D
..S HFIEN=$P(TERM,";")
..S HFCAT=$P($G(^AUTTHF(HFIEN,0)),U,3)
..S HFCAT=$P($G(^AUTTHF(HFCAT,0)),U)
..S X=$$RJ^XLFSTR("Health Factor Category:",RJC,PAD)
..S X=X_" "_HFCAT
..D ^DIWP
I NAME'="" Q
I $L(FIELD)>0 D
.S X=$$RJ^XLFSTR(TITLE,RJC,PAD)
.S X=X_" "_$$EXTERNAL^DILFD(FILENUM,FLDNUM,"",FIELD,"")
.I FLDNUM=13 S X=X_" - "_$$SPECIAL(FIND0,FIELD)
.D ^DIWP
Q
;
;================================================
SPECIAL(FIND0,FIELD) ;Special output for certain fields.
N FINDING,GLOBAL,IEN
S FINDING=$P(FIND0,U,1)
S IEN=$P(FINDING,";",1)
S GLOBAL=$P(FINDING,";",2)
I GLOBAL="YTT(601.71," Q $$SCNAME^PXRMMH(IEN,FIELD)
Q ""
;
;================================================
STATUS(STAT0,TITLE,SPACE) ;
I $L(STAT0)>0 D
.I SCNT=0 S X=$$RJ^XLFSTR(TITLE,SPACE,PAD)
.I SCNT>0 S X=$$RJ^XLFSTR("",SPACE,PAD)
.S X=X_" "_STAT0
.D ^DIWP
Q
;
;================================================
WPFORMAT(FINDING,NODE,RJC,INDEX) ;Format found/not found word processing text.
I '$D(^PXD(811.9,D0,NODE,FINDING,INDEX,1,0)) Q
;Save the title using the current format for DIWP.
N DIWF,DIWL,DIWR,IND,NLINES,SC,X
K ^UTILITY($J,"W")
S DIWF="|",DIWL=RJC+2,DIWR=78
S IND=0
F S IND=$O(^PXD(811.9,D0,NODE,FINDING,INDEX,IND)) Q:+IND=0 D
.S X=$G(^PXD(811.9,D0,NODE,FINDING,INDEX,IND,0))
.D ^DIWP
;Find where this stuff went.
S SC=$O(^UTILITY($J,"W",""))
;Save into ^TMP.
S NLINES=^UTILITY($J,"W",SC)
S ^TMP($J,"W",FINDING,NODE,INDEX)=NLINES
F IND=1:1:NLINES D
.S ^TMP($J,"W",FINDING,NODE,INDEX,IND)=^UTILITY($J,"W",SC,IND,0)
K ^UTILITY($J,"W")
Q
;
;================================================
WPOUT(FINDING,NODE,TITLE,RJC,PAD,PADS,INDEX) ;Output found/not found word processing
;text.
I $D(^TMP($J,"W",FINDING,NODE,INDEX)) D
.N IND,X
.S X=$$RJ^XLFSTR(TITLE,RJC,PAD)_" "_^TMP($J,"W",FINDING,NODE,INDEX,1)
.D ^DIWP
.F IND=2:1:^TMP($J,"W",FINDING,NODE,INDEX) D
..S X=PADS_^TMP($J,"W",FINDING,NODE,INDEX,IND)
..D ^DIWP
Q
;
PXRMPTDF ; SLC/PKR/PJH - Reminder Inquiry print template routines. ;03/16/2009
+1 ;;2.0;CLINICAL REMINDERS;**4,6,12**;Feb 04, 2005;Build 73
+2 ;
+3 ;================================================
PFIND ;Print the reminder definition finding multiple.
+1 NEW DIWF,FIELD,FILENUM,FINDING,FIND0,FIND3,FINDNAM,FL,HFCAT,HFIEN
+2 NEW IEN1,IND,INT,LEN,NL,OUTPUT,PAD,PADS,PARRAY
+3 NEW RJC,RFIND,RTERM,SCNT,SIEN,STAT0,TEMP,X
+4 ;If called by a FileMan print build the variable pointer list.
+5 IF '$DATA(PXRMFVPL)
NEW PXRMFVPL
DO BLDRLIST^PXRMVPTR(811.902,.01,.PXRMFVPL)
+6 ;No printing is done by PFIND it accumulates all output using ^DIWP.
+7 ;The print template outputs the text with ^DIWW.
+8 ;Because of the way DIWP works we need to format all the found and
+9 ;not found text first and store it in ^TMP.
+10 KILL ^TMP($JOB,"W")
+11 SET FILENUM="811.902"
+12 SET RJC=30
SET PAD=" "
SET PADS=""
+13 FOR IND=1:1:(RJC+2)
SET PADS=PADS_PAD
+14 SET FINDING=0
+15 FOR
SET FINDING=$ORDER(^PXD(811.9,D0,20,FINDING))
IF +FINDING=0
QUIT
Begin DoDot:1
+16 DO WPFORMAT(FINDING,20,RJC,1)
+17 DO WPFORMAT(FINDING,20,RJC,2)
End DoDot:1
+18 KILL ^UTILITY($JOB,"W")
+19 SET FINDING=0
+20 FOR
SET FINDING=$ORDER(^PXD(811.9,D0,25,FINDING))
IF +FINDING=0
QUIT
Begin DoDot:1
+21 DO WPFORMAT(FINDING,25,RJC,1)
+22 DO WPFORMAT(FINDING,25,RJC,2)
End DoDot:1
+23 SET DIWF="C80"
SET DIWL=2
+24 KILL ^UTILITY($JOB,"W")
+25 SET FINDING=0
+26 FOR
SET FINDING=$ORDER(^PXD(811.9,D0,20,FINDING))
IF +FINDING=0
QUIT
Begin DoDot:1
+27 SET FIND0=^PXD(811.9,D0,20,FINDING,0)
+28 SET FIELD=$PIECE(FIND0,U,1)
+29 SET RTERM=FIELD
+30 SET X=" "
+31 DO ^DIWP
+32 SET FINDNAM=$$ENTRYNAM^PXRMPTD2(FIELD)
+33 IF FINDNAM=""
SET FINDNAM="?"
+34 SET RFIND=$$GENIEN^PXRMPTD2(FINDING)
+35 SET X="---- Begin: "_FINDNAM_RFIND
+36 DO FORMATS^PXRMTEXT(2,75,X,.NL,.OUTPUT)
+37 FOR IND=1:1:NL
Begin DoDot:2
+38 SET X=OUTPUT(IND)
+39 IF IND=NL
SET X=X_" "
SET LEN=75-$LENGTH(X)
FOR INT=1:1:LEN
SET X=X_"-"
+40 DO ^DIWP
End DoDot:2
+41 ;
+42 SET X=$$RJ^XLFSTR("Finding Type:",RJC,PAD)
+43 SET X=X_" "_$$FTYPE^PXRMPTD2(FIELD,0)
+44 DO ^DIWP
+45 IF RFIND["HF"
Begin DoDot:2
+46 SET HFIEN=$PIECE($PIECE($PIECE(RFIND,"HF",2),"(",2),")")
+47 SET HFCAT=$PIECE($GET(^AUTTHF(HFIEN,0)),U,3)
+48 SET HFCAT=$SELECT(HFCAT="":"UNDEFINED",1:$PIECE($GET(^AUTTHF(HFCAT,0)),U,1))
+49 SET X=$$RJ^XLFSTR("Health Factor Category:",RJC,PAD)
+50 SET X=X_" "_HFCAT
+51 DO ^DIWP
End DoDot:2
+52 ;
+53 SET FIELD=$PIECE(FIND0,U,4)
+54 IF $LENGTH(FIELD)>0
Begin DoDot:2
+55 SET X=$$RJ^XLFSTR("Match Frequency/Age:",RJC,PAD)
+56 SET X=X_" "_$$GENFREQ^PXRMPTD2(FIND0)
+57 DO ^DIWP
End DoDot:2
+58 ;
+59 DO SFDISP(FIND0,5,6,"Rank Frequency:",RJC,PAD,FILENUM)
+60 DO SFDISP(FIND0,6,7,"Use in Resolution Logic:",RJC,PAD,FILENUM)
+61 DO SFDISP(FIND0,7,8,"Use in Patient Cohort Logic:",RJC,PAD,FILENUM)
+62 DO DATE^PXRMPTD2(FIND0,8,9,"Beginning Date/Time:",RJC,PAD,FILENUM)
+63 DO DATE^PXRMPTD2(FIND0,11,12,"Ending Date/Time:",RJC,PAD,FILENUM)
+64 DO SFDISP(FIND0,14,17,"Occurrence Count:",RJC,PAD,FILENUM)
+65 DO SFDISP(FIND0,9,10,"Use Inactive Problems:",RJC,PAD,FILENUM)
+66 DO SFDISP(FIND0,10,11,"Within Category Rank:",RJC,PAD,FILENUM)
+67 DO SFDISP(FIND0,16,28,"Include Visit Data:",RJC,PAD,FILENUM)
+68 DO SFDISP(FIND0,12,13,"MH Scale:",RJC,PAD,FILENUM)
+69 DO SFDISP(FIND0,13,16,"Rx Type:",RJC,PAD,FILENUM)
+70 DO SFDISP(FIND0,15,27,"Use Start Date:",RJC,PAD,FILENUM)
+71 IF $DATA(^PXD(811.9,D0,20,FINDING,5,0))=1
Begin DoDot:2
+72 SET (SCNT,SIEN)=0
+73 FOR
SET SIEN=$ORDER(^PXD(811.9,D0,20,FINDING,5,SIEN))
IF SIEN=""
QUIT
Begin DoDot:3
+74 SET STAT0=$GET(^PXD(811.9,D0,20,FINDING,5,SIEN,0))
+75 DO STATUS(STAT0,"Status List:",RJC)
SET SCNT=SCNT+1
End DoDot:3
End DoDot:2
+76 SET FIND0=$GET(^PXD(811.9,D0,20,FINDING,3))
+77 DO SFDISP(FIND0,1,14,"Condition:",RJC,PAD,FILENUM)
+78 DO SFDISP(FIND0,2,15,"Condition Case Sensitive:",RJC,PAD,FILENUM)
+79 DO SFDISP(FIND0,3,18,"Use Status/Cond in Search:",RJC,PAD,FILENUM)
+80 IF $GET(^PXD(811.9,D0,20,FINDING,15))'=""
Begin DoDot:2
+81 SET X=$$RJ^XLFSTR("Computed Finding Parameter:",RJC,PAD)
+82 SET X=X_" "_$GET(^PXD(811.9,D0,20,FINDING,15))
+83 DO ^DIWP
End DoDot:2
+84 DO WPOUT(FINDING,20,"Found Text:",RJC,PAD,PADS,1)
+85 DO WPOUT(FINDING,20,"Not Found Text:",RJC,PAD,PADS,2)
+86 IF RTERM["PXRMD(811.5"
SET IEN1=$PIECE(RTERM,";")
DO RTERM
+87 SET X="---- End: "_FINDNAM
+88 DO FORMATS^PXRMTEXT(2,75,X,.NL,.OUTPUT)
+89 FOR IND=1:1:NL
Begin DoDot:2
+90 SET X=OUTPUT(IND)
+91 IF IND=NL
SET X=X_" "
SET LEN=75-$LENGTH(X)
FOR INT=1:1:LEN
SET X=X_"-"
+92 DO ^DIWP
End DoDot:2
End DoDot:1
+93 ;
+94 ;Function Findings
+95 IF +$PIECE($GET(^PXD(811.9,D0,25,0)),U,4)>0
Begin DoDot:1
+96 SET X=" "
+97 DO ^DIWP
+98 SET X="Function Findings:"
+99 DO ^DIWP
+100 ;Build the list of findings for this reminder.
+101 DO BLDFLST^PXRMPTL(D0,.FL)
+102 SET FILENUM="811.925"
SET FINDING=0
+103 FOR
SET FINDING=$ORDER(^PXD(811.9,D0,25,FINDING))
IF +FINDING=0
QUIT
Begin DoDot:2
+104 SET FIND0=$GET(^PXD(811.9,D0,25,FINDING,0))
+105 SET FIND3=$GET(^PXD(811.9,D0,25,FINDING,3))
+106 IF FIND3=""
QUIT
+107 SET FIELD=$PIECE(FIND0,U,1)
+108 SET FINDNAM="FF("_FIELD_")"
+109 SET X=" "
+110 DO ^DIWP
+111 SET X=$$RJ^XLFSTR("---- Begin:",12,PAD)
+112 SET X=X_" "_FINDNAM
+113 SET LEN=(75-$LENGTH(X))
+114 FOR INT=1:1:LEN
SET X=X_"-"
+115 DO ^DIWP
+116 ;
+117 DO SFDISP(FIND3,1,3,"Function String:",RJC,PAD,FILENUM)
+118 SET X=" Expanded Function String:"
DO ^DIWP
+119 DO DISLOGF^PXRMPTL(D0,FINDING,.FL,.PARRAY)
+120 SET INT=0
+121 FOR
SET INT=$ORDER(PARRAY(INT))
IF 'INT
QUIT
Begin DoDot:3
+122 SET X=$JUSTIFY("",6)_PARRAY(INT)
DO ^DIWP
End DoDot:3
+123 ;
+124 SET FIELD=$PIECE(FIND0,U,4)
+125 IF $LENGTH(FIELD)>0
Begin DoDot:3
+126 SET X=$$RJ^XLFSTR("Match Frequency/Age:",RJC,PAD)
+127 SET X=X_" "_$$GENFREQ^PXRMPTD2(FIND0)
+128 DO ^DIWP
End DoDot:3
+129 ;
+130 DO SFDISP(FIND0,5,10,"Rank Frequency:",RJC,PAD,FILENUM)
+131 DO SFDISP(FIND0,6,11,"Use in Resolution Logic:",RJC,PAD,FILENUM)
+132 DO SFDISP(FIND0,7,12,"Use in Patient Cohort Logic:",RJC,PAD,FILENUM)
+133 ;
+134 DO WPOUT(FINDING,25,"Found Text:",RJC,PAD,PADS,1)
+135 DO WPOUT(FINDING,25,"Not Found Text:",RJC,PAD,PADS,2)
+136 SET X=$$RJ^XLFSTR("---- End:",10,PADS)
+137 SET X=X_" "_FINDNAM_" "
+138 SET LEN=(75-$LENGTH(X))
+139 FOR INT=1:1:(LEN)
SET X=X_"-"
+140 DO ^DIWP
+141 SET X=" "
+142 DO ^DIWP
End DoDot:2
End DoDot:1
+143 ;
+144 KILL ^TMP($JOB,"W")
+145 ;^UTILITY($J,"W") will be killed by ^DIWW in the print template.
+146 QUIT
+147 ;
+148 ;================================================
RTERM ;Reminder Term
+1 NEW CNT,RJT,SCNT,SIEN,STAT0,TERM,TERM3,TERMNUM,TERMS
+2 SET CNT=0
SET RJT=RJC+5
SET TERMNUM="811.52"
SET TERMS=0
+3 FOR
SET TERMS=$ORDER(^PXRMD(811.5,IEN1,20,TERMS))
IF +TERMS=0
QUIT
Begin DoDot:1
+4 SET TERM=$GET(^PXRMD(811.5,IEN1,20,TERMS,0))
+5 SET TERM3=$GET(^PXRMD(811.5,IEN1,20,TERMS,3))
+6 DO SFDISP(TERM,1,.01,"Mapped Finding Item:",RJT,PAD,TERMNUM,CNT)
+7 DO SFDISP(TERM,8,9,"Beginning Date/Time:",RJT,PAD,TERMNUM)
+8 DO SFDISP(TERM,9,10,"Use Inactive Problems:",RJT,PAD,TERMNUM)
+9 DO SFDISP(TERM,11,12,"Ending Date/Time:",RJT,PAD,TERMNUM)
+10 DO SFDISP(TERM,10,11,"Within Category Rank:",RJT,PAD,TERMNUM)
+11 DO SFDISP(TERM,12,13,"MH Scale:",RJT,PAD,TERMNUM)
+12 DO SFDISP(TERM,13,16,"RX Type:",RJT,PAD,TERMNUM)
+13 DO SFDISP(TERM,14,17,"Occurrence Count:",RJT,PAD,TERMNUM)
+14 IF $DATA(^PXRMD(811.5,IEN1,20,TERMS,5,0))=1
Begin DoDot:2
+15 SET (SCNT,SIEN)=0
+16 FOR
SET SIEN=$ORDER(^PXRMD(811.5,IEN1,20,TERMS,5,SIEN))
IF SIEN=""
QUIT
Begin DoDot:3
+17 SET STAT0=$GET(^PXRMD(811.5,IEN1,20,TERMS,5,SIEN,0))
+18 DO STATUS(STAT0,"Status List:",RJT)
SET SCNT=SCNT+1
End DoDot:3
End DoDot:2
+19 DO SFDISP(TERM3,1,14,"Condition:",RJT,PAD,TERMNUM,1)
+20 DO SFDISP(TERM3,2,15,"Condition Case Sensitive:",RJT,PAD,TERMNUM)
+21 DO SFDISP(TERM3,3,18,"Use Status/Cond in Search:",RJT,PAD,TERMNUM)
+22 IF $GET(^PXRMD(811.5,IEN1,20,TERMS,15))'=""
Begin DoDot:2
+23 SET X=$$RJ^XLFSTR("Computed Finding Parameter:",RJT,PAD)
+24 SET X=X_" "_$GET(^PXRMD(811.5,IEN1,20,TERMS,15))
+25 DO ^DIWP
End DoDot:2
+26 SET X=""
+27 DO ^DIWP
+28 SET CNT=CNT+1
End DoDot:1
+29 IF CNT=0
Begin DoDot:1
+30 SET X=$$RJ^XLFSTR("RT Mapped Finding:",RJC,PAD)
+31 SET X=X_" No Reminder Finding Found"
+32 DO ^DIWP
End DoDot:1
QUIT
+33 QUIT
+34 ;
+35 ;================================================
SFDISP(FIND0,PIECE,FLDNUM,TITLE,RJC,PAD,FILENUM,FLG) ;Standard finding
+1 ;multiple field display.
+2 NEW FIELD,FMTSTR,HFCAT,HFIEN,IND,OUTPUT,NAME,NL,TYPE,X
+3 SET FMTSTR=RJC_"R1^35L"
+4 SET NAME=""
+5 SET FIELD=$PIECE(FIND0,U,PIECE)
+6 IF (FILENUM="811.52")
IF (FLDNUM=".01")
IF (PIECE=1)
Begin DoDot:1
+7 IF FLG=0
Begin DoDot:2
+8 SET X=""
DO ^DIWP
+9 SET RTERM=$PIECE($PIECE(RFIND,"=",2),")")_")"
End DoDot:2
+10 SET TYPE=$$FTYPE^PXRMPTD2(FIELD,1)
SET NAME=$$ENTRYNAM^PXRMPTD2(FIELD)
+11 SET X="Mapped Findings:^"_TYPE_"."_NAME
+12 DO COLFMT^PXRMTEXT(FMTSTR,X,PAD,.NL,.OUTPUT)
+13 FOR IND=1:1:NL
SET X=OUTPUT(IND)
DO ^DIWP
+14 IF TYPE="HF"
Begin DoDot:2
+15 SET HFIEN=$PIECE(TERM,";")
+16 SET HFCAT=$PIECE($GET(^AUTTHF(HFIEN,0)),U,3)
+17 SET HFCAT=$PIECE($GET(^AUTTHF(HFCAT,0)),U)
+18 SET X=$$RJ^XLFSTR("Health Factor Category:",RJC,PAD)
+19 SET X=X_" "_HFCAT
+20 DO ^DIWP
End DoDot:2
End DoDot:1
+21 IF NAME'=""
QUIT
+22 IF $LENGTH(FIELD)>0
Begin DoDot:1
+23 SET X=$$RJ^XLFSTR(TITLE,RJC,PAD)
+24 SET X=X_" "_$$EXTERNAL^DILFD(FILENUM,FLDNUM,"",FIELD,"")
+25 IF FLDNUM=13
SET X=X_" - "_$$SPECIAL(FIND0,FIELD)
+26 DO ^DIWP
End DoDot:1
+27 QUIT
+28 ;
+29 ;================================================
SPECIAL(FIND0,FIELD) ;Special output for certain fields.
+1 NEW FINDING,GLOBAL,IEN
+2 SET FINDING=$PIECE(FIND0,U,1)
+3 SET IEN=$PIECE(FINDING,";",1)
+4 SET GLOBAL=$PIECE(FINDING,";",2)
+5 IF GLOBAL="YTT(601.71,"
QUIT $$SCNAME^PXRMMH(IEN,FIELD)
+6 QUIT ""
+7 ;
+8 ;================================================
STATUS(STAT0,TITLE,SPACE) ;
+1 IF $LENGTH(STAT0)>0
Begin DoDot:1
+2 IF SCNT=0
SET X=$$RJ^XLFSTR(TITLE,SPACE,PAD)
+3 IF SCNT>0
SET X=$$RJ^XLFSTR("",SPACE,PAD)
+4 SET X=X_" "_STAT0
+5 DO ^DIWP
End DoDot:1
+6 QUIT
+7 ;
+8 ;================================================
WPFORMAT(FINDING,NODE,RJC,INDEX) ;Format found/not found word processing text.
+1 IF '$DATA(^PXD(811.9,D0,NODE,FINDING,INDEX,1,0))
QUIT
+2 ;Save the title using the current format for DIWP.
+3 NEW DIWF,DIWL,DIWR,IND,NLINES,SC,X
+4 KILL ^UTILITY($JOB,"W")
+5 SET DIWF="|"
SET DIWL=RJC+2
SET DIWR=78
+6 SET IND=0
+7 FOR
SET IND=$ORDER(^PXD(811.9,D0,NODE,FINDING,INDEX,IND))
IF +IND=0
QUIT
Begin DoDot:1
+8 SET X=$GET(^PXD(811.9,D0,NODE,FINDING,INDEX,IND,0))
+9 DO ^DIWP
End DoDot:1
+10 ;Find where this stuff went.
+11 SET SC=$ORDER(^UTILITY($JOB,"W",""))
+12 ;Save into ^TMP.
+13 SET NLINES=^UTILITY($JOB,"W",SC)
+14 SET ^TMP($JOB,"W",FINDING,NODE,INDEX)=NLINES
+15 FOR IND=1:1:NLINES
Begin DoDot:1
+16 SET ^TMP($JOB,"W",FINDING,NODE,INDEX,IND)=^UTILITY($JOB,"W",SC,IND,0)
End DoDot:1
+17 KILL ^UTILITY($JOB,"W")
+18 QUIT
+19 ;
+20 ;================================================
WPOUT(FINDING,NODE,TITLE,RJC,PAD,PADS,INDEX) ;Output found/not found word processing
+1 ;text.
+2 IF $DATA(^TMP($JOB,"W",FINDING,NODE,INDEX))
Begin DoDot:1
+3 NEW IND,X
+4 SET X=$$RJ^XLFSTR(TITLE,RJC,PAD)_" "_^TMP($JOB,"W",FINDING,NODE,INDEX,1)
+5 DO ^DIWP
+6 FOR IND=2:1:^TMP($JOB,"W",FINDING,NODE,INDEX)
Begin DoDot:2
+7 SET X=PADS_^TMP($JOB,"W",FINDING,NODE,INDEX,IND)
+8 DO ^DIWP
End DoDot:2
End DoDot:1
+9 QUIT
+10 ;