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

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

initial load of WorldVistAEHR

File size: 6.0 KB
Line 
1DGROMAIL ;DJH/AMA - ROM HL7 MAIL MESSAGE PROCESSING ; 28 Apr 2004 4:16 PM
2 ;;5.3;Registration;**533,572**;Aug 13, 1993
3 ;
4 Q
5 ;
6MPIMAIL(DGQRY) ;LOG MPI EXCEPTION FROM LAST SITE TREATED
7 ;The ICN sent from the MPI does not match the patient at the Last Site
8 ;Treated, even though the site was on the Treatment Facility List
9 ;received from the MPI. Send the MPI an exception to this effect.
10 ;CALLED FROM RCVQRY^DGROHLR
11 ;
12 ; Input:
13 ; DGQRY - Patient lookup components array
14 N FACNAM,LINE,TEXT,DGXMTXT,MPIFL,SITE,HLMID,LST,QS
15 S HLMID=$G(HL("MID"))
16 S LST=+$G(HL("RFN"))
17 S QS=+$G(HL("SAF"))
18 ;
19 S FACNAM="",LINE="",MPIFL=1,HL("MID")=""
20 I '$G(DGQRY("RCVFAC")) D
21 . S SITE=$$SITE^VASITE
22 . S DGQRY("RCVFAC")=$P(SITE,U,3)
23 . S QS=DGQRY("RCVAC")
24 ;
25 S RGEXC=219
26 S TEXT="Unable to find ICN # "_DGQRY("ICN")_" at "_LST_" for a Register Once call from Station # "_QS
27 D EXC^RGHLLOG(RGEXC,TEXT)
28 S HL("MID")=HLMID
29 Q
30 ;
31DODMAIL(DGDATA,DFN,LSTDFN) ;SEND MAIL MESSAGE TO DATE OF DEATH MAIL GROUP
32 ;Date of Death data has been received from the Last Site Treated,
33 ;so notify the appropriate people that this person is listed as
34 ;deceased at the LST.
35 ; CALLED FROM DOD^DGRODEBR
36 ;
37 ; Input:
38 ; DGDATA - Data element array from LST, ^TMP("DGROFDA",$J)
39 ; DFN - Pointer to the PATIENT (#2) file
40 ; LSTDFN - Pointer to the patient data from the LST, in DGDATA
41 N U,LINE,LNCNT,TEXT,DGXMTXT,MPIFL
42 ;
43 S U="^",LINE="",LNCNT=7,MPIFL=0
44 S LINE(1)="* * * * DG REGISTER ONCE NOTIFICATION * * * *"
45 S LINE(2)="Death Information has been received for the following patient:"
46 S LINE(3)="Patient Name: "_$$GET1^DIQ(2,DFN,.01)
47 S LINE(4)="Social Security Number: "_$$GET1^DIQ(2,DFN,.09)
48 S LINE(5)="Date Of Birth: "_$$FMTE^XLFDT($$GET1^DIQ(2,DFN,.03,"I"))
49 S LINE(6)="Integrated Control #: "_$$GET1^DIQ(2,DFN,991.01)
50 ;
51 S LINE(LNCNT)="Death data received:"
52 I $D(@DGDATA@(2,LSTDFN_",",.351)) D
53 . S LNCNT=LNCNT+1
54 . ;* Format External date received per XLFDT for output consistency
55 . K X,%DT,Y ;* DG*5.3*572
56 . S X=@DGDATA@(2,LSTDFN_",",.351,"E")
57 . S %DT="TSN"
58 . D ^%DT
59 . S LINE(LNCNT)=" Date of Death: "_$$FMTE^XLFDT(Y)
60 ;
61 I $D(@DGDATA@(2,LSTDFN_",",.353)) D
62 . N DGSET,DGSRCE
63 . ;* External DOD Source returned from LST
64 . S DGSRCE=@DGDATA@(2,LSTDFN_",",.353,"E") ;* DG*5.3*572
65 . S LNCNT=LNCNT+1
66 . S LINE(LNCNT)=" Source Of Notification of D.o.D.: "_DGSRCE
67 ;
68 I $D(@DGDATA@(2,LSTDFN_",",.352)) D
69 . S LNCNT=LNCNT+1
70 . S LINE(LNCNT)=" D.o.D. Entered By: "_@DGDATA@(2,LSTDFN_",",.352,"E")
71 ;
72 I $D(@DGDATA@(2,LSTDFN_",",.354)) D
73 . S LNCNT=LNCNT+1
74 . ;* Format External date received per XLFDT for output consistency
75 . K X,%DT,Y ;* DG*5.3*572
76 . S X=@DGDATA@(2,LSTDFN_",",.354,"E")
77 . S %DT="TSN"
78 . D ^%DT
79 . S LINE(LNCNT)=" D.o.D. Last Updated: "_$$FMTE^XLFDT(Y)
80 ;
81 ;DG*5.3*572 -- added field .355
82 I $D(@DGDATA@(2,LSTDFN_",",.355)) D
83 . S LNCNT=LNCNT+1
84 . S LINE(LNCNT)=" D.o.D. Last Edited By: "_@DGDATA@(2,LSTDFN_",",.355,"E")
85 ;
86 S DGXMTXT=$NA(TEXT)
87 D BLDMSG(.LINE,DGXMTXT)
88 D SNDMSG(DGXMTXT,"DG REGISTER ONCE",MPIFL)
89 K X,%DT,Y ;* DG*5.3*572
90 Q
91 ;
92SPMAIL(DFN) ;SEND MAIL MESSAGE REGARDING A SENSITIVE PATIENT
93 ;Sensitive Patient data has been received from the Last Site Treated,
94 ;so notify the appropriate people that this person is listed as
95 ;Sensitive at the LST.
96 ; CALLED FROM SP^DGRODEBR
97 ;
98 ; Input:
99 ; DGDATA - Data element array from LST, ^TMP("DGROFDA",$J)
100 ; DFN - Pointer to the PATIENT (#2) file
101 N U,LINE,TEXT,DGXMTXT,MPIFL
102 ;
103 S U="^",LINE="",MPIFL=0
104 S LINE(1)="* * * * DG REGISTER ONCE NOTIFICATION * * * *"
105 S LINE(2)="Sensitive Patient Information has been received for the following patient:"
106 S LINE(3)="Patient Name: "_$$GET1^DIQ(2,DFN,.01)
107 S LINE(4)="Social Security Number: "_$$GET1^DIQ(2,DFN,.09)
108 S LINE(5)="Date Of Birth: "_$$FMTE^XLFDT($$GET1^DIQ(2,DFN,.03,"I"))
109 S LINE(6)="Integrated Control #: "_$$GET1^DIQ(2,DFN,991.01)
110 ;
111 S DGXMTXT=$NA(TEXT)
112 D BLDMSG(.LINE,DGXMTXT)
113 D SNDMSG(DGXMTXT,"DG REGISTER ONCE",MPIFL)
114 Q
115 ;
116BLDMSG(LINE,DGXMTXT) ;build MailMan message array
117 ;
118 ; Input:
119 ; LINE - message array
120 ;
121 ; Output:
122 ; DGXMTXT - array of MailMan text lines
123 ;
124 N DGLIN ;line counter
125 N DGMAX ;maximum line length
126 N DGCNT ;counter
127 ;
128 S DGLIN=0
129 S DGMAX=65
130 ;
131 S DGCNT=0 F S DGCNT=$O(LINE(DGCNT)) Q:'DGCNT D
132 . D ADDLINE("",0,DGMAX,.DGLIN,DGXMTXT)
133 . D ADDLINE(LINE(DGCNT),0,DGMAX,.DGLIN,DGXMTXT)
134 ;
135 D ADDLINE("",0,DGMAX,.DGLIN,DGXMTXT)
136 Q
137 ;
138ADDLINE(DGTEXT,DGINDENT,DGMAXLEN,DGCNT,DGXMTXT) ;add text line to message array
139 ;
140 ; Input:
141 ; DGTEXT - text string
142 ; DGINDENT - number of spaces to insert at start of line
143 ; DGMAXLEN - maximum desired line length (default: 60)
144 ; DGCNT - line number passed by reference
145 ;
146 ; Output:
147 ; DGXMTXT - array of text strings
148 ;
149 N DGAVAIL ;available space for text
150 N DGLINE ;truncated text
151 N DGLOC ;location of space character
152 N DGPAD ;space indent
153 ;
154 S DGTEXT=$G(DGTEXT)
155 S DGINDENT=+$G(DGINDENT)
156 S DGMAXLEN=+$G(DGMAXLEN)
157 S:'DGMAXLEN DGMAXLEN=60
158 I DGINDENT>(DGMAXLEN-1) S DGINDENT=0
159 S DGCNT=$G(DGCNT,0) ;default to 0
160 ;
161 S DGPAD=$$REPEAT^XLFSTR(" ",DGINDENT)
162 ;
163 ;determine available space for text
164 S DGAVAIL=(DGMAXLEN-DGINDENT)
165 F D Q:('$L(DGTEXT))
166 . ;
167 . ;find potential line break
168 . S DGLOC=$L($E(DGTEXT,1,DGAVAIL)," ")
169 . ;
170 . ;break a line that is too long when it has potential line breaks
171 . I $L(DGTEXT)>DGAVAIL,DGLOC D
172 . . S DGLINE=$P(DGTEXT," ",1,$S(DGLOC>1:DGLOC-1,1:1))
173 . . S DGTEXT=$P(DGTEXT," ",$S(DGLOC>1:DGLOC,1:DGLOC+1),$L(DGTEXT," "))
174 . E D
175 . . S DGLINE=DGTEXT,DGTEXT=""
176 . ;
177 . S DGCNT=DGCNT+1
178 . S @DGXMTXT@(DGCNT)=DGPAD_DGLINE
179 Q
180 ;
181SNDMSG(DGXMTXT,MAILGRP,MPIFL) ;send the MailMan message
182 ;
183 ; Input:
184 ; DGXMTXT - name of message text array in closed format
185 ;
186 ; Output:
187 ; none
188 ;
189 N DIFROM ;protect FM package
190 N XMDUZ ;sender
191 N XMSUB ;message subject
192 N XMTEXT ;name of message text array in open format
193 N XMY ;recipient array
194 N XMZ ;returned message number
195 ;
196 S XMDUZ="DG Register Once Module"
197 S XMSUB="DG REGISTER ONCE MESSAGE"
198 S XMTEXT=$$OREF^DILF(DGXMTXT)
199 S XMY("G."_MAILGRP)=""
200 I '$G(MPIFL) S XMY(DUZ)=""
201 D ^XMD
202 Q
Note: See TracBrowser for help on using the repository browser.