PXRMFNFT ; SLC/PKR - Process found/not found text. ;05/21/2010
;;2.0;CLINICAL REMINDERS;**4,12,16**;Feb 04, 2005;Build 119
;
;===================================================
AGE(DFN,DEFARR,FIEVAL,NTXT) ;Output the age match/no match
;text.
N CTIUO,FI,IC,LC,NIN,NLINES,TEXT,TEXTIN
I '$D(FIEVAL("AGE")) Q
S NLINES=0
S IC=""
F S IC=$O(FIEVAL("AGE",IC)) Q:IC="" D
. S FI=$S(FIEVAL("AGE",IC):1,1:2)
. S NIN=$P(DEFARR(7,IC,3),U,FI)
. I +NIN=0 Q
. K TEXTIN
.;If CTIUO is true the text contains a TIU object.
. S CTIUO=$S(NIN["T":1,1:0)
. I CTIUO D
.. N VSTR S VSTR=""
..;TIU expansion expects the trailing 0, i.e. TEXTIN(N,0).
.. F LC=1:1:+NIN S TEXTIN(LC)=^PXD(811.9,PXRMITEM,7,IC,FI,LC,0)
.. S NIN=NIN+1,TEXTIN(NIN)="\\"
.. D FNFTXTO(1,NIN,.TEXTIN,DFN,VSTR,.NLINES,.TEXT)
. I 'CTIUO D
.. F LC=1:1:NIN S TEXTIN(LC)=^PXD(811.9,PXRMITEM,7,IC,FI,LC,0)
.. S NIN=NIN+1,TEXTIN(NIN)="\\"
.. D FNFTXTR(1,NIN,.TEXTIN,.NLINES,.TEXT)
D COPYTXT^PXRMOUTU(.NTXT,NLINES,.TEXT)
Q
;
;===================================================
FINDING(INDENT,DFN,FINDING,IFIEVAL,NLINES,TEXT) ;Output the finding found/not
;found text.
N CTIUO,FI,LC,NIN,NODE,TEMP,TEXTIN
S FI=$S(IFIEVAL:1,1:2)
S NODE=$S(FINDING["FF":25,1:20)
S TEMP=$G(DEFARR(NODE,FINDING,6))
S NIN=$P(TEMP,U,FI)
I +NIN=0 Q
I FINDING["FF" S FINDING=$P(FINDING,"FF",2)
S CTIUO=$S(NIN["T":1,1:0)
I CTIUO D
. S NIN=+NIN
. N VSTR
. F LC=1:1:+NIN S TEXTIN(LC)=^PXD(811.9,PXRMITEM,NODE,FINDING,FI,LC,0)
. I $D(IFIEVAL("VISIT")) D
.. N TEMP,VDATE,VLOC,VSC
.. S TEMP=^AUPNVSIT(IFIEVAL("VISIT"),0)
.. S VDATE=$P(TEMP,U,1)
.. S VLOC=$P(TEMP,U,22)
.. S VSC=$P(TEMP,U,7)
.. S VSTR=VLOC_";"_VDATE_";"_VSC
. E S VSTR=""
. S NIN=NIN+1,TEXTIN(NIN)="\\"
. D FNFTXTO(INDENT,NIN,.TEXTIN,DFN,VSTR,.NLINES,.TEXT)
I 'CTIUO D
. F LC=1:1:NIN S TEXTIN(LC)=^PXD(811.9,PXRMITEM,NODE,FINDING,FI,LC,0)
. S NIN=NIN+1,TEXTIN(NIN)="\\"
. D FNFTXTR(INDENT,NIN,.TEXTIN,.NLINES,.TEXT)
Q
;
;===================================================
FNFTXTO(INDENT,NIN,TEXTIN,DFN,VSTR,NLINES,TEXT) ;Load found/not found text
;that contains TIU objects.
N IND,INOBJECT,JND,OLINE,NEWLINE,NOL,NOUT,NUML,TA,TEXTOUT,TIN
;Make sure this works if it is being called a part of an object.
I $D(^TMP("TIUBOIL",$J)) D
. K ^TMP("PXRMTIUBOIL",$J)
. M ^TMP("PXRMTIUBOIL",$J)=^TMP("TIUBOIL",$J)
. S INOBJECT=1
E S INOBJECT=0
S NUML=0
F IND=1:1:NIN D
. I TEXTIN(IND)'["|" S NUML=NUML+1,TIN(NUML)=TEXTIN(IND) Q
. S NEWLINE=$S(TEXTIN(IND)["|_\\":"\\",1:"")
. S OLINE(1,0)=$S(NEWLINE'="":$$STRREP^PXRMUTIL(TEXTIN(IND),"_\\",""),1:TEXTIN(IND))
. K ^TMP("TIUBOIL",$J)
. D BLRPLT^TIUSRVD(.TA,"",DFN,VSTR,"OLINE")
. S NOL=$P(^TMP("TIUBOIL",$J,0),U,3)
. F JND=1:1:NOL S NUML=NUML+1,TIN(NUML)=^TMP("TIUBOIL",$J,JND,0)_NEWLINE
D FORMAT^PXRMTEXT(INDENT,PXRMRM,NUML,.TIN,.NOUT,.TEXTOUT)
F LC=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(LC)
K ^TMP("TIUBOIL",$J)
I INOBJECT M ^TMP("TIUBOIL",$J)=^TMP("PXRMTIUBOIL",$J) K ^TMP("PXRMTIUBOIL",$J)
Q
;
;===================================================
FNFTXTR(INDENT,NIN,TEXTIN,NLINES,TEXT) ;Load regular found/not found text
;that does not contain TIU objects.
N JND,NOUT,TEXTOUT
D FORMAT^PXRMTEXT(INDENT,PXRMRM,NIN,.TEXTIN,.NOUT,.TEXTOUT)
F JND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(JND)
Q
;
;===================================================
LOGIC(DFN,LOGSTR,LOGTYPE,TTYPE,DEFARR,NTXT) ;Output the detailed
;logic found/not found text.
I LOGSTR="" Q
N CTIUO,FI,LC,NIN,NLINES,SUB,TEXT,TEXTIN
I TTYPE="S" S NIN=$S(LOGTYPE="PCL":DEFARR(72),LOGTYPE="RES":DEFARR(77),1:0)
E S NIN=$S(LOGTYPE="PCL":DEFARR(62),LOGTYPE="RES":DEFARR(67),1:0)
I NIN="" Q
S FI=$P(LOGSTR,U,1)
S NIN=$S(FI=1:$P(NIN,U,1),FI=0:$P(NIN,U,2),1:0)
I +NIN=0 Q
I TTYPE="S" D
. I LOGTYPE="PCL",FI=1 S SUB=70
. I LOGTYPE="PCL",FI=0 S SUB=71
. I LOGTYPE="RES",FI=1 S SUB=75
. I LOGTYPE="RES",FI=0 S SUB=76
E D
. I LOGTYPE="PCL",FI=1 S SUB=60
. I LOGTYPE="PCL",FI=0 S SUB=61
. I LOGTYPE="RES",FI=1 S SUB=65
. I LOGTYPE="RES",FI=0 S SUB=66
S NLINES=0
S CTIUO=$S(NIN["T":1,1:0)
I CTIUO D
. N VSTR S VSTR=""
. F LC=1:1:+NIN S TEXTIN(LC)=^PXD(811.9,PXRMITEM,SUB,LC,0)
. S NIN=NIN+1,TEXTIN(NIN)="\\"
. D FNFTXTO(1,NIN,.TEXTIN,DFN,VSTR,.NLINES,.TEXT)
I 'CTIUO D
. F LC=1:1:NIN S TEXTIN(LC)=^PXD(811.9,PXRMITEM,SUB,LC,0)
. S NIN=NIN+1,TEXTIN(NIN)="\\"
. D FNFTXTR(1,NIN,.TEXTIN,.NLINES,.TEXT)
D COPYTXT^PXRMOUTU(.NTXT,NLINES,.TEXT)
Q
;
;===================================================
SNMLA(RIEN) ;Set the number of match lines for the age match text.
N IND,JND,LC,MATCHLC,NPIPE,RES,WMSG
S IND=0
F S IND=+$O(^PXD(811.9,RIEN,7,IND)) Q:IND=0 D
.;Age match text
. S (JND,LC,NPIPE)=0
. F S JND=$O(^PXD(811.9,RIEN,7,IND,1,JND)) Q:JND="" D
.. S NPIPE=NPIPE+$L(^PXD(811.9,RIEN,7,IND,1,JND,0),"|")-1
.. S LC=LC+1
. S MATCHLC=LC
. I (NPIPE#2)=1 D
.. S WMSG="match text for age range "_IND
.. D TIUOBJW(WMSG,NPIPE)
. I NPIPE>1 S MATCHLC=MATCHLC_"T"
.;Age no match text
. S (JND,LC,NPIPE)=0
. F S JND=$O(^PXD(811.9,RIEN,7,IND,2,JND)) Q:JND="" D
.. S NPIPE=NPIPE+$L(^PXD(811.9,RIEN,7,IND,2,JND,0),"|")-1
.. S LC=LC+1
. I (NPIPE#2)=1 D
.. S WMSG="no match text for age range "_IND
.. D TIUOBJW(WMSG,NPIPE)
. I NPIPE>1 S LC=LC_"T"
. S ^PXD(811.9,RIEN,7,IND,3)=MATCHLC_U_LC
Q
;
;===================================================
SNMLF(RIEN,NODE) ;Set the number of found lines for the found text.
;For regular and functional findings.
N IND,JND,LC,NNAME,NFL,NPIPE,RES,WMSG
S NNAME=$S(NODE=20:"finding",NODE=25:"function finding",1:"?")
S IND=0
F S IND=+$O(^PXD(811.9,RIEN,NODE,IND)) Q:IND=0 D
.;Found text
. S (JND,LC,NPIPE)=0
. F S JND=$O(^PXD(811.9,RIEN,NODE,IND,1,JND)) Q:JND="" D
.. S NPIPE=NPIPE+$L(^PXD(811.9,RIEN,NODE,IND,1,JND,0),"|")-1
.. S LC=LC+1
. S NFL=LC
. I (NPIPE#2)=1 D
.. S WMSG="found text for "_NNAME_" "_IND
.. D TIUOBJW(WMSG,NPIPE)
. I NPIPE>1 S NFL=NFL_"T"
.;Not found text
. S (JND,LC,NPIPE)=0
. F S JND=$O(^PXD(811.9,RIEN,NODE,IND,2,JND)) Q:JND="" D
.. S NPIPE=NPIPE+$L(^PXD(811.9,RIEN,NODE,IND,2,JND,0),"|")-1
.. S LC=LC+1
. I (NPIPE#2)=1 D
.. S WMSG="not found text for "_NNAME_" "_IND
.. D TIUOBJW(WMSG,NPIPE)
. I NPIPE>1 S LC=LC_"T"
. S ^PXD(811.9,RIEN,NODE,IND,6)=NFL_U_LC
Q
;
;===================================================
SNMLL(RIEN) ;Set the number of lines for the logic found/not found
;text. Append a "T" to the number of lines if the text contains
;a TIU object.
N CSTR,IND,LC,NPIPE,RES,SUB,TTYPE
;SUB=60 General cohort found text
;SUB=61 General cohort not found text
;SUB=65 General resolution found text
;SUB=66 General resolution not found text
;SUB=70 Summary cohort found text
;SUB=71 Summary cohort not found text
;SUB=75 Summary resolution found text
;SUB=76 Summary resolution not found text
F SUB=60,61,65,66,70,71,75,76 D
. S (IND,LC,NPIPE)=0
. F S IND=$O(^PXD(811.9,RIEN,SUB,IND)) Q:IND="" D
.. S NPIPE=NPIPE+$L(^PXD(811.9,RIEN,SUB,IND,0),"|")-1
.. S LC=LC+1
. I (NPIPE#2)=1 D
.. I SUB=60 S TTYPE="general cohort found text"
.. I SUB=61 S TTYPE="general cohort not found text"
.. I SUB=65 S TTYPE="general resolution found text"
.. I SUB=66 S TTYPE="general resolution not found text"
.. I SUB=70 S TTYPE="summary cohort found text"
.. I SUB=71 S TTYPE="summary cohort not found text"
.. I SUB=75 S TTYPE="summary resolution found text"
.. I SUB=76 S TTYPE="summary resolution not found text"
.. D TIUOBJW(TTYPE,NPIPE)
. I NPIPE>1 S LC=LC_"T"
. I SUB=60 S CSTR=LC
. I SUB=61 S ^PXD(811.9,RIEN,62)=CSTR_U_LC
. I SUB=65 S CSTR=LC
. I SUB=66 S ^PXD(811.9,RIEN,67)=CSTR_U_LC
. I SUB=70 S CSTR=LC
. I SUB=71 S ^PXD(811.9,RIEN,72)=CSTR_U_LC
. I SUB=75 S CSTR=LC
. I SUB=76 S ^PXD(811.9,RIEN,77)=CSTR_U_LC
Q
;
;===================================================
TIUOBJW(WMSG,NPIPE) ;Odd number of "|" characters in text, issue
;a warning that TIU OBJ expansion will not work.
N TEXT
S TEXT(1)=""
S TEXT(2)="Warning, "_WMSG_" has "_NPIPE_" ""|"" characters."
S TEXT(3)="Because this is an odd number, TIU Object expansion will not work."
D MES^XPDUTL(.TEXT)
Q
;
PXRMFNFT ; SLC/PKR - Process found/not found text. ;05/21/2010
+1 ;;2.0;CLINICAL REMINDERS;**4,12,16**;Feb 04, 2005;Build 119
+2 ;
+3 ;===================================================
AGE(DFN,DEFARR,FIEVAL,NTXT) ;Output the age match/no match
+1 ;text.
+2 NEW CTIUO,FI,IC,LC,NIN,NLINES,TEXT,TEXTIN
+3 IF '$DATA(FIEVAL("AGE"))
QUIT
+4 SET NLINES=0
+5 SET IC=""
+6 FOR
SET IC=$ORDER(FIEVAL("AGE",IC))
IF IC=""
QUIT
Begin DoDot:1
+7 SET FI=$SELECT(FIEVAL("AGE",IC):1,1:2)
+8 SET NIN=$PIECE(DEFARR(7,IC,3),U,FI)
+9 IF +NIN=0
QUIT
+10 KILL TEXTIN
+11 ;If CTIUO is true the text contains a TIU object.
+12 SET CTIUO=$SELECT(NIN["T":1,1:0)
+13 IF CTIUO
Begin DoDot:2
+14 NEW VSTR
SET VSTR=""
+15 ;TIU expansion expects the trailing 0, i.e. TEXTIN(N,0).
+16 FOR LC=1:1:+NIN
SET TEXTIN(LC)=^PXD(811.9,PXRMITEM,7,IC,FI,LC,0)
+17 SET NIN=NIN+1
SET TEXTIN(NIN)="\\"
+18 DO FNFTXTO(1,NIN,.TEXTIN,DFN,VSTR,.NLINES,.TEXT)
End DoDot:2
+19 IF 'CTIUO
Begin DoDot:2
+20 FOR LC=1:1:NIN
SET TEXTIN(LC)=^PXD(811.9,PXRMITEM,7,IC,FI,LC,0)
+21 SET NIN=NIN+1
SET TEXTIN(NIN)="\\"
+22 DO FNFTXTR(1,NIN,.TEXTIN,.NLINES,.TEXT)
End DoDot:2
End DoDot:1
+23 DO COPYTXT^PXRMOUTU(.NTXT,NLINES,.TEXT)
+24 QUIT
+25 ;
+26 ;===================================================
FINDING(INDENT,DFN,FINDING,IFIEVAL,NLINES,TEXT) ;Output the finding found/not
+1 ;found text.
+2 NEW CTIUO,FI,LC,NIN,NODE,TEMP,TEXTIN
+3 SET FI=$SELECT(IFIEVAL:1,1:2)
+4 SET NODE=$SELECT(FINDING["FF":25,1:20)
+5 SET TEMP=$GET(DEFARR(NODE,FINDING,6))
+6 SET NIN=$PIECE(TEMP,U,FI)
+7 IF +NIN=0
QUIT
+8 IF FINDING["FF"
SET FINDING=$PIECE(FINDING,"FF",2)
+9 SET CTIUO=$SELECT(NIN["T":1,1:0)
+10 IF CTIUO
Begin DoDot:1
+11 SET NIN=+NIN
+12 NEW VSTR
+13 FOR LC=1:1:+NIN
SET TEXTIN(LC)=^PXD(811.9,PXRMITEM,NODE,FINDING,FI,LC,0)
+14 IF $DATA(IFIEVAL("VISIT"))
Begin DoDot:2
+15 NEW TEMP,VDATE,VLOC,VSC
+16 SET TEMP=^AUPNVSIT(IFIEVAL("VISIT"),0)
+17 SET VDATE=$PIECE(TEMP,U,1)
+18 SET VLOC=$PIECE(TEMP,U,22)
+19 SET VSC=$PIECE(TEMP,U,7)
+20 SET VSTR=VLOC_";"_VDATE_";"_VSC
End DoDot:2
+21 IF '$TEST
SET VSTR=""
+22 SET NIN=NIN+1
SET TEXTIN(NIN)="\\"
+23 DO FNFTXTO(INDENT,NIN,.TEXTIN,DFN,VSTR,.NLINES,.TEXT)
End DoDot:1
+24 IF 'CTIUO
Begin DoDot:1
+25 FOR LC=1:1:NIN
SET TEXTIN(LC)=^PXD(811.9,PXRMITEM,NODE,FINDING,FI,LC,0)
+26 SET NIN=NIN+1
SET TEXTIN(NIN)="\\"
+27 DO FNFTXTR(INDENT,NIN,.TEXTIN,.NLINES,.TEXT)
End DoDot:1
+28 QUIT
+29 ;
+30 ;===================================================
FNFTXTO(INDENT,NIN,TEXTIN,DFN,VSTR,NLINES,TEXT) ;Load found/not found text
+1 ;that contains TIU objects.
+2 NEW IND,INOBJECT,JND,OLINE,NEWLINE,NOL,NOUT,NUML,TA,TEXTOUT,TIN
+3 ;Make sure this works if it is being called a part of an object.
+4 IF $DATA(^TMP("TIUBOIL",$JOB))
Begin DoDot:1
+5 KILL ^TMP("PXRMTIUBOIL",$JOB)
+6 MERGE ^TMP("PXRMTIUBOIL",$JOB)=^TMP("TIUBOIL",$JOB)
+7 SET INOBJECT=1
End DoDot:1
+8 IF '$TEST
SET INOBJECT=0
+9 SET NUML=0
+10 FOR IND=1:1:NIN
Begin DoDot:1
+11 IF TEXTIN(IND)'["|"
SET NUML=NUML+1
SET TIN(NUML)=TEXTIN(IND)
QUIT
+12 SET NEWLINE=$SELECT(TEXTIN(IND)["|_\\":"\\",1:"")
+13 SET OLINE(1,0)=$SELECT(NEWLINE'="":$$STRREP^PXRMUTIL(TEXTIN(IND),"_\\",""),1:TEXTIN(IND))
+14 KILL ^TMP("TIUBOIL",$JOB)
+15 DO BLRPLT^TIUSRVD(.TA,"",DFN,VSTR,"OLINE")
+16 SET NOL=$PIECE(^TMP("TIUBOIL",$JOB,0),U,3)
+17 FOR JND=1:1:NOL
SET NUML=NUML+1
SET TIN(NUML)=^TMP("TIUBOIL",$JOB,JND,0)_NEWLINE
End DoDot:1
+18 DO FORMAT^PXRMTEXT(INDENT,PXRMRM,NUML,.TIN,.NOUT,.TEXTOUT)
+19 FOR LC=1:1:NOUT
SET NLINES=NLINES+1
SET TEXT(NLINES)=TEXTOUT(LC)
+20 KILL ^TMP("TIUBOIL",$JOB)
+21 IF INOBJECT
MERGE ^TMP("TIUBOIL",$JOB)=^TMP("PXRMTIUBOIL",$JOB)
KILL ^TMP("PXRMTIUBOIL",$JOB)
+22 QUIT
+23 ;
+24 ;===================================================
FNFTXTR(INDENT,NIN,TEXTIN,NLINES,TEXT) ;Load regular found/not found text
+1 ;that does not contain TIU objects.
+2 NEW JND,NOUT,TEXTOUT
+3 DO FORMAT^PXRMTEXT(INDENT,PXRMRM,NIN,.TEXTIN,.NOUT,.TEXTOUT)
+4 FOR JND=1:1:NOUT
SET NLINES=NLINES+1
SET TEXT(NLINES)=TEXTOUT(JND)
+5 QUIT
+6 ;
+7 ;===================================================
LOGIC(DFN,LOGSTR,LOGTYPE,TTYPE,DEFARR,NTXT) ;Output the detailed
+1 ;logic found/not found text.
+2 IF LOGSTR=""
QUIT
+3 NEW CTIUO,FI,LC,NIN,NLINES,SUB,TEXT,TEXTIN
+4 IF TTYPE="S"
SET NIN=$SELECT(LOGTYPE="PCL":DEFARR(72),LOGTYPE="RES":DEFARR(77),1:0)
+5 IF '$TEST
SET NIN=$SELECT(LOGTYPE="PCL":DEFARR(62),LOGTYPE="RES":DEFARR(67),1:0)
+6 IF NIN=""
QUIT
+7 SET FI=$PIECE(LOGSTR,U,1)
+8 SET NIN=$SELECT(FI=1:$PIECE(NIN,U,1),FI=0:$PIECE(NIN,U,2),1:0)
+9 IF +NIN=0
QUIT
+10 IF TTYPE="S"
Begin DoDot:1
+11 IF LOGTYPE="PCL"
IF FI=1
SET SUB=70
+12 IF LOGTYPE="PCL"
IF FI=0
SET SUB=71
+13 IF LOGTYPE="RES"
IF FI=1
SET SUB=75
+14 IF LOGTYPE="RES"
IF FI=0
SET SUB=76
End DoDot:1
+15 IF '$TEST
Begin DoDot:1
+16 IF LOGTYPE="PCL"
IF FI=1
SET SUB=60
+17 IF LOGTYPE="PCL"
IF FI=0
SET SUB=61
+18 IF LOGTYPE="RES"
IF FI=1
SET SUB=65
+19 IF LOGTYPE="RES"
IF FI=0
SET SUB=66
End DoDot:1
+20 SET NLINES=0
+21 SET CTIUO=$SELECT(NIN["T":1,1:0)
+22 IF CTIUO
Begin DoDot:1
+23 NEW VSTR
SET VSTR=""
+24 FOR LC=1:1:+NIN
SET TEXTIN(LC)=^PXD(811.9,PXRMITEM,SUB,LC,0)
+25 SET NIN=NIN+1
SET TEXTIN(NIN)="\\"
+26 DO FNFTXTO(1,NIN,.TEXTIN,DFN,VSTR,.NLINES,.TEXT)
End DoDot:1
+27 IF 'CTIUO
Begin DoDot:1
+28 FOR LC=1:1:NIN
SET TEXTIN(LC)=^PXD(811.9,PXRMITEM,SUB,LC,0)
+29 SET NIN=NIN+1
SET TEXTIN(NIN)="\\"
+30 DO FNFTXTR(1,NIN,.TEXTIN,.NLINES,.TEXT)
End DoDot:1
+31 DO COPYTXT^PXRMOUTU(.NTXT,NLINES,.TEXT)
+32 QUIT
+33 ;
+34 ;===================================================
SNMLA(RIEN) ;Set the number of match lines for the age match text.
+1 NEW IND,JND,LC,MATCHLC,NPIPE,RES,WMSG
+2 SET IND=0
+3 FOR
SET IND=+$ORDER(^PXD(811.9,RIEN,7,IND))
IF IND=0
QUIT
Begin DoDot:1
+4 ;Age match text
+5 SET (JND,LC,NPIPE)=0
+6 FOR
SET JND=$ORDER(^PXD(811.9,RIEN,7,IND,1,JND))
IF JND=""
QUIT
Begin DoDot:2
+7 SET NPIPE=NPIPE+$LENGTH(^PXD(811.9,RIEN,7,IND,1,JND,0),"|")-1
+8 SET LC=LC+1
End DoDot:2
+9 SET MATCHLC=LC
+10 IF (NPIPE#2)=1
Begin DoDot:2
+11 SET WMSG="match text for age range "_IND
+12 DO TIUOBJW(WMSG,NPIPE)
End DoDot:2
+13 IF NPIPE>1
SET MATCHLC=MATCHLC_"T"
+14 ;Age no match text
+15 SET (JND,LC,NPIPE)=0
+16 FOR
SET JND=$ORDER(^PXD(811.9,RIEN,7,IND,2,JND))
IF JND=""
QUIT
Begin DoDot:2
+17 SET NPIPE=NPIPE+$LENGTH(^PXD(811.9,RIEN,7,IND,2,JND,0),"|")-1
+18 SET LC=LC+1
End DoDot:2
+19 IF (NPIPE#2)=1
Begin DoDot:2
+20 SET WMSG="no match text for age range "_IND
+21 DO TIUOBJW(WMSG,NPIPE)
End DoDot:2
+22 IF NPIPE>1
SET LC=LC_"T"
+23 SET ^PXD(811.9,RIEN,7,IND,3)=MATCHLC_U_LC
End DoDot:1
+24 QUIT
+25 ;
+26 ;===================================================
SNMLF(RIEN,NODE) ;Set the number of found lines for the found text.
+1 ;For regular and functional findings.
+2 NEW IND,JND,LC,NNAME,NFL,NPIPE,RES,WMSG
+3 SET NNAME=$SELECT(NODE=20:"finding",NODE=25:"function finding",1:"?")
+4 SET IND=0
+5 FOR
SET IND=+$ORDER(^PXD(811.9,RIEN,NODE,IND))
IF IND=0
QUIT
Begin DoDot:1
+6 ;Found text
+7 SET (JND,LC,NPIPE)=0
+8 FOR
SET JND=$ORDER(^PXD(811.9,RIEN,NODE,IND,1,JND))
IF JND=""
QUIT
Begin DoDot:2
+9 SET NPIPE=NPIPE+$LENGTH(^PXD(811.9,RIEN,NODE,IND,1,JND,0),"|")-1
+10 SET LC=LC+1
End DoDot:2
+11 SET NFL=LC
+12 IF (NPIPE#2)=1
Begin DoDot:2
+13 SET WMSG="found text for "_NNAME_" "_IND
+14 DO TIUOBJW(WMSG,NPIPE)
End DoDot:2
+15 IF NPIPE>1
SET NFL=NFL_"T"
+16 ;Not found text
+17 SET (JND,LC,NPIPE)=0
+18 FOR
SET JND=$ORDER(^PXD(811.9,RIEN,NODE,IND,2,JND))
IF JND=""
QUIT
Begin DoDot:2
+19 SET NPIPE=NPIPE+$LENGTH(^PXD(811.9,RIEN,NODE,IND,2,JND,0),"|")-1
+20 SET LC=LC+1
End DoDot:2
+21 IF (NPIPE#2)=1
Begin DoDot:2
+22 SET WMSG="not found text for "_NNAME_" "_IND
+23 DO TIUOBJW(WMSG,NPIPE)
End DoDot:2
+24 IF NPIPE>1
SET LC=LC_"T"
+25 SET ^PXD(811.9,RIEN,NODE,IND,6)=NFL_U_LC
End DoDot:1
+26 QUIT
+27 ;
+28 ;===================================================
SNMLL(RIEN) ;Set the number of lines for the logic found/not found
+1 ;text. Append a "T" to the number of lines if the text contains
+2 ;a TIU object.
+3 NEW CSTR,IND,LC,NPIPE,RES,SUB,TTYPE
+4 ;SUB=60 General cohort found text
+5 ;SUB=61 General cohort not found text
+6 ;SUB=65 General resolution found text
+7 ;SUB=66 General resolution not found text
+8 ;SUB=70 Summary cohort found text
+9 ;SUB=71 Summary cohort not found text
+10 ;SUB=75 Summary resolution found text
+11 ;SUB=76 Summary resolution not found text
+12 FOR SUB=60,61,65,66,70,71,75,76
Begin DoDot:1
+13 SET (IND,LC,NPIPE)=0
+14 FOR
SET IND=$ORDER(^PXD(811.9,RIEN,SUB,IND))
IF IND=""
QUIT
Begin DoDot:2
+15 SET NPIPE=NPIPE+$LENGTH(^PXD(811.9,RIEN,SUB,IND,0),"|")-1
+16 SET LC=LC+1
End DoDot:2
+17 IF (NPIPE#2)=1
Begin DoDot:2
+18 IF SUB=60
SET TTYPE="general cohort found text"
+19 IF SUB=61
SET TTYPE="general cohort not found text"
+20 IF SUB=65
SET TTYPE="general resolution found text"
+21 IF SUB=66
SET TTYPE="general resolution not found text"
+22 IF SUB=70
SET TTYPE="summary cohort found text"
+23 IF SUB=71
SET TTYPE="summary cohort not found text"
+24 IF SUB=75
SET TTYPE="summary resolution found text"
+25 IF SUB=76
SET TTYPE="summary resolution not found text"
+26 DO TIUOBJW(TTYPE,NPIPE)
End DoDot:2
+27 IF NPIPE>1
SET LC=LC_"T"
+28 IF SUB=60
SET CSTR=LC
+29 IF SUB=61
SET ^PXD(811.9,RIEN,62)=CSTR_U_LC
+30 IF SUB=65
SET CSTR=LC
+31 IF SUB=66
SET ^PXD(811.9,RIEN,67)=CSTR_U_LC
+32 IF SUB=70
SET CSTR=LC
+33 IF SUB=71
SET ^PXD(811.9,RIEN,72)=CSTR_U_LC
+34 IF SUB=75
SET CSTR=LC
+35 IF SUB=76
SET ^PXD(811.9,RIEN,77)=CSTR_U_LC
End DoDot:1
+36 QUIT
+37 ;
+38 ;===================================================
TIUOBJW(WMSG,NPIPE) ;Odd number of "|" characters in text, issue
+1 ;a warning that TIU OBJ expansion will not work.
+2 NEW TEXT
+3 SET TEXT(1)=""
+4 SET TEXT(2)="Warning, "_WMSG_" has "_NPIPE_" ""|"" characters."
+5 SET TEXT(3)="Because this is an odd number, TIU Object expansion will not work."
+6 DO MES^XPDUTL(.TEXT)
+7 QUIT
+8 ;