source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/VAFCMSG.m@ 836

Last change on this file since 836 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.8 KB
RevLine 
[613]1VAFCMSG ;ALB/JRP-BACKGROUND JOB TO TRANSMIT ENTRIES IN PIVOT FILE ; 3/2/04 12:54pm
2 ;;5.3;Registration;**91,149,530,578**;Jun 06, 1996
3 ;
4MAIN ;Main entry point for background job
5 ;
6 ;attempt to lock non existant global.
7 L +^VAT(391.71,"VAFC BATCH UPDATE ADT/HL7"):1 I '$T Q
8 ;Send messages ? 0=STOP,2=SUSPEND
9 N SEND
10 S SEND=$P($$SEND^VAFHUTL(),"^",2)
11 I (SEND=0)!(SEND=2) L -^VAT(391.71,"VAFC BATCH UPDATE ADT/HL7") Q
12 ;Send Registration messages
13 D BCSTA04
14 ;Send changes to patient's demographical data (ADT-A08)
15 D BCSTA08
16 ;Send changes to patient's treating facility list (MFU-M05)
17 D BCKTFMFU^VAFCTFMF
18 ;unlock global
19 L -^VAT(391.71,"VAFC BATCH UPDATE ADT/HL7")
20 ;K DIC,X,Y
21 Q
22 ;
23BCSTA08 ;Broadcast ADT-A08 messages for all entries in ADT/HL PIVOT file
24 ;(#391.71) that have been marked for transmission
25 ;
26 ;Input : None
27 ;Output : None
28 ;
29 ;Declare variables
30 N PIVOTPTR,NODE,DFN,EDITDATE,TMP,INFOARR
31 S INFOARR="^TMP(""VAFCMSG"","_$J_",""EVNTINFO"")"
32 K @INFOARR
33 ;Loop through pivot file based on demographic updates
34 S PIVOTPTR=0
35 F S PIVOTPTR=+$O(^VAT(391.71,"AXMIT",4,PIVOTPTR)) Q:('PIVOTPTR) D
36 .;Bad entry in cross reference - delete it and quit
37 .I ('$D(^VAT(391.71,PIVOTPTR))) K ^VAT(391.71,"AXMIT",4,PIVOTPTR) Q
38 .;Get event date and pointer to patient
39 .S NODE=$G(^VAT(391.71,PIVOTPTR,0))
40 .S EDITDATE=+NODE
41 .S DFN=+$P(NODE,"^",3)
42 .;PATCH 530 check global for lock status - quit if locked.
43 .L +^DPT(DFN):1 I '$T Q
44 .;Bad pointer to patient - mark entry as transmitted and quit
45 .I ('$D(^DPT(DFN,0)))!($G(^DPT(DFN,-9))) D XMITFLAG^VAFCDD01(PIVOTPTR,"",1) Q
46 .I $P(^DPT(DFN,0),U)="" D XMITFLAG^VAFCDD01(PIVOTPTR,"",1) Q
47 .I '$D(^DPT("B",$P(^DPT(DFN,0),U),DFN)) D XMITFLAG^VAFCDD01(PIVOTPTR,"",1) Q
48 .;Store info into event information array
49 .K @INFOARR
50 .S @INFOARR@("PIVOT")=PIVOTPTR
51 .;Event reason code
52 .; 99 = Death 98 = Resurrection 97=Sensitivity Update
53 .; Death will overwrite any other reason code. It is the
54 .; dominant reason code.
55 .S @INFOARR@("REASON",1)=""
56 .S @INFOARR@("REASON",1)=$P($G(^VAT(391.71,PIVOTPTR,0)),"^",10)
57 .I (+$G(^DPT(DFN,.35))) S @INFOARR@("REASON",1)=99
58 .;
59 .; user/operator name from duz
60 .S DIC="^VA(200,",DIC(0)="MZO",X="`"_+$P(NODE,"^",9) D ^DIC
61 .S @INFOARR@("USER")=$P($G(Y),"^",2)
62 .;
63 .S @INFOARR@("EVENT-NUM")=$P(NODE,"^",2)
64 .S @INFOARR@("VAR-PTR")=$P(NODE,"^",5)
65 .;
66 .;Broadcast ADT-A08 message
67 .S TMP=$$BCSTADT^VAFCMSG0(DFN,"A08",EDITDATE,INFOARR)
68 .;Store result in pivot file
69 .S:$P(TMP,U,2)]"" TMP=$P(TMP,U,2) D FILERM^VAFCUTL(PIVOTPTR,TMP)
70 .;Error broadcasting message
71 .Q:(TMP<0)
72 .;Mark entry in pivot file as transmitted
73 .D XMITFLAG^VAFCDD01(PIVOTPTR,"",1)
74 .;PATCH 530 if locked by check unlock.
75 .L -^DPT(DFN)
76 ;Done - clean up and quit
77 K @INFOARR
78 Q
79 ;
80BCSTA04 ;Broadcast ADT-A04 messages for all entries in ADT/HL PIVOT file
81 ;(#391.71) that have been marked for transmission
82 ;
83 ;Input : None
84 ;Output : None
85 ;
86 ;Declare variables
87 N PIVOTPTR,NODE,DFN,EDITDATE,FIELDS,RESULT
88 S PIVOTPTR=0
89 F S PIVOTPTR=+$O(^VAT(391.71,"AXMIT",3,PIVOTPTR)) Q:('PIVOTPTR) D
90 .;Bad entry in cross reference - delete it and quit
91 .I ('$D(^VAT(391.71,PIVOTPTR))) K ^VAT(391.71,"AXMIT",3,PIVOTPTR) Q
92 .;Get event date and pointer to patient
93 .S NODE=$G(^VAT(391.71,PIVOTPTR,0))
94 .S FIELDS=$G(^VAT(391.71,PIVOTPTR,2))
95 .S USER=+$P(NODE,"^",9)
96 .S EDITDATE=+NODE
97 .S DFN=+$P(NODE,"^",3)
98 .;PATCH 530 check for locked record - quit if locked.
99 .L +^DPT(DFN):1 I '$T Q
100 .;Bad pointer to patient - mark entry as transmitted and quit
101 .I ('$D(^DPT(DFN,0)))!($G(^DPT(DFN,-9))) D XMITFLAG^VAFCDD01(PIVOTPTR,"",1) Q
102 .I $P(^DPT(DFN,0),U)="" D XMITFLAG^VAFCDD01(PIVOTPTR,"",1) Q
103 .I '$D(^DPT("B",$P(^DPT(DFN,0),U),DFN)) D XMITFLAG^VAFCDD01(PIVOTPTR,"",1) Q
104 .;Broadcast ADT-A04 message
105 .S RESULT=$$EN^VAFCA04(DFN,EDITDATE,USER,PIVOTPTR)
106 .D XMITFLAG^VAFCDD01(PIVOTPTR,"",1)
107 .L -^DPT(DFN)
108 ;Done - quit
109 Q
Note: See TracBrowser for help on using the repository browser.