source: ccr/trunk/p/CCRDPT.m@ 181

Last change on this file since 181 was 175, checked in by Sam Habiel, 16 years ago

Refactored CCRDPT and updated GPLACTOR accordingly

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