MPIFACHK ;CMC/BP-ACKNOWLEDGEMENT CHECK ;JULY 8, 2002
;;1.0; MASTER PATIENT INDEX VISTA ;**22**;30 Apr 99
;
; Integration Agreements Utilized:
; START, STOP, EXC^RGHLLOG - #2796
;
EN(RETURN,BEFORE) ; CHECKING FOR "A" FOR XTMP("MPIFA.. NODES that happened before FM date BEFORE
;RPC - RETURN will have 0 if no messages need to be resent OR 1 if there are some resent.
;
N DFN2,TAG,MPIFHL,ICN,ICN2 K MPIFMSG
M MPIFHL=HL ;need to save hl variables to avoid undefined errors when returning to RPC.
S MPIFMSG="MPIFA",RETURN=0
F S MPIFMSG=$O(^XTMP(MPIFMSG)) Q:$E(MPIFMSG,1,5)'="MPIFA" D
.Q:$P(^XTMP(MPIFMSG,0),"^",2)>BEFORE
.I $E(MPIFMSG,1,7)="MPIFA40" D
..S DFN2=$O(^XTMP(MPIFMSG,0))
..Q:DFN2=""
..I $G(^XTMP(MPIFMSG,DFN2,"MPI",0))="A" D
...S ICN=$G(^XTMP(MPIFMSG,DFN2,"MPI",1))
...S ICN2=$P(ICN,"^",2),MSGN=$P(ICN,"^",3),ICN=$P(ICN,"^")
...S RETURN=1
...D START^RGHLLOG()
...D EXC^RGHLLOG(208,"Merge msg A40 for TO record ICN1= "_ICN_" FROM record ICN2= "_ICN2_". HL7 msg id= "_MSGN_" No ACK received back")
...D STOP^RGHLLOG()
..K ^XTMP(MPIFMSG)
.Q:MPIFMSG["A40"
.Q:'$D(^XTMP(MPIFMSG,"MPI",0))
.I $G(^XTMP(MPIFMSG,"MPI",0))="A" D
..S TAG=$E(MPIFMSG,5,7)
..D @TAG S RETURN=1
K MPIFMSG
M HL=MPIFHL
;
S MPIFMSG="RGA"
F S MPIFMSG=$O(^XTMP(MPIFMSG)) Q:$E(MPIFMSG,1,3)'="RGA" D
.Q:$P(^XTMP(MPIFMSG,0),"^",2)>BEFORE
.Q:'$D(^XTMP(MPIFMSG,"MPI",0))
.I $G(^XTMP(MPIFMSG,"MPI",0))="A" D
..S TAG=$E(MPIFMSG,3,5)
..I TAG="A01"!(TAG="A03")!(TAG="A04")!(TAG="A08") S TAG="A31"
..D @TAG S RETURN=1
K MPIFMSG
M HL=MPIFHL
Q
;
A28 ;
K ^XTMP(MPIFMSG)
N NUM
S NUM=$$A28^MPIFA28(+$P(MPIFMSG,"%",2))
Q
A31 ;
K ^XTMP(MPIFMSG)
N NUM
S NUM=$$A31^MPIFA31B(+$P(MPIFMSG,"%",2))
Q
A29 ;
K ^XTMP(MPIFMSG)
N ICN,MSGN
S ICN=$G(^XTMP(MPIFMSG,"MPI",1)),MSGN=$P(ICN,"^",2),ICN=$P(ICN,"^")
D START^RGHLLOG()
D EXC^RGHLLOG(208,"Inactivate msg A29 for DFN= "_$P(MPIFMSG,"%",2)_" with ICN= "_ICN_" original HL7 msg id= "_MSGN_" No ACK received back",$P(MPIFMSG,"%",2))
D STOP^RGHLLOG()
Q
A24 ;
K ^XTMP(MPIFMSG)
N NUM
S NUM=$$A24^MPIFA24B(+$P(MPIFMSG,"%",2))
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMPIFACHK 2152 printed Dec 13, 2024@02:10:53 Page 2
MPIFACHK ;CMC/BP-ACKNOWLEDGEMENT CHECK ;JULY 8, 2002
+1 ;;1.0; MASTER PATIENT INDEX VISTA ;**22**;30 Apr 99
+2 ;
+3 ; Integration Agreements Utilized:
+4 ; START, STOP, EXC^RGHLLOG - #2796
+5 ;
EN(RETURN,BEFORE) ; CHECKING FOR "A" FOR XTMP("MPIFA.. NODES that happened before FM date BEFORE
+1 ;RPC - RETURN will have 0 if no messages need to be resent OR 1 if there are some resent.
+2 ;
+3 NEW DFN2,TAG,MPIFHL,ICN,ICN2
KILL MPIFMSG
+4 ;need to save hl variables to avoid undefined errors when returning to RPC.
MERGE MPIFHL=HL
+5 SET MPIFMSG="MPIFA"
SET RETURN=0
+6 FOR
SET MPIFMSG=$ORDER(^XTMP(MPIFMSG))
if $EXTRACT(MPIFMSG,1,5)'="MPIFA"
QUIT
Begin DoDot:1
+7 if $PIECE(^XTMP(MPIFMSG,0),"^",2)>BEFORE
QUIT
+8 IF $EXTRACT(MPIFMSG,1,7)="MPIFA40"
Begin DoDot:2
+9 SET DFN2=$ORDER(^XTMP(MPIFMSG,0))
+10 if DFN2=""
QUIT
+11 IF $GET(^XTMP(MPIFMSG,DFN2,"MPI",0))="A"
Begin DoDot:3
+12 SET ICN=$GET(^XTMP(MPIFMSG,DFN2,"MPI",1))
+13 SET ICN2=$PIECE(ICN,"^",2)
SET MSGN=$PIECE(ICN,"^",3)
SET ICN=$PIECE(ICN,"^")
+14 SET RETURN=1
+15 DO START^RGHLLOG()
+16 DO EXC^RGHLLOG(208,"Merge msg A40 for TO record ICN1= "_ICN_" FROM record ICN2= "_ICN2_". HL7 msg id= "_MSGN_" No ACK received back")
+17 DO STOP^RGHLLOG()
End DoDot:3
+18 KILL ^XTMP(MPIFMSG)
End DoDot:2
+19 if MPIFMSG["A40"
QUIT
+20 if '$DATA(^XTMP(MPIFMSG,"MPI",0))
QUIT
+21 IF $GET(^XTMP(MPIFMSG,"MPI",0))="A"
Begin DoDot:2
+22 SET TAG=$EXTRACT(MPIFMSG,5,7)
+23 DO @TAG
SET RETURN=1
End DoDot:2
End DoDot:1
+24 KILL MPIFMSG
+25 MERGE HL=MPIFHL
+26 ;
+27 SET MPIFMSG="RGA"
+28 FOR
SET MPIFMSG=$ORDER(^XTMP(MPIFMSG))
if $EXTRACT(MPIFMSG,1,3)'="RGA"
QUIT
Begin DoDot:1
+29 if $PIECE(^XTMP(MPIFMSG,0),"^",2)>BEFORE
QUIT
+30 if '$DATA(^XTMP(MPIFMSG,"MPI",0))
QUIT
+31 IF $GET(^XTMP(MPIFMSG,"MPI",0))="A"
Begin DoDot:2
+32 SET TAG=$EXTRACT(MPIFMSG,3,5)
+33 IF TAG="A01"!(TAG="A03")!(TAG="A04")!(TAG="A08")
SET TAG="A31"
+34 DO @TAG
SET RETURN=1
End DoDot:2
End DoDot:1
+35 KILL MPIFMSG
+36 MERGE HL=MPIFHL
+37 QUIT
+38 ;
A28 ;
+1 KILL ^XTMP(MPIFMSG)
+2 NEW NUM
+3 SET NUM=$$A28^MPIFA28(+$PIECE(MPIFMSG,"%",2))
+4 QUIT
A31 ;
+1 KILL ^XTMP(MPIFMSG)
+2 NEW NUM
+3 SET NUM=$$A31^MPIFA31B(+$PIECE(MPIFMSG,"%",2))
+4 QUIT
A29 ;
+1 KILL ^XTMP(MPIFMSG)
+2 NEW ICN,MSGN
+3 SET ICN=$GET(^XTMP(MPIFMSG,"MPI",1))
SET MSGN=$PIECE(ICN,"^",2)
SET ICN=$PIECE(ICN,"^")
+4 DO START^RGHLLOG()
+5 DO EXC^RGHLLOG(208,"Inactivate msg A29 for DFN= "_$PIECE(MPIFMSG,"%",2)_" with ICN= "_ICN_" original HL7 msg id= "_MSGN_" No ACK received back",$PIECE(MPIFMSG,"%",2))
+6 DO STOP^RGHLLOG()
+7 QUIT
A24 ;
+1 KILL ^XTMP(MPIFMSG)
+2 NEW NUM
+3 SET NUM=$$A24^MPIFA24B(+$PIECE(MPIFMSG,"%",2))
+4 QUIT