source: WorldVistAEHR/trunk/r/CLINICAL_REMINDERS-PXRM/PXRMOUTC.m@ 1166

Last change on this file since 1166 was 623, checked in by George Lilly, 15 years ago

revised back to 6/30/08 version

File size: 5.4 KB
Line 
1PXRMOUTC ; SLC/PKR - Clinical Maintenance output. ;10/07/2005
2 ;;2.0;CLINICAL REMINDERS;**4**;Feb 04, 2005;Build 21
3 ;================================================
4CM(DEFARR,PXRMPDEM,PCLOGIC,RESLOGIC,RESDATE,FIEVAL) ;Prepare the
5 ;clinical maintenance output.
6 N IND,FIDATA,FINDING,FLIST,FTYPE
7 N HDR,NHDR,IFIEVAL,LIST,NFLINES,NTXT,NUM
8 N TEMP,TEXT
9 S NTXT=0
10 ;Check for a dead patient
11 I +$G(PXRMPDEM("DOD"))>0 D
12 . S TEMP=$$FMTE^XLFDT(PXRMPDEM("DOD"),"5DZ")
13 . S TEXT="Patient is deceased, date of death: "_TEMP
14 . D ADDTXT^PXRMOUTU(1,PXRMRM,.NTXT,TEXT)
15 ;Display the frequency information only if there is resolution logic.
16 I RESLOGIC'="" D FREQ(.DEFARR,.NTXT,.TEXT)
17 ;Output the AGE match/no match text.
18 D AGE^PXRMFNFT(PXRMPDEM("DFN"),.DEFARR,.FIEVAL,.NTXT)
19 ;Process the findings in the order: patient cohort, resolution,
20 ;age, and informational.
21 M FIDATA=FIEVAL
22 F FTYPE="PCL","RES","AGE","INFO" D
23 . S LIST=$S(FTYPE="PCL":DEFARR(32),FTYPE="RES":DEFARR(36),FTYPE="AGE":DEFARR(40),FTYPE="INFO":DEFARR(42))
24 .;Output the general logic text.
25 . I FTYPE="PCL" D LOGIC^PXRMFNFT(PXRMPDEM("DFN"),PCLOGIC,FTYPE,"D",.DEFARR,.NTXT)
26 . I FTYPE="RES",$P(PCLOGIC,U,1) D LOGIC^PXRMFNFT(PXRMPDEM("DFN"),RESLOGIC,FTYPE,"D",.DEFARR,.NTXT)
27 .;Process the findings for each type.
28 . K TEXT
29 . S (NHDR,NFLINES)=0
30 . S NUM=+$P(LIST,U,1)
31 . S FLIST=$P(LIST,U,2)
32 . F IND=1:1:NUM D
33 .. S FINDING=$P(FLIST,";",IND)
34 ..;No output for age or sex findings.
35 .. I (FINDING="AGE")!(FINDING="SEX") Q
36 ..;Make sure each finding is processed only once.
37 .. I '$D(FIDATA(FINDING)) Q
38 .. K IFIEVAL
39 .. I FIEVAL(FINDING) M IFIEVAL=FIEVAL(FINDING)
40 .. E S IFIEVAL=0
41 ..;If the finding is false all we need to do is process the not found
42 ..;text. If it is true we also need to output the finding information.
43 .. I IFIEVAL D FOUT(1,.IFIEVAL,.NFLINES,.TEXT)
44 ..;Output the found/not found text for the finding.
45FNF .. D FINDING^PXRMFNFT(3,PXRMPDEM("DFN"),FINDING,.IFIEVAL,.NFLINES,.TEXT)
46 ..;Make sure each finding is processed only once.
47 .. K FIDATA(FINDING)
48 .;
49 .;If there was any text for this finding type create a header.
50 . D HEADER(FTYPE,NFLINES,RESDATE,.NHDR,.HDR)
51 .;Output the header and the finding text.
52 . D ADDTXTA^PXRMOUTU(1,PXRMRM,.NTXT,NHDR,.HDR)
53 . D COPYTXT^PXRMOUTU(.NTXT,NFLINES,.TEXT)
54 ;Output INFO nodes
55 D INFO^PXRMOUTU(PXRMITEM,.NTXT)
56 Q
57 ;
58 ;================================================
59FOUT(INDENT,IFIEVAL,NLINES,TEXT) ;Do output for individual findings
60 ;in the FINDING array.
61 I $D(IFIEVAL("TERM")) D OUTPUT^PXRMTERM(1,.IFIEVAL,.NFLINES,.TEXT) Q
62 N FTYPE
63 S FTYPE=$P(IFIEVAL("FINDING"),U,1)
64 S FTYPE=$P(FTYPE,";",2)
65 I FTYPE="AUTTEDT(" D OUTPUT^PXRMEDU(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
66 I FTYPE="AUTTEXAM(" D OUTPUT^PXRMEXAM(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
67 I FTYPE="AUTTHF(" D OUTPUT^PXRMHF(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
68 I FTYPE="AUTTIMM(" D OUTPUT^PXRMIMM(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
69 I FTYPE="AUTTSK(" D OUTPUT^PXRMSKIN(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
70 I FTYPE="GMRD(120.51," D OUTPUT^PXRMVITL(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
71 I FTYPE="LAB(60," D OUTPUT^PXRMLAB(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
72 I FTYPE="ORD(101.43," D OUTPUT^PXRMORDR(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
73 I FTYPE="PS(50.605," D OUTPUT^PXRMDRCL(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
74 I FTYPE="PSDRUG(" D OUTPUT^PXRMDRUG(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
75 I FTYPE="PSNDF(50.6," D OUTPUT^PXRMDGEN(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
76 I FTYPE="PS(55," D OUTPUT^PXRMDIN(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
77 I FTYPE="PS(55NVA," D OUTPUT^PXRMDNVA(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
78 I FTYPE="PSRX(" D OUTPUT^PXRMDOUT(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
79 I FTYPE="PXD(811.2," D OUTPUT^PXRMTAX(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
80 I FTYPE="PXRMD(802.4," D OUTPUT^PXRMFF(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
81 I FTYPE="PXRMD(810.9," D OUTPUT^PXRMLOCF(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
82 I FTYPE="PXRMD(811.4," D OUTPUT^PXRMCF(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
83 I FTYPE="RAMIS(71," D OUTPUT^PXRMRAD(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
84 I FTYPE="YTT(601," D OUTPUT^PXRMMH(INDENT,.IFIEVAL,.NLINES,.TEXT) Q
85 Q
86 ;
87 ;================================================
88FREQ(DEFARR,NTXT,TEXT) ;Display the frequency information.
89 N FREQ,TEMP
90 ;If there was a custom date due print out that information.
91 I $D(^TMP(PXRMPID,$J,PXRMITEM,"zCDUE")) D
92 . S TEMP=^TMP(PXRMPID,$J,PXRMITEM,"zCDUE")
93 . S TEXT=$$OUTPUT^PXRMCDUE(TEMP,.DEFARR)
94 . I DEFARR(31)["AGE" D
95 .. S TEMP=$G(^TMP(PXRMPID,$J,PXRMITEM,"zFREQARNG"))
96 .. I TEMP'="" S TEXT=TEXT_" Applicable"_$$FMTAGE^PXRMAGE($P(TEMP,U,2),$P(TEMP,U,3))_"."
97 . D ADDTXT^PXRMOUTU(1,PXRMRM,.NTXT,TEXT)
98 E D
99 . S TEMP=$G(^TMP(PXRMPID,$J,PXRMITEM,"zFREQARNG"))
100 . I TEMP'="" D
101 .. S FREQ=$P(TEMP,U,1)
102 .. S TEXT=$$FMTFREQ^PXRMAGE(FREQ)
103 .. I FREQ=-1 S TEXT=TEXT_" for this patient."
104 .. I DEFARR(31)["AGE",FREQ'=-1 S TEXT=TEXT_$$FMTAGE^PXRMAGE($P(TEMP,U,2),$P(TEMP,U,3))_"."
105 .. D ADDTXT^PXRMOUTU(1,PXRMRM,.NTXT,TEXT)
106 Q
107 ;
108 ;================================================
109HEADER(FTYPE,NLINES,RESDATE,NHDR,HDR) ;Create a finding header.
110 I FTYPE="RES" D Q
111 . I +RESDATE'=0 D Q
112 .. S HDR(2)="Resolution: Last done "_$$EDATE^PXRMDATE(RESDATE)
113 .. S NHDR=2
114 .. S HDR(1)="\\"
115 . I '$D(HDR(2)),NLINES>0 D
116 .. S HDR(2)="Resolution:"
117 .. S NHDR=2
118 .. S HDR(1)="\\"
119 ;
120 I NLINES=0 Q
121 I FTYPE="PCL" D Q
122 . S NHDR=2
123 . S HDR(1)="\\"
124 . S HDR(2)="Cohort:"
125 ;
126 I FTYPE="AGE" D Q
127 . S NHDR=2
128 . S HDR(1)="\\"
129 . S HDR(2)="Age/Frequency:"
130 ;
131 I FTYPE="INFO" D Q
132 . S NHDR=2
133 . S HDR(1)="\\"
134 . S HDR(2)="Information:"
135 Q
136 ;
Note: See TracBrowser for help on using the repository browser.