PXRMPTD2 ;SLC/PKR/PJH - Reminder Inquiry print template routines. ;03/07/2011
;;2.0;CLINICAL REMINDERS;**4,6,18**;Feb 04, 2005;Build 152
;================================================
DATE(FIND0,PIECE,FLDNUM,TITLE,RJC,PAD,FILENUM,FLG) ;Standard DATE
N DATE,X
S DATE=$P($G(FIND0),U,PIECE)
I DATE'="" D
. S DATE=$$FMTE^XLFDT(DATE,"5Z"),X=$$RJ^XLFSTR(TITLE,RJC,PAD),X=X_" "_DATE
. D ^DIWP
Q
;
;================================================
ENTRYNAM(VPTR) ;Given the variable pointer return the entry name. The
;variable pointer list contains the information necessary to do the
;look up.
N IEN,FILENUM,NAME,ROOT
I VPTR="" Q ""
S IEN=$P(VPTR,";",1),ROOT=$P(VPTR,";",2),FILENUM=$P(PXRMFVPL(ROOT),U,1)
S NAME=$$GET1^DIQ(FILENUM,IEN,.01,"","","")
Q NAME
;
;================================================
FREQ(FREQ) ;Format frequency.
I FREQ=-1 Q "Cannot be determined"
I +FREQ=0 Q FREQ_" - Not indicated"
I FREQ="99Y" Q "99Y - Once"
N UNIT
S UNIT=$S(FREQ["H":" hour",FREQ["D":" day",FREQ["W":" week",FREQ["M":" month",FREQ["Y":" year",1:" ?")_$S(+FREQ>1:"s",1:"")
Q +FREQ_UNIT
;
;================================================
FTYPE(VPTR,CNT) ;Return finding type.
N FTYPE,ROOT
I VPTR="" Q "UNDEFINED?"
S ROOT=$P(VPTR,";",2)
I '$D(PXRMFVPL) N PXRMFVPL D BLDRLIST^PXRMVPTR(811.902,.01,.PXRMFVPL)
S FTYPE=$S(CNT=1:$P(PXRMFVPL(ROOT),U,4),1:$P(PXRMFVPL(ROOT),U,2))
Q FTYPE
;
;================================================
GENFREQ(PXF0) ;Print age range frequency set for findings.
N PXF,PXW,PXAMIN,PXAMAX
S PXF=$P(PXF0,U,4)
I PXF="" Q ""
S PXAMIN=$P(PXF0,U,2),PXAMAX=$P(PXF0,U,3)
S PXW=$$FREQ(PXF)
S PXW=PXW_$$FMTAGE^PXRMAGE(PXAMIN,PXAMAX)
Q PXW
;
;================================================
GENIEN(FINDING) ;Return internal entry number for findings.
N F0,IEN,PREFIX,ROOT,VPTR
S ROOT="^PXD(811.9,D0,20,FINDING,0)"
S F0=@ROOT
S VPTR=$P(F0,U,1)
I VPTR="" Q "UNDEFINED"
S IEN=$P(VPTR,";",1),ROOT=$P(VPTR,";",2)
I '$D(PXRMFVPL) N PXRMFVPL D BLDRLIST^PXRMVPTR(811.902,.01,.PXRMFVPL)
S VPTR=PXRMFVPL(ROOT)
S PREFIX=$P(VPTR,U,4)
Q " (FI("_+FINDING_")="_PREFIX_"("_IEN_"))"
;
PXRMPTD2 ;SLC/PKR/PJH - Reminder Inquiry print template routines. ;03/07/2011
+1 ;;2.0;CLINICAL REMINDERS;**4,6,18**;Feb 04, 2005;Build 152
+2 ;================================================
DATE(FIND0,PIECE,FLDNUM,TITLE,RJC,PAD,FILENUM,FLG) ;Standard DATE
+1 NEW DATE,X
+2 SET DATE=$PIECE($GET(FIND0),U,PIECE)
+3 IF DATE'=""
Begin DoDot:1
+4 SET DATE=$$FMTE^XLFDT(DATE,"5Z")
SET X=$$RJ^XLFSTR(TITLE,RJC,PAD)
SET X=X_" "_DATE
+5 DO ^DIWP
End DoDot:1
+6 QUIT
+7 ;
+8 ;================================================
ENTRYNAM(VPTR) ;Given the variable pointer return the entry name. The
+1 ;variable pointer list contains the information necessary to do the
+2 ;look up.
+3 NEW IEN,FILENUM,NAME,ROOT
+4 IF VPTR=""
QUIT ""
+5 SET IEN=$PIECE(VPTR,";",1)
SET ROOT=$PIECE(VPTR,";",2)
SET FILENUM=$PIECE(PXRMFVPL(ROOT),U,1)
+6 SET NAME=$$GET1^DIQ(FILENUM,IEN,.01,"","","")
+7 QUIT NAME
+8 ;
+9 ;================================================
FREQ(FREQ) ;Format frequency.
+1 IF FREQ=-1
QUIT "Cannot be determined"
+2 IF +FREQ=0
QUIT FREQ_" - Not indicated"
+3 IF FREQ="99Y"
QUIT "99Y - Once"
+4 NEW UNIT
+5 SET UNIT=$SELECT(FREQ["H":" hour",FREQ["D":" day",FREQ["W":" week",FREQ["M":" month",FREQ["Y":" year",1:" ?")_$SELECT(+FREQ>1:"s",1:"")
+6 QUIT +FREQ_UNIT
+7 ;
+8 ;================================================
FTYPE(VPTR,CNT) ;Return finding type.
+1 NEW FTYPE,ROOT
+2 IF VPTR=""
QUIT "UNDEFINED?"
+3 SET ROOT=$PIECE(VPTR,";",2)
+4 IF '$DATA(PXRMFVPL)
NEW PXRMFVPL
DO BLDRLIST^PXRMVPTR(811.902,.01,.PXRMFVPL)
+5 SET FTYPE=$SELECT(CNT=1:$PIECE(PXRMFVPL(ROOT),U,4),1:$PIECE(PXRMFVPL(ROOT),U,2))
+6 QUIT FTYPE
+7 ;
+8 ;================================================
GENFREQ(PXF0) ;Print age range frequency set for findings.
+1 NEW PXF,PXW,PXAMIN,PXAMAX
+2 SET PXF=$PIECE(PXF0,U,4)
+3 IF PXF=""
QUIT ""
+4 SET PXAMIN=$PIECE(PXF0,U,2)
SET PXAMAX=$PIECE(PXF0,U,3)
+5 SET PXW=$$FREQ(PXF)
+6 SET PXW=PXW_$$FMTAGE^PXRMAGE(PXAMIN,PXAMAX)
+7 QUIT PXW
+8 ;
+9 ;================================================
GENIEN(FINDING) ;Return internal entry number for findings.
+1 NEW F0,IEN,PREFIX,ROOT,VPTR
+2 SET ROOT="^PXD(811.9,D0,20,FINDING,0)"
+3 SET F0=@ROOT
+4 SET VPTR=$PIECE(F0,U,1)
+5 IF VPTR=""
QUIT "UNDEFINED"
+6 SET IEN=$PIECE(VPTR,";",1)
SET ROOT=$PIECE(VPTR,";",2)
+7 IF '$DATA(PXRMFVPL)
NEW PXRMFVPL
DO BLDRLIST^PXRMVPTR(811.902,.01,.PXRMFVPL)
+8 SET VPTR=PXRMFVPL(ROOT)
+9 SET PREFIX=$PIECE(VPTR,U,4)
+10 QUIT " (FI("_+FINDING_")="_PREFIX_"("_IEN_"))"
+11 ;