Changes in ccr/trunk/p/CCRDPT.m [26:14]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ccr/trunk/p/CCRDPT.m
r26 r14 4 4 ; NOTE TO PROGRAMMER: You need to call INIT(DPT) to initialize; and 5 5 ; DESTROY to clean-up. 6 7 ; The first line of every routine tests if the global exists.8 9 ; CCRDPT 83 lines CCRCCD/SMH - Routines to Extract Patient Data for10 ; INIT 9 lines Copy DFN global to a local variable11 ; DESTROY 6 lines Kill local variable12 ; FAMILY 6 lines Family Name13 ; GIVEN 6 lines Given Name14 ; MIDDLE 6 lines Middle Name15 ; SUFFIX 6 lines Suffix Name16 ; DISPNAME 5 lines Display Name17 ; DOB 6 lines Date of Birth18 ; GENDER 4 lines Get Gender19 ; SSN 4 lines Get SSN for ID20 ; ADDRTYPE 4 lines Get Home Address21 ; ADDR1 4 lines Get Home Address line 122 ; ADDR2 5 lines Get Home Address line 223 ; CITY 4 lines Get City for Home Address24 ; STATE 11 lines Get State for Home Address25 ; ZIP 4 lines Get Zip code for Home Address26 ; COUNTY 4 lines Get County for our Address27 ; COUNTRY 4 lines Get Country for our Address28 ; RESTEL 4 lines Residential Telephone29 ; WORKTEL 4 lines Work Telephone30 ; EMAIL 4 lines Email Adddress31 ; CELLTEL 4 lines Cell Phone32 ; NOK1FAM 6 lines Next of Kin 1 (NOK1) Family Name33 ; NOK1GIV 6 lines NOK1 Given Name34 ; NOK1MID 6 lines NOK1 Middle Name35 ; NOK1SUF 6 lines NOK1 Suffi Name36 ; NOK1DISP 5 lines NOK1 Display Name37 ; NOK1REL 4 lines NOK1 Relationship to the patient38 ; NOK1ADD1 4 lines NOK1 Address 139 ; NOK1ADD2 5 lines NOK1 Address 240 ; NOK1CITY 4 lines NOK1 City41 ; NOK1STAT 5 lines NOK1 State42 ; NOK1ZIP 4 lines NOK1 Zip Code43 ; NOK1HTEL; 4 lines NOK1 Home Telephone44 ; NOK1WTEL; 4 lines NOK1 Work Telephone45 ; NOK1SAME; 4 lines Is NOK1's Address the same the patient?46 ; NOK2FAM 6 lines NOK2 Family Name47 ; NOK2GIV 6 lines NOK2 Given Name48 ; NOK2MID 6 lines NOK2 Middle Name49 ; NOK2SUF 5 lines NOK2 Suffi Name50 ; NOK2DISP 5 lines NOK2 Display Name51 ; NOK2REL 4 lines NOK2 Relationship to the patient52 ; NOK2ADD1 4 lines NOK2 Address 153 ; NOK2ADD2 5 lines NOK2 Address 254 ; NOK2CITY 4 lines NOK2 City55 ; NOK2STAT 5 lines NOK2 State56 ; NOK2ZIP 4 lines NOK2 Zip Code57 ; NOK2HTEL; 4 lines NOK2 Home Telephone58 ; NOK2WTEL; 4 lines NOK2 Work Telephone59 ; NOK2SAME; 4 lines Is NOK2's Address the same the patient?60 ; EMERFAM 6 lines Emergency Contact (EMER) Family Name61 ; EMERGIV 6 lines EMER Given Name62 ; EMERMID 6 lines EMER Middle Name63 ; EMERSUF 5 lines EMER Suffi Name64 ; EMERDISP 5 lines EMER Display Name65 ; EMERREL 4 lines EMER Relationship to the patient66 ; EMERADD1 4 lines EMER Address 167 ; EMERADD2 5 lines EMER Address 268 ; EMERCITY 4 lines EMER City69 ; EMERSTAT 5 lines EMER State70 ; EMERZIP 4 lines EMER Zip Code71 ; EMERHTEL; 4 lines EMER Home Telephone72 ; EMERWTEL; 4 lines EMER Work Telephone73 ; EMERSAME; 4 lines Is EMER's Address the same the NOK?74 6 75 7 W "No Entry at top!" Q … … 167 99 FAMILY() ; Family Name; PUBLIC; Extrinsic 168 100 ; PREREQ: PT Defined 169 Q:$G(PT(0))="" ""170 101 N NAME S NAME=$P(PT(0),"^",1) 171 102 D NAMECOMP^XLFNAME(.NAME) … … 174 105 GIVEN() ; Given Name; PUBLIC; Extrinsic 175 106 ; PREREQ: PT Defined 176 Q:$G(PT(0))="" ""177 107 N NAME S NAME=$P(PT(0),"^",1) 178 108 D NAMECOMP^XLFNAME(.NAME) … … 181 111 MIDDLE() ; Middle Name; PUBLIC; Extrinsic 182 112 ; PREREQ: PT Defined 183 Q:$G(PT(0))="" ""184 113 N NAME S NAME=$P(PT(0),"^",1) 185 114 D NAMECOMP^XLFNAME(.NAME) … … 188 117 SUFFIX() ; Suffi Name; PUBLIC; Extrinsic 189 118 ; PREREQ: PT Defined 190 Q:$G(PT(0))="" ""191 119 N NAME S NAME=$P(PT(0),"^",1) 192 120 D NAMECOMP^XLFNAME(.NAME) … … 195 123 DISPNAME() ; Display Name; PUBLIC; Extrinsic 196 124 ; PREREQ: PT Defined 197 Q:$G(PT(0))="" ""198 125 N NAME S NAME=$P(PT(0),"^",1) 199 126 Q $$NAMEFMT^XLFNAME(.NAME,"G","MXc") … … 201 128 DOB() ; Date of Birth; PUBLIC; Extrinsic 202 129 ; PREREQ: PT Defined 203 Q:$G(PT(0))="" ""204 130 N DOB S DOB=$P(PT(0),"^",3) 205 131 ; Date in FM Date Format. Convert to UTC/ISO 8601. … … 208 134 GENDER() ; Get Gender; PUBLIC; Extrinsic 209 135 ; PREREQ: PT Defined 210 Q:$G(PT(0))="" ""211 136 Q $P(PT(0),"^",2) 212 137 ; 213 138 SSN() ; Get SSN for ID; PUBLIC; Extrinsic 214 139 ; PREREQ: PT Defined 215 Q:$G(PT(0))="" ""216 140 Q $P(PT(0),"^",9) 217 141 ; 218 ADDRTYPE( ) ; Get Home Address; PUBLIC; Extrinsic142 ADDRTYPE(ADDR) ; Get Home Address; PUBLIC; Extrinsic 219 143 ; Vista only stores a home address for the patient. 220 Q:$G(PT(0))="" ""221 144 Q "Home" 222 145 ; 223 146 ADDR1() ; Get Home Address line 1; PUBLIC; Extrinsic 224 147 ; PREREQ: PT Defined 225 Q:$G(PT(.11))="" ""226 148 Q $P(PT(.11),"^",1) 227 149 ; … … 229 151 ; PREREQ: PT Defined 230 152 ; Vista has Lines 2,3; CCR has only line 1,2; so compromise 231 Q:$G(PT(.11))="" ""232 ; If the thrid address is empty, just return the 2nd.233 ; If the 2nd is empty, we don't lose, b/c it will return ""234 ; This is so that we won't produce a comma if there is no 3rd addr.235 Q:$P(PT(.11),"^",3)="" $P(PT(.11),"^",2)236 153 Q $P(PT(.11),"^",2)_", "_$P(PT(.11),"^",3) 237 154 ; 238 155 CITY() ; Get City for Home Address; PUBLIC; Extrinsic 239 156 ; PREREQ: PT Defined 240 Q:$G(PT(.11))="" ""241 157 Q $P(PT(.11),"^",4) 242 158 ; 243 159 STATE() ; Get State for Home Address; PUBLIC; Extrinsic 244 160 ; PREREQ: PT Defined 245 Q:$G(PT(.11))="" ""246 161 ; State is stored as a pointer 247 N STATENUM S STATENUM=$P(PT(.11),"^",5)162 N STATENUM=$P(PT(.11)"^",5) 248 163 ; 249 164 ; State File Global is below … … 251 166 ; ==>[3F] ^ (#5) CAPITAL [4F] ^ (#2.1) AAC RECOGNIZED [5S] ^ (#2.2) 252 167 ; ==>US STATE OR POSSESSION [6S] ^ 253 Q:STATENUM="" "" ; To prevent global undefined below if no state254 168 Q $P(^DIC(5,STATENUM,0),"^",1) 255 169 ; 256 ZIP() ; Get Zip code for Home Address ; PUBLIC; Extrinsic170 ZIP() ; Get Zip code for Home Address 257 171 ; PREREQ: PT Defined 258 Q:$G(PT(.11))="" ""259 172 Q $P(PT(.11),"^",6) 260 173 ; 261 COUNTY() ; Get County for our Address ; PUBLIC; Extrinsic174 COUNTY() ; Get County for our Address 262 175 ; PREREQ: PT Defined 263 Q:$G(PT(.11))="" ""264 176 Q $P(PT(.11),"^",7) 265 177 ; 266 COUNTRY() ; Get Country for our Address; PUBLIC; Extrinsic267 ; Unfortunately, I can't find where that is stored, so the inevitable...268 Q:$G(PT(.11))="" ""269 Q "USA"270 ;271 RESTEL() ; Residential Telephone; PUBLIC; Extrinsic272 ; PREREQ: PT Defined273 Q:$G(PT(.13))="" ""274 Q $P(PT(.13),"^",1)275 ;276 WORKTEL() ; Work Telephone; PUBLIC; Extrinsic277 ; PREREQ: PT Defined278 Q:$G(PT(.13))="" ""279 Q $P(PT(.13),"^",2)280 ;281 EMAIL() ; Email Adddress; PUBLIC; Extrinsic282 ; PREREQ: PT Defined283 Q:$G(PT(.13))="" ""284 Q $P(PT(.13),"^",3)285 ;286 CELLTEL() ; Cell Phone; PUBLIC; Extrinsic287 ; PREREQ: PT Defined288 Q:$G(PT(.13))="" ""289 Q $P(PT(.13),"^",4)290 ;291 NOK1FAM() ; Next of Kin 1 (NOK1) Family Name; PUBLIC; Extrinsic292 ; PREREQ: PT Defined293 Q:$G(PT(.21))="" ""294 N NAME S NAME=$P(PT(.21),"^",1)295 D NAMECOMP^XLFNAME(.NAME)296 Q NAME("FAMILY")297 ;298 NOK1GIV() ; NOK1 Given Name; PUBLIC; Extrinsic299 ; PREREQ: PT Defined300 Q:$G(PT(.21))="" ""301 N NAME S NAME=$P(PT(.21),"^",1)302 D NAMECOMP^XLFNAME(.NAME)303 Q NAME("GIVEN")304 ;305 NOK1MID() ; NOK1 Middle Name; PUBLIC; Extrinsic306 ; PREREQ: PT Defined307 Q:$G(PT(.21))="" ""308 N NAME S NAME=$P(PT(.21),"^",1)309 D NAMECOMP^XLFNAME(.NAME)310 Q NAME("MIDDLE")311 ;312 NOK1SUF() ; NOK1 Suffi Name; PUBLIC; Extrinsic313 ; PREREQ: PT Defined314 Q:$G(PT(.21))="" ""315 N NAME S NAME=$P(PT(.21),"^",1)316 D NAMECOMP^XLFNAME(.NAME)317 Q NAME("SUFFIX")318 ;319 NOK1DISP() ; NOK1 Display Name; PUBLIC; Extrinsic320 ; PREREQ: PT Defined321 Q:$G(PT(.21))="" ""322 N NAME S NAME=$P(PT(.21),"^",1)323 Q $$NAMEFMT^XLFNAME(.NAME,"G","MXc")324 ; "G" is Given Name First; "MXc" is Mixed Case, With Suffx Preceded by Comma325 NOK1REL() ; NOK1 Relationship to the patient; PUBLIC; Extrinsic326 ; PREREQ: PT Defined327 Q:$G(PT(.21))="" ""328 Q $P(PT(.21),"^",2)329 ;330 NOK1ADD1() ; NOK1 Address 1; PUBLIC; Extrinsic331 ; PREREQ: PT Defined332 Q:$G(PT(.21))="" ""333 Q $P(PT(.21),"^",3)334 ;335 NOK1ADD2() ; NOK1 Address 2; PUBLIC; Extrinsic336 ; PREREQ: PT Defined337 ; As before, CCR only allows two fileds for the address, so we have to compromise338 Q:$G(PT(.21))="" ""339 ; If the thrid address is empty, just return the 2nd.340 ; If the 2nd is empty, we don't lose, b/c it will return ""341 ; This is so that we won't produce a comma if there is no 3rd addr.342 Q:$P(PT(.21),"^",5)="" $P(PT(.21),"^",4)343 Q $P(PT(.21),"^",4)_", "_$P(PT(.21),"^",5)344 ;345 NOK1CITY() ; NOK1 City; PUBLIC; Extrinsic346 ; PREREQ: PT Defined347 Q:$G(PT(.21))="" ""348 Q $P(PT(.21),"^",6)349 ;350 NOK1STAT() ; NOK1 State; PUBLIC; Extrinsic351 ; PREREQ: PT Defined352 Q:$G(PT(.21))="" ""353 N STATENUM S STATENUM=$P(PT(.21),"^",7)354 Q:STATENUM="" ""355 Q $P(^DIC(5,STATENUM,0),"^",1)356 ;357 NOK1ZIP() ; NOK1 Zip Code; PUBLIC; Extrinsic358 ; PREREQ: PT Defined359 Q:$G(PT(.21))="" ""360 Q $P(PT(.21),"^",8)361 ;362 NOK1HTEL() ; NOK1 Home Telephone; PUBLIC; Extrinsic363 ; PREREQ: PT Defined364 Q:$G(PT(.21))="" ""365 Q $P(PT(.21),"^",9)366 ;367 NOK1WTEL() ; NOK1 Work Telephone; PUBLIC; Extrinsic368 ; PREREQ: PT Defined369 Q:$G(PT(.21))="" ""370 Q $P(PT(.21),"^",11)371 ;372 NOK1SAME() ; Is NOK1's Address the same the patient?; PUBLIC; Extrinsic373 ; PREREQ: PT Defined374 Q:$G(PT(.21))="" ""375 Q $P(PT(.21),"^",10)376 ;377 NOK2FAM() ; NOK2 Family Name; PUBLIC; Extrinsic378 ; PREREQ: PT Defined379 Q:$G(PT(.211))="" ""380 N NAME S NAME=$P(PT(.211),"^",1)381 D NAMECOMP^XLFNAME(.NAME)382 Q NAME("FAMILY")383 ;384 NOK2GIV() ; NOK2 Given Name; PUBLIC; Extrinsic ; PREREQ: PT Defined385 Q:$G(PT(.211))="" ""386 N NAME S NAME=$P(PT(.211),"^",1)387 D NAMECOMP^XLFNAME(.NAME)388 Q NAME("GIVEN")389 ;390 NOK2MID() ; NOK2 Middle Name; PUBLIC; Extrinsic391 ; PREREQ: PT Defined392 Q:$G(PT(.211))="" ""393 N NAME S NAME=$P(PT(.211),"^",1)394 D NAMECOMP^XLFNAME(.NAME)395 Q NAME("MIDDLE")396 ;397 NOK2SUF() ; NOK2 Suffi Name; PUBLIC; Extrinsic398 ; PREREQ: PT Defined399 Q:$G(PT(.211))="" ""400 N NAME S NAME=$P(PT(.211),"^",1)401 D NAMECOMP^XLFNAME(.NAME)402 Q NAME("SUFFIX")403 NOK2DISP() ; NOK2 Display Name; PUBLIC; Extrinsic404 ; PREREQ: PT Defined405 Q:$G(PT(.211))="" ""406 N NAME S NAME=$P(PT(.211),"^",1)407 Q $$NAMEFMT^XLFNAME(.NAME,"G","MXc")408 ; "G" is Given Name First; "MXc" is Mixed Case, With Suffx Preceded by Comma409 NOK2REL() ; NOK2 Relationship to the patient; PUBLIC; Extrinsic410 ; PREREQ: PT Defined411 Q:$G(PT(.211))="" ""412 Q $P(PT(.211),"^",2)413 ;414 NOK2ADD1() ; NOK2 Address 1; PUBLIC; Extrinsic415 ; PREREQ: PT Defined416 Q:$G(PT(.211))="" ""417 Q $P(PT(.211),"^",3)418 ;419 NOK2ADD2() ; NOK2 Address 2; PUBLIC; Extrinsic420 ; PREREQ: PT Defined421 ; As before, CCR only allows two fileds for the address, so we have to compromise422 Q:$G(PT(.211))="" ""423 ; If the thrid address is empty, just return the 2nd.424 ; If the 2nd is empty, we don't lose, b/c it will return ""425 ; This is so that we won't produce a comma if there is no 3rd addr.426 Q:$P(PT(.211),"^",5)="" $P(PT(.211),"^",4)427 Q $P(PT(.211),"^",4)_", "_$P(PT(.211),"^",5)428 ;429 NOK2CITY() ; NOK2 City; PUBLIC; Extrinsic430 ; PREREQ: PT Defined431 Q:$G(PT(.211))="" ""432 Q $P(PT(.211),"^",6)433 ;434 NOK2STAT() ; NOK2 State; PUBLIC; Extrinsic435 ; PREREQ: PT Defined436 Q:$G(PT(.211))="" ""437 N STATENUM S STATENUM=$P(PT(.211),"^",7)438 Q:STATENUM="" "" ; To prevent global undefined below if no state439 Q $P(^DIC(5,STATENUM,0),"^",1) ; Explained above440 ;441 NOK2ZIP() ; NOK2 Zip Code; PUBLIC; Extrinsic442 ; PREREQ: PT Defined443 Q:$G(PT(.211))="" ""444 Q $P(PT(.211),"^",8)445 ;446 NOK2HTEL() ; NOK2 Home Telephone; PUBLIC; Extrinsic447 ; PREREQ: PT Defined448 Q:$G(PT(.211))="" ""449 Q $P(PT(.211),"^",9)450 ;451 NOK2WTEL() ; NOK2 Work Telephone; PUBLIC; Extrinsic452 ; PREREQ: PT Defined453 Q:$G(PT(.211))="" ""454 Q $P(PT(.211),"^",11)455 ;456 NOK2SAME() ; Is NOK2's Address the same the patient?; PUBLIC; Extrinsic457 ; PREREQ: PT Defined458 Q:$G(PT(.211))="" ""459 Q $P(PT(.211),"^",10)460 ;461 EMERFAM() ; Emergency Contact (EMER) Family Name; PUBLIC; Extrinsic462 ; PREREQ: PT Defined463 Q:$G(PT(.33))="" ""464 N NAME S NAME=$P(PT(.33),"^",1)465 D NAMECOMP^XLFNAME(.NAME)466 Q NAME("FAMILY")467 ;468 EMERGIV() ; EMER Given Name; PUBLIC; Extrinsic469 ; PREREQ: PT Defined470 Q:$G(PT(.33))="" ""471 N NAME S NAME=$P(PT(.33),"^",1)472 D NAMECOMP^XLFNAME(.NAME)473 Q NAME("GIVEN")474 ;475 EMERMID() ; EMER Middle Name; PUBLIC; Extrinsic476 ; PREREQ: PT Defined477 Q:$G(PT(.33))="" ""478 N NAME S NAME=$P(PT(.33),"^",1)479 D NAMECOMP^XLFNAME(.NAME)480 Q NAME("MIDDLE")481 ;482 EMERSUF() ; EMER Suffi Name; PUBLIC; Extrinsic483 ; PREREQ: PT Defined484 Q:$G(PT(.33))="" ""485 N NAME S NAME=$P(PT(.33),"^",1)486 D NAMECOMP^XLFNAME(.NAME)487 Q NAME("SUFFIX")488 EMERDISP() ; EMER Display Name; PUBLIC; Extrinsic489 ; PREREQ: PT Defined490 Q:$G(PT(.33))="" ""491 N NAME S NAME=$P(PT(.33),"^",1)492 Q $$NAMEFMT^XLFNAME(.NAME,"G","MXc")493 ; "G" is Given Name First; "MXc" is Mixed Case, With Suffx Preceded by Comma494 EMERREL() ; EMER Relationship to the patient; PUBLIC; Extrinsic495 ; PREREQ: PT Defined496 Q:$G(PT(.33))="" ""497 Q $P(PT(.33),"^",2)498 ;499 EMERADD1() ; EMER Address 1; PUBLIC; Extrinsic500 ; PREREQ: PT Defined501 Q:$G(PT(.33))="" ""502 Q $P(PT(.33),"^",3)503 ;504 EMERADD2() ; EMER Address 2; PUBLIC; Extrinsic505 ; PREREQ: PT Defined506 ; As before, CCR only allows two fileds for the address, so we have to compromise507 Q:$G(PT(.33))="" ""508 ; If the thrid address is empty, just return the 2nd.509 ; If the 2nd is empty, we don't lose, b/c it will return ""510 ; This is so that we won't produce a comma if there is no 3rd addr.511 Q:$P(PT(.33),"^",5)="" $P(PT(.33),"^",4)512 Q $P(PT(.33),"^",4)_", "_$P(PT(.33),"^",5)513 ;514 EMERCITY() ; EMER City; PUBLIC; Extrinsic515 ; PREREQ: PT Defined516 Q:$G(PT(.33))="" ""517 Q $P(PT(.33),"^",6)518 ;519 EMERSTAT() ; EMER State; PUBLIC; Extrinsic520 ; PREREQ: PT Defined521 Q:$G(PT(.33))="" ""522 N STATENUM S STATENUM=$P(PT(.33),"^",7)523 Q:STATENUM="" "" ; To prevent global undefined below if no state524 Q $P(^DIC(5,STATENUM,0),"^",1) ; Explained above525 ;526 EMERZIP() ; EMER Zip Code; PUBLIC; Extrinsic527 ; PREREQ: PT Defined528 Q:$G(PT(.33))="" ""529 Q $P(PT(.33),"^",8)530 ;531 EMERHTEL() ; EMER Home Telephone; PUBLIC; Extrinsic532 ; PREREQ: PT Defined533 Q:$G(PT(.33))="" ""534 Q $P(PT(.33),"^",9)535 ;536 EMERWTEL() ; EMER Work Telephone; PUBLIC; Extrinsic537 ; PREREQ: PT Defined538 Q:$G(PT(.33))="" ""539 Q $P(PT(.33),"^",11)540 ;541 EMERSAME() ; Is EMER's Address the same the NOK?; PUBLIC; Extrinsic542 ; PREREQ: PT Defined543 Q:$G(PT(.33))="" ""544 Q $P(PT(.33),"^",10)545 ;
Note:
See TracChangeset
for help on using the changeset viewer.