source: WorldVistAEHR/trunk/r/CLINICAL_REMINDERS-PXRM/PXRMOBJ.m@ 1154

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

initial load of WorldVistAEHR

File size: 5.2 KB
Line 
1PXRMOBJ ;SLC/JVS - PXRM OBJECT AND GUI EVAL FOR GEC ;7/14/05 07:34
2 ;;2.0;CLINICAL REMINDERS;**4**;Feb 04, 2005;Build 21
3 ;
4 Q
5 ;
6STAT(DFN) ;Status Object
7 N STATUS,CNT,I,MISSING,CMARRAY,K
8 S CNT=0
9 D STATUS^PXRMOBJX(DFN,.STATUS,.MISSING)
10 K ^TMP("PXRMOBJSTATUS",$J)
11 S CMARRAY="^TMP(""PXRMOBJSTATUS"",$J)"
12 S I=0 F S I=$O(STATUS(I)) Q:I="" D
13 .S K=0 F S K=$O(STATUS(I,K)) Q:K="" D
14 ..S ^TMP("PXRMOBJSTATUS",$J,$$UP,0)=STATUS(I,K)
15 S ^TMP("PXRMOBJSTATUS",$J,$$UP,0)=""
16 Q "~@"_$NA(@CMARRAY)
17 ;
18UP() ;
19 S CNT=CNT+1
20 Q CNT
21 ;
22DEM(DFN) ;
23 Q:DFN=""
24 N X,ARY
25 N ZIP,DATA
26 D GET
27 K ^TMP("PXRMOBJ",$J)
28 S CMARRAY="^TMP(""PXRMOBJ"",$J)"
29 S ^TMP("PXRMOBJ",$J,1,0)=""
30 S ^TMP("PXRMOBJ",$J,2,0)=" Name: "_DATA("NAME")_" "_"Gender: "_DATA("SEX")
31 S ^TMP("PXRMOBJ",$J,3,0)=" DOB: "_DATA("DOB")_" "_"Age:"_DATA("AGE")
32 S ^TMP("PXRMOBJ",$J,4,0)=" Marital Status: "_DATA("MARSTAT")
33 S ^TMP("PXRMOBJ",$J,5,0)=" Address: "_DATA("STRAD1")
34 I DATA("STRAD2")'="" S ^TMP("PXRMOBJ",$J,6,0)=" "_DATA("STRAD2")
35 I DATA("STRAD3")'="" S ^TMP("PXRMOBJ",$J,7,0)=" "_DATA("STRAD3")
36 S ^TMP("PXRMOBJ",$J,8,0)=" "_DATA("CITY")_" "_DATA("STATE")_" "_ZIP
37 S ^TMP("PXRMOBJ",$J,9,0)=" H Phone: "_DATA("PHONER")
38 S ^TMP("PXRMOBJ",$J,10,0)=" W Phone: "_DATA("PHONEW")
39 S ^TMP("PXRMOBJ",$J,11,0)=" Service Connected %: "_DATA("SERCON")
40 S ^TMP("PXRMOBJ",$J,12,0)=" LTC Co-Pay Status: "_DATA("STATUS")
41 I DATA("STATUS DATE")'["<No Test>" D
42 .S ^TMP("PXRMOBJ",$J,13,0)=" LTC Date Tested: "_DATA("STATUS DATE")
43 I $D(DATA("WHY")) D
44 .S ^TMP("PXRMOBJ",$J,13,0)=" Reason: "_DATA("WHY")
45 S ^TMP("PXRMOBJ",$J,14,0)=""
46 ; NODE MUST END WITH ZERO SUBSCRIPT
47 ; @CMARRAY@(CNT,0)=TEXT
48 D EXIT
49 Q "~@"_$NA(@CMARRAY)
50 ;
51GET ; Get data from file
52 N FIELDS,STATUS,DFN2,STAT
53 ;DBIA #11
54 ;S DFN=75
55 S FIELDS=".01;.02;.03;.033;.05;.111;.1112;.112;.113;.114;.115;.116;.131;.132;.302;.3621;.3622;.3624;.3626;.3627;.3628;.3629;.36295"
56 D GETS^DIQ(2,DFN,FIELDS,"ER","^TMP(""PXRMGECOBJ"",$J)")
57 ;
58 S ARY="^TMP(""PXRMGECOBJ"",$J,2)",DFN2=DFN_","
59 ;
60 S DATA("AGE")=@ARY@(DFN2,"AGE","E")
61 S DATA("AMOUNTAA")=@ARY@(DFN2,"AMOUNT OF AID & ATTENDANCE","E")
62 S DATA("AMOUNTGI")=@ARY@(DFN2,"AMOUNT OF GI INSURANCE","E")
63 S DATA("AMOUNTHO")=@ARY@(DFN2,"AMOUNT OF HOUSEBOUND","E")
64 S DATA("AMOUNTOT")=@ARY@(DFN2,"AMOUNT OF OTHER INCOME","E")
65 S DATA("AMOUNTOR")=@ARY@(DFN2,"AMOUNT OF OTHER RETIREMENT","E")
66 S DATA("AMOUNTSS")=@ARY@(DFN2,"AMOUNT OF SSI","E")
67 S DATA("AMOUNTVA")=@ARY@(DFN2,"AMOUNT OF VA PENSION","E")
68 S DATA("CITY")=@ARY@(DFN2,"CITY","E")
69 S DATA("DOB")=@ARY@(DFN2,"DATE OF BIRTH","E")
70 S DATA("MARSTAT")=@ARY@(DFN2,"MARITAL STATUS","E")
71 S DATA("NAME")=@ARY@(DFN2,"NAME","E")
72 S DATA("PHONER")=@ARY@(DFN2,"PHONE NUMBER [RESIDENCE]","E")
73 S DATA("PHONEW")=@ARY@(DFN2,"PHONE NUMBER [WORK]","E")
74 S DATA("SERCON")=@ARY@(DFN2,"SERVICE CONNECTED PERCENTAGE","E")
75 S DATA("SEX")=@ARY@(DFN2,"SEX","E")
76 S DATA("STATE")=@ARY@(DFN2,"STATE","E")
77 S DATA("STRAD1")=@ARY@(DFN2,"STREET ADDRESS [LINE 1]","E")
78 S DATA("STRAD2")=@ARY@(DFN2,"STREET ADDRESS [LINE 2]","E")
79 S DATA("STRAD3")=@ARY@(DFN2,"STREET ADDRESS [LINE 3]","E")
80 S DATA("TOTAL")=@ARY@(DFN2,"TOTAL ANNUAL VA CHECK AMOUNT","E")
81 S DATA("ZIP")=@ARY@(DFN2,"ZIP CODE","E")
82 S DATA("ZIP4")=@ARY@(DFN2,"ZIP+4","E")
83 S ZIP="" D
84 .I DATA("ZIP4")'="" S ZIP=DATA("ZIP4") Q
85 .I DATA("ZIP")'="" S ZIP=DATA("ZIP")
86 S DATA("SUM")=DATA("AMOUNTAA")+DATA("AMOUNTGI")+DATA("AMOUNTHO")+DATA("AMOUNTOT")+DATA("AMOUNTSS")+DATA("AMOUNTVA")
87 I DATA("SUM")=0 S DATA("SUM")=""
88 ;get LTC CO-PAY TEST status
89 S (DATA("STATUS"),DATA("STATUS DATE"))="<No Test>"
90 S STAT=$$EXMPT(DFN)
91 I STAT=0 S DATA("STATUS")="NON EXEMPT"
92 I STAT>0 S DATA("STATUS")="EXEMPT"
93 I STAT=1 S DATA("WHY")="Veteran has compensable SC disability."
94 I STAT=2 S DATA("WHY")="Veteran is single NSC pensioner."
95 ;DBIA #701
96 S STATUS=$$LST^EASECU(DFN,"",3) D
97 .I STATUS'="" D
98 ..S DATA("STATUS")=$P(STATUS,"^",3)
99 ..S DATA("STATUS DATE")=$$FMTE^XLFDT($P(STATUS,"^",2))
100 Q
101 ;
102EXMPT(DFN) ;Check if veteran is exempt from LTC co-payments:
103 ; If the veteran has a compensable SC disability, OR
104 ; If the veteran is a single, NSC pensioner not in receipt of A&A
105 ; and HB benefits
106 ; Input -- DFN Patient IEN
107 ; Output -- 0 = veteran not exempt
108 ; 1 = veteran has compensable SC disability
109 ; 2 = veteran is single NSC pensioner (no A&A, HB)
110 N X,Y,ELG
111 S Y=0
112 ; if service connected percentage is greater than 10% OR service
113 ; connected percentage is less than 10% and annual VA
114 ; check amount is greater than 0, then exempt type 1
115 S X=$G(^DPT(DFN,.36)),ELG=$P($G(^DIC(8,+X,0)),U,9)
116 I ELG=1!($P($G(^DPT(DFN,.3)),U,2)'<10) S Y=1 G EXMPTQ
117 I ELG=3,$P($G(^DPT(DFN,.3)),U,2)<10,$P($G(^DPT(DFN,.362)),U,20)>0 S Y=1
118 G EXMPTQ
119 ; if Service Connected quit
120 I $P($G(^DPT(DFN,.3)),U)="Y" G EXMPTQ
121 ; if Marital Status = 'Married' or 'Separated' quit
122 S X=$P($G(^DIC(11,+$P($G(^DPT(DFN,0)),U,5),0)),U,3)
123 I "^M^S^"[("^"_X_"^") G EXMPTQ
124 ; if not receiving VA pension quit
125 S X=$G(^DPT(DFN,.362)) I $P(X,U,14)'="Y" G EXMPTQ
126 ; if receiving A&A or HP benefits quit
127 I $P(X,U,12)="Y"!($P(X,U,13)="Y") G EXMPTQ
128 S Y=2
129EXMPTQ Q Y
130 ;
131EXIT ;
132 K ^TMP("PXRMGECOBJ",$J)
Note: See TracBrowser for help on using the repository browser.