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

DGROMAIL.m

Go to the documentation of this file.
  1. DGROMAIL ;DJH/AMA - ROM HL7 MAIL MESSAGE PROCESSING ; 28 Apr 2004 4:16 PM
  1. ;;5.3;Registration;**533,572**;Aug 13, 1993
  1. ;
  1. Q
  1. ;
  1. MPIMAIL(DGQRY) ;LOG MPI EXCEPTION FROM LAST SITE TREATED
  1. ;The ICN sent from the MPI does not match the patient at the Last Site
  1. ;Treated, even though the site was on the Treatment Facility List
  1. ;received from the MPI. Send the MPI an exception to this effect.
  1. ;CALLED FROM RCVQRY^DGROHLR
  1. ;
  1. ; Input:
  1. ; DGQRY - Patient lookup components array
  1. N FACNAM,LINE,TEXT,DGXMTXT,MPIFL,SITE,HLMID,LST,QS
  1. S HLMID=$G(HL("MID"))
  1. S LST=+$G(HL("RFN"))
  1. S QS=+$G(HL("SAF"))
  1. ;
  1. S FACNAM="",LINE="",MPIFL=1,HL("MID")=""
  1. I '$G(DGQRY("RCVFAC")) D
  1. . S SITE=$$SITE^VASITE
  1. . S DGQRY("RCVFAC")=$P(SITE,U,3)
  1. . S QS=DGQRY("RCVAC")
  1. ;
  1. S RGEXC=219
  1. S TEXT="Unable to find ICN # "_DGQRY("ICN")_" at "_LST_" for a Register Once call from Station # "_QS
  1. D EXC^RGHLLOG(RGEXC,TEXT)
  1. S HL("MID")=HLMID
  1. Q
  1. ;
  1. DODMAIL(DGDATA,DFN,LSTDFN) ;SEND MAIL MESSAGE TO DATE OF DEATH MAIL GROUP
  1. ;Date of Death data has been received from the Last Site Treated,
  1. ;so notify the appropriate people that this person is listed as
  1. ;deceased at the LST.
  1. ; CALLED FROM DOD^DGRODEBR
  1. ;
  1. ; Input:
  1. ; DGDATA - Data element array from LST, ^TMP("DGROFDA",$J)
  1. ; DFN - Pointer to the PATIENT (#2) file
  1. ; LSTDFN - Pointer to the patient data from the LST, in DGDATA
  1. N U,LINE,LNCNT,TEXT,DGXMTXT,MPIFL
  1. ;
  1. S U="^",LINE="",LNCNT=7,MPIFL=0
  1. S LINE(1)="* * * * DG REGISTER ONCE NOTIFICATION * * * *"
  1. S LINE(2)="Death Information has been received for the following patient:"
  1. S LINE(3)="Patient Name: "_$$GET1^DIQ(2,DFN,.01)
  1. S LINE(4)="Social Security Number: "_$$GET1^DIQ(2,DFN,.09)
  1. S LINE(5)="Date Of Birth: "_$$FMTE^XLFDT($$GET1^DIQ(2,DFN,.03,"I"))
  1. S LINE(6)="Integrated Control #: "_$$GET1^DIQ(2,DFN,991.01)
  1. ;
  1. S LINE(LNCNT)="Death data received:"
  1. I $D(@DGDATA@(2,LSTDFN_",",.351)) D
  1. . S LNCNT=LNCNT+1
  1. . ;* Format External date received per XLFDT for output consistency
  1. . K X,%DT,Y ;* DG*5.3*572
  1. . S X=@DGDATA@(2,LSTDFN_",",.351,"E")
  1. . S %DT="TSN"
  1. . D ^%DT
  1. . S LINE(LNCNT)=" Date of Death: "_$$FMTE^XLFDT(Y)
  1. ;
  1. I $D(@DGDATA@(2,LSTDFN_",",.353)) D
  1. . N DGSET,DGSRCE
  1. . ;* External DOD Source returned from LST
  1. . S DGSRCE=@DGDATA@(2,LSTDFN_",",.353,"E") ;* DG*5.3*572
  1. . S LNCNT=LNCNT+1
  1. . S LINE(LNCNT)=" Source Of Notification of D.o.D.: "_DGSRCE
  1. ;
  1. I $D(@DGDATA@(2,LSTDFN_",",.352)) D
  1. . S LNCNT=LNCNT+1
  1. . S LINE(LNCNT)=" D.o.D. Entered By: "_@DGDATA@(2,LSTDFN_",",.352,"E")
  1. ;
  1. I $D(@DGDATA@(2,LSTDFN_",",.354)) D
  1. . S LNCNT=LNCNT+1
  1. . ;* Format External date received per XLFDT for output consistency
  1. . K X,%DT,Y ;* DG*5.3*572
  1. . S X=@DGDATA@(2,LSTDFN_",",.354,"E")
  1. . S %DT="TSN"
  1. . D ^%DT
  1. . S LINE(LNCNT)=" D.o.D. Last Updated: "_$$FMTE^XLFDT(Y)
  1. ;
  1. ;DG*5.3*572 -- added field .355
  1. I $D(@DGDATA@(2,LSTDFN_",",.355)) D
  1. . S LNCNT=LNCNT+1
  1. . S LINE(LNCNT)=" D.o.D. Last Edited By: "_@DGDATA@(2,LSTDFN_",",.355,"E")
  1. ;
  1. S DGXMTXT=$NA(TEXT)
  1. D BLDMSG(.LINE,DGXMTXT)
  1. D SNDMSG(DGXMTXT,"DG REGISTER ONCE",MPIFL)
  1. K X,%DT,Y ;* DG*5.3*572
  1. Q
  1. ;
  1. SPMAIL(DFN) ;SEND MAIL MESSAGE REGARDING A SENSITIVE PATIENT
  1. ;Sensitive Patient data has been received from the Last Site Treated,
  1. ;so notify the appropriate people that this person is listed as
  1. ;Sensitive at the LST.
  1. ; CALLED FROM SP^DGRODEBR
  1. ;
  1. ; Input:
  1. ; DGDATA - Data element array from LST, ^TMP("DGROFDA",$J)
  1. ; DFN - Pointer to the PATIENT (#2) file
  1. N U,LINE,TEXT,DGXMTXT,MPIFL
  1. ;
  1. S U="^",LINE="",MPIFL=0
  1. S LINE(1)="* * * * DG REGISTER ONCE NOTIFICATION * * * *"
  1. S LINE(2)="Sensitive Patient Information has been received for the following patient:"
  1. S LINE(3)="Patient Name: "_$$GET1^DIQ(2,DFN,.01)
  1. S LINE(4)="Social Security Number: "_$$GET1^DIQ(2,DFN,.09)
  1. S LINE(5)="Date Of Birth: "_$$FMTE^XLFDT($$GET1^DIQ(2,DFN,.03,"I"))
  1. S LINE(6)="Integrated Control #: "_$$GET1^DIQ(2,DFN,991.01)
  1. ;
  1. S DGXMTXT=$NA(TEXT)
  1. D BLDMSG(.LINE,DGXMTXT)
  1. D SNDMSG(DGXMTXT,"DG REGISTER ONCE",MPIFL)
  1. Q
  1. ;
  1. BLDMSG(LINE,DGXMTXT) ;build MailMan message array
  1. ;
  1. ; Input:
  1. ; LINE - message array
  1. ;
  1. ; Output:
  1. ; DGXMTXT - array of MailMan text lines
  1. ;
  1. N DGLIN ;line counter
  1. N DGMAX ;maximum line length
  1. N DGCNT ;counter
  1. ;
  1. S DGLIN=0
  1. S DGMAX=65
  1. ;
  1. S DGCNT=0 F S DGCNT=$O(LINE(DGCNT)) Q:'DGCNT D
  1. . D ADDLINE("",0,DGMAX,.DGLIN,DGXMTXT)
  1. . D ADDLINE(LINE(DGCNT),0,DGMAX,.DGLIN,DGXMTXT)
  1. ;
  1. D ADDLINE("",0,DGMAX,.DGLIN,DGXMTXT)
  1. Q
  1. ;
  1. ADDLINE(DGTEXT,DGINDENT,DGMAXLEN,DGCNT,DGXMTXT) ;add text line to message array
  1. ;
  1. ; Input:
  1. ; DGTEXT - text string
  1. ; DGINDENT - number of spaces to insert at start of line
  1. ; DGMAXLEN - maximum desired line length (default: 60)
  1. ; DGCNT - line number passed by reference
  1. ;
  1. ; Output:
  1. ; DGXMTXT - array of text strings
  1. ;
  1. N DGAVAIL ;available space for text
  1. N DGLINE ;truncated text
  1. N DGLOC ;location of space character
  1. N DGPAD ;space indent
  1. ;
  1. S DGTEXT=$G(DGTEXT)
  1. S DGINDENT=+$G(DGINDENT)
  1. S DGMAXLEN=+$G(DGMAXLEN)
  1. S:'DGMAXLEN DGMAXLEN=60
  1. I DGINDENT>(DGMAXLEN-1) S DGINDENT=0
  1. S DGCNT=$G(DGCNT,0) ;default to 0
  1. ;
  1. S DGPAD=$$REPEAT^XLFSTR(" ",DGINDENT)
  1. ;
  1. ;determine available space for text
  1. S DGAVAIL=(DGMAXLEN-DGINDENT)
  1. F D Q:('$L(DGTEXT))
  1. . ;
  1. . ;find potential line break
  1. . S DGLOC=$L($E(DGTEXT,1,DGAVAIL)," ")
  1. . ;
  1. . ;break a line that is too long when it has potential line breaks
  1. . I $L(DGTEXT)>DGAVAIL,DGLOC D
  1. . . S DGLINE=$P(DGTEXT," ",1,$S(DGLOC>1:DGLOC-1,1:1))
  1. . . S DGTEXT=$P(DGTEXT," ",$S(DGLOC>1:DGLOC,1:DGLOC+1),$L(DGTEXT," "))
  1. . E D
  1. . . S DGLINE=DGTEXT,DGTEXT=""
  1. . ;
  1. . S DGCNT=DGCNT+1
  1. . S @DGXMTXT@(DGCNT)=DGPAD_DGLINE
  1. Q
  1. ;
  1. SNDMSG(DGXMTXT,MAILGRP,MPIFL) ;send the MailMan message
  1. ;
  1. ; Input:
  1. ; DGXMTXT - name of message text array in closed format
  1. ;
  1. ; Output:
  1. ; none
  1. ;
  1. N DIFROM ;protect FM package
  1. N XMDUZ ;sender
  1. N XMSUB ;message subject
  1. N XMTEXT ;name of message text array in open format
  1. N XMY ;recipient array
  1. N XMZ ;returned message number
  1. ;
  1. S XMDUZ="DG Register Once Module"
  1. S XMSUB="DG REGISTER ONCE MESSAGE"
  1. S XMTEXT=$$OREF^DILF(DGXMTXT)
  1. S XMY("G."_MAILGRP)=""
  1. I '$G(MPIFL) S XMY(DUZ)=""
  1. D ^XMD
  1. Q