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

PXRMOUTC.m

Go to the documentation of this file.
PXRMOUTC ; SLC/PKR - Clinical Maintenance output. ;05/26/2022
 ;;2.0;CLINICAL REMINDERS;**4,6,17,26,47,46,42,65**;Feb 04, 2005;Build 438
 ;================================================
CM(DEFARR,PXRMPDEM,PCLOGIC,RESLOGIC,RESDATE,FIEVAL,OUTTYPE) ;Prepare the 
 ;Clinical maintenance (OUTTYPE=5) and order check (OUTTPYPE=55)
 ;output.
 N DISPLAY,IND,JND,FINDING,FLIST,FLISTNODE,FTYPE
 N HDR,NHDR,IFIEVAL,LIST,NFLINES,NTXT,NUM,NUMLINES
 N TEMP,TEXT
 S FLISTNODE("PCL")=32,FLISTNODE("RES")=36,FLISTNODE("AGE")=40,FLISTNODE("INFO")=42
 S FLISTNODE("CONTRA")=81,FLISTNODE("REFUSED")=91
 S NTXT=0
 ;Check for a dead patient
 I +$G(PXRMPDEM("DOD"))>0 D
 . S TEMP=$$FMTE^XLFDT(PXRMPDEM("DOD"),"5DZ")
 . S TEXT="Patient is deceased, date of death: "_TEMP
 . D ADDTXT^PXRMOUTU(1,PXRMRM,.NTXT,TEXT)
 ;Display the frequency information only if there is resolution logic.
 I RESLOGIC'="",OUTTYPE=5 D FREQ(.DEFARR,.NTXT,.TEXT)
 ;Output the AGE match/no match text.
 D AGE^PXRMFNFT(PXRMPDEM("DFN"),.DEFARR,.FIEVAL,.NTXT)
 ;Process the findings in the order: patient cohort, resolution,
 ;age, and informational.
 F FTYPE="PCL","RES","AGE","CONTRA","REFUSED","INFO" D
 . S LIST=DEFARR(FLISTNODE(FTYPE))
 .;Output the general logic text.
 . I FTYPE="PCL" D LOGIC^PXRMFNFT(PXRMPDEM("DFN"),PCLOGIC,FTYPE,"D",.DEFARR,.FIEVAL,.NTXT)
 . I FTYPE="RES",$P(PCLOGIC,U,1) D LOGIC^PXRMFNFT(PXRMPDEM("DFN"),RESLOGIC,FTYPE,"D",.DEFARR,.FIEVAL,.NTXT)
 .;Process the findings for each type.
 . K TEXT
 . S (NHDR,NFLINES)=0
 . S NUM=+$P(LIST,U,1)
 . S FLIST=$P(LIST,U,2)
 . F IND=1:1:NUM D
 .. S FINDING=$P(FLIST,";",IND)
 ..;No output for age or sex findings.
 .. I (FINDING="AGE")!(FINDING="SEX") Q
 ..;If the finding is not defined skip it. This can occur when the
 ..;reminder is N/A.
 .. I '$D(FIEVAL(FINDING)) Q
 .. K IFIEVAL
 .. I FIEVAL(FINDING) D
 ... M IFIEVAL=FIEVAL(FINDING)
 ...;Remove any false occurrences so they are not displayed.
 ... S JND=0
 ... F  S JND=+$O(IFIEVAL(JND)) Q:JND=0  K:'IFIEVAL(JND) IFIEVAL(JND)
 .. E  D
 ... S IFIEVAL=0
 ..;Function findings are processed as a group.
 .. I IFIEVAL,FINDING'["FF" D FOUT(1,.IFIEVAL,.NFLINES,.TEXT)
 ..;Output the found/not found text for the finding.
 .. D FINDING^PXRMFNFT(PXRMPDEM("DFN"),FINDING,.FIEVAL,.IFIEVAL,.NFLINES,.TEXT)
 .;
 .;Display function finding values for this FTYPE, skip INFO only.
 . I (FTYPE'="INFO"),(FLIST["FF") D FFOUT(3,NUM,FLIST,.FIEVAL,.NFLINES,.TEXT)
 .;If there was any text for this finding type create a header.
 . I OUTTYPE=5 D HEADER(FTYPE,NFLINES,RESDATE,.NHDR,.HDR)
 .;Output the header and the finding text.
 . D ADDTXTA^PXRMOUTU(1,PXRMRM,.NTXT,NHDR,.HDR)
 . D COPYTXT^PXRMOUTU(.NTXT,NFLINES,.TEXT)
 ;If there are any contraindications, precautions, or refusals output them.
 ;Use CRSTATUS and the line counts to determine if the CONTRAINDICATED and
 ;REFUSED true and false text should be output.
 I (CRSTATUS="CONTRA") D
 . S NUMLINES=$P(DEFARR(85),U,1)
 . I NUMLINES>0 D CRLOGIC^PXRMFNFT(PXRMPDEM("DFN"),NUMLINES,83,.NTXT)
 I (CRSTATUS'="CONTRA") D
 . S NUMLINES=$P(DEFARR(85),U,2)
 . I NUMLINES>0 D CRLOGIC^PXRMFNFT(PXRMPDEM("DFN"),NUMLINES,84,.NTXT)
 I (CRSTATUS="REFUSED") D
 . S NUMLINES=$P(DEFARR(95),U,1)
 . I NUMLINES>0 D CRLOGIC^PXRMFNFT(PXRMPDEM("DFN"),NUMLINES,93,.NTXT)
 I (CRSTATUS'="CONTRA"),(CRSTATUS'="REFUSED") D
 . S NUMLINES=$P(DEFARR(95),U,2)
 . I NUMLINES>0 D CRLOGIC^PXRMFNFT(PXRMPDEM("DFN"),NUMLINES,94,.NTXT)
 ;
 I $D(FIEVAL("CONTRA")) D OUTPUTCONREF^PXRMIMM(1,"CONTRA",.DEFARR,.FIEVAL,.NTXT)
 I $D(FIEVAL("REFUSED")) D OUTPUTCONREF^PXRMIMM(1,"REFUSED",.DEFARR,.FIEVAL,.NTXT)
 I $D(FIEVAL("PRECAUTION")) D OUTPUTCONREF^PXRMIMM(1,"PRECAUTION",.DEFARR,.FIEVAL,.NTXT)
 ;Output INFO nodes
 D INFO^PXRMOUTU(PXRMITEM,.NTXT)
 ;Check for term warnings.
 I '$D(^TMP(PXRMPID,$J,PXRMITEM,"WARNING")) Q
 N DESC,NTW
 K TEXT
 S DESC="NOTERM",NTW=2
 F  S DESC=$O(^TMP(PXRMPID,$J,PXRMITEM,"WARNING",DESC)) Q:DESC'["NOTERM"  D
 . S NTW=NTW+1,TEXT(NTW)=$P(^TMP(PXRMPID,$J,PXRMITEM,"WARNING",DESC),":",2)_"\\"
 I NTW>2 D
 . S TEXT(1)=""
 . S TEXT(2)="Term Warnings:\\"
 . D ADDTXTA^PXRMOUTU(1,PXRMRM,.NTXT,NTW,.TEXT)
 Q
 ;
 ;================================================
FOUT(INDENT,IFIEVAL,NLINES,TEXT) ;Do output for individual findings 
 ;in the FINDING array.
 I $D(IFIEVAL("TERM")) D OUTPUT^PXRMTERM(1,.IFIEVAL,.NFLINES,.TEXT) Q
 N FTYPE
 S FTYPE=$P(IFIEVAL("FINDING"),U,1)
 S FTYPE=$P(FTYPE,";",2)
 I FTYPE="AUTTEDT(" D OUTPUT^PXRMEDU(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="AUTTEXAM(" D OUTPUT^PXRMEXAM(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="AUTTHF(" D OUTPUT^PXRMHF(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="AUTTIMM(" D OUTPUT^PXRMIMM(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="AUTTSK(" D OUTPUT^PXRMSKIN(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="GMRD(120.51," D OUTPUT^PXRMVITL(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="LAB(60," D OUTPUT^PXRMLAB(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="ORD(101.43," D OUTPUT^PXRMORDR(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="PS(50.605," D OUTPUT^PXRMDRCL(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="PSDRUG(" D OUTPUT^PXRMDRUG(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="PSNDF(50.6," D OUTPUT^PXRMDGEN(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="PS(55," D OUTPUT^PXRMDRUG(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="PS(55NVA," D OUTPUT^PXRMDRUG(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="PSRX(" D OUTPUT^PXRMDRUG(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="PXD(811.2," D OUTPUT^PXRMTAX(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="PXRMD(802.4," D OUTPUT^PXRMFF(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="PXRMD(810.9," D OUTPUT^PXRMLOCF(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="PXRMD(811.4," D OUTPUT^PXRMCF(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="RAMIS(71," D OUTPUT^PXRMRAD(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 I FTYPE="YTT(601.71," D OUTPUT^PXRMMH(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
 Q
 ;
 ;================================================
FFOUT(INDENT,NUM,FLIST,FIEVAL,NLINES,TEXT) ;Output for function findings.
 ;Only display the Function Finding in Reminder Test.
 I '$D(PXRMDEBG) Q
 N IND,FFNUM,FFLIST,FFTEXT,FINDING,NOUT,TEXTOUT
 F IND=1:1:NUM D
 . S FINDING=$P(FLIST,";",IND)
 . I '$D(FIEVAL(FINDING)) Q
 . I $E(FINDING,1,2)="FF" S FFNUM=$P(FINDING,"FF",2),FFLIST(FFNUM)=""
 I '$D(FFLIST) Q
 S FFNUM=$O(FFLIST(0))
 S FFTEXT="FF("_FFNUM_")="_FIEVAL("FF"_FFNUM)
 F  S FFNUM=$O(FFLIST(FFNUM)) Q:FFNUM=""  D
 . S FFTEXT=FFTEXT_", FF("_FFNUM_")="_FIEVAL("FF"_FFNUM)
 D FORMATS^PXRMTEXT(INDENT,PXRMRM,FFTEXT,.NOUT,.TEXTOUT)
 F IND=1:1:NOUT S NLINES=NLINES+1,TEXT(NLINES)=TEXTOUT(IND)
 S NLINES=NLINES+1,TEXT(NLINES)=""
 Q
 ;
 ;================================================
FREQ(DEFARR,NTXT,TEXT) ;Display the frequency information.
 N FREQ,TEMP
 ;If there was a custom date due print out that information.
 I $D(^TMP(PXRMPID,$J,PXRMITEM,"zCDUE")) D
 . S TEMP=^TMP(PXRMPID,$J,PXRMITEM,"zCDUE")
 . S TEXT=$$OUTPUT^PXRMCDUE(TEMP,.DEFARR)
 . I DEFARR(31)["AGE" D
 .. S TEMP=$G(^TMP(PXRMPID,$J,PXRMITEM,"zFREQARNG"))
 .. I TEMP'="" S TEXT=TEXT_" Applicable"_$$FMTAGE^PXRMAGE($P(TEMP,U,2),$P(TEMP,U,3))_"."
 . D ADDTXT^PXRMOUTU(1,PXRMRM,.NTXT,TEXT)
 E  D
 . S TEMP=$G(^TMP(PXRMPID,$J,PXRMITEM,"zFREQARNG"))
 . I TEMP'="" D
 .. S FREQ=$P(TEMP,U,1)
 .. S TEXT=$$FMTFREQ^PXRMAGE(FREQ)
 .. I FREQ=-1 S TEXT=TEXT_" for this patient."
 .. I DEFARR(31)["AGE",FREQ'=-1 S TEXT=TEXT_$$FMTAGE^PXRMAGE($P(TEMP,U,2),$P(TEMP,U,3))_"."
 .. D ADDTXT^PXRMOUTU(2,PXRMRM,.NTXT,TEXT)
 Q
 ;
 ;================================================
 K HDR
 I FTYPE="RES" D  Q
 . I +RESDATE'=0 D  Q
 .. S HDR(2)="Resolution: Last done - "_$$EDATE^PXRMDATE(RESDATE)
 .. S NHDR=2
 .. S HDR(1)="\\"
 . I '$D(HDR(2)),NLINES>0 D
 .. S HDR(2)="Resolution:"
 .. S NHDR=2
 .. S HDR(1)="\\"
 ;
 I NLINES=0 Q
 S NHDR=2
 S HDR(1)="\\"
 I FTYPE="PCL" S HDR(2)="Cohort:"  Q
 I FTYPE="AGE" S HDR(2)="Age/Frequency:"  Q
 I FTYPE="CONTRA" S HDR(2)="Contraindicated:"  Q
 I FTYPE="REFUSED" S HDR(2)="Refused:"  Q
 I FTYPE="INFO" S HDR(2)="Information:"
 Q
 ;