source: FOIAVistA/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VAFHLZMT.m@ 1606

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

initial load of FOIAVistA 6/30/08 version

File size: 5.8 KB
Line 
1VAFHLZMT ;ALB/MLI/LD - Creation of HL7 ZMT (means test) segment ; 22 Mar 93
2 ;;5.3;Registration;**14,33,122,182**;Aug 13, 1993
3 ;
4 ; This routine returns the ZMT segment which contains means test
5 ; data for a selected patient.
6 ;
7EN(DFN,VAFSTR,VAFMTDT,VAFTYPE,SETID,DELETE,LIMIT) ; Entry point to get ZMT segment
8 ;
9 ; Input:
10 ; DFN - as the IEN or corresponding patient in the PATIENT file
11 ; VAFSTR - as string of segment fields needed separated by commas
12 ; VAFMTDT - (optional) as date of desired means test (defaults to latest MT)
13 ; VAFTYPE - (optional) as type of test: 1 - Means Test (default=1)
14 ; 2 - Copay Test
15 ; SETID - (optional) value to use for SEQ 1, the set id field (1 used
16 ; as default if not passed.)
17 ; DELETE - (optional, pass by reference) This array is used to
18 ; indicate whether the segment is being used to notify of the
19 ; the deletion of a means test, pharmacy copay test, or a
20 ; hardship determinatin. If a means test or hardship is being
21 ; deleted, then VAFTYPE must equal 1. If an Rx copay test is
22 ; being deleted, then VAFTYPE must equal 2. The subscripts
23 ; are as follows:
24 ; DELETE("DATE OF TEST")=<date of test> - indicates
25 ; the income year of the test that the deletion flags
26 ; refer to
27 ; DELETE("HARDSHIP") - if $G(DELETE("HARDSHIP"))=1 then the
28 ; segment will be created to delete the hardship.
29 ; DELETE("MT") - if $G(DELETE("MT"))=1 then
30 ; the segment will be created to delete a means test.
31 ; DELETE("RX")= if $G(DELETE("RX"))=1 then
32 ; the segment will be created to delete a pharmacy
33 ; copay test.
34 ; LIMIT - (optional) if $G(LIMIT)=1 then this indicates that a test in
35 ; a prior income year than indicated by the VAFMTDT parameter
36 ; should NOT be returned in the ZMT segment
37 ;
38 ; ****Also assumes all HL7 variables are defined as returned ****
39 ; by the INIT^HLTRANS call
40 ;
41 ; Output - string in the form of the DHCP HL7 ZMT segment
42 ;
43 ;
44 N NODE,PRIM,X,Y,VAFY,NODE2
45 ;
46 I '$G(DFN)!($G(VAFSTR)']"") G QUIT
47 S $P(VAFY,HLFS,22)="",VAFSTR=","_VAFSTR_","
48 S VAFTYPE=$S($G(VAFTYPE):VAFTYPE,1:1)
49 S VAFMTDT=$S($G(VAFMTDT):VAFMTDT,1:DT)
50 S $P(VAFY,HLFS,1)=$S($G(SETID):SETID,1:1)
51 S (NODE,NODE2,PRIM)=""
52 ;
53 ;handle deletions of a test
54 I ($G(DELETE("MT"))=1),VAFTYPE=1 D G QUIT
55 .S $P(VAFY,HLFS,2)=$$HLDATE^HLFNC(DELETE("DATE OF TEST")) ; MT Date
56 .S $P(VAFY,HLFS,3)=HLQ
57 .I ($G(DELETE("HARDSHIP"))=1) S $P(VAFY,HLFS,24)=HLQ
58 .S $P(VAFY,HLFS,17)=VAFTYPE ; Type Of Test
59 ;
60 I ($G(DELETE("RX"))=1),VAFTYPE=2 D G QUIT
61 .S $P(VAFY,HLFS,2)=$$HLDATE^HLFNC(DELETE("DATE OF TEST")) ; MT Date
62 .S $P(VAFY,HLFS,3)=HLQ
63 .S $P(VAFY,HLFS,17)=VAFTYPE ; Type Of Test
64 ;
65 S X=$$LST^DGMTU(DFN,VAFMTDT,$S($G(VAFTYPE):VAFTYPE,1:1))
66 I +X S NODE=$G(^DGMT(408.31,+X,0)),PRIM=$G(^("PRIM")),NODE2=$G(^DGMT(408.31,+X,2))
67 ;
68 ;if $$LST^DGMTU returned the wrong income year than disregard it
69 I ($G(LIMIT)=1),$E(VAFMTDT,1,3)'=$E(+NODE,1,3) S (NODE,NODE2,X,PRIM)=""
70 ;
71 I VAFSTR[",2," S $P(VAFY,HLFS,2)=$S(+NODE:$$HLDATE^HLFNC(+NODE),1:HLQ) ; MT Date
72 I VAFSTR[",3," S X=$P($G(^DG(408.32,+$P(NODE,"^",3),0)),"^",2),$P(VAFY,HLFS,3)=$S(X]"":X,1:"") ; MT Status
73 I VAFSTR[",4," S $P(VAFY,HLFS,4)=$S($P(NODE,"^",4)]"":$P(NODE,"^",4),1:HLQ) ; Income
74 I VAFSTR[",5," S $P(VAFY,HLFS,5)=$S($P(NODE,"^",5)]"":$P(NODE,"^",5),1:HLQ) ; Net Worth
75 I VAFSTR[",6," S $P(VAFY,HLFS,6)=$S($P(NODE,"^",10):$$HLDATE^HLFNC($P(NODE,"^",10)),1:HLQ) ; Adjudication Date/Time
76 I VAFSTR[",7," S $P(VAFY,HLFS,7)=$$YN^VAFHLFNC($P(NODE,"^",11)) ; Agreed To Pay
77 I VAFSTR[",8," S $P(VAFY,HLFS,8)=$S($P(NODE,"^",12):$P(NODE,"^",12),1:HLQ) ; Threshold A
78 I VAFSTR[",9," S $P(VAFY,HLFS,9)=$S($P(NODE,"^",15)]"":$P(NODE,"^",15),1:HLQ) ; Deductible Expenses
79 I VAFSTR[",10," S $P(VAFY,HLFS,10)=$S($P(NODE,"^",7):$$HLDATE^HLFNC($P(NODE,"^",7)),1:HLQ) ; Date/Time Completed
80 I VAFSTR[",11," S $P(VAFY,HLFS,11)=$$YN^VAFHLFNC($P(NODE,"^",16)) ; Previous Year Means Test Threshold Flag
81 I VAFSTR[",12," S $P(VAFY,HLFS,12)=$S($P(NODE,"^",18)]"":$P(NODE,"^",18),1:HLQ) ; Total Dependents
82 I VAFSTR[",13," S $P(VAFY,HLFS,13)=$$YN^VAFHLFNC($P(NODE,"^",20)) ; Hardship
83 I VAFSTR[",14," S $P(VAFY,HLFS,14)=$S($P(NODE,"^",21):$$HLDATE^HLFNC($P(NODE,"^",21)),1:HLQ) ; Hardship Review Date
84 I VAFSTR[",15," S $P(VAFY,HLFS,15)=$S($P(NODE,"^",24):$$HLDATE^HLFNC($P(NODE,"^",24)),1:HLQ) ; Date Vet Signed Test
85 I VAFSTR[",16," S $P(VAFY,HLFS,16)=$$YN^VAFHLFNC($P(NODE,"^",14)) ; Declines To Give Income Info
86 I VAFSTR[",17," S $P(VAFY,HLFS,17)=$S($P(NODE,"^",19):$P(NODE,"^",19),1:VAFTYPE) ; Type Of Test
87 I VAFSTR[",18," S $P(VAFY,HLFS,18)=$S($P(NODE,"^",23)]"":$P(NODE,"^",23),1:HLQ) ; Source Of Test
88 I VAFSTR[",19," S $P(VAFY,HLFS,19)=$$YN^VAFHLFNC(PRIM) ; Primary Test?
89 I VAFSTR[",20," S $P(VAFY,HLFS,20)=$S($P(NODE,"^",25):$$HLDATE^HLFNC($P(NODE,"^",25)),1:HLQ) ; Date IVM Verified MT Completed
90 I VAFSTR[",21," S $P(VAFY,HLFS,21)=$$YN^VAFHLFNC($P(NODE,"^",26)) ; Refused To Sign
91 ;
92 ;
93 I VAFSTR[",22," S $P(VAFY,HLFS,22)=$P(NODE2,"^",5) ;Site Conducting Test
94 I VAFSTR[",23," S $P(VAFY,HLFS,23)=$P(NODE2,"^",4) ;Site Granting Hardship
95 I VAFSTR[",24," S $P(VAFY,HLFS,24)=$S($P(NODE2,"^"):$$HLDATE^HLFNC($P(NODE2,"^")),1:"") ;Hardship Effective Date
96 I VAFSTR[",25," S $P(VAFY,HLFS,25)=$S($P(NODE2,"^",2):$$HLDATE^HLFNC($P(NODE2,"^",2)),1:"") ;Dt/Tm Test Last Edited
97 I VAFSTR[",26," S $P(VAFY,HLFS,26)=$S($P(NODE2,"^",3):$$GETCODE^DGMTH($P(NODE2,"^",3)),1:"") ; Test Determined Status
98 ;
99 ;can only transmit the deletion of a hardship if the segment is for a means test - and the income years must match if there is a means test
100 ;
101 I VAFTYPE=1,($G(DELETE("HARDSHIP"))=1),('(+NODE)!($E(DELETE("DATE OF TEST"),1,3)=$E((+NODE),1,3))) S $P(VAFY,HLFS,24)=HLQ
102 ;
103QUIT Q "ZMT"_HLFS_$G(VAFY)
Note: See TracBrowser for help on using the repository browser.