Index: FOIAVistA/tag/r/MASTER_PATIENT_INDEX_VISTA-MPIF/MPIFAPI.m
===================================================================
--- FOIAVistA/trunk/r/MASTER_PATIENT_INDEX_VISTA-MPIF/MPIFAPI.m	(revision 631)
+++ FOIAVistA/tag/r/MASTER_PATIENT_INDEX_VISTA-MPIF/MPIFAPI.m	(revision 636)
@@ -1,4 +1,26 @@
 MPIFAPI ;CMC/BP-APIS FOR MPI ;DEC 21, 1998
- ;;1.0; MASTER PATIENT INDEX VISTA ;**1,3,14,16,17,21,27,28,33,35,37,43,45,44,46,48**;30 Apr 99;Build 6
+ ;;1.0; MASTER PATIENT INDEX VISTA ;**1,3,14,16,17,21,27,28,33,35,37,43,45,44,46,48,40**;30 Apr 99;Build 13
+ ; Modified from FOIA VISTA,
+ ; Copyright (C) 2007 WorldVistA
+ ;
+ ; This program is free software; you can redistribute it and/or modify
+ ; it under the terms of the GNU General Public License as published by
+ ; the Free Software Foundation; either version 2 of the License, or
+ ; (at your option) any later version.
+ ;
+ ; This program is distributed in the hope that it will be useful,
+ ; but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ ; GNU General Public License for more details.
+ ;
+ ; You should have received a copy of the GNU General Public License
+ ; along with this program; if not, write to the Free Software
+ ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ ;
+ ; 2/5/2005  DAOU/WCJ: VOE patch created
+ ; 4/22/2005 ALB/PTD: MPIF*1*37
+ ; 9/14/2005 VA/CJS: VOE patch reworked as MPIF*1*40 T1
+ ; 4/3/2006  WV/TOAD: VOE patch reapplied after YS*5.01*37
+ ;
  ; Integration Agreements Utilized:
  ;   ^DPT( - #2070 and #4079
@@ -93,5 +115,19 @@
  ...I MPIFARR(2,DFN,.09,"E")["P",("S"[MPIFARR(2,DFN,.0906,"I")) S MPIFP=".0906;"
  ..S DIE="^DPT(",DA=DFN,DIE("NO^")="BACK"
- ..S DR=MPIFP_".2403;.092;.093;1",DR(2,2.01)=".01" D ^DIE K DA,DIE,DR Q
+ ..; start of VOE change part 1 of 2
+ ..; if agency is EHR or IHS, ask Health Record Number before other fields
+ ..;
+ ..; before change
+ ..;S DR=MPIFP_".2403;.092;.093;1",DR(2,2.01)=".01" D ^DIE K DA,DIE,DR Q
+ ..;
+ ..; after change
+ ..S DR=MPIFP_".2403;.092;.093;1"
+ ..I "EI"[$G(DUZ("AG")) S DR="D HRN^MPIFAG1;"_DR
+ ..S DR(2,2.01)=".01"
+ ..D ^DIE
+ ..K DA,DIE,DR
+ ..;
+ ..; end of VOE change 1 of 2
+ ..;
  .I $G(DGNEW)="" D  ;Existing patient, get current values
  ..N MPIDOB,IMPRS,MPIMMN,MPICTY,MPIST
@@ -124,4 +160,12 @@
  ...I MPIFARR(2,DFN,.09,"E")["P",(MPIFARR(2,DFN,.0906,"I")="") S DR=DR_".0906;" ;**48 correct when SSN is prompted
  ...I MPIFARR(2,DFN,.09,"E")["P",(MPIFARR(2,DFN,.0906,"I")="S") S DR=DR_".09;" ;**48 correct when SSN is prompted
+ ..;
+ ..; start of VOE change part 2 of 2
+ ..; if agency is EHR or IHS, ask Health Record Number after SSN
+ ..;
+ ..I "EI"[$G(DUZ("AG")) S DR=DR_"D HRN^MPIFAG1;"
+ ..;
+ ..; end of VOE change 2 of 2
+ ..;
  ..I $G(MPIFARR(2,DFN,994,"I"))="" S DR=DR_"994;" ;MULTIPLE BIRTH INDICATOR
  ..S MPIMMN=$G(MPIFARR(2,DFN,.2403,"E")) ;MOTHER'S MAIDEN NAME
Index: FOIAVistA/tag/r/MASTER_PATIENT_INDEX_VISTA-MPIF/MPIFQ0.m
===================================================================
--- FOIAVistA/trunk/r/MASTER_PATIENT_INDEX_VISTA-MPIF/MPIFQ0.m	(revision 631)
+++ FOIAVistA/tag/r/MASTER_PATIENT_INDEX_VISTA-MPIF/MPIFQ0.m	(revision 636)
@@ -1,11 +1,6 @@
-MPIFQ0 ;ALB/RJS-QUERY HANDLER TOP LEVEL ;JUL 11, 1997
- ;;1.0; MASTER PATIENT INDEX VISTA ;**1,3,8,14,13,16,17,21,20,24,26,28,31,33,35,38,43**;30 Apr 99
- ;
- ; Integration Agreements utilized:
- ;  EXC, START and STOP^RGHLLOG - #2796
- ;  FILE^VAFCTFU - #2988
- ;  $$EN^HLCSAC - #3471
- ;  NAME^VAFCPID2 - #3492
- ;
+MPIFQ0 ;ALB/RJS-QUERY HANDLER TOP LEVEL ;2/8/07  22:22
+ ;;1.0; MASTER PATIENT INDEX VISTA ;**1,3,8,14,13,16,17,21,20,24,26,28,31,33,35,38,43,40**;30 Apr 99;Build 13
+ ; Modified from FOIA VISTA,
+ ; GPL Copyright (C) 2007 WorldVistA
 INTACTV ;Interactive standalone query
  N DFN,NAME1,MPIFLL
@@ -23,5 +18,5 @@
  I $G(LOCDATA(2,DFN,991.01))>0&('$D(MPIFLL)) W:'$D(MPIFRPC) !,"Patient already has an ICN" G END
  S HLP("ACKTIME")=300,MPIQRYNM="EXACT_MATCH_QUERY"
- ;MPIQRYNM="VTQ_PID_ICN_NO_LOAD" **43 CHANGING QUERY NAME
+ ;MPIQRYNM="VTQ_PID_ICN_NO_LOAD" CHANGING QUERY NAME
  G JUMP
 VTQ G:$G(DFN)']"" END
@@ -29,7 +24,11 @@
  D GETDATA("^DPT(",DFN,"LOCDATA",".01;.02;.03;.09;.301;391;1901")
  S LOCDATA(2,DFN,991.01)=$P($$MPINODE^MPIFAPI(DFN),"^"),TSSN=LOCDATA(2,DFN,.09)
- ;S MPIQRYNM="VTQ_PID_ICN_NO_LOAD" **43 CHANGING QUERY NAME
+ ;S MPIQRYNM="VTQ_PID_ICN_NO_LOAD" CHANGING QUERY NAME
  S MPIQRYNM="EXACT_MATCH_QUERY"
  I $G(LOCDATA(2,DFN,991.01))>0 S MPIFRTN="ALREADY HAS ICN" G END ;If Pt already has ICN don't connect to MPI
+ ;New VOE code
+ ;Agency EHR does not use MPI
+ I '($G(DUZ("AG"))="V"!$$GET^XPAR("SYS","MPIF VOE MPI")) G END ;DAOU/WCJ;WV/CJS
+ ;End EHR modifications
 JUMP N TIME,% D NOW^%DTC S TIME=%
  N HL,MPIINM,MPIOUT,MPIIN,MPIMCNT,MPICNT,MPICS,HEADER,TEST,SITE,MPIDC,SSN
@@ -69,5 +68,5 @@
  .I '$D(MPIFS) W:'$D(MPIFRPC) !!,"Exact match for Patient was not found in the MPI..."
  .D A28^MPIFQ3(DFN) S MPIFRTN="DID A28"
- .;**43 log potential match exception if exist
+ .; log potential match exception if exist
  .I MPIPOT=1 D
  ..D START^RGHLLOG(0),EXC^RGHLLOG(218,"Potential match(es) found, please review via MPI/PD Exception Handler",DFN),STOP^RGHLLOG(0)
@@ -75,5 +74,5 @@
  ;If INDEX=1 it means we got 1 match check SSN see if definitely same pt
  I (INDEX=1) D  G EXIT
- .;**43 Removed &(TSSN=SSN) from line above as there will only be an exact match returned now
+ .; Removed &(TSSN=SSN) from line above, only be an exact match returned now
  .N CCMOR,ICN,DATA,TICN,SNM,SNM2,IEN
  .S DATA=^TMP("MPIFVQQ",$J,INDEX,"DATA"),CMOR=$P(DATA,"^",5),ICN=$P(DATA,"^",6),IEN=$$IEN^XUAF4(CMOR)
@@ -132,5 +131,5 @@
  N RESLT S RESLT=$$A24^MPIFA24B(DFN)
  I +RESLT<0 D EXC^RGHLLOG(208,"Problem building A24 (ADD TF) for DFN= "_DFN,DFN)
- ; Added for patch 31, create treating facility list
+ ; create treating facility list
  I $D(^TMP("MPIFVQQ",$J,INDEX,"TF")) D
  . N MPINTFI,MPINTF,TFSTRG,TFIEN,MPIFMDT
@@ -144,6 +143,4 @@
  Q
 GETDATA(DIC,DA,MPIFAR,DR,EI) ;
- ;This function returns the values stored in the fields via FM call DIQ1
- ;DIC=file reference, DA=IEN in file, ARRAY=array for the values to be stored in, DR=fields requested, EI=external/internal values
  N DIQ S DIQ=MPIFAR
  I $G(EI)]"" S DIQ(0)=EI
@@ -164,5 +161,5 @@
 RDF ;
  Q
-QAK ;**43 added check for potential matches
+QAK ; check potential matches
  K MPIPOT S MPIPOT=0
  I MSG(1)["POTENTIAL MATCHES" S MPIPOT=1
@@ -189,3 +186,2 @@
  S ^TMP("MPIFVQQ",$J,INDEX,0)=STRING,^TMP("MPIFVQQ",$J,"IDX",INDEX,INDEX)=""
  Q
- Q
