Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BZXBPN

BZXBPN.m

Go to the documentation of this file.
BZXBPN ;IHS/PHXAO/AEF - FIND BAD PATIENT NAMES
 ;;1.0;ANNE'S SPECIAL ROUTINES;;JUNE 10, 2004
 ;
 ;The code in this routine was written by Jim Gray at PIMC.
 ;
BADPTNAM ;Find bad names
 W !,"PATIENT NAME",?25,"MEDICAID NAME",?50,"MEDICARE NAME"
 S DFN=0
 F  S DFN=$O(^DPT(DFN)) Q:'DFN  D
 .Q:'$D(^DPT(DFN,0))
 .S BZXDONE=0
 .S VIEN=0
 .F  S VIEN=$O(^AUPNVSIT("AC",DFN,VIEN)) Q:'VIEN  D  Q:BZXDONE
 ..Q:(+$G(^AUPNVSIT(VIEN,0)))<3020214
 ..S FLG=0
 ..K NAME,MCAIDNAM,MCARNAM
 ..S NAME=$P(^DPT(DFN,0),U,1)
 ..S BZXGOOD=$$CHKNAM(NAME)
 ..I BZXGOOD<1 W !,NAME S FLG=1
 ..S MCAIDIEN=0
 ..F  S MCAIDIEN=$O(^AUPNMCD("B",DFN,MCAIDIEN)) Q:'MCAIDIEN  D
 ...S MCAIDNAM=$P($G(^AUPNMCD(MCAIDIEN,21)),U,1)
 ...I $$CHKNAM(MCAIDNAM)<1 D
 ....I FLG=0 W !,NAME S FLG=1
 ....I (MCAIDNAM="")!(MCAIDNAM?1." ") S MCAIDNAM="BLANK"
 ....W ?25,MCAIDNAM
 ..I $D(^AUPNMCR(DFN,21)) D
 ...S MCARNAM=$P(^AUPNMCR(DFN,21),U,1)
 ...I $$CHKNAM(MCARNAM)<1 D
 ....I FLG=0 W !,NAME S FLG=1
 ....I (MCARNAM="")!(MCARNAM?1." ") S MCARNAM="BLANK"
 ....W ?50,MCARNAM
 ..S BZXDONE=1
 Q
 ;
CHKNAM(NAM) ;CHECK NAME FORMAT
 I NAM?2.A.1(1" ",1"-").A1" "1(1"JR",1"SR",1"II",1"III",1"IV",1"V")1","2.A.1" ".A.1"." Q -1  ;BAD
 I NAM?2.A.1(1" ",1"-").A1","1.A.1" ".A.1".".1",".3A.1"." Q 1  ;GOOD
 Q 0
 ;
BADADR ;Find bad addresses
 S DFN=0
 F  S DFN=$O(^DPT(DFN)) Q:'DFN  D
 .Q:'$D(^DPT(DFN,0))
 .S BZXDONE=0
 .S VIEN=0
 .F  S VIEN=$O(^AUPNVSIT("AC",DFN,VIEN)) Q:'VIEN  D  Q:BZXDONE
 ..Q:(+$G(^AUPNVSIT(VIEN,0)))<3020214
 ..S BZXDONE=1
 ..S IENS=DFN_","
 ..S BZXGOOD=0
 ..S BZXADDR=$$GET1^DIQ(2,IENS,.111)
 ..Q:BZXADDR="" 
 ..I BZXADDR?1.5N1" ".5AP.1" "3.NA.AP.N." " S BZXGOOD=1
 ..I BZXADDR?1"P".1".".1" "1"O".1".".1" ".1"BOX"1" ".1"#"1.8N S BZXGOOD=1
 ..Q:BZXGOOD
 ..S BZXPAT0=^DPT(DFN,0)
 ..S BZXPAT11=^DPT(DFN,.11)
 ..S NAME=$P(BZXPAT0,U,1)
 ..S SSN=$P(BZXPAT0,U,9)
 ..S ADDR2T3=$P(BZXPAT11,U,2,3)
 ..S CITY=$P(BZXPAT11,U,4)
 ..S STATE=$$GET1^DIQ(2,IENS,.115)
 ..S ZIP=$P(BZXPAT11,U,6)
 ..W !,NAME,?25,SSN
 ..W !,BZXADDR
 ..I $L(ADDR2T3)>1 W !,ADDR2T3
 ..W !,CITY_", "_STATE_" "_ZIP
 ..W !
 Q