SCMCHLM ;BP/DJB - PCMM HL7 Mail Msgs ; 6/28/99 10:16am
;;5.3;Scheduling;**177,210,505,1015**;AUG 13, 1993;Build 21
;
;Reference routine: SCDXMSG2
CMPLBULL(SENT,ERRCNT,VALER) ;Send completion bulletin
;
;Input : SENT - Number of messages sent to NPCD. Default=0.
; ERRCNT - Number of errored messages.
; VALER - Array containing error messages.
;Output : None
;
;Check input
S SENT=+$G(SENT)
S ERRCNT=$G(ERRCNT)
S VALER=$G(VALER)
;
;Declare variables
NEW MSGTXT,XMB,XMTEXT,XMY,XMDUZ,XMDT,XMZ,XMITPTR,LINE
NEW ENCPTR,DELPTR,ENCDATE,ENCLOC,NAME,TMP,ENCZERO,SSN,PATZERO
;
S MSGTXT="^TMP(""SCMC-XMIT-BLD"","_$J_",""BULLETIN"")"
KILL @MSGTXT
;
;Put number of messages transmitted into message text
S @MSGTXT@(1)="Transmission of PCMM Primary Care data to the NPCD has completed."
S @MSGTXT@(2)=""
S @MSGTXT@(3)="A total of "_SENT_" messages were sent."
;Put number of nontransmitted messages into message text
S @MSGTXT@(4)="A total of "_ERRCNT_" messages were not sent."
S @MSGTXT@(5)=""
S @MSGTXT@(6)="Please review the IEMM Error listing for further detail."
;
;Set bulletin subject
S XMB(1)="Transmission of data to NPCDB completed"
;Deliver bulletin
S XMB="PCMM PRIMARY CARE DATA TO NPCDB SUMMARY"
S XMTEXT=$P(MSGTXT,")",1)_","
D ^XMB
;Done - clean up and quit
KILL @MSGTXT
Q
;
ERRBULL(REASON) ;Send error bulletin
;
;Input : REASON - Why transmission of data could not be completed
;Output : None
;
;Check input
S REASON=$G(REASON)
;
;Declare variables
NEW MSGTXT,XMB,XMTEXT,XMY,XMDUZ,XMDT,XMZ
;
;Set message text
S MSGTXT(1)="Transmission of PCMM Primary Care data to the CDCO"
S MSGTXT(2)=" "
S MSGTXT(3)="could not be completed for the following reason:"
S MSGTXT(4)=" "
S MSGTXT(5)=" "_REASON
;
;Set bulletin subject
S XMB(1)="** TRANSMISSION OF DATA TO NPCDB NOT COMPLETED **"
;Deliver bulletin
S XMB="PCMM PRIMARY CARE DATA TO NPCDB SUMMARY"
S XMTEXT="MSGTXT("
D ^XMB
;
;Done
Q
;
NOTIFY ; Description: This is used to send a message to local mail group.
; The notification message is used to alert users at the local site
; that new PCMM HL7 Transmission errors were received from the CDCO.
;
;Reference routine: SCMCHLRR
;
; Input: None
; Output: None
;
;Init variables
N ACK,SCBEG,SCCNT,SCEND,SCTLIEN,SCSTAT
N SCAIEN,SCADFN,SCBIEN,SCCX,SCCY,SCGLB,SCCIENB,SCCIENA,SCTPSS
N SCTPOS,SCY,SCX,SCINNAM
N SCHLIEN,SCHLIEN1,SCHLIEN2,SCHLIEN3,SCHLIEN4,SCHLIEN5,SCINT
N SCMCIDX,SCMCIE,SCMCTMX,SCMCTPX,SCMCX,SCMGIEN,SCTP
S (SCTLIEN,SCBEG,SCEND,SCCNT)=0 K ^XTMP("SCMCHLM")
S ^XTMP("SCMCHLM",0)=DT_U_DT
;
;Get data from PCMM HL7 Trans Log file for records that have
;have a status of 'rejected' and 'marked for re-transmit'
F SCSTAT="M","RJ" D
.F S SCTLIEN=$O(^SCPT(404.471,"ASTAT",SCSTAT,SCTLIEN)) Q:SCTLIEN="" D
..;
..;if Included In Reject Bulletin? field is not 'YES'
..I $$INCLUDE^SCMCHLA(SCTLIEN)'="Y" D
...;
...;count rejects received
...S SCCNT=SCCNT+1
...;
...;get institution,team,position and message ID
...S (SCTPOS,SCTPSS,SCINNAM,SCTP)="UNK"
...S SCAIEN=$G(^SCPT(404.471,SCTLIEN,0)) D
....S SCADFN=$P(SCAIEN,U,2),SCMGIEN=$P(SCAIEN,U),SCHLIEN=0
....F S SCHLIEN=$O(^SCPT(404.471,SCTLIEN,"ZPC",SCHLIEN)) Q:SCHLIEN="" D
.....S SCHLIEN1=$G(^SCPT(404.471,SCTLIEN,"ZPC",SCHLIEN,0)) Q:SCHLIEN1=""
.....S SCHLIEN2=$P(SCHLIEN1,U,2),SCHLIEN3=+$G(^SCPT(404.49,SCHLIEN2,0))
.....S SCHLIEN4=$G(^SCPT(404.43,SCHLIEN3,0)) Q:SCHLIEN4=""
.....S SCHLIEN5=$G(^SCPT(404.42,+SCHLIEN4,0)) Q:SCHLIEN5=""
.....S SCTPOS=$P(SCHLIEN4,U,2),SCTPSS=$G(^SCTM(404.57,+SCTPOS,0))
.....S SCTP=$P(SCTPSS,U,2),SCY=$G(^SCTM(404.51,+SCTP,0)),SCINT=$P(SCY,U,7)
.....S SCINNAM=$$GET1^DIQ(4,+SCINT_",",.01)
.....I '$D(^XTMP("SCMCHLM",$J,+SCINT,+SCAIEN)) D
......S ^XTMP("SCMCHLM",$J,+SCINT,+SCAIEN,+SCHLIEN)=SCINNAM_"^"_$P(SCTPSS,U)_"^"_$P(SCY,U)
...;get date/time of 'earliest' and 'latest' reject msg
...S ACK=$$ACK^SCMCHLA(SCTLIEN)
...I 'SCBEG S SCBEG=ACK
...I ACK<SCBEG S SCBEG=ACK
...I 'SCEND S SCEND=ACK
...I ACK>SCEND S SCEND=ACK
...;
...;set Included In Reject Bulletin? field of record to 'YES'
...I $$UPDINCL^SCMCHLA(SCTLIEN,"Y")
;
;If reject msgs, then send notification message
I SCCNT D SEND(SCBEG,SCEND,SCCNT)
Q
;
SEND(SCBEG,SCEND,SCCNT) ;
; Description: Used to send PCMM Transmission Errors Received
; notification message.
;
; Input:
; SCBEG - internal FM date/time earliest error received
; SCEND - internal FM date/time latest error received
; SCCNT - count of errors received
;
; Output: None
;
N SCRANGE,TEXT,XMDUN,XMDUZ,XMTEXT,XMROU,XMSTRIP,XMSUB,XMY,XMZ
;
;Init subj/sender
S XMSUB="PCMM Transmission Errors Received"
S (XMDUN,XMDUZ)="PCMM Module"
;
;Recipient (mail group)
S XMY("G.PCMM TRANSMISSION ERRORS")=""
;
;Message body
S XMTEXT="TEXT("
S TEXT(1)="PCMM reject transmissions have been received from the Corporate"
S TEXT(2)="Data Center Operations (CDCO)."
S TEXT(3)=""
S SCRANGE=" Reject Transmissions Received: "_$$FMTE^XLFDT($G(SCBEG),"2P")_" thru "_$$FMTE^XLFDT($G(SCEND),"2P")
S TEXT(4)=SCRANGE
S TEXT(5)=" Total Transmissions Rejected: "_$G(SCCNT)
S TEXT(6)=""
S TEXT(7)="Please use the PCMM Transmission Error Processing option for a"
S TEXT(8)="list of the errors associated with these rejected transmissions."
S TEXT(9)=""
S TEXT(10)="Institution Message ID Team Position"
S TEXT(11)="=========== ========== ==== ========"
S TEXT(12)=""
N SCMCID,SCMCIN,SCMCIDN,SCMCTM,SCMCTP,SCMCINNM,SCMCL
S SCMCL=12
S SCMCIN=0 F S SCMCIN=$O(^XTMP("SCMCHLM",$J,SCMCIN)) Q:SCMCIN="" D
.S SCMCID=0 F S SCMCID=$O(^XTMP("SCMCHLM",$J,SCMCIN,SCMCID)) Q:SCMCID="" D
..S SCMCIE=0 F S SCMCIE=$O(^XTMP("SCMCHLM",$J,SCMCIN,SCMCID,SCMCIE)) Q:SCMCIE<1 D
...S SCMCIDN=$G(^XTMP("SCMCHLM",$J,SCMCIN,SCMCID,SCMCIE))
...S SCMCINNM=$E($P(SCMCIDN,U,1),1,17),SCMCTM=$E($P(SCMCIDN,U,2),1,20)
...S SCMCTP=$E($P(SCMCIDN,U,3),1,20),SCMCL=SCMCL+1
...S SCMCX=SCMCINNM_$E(" ",1,20-$L(SCMCINNM))
...S SCMCIDX=$E(" ",1,15-$L(SCMCID))_SCMCID
...S SCMCX=SCMCX_SCMCIDX
...S SCMCTMX=$E(" ",1,17-$L(SCMCTM))_SCMCTM
...S SCMCX=SCMCX_SCMCTMX
...S SCMCTPX=$E(" ",1,17-$L(SCMCTP))_SCMCTP
...S SCMCX=SCMCX_SCMCTPX
...S TEXT(SCMCL)=SCMCX
;
;Mailman delivery
D ^XMD
K ^XTMP("SCMCHLM")
Q
SCMCHLM ;BP/DJB - PCMM HL7 Mail Msgs ; 6/28/99 10:16am
+1 ;;5.3;Scheduling;**177,210,505,1015**;AUG 13, 1993;Build 21
+2 ;
+3 ;Reference routine: SCDXMSG2
CMPLBULL(SENT,ERRCNT,VALER) ;Send completion bulletin
+1 ;
+2 ;Input : SENT - Number of messages sent to NPCD. Default=0.
+3 ; ERRCNT - Number of errored messages.
+4 ; VALER - Array containing error messages.
+5 ;Output : None
+6 ;
+7 ;Check input
+8 SET SENT=+$GET(SENT)
+9 SET ERRCNT=$GET(ERRCNT)
+10 SET VALER=$GET(VALER)
+11 ;
+12 ;Declare variables
+13 NEW MSGTXT,XMB,XMTEXT,XMY,XMDUZ,XMDT,XMZ,XMITPTR,LINE
+14 NEW ENCPTR,DELPTR,ENCDATE,ENCLOC,NAME,TMP,ENCZERO,SSN,PATZERO
+15 ;
+16 SET MSGTXT="^TMP(""SCMC-XMIT-BLD"","_$JOB_",""BULLETIN"")"
+17 KILL @MSGTXT
+18 ;
+19 ;Put number of messages transmitted into message text
+20 SET @MSGTXT@(1)="Transmission of PCMM Primary Care data to the NPCD has completed."
+21 SET @MSGTXT@(2)=""
+22 SET @MSGTXT@(3)="A total of "_SENT_" messages were sent."
+23 ;Put number of nontransmitted messages into message text
+24 SET @MSGTXT@(4)="A total of "_ERRCNT_" messages were not sent."
+25 SET @MSGTXT@(5)=""
+26 SET @MSGTXT@(6)="Please review the IEMM Error listing for further detail."
+27 ;
+28 ;Set bulletin subject
+29 SET XMB(1)="Transmission of data to NPCDB completed"
+30 ;Deliver bulletin
+31 SET XMB="PCMM PRIMARY CARE DATA TO NPCDB SUMMARY"
+32 SET XMTEXT=$PIECE(MSGTXT,")",1)_","
+33 DO ^XMB
+34 ;Done - clean up and quit
+35 KILL @MSGTXT
+36 QUIT
+37 ;
ERRBULL(REASON) ;Send error bulletin
+1 ;
+2 ;Input : REASON - Why transmission of data could not be completed
+3 ;Output : None
+4 ;
+5 ;Check input
+6 SET REASON=$GET(REASON)
+7 ;
+8 ;Declare variables
+9 NEW MSGTXT,XMB,XMTEXT,XMY,XMDUZ,XMDT,XMZ
+10 ;
+11 ;Set message text
+12 SET MSGTXT(1)="Transmission of PCMM Primary Care data to the CDCO"
+13 SET MSGTXT(2)=" "
+14 SET MSGTXT(3)="could not be completed for the following reason:"
+15 SET MSGTXT(4)=" "
+16 SET MSGTXT(5)=" "_REASON
+17 ;
+18 ;Set bulletin subject
+19 SET XMB(1)="** TRANSMISSION OF DATA TO NPCDB NOT COMPLETED **"
+20 ;Deliver bulletin
+21 SET XMB="PCMM PRIMARY CARE DATA TO NPCDB SUMMARY"
+22 SET XMTEXT="MSGTXT("
+23 DO ^XMB
+24 ;
+25 ;Done
+26 QUIT
+27 ;
NOTIFY ; Description: This is used to send a message to local mail group.
+1 ; The notification message is used to alert users at the local site
+2 ; that new PCMM HL7 Transmission errors were received from the CDCO.
+3 ;
+4 ;Reference routine: SCMCHLRR
+5 ;
+6 ; Input: None
+7 ; Output: None
+8 ;
+9 ;Init variables
+10 NEW ACK,SCBEG,SCCNT,SCEND,SCTLIEN,SCSTAT
+11 NEW SCAIEN,SCADFN,SCBIEN,SCCX,SCCY,SCGLB,SCCIENB,SCCIENA,SCTPSS
+12 NEW SCTPOS,SCY,SCX,SCINNAM
+13 NEW SCHLIEN,SCHLIEN1,SCHLIEN2,SCHLIEN3,SCHLIEN4,SCHLIEN5,SCINT
+14 NEW SCMCIDX,SCMCIE,SCMCTMX,SCMCTPX,SCMCX,SCMGIEN,SCTP
+15 SET (SCTLIEN,SCBEG,SCEND,SCCNT)=0
KILL ^XTMP("SCMCHLM")
+16 SET ^XTMP("SCMCHLM",0)=DT_U_DT
+17 ;
+18 ;Get data from PCMM HL7 Trans Log file for records that have
+19 ;have a status of 'rejected' and 'marked for re-transmit'
+20 FOR SCSTAT="M","RJ"
Begin DoDot:1
+21 FOR
SET SCTLIEN=$ORDER(^SCPT(404.471,"ASTAT",SCSTAT,SCTLIEN))
IF SCTLIEN=""
QUIT
Begin DoDot:2
+22 ;
+23 ;if Included In Reject Bulletin? field is not 'YES'
+24 IF $$INCLUDE^SCMCHLA(SCTLIEN)'="Y"
Begin DoDot:3
+25 ;
+26 ;count rejects received
+27 SET SCCNT=SCCNT+1
+28 ;
+29 ;get institution,team,position and message ID
+30 SET (SCTPOS,SCTPSS,SCINNAM,SCTP)="UNK"
+31 SET SCAIEN=$GET(^SCPT(404.471,SCTLIEN,0))
Begin DoDot:4
+32 SET SCADFN=$PIECE(SCAIEN,U,2)
SET SCMGIEN=$PIECE(SCAIEN,U)
SET SCHLIEN=0
+33 FOR
SET SCHLIEN=$ORDER(^SCPT(404.471,SCTLIEN,"ZPC",SCHLIEN))
IF SCHLIEN=""
QUIT
Begin DoDot:5
+34 SET SCHLIEN1=$GET(^SCPT(404.471,SCTLIEN,"ZPC",SCHLIEN,0))
IF SCHLIEN1=""
QUIT
+35 SET SCHLIEN2=$PIECE(SCHLIEN1,U,2)
SET SCHLIEN3=+$GET(^SCPT(404.49,SCHLIEN2,0))
+36 SET SCHLIEN4=$GET(^SCPT(404.43,SCHLIEN3,0))
IF SCHLIEN4=""
QUIT
+37 SET SCHLIEN5=$GET(^SCPT(404.42,+SCHLIEN4,0))
IF SCHLIEN5=""
QUIT
+38 SET SCTPOS=$PIECE(SCHLIEN4,U,2)
SET SCTPSS=$GET(^SCTM(404.57,+SCTPOS,0))
+39 SET SCTP=$PIECE(SCTPSS,U,2)
SET SCY=$GET(^SCTM(404.51,+SCTP,0))
SET SCINT=$PIECE(SCY,U,7)
+40 SET SCINNAM=$$GET1^DIQ(4,+SCINT_",",.01)
+41 IF '$DATA(^XTMP("SCMCHLM",$JOB,+SCINT,+SCAIEN))
Begin DoDot:6
+42 SET ^XTMP("SCMCHLM",$JOB,+SCINT,+SCAIEN,+SCHLIEN)=SCINNAM_"^"_$PIECE(SCTPSS,U)_"^"_$PIECE(SCY,U)
End DoDot:6
End DoDot:5
End DoDot:4
+43 ;get date/time of 'earliest' and 'latest' reject msg
+44 SET ACK=$$ACK^SCMCHLA(SCTLIEN)
+45 IF 'SCBEG
SET SCBEG=ACK
+46 IF ACK<SCBEG
SET SCBEG=ACK
+47 IF 'SCEND
SET SCEND=ACK
+48 IF ACK>SCEND
SET SCEND=ACK
+49 ;
+50 ;set Included In Reject Bulletin? field of record to 'YES'
+51 IF $$UPDINCL^SCMCHLA(SCTLIEN,"Y")
End DoDot:3
End DoDot:2
End DoDot:1
+52 ;
+53 ;If reject msgs, then send notification message
+54 IF SCCNT
DO SEND(SCBEG,SCEND,SCCNT)
+55 QUIT
+56 ;
SEND(SCBEG,SCEND,SCCNT) ;
+1 ; Description: Used to send PCMM Transmission Errors Received
+2 ; notification message.
+3 ;
+4 ; Input:
+5 ; SCBEG - internal FM date/time earliest error received
+6 ; SCEND - internal FM date/time latest error received
+7 ; SCCNT - count of errors received
+8 ;
+9 ; Output: None
+10 ;
+11 NEW SCRANGE,TEXT,XMDUN,XMDUZ,XMTEXT,XMROU,XMSTRIP,XMSUB,XMY,XMZ
+12 ;
+13 ;Init subj/sender
+14 SET XMSUB="PCMM Transmission Errors Received"
+15 SET (XMDUN,XMDUZ)="PCMM Module"
+16 ;
+17 ;Recipient (mail group)
+18 SET XMY("G.PCMM TRANSMISSION ERRORS")=""
+19 ;
+20 ;Message body
+21 SET XMTEXT="TEXT("
+22 SET TEXT(1)="PCMM reject transmissions have been received from the Corporate"
+23 SET TEXT(2)="Data Center Operations (CDCO)."
+24 SET TEXT(3)=""
+25 SET SCRANGE=" Reject Transmissions Received: "_$$FMTE^XLFDT($GET(SCBEG),"2P")_" thru "_$$FMTE^XLFDT($GET(SCEND),"2P")
+26 SET TEXT(4)=SCRANGE
+27 SET TEXT(5)=" Total Transmissions Rejected: "_$GET(SCCNT)
+28 SET TEXT(6)=""
+29 SET TEXT(7)="Please use the PCMM Transmission Error Processing option for a"
+30 SET TEXT(8)="list of the errors associated with these rejected transmissions."
+31 SET TEXT(9)=""
+32 SET TEXT(10)="Institution Message ID Team Position"
+33 SET TEXT(11)="=========== ========== ==== ========"
+34 SET TEXT(12)=""
+35 NEW SCMCID,SCMCIN,SCMCIDN,SCMCTM,SCMCTP,SCMCINNM,SCMCL
+36 SET SCMCL=12
+37 SET SCMCIN=0
FOR
SET SCMCIN=$ORDER(^XTMP("SCMCHLM",$JOB,SCMCIN))
IF SCMCIN=""
QUIT
Begin DoDot:1
+38 SET SCMCID=0
FOR
SET SCMCID=$ORDER(^XTMP("SCMCHLM",$JOB,SCMCIN,SCMCID))
IF SCMCID=""
QUIT
Begin DoDot:2
+39 SET SCMCIE=0
FOR
SET SCMCIE=$ORDER(^XTMP("SCMCHLM",$JOB,SCMCIN,SCMCID,SCMCIE))
IF SCMCIE<1
QUIT
Begin DoDot:3
+40 SET SCMCIDN=$GET(^XTMP("SCMCHLM",$JOB,SCMCIN,SCMCID,SCMCIE))
+41 SET SCMCINNM=$EXTRACT($PIECE(SCMCIDN,U,1),1,17)
SET SCMCTM=$EXTRACT($PIECE(SCMCIDN,U,2),1,20)
+42 SET SCMCTP=$EXTRACT($PIECE(SCMCIDN,U,3),1,20)
SET SCMCL=SCMCL+1
+43 SET SCMCX=SCMCINNM_$EXTRACT(" ",1,20-$LENGTH(SCMCINNM))
+44 SET SCMCIDX=$EXTRACT(" ",1,15-$LENGTH(SCMCID))_SCMCID
+45 SET SCMCX=SCMCX_SCMCIDX
+46 SET SCMCTMX=$EXTRACT(" ",1,17-$LENGTH(SCMCTM))_SCMCTM
+47 SET SCMCX=SCMCX_SCMCTMX
+48 SET SCMCTPX=$EXTRACT(" ",1,17-$LENGTH(SCMCTP))_SCMCTP
+49 SET SCMCX=SCMCX_SCMCTPX
+50 SET TEXT(SCMCL)=SCMCX
End DoDot:3
End DoDot:2
End DoDot:1
+51 ;
+52 ;Mailman delivery
+53 DO ^XMD
+54 KILL ^XTMP("SCMCHLM")
+55 QUIT