| 1 | SCMCHLM ;BP/DJB - PCMM HL7 Mail Msgs ; 6/28/99 10:16am | 
|---|
| 2 | ;;5.3;Scheduling;**177,210**;AUG 13, 1993 | 
|---|
| 3 | ; | 
|---|
| 4 | ;Reference routine: SCDXMSG2 | 
|---|
| 5 | CMPLBULL(SENT,ERRCNT,VALER) ;Send completion bulletin | 
|---|
| 6 | ; | 
|---|
| 7 | ;Input  : SENT   - Number of messages sent to NPCD. Default=0. | 
|---|
| 8 | ;         ERRCNT - Number of errored messages. | 
|---|
| 9 | ;         VALER  - Array containing error messages. | 
|---|
| 10 | ;Output : None | 
|---|
| 11 | ; | 
|---|
| 12 | ;Check input | 
|---|
| 13 | S SENT=+$G(SENT) | 
|---|
| 14 | S ERRCNT=$G(ERRCNT) | 
|---|
| 15 | S VALER=$G(VALER) | 
|---|
| 16 | ; | 
|---|
| 17 | ;Declare variables | 
|---|
| 18 | NEW MSGTXT,XMB,XMTEXT,XMY,XMDUZ,XMDT,XMZ,XMITPTR,LINE | 
|---|
| 19 | NEW ENCPTR,DELPTR,ENCDATE,ENCLOC,NAME,TMP,ENCZERO,SSN,PATZERO | 
|---|
| 20 | ; | 
|---|
| 21 | S MSGTXT="^TMP(""SCMC-XMIT-BLD"","_$J_",""BULLETIN"")" | 
|---|
| 22 | KILL @MSGTXT | 
|---|
| 23 | ; | 
|---|
| 24 | ;Put number of messages transmitted into message text | 
|---|
| 25 | S @MSGTXT@(1)="Transmission of PCMM Primary Care data to the NPCD has completed." | 
|---|
| 26 | S @MSGTXT@(2)="" | 
|---|
| 27 | S @MSGTXT@(3)="A total of "_SENT_" messages were sent." | 
|---|
| 28 | ;Put number of nontransmitted messages into message text | 
|---|
| 29 | S @MSGTXT@(4)="A total of "_ERRCNT_" messages were not sent." | 
|---|
| 30 | S @MSGTXT@(5)="" | 
|---|
| 31 | S @MSGTXT@(6)="Please review the IEMM Error listing for further detail." | 
|---|
| 32 | ; | 
|---|
| 33 | ;Set bulletin subject | 
|---|
| 34 | S XMB(1)="Transmission of data to NPCDB completed" | 
|---|
| 35 | ;Deliver bulletin | 
|---|
| 36 | S XMB="PCMM PRIMARY CARE DATA TO NPCDB SUMMARY" | 
|---|
| 37 | S XMTEXT=$P(MSGTXT,")",1)_"," | 
|---|
| 38 | D ^XMB | 
|---|
| 39 | ;Done - clean up and quit | 
|---|
| 40 | KILL @MSGTXT | 
|---|
| 41 | Q | 
|---|
| 42 | ; | 
|---|
| 43 | ERRBULL(REASON) ;Send error bulletin | 
|---|
| 44 | ; | 
|---|
| 45 | ;Input  : REASON - Why transmission of data could not be completed | 
|---|
| 46 | ;Output : None | 
|---|
| 47 | ; | 
|---|
| 48 | ;Check input | 
|---|
| 49 | S REASON=$G(REASON) | 
|---|
| 50 | ; | 
|---|
| 51 | ;Declare variables | 
|---|
| 52 | NEW MSGTXT,XMB,XMTEXT,XMY,XMDUZ,XMDT,XMZ | 
|---|
| 53 | ; | 
|---|
| 54 | ;Set message text | 
|---|
| 55 | S MSGTXT(1)="Transmission of PCMM Primary Care data to the NPCD" | 
|---|
| 56 | S MSGTXT(2)=" " | 
|---|
| 57 | S MSGTXT(3)="could not be completed for the following reason:" | 
|---|
| 58 | S MSGTXT(4)=" " | 
|---|
| 59 | S MSGTXT(5)="  "_REASON | 
|---|
| 60 | ; | 
|---|
| 61 | ;Set bulletin subject | 
|---|
| 62 | S XMB(1)="** TRANSMISSION OF DATA TO NPCDB NOT COMPLETED **" | 
|---|
| 63 | ;Deliver bulletin | 
|---|
| 64 | S XMB="PCMM PRIMARY CARE DATA TO NPCDB SUMMARY" | 
|---|
| 65 | S XMTEXT="MSGTXT(" | 
|---|
| 66 | D ^XMB | 
|---|
| 67 | ; | 
|---|
| 68 | ;Done | 
|---|
| 69 | Q | 
|---|
| 70 | ; | 
|---|
| 71 | NOTIFY ; Description: This is used to send a message to local mail group. | 
|---|
| 72 | ; The notification message is used to alert users at the local site | 
|---|
| 73 | ; that new PCMM HL7 Transmission errors were received from the AAC. | 
|---|
| 74 | ; | 
|---|
| 75 | ;Reference routine: SCMCHLRR | 
|---|
| 76 | ; | 
|---|
| 77 | ;  Input: None | 
|---|
| 78 | ; Output: None | 
|---|
| 79 | ; | 
|---|
| 80 | ;Init variables | 
|---|
| 81 | N ACK,SCBEG,SCCNT,SCEND,SCTLIEN,SCSTAT | 
|---|
| 82 | S (SCTLIEN,SCBEG,SCEND,SCCNT)=0 | 
|---|
| 83 | ; | 
|---|
| 84 | ;Get data from PCMM HL7 Trans Log file for records that have | 
|---|
| 85 | ;have a status of 'rejected' and 'marked for re-transmit' | 
|---|
| 86 | F SCSTAT="M","RJ" D | 
|---|
| 87 | .F  S SCTLIEN=$O(^SCPT(404.471,"ASTAT",SCSTAT,SCTLIEN)) Q:'SCTLIEN  D | 
|---|
| 88 | ..; | 
|---|
| 89 | ..;if Included In Reject Bulletin? field is not 'YES' | 
|---|
| 90 | ..I $$INCLUDE^SCMCHLA(SCTLIEN)'="Y" D | 
|---|
| 91 | ...; | 
|---|
| 92 | ...;count rejects received | 
|---|
| 93 | ...S SCCNT=SCCNT+1 | 
|---|
| 94 | ...; | 
|---|
| 95 | ...;get date/time of 'earliest' and 'latest' reject msg | 
|---|
| 96 | ...S ACK=$$ACK^SCMCHLA(SCTLIEN) | 
|---|
| 97 | ...I 'SCBEG S SCBEG=ACK | 
|---|
| 98 | ...I ACK<SCBEG S SCBEG=ACK | 
|---|
| 99 | ...I 'SCEND S SCEND=ACK | 
|---|
| 100 | ...I ACK>SCEND S SCEND=ACK | 
|---|
| 101 | ...; | 
|---|
| 102 | ...;set Included In Reject Bulletin? field of record to 'YES' | 
|---|
| 103 | ...I $$UPDINCL^SCMCHLA(SCTLIEN,"Y") | 
|---|
| 104 | ; | 
|---|
| 105 | ;If reject msgs, then send notification message | 
|---|
| 106 | I SCCNT D SEND(SCBEG,SCEND,SCCNT) | 
|---|
| 107 | Q | 
|---|
| 108 | ; | 
|---|
| 109 | SEND(SCBEG,SCEND,SCCNT) ; | 
|---|
| 110 | ; Description: Used to send PCMM Transmission Errors Received | 
|---|
| 111 | ; notification message. | 
|---|
| 112 | ; | 
|---|
| 113 | ;  Input: | 
|---|
| 114 | ;   SCBEG - internal FM date/time earliest error received | 
|---|
| 115 | ;   SCEND - internal FM date/time latest error received | 
|---|
| 116 | ;   SCCNT - count of erros received | 
|---|
| 117 | ; | 
|---|
| 118 | ; Output: None | 
|---|
| 119 | ; | 
|---|
| 120 | N SCRANGE,TEXT,XMDUN,XMDUZ,XMTEXT,XMROU,XMSTRIP,XMSUB,XMY,XMZ | 
|---|
| 121 | ; | 
|---|
| 122 | ;Init subj/sender | 
|---|
| 123 | S XMSUB="PCMM Transmission Errors Received" | 
|---|
| 124 | S (XMDUN,XMDUZ)="PCMM Module" | 
|---|
| 125 | ; | 
|---|
| 126 | ;Recipient (mail group) | 
|---|
| 127 | S XMY("G.PCMM TRANSMISSION ERRORS")="" | 
|---|
| 128 | ; | 
|---|
| 129 | ;Message body | 
|---|
| 130 | S XMTEXT="TEXT(" | 
|---|
| 131 | S TEXT(1)="PCMM reject transmissions have been received from the Austin" | 
|---|
| 132 | S TEXT(2)="Automation Center (AAC)." | 
|---|
| 133 | S TEXT(3)="" | 
|---|
| 134 | S SCRANGE=" Reject Transmissions Received: "_$$FMTE^XLFDT($G(SCBEG),"2P")_" thru "_$$FMTE^XLFDT($G(SCEND),"2P") | 
|---|
| 135 | S TEXT(4)=SCRANGE | 
|---|
| 136 | S TEXT(5)="  Total Transmissions Rejected: "_$G(SCCNT) | 
|---|
| 137 | S TEXT(6)="" | 
|---|
| 138 | S TEXT(7)="Please use the PCMM Transmission Error Processing option for a" | 
|---|
| 139 | S TEXT(8)="list of the errors associated with these rejected transmissions." | 
|---|
| 140 | ; | 
|---|
| 141 | ;Mailman deliverey | 
|---|
| 142 | D ^XMD | 
|---|
| 143 | Q | 
|---|