MPIFDUPS ;SFCIO/CMC-MPIF RPC APIS ;26 Sept 01
;;1.0; MASTER PATIENT INDEX VISTA ;**20**;30 Apr 99
;
;Integration Agreements Utilized:
; ^DPT( - #2070
;
TOSITE(RETURN,ARRAY) ;
; RPC for processing ICNs from MPI's TOSITE global
I $G(ARRAY)="" S RETURN="-1^NO DATA TO CHECK" Q
N ENT,ICN,SSN,SITE,NODE,MPIN,DFN
S RETURN=""
F ENT=1:1 S NODE=$P(ARRAY,"^",ENT) Q:NODE=""!(+RETURN=-1) D
.S SITE=$P(NODE,";")
.I $P($$SITE^VASITE,"^",3)'=SITE S RETURN="-1^WRONG SITE^"_ARRAY Q
.S ICN=$P(NODE,";",2),SSN=$P(NODE,";",3)
.S DFN=+$$GETDFN^MPIF001(ICN)
.I DFN<0 S RETURN=RETURN_NODE_";1^" Q
. ; ^ 1=ICN doesn't exist
.I DFN D
..; checking if ICN is on MPI node
..S MPIN=$$MPINODE^MPIFAPI(DFN)
..I $P(MPIN,"^")'=ICN S RETURN=RETURN_NODE_";4^" Q
..; checking if SSN is the same as on MPI - 4=icn should be inactivated
..I $P(^DPT(DFN,0),"^",9)'=SSN S RETURN=RETURN_NODE_";3^" Q
..; 3 = SSN conflict
..S RETURN=RETURN_NODE_";2^" Q
..; 2 = ICN exists
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMPIFDUPS 995 printed Nov 22, 2024@17:21:09 Page 2
MPIFDUPS ;SFCIO/CMC-MPIF RPC APIS ;26 Sept 01
+1 ;;1.0; MASTER PATIENT INDEX VISTA ;**20**;30 Apr 99
+2 ;
+3 ;Integration Agreements Utilized:
+4 ; ^DPT( - #2070
+5 ;
TOSITE(RETURN,ARRAY) ;
+1 ; RPC for processing ICNs from MPI's TOSITE global
+2 IF $GET(ARRAY)=""
SET RETURN="-1^NO DATA TO CHECK"
QUIT
+3 NEW ENT,ICN,SSN,SITE,NODE,MPIN,DFN
+4 SET RETURN=""
+5 FOR ENT=1:1
SET NODE=$PIECE(ARRAY,"^",ENT)
if NODE=""!(+RETURN=-1)
QUIT
Begin DoDot:1
+6 SET SITE=$PIECE(NODE,";")
+7 IF $PIECE($$SITE^VASITE,"^",3)'=SITE
SET RETURN="-1^WRONG SITE^"_ARRAY
QUIT
+8 SET ICN=$PIECE(NODE,";",2)
SET SSN=$PIECE(NODE,";",3)
+9 SET DFN=+$$GETDFN^MPIF001(ICN)
+10 IF DFN<0
SET RETURN=RETURN_NODE_";1^"
QUIT
+11 ; ^ 1=ICN doesn't exist
+12 IF DFN
Begin DoDot:2
+13 ; checking if ICN is on MPI node
+14 SET MPIN=$$MPINODE^MPIFAPI(DFN)
+15 IF $PIECE(MPIN,"^")'=ICN
SET RETURN=RETURN_NODE_";4^"
QUIT
+16 ; checking if SSN is the same as on MPI - 4=icn should be inactivated
+17 IF $PIECE(^DPT(DFN,0),"^",9)'=SSN
SET RETURN=RETURN_NODE_";3^"
QUIT
+18 ; 3 = SSN conflict
+19 SET RETURN=RETURN_NODE_";2^"
QUIT
+20 ; 2 = ICN exists
End DoDot:2
End DoDot:1
+21 QUIT
+22 ;