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

DPTDCAN.m

Go to the documentation of this file.
  1. DPTDCAN ; IHS/TUCSON/JCM - GETS POSSIBLE DUPLICATE CANDIDATES ; [ 09/10/2001 8:24 AM ]
  1. ;;1.0;PATIENT MERGE;;FEB 02, 1994
  1. ;
  1. ; Calls: EN^DIQ1
  1. ;
  1. START ;
  1. K ^TMP("XDRD",$J,XDRFL),DPTDCAN
  1. ;
  1. ;
  1. ;---> BEGIN CHANGES 9/9/2001.
  1. ;---> Quit if patient does not exist. ;Mike Remillard, 9/9/2001
  1. ;---> Next line $D added.
  1. Q:'$D(^DPT(XDRCD,0))
  1. ;---> END CHANGES 9/9/2001.
  1. ;
  1. ;
  1. Q:$P(^DPT(XDRCD,0),U,19)
  1. D VALUE
  1. D NAME
  1. D SSN
  1. D DOB
  1. END D EOJ
  1. Q
  1. ;
  1. VALUE ;
  1. S DIC=2,DA=XDRCD,DIQ(0)="I",DIQ="DPTDCAN",DR=".01;.03;.09"
  1. D EN^DIQ1 K DIC,DA,DR,DIQ
  1. Q
  1. ;
  1. NAME ;
  1. I XDRFL=2 Q:'$D(^DPT(XDRCD,0)) ;IHS/ANMC/LJF 9/10/01 to prevent undef when entry doesn't exist
  1. G:DPTDCAN(XDRFL,XDRCD,.01,"I")']"" NAMEX
  1. S DPTDCAN("NAME")=DPTDCAN(XDRFL,XDRCD,.01,"I")
  1. S DPTDCAN("LNAME&FI")=$P(DPTDCAN("NAME"),",",1)_","_$E($P(DPTDCAN("NAME"),",",2),1)_"AAA"
  1. S DPTDCAN("BNAME")=DPTDCAN("LNAME&FI")
  1. F I=0:0 S DPTDCAN("BNAME")=$O(^DPT("B",DPTDCAN("BNAME"))) Q:DPTDCAN("BNAME")=""!(($P(DPTDCAN("NAME"),",",1)_","_$E($P(DPTDCAN("NAME"),",",2),1))'=($P(DPTDCAN("BNAME"),",",1)_","_$E($P(DPTDCAN("BNAME"),",",2),1))) D
  1. . S DPTDCAN("BNAMEDFN")=0 F S DPTDCAN("BNAMEDFN")=$O(^DPT("B",DPTDCAN("BNAME"),DPTDCAN("BNAMEDFN"))) Q:DPTDCAN("BNAMEDFN")="" S:DPTDCAN("BNAMEDFN")'=XDRCD ^TMP("XDRD",$J,XDRFL,DPTDCAN("BNAMEDFN"))=""
  1. . Q
  1. NAMEX Q
  1. ;
  1. SSN ;Get patients with same last four digits of ssn
  1. G:DPTDCAN(XDRFL,XDRCD,.09,"I")']"" SSNX
  1. S DPTDCAN("SSN")=DPTDCAN(XDRFL,XDRCD,.09,"I")
  1. S DPTDCAN("L4SSN")=$E(DPTDCAN("SSN"),6,9)
  1. S DPTDCAN("BL4SSN")=XDRCD
  1. F %=0:0 S DPTDCAN("BL4SSN")=$O(^DPT("BS",DPTDCAN("L4SSN"),DPTDCAN("BL4SSN"))) Q:'DPTDCAN("BL4SSN") S ^TMP("XDRD",$J,XDRFL,DPTDCAN("BL4SSN"))=""
  1. ;
  1. ; Check SSNS with same first five digits
  1. ; Commented out the following line, is not specific enough for IHS
  1. ; but would be useful for the VA
  1. ;
  1. ;S DPTDCAN("F5SSN")=$E(DPTDCAN("SSN"),1,5)_"0000",DPTDCAN("5SSN")=DPTDCAN("F5SSN") D
  1. . F %=0:0 S DPTDCAN("5SSN")=$O(^DPT("SSN",DPTDCAN("5SSN"))) Q:DPTDCAN("5SSN")'=+DPTDCAN("5SSN")!($E(DPTDCAN("5SSN"),1,5)'=$E(DPTDCAN("SSN"),1,5)) S ^TMP("DPTDCAN",$J,XDRFL,$O(^DPT("SSN",DPTDCAN("5SSN"),"")))=""
  1. . Q
  1. SSNX Q
  1. ;
  1. DOB ;Get patients with same date of birth
  1. G:DPTDCAN(XDRFL,XDRCD,.03,"I")']"" DOBX
  1. S DPTDCAN("DOB")=DPTDCAN(XDRFL,XDRCD,.03,"I")
  1. S DPTDCAN("BDOB")=XDRCD
  1. F %=0:0 S DPTDCAN("BDOB")=$O(^DPT("ADOB",DPTDCAN("DOB"),DPTDCAN("BDOB"))) Q:'DPTDCAN("BDOB") S ^TMP("XDRD",$J,XDRFL,DPTDCAN("BDOB"))=""
  1. ;
  1. ;Transpose day of birth and get patients with same date of birth
  1. ;
  1. S DPTDCAN("TDOB")=$E(DPTDCAN("DOB"),1,5)_$E(DPTDCAN("DOB"),7)_$E(DPTDCAN("DOB"),6)
  1. S DPTDCAN("BDOB")=XDRCD
  1. F %=0:0 S DPTDCAN("BDOB")=$O(^DPT("ADOB",DPTDCAN("TDOB"),DPTDCAN("BDOB"))) Q:'DPTDCAN("BDOB") S ^TMP("XDRD",$J,XDRFL,DPTDCAN("BDOB"))=""
  1. DOBX Q
  1. ;
  1. EOJ ;
  1. K DPTDCAN,%
  1. Q