source: FOIAVistA/trunk/r/SCHEDULING-SD-SC/SCDXMSG2.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 6.2 KB
Line 
1SCDXMSG2 ;ALB/JRP - AMB CARE TRANSMISSION BULLETINS;01-JUL-1996 ; 1/17/02 5:07pm
2 ;;5.3;Scheduling;**44,121,128,66,132,247,393,466**;AUG 13, 1993;Build 2
3 ;
4CMPLBULL(SENT,ERRCNT,IPCNT,IPERR) ;Send completion bulletin
5 ;
6 ;Input : SENT - Number of encounters sent to NPCDB (Defaults to 0)
7 ; ERRCNT - Contains the number of errored encounters
8 ; IPCNT - Number of inpatient encounters
9 ; IPERR - Contains the number of inpatient errored encounters
10 ;Output : None
11 ;
12 ;Declare variables
13 N MSGTXT,XMB,XMTEXT,XMY,XMDUZ,XMDT,XMZ,XMITPTR,LINE
14 N ENCPTR,DELPTR,ENCDATE,ENCLOC,NAME,TMP,ENCZERO,SSN,PATZERO
15 ;Deliver bulletin
16 S XMB="SCDX AMBCARE TO NPCDB SUMMARY"
17 S XMB(1)=+$G(SENT)
18 S XMB(2)=+$G(ERRCNT)
19 S XMB(3)=+$G(SENT)-(+$G(IPCNT))
20 S XMB(4)=+$G(IPCNT)
21 S XMB(5)=+$G(ERRCNT)-(+$G(IPERR))
22 S XMB(6)=+$G(IPERR)
23 D ^XMB
24 Q
25 ;
26ERRBULL(REASON) ;Send error bulletin
27 ;
28 ;Input : REASON - Why transmission of data could not be completed
29 ;Output : None
30 ;
31 ;Check input
32 S REASON=$G(REASON)
33 ;Declare variables
34 N MSGTXT,XMB,XMTEXT,XMY,XMDUZ,XMDT,XMZ
35 ;Set message text
36 S MSGTXT(1)="Transmission of data to the National Patient Care Database"
37 S MSGTXT(2)=" "
38 S MSGTXT(3)="could not be completed for the following reason:"
39 S MSGTXT(4)=" "
40 S MSGTXT(5)=" "_REASON
41 ;Set bulletin subject
42 S XMB(1)="** TRANSMISSION OF DATA TO NPCDB NOT COMPLETED **"
43 ;Deliver bulletin
44 S XMB="SCDX AMBCARE TO NPCDB SUMMARY"
45 S XMTEXT="MSGTXT("
46 D ^XMB
47 ;Done
48 Q
49 ;
50LATEACT(XMITPTR,ACT,USER,DATE) ;Send late activity bulletin
51 ;
52 ;Input : XMITPTR - Pointer to TRANSMITTED OUTPATIENT ENCOUNTER file
53 ; (#409.73) that was acted upon
54 ; ACT - Late activity that occurred
55 ; Free text (defaults to transmission event of XMITPTR)
56 ; USER - Who did the activity
57 ; Pointer to NEW PERSON file (#200)
58 ; (defaults to causer of event of XMITPTR)
59 ; DATE - Date/time activity took place
60 ; FileMan format (defaults to event date of XMITPTR)
61 ;Output : None
62 ;Notes : Late activity bulletin will be sent to members of the mail
63 ; group contained in the LATE ACTIVITY MAIL GROUP field (#217)
64 ; of the MAS PARAMETER file (#43). The bulletin will not be
65 ; sent if this mail group has not been defined.
66 ; : POSTMASTER (DUZ=.5) will be converted to 'ACRP NIGHTLY
67 ; TRANSMISSION BUILDER' as the causer of the event
68 ; : Bulletin will default to a transmission event if no ACT
69 ; is specified
70 ;
71 ;Check input
72 S XMITPTR=+$G(XMITPTR)
73 Q:('$D(^SD(409.73,XMITPTR,0)))
74 S ACT=$G(ACT)
75 S USER=+$G(USER)
76 S DATE=+$G(DATE)
77 ;Declare variables
78 N NODE,ENCPTR,DELPTR,ENCDATE,XMDUZ,XMTEXT,XMSUB,XMY,MSGL,SMTB,SMTN
79 N CLOSED,DFN,CLINIC,DIV,VA,LASTXMIT,LASTACK,LASTCODE,HISTARR
80 ;Send bulletin to site specified mail group
81 ; Don't send if mail group not defined or is invalid
82 S NODE=$G(^DG(43,1,"SCLR"))
83 Q:('$P(NODE,"^",17))
84 D XMY^SDUTL2($P(NODE,"^",17),0,0)
85 Q:('$D(XMY))
86 ;Get zero node of transmission file
87 S NODE=$G(^SD(409.73,XMITPTR,0))
88 ;Set default values (if applicable)
89 I (ACT="") D Q:(ACT="")
90 .S ACT=+$P(NODE,"^",5)
91 .I (ACT=1)!(ACT=2) S ACT="Creation/Editing of encounter" Q
92 .I (ACT=3) S ACT="Deletion of encounter" Q
93 .S ACT="Retransmission of encounter"
94 I ('USER) D
95 .S USER=+$P(NODE,"^",7)
96 .S:('USER) USER=+$G(DUZ)
97 S:(USER=.5) USER="ACRP NIGHTLY TRANSMISSION BUILDER"
98 I ('DATE) S DATE=+$P(NODE,"^",6) S:('DATE) DATE=$$DT^XLFDT()
99 ;Get pointer to encounter and deleted encounter
100 S ENCPTR=+$P(NODE,"^",2)
101 S DELPTR=+$P(NODE,"^",3)
102 ;Get zero node of [deleted] encounter
103 S NODE=""
104 S:(ENCPTR) NODE=$G(^SCE(ENCPTR,0))
105 S:('ENCPTR) NODE=$G(^SD(409.74,DELPTR,1))
106 ;Get date/time of encounter
107 S ENCDATE=+NODE
108 ;Get DFN
109 S DFN=+$P(NODE,"^",2)
110 ;Get clinic pointer
111 S CLINIC=+$P(NODE,"^",4)
112 ;Get division
113 S DIV=+$P(NODE,"^",11)
114 ;Get transmission history
115 S (LASTXMIT,LASTACK,LASTCODE)=""
116 S HISTARR=$NA(^TMP("SCDXMSG2",$J,"HIST"))
117 K @HISTARR
118 I ($$HST4XMIT^SCDXFU13(XMITPTR,HISTARR,1)) D
119 .;Get last xmit date
120 .S LASTXMIT=+$O(@HISTARR@(""),-1)
121 .Q:('LASTXMIT)
122 .;Get ack info for last xmit
123 .S LASTACK=$G(@HISTARR@(LASTXMIT))
124 .S LASTCODE=$P(LASTACK,"^",3)
125 .S LASTACK=$P(LASTACK,"^",2)
126 K @HISTARR
127 ;Determine the level of acceptance for data base credit and/or
128 ;workload credit
129 S MSGL=$$XMIT4DBC^SCDXFU04(XMITPTR)
130 Q:MSGL<1!(MSGL>4) ; Only four levels of messages are defined
131 ; 0 - no message, transmit
132 ; 5 - no transmit; error
133 ;Build message
134 S SMTB="The following activity occurred "
135 S XMTEXT(1)=SMTB_"after the National Patient Care"
136 S XMTEXT(2)="Database was closed"
137 I MSGL=4 S XMTEXT(2)=XMTEXT(2)_"."
138 I MSGL=3 D
139 .S XMTEXT(2)=XMTEXT(2)_" for yearly workload credit but will be sent"
140 .S XMTEXT(3)="to the NPCD for historical accuracy of the database."
141 I MSGL=2 D
142 .S XMTEXT(2)=XMTEXT(2)_" for monthly workload credit but will be sent"
143 .S XMTEXT(3)="to the NPCD to be included in the fiscal year totals."
144 I MSGL=1 D
145 .; the rolling 20-day message is based on setup of ROLLD=19 in
146 .; CLOSEOUT^SCDXFU04
147 .S XMTEXT(1)=SMTB_"20 or more days after the encounter"
148 .S XMTEXT(2)="date but is valid for workload credit and will be sent"
149 .S XMTEXT(3)="to the National Patient Care Database."
150 S SMTN=$S(MSGL=4:3,1:4) S XMTEXT(SMTN)=" "
151 S XMTEXT(SMTN+1)=" Activity: "_ACT
152 S XMTEXT(SMTN+2)="Entered By: "_$S(USER:$P($G(^VA(200,USER,0)),"^",1),1:USER)
153 S XMTEXT(SMTN+3)="Entered On: "_$$FMTE^XLFDT(DATE)
154 S XMTEXT(SMTN+4)=" "
155 S XMTEXT(SMTN+5)=" Encounter Date: "_$$FMTE^XLFDT(ENCDATE)_" (#"_$S(ENCPTR:ENCPTR,1:DELPTR)_")"
156 S:('ENCPTR) XMTEXT(SMTN+5)=XMTEXT(SMTN+5)_" ** Deleted Encounter **"
157 S XMTEXT(SMTN+6)="Last NPCD Transmission: "_$S(LASTXMIT:$$FMTE^XLFDT(LASTXMIT),1:"Encounter data never transmitted ")_" (#"_XMITPTR_")"
158 S XMTEXT(SMTN+7)="Last NPCD Ack Received: "_$S(LASTACK:$$FMTE^XLFDT(+LASTACK),1:"Acknowledgement not received")
159 S:(LASTACK) XMTEXT(SMTN+7)=XMTEXT(SMTN+7)_" ("_$S((LASTCODE'=""):$$EXTERNAL^DILFD(409.73,15,"",LASTCODE),1:"Status unknown")_")"
160 S XMTEXT(SMTN+8)=" "
161 S XMTEXT(SMTN+9)=" Clinic: "_$P($G(^SC(CLINIC,0)),"^",1)
162 D PID^VADPT6
163 S XMTEXT(SMTN+10)="Patient: "_$P($G(^DPT(DFN,0)),"^",1)_" ("_VA("BID")_")"
164 ;Send message
165 S XMSUB="Late ACRP Related Activity"_$$DIV^SDAMEVT1(DIV)
166 S XMTEXT="XMTEXT("
167 S XMDUZ=.5
168 S:(USER) XMY(USER)=""
169 D ^XMD ; REMOVE COMMENT
170 ;Done
171 Q
Note: See TracBrowser for help on using the repository browser.