source: WorldVistAEHR/trunk/r/IHS_ROUTINES-AUP/AUPNLK3.m@ 1742

Last change on this file since 1742 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.2 KB
Line 
1AUPNLK3 ; IHS/CMI/LAB - IHS PATIENT LOOKUP CHECK FOR DUPLICATES ;1/29/07 09:05
2 ;;1.0;PCE PATIENT CARE ENCOUNTER;**167**;Aug 12, 1996;Build 22
3 ;'Modified' MAS Patient Look-up Check for Duplicates, June 1987
4 ;
5 ; Upon exiting this routine AUPNLK3 will be set as follows:
6 ;
7 ; AUPNLK3 = 0 means ok to add patient
8 ; AUPNLK3 = -1 means do not add patient
9 ;
10 ; AUPQF3 values have the following meaing.
11 ;
12 ; 0 = Initial state
13 ; 1 = Missing fields
14 ; 2 = No potential duplicates
15 ; 3 = Operator said no
16 ; 4 = Operator said yes
17 ;
18START ;
19 D INIT ; Initialization
20 I AUPQF3 D EOJ Q
21 D SEARCH ; Do search
22 I AUPQF3 D EOJ Q
23 D SHOW ; Show list of potential duplicates
24 D ASK ; See if still want to add
25 D EOJ
26 Q
27 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - -
28 ;
29SEARCH ; SEARCH FOR POTENTIAL DUPLICATES
30 S AUPNM=AUPX,SEX=AUPIDS(.02),DOB=AUPIDS(.03),SSN=AUPIDS(.09)
31 W !!?3,"...searching for potential duplicates"
32 D ^AUPNLKD
33 I 'AUPD W !!?3,"No potential duplicates have been identified." S AUPQF3=2 Q
34 Q
35 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
36 ;
37SHOW ; SHOW LIST OF POTENTIAL DUPLICATES
38 W !!?3,*7,"The following patients have been identified as potential duplicates:",!
39 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)
40 Q
41 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - -
42 ;
43ASK ; ASK OPERATOR
44 F AUPL=0:0 D ASKADD Q:%
45 I %'=1 S AUPQF3=3 Q
46 S AUPQF3=4
47 Q
48 ;
49ASKADD ;
50 W !!?3,"Do you still want to add '",AUPX,"' as a new patient"
51 S %=2 D YN^DICN I '% W !!?6,"Enter 'YES' to add new patient, or 'NO' not to." Q
52 Q
53 ;
54 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - -
55 ;
56INIT ; INITIALIZATION
57 S AUPQF3=0
58 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
59 Q
60 ;
61 ; - - - - - - - - - - - - - - - - - - - - - - - - - - - -
62 ;
63EOJ ;
64 S AUPNLK3=$S(AUPQF3#2:-1,1:0)
65 K AUPAN,AUPD,AUPNM,AUPQF3
66 K DOB,SEX,SSN
67 Q
Note: See TracBrowser for help on using the repository browser.