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

VAFCMSG.m

Go to the documentation of this file.
  1. VAFCMSG ;ALB/JRP-BACKGROUND JOB TO TRANSMIT ENTRIES IN PIVOT FILE ;7 Dec 2018 3:39 PM
  1. ;;5.3;Registration;**91,149,530,578,974**;Jun 06, 1996;Build 2
  1. ;
  1. MAIN ;Main entry point for background job
  1. ;
  1. ;attempt to lock non existant global.
  1. L +^VAT(391.71,"VAFC BATCH UPDATE ADT/HL7"):1 I '$T Q
  1. ;Send messages ? 0=STOP,2=SUSPEND
  1. N SEND
  1. S SEND=$P($$SEND^VAFHUTL(),"^",2)
  1. I (SEND=0)!(SEND=2) L -^VAT(391.71,"VAFC BATCH UPDATE ADT/HL7") Q
  1. ;Send Registration messages
  1. D BCSTA04
  1. ;Send changes to patient's demographical data (ADT-A08)
  1. D BCSTA08
  1. ;Send changes to patient's treating facility list (MFU-M05)
  1. D BCKTFMFU^VAFCTFMF
  1. ;unlock global
  1. L -^VAT(391.71,"VAFC BATCH UPDATE ADT/HL7")
  1. ;K DIC,X,Y
  1. Q
  1. ;
  1. BCSTA08 ;Broadcast ADT-A08 messages for all entries in ADT/HL PIVOT file
  1. ;(#391.71) that have been marked for transmission
  1. ;
  1. ;Input : None
  1. ;Output : None
  1. ;
  1. ;Declare variables
  1. N PIVOTPTR,NODE,DFN,EDITDATE,TMP,INFOARR
  1. S INFOARR="^TMP(""VAFCMSG"","_$J_",""EVNTINFO"")"
  1. K @INFOARR
  1. ;Loop through pivot file based on demographic updates
  1. S PIVOTPTR=0
  1. F S PIVOTPTR=+$O(^VAT(391.71,"AXMIT",4,PIVOTPTR)) Q:('PIVOTPTR) D
  1. .;Bad entry in cross reference - delete it and quit
  1. .I ('$D(^VAT(391.71,PIVOTPTR))) K ^VAT(391.71,"AXMIT",4,PIVOTPTR) Q
  1. .;Get event date and pointer to patient
  1. .S NODE=$G(^VAT(391.71,PIVOTPTR,0))
  1. .S EDITDATE=+NODE
  1. .S DFN=+$P(NODE,"^",3)
  1. .;PATCH 530 check global for lock status - quit if locked.
  1. .L +^DPT(DFN):1 I '$T Q
  1. .;Bad pointer to patient - mark entry as transmitted and quit
  1. .I ('$D(^DPT(DFN,0)))!($G(^DPT(DFN,-9))) D XMITFLAG^VAFCDD01(PIVOTPTR,"",1) Q
  1. .I $P(^DPT(DFN,0),U)="" D XMITFLAG^VAFCDD01(PIVOTPTR,"",1) Q
  1. .;**974,Story 841921 (mko): If name components were edited, a bug
  1. .; in UPDNAME^XLFNAME could allow the .01 to be more than 30 characters.
  1. .I '$D(^DPT("B",$E($P(^DPT(DFN,0),U),1,30),DFN)) D XMITFLAG^VAFCDD01(PIVOTPTR,"",1) Q
  1. .;Store info into event information array
  1. .K @INFOARR
  1. .S @INFOARR@("PIVOT")=PIVOTPTR
  1. .;Event reason code
  1. .; 99 = Death 98 = Resurrection 97=Sensitivity Update
  1. .; Death will overwrite any other reason code. It is the
  1. .; dominant reason code.
  1. .S @INFOARR@("REASON",1)=""
  1. .S @INFOARR@("REASON",1)=$P($G(^VAT(391.71,PIVOTPTR,0)),"^",10)
  1. .I (+$G(^DPT(DFN,.35))) S @INFOARR@("REASON",1)=99
  1. .;
  1. .; user/operator name from duz
  1. .S DIC="^VA(200,",DIC(0)="MZO",X="`"_+$P(NODE,"^",9) D ^DIC
  1. .S @INFOARR@("USER")=$P($G(Y),"^",2)
  1. .;
  1. .S @INFOARR@("EVENT-NUM")=$P(NODE,"^",2)
  1. .S @INFOARR@("VAR-PTR")=$P(NODE,"^",5)
  1. .;
  1. .;Broadcast ADT-A08 message
  1. .S TMP=$$BCSTADT^VAFCMSG0(DFN,"A08",EDITDATE,INFOARR)
  1. .;Store result in pivot file
  1. .S:$P(TMP,U,2)]"" TMP=$P(TMP,U,2) D FILERM^VAFCUTL(PIVOTPTR,TMP)
  1. .;Error broadcasting message
  1. .Q:(TMP<0)
  1. .;Mark entry in pivot file as transmitted
  1. .D XMITFLAG^VAFCDD01(PIVOTPTR,"",1)
  1. .;PATCH 530 if locked by check unlock.
  1. .L -^DPT(DFN)
  1. ;Done - clean up and quit
  1. K @INFOARR
  1. Q
  1. ;
  1. BCSTA04 ;Broadcast ADT-A04 messages for all entries in ADT/HL PIVOT file
  1. ;(#391.71) that have been marked for transmission
  1. ;
  1. ;Input : None
  1. ;Output : None
  1. ;
  1. ;Declare variables
  1. N PIVOTPTR,NODE,DFN,EDITDATE,FIELDS,RESULT
  1. S PIVOTPTR=0
  1. F S PIVOTPTR=+$O(^VAT(391.71,"AXMIT",3,PIVOTPTR)) Q:('PIVOTPTR) D
  1. .;Bad entry in cross reference - delete it and quit
  1. .I ('$D(^VAT(391.71,PIVOTPTR))) K ^VAT(391.71,"AXMIT",3,PIVOTPTR) Q
  1. .;Get event date and pointer to patient
  1. .S NODE=$G(^VAT(391.71,PIVOTPTR,0))
  1. .S FIELDS=$G(^VAT(391.71,PIVOTPTR,2))
  1. .S USER=+$P(NODE,"^",9)
  1. .S EDITDATE=+NODE
  1. .S DFN=+$P(NODE,"^",3)
  1. .;PATCH 530 check for locked record - quit if locked.
  1. .L +^DPT(DFN):1 I '$T Q
  1. .;Bad pointer to patient - mark entry as transmitted and quit
  1. .I ('$D(^DPT(DFN,0)))!($G(^DPT(DFN,-9))) D XMITFLAG^VAFCDD01(PIVOTPTR,"",1) Q
  1. .I $P(^DPT(DFN,0),U)="" D XMITFLAG^VAFCDD01(PIVOTPTR,"",1) Q
  1. .;**974,Story 841921 (mko): If name components were edited, a bug
  1. .; in UPDNAME^XLFNAME could allow the .01 to be more than 30 characters.
  1. .I '$D(^DPT("B",$E($P(^DPT(DFN,0),U),1,30),DFN)) D XMITFLAG^VAFCDD01(PIVOTPTR,"",1) Q
  1. .;Broadcast ADT-A04 message
  1. .S RESULT=$$EN^VAFCA04(DFN,EDITDATE,USER,PIVOTPTR)
  1. .D XMITFLAG^VAFCDD01(PIVOTPTR,"",1)
  1. .L -^DPT(DFN)
  1. ;Done - quit
  1. Q