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

MPIFFULL.m

Go to the documentation of this file.
MPIFFULL ;BP/CMC-ALLOW ASSIGNMENT OF LOCAL ICNS FOR X PATIENTS ;29 Dec 2011  4:06 PM
 ;;1.0;MASTER PATIENT INDEX VISTA;**54**;30 Apr 99;Build 2
 ;
 ; Integration Agreement Utilized:
 ;   ^DPT( - #2070
 ;
 ; $O through Patient file (#2) finding patients that don't have ICNs
 ; assigning X patients local ICNs
 ;
LOCALIA(RETURN,HOWM) ;
 ;RETURN IS USED TO RETURN COUNTER OF HOW MANY COMPLETED AND IF PROCESS HAS COMPLETED FOR THE SITE
 ;HOWM IS HOW MANY PATIENTS SHOULD BE PROCESSED THIS TIME
 ;
 N IEN,NODE,DFN,CNT,X,Y,%,%H,%I,ICN,LAST
 I $D(^XTMP("MPIF FULL ENUMERATION")) S RETURN=0,RETURN(0)="1^PROCESS ALREADY RUNNING" Q
 D NOW^%DTC
 I '$D(^XTMP("MPIF FULL ENUMERATION")) S ^XTMP("MPIF FULL ENUMERATION",0)=%+10_"^"_%_"^"_"Full Enumeration of Patients to MPI"
 ;
 ;**54,MVI_913: Set 0 node of ^XTMP that will contain list of records that appear to be "old"
 S ^XTMP("MPIF OLD RECORDS",0)=$$FMADD^XLFDT(X,90)_"^"_%_"^List of 'old' records"
 ;
 ;GET LAST DFN COMPLETED
 S IEN=$O(^MPIF(984.8,"B","ONE","")),NODE=$G(^MPIF(984.8,IEN,0))
 I $P(NODE,"^",5)'="" S RETURN(0)="1^FULL ENUMERATION COMPLETED",RETURN=0 K ^XTMP("MPIF FULL ENUMERATION",0) Q
 ; ^ FULL ENUMERATION COMPLETED
 S DFN=0,CNT=0,RETURN=1
 I $P(NODE,"^",4)'="" S DFN=$P(NODE,"^",4)
 D NOW^%DTC
 S $P(NODE,"^",2)=%
 F  S DFN=$O(^DPT(DFN)) Q:DFN=""!(CNT=HOWM)  D
 .I $P($G(^DPT(DFN,"MPI")),"^")="",'$D(^DPT(DFN,-9)) D
 ..;**54,MVI_913: Add DFN to ^XTMP old list
 ..S:$D(^DPT("AMPIMIS",DFN))[0 ^XTMP("MPIF OLD RECORDS",DFN)=""
 ..S ICN=$$ICNLC^MPIF001(DFN),CNT=CNT+1,LAST=DFN
 D NOW^%DTC
 S $P(NODE,"^",3)=%,$P(NODE,"^",4)=LAST
 I DFN="" S RETURN(0)="1^"_CNT_" PROCESSED^FULL ENUMERATION COMPLETED "_%,$P(NODE,"^",5)="FULL ENUMERATION COMPLETED"
 I DFN'="" S RETURN(0)="1^"_CNT_" PROCESSED - COMPLETED @ "_%
 S ^MPIF(984.8,IEN,0)=NODE
 K ^XTMP("MPIF FULL ENUMERATION",0)
 Q
 ;
STATS(RETURN) ;
 ;RETURN IS THE ARRAY TO HOLD THE STAT DATA
 N IEN,CNT,DFN,ICN,SITE
 S SITE=$P($$SITE^VASITE(),"^",3)
 S CNT("NICN")=0,CNT("LOCAL")=0,CNT("MERGED")=0,CNT("NOICN")=0
 S IEN=$O(^MPIF(984.8,"B","ONE","")),RETURN=0
 Q:IEN<1
 S NODE=$G(^MPIF(984.8,IEN,0)),RETURN=1
 S DFN=0
 F  S DFN=$O(^DPT(DFN)) Q:DFN=""  D
 .S ICN=$P($G(^DPT(DFN,"MPI")),"^")
 .I $E(ICN,1,3)=SITE S CNT("LOCAL")=CNT("LOCAL")+1
 .I $E(ICN,1)=1 S CNT("NICN")=CNT("NICN")+1
 .I $D(^DPT(DFN,-9)) S CNT("MERGED")=CNT("MERGED")+1
 .I ICN="",'$D(^DPT(DFN,-9)) S CNT("NOICN")=CNT("NOICN")+1
 S RETURN(1)=$P(NODE,"^",5)_"^"_$P(NODE,"^",3)_"^"_CNT("NICN")_"^"_CNT("LOCAL")_"^"_CNT("MERGED")_"^"_CNT("NOICN")
 ;COMPLETED?^LAST COMPLETED RUN^TOTAL NATIONAL ICNS^TOTAL LOCAL ICNS^TOTAL MERGED RECORDS^TOTAL RECORDS WITHOUT ICN
 Q