source: WorldVistAEHR/trunk/r/INCOME_VERIFICATION_MATCH-IVM/IVMCUC.m@ 1670

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

initial load of WorldVistAEHR

File size: 4.5 KB
Line 
1IVMCUC ;ALB/KCL/CJM,LBD - DATA COLLECTION DIVISION (DCD) SELECTION CRITERIA ; 07-MAR-95
2 ;;2.0;INCOME VERIFICATION MATCH;**9,17,62**;21-OCT-94
3 ;
4 ;
5BT(IEN) ;
6 ;Description: logs DCD defined Beneficiary Travel event if DCD criteria are met.
7 ;
8 N DFN
9 Q:'$G(IEN)
10 S DFN=$P($G(^DGBT(392.2,IEN,0)),"^",2)
11 D:DFN LOGDCD(DFN)
12 Q
13LOGDCD(DFN,IVMCDT) ;
14 ;Description: logs DCD defined events for nightly transmission if DCD criteria are met.
15 ;
16 ;Input:
17 ; DFN - ien of record in the PATIENT file
18 ; IVMCDT - optional parameter, is the date/time to check, uses DT if not passed in
19 ;
20 ;
21 S:'$G(IVMCDT) IVMCDT=DT
22 ;if patient meets DCD criteria, want to log patient for transmission
23 I $$DCD(DFN,IVMCDT) D
24 .N EVENTS,YEAR
25 .S EVENTS("DCD")=1
26 .S YEAR=$E(IVMCDT,1,3)-1_"0000"
27 .I $$LOG^IVMPLOG(DFN,YEAR,.EVENTS) ;then call was successful
28 Q
29DCD(DFN,IVMCDT) ;
30 ; - Determine if patient meets Data Collection Division (DCD) selection
31 ; criteria and should be transmitted to the HEC.
32 ; ===================================================================
33 ; Veteran meets DCD section criteria if:
34 ; 1. MT category based on IVMCDT is Cat A or Cat C
35 ; or GMT (added by IVM*2*62)
36 ;
37 ; OR, 2. Completed an Rx-Copay Test based on IVMCDT
38 ;
39 ; OR, 3. Primary Eligiblility is NSC and veteran is
40 ; eligible for Medicaid based on IVMCDT
41 ;
42 ; OR, 3. Primary Eligiblility is (NOT) one of the following:
43 ; 1. NSC, VA PENSION
44 ; 2. SC 50% TO 100%
45 ; 3. AID & ATTENDANCE
46 ; 4. HOUSE BOUND
47 ;
48 ; AND,
49 ; a. Had any Income Screening based on IVMCDT
50 ; OR, b. Submitted a claim for BT based on IVMCDT
51 ; ====================================================================
52 ;
53 ; Input: DFN - as IEN of Patient (#2) file
54 ; IVMCDT - as Date/Time (Optional - default is today@2359)
55 ;
56 ; Output: 1 --> if pt meets DCD selection criteria and
57 ; should be sent to IVM Center
58 ; 0 --> if pt does not meet DCD selection criteria and
59 ; should not be sent to IVM Center
60 ;
61 N IVMCBTCL,IVMCPEL,IVMCFLAG,IVMCIYR,IVMCTEST,VA,VAERR,VAEL
62 ;
63 S DFN=$G(DFN) I '$D(^DPT(+DFN,0)) G DCDQ
64 S IVMCDT=$S($G(IVMCDT):IVMCDT,1:DT) S:'$P(IVMCDT,".",2) IVMCDT=IVMCDT_.2359
65 ;
66 ; - exclude non-vets
67 I $G(^DPT(DFN,"VET"))="N" G DCDQ
68 ;
69 ; - determine income year
70 S IVMCIYR=$$LYR^DGMTSCU1(IVMCDT)
71 ;
72 ; - flag indicating pt meets DCD selection criteria, transmit
73 S IVMCFLAG=1
74 ;
75MT ; - get last Means Test or Rx Copay Test for patient
76 S IVMCTEST=$$LST^DGMTCOU1(DFN,IVMCDT,3)
77 I $E($P(IVMCTEST,"^",2),1,3)'=$E(IVMCDT,1,3) G PRIM
78 ;
79 ; - if pt MT category is A or C based on date of test, transmit
80 ; add check for GMT status (IVM*2*62)
81 I IVMCTEST,($P(IVMCTEST,"^",5)=1),"^A^C^G^"[("^"_$P(IVMCTEST,"^",4)_"^") G DCDQ
82 ;
83 ; - if completed Rx Copay Test based on date of test, transmit
84 I IVMCTEST,($P(IVMCTEST,"^",5)=2),($P(IVMCTEST,"^",4)="M"!($P(IVMCTEST,"^",4)="E")) G DCDQ
85 ;
86PRIM ; - get pt Primary Eligibility
87 D ELIG^VADPT S IVMCPEL=$P($G(^DIC(8,+VAEL(1),0)),"^",9)
88 ;
89 ; - if Primary Elig code is NSC and eligible for Medicaid
90 ; based on (Date Last Asked?) field, transmit
91 I IVMCPEL=5,+$G(^DPT(DFN,.38)),($P($G(^(.38)),"^",2)>($E(DT,1,3)-2_1231.999999)) G DCDQ
92 ;
93 ; - if pt Primary Eligibility code is on DCD exclusion list,
94 ; do not transmit
95 I "^1^2^4^15^"[("^"_IVMCPEL_"^") S IVMCFLAG=0 G DCDQ
96 ;
97 ; - If pt has any Income Screening (reported income), transmit
98 I $$IS(DFN,IVMCIYR) G DCDQ
99 ;
100 ; - if submitted Beneficiary Travel claim
101 S IVMCBTCL=$O(^DGBT(392,"C",DFN,$E(IVMCDT,1,3)_"0000"))
102 ;
103 ; - check if claim in date range
104 G:IVMCBTCL DCDQ
105 ;
106 ; - otherwise, set flag indicating pt should not be transmitted
107 S IVMCFLAG=0
108 ;
109DCDQ Q $G(IVMCFLAG)
110 ;
111 ;
112IS(DFN,IVMCIYR) ; Has the veteran had Income Screening this year?
113 ; Input: DFN -- Pointer to the patient in file #2
114 ; IVMCIYR -- Income year in question
115 ; Output: Has the vet had income screening? 0 => No | 1 => Yes
116 ;
117 N IVMCIS,IVMCPR,IVMCIAI S IVMCIS=0
118 I '$G(DFN) G ISQ
119 ;
120 ; - get IEN of Patient Relation (#408.12) file, look at pts dependents
121 F IVMCPR=0:0 S IVMCPR=$O(^DGPR(408.12,"B",DFN,IVMCPR)) Q:'IVMCPR D
122 .;
123 .; - get IEN of Individual Annual Income (#408.21) file
124 .; get dependents annual income record effective on input date
125 .S IVMCIAI=$O(^DGMT(408.21,"AI",+IVMCPR,-IVMCIYR,0))
126 .;
127 .; - check for reported income
128 .I IVMCIAI S IVMCIS=IVMCIS+$S($P($G(^DGMT(408.21,+IVMCIAI,0)),U,8,17)'?."^":1,1:0)
129 ;
130ISQ Q IVMCIS>0
Note: See TracBrowser for help on using the repository browser.