SD53747P ;MNT/BJR - Clean up Untransmitted Encounters ; Apr 01, 2020@19:34
;;5.3;Scheduling;**747**;Aug 13, 1993;Build 5
;
Q
;
;Reference to $$EMGRES^DGUTL supported by ICR # 4800
;Reference to $$SITE^VASITE supported by ICR # 10112
;Reference to $$FMTE^XLFDT supported by ICR # 10103
;Reference to $$HTE^XLFDT supported by ICR # 10103
;Reference to $$NOW^XLFDT supported by ICR # 10103
;Reference to $$SCH^XLFDT supported by ICR # 10103
;Reference to ^XMD supported by ICR # 10070
;Reference to BMES^XPDUTL supported by ICR # 10141
;Reference to MES^XPDUTL supported by ICR # 10141
;
POST ;Scan the TRANSMITTED OUTPATIENT ENCOUNTER file (#409.73) for records
;transmitted with the Pandemic EMERGENCY RESPONSE INDICATOR.
;
N SDTIEN ;Transmitted Outpatient Encounter file pointer
N SDENCPTR ;Outpatient Encounter file pointer
N SDREQUE ;Count of messages re-queued
N SDSTART ;start date/time
N SDXMITDT ;Date/Time Counter
N SDERIDT ;Pandemic patch earliest install date
N SDDFN ;IEN to PATIENT file (#2)
;
K ^TMP("SD53747P",$J)
S SDERIDT=3200327
S SDSTART=$$NOW^XLFDT
S SDREQUE=0
S SDXMITDT=SDERIDT-.00001
D MES^XPDUTL("Performing Ambulatory Care Validation Checks...")
F S SDXMITDT=$O(^SD(409.73,"AACXMIT",SDXMITDT)) Q:'SDXMITDT D
. S SDTIEN=0
. F S SDTIEN=$O(^SD(409.73,"AACXMIT",SDXMITDT,SDTIEN)) Q:'SDTIEN D
. . S SDENCPTR=$P($G(^SD(409.73,SDTIEN,0)),U,2)
. . Q:'SDENCPTR
. . S SDDFN=$P($G(^SCE(SDENCPTR,0)),U,2)
. . Q:($$EMGRES^DGUTL(SDDFN)'="P")
. . D FLG(SDTIEN)
. . S SDREQUE=SDREQUE+1
;send completion MailMan message
D NOTIFY(SDSTART,SDREQUE)
Q
;
NOTIFY(SDSTIME,SDREQ) ;send job completion msg
;
; Input
; SDSTIME - job start date/time
; SDREQ - count of untransmitted encounters re-queued
;
; Output
; none
;
N DIFROM,XMDUZ,XMSUB,XMTEXT,XMY,XMZ
N SDSITE,SDETIME,SDTEXT,LINECT
S SDSITE=$$SITE^VASITE
S SDETIME=$$NOW^XLFDT
S XMDUZ="Untransmitted Encounters Re-queue"
S XMSUB="Patch SD*5.3*747 Pandemic ERI (Encounter Transmissions)"
S XMTEXT="^TMP(""SD53747P"",$J,"
S XMY(DUZ)=""
S ^TMP("SD53747P",$J,1)=""
S ^TMP("SD53747P",$J,2)=" Facility Name: "_$P(SDSITE,U,2)
S ^TMP("SD53747P",$J,3)=" Station Number: "_$P(SDSITE,U,3)
S ^TMP("SD53747P",$J,4)=""
S ^TMP("SD53747P",$J,5)=" Date/Time job started: "_$$FMTE^XLFDT(SDSTIME)
S ^TMP("SD53747P",$J,6)=" Date/Time job stopped: "_$$FMTE^XLFDT(SDETIME)
S ^TMP("SD53747P",$J,7)=""
S ^TMP("SD53747P",$J,9)="Total untransmitted encounters re-queued : "_SDREQ
S ^TMP("SD53747P",$J,10)="Please Note: There is no user intervention required with the re-transmission"
S ^TMP("SD53747P",$J,11)="of the untransmitted encounters. They will be retransmitted via the nightly"
S ^TMP("SD53747P",$J,12)="background job that is scheduled at your site."
D ^XMD K ^TMP("SD53747P",$J),XMY
Q
FLG(SDXMT) ; Entry point for Reflag Transmission protocol
N SDRTN
S SDRTN=$$VALIDATE^SCMSVUT2(SDXMT)
I SDRTN<0 Q
S SDRTN=$$SETRFLG(SDXMT)
I SDRTN<0 D MES^XPDUTL("There was a problem reflagging the transmission for "_SDXMT)
Q
;
SETRFLG(SDXMT) ;
; Input
; SDXMT - Pointer to Transmission File, #409.73
;
; Output
; -1 - There was a problem reflagging the transmission
; 0 - No errors occurred
; 1 - The entry is already flagged for transmission
;
N SDRSLT,SDSTAT
S SDRSLT=-1
S SDSTAT=$P($G(^SD(409.73,SDXMT,0)),U,4)
I SDSTAT S SDRSLT=1
E D
. D XMITFLAG^SCDXFU01(SDXMT,0),STREEVNT^SCDXFU01(SDXMT,0)
. S SDRSLT=0
Q SDRSLT
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSD53747P 3622 printed Dec 13, 2024@02:45:27 Page 2
SD53747P ;MNT/BJR - Clean up Untransmitted Encounters ; Apr 01, 2020@19:34
+1 ;;5.3;Scheduling;**747**;Aug 13, 1993;Build 5
+2 ;
+3 QUIT
+4 ;
+5 ;Reference to $$EMGRES^DGUTL supported by ICR # 4800
+6 ;Reference to $$SITE^VASITE supported by ICR # 10112
+7 ;Reference to $$FMTE^XLFDT supported by ICR # 10103
+8 ;Reference to $$HTE^XLFDT supported by ICR # 10103
+9 ;Reference to $$NOW^XLFDT supported by ICR # 10103
+10 ;Reference to $$SCH^XLFDT supported by ICR # 10103
+11 ;Reference to ^XMD supported by ICR # 10070
+12 ;Reference to BMES^XPDUTL supported by ICR # 10141
+13 ;Reference to MES^XPDUTL supported by ICR # 10141
+14 ;
POST ;Scan the TRANSMITTED OUTPATIENT ENCOUNTER file (#409.73) for records
+1 ;transmitted with the Pandemic EMERGENCY RESPONSE INDICATOR.
+2 ;
+3 ;Transmitted Outpatient Encounter file pointer
NEW SDTIEN
+4 ;Outpatient Encounter file pointer
NEW SDENCPTR
+5 ;Count of messages re-queued
NEW SDREQUE
+6 ;start date/time
NEW SDSTART
+7 ;Date/Time Counter
NEW SDXMITDT
+8 ;Pandemic patch earliest install date
NEW SDERIDT
+9 ;IEN to PATIENT file (#2)
NEW SDDFN
+10 ;
+11 KILL ^TMP("SD53747P",$JOB)
+12 SET SDERIDT=3200327
+13 SET SDSTART=$$NOW^XLFDT
+14 SET SDREQUE=0
+15 SET SDXMITDT=SDERIDT-.00001
+16 DO MES^XPDUTL("Performing Ambulatory Care Validation Checks...")
+17 FOR
SET SDXMITDT=$ORDER(^SD(409.73,"AACXMIT",SDXMITDT))
if 'SDXMITDT
QUIT
Begin DoDot:1
+18 SET SDTIEN=0
+19 FOR
SET SDTIEN=$ORDER(^SD(409.73,"AACXMIT",SDXMITDT,SDTIEN))
if 'SDTIEN
QUIT
Begin DoDot:2
+20 SET SDENCPTR=$PIECE($GET(^SD(409.73,SDTIEN,0)),U,2)
+21 if 'SDENCPTR
QUIT
+22 SET SDDFN=$PIECE($GET(^SCE(SDENCPTR,0)),U,2)
+23 if ($$EMGRES^DGUTL(SDDFN)'="P")
QUIT
+24 DO FLG(SDTIEN)
+25 SET SDREQUE=SDREQUE+1
End DoDot:2
End DoDot:1
+26 ;send completion MailMan message
+27 DO NOTIFY(SDSTART,SDREQUE)
+28 QUIT
+29 ;
NOTIFY(SDSTIME,SDREQ) ;send job completion msg
+1 ;
+2 ; Input
+3 ; SDSTIME - job start date/time
+4 ; SDREQ - count of untransmitted encounters re-queued
+5 ;
+6 ; Output
+7 ; none
+8 ;
+9 NEW DIFROM,XMDUZ,XMSUB,XMTEXT,XMY,XMZ
+10 NEW SDSITE,SDETIME,SDTEXT,LINECT
+11 SET SDSITE=$$SITE^VASITE
+12 SET SDETIME=$$NOW^XLFDT
+13 SET XMDUZ="Untransmitted Encounters Re-queue"
+14 SET XMSUB="Patch SD*5.3*747 Pandemic ERI (Encounter Transmissions)"
+15 SET XMTEXT="^TMP(""SD53747P"",$J,"
+16 SET XMY(DUZ)=""
+17 SET ^TMP("SD53747P",$JOB,1)=""
+18 SET ^TMP("SD53747P",$JOB,2)=" Facility Name: "_$PIECE(SDSITE,U,2)
+19 SET ^TMP("SD53747P",$JOB,3)=" Station Number: "_$PIECE(SDSITE,U,3)
+20 SET ^TMP("SD53747P",$JOB,4)=""
+21 SET ^TMP("SD53747P",$JOB,5)=" Date/Time job started: "_$$FMTE^XLFDT(SDSTIME)
+22 SET ^TMP("SD53747P",$JOB,6)=" Date/Time job stopped: "_$$FMTE^XLFDT(SDETIME)
+23 SET ^TMP("SD53747P",$JOB,7)=""
+24 SET ^TMP("SD53747P",$JOB,9)="Total untransmitted encounters re-queued : "_SDREQ
+25 SET ^TMP("SD53747P",$JOB,10)="Please Note: There is no user intervention required with the re-transmission"
+26 SET ^TMP("SD53747P",$JOB,11)="of the untransmitted encounters. They will be retransmitted via the nightly"
+27 SET ^TMP("SD53747P",$JOB,12)="background job that is scheduled at your site."
+28 DO ^XMD
KILL ^TMP("SD53747P",$JOB),XMY
+29 QUIT
FLG(SDXMT) ; Entry point for Reflag Transmission protocol
+1 NEW SDRTN
+2 SET SDRTN=$$VALIDATE^SCMSVUT2(SDXMT)
+3 IF SDRTN<0
QUIT
+4 SET SDRTN=$$SETRFLG(SDXMT)
+5 IF SDRTN<0
DO MES^XPDUTL("There was a problem reflagging the transmission for "_SDXMT)
+6 QUIT
+7 ;
SETRFLG(SDXMT) ;
+1 ; Input
+2 ; SDXMT - Pointer to Transmission File, #409.73
+3 ;
+4 ; Output
+5 ; -1 - There was a problem reflagging the transmission
+6 ; 0 - No errors occurred
+7 ; 1 - The entry is already flagged for transmission
+8 ;
+9 NEW SDRSLT,SDSTAT
+10 SET SDRSLT=-1
+11 SET SDSTAT=$PIECE($GET(^SD(409.73,SDXMT,0)),U,4)
+12 IF SDSTAT
SET SDRSLT=1
+13 IF '$TEST
Begin DoDot:1
+14 DO XMITFLAG^SCDXFU01(SDXMT,0)
DO STREEVNT^SCDXFU01(SDXMT,0)
+15 SET SDRSLT=0
End DoDot:1
+16 QUIT SDRSLT
+17 ;