PXRMPTDF ;SLC/PKR/PJH - Reminder Inquiry print template routines. ;08/25/2020
;;2.0;CLINICAL REMINDERS;**4,6,12,46,65**;Feb 04, 2005;Build 438
;
;================================================
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)
. D WPFORMAT(FINDING,25,RJC,20)
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)
. D SFDISP(FIND0,17,29,"Immunization Search Criteria:",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
.. D WPOUT(FINDING,25,"Description:",RJC,PAD,PADS,20)
..;
.. 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 DATE^PXRMPTD2(TERM,8,9,"Beginning Date/Time:",RJT,PAD,TERMNUM)
.D SFDISP(TERM,9,10,"Use Inactive Problems:",RJT,PAD,TERMNUM)
.D DATE^PXRMPTD2(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 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
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXRMPTDF 9994 printed Oct 16, 2024@17:49:32 Page 2
PXRMPTDF ;SLC/PKR/PJH - Reminder Inquiry print template routines. ;08/25/2020
+1 ;;2.0;CLINICAL REMINDERS;**4,6,12,46,65**;Feb 04, 2005;Build 438
+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)
+23 DO WPFORMAT(FINDING,25,RJC,20)
End DoDot:1
+24 SET DIWF="C80"
SET DIWL=2
+25 KILL ^UTILITY($JOB,"W")
+26 SET FINDING=0
+27 FOR
SET FINDING=$ORDER(^PXD(811.9,D0,20,FINDING))
if +FINDING=0
QUIT
Begin DoDot:1
+28 SET FIND0=^PXD(811.9,D0,20,FINDING,0)
+29 SET FIELD=$PIECE(FIND0,U,1)
+30 SET RTERM=FIELD
+31 SET X=" "
+32 DO ^DIWP
+33 SET FINDNAM=$$ENTRYNAM^PXRMPTD2(FIELD)
+34 IF FINDNAM=""
SET FINDNAM="?"
+35 SET RFIND=$$GENIEN^PXRMPTD2(FINDING)
+36 SET X="---- Begin: "_FINDNAM_RFIND
+37 DO FORMATS^PXRMTEXT(2,75,X,.NL,.OUTPUT)
+38 FOR IND=1:1:NL
Begin DoDot:2
+39 SET X=OUTPUT(IND)
+40 IF IND=NL
SET X=X_" "
SET LEN=75-$LENGTH(X)
FOR INT=1:1:LEN
SET X=X_"-"
+41 DO ^DIWP
End DoDot:2
+42 ;
+43 SET X=$$RJ^XLFSTR("Finding Type:",RJC,PAD)
+44 SET X=X_" "_$$FTYPE^PXRMPTD2(FIELD,0)
+45 DO ^DIWP
+46 IF RFIND["HF"
Begin DoDot:2
+47 SET HFIEN=$PIECE($PIECE($PIECE(RFIND,"HF",2),"(",2),")")
+48 SET HFCAT=$PIECE($GET(^AUTTHF(HFIEN,0)),U,3)
+49 SET HFCAT=$SELECT(HFCAT="":"UNDEFINED",1:$PIECE($GET(^AUTTHF(HFCAT,0)),U,1))
+50 SET X=$$RJ^XLFSTR("Health Factor Category:",RJC,PAD)
+51 SET X=X_" "_HFCAT
+52 DO ^DIWP
End DoDot:2
+53 ;
+54 SET FIELD=$PIECE(FIND0,U,4)
+55 IF $LENGTH(FIELD)>0
Begin DoDot:2
+56 SET X=$$RJ^XLFSTR("Match Frequency/Age:",RJC,PAD)
+57 SET X=X_" "_$$GENFREQ^PXRMPTD2(FIND0)
+58 DO ^DIWP
End DoDot:2
+59 ;
+60 DO SFDISP(FIND0,5,6,"Rank Frequency:",RJC,PAD,FILENUM)
+61 DO SFDISP(FIND0,6,7,"Use in Resolution Logic:",RJC,PAD,FILENUM)
+62 DO SFDISP(FIND0,7,8,"Use in Patient Cohort Logic:",RJC,PAD,FILENUM)
+63 DO DATE^PXRMPTD2(FIND0,8,9,"Beginning Date/Time:",RJC,PAD,FILENUM)
+64 DO DATE^PXRMPTD2(FIND0,11,12,"Ending Date/Time:",RJC,PAD,FILENUM)
+65 DO SFDISP(FIND0,14,17,"Occurrence Count:",RJC,PAD,FILENUM)
+66 DO SFDISP(FIND0,9,10,"Use Inactive Problems:",RJC,PAD,FILENUM)
+67 DO SFDISP(FIND0,10,11,"Within Category Rank:",RJC,PAD,FILENUM)
+68 DO SFDISP(FIND0,16,28,"Include Visit Data:",RJC,PAD,FILENUM)
+69 DO SFDISP(FIND0,12,13,"MH Scale:",RJC,PAD,FILENUM)
+70 DO SFDISP(FIND0,13,16,"Rx Type:",RJC,PAD,FILENUM)
+71 DO SFDISP(FIND0,15,27,"Use Start Date:",RJC,PAD,FILENUM)
+72 DO SFDISP(FIND0,17,29,"Immunization Search Criteria:",RJC,PAD,FILENUM)
+73 IF $DATA(^PXD(811.9,D0,20,FINDING,5,0))=1
Begin DoDot:2
+74 SET (SCNT,SIEN)=0
+75 FOR
SET SIEN=$ORDER(^PXD(811.9,D0,20,FINDING,5,SIEN))
if SIEN=""
QUIT
Begin DoDot:3
+76 SET STAT0=$GET(^PXD(811.9,D0,20,FINDING,5,SIEN,0))
+77 DO STATUS(STAT0,"Status List:",RJC)
SET SCNT=SCNT+1
End DoDot:3
End DoDot:2
+78 SET FIND0=$GET(^PXD(811.9,D0,20,FINDING,3))
+79 DO SFDISP(FIND0,1,14,"Condition:",RJC,PAD,FILENUM)
+80 DO SFDISP(FIND0,2,15,"Condition Case Sensitive:",RJC,PAD,FILENUM)
+81 DO SFDISP(FIND0,3,18,"Use Status/Cond in Search:",RJC,PAD,FILENUM)
+82 IF $GET(^PXD(811.9,D0,20,FINDING,15))'=""
Begin DoDot:2
+83 SET X=$$RJ^XLFSTR("Computed Finding Parameter:",RJC,PAD)
+84 SET X=X_" "_$GET(^PXD(811.9,D0,20,FINDING,15))
+85 DO ^DIWP
End DoDot:2
+86 DO WPOUT(FINDING,20,"Found Text:",RJC,PAD,PADS,1)
+87 DO WPOUT(FINDING,20,"Not Found Text:",RJC,PAD,PADS,2)
+88 IF RTERM["PXRMD(811.5"
SET IEN1=$PIECE(RTERM,";")
DO RTERM
+89 SET X="---- End: "_FINDNAM
+90 DO FORMATS^PXRMTEXT(2,75,X,.NL,.OUTPUT)
+91 FOR IND=1:1:NL
Begin DoDot:2
+92 SET X=OUTPUT(IND)
+93 IF IND=NL
SET X=X_" "
SET LEN=75-$LENGTH(X)
FOR INT=1:1:LEN
SET X=X_"-"
+94 DO ^DIWP
End DoDot:2
End DoDot:1
+95 ;
+96 ;Function Findings
+97 IF +$PIECE($GET(^PXD(811.9,D0,25,0)),U,4)>0
Begin DoDot:1
+98 SET X=" "
+99 DO ^DIWP
+100 SET X="Function Findings:"
+101 DO ^DIWP
+102 ;Build the list of findings for this reminder.
+103 DO BLDFLST^PXRMPTL(D0,.FL)
+104 SET FILENUM="811.925"
SET FINDING=0
+105 FOR
SET FINDING=$ORDER(^PXD(811.9,D0,25,FINDING))
if +FINDING=0
QUIT
Begin DoDot:2
+106 SET FIND0=$GET(^PXD(811.9,D0,25,FINDING,0))
+107 SET FIND3=$GET(^PXD(811.9,D0,25,FINDING,3))
+108 IF FIND3=""
QUIT
+109 SET FIELD=$PIECE(FIND0,U,1)
+110 SET FINDNAM="FF("_FIELD_")"
+111 SET X=" "
+112 DO ^DIWP
+113 SET X=$$RJ^XLFSTR("---- Begin:",12,PAD)
+114 SET X=X_" "_FINDNAM
+115 SET LEN=(75-$LENGTH(X))
+116 FOR INT=1:1:LEN
SET X=X_"-"
+117 DO ^DIWP
+118 ;
+119 DO SFDISP(FIND3,1,3,"Function String:",RJC,PAD,FILENUM)
+120 SET X=" Expanded Function String:"
DO ^DIWP
+121 DO DISLOGF^PXRMPTL(D0,FINDING,.FL,.PARRAY)
+122 SET INT=0
+123 FOR
SET INT=$ORDER(PARRAY(INT))
if 'INT
QUIT
Begin DoDot:3
+124 SET X=$JUSTIFY("",6)_PARRAY(INT)
DO ^DIWP
End DoDot:3
+125 DO WPOUT(FINDING,25,"Description:",RJC,PAD,PADS,20)
+126 ;
+127 SET FIELD=$PIECE(FIND0,U,4)
+128 IF $LENGTH(FIELD)>0
Begin DoDot:3
+129 SET X=$$RJ^XLFSTR("Match Frequency/Age:",RJC,PAD)
+130 SET X=X_" "_$$GENFREQ^PXRMPTD2(FIND0)
+131 DO ^DIWP
End DoDot:3
+132 ;
+133 DO SFDISP(FIND0,5,10,"Rank Frequency:",RJC,PAD,FILENUM)
+134 DO SFDISP(FIND0,6,11,"Use in Resolution Logic:",RJC,PAD,FILENUM)
+135 DO SFDISP(FIND0,7,12,"Use in Patient Cohort Logic:",RJC,PAD,FILENUM)
+136 ;
+137 DO WPOUT(FINDING,25,"Found Text:",RJC,PAD,PADS,1)
+138 DO WPOUT(FINDING,25,"Not Found Text:",RJC,PAD,PADS,2)
+139 SET X=$$RJ^XLFSTR("---- End:",10,PADS)
+140 SET X=X_" "_FINDNAM_" "
+141 SET LEN=(75-$LENGTH(X))
+142 FOR INT=1:1:(LEN)
SET X=X_"-"
+143 DO ^DIWP
+144 SET X=" "
+145 DO ^DIWP
End DoDot:2
End DoDot:1
+146 ;
+147 KILL ^TMP($JOB,"W")
+148 ;^UTILITY($J,"W") will be killed by ^DIWW in the print template.
+149 QUIT
+150 ;
+151 ;================================================
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 DATE^PXRMPTD2(TERM,8,9,"Beginning Date/Time:",RJT,PAD,TERMNUM)
+8 DO SFDISP(TERM,9,10,"Use Inactive Problems:",RJT,PAD,TERMNUM)
+9 DO DATE^PXRMPTD2(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 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,
+1 ;word processing 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 ;