source: ccr/trunk/p/C0CDPT.m@ 573

Last change on this file since 573 was 508, checked in by George Lilly, 16 years ago

formatting for Version 1

File size: 8.7 KB
RevLine 
[508]1C0CDPT ;WV/CCRCCD/SMH - Routines to Extract Patient Data for CCDCCR; 6/15/08
2 ;;1.0;C0C;;May 19, 2009;
[69]3 ;
[175]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.
[69]15 ;
[175]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?
[69]78 ;
[175]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 ;
[508]89FAMILY(DFN) ; Family Name
[175]90 N NAME S NAME=$$GET1^DIQ(2,DFN,.01)
91 D NAMECOMP^XLFNAME(.NAME)
92 Q NAME("FAMILY")
[508]93GIVEN(DFN) ; Given Name
[175]94 N NAME S NAME=$$GET1^DIQ(2,DFN,.01)
95 D NAMECOMP^XLFNAME(.NAME)
96 Q NAME("GIVEN")
[508]97MIDDLE(DFN) ; Middle Name
[175]98 N NAME S NAME=$$GET1^DIQ(2,DFN,.01)
99 D NAMECOMP^XLFNAME(.NAME)
100 Q NAME("MIDDLE")
[508]101SUFFIX(DFN) ; Suffi Name
[175]102 N NAME S NAME=$$GET1^DIQ(2,DFN,.01)
103 D NAMECOMP^XLFNAME(.NAME)
104 Q NAME("SUFFIX")
[508]105DISPNAME(DFN) ; Display Name
[175]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")
[508]109DOB(DFN) ; Date of Birth
[175]110 N DOB S DOB=$$GET1^DIQ(2,DFN,.03,"I")
111 ; Date in FM Date Format. Convert to UTC/ISO 8601.
[396]112 Q $$FMDTOUTC^C0CUTIL(DOB,"D")
[508]113GENDER(DFN) ; Gender/Sex
[175]114 Q $$GET1^DIQ(2,DFN,.02) ;
[508]115SSN(DFN) ; SSN
[175]116 Q $$GET1^DIQ(2,DFN,.09)
[508]117ADDRTYPE(DFN) ; Address Type
[175]118 ; Vista only stores a home address for the patient.
119 Q "Home"
[508]120ADDR1(DFN) ; Get Home Address line 1
[175]121 Q $$GET1^DIQ(2,DFN,.111)
[508]122ADDR2(DFN) ; Get Home Address line 2
[175]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
[508]128CITY(DFN) ; Get City for Home Address
[175]129 Q $$GET1^DIQ(2,DFN,.114)
[508]130STATE(DFN) ; Get State for Home Address
[175]131 Q $$GET1^DIQ(2,DFN,.115)
[508]132ZIP(DFN) ; Get Zip code for Home Address
[175]133 Q $$GET1^DIQ(2,DFN,.116)
[508]134COUNTY(DFN) ; Get County for our Address
[175]135 Q $$GET1^DIQ(2,DFN,.117)
[508]136COUNTRY(DFN) ; Get Country for our Address
[175]137 ; Unfortunately, it's not stored anywhere in Vista, so the inevitable...
138 Q "USA"
[508]139RESTEL(DFN) ; Residential Telephone
[175]140 Q $$GET1^DIQ(2,DFN,.131)
[508]141WORKTEL(DFN) ; Work Telephone
[175]142 Q $$GET1^DIQ(2,DFN,.132)
[508]143EMAIL(DFN) ; Email Adddress
[175]144 Q $$GET1^DIQ(2,DFN,.133)
[508]145CELLTEL(DFN) ; Cell Phone
[175]146 Q $$GET1^DIQ(2,DFN,.134)
[508]147NOK1FAM(DFN) ; Next of Kin 1 (NOK1) Family Name
[175]148 N NAME S NAME=$$GET1^DIQ(2,DFN,.211)
149 D NAMECOMP^XLFNAME(.NAME)
150 Q NAME("FAMILY")
[508]151NOK1GIV(DFN) ; NOK1 Given Name
[175]152 N NAME S NAME=$$GET1^DIQ(2,DFN,.211)
153 D NAMECOMP^XLFNAME(.NAME)
154 Q NAME("GIVEN")
[508]155NOK1MID(DFN) ; NOK1 Middle Name
[175]156 N NAME S NAME=$$GET1^DIQ(2,DFN,.211)
157 D NAMECOMP^XLFNAME(.NAME)
158 Q NAME("MIDDLE")
[508]159NOK1SUF(DFN) ; NOK1 Suffi Name
[175]160 N NAME S NAME=$$GET1^DIQ(2,DFN,.211)
161 D NAMECOMP^XLFNAME(.NAME)
162 Q NAME("SUFFIX")
[508]163NOK1DISP(DFN) ; NOK1 Display Name
[175]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")
[508]167NOK1REL(DFN) ; NOK1 Relationship to the patient
[175]168 Q $$GET1^DIQ(2,DFN,.212)
[508]169NOK1ADD1(DFN) ; NOK1 Address 1
[175]170 Q $$GET1^DIQ(2,DFN,.213)
[508]171NOK1ADD2(DFN) ; NOK1 Address 2
[175]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
[508]176NOK1CITY(DFN) ; NOK1 City
[175]177 Q $$GET1^DIQ(2,DFN,.216)
[508]178NOK1STAT(DFN) ; NOK1 State
[175]179 Q $$GET1^DIQ(2,DFN,.217)
[508]180NOK1ZIP(DFN) ; NOK1 Zip Code
[175]181 Q $$GET1^DIQ(2,DFN,.218)
[508]182NOK1HTEL(DFN) ; NOK1 Home Telephone
[175]183 Q $$GET1^DIQ(2,DFN,.219)
[508]184NOK1WTEL(DFN) ; NOK1 Work Telephone
[175]185 Q $$GET1^DIQ(2,DFN,.21011)
[508]186NOK1SAME(DFN) ; Is NOK1's Address the same the patient?
[175]187 Q $$GET1^DIQ(2,DFN,.2125)
[508]188NOK2FAM(DFN) ; NOK2 Family Name
[175]189 N NAME S NAME=$$GET1^DIQ(2,DFN,.2191)
190 D NAMECOMP^XLFNAME(.NAME)
191 Q NAME("FAMILY")
[508]192NOK2GIV(DFN) ; NOK2 Given Name
[175]193 N NAME S NAME=$$GET1^DIQ(2,DFN,.2191)
194 D NAMECOMP^XLFNAME(.NAME)
195 Q NAME("GIVEN")
[508]196NOK2MID(DFN) ; NOK2 Middle Name
[175]197 N NAME S NAME=$$GET1^DIQ(2,DFN,.2191)
198 D NAMECOMP^XLFNAME(.NAME)
199 Q NAME("MIDDLE")
[508]200NOK2SUF(DFN) ; NOK2 Suffi Name
[175]201 N NAME S NAME=$$GET1^DIQ(2,DFN,.2191)
202 D NAMECOMP^XLFNAME(.NAME)
203 Q NAME("SUFFIX")
[508]204NOK2DISP(DFN) ; NOK2 Display Name
[175]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")
[508]208NOK2REL(DFN) ; NOK2 Relationship to the patient
[175]209 Q $$GET1^DIQ(2,DFN,.2192)
[508]210NOK2ADD1(DFN) ; NOK2 Address 1
[175]211 Q $$GET1^DIQ(2,DFN,.2193)
[508]212NOK2ADD2(DFN) ; NOK2 Address 2
[175]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
[508]217NOK2CITY(DFN) ; NOK2 City
[175]218 Q $$GET1^DIQ(2,DFN,.2196)
[508]219NOK2STAT(DFN) ; NOK2 State
[175]220 Q $$GET1^DIQ(2,DFN,.2197)
[508]221NOK2ZIP(DFN) ; NOK2 Zip Code
[175]222 Q $$GET1^DIQ(2,DFN,.2198)
[508]223NOK2HTEL(DFN) ; NOK2 Home Telephone
[175]224 Q $$GET1^DIQ(2,DFN,.2199)
[508]225NOK2WTEL(DFN) ; NOK2 Work Telephone
[175]226 Q $$GET1^DIQ(2,DFN,.211011)
[508]227NOK2SAME(DFN) ; Is NOK2's Address the same the patient?
[175]228 Q $$GET1^DIQ(2,DFN,.21925)
[508]229EMERFAM(DFN) ; Emergency Contact (EMER) Family Name
[175]230 N NAME S NAME=$$GET1^DIQ(2,DFN,.331)
231 D NAMECOMP^XLFNAME(.NAME)
232 Q NAME("FAMILY")
[508]233EMERGIV(DFN) ; EMER Given Name
[175]234 N NAME S NAME=$$GET1^DIQ(2,DFN,.331)
235 D NAMECOMP^XLFNAME(.NAME)
236 Q NAME("GIVEN")
[508]237EMERMID(DFN) ; EMER Middle Name
[175]238 N NAME S NAME=$$GET1^DIQ(2,DFN,.331)
239 D NAMECOMP^XLFNAME(.NAME)
240 Q NAME("MIDDLE")
[508]241EMERSUF(DFN) ; EMER Suffi Name
[175]242 N NAME S NAME=$$GET1^DIQ(2,DFN,.331)
243 D NAMECOMP^XLFNAME(.NAME)
244 Q NAME("SUFFIX")
[508]245EMERDISP(DFN) ; EMER Display Name
[175]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")
[508]249EMERREL(DFN) ; EMER Relationship to the patient
[175]250 Q $$GET1^DIQ(2,DFN,.331)
[508]251EMERADD1(DFN) ; EMER Address 1
[175]252 Q $$GET1^DIQ(2,DFN,.333)
[508]253EMERADD2(DFN) ; EMER Address 2
[175]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
[508]258EMERCITY(DFN) ; EMER City
[175]259 Q $$GET1^DIQ(2,DFN,.336)
[508]260EMERSTAT(DFN) ; EMER State
[175]261 Q $$GET1^DIQ(2,DFN,.337)
[508]262EMERZIP(DFN) ; EMER Zip Code
[175]263 Q $$GET1^DIQ(2,DFN,.338)
[508]264EMERHTEL(DFN) ; EMER Home Telephone
[175]265 Q $$GET1^DIQ(2,DFN,.339)
[508]266EMERWTEL(DFN) ; EMER Work Telephone
[175]267 Q $$GET1^DIQ(2,DFN,.33011)
[508]268EMERSAME(DFN) ; Is EMER's Address the same the NOK?
[175]269 Q $$GET1^DIQ(2,DFN,.3305)
Note: See TracBrowser for help on using the repository browser.