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

AUPNLK3.m

Go to the documentation of this file.
  1. AUPNLK3 ; IHS/CMI/LAB - IHS PATIENT LOOKUP CHECK FOR DUPLICATES ;
  1. ;;99.1;IHS DICTIONARIES (PATIENT);;MAR 09, 1999
  1. ;'Modified' MAS Patient Look-up Check for Duplicates, June 1987
  1. ;
  1. ; Upon exiting this routine AUPNLK3 will be set as follows:
  1. ;
  1. ; AUPNLK3 = 0 means ok to add patient
  1. ; AUPNLK3 = -1 means do not add patient
  1. ;
  1. ; AUPQF3 values have the following meaing.
  1. ;
  1. ; 0 = Initial state
  1. ; 1 = Missing fields
  1. ; 2 = No potential duplicates
  1. ; 3 = Operator said no
  1. ; 4 = Operator said yes
  1. ;
  1. START ;
  1. D INIT ; Initialization
  1. I AUPQF3 D EOJ Q
  1. D SEARCH ; Do search
  1. I AUPQF3 D EOJ Q
  1. D SHOW ; Show list of potential duplicates
  1. D ASK ; See if still want to add
  1. D EOJ
  1. Q
  1. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1. ;
  1. S AUPNM=AUPX,SEX=AUPIDS(.02),DOB=AUPIDS(.03),SSN=AUPIDS(.09)
  1. W !!?3,"...searching for potential duplicates"
  1. D ^AUPNLKD
  1. I 'AUPD W !!?3,"No potential duplicates have been identified." S AUPQF3=2 Q
  1. Q
  1. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1. ;
  1. SHOW ; SHOW LIST OF POTENTIAL DUPLICATES
  1. W !!?3,*7,"The following patients have been identified as potential duplicates:",!
  1. F Y=0:0 S Y=$O(AUPD(Y)) Q:'Y W !?5,$P(^DPT(Y,0),U) X DIC("W") I $D(^DPT(Y,.01)) F AUPAN=0:0 S AUPAN=$O(^DPT(Y,.01,AUPAN)) Q:AUPAN'=+AUPAN I $D(^(AUPAN,0)) W !?10,$P(^(0),U,1)
  1. Q
  1. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1. ;
  1. ASK ; ASK OPERATOR
  1. F AUPL=0:0 D ASKADD Q:%
  1. I %'=1 S AUPQF3=3 Q
  1. S AUPQF3=4
  1. Q
  1. ;
  1. ASKADD ;
  1. W !!?3,"Do you still want to add '",AUPX,"' as a new patient"
  1. S %=2 D YN^DICN I '% W !!?6,"Enter 'YES' to add new patient, or 'NO' not to." Q
  1. Q
  1. ;
  1. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1. ;
  1. INIT ; INITIALIZATION
  1. S AUPQF3=0
  1. I '$D(AUPX)!('$D(AUPIDS(.02)))!('$D(AUPIDS(.03)))!('$D(AUPIDS(.09))) W !?3,*7,"Unable to search for potential duplicates, Sex, Date of Birth and",!?3,"Social Security Number must be defined." S AUPQF3=1 Q
  1. Q
  1. ;
  1. ; - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1. ;
  1. EOJ ;
  1. S AUPNLK3=$S(AUPQF3#2:-1,1:0)
  1. K AUPAN,AUPD,AUPNM,AUPQF3
  1. K DOB,SEX,SSN
  1. Q