1 | C0CDPT ;WV/CCRCCD/SMH - Routines to Extract Patient Data for CCDCCR; 6/15/08
|
---|
2 | ;;1.2;C0C;;May 11, 2012;Build 47
|
---|
3 | ;
|
---|
4 | ; Copyright 2008 WorldVistA. Licensed under the terms of the GNU
|
---|
5 | ; General Public License.
|
---|
6 | ;
|
---|
7 | ; This program is distributed in the hope that it will be useful,
|
---|
8 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
9 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
10 | ; GNU General Public License for more details.
|
---|
11 | ;
|
---|
12 | ; You should have received a copy of the GNU General Public License along
|
---|
13 | ; with this program; if not, write to the Free Software Foundation, Inc.,
|
---|
14 | ; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
---|
15 | ;
|
---|
16 | ; FAMILY Family Name
|
---|
17 | ; GIVEN Given Name
|
---|
18 | ; MIDDLE Middle Name
|
---|
19 | ; SUFFIX Suffix Name
|
---|
20 | ; DISPNAME Display Name
|
---|
21 | ; DOB Date of Birth
|
---|
22 | ; GENDER Get Gender
|
---|
23 | ; SSN Get SSN for ID
|
---|
24 | ; ADDRTYPE Get Home Address
|
---|
25 | ; ADDR1 Get Home Address line 1
|
---|
26 | ; ADDR2 Get Home Address line 2
|
---|
27 | ; CITY Get City for Home Address
|
---|
28 | ; STATE Get State for Home Address
|
---|
29 | ; ZIP Get Zip code for Home Address
|
---|
30 | ; COUNTY Get County for our Address
|
---|
31 | ; COUNTRY Get Country for our Address
|
---|
32 | ; RESTEL Residential Telephone
|
---|
33 | ; WORKTEL Work Telephone
|
---|
34 | ; EMAIL Email Adddress
|
---|
35 | ; CELLTEL Cell Phone
|
---|
36 | ; NOK1FAM Next of Kin 1 (NOK1) Family Name
|
---|
37 | ; NOK1GIV NOK1 Given Name
|
---|
38 | ; NOK1MID NOK1 Middle Name
|
---|
39 | ; NOK1SUF NOK1 Suffi Name
|
---|
40 | ; NOK1DISP NOK1 Display Name
|
---|
41 | ; NOK1REL NOK1 Relationship to the patient
|
---|
42 | ; NOK1ADD1 NOK1 Address 1
|
---|
43 | ; NOK1ADD2 NOK1 Address 2
|
---|
44 | ; NOK1CITY NOK1 City
|
---|
45 | ; NOK1STAT NOK1 State
|
---|
46 | ; NOK1ZIP NOK1 Zip Code
|
---|
47 | ; NOK1HTEL NOK1 Home Telephone
|
---|
48 | ; NOK1WTEL NOK1 Work Telephone
|
---|
49 | ; NOK1SAME Is NOK1's Address the same the patient?
|
---|
50 | ; NOK2FAM NOK2 Family Name
|
---|
51 | ; NOK2GIV NOK2 Given Name
|
---|
52 | ; NOK2MID NOK2 Middle Name
|
---|
53 | ; NOK2SUF NOK2 Suffi Name
|
---|
54 | ; NOK2DISP NOK2 Display Name
|
---|
55 | ; NOK2REL NOK2 Relationship to the patient
|
---|
56 | ; NOK2ADD1 NOK2 Address 1
|
---|
57 | ; NOK2ADD2 NOK2 Address 2
|
---|
58 | ; NOK2CITY NOK2 City
|
---|
59 | ; NOK2STAT NOK2 State
|
---|
60 | ; NOK2ZIP NOK2 Zip Code
|
---|
61 | ; NOK2HTEL NOK2 Home Telephone
|
---|
62 | ; NOK2WTEL NOK2 Work Telephone
|
---|
63 | ; NOK2SAME Is NOK2's Address the same the patient?
|
---|
64 | ; EMERFAM Emergency Contact (EMER) Family Name
|
---|
65 | ; EMERGIV EMER Given Name
|
---|
66 | ; EMERMID EMER Middle Name
|
---|
67 | ; EMERSUF EMER Suffi Name
|
---|
68 | ; EMERDISP EMER Display Name
|
---|
69 | ; EMERREL EMER Relationship to the patient
|
---|
70 | ; EMERADD1 EMER Address 1
|
---|
71 | ; EMERADD2 EMER Address 2
|
---|
72 | ; EMERCITY EMER City
|
---|
73 | ; EMERSTAT EMER State
|
---|
74 | ; EMERZIP EMER Zip Code
|
---|
75 | ; EMERHTEL EMER Home Telephone
|
---|
76 | ; EMERWTEL EMER Work Telephone
|
---|
77 | ; EMERSAME Is EMER's Address the same the NOK?
|
---|
78 | ;
|
---|
79 | W "No Entry at top!" Q
|
---|
80 | ;
|
---|
81 | ;**Revision History**
|
---|
82 | ; - June 15, 08: v0.1 using merged global
|
---|
83 | ; - Oct 3, 08: v0.2 using fileman calls, many formatting changes.
|
---|
84 | ;
|
---|
85 | ; All methods are Public and Extrinsic
|
---|
86 | ; All calls use Fileman file 2 (Patient).
|
---|
87 | ; You can obtain field numbers using the data dictionary
|
---|
88 | ;
|
---|
89 | FAMILY(DFN) ; Family Name
|
---|
90 | N NAME S NAME=$$GET1^DIQ(2,DFN,.01)
|
---|
91 | D NAMECOMP^XLFNAME(.NAME)
|
---|
92 | Q NAME("FAMILY")
|
---|
93 | GIVEN(DFN) ; Given Name
|
---|
94 | N NAME S NAME=$$GET1^DIQ(2,DFN,.01)
|
---|
95 | D NAMECOMP^XLFNAME(.NAME)
|
---|
96 | Q NAME("GIVEN")
|
---|
97 | MIDDLE(DFN) ; Middle Name
|
---|
98 | N NAME S NAME=$$GET1^DIQ(2,DFN,.01)
|
---|
99 | D NAMECOMP^XLFNAME(.NAME)
|
---|
100 | Q NAME("MIDDLE")
|
---|
101 | SUFFIX(DFN) ; Suffi Name
|
---|
102 | N NAME S NAME=$$GET1^DIQ(2,DFN,.01)
|
---|
103 | D NAMECOMP^XLFNAME(.NAME)
|
---|
104 | Q NAME("SUFFIX")
|
---|
105 | DISPNAME(DFN) ; Display Name
|
---|
106 | N NAME S NAME=$$GET1^DIQ(2,DFN,.01)
|
---|
107 | ; "G" is Given Name First; "MXc" is Mixed Case, With Suffx Preceded by Comma
|
---|
108 | Q $$NAMEFMT^XLFNAME(.NAME,"G","MXc")
|
---|
109 | DOB(DFN) ; Date of Birth
|
---|
110 | N DOB S DOB=$$GET1^DIQ(2,DFN,.03,"I")
|
---|
111 | ; Date in FM Date Format. Convert to UTC/ISO 8601.
|
---|
112 | Q $$FMDTOUTC^C0CUTIL(DOB,"D")
|
---|
113 | GENDER(DFN) ; Gender/Sex
|
---|
114 | Q $$GET1^DIQ(2,DFN,.02,"I")_"^"_$$GET1^DIQ(2,DFN,.02,"E") ;
|
---|
115 | SSN(DFN) ; SSN
|
---|
116 | Q $$GET1^DIQ(2,DFN,.09)
|
---|
117 | ADDRTYPE(DFN) ; Address Type
|
---|
118 | ; Vista only stores a home address for the patient.
|
---|
119 | Q "Home"
|
---|
120 | ADDR1(DFN) ; Get Home Address line 1
|
---|
121 | Q $$GET1^DIQ(2,DFN,.111)
|
---|
122 | ADDR2(DFN) ; Get Home Address line 2
|
---|
123 | ; Vista has Lines 2,3; CCR has only line 1,2; so compromise
|
---|
124 | N ADDLN2,ADDLN3
|
---|
125 | S ADDLN2=$$GET1^DIQ(2,DFN,.112),ADDLN3=$$GET1^DIQ(2,DFN,.113)
|
---|
126 | Q:ADDLN3="" ADDLN2
|
---|
127 | Q ADDLN2_", "_ADDLN3
|
---|
128 | CITY(DFN) ; Get City for Home Address
|
---|
129 | Q $$GET1^DIQ(2,DFN,.114)
|
---|
130 | STATE(DFN) ; Get State for Home Address
|
---|
131 | Q $$GET1^DIQ(2,DFN,.115)
|
---|
132 | ZIP(DFN) ; Get Zip code for Home Address
|
---|
133 | Q $$GET1^DIQ(2,DFN,.116)
|
---|
134 | COUNTY(DFN) ; Get County for our Address
|
---|
135 | Q $$GET1^DIQ(2,DFN,.117)
|
---|
136 | COUNTRY(DFN) ; Get Country for our Address
|
---|
137 | ; Unfortunately, it's not stored anywhere in Vista, so the inevitable...
|
---|
138 | Q "USA"
|
---|
139 | RESTEL(DFN) ; Residential Telephone
|
---|
140 | Q $$GET1^DIQ(2,DFN,.131)
|
---|
141 | WORKTEL(DFN) ; Work Telephone
|
---|
142 | Q $$GET1^DIQ(2,DFN,.132)
|
---|
143 | EMAIL(DFN) ; Email Adddress
|
---|
144 | Q $$GET1^DIQ(2,DFN,.133)
|
---|
145 | CELLTEL(DFN) ; Cell Phone
|
---|
146 | Q $$GET1^DIQ(2,DFN,.134)
|
---|
147 | NOK1FAM(DFN) ; Next of Kin 1 (NOK1) Family Name
|
---|
148 | N NAME S NAME=$$GET1^DIQ(2,DFN,.211)
|
---|
149 | D NAMECOMP^XLFNAME(.NAME)
|
---|
150 | Q NAME("FAMILY")
|
---|
151 | NOK1GIV(DFN) ; NOK1 Given Name
|
---|
152 | N NAME S NAME=$$GET1^DIQ(2,DFN,.211)
|
---|
153 | D NAMECOMP^XLFNAME(.NAME)
|
---|
154 | Q NAME("GIVEN")
|
---|
155 | NOK1MID(DFN) ; NOK1 Middle Name
|
---|
156 | N NAME S NAME=$$GET1^DIQ(2,DFN,.211)
|
---|
157 | D NAMECOMP^XLFNAME(.NAME)
|
---|
158 | Q NAME("MIDDLE")
|
---|
159 | NOK1SUF(DFN) ; NOK1 Suffi Name
|
---|
160 | N NAME S NAME=$$GET1^DIQ(2,DFN,.211)
|
---|
161 | D NAMECOMP^XLFNAME(.NAME)
|
---|
162 | Q NAME("SUFFIX")
|
---|
163 | NOK1DISP(DFN) ; NOK1 Display Name
|
---|
164 | N NAME S NAME=$$GET1^DIQ(2,DFN,.211)
|
---|
165 | ; "G" is Given Name First; "MXc" is Mixed Case, With Suffx Preceded by Comma
|
---|
166 | Q $$NAMEFMT^XLFNAME(.NAME,"G","MXc")
|
---|
167 | NOK1REL(DFN) ; NOK1 Relationship to the patient
|
---|
168 | Q $$GET1^DIQ(2,DFN,.212)
|
---|
169 | NOK1ADD1(DFN) ; NOK1 Address 1
|
---|
170 | Q $$GET1^DIQ(2,DFN,.213)
|
---|
171 | NOK1ADD2(DFN) ; NOK1 Address 2
|
---|
172 | N ADDLN2,ADDLN3
|
---|
173 | S ADDLN2=$$GET1^DIQ(2,DFN,.214),ADDLN3=$$GET1^DIQ(2,DFN,.215)
|
---|
174 | Q:ADDLN3="" ADDLN2
|
---|
175 | Q ADDLN2_", "_ADDLN3
|
---|
176 | NOK1CITY(DFN) ; NOK1 City
|
---|
177 | Q $$GET1^DIQ(2,DFN,.216)
|
---|
178 | NOK1STAT(DFN) ; NOK1 State
|
---|
179 | Q $$GET1^DIQ(2,DFN,.217)
|
---|
180 | NOK1ZIP(DFN) ; NOK1 Zip Code
|
---|
181 | Q $$GET1^DIQ(2,DFN,.218)
|
---|
182 | NOK1HTEL(DFN) ; NOK1 Home Telephone
|
---|
183 | Q $$GET1^DIQ(2,DFN,.219)
|
---|
184 | NOK1WTEL(DFN) ; NOK1 Work Telephone
|
---|
185 | Q $$GET1^DIQ(2,DFN,.21011)
|
---|
186 | NOK1SAME(DFN) ; Is NOK1's Address the same the patient?
|
---|
187 | Q $$GET1^DIQ(2,DFN,.2125)
|
---|
188 | NOK2FAM(DFN) ; NOK2 Family Name
|
---|
189 | N NAME S NAME=$$GET1^DIQ(2,DFN,.2191)
|
---|
190 | D NAMECOMP^XLFNAME(.NAME)
|
---|
191 | Q NAME("FAMILY")
|
---|
192 | NOK2GIV(DFN) ; NOK2 Given Name
|
---|
193 | N NAME S NAME=$$GET1^DIQ(2,DFN,.2191)
|
---|
194 | D NAMECOMP^XLFNAME(.NAME)
|
---|
195 | Q NAME("GIVEN")
|
---|
196 | NOK2MID(DFN) ; NOK2 Middle Name
|
---|
197 | N NAME S NAME=$$GET1^DIQ(2,DFN,.2191)
|
---|
198 | D NAMECOMP^XLFNAME(.NAME)
|
---|
199 | Q NAME("MIDDLE")
|
---|
200 | NOK2SUF(DFN) ; NOK2 Suffi Name
|
---|
201 | N NAME S NAME=$$GET1^DIQ(2,DFN,.2191)
|
---|
202 | D NAMECOMP^XLFNAME(.NAME)
|
---|
203 | Q NAME("SUFFIX")
|
---|
204 | NOK2DISP(DFN) ; NOK2 Display Name
|
---|
205 | N NAME S NAME=$$GET1^DIQ(2,DFN,.2191)
|
---|
206 | ; "G" is Given Name First; "MXc" is Mixed Case, With Suffx Preceded by Comma
|
---|
207 | Q $$NAMEFMT^XLFNAME(.NAME,"G","MXc")
|
---|
208 | NOK2REL(DFN) ; NOK2 Relationship to the patient
|
---|
209 | Q $$GET1^DIQ(2,DFN,.2192)
|
---|
210 | NOK2ADD1(DFN) ; NOK2 Address 1
|
---|
211 | Q $$GET1^DIQ(2,DFN,.2193)
|
---|
212 | NOK2ADD2(DFN) ; NOK2 Address 2
|
---|
213 | N ADDLN2,ADDLN3
|
---|
214 | S ADDLN2=$$GET1^DIQ(2,DFN,.2194),ADDLN3=$$GET1^DIQ(2,DFN,.2195)
|
---|
215 | Q:ADDLN3="" ADDLN2
|
---|
216 | Q ADDLN2_", "_ADDLN3
|
---|
217 | NOK2CITY(DFN) ; NOK2 City
|
---|
218 | Q $$GET1^DIQ(2,DFN,.2196)
|
---|
219 | NOK2STAT(DFN) ; NOK2 State
|
---|
220 | Q $$GET1^DIQ(2,DFN,.2197)
|
---|
221 | NOK2ZIP(DFN) ; NOK2 Zip Code
|
---|
222 | Q $$GET1^DIQ(2,DFN,.2198)
|
---|
223 | NOK2HTEL(DFN) ; NOK2 Home Telephone
|
---|
224 | Q $$GET1^DIQ(2,DFN,.2199)
|
---|
225 | NOK2WTEL(DFN) ; NOK2 Work Telephone
|
---|
226 | Q $$GET1^DIQ(2,DFN,.211011)
|
---|
227 | NOK2SAME(DFN) ; Is NOK2's Address the same the patient?
|
---|
228 | Q $$GET1^DIQ(2,DFN,.21925)
|
---|
229 | EMERFAM(DFN) ; Emergency Contact (EMER) Family Name
|
---|
230 | N NAME S NAME=$$GET1^DIQ(2,DFN,.331)
|
---|
231 | D NAMECOMP^XLFNAME(.NAME)
|
---|
232 | Q NAME("FAMILY")
|
---|
233 | EMERGIV(DFN) ; EMER Given Name
|
---|
234 | N NAME S NAME=$$GET1^DIQ(2,DFN,.331)
|
---|
235 | D NAMECOMP^XLFNAME(.NAME)
|
---|
236 | Q NAME("GIVEN")
|
---|
237 | EMERMID(DFN) ; EMER Middle Name
|
---|
238 | N NAME S NAME=$$GET1^DIQ(2,DFN,.331)
|
---|
239 | D NAMECOMP^XLFNAME(.NAME)
|
---|
240 | Q NAME("MIDDLE")
|
---|
241 | EMERSUF(DFN) ; EMER Suffi Name
|
---|
242 | N NAME S NAME=$$GET1^DIQ(2,DFN,.331)
|
---|
243 | D NAMECOMP^XLFNAME(.NAME)
|
---|
244 | Q NAME("SUFFIX")
|
---|
245 | EMERDISP(DFN) ; EMER Display Name
|
---|
246 | N NAME S NAME=$$GET1^DIQ(2,DFN,.331)
|
---|
247 | ; "G" is Given Name First; "MXc" is Mixed Case, With Suffx Preceded by Comma
|
---|
248 | Q $$NAMEFMT^XLFNAME(.NAME,"G","MXc")
|
---|
249 | EMERREL(DFN) ; EMER Relationship to the patient
|
---|
250 | Q $$GET1^DIQ(2,DFN,.331)
|
---|
251 | EMERADD1(DFN) ; EMER Address 1
|
---|
252 | Q $$GET1^DIQ(2,DFN,.333)
|
---|
253 | EMERADD2(DFN) ; EMER Address 2
|
---|
254 | N ADDLN2,ADDLN3
|
---|
255 | S ADDLN2=$$GET1^DIQ(2,DFN,.334),ADDLN3=$$GET1^DIQ(2,DFN,.335)
|
---|
256 | Q:ADDLN3="" ADDLN2
|
---|
257 | Q ADDLN2_", "_ADDLN3
|
---|
258 | EMERCITY(DFN) ; EMER City
|
---|
259 | Q $$GET1^DIQ(2,DFN,.336)
|
---|
260 | EMERSTAT(DFN) ; EMER State
|
---|
261 | Q $$GET1^DIQ(2,DFN,.337)
|
---|
262 | EMERZIP(DFN) ; EMER Zip Code
|
---|
263 | Q $$GET1^DIQ(2,DFN,.338)
|
---|
264 | EMERHTEL(DFN) ; EMER Home Telephone
|
---|
265 | Q $$GET1^DIQ(2,DFN,.339)
|
---|
266 | EMERWTEL(DFN) ; EMER Work Telephone
|
---|
267 | Q $$GET1^DIQ(2,DFN,.33011)
|
---|
268 | EMERSAME(DFN) ; Is EMER's Address the same the NOK?
|
---|
269 | Q $$GET1^DIQ(2,DFN,.3305)
|
---|