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

AGMPHLBU.m

Go to the documentation of this file.
AGMPHLBU ; IHS/SD/TPF - HLO MPI A08 BACKGROUND UPDATE TASK ;    
 ;;7.2;IHS PATIENT REGISTRATION;**1,6**;JAN 07, 2011;Build 23
 ;
 ;RTN RUNS IN BACKGROUND AND TRAVERSES THE ADT/HL PIVOT FILE
 ;ANY RECORDS WITH FIELD 'REQUIRES TRANSMISSION' SET TO 'YES' 
A08UPDT ;EP - SEND A08 MESSAGES TO MPI
 D UPDATE^AGMPCHK ;Added 9/8 by SWH, this routine will update the AGMPCHK list. It was added here to avoid adding a new TASK in taskman
 L +^AGMPHLBU:5 Q:'$T  ;DO NOT START IF ALREADY RUNNING
 N PIVOT,TYPE,DFN,HLMSG,TEMPDUZ2
 S TEMPDUZ2=DUZ(2)
 S TYPE=4  ;THIS IS NOT AN HL7 EVENT
 ;FOR LOOP TO DO OTHER TYPES IN FUTURE?
 ;4 = ONLY DO REGISTRATION UPDATES
 S PIVOT=""
 F  S PIVOT=$O(^VAT(391.71,"AXMIT",4,PIVOT)) Q:'PIVOT  D
 .S DFN=$P($G(^VAT(391.71,PIVOT,0)),U,3)  ;PATIENT
 .I $$DEMOPAT^AGMPHLU(DFN) Q  ; 9/13/2017 - GCD - CR 7713 - Don't upload demo patients.
 .S DUZ(2)=$P($G(^VAT(391.71,PIVOT,9999999)),U)
 .I DUZ(2)=""!(DUZ(2)=0) D  Q   ;QUIT AND TRY AGAIN
 ..;D NOTIF^AGMPIHLO(DFN,"PIVOT="_PIVOT_" DUZ2="_$P($G(^VAT(391.71,PIVOT,9999999)),U))
 ..;THIS IS SOME TYPE OF TIMING ISSUE. MARK WILLIAMS IS INVESTIGATING
 ..;VAFCDD01 DOES NOT POPULATE DUZ2 IN ADT/HL7 PIVOT FILE
 .S HLMSG=$S(TYPE=4:"A08("_DFN_")",1:"OTHER")  ;DO MSG BASED ON TYPE OF EVENT
 .D @HLMSG
 S DUZ(2)=TEMPDUZ2  ;RESTORE TASK TO ORIGINAL DUZ(2)
 L -^AGMPHLBU  ;CLEAR RUNNING FLAG
 Q
 ;
A08(DFN) ;EP - CREATE A08 MESSAGE
 I $$DEMOPAT^AGMPHLU($G(DFN)) Q  ; 9/13/2017 - GCD - CR 7713 - Don't upload demo patients.
 N SUCCESS
 D CREATMSG^AGMPIHLO(DFN,"A08",,.SUCCESS)  ;THIS COULD BE ADDED TO THE AG UPDATE PATIENT PROTOCOL AS THE ENTRY ACTION
 I 'SUCCESS D NOTIF^AGMPIHLO(DFN,"Unable to create A08 to update patient on MPI from AGMPHHBU") Q
 I SUCCESS[("NOT DEFINED IN PID^AGMPIHL1") Q  ;TIMING ISSUE TRY AGAIN
 I SUCCESS D SETXMIT(PIVOT)
 ;KICK OFF PROTOCOL
 S X="AG UPDATE A PATIENT",DIC=101,INDA=DFN
 D EN^XQOR
 Q
 ;
OTHER ;EP - STUB FOR OTHER TYPES - FUTURE USE
 Q
 ;
SETXMIT(PIVOT) ;EP - RESET TRANSMIT FLAG
 K DIE,DIR,DIC,DA,DR
 S DIE="^VAT(391.71,"
 S DA=PIVOT
 S DR=".06///1;.08///0"  ;SET AS TRANSMITED AND NO TRANSMISSION REQUIRED
 D ^DIE
 Q