SCDXRT01 ;ALB/JRP - AMB CARE RETRANSMISSION ;5/9/96
;;5.3;Scheduling;**44,640**;AUG 13, 1993;Build 8
;
RTRNRNG ;Mark all [Deleted] Outpatient Encounters for a user specified
; date range for retransmission to the National Ambulatory Care
; Database
;
;Input : None
;Output : None
;Note : User is prompted for the date range to retransmit
; : Encounters that are not contained in the Transmitted
; Outpatient Encounter file (#409.73) can not be
; retransmitted
; : [Deleted] Encounters that occurred before switching to new
; transmission format can not be retransmitted
; : [Deleted] Encounters that occurred within the last two days
; can not be retransmitted
;
;SD*640 Stop retransmit by date range
Q
;
;Declare variables
N MINDT,MAXDT,SCDXSTRT,SCDXEND,HELPTXT,X,%H,%,%I
N ZTSK,ZTDESC,ZTRTN,ZTIO,ZTDTH
W !!
;Cut-off date for old transmission format is earliest date
; allowed for retransmission (default to 10/1/96)
S MINDT=+$P($G(^SD(404.91,1,"AMB")),"^",2)
S:('MINDT) MINDT=2961001
;Today is the latest date allowed for retransmission
D NOW^%DTC
S MAXDT=X
;Set up help text for getting beginning and ending dates
S HELPTXT("BGN")="Enter the beginning date for retransmitting encounters"
S HELPTXT("END")="Enter the ending date for retransmitting encounters"
;Get beginning and ending dates
S X=$$GETDTRNG^SCDXUTL1(MINDT,MAXDT,"HELPTXT(""BGN"")","HELPTXT(""END"")")
;User abort / time out
Q:(X<0)
W !!
;Verify that user wants to do this
S SCDXSTRT=$P(X,"^",1)
S SCDXEND=$P(X,"^",2)
S DIR("A",1)=" "
S DIR("A",2)=" "
S X=(+$E(SCDXSTRT,4,5))_"/"_(+$E(SCDXSTRT,6,7))_"/"_(1700+$E(SCDXSTRT,1,3))
S DIR("A",3)="All outpatient encounters that occurred between "_X
S X=(+$E(SCDXEND,4,5))_"/"_(+$E(SCDXEND,6,7))_"/"_(1700+$E(SCDXEND,1,3))
S DIR("A",4)="and "_X_" will be marked for retransmission to the"
S DIR("A",5)="National Patient Care Database."
S DIR("A",6)=" "
S DIR("A",7)=" "
S DIR("A")="Are you sure you want to do this ? "
S DIR(0)="YA"
D ^DIR
;Not verified / user abort / time out
Q:('Y)
;Queue marking for retransmission
S ZTRTN="TASKRX^SCDXRT01"
S ZTDESC="Mark [Deleted] Outpatient Encounters for retransmission"
S ZTDTH=$H
S ZTIO=""
S ZTSAVE("SCDXSTRT")=SCDXSTRT
S ZTSAVE("SCDXEND")=SCDXEND
K ZTSK D ^%ZTLOAD
W:('$G(ZTSK)) !!,"** UNABLE TO QUEUE MARKING OF ENCOUNTERS FOR RETRANSMISSION **",!!
W:($G(ZTSK)) !!,"Marking of encounters for retransmission queued as task number ",ZTSK
W !!
Q
;
TASKRX ;Mark all [Deleted] Outpatient Encounters in a given date range
; for retransmission
;
;Input : SCDXSTRT - Date to begin marking encounters from
; (FileMan format) (Required)
; SCDXEND - Date to end marking encounters at
; (FileMan format) (Required)
;Output : None
;Notes : Encounters that are not contained in the Transmitted
; Outpatient Encounter file (#409.73) can not be
; retransmitted
; : This entry point should be used when marking for
; retransmission is being queued. If queued, ZTSTOP will
; be set accordingly.
;
;Check input
Q:('$G(SCDXSTRT))
Q:('$G(SCDXEND))
;Declare variables
N JUNK
;Call module to mark entries for retransmission
S JUNK=$$REXMIT(SCDXSTRT,SCDXEND)
;Set ZTSTOP accordingly
S:($P(JUNK,"^",4)) ZTSTOP=1
;Done
Q
;
REXMIT(STARTDT,ENDDT) ;Mark all [Deleted] Outpatient Encounters in a
; given date range for retransmission
;
;Input : STARTDT - Date to begin marking encounters from
; (FileMan format) (Required)
; ENDDT - Date to end marking encounters at (FileMan format)
; (Required)
;Output : Tot^Enc^Del^Stop - Number of [deleted] encounters marked for
; retransmission
; Tot - Total number of encounters marked
; Enc - Number of existing encounters marked
; Del - Number of deleted encounters marked
; Stop - Flag indicating if task was asked to stop
; 1 = Task was asked to stop
; 0 = Task was not asked to stop
; 0 - No encounters marked / bad input
;Notes : Encounters that are not contained in the Transmitted
; Outpatient Encounter file (#409.73) can not be
; retransmitted
;
;Check input
S STARTDT=+$G(STARTDT)
Q:('STARTDT)
S ENDDT=+$G(ENDDT)
Q:('ENDDT)
;Declare variables
N XMITPTR,ENCPTR,DELPTR,ENCDATE,EVNTDATE,DELCNT,ENCCNT,STOP,LOOP
S STOP=0
;Add one second before midnight to ending date
S ENDDT=ENDDT+.235959
;Find all deleted encounters that fall in date range
S ENCDATE=STARTDT-.000001
S DELCNT=0
F LOOP=1:1 S ENCDATE=+$O(^SD(409.74,"B",ENCDATE)) Q:(('ENCDATE)!(ENCDATE>ENDDT)) D Q:(STOP)
.;Check for request to stop
.I ('(LOOP#10)) S STOP=$$S^%ZTLOAD(DELCNT_" encounters have been marked for retransmission") Q:(STOP)
.S DELPTR=0
.F S DELPTR=+$O(^SD(409.74,"B",ENCDATE,DELPTR)) Q:('DELPTR) D
..;Find entry in Transmitted Outpatient Encounter file
..S XMITPTR=+$O(^SD(409.73,"ADEL",DELPTR,0))
..;Entry not found - don't retransmit
..Q:('XMITPTR)
..;Mark entry for retransmission
..D STREEVNT^SCDXFU01(XMITPTR,0)
..;Turn on transmission flag
..D XMITFLAG^SCDXFU01(XMITPTR)
..;Increment count of deleted encounters marked
..S DELCNT=DELCNT+1
;Task was asked to stop - abort
Q:(STOP) DELCNT_"^^"_DELCNT_"^1"
;Find all encounters that fall in date range
S ENCCNT=0
S ENCDATE=STARTDT-.000001
F LOOP=1:1 S ENCDATE=+$O(^SCE("B",ENCDATE)) Q:(('ENCDATE)!(ENCDATE>ENDDT)) D Q:(STOP)
.;Check for request to stop
.I ('(LOOP#10)) S STOP=$$S^%ZTLOAD((ENCCNT+DELCNT)_" encounters have been marked for retransmission") Q:(STOP)
.S ENCPTR=0
.F S ENCPTR=+$O(^SCE("B",ENCDATE,ENCPTR)) Q:('ENCPTR) D
..;Find entry in Transmitted Outpatient Encounter file
..S XMITPTR=+$O(^SD(409.73,"AENC",ENCPTR,0))
..;Entry not found - don't retransmit
..Q:('XMITPTR)
..;Mark entry for retransmission
..D STREEVNT^SCDXFU01(XMITPTR,0)
..;Turn on transmission flag
..D XMITFLAG^SCDXFU01(XMITPTR)
..;Increment count of encounters marked
..S ENCCNT=ENCCNT+1
;Done
Q (DELCNT+ENCCNT)_"^"_ENCCNT_"^"_DELCNT_"^"_STOP
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCDXRT01 6369 printed Nov 22, 2024@17:49:27 Page 2
SCDXRT01 ;ALB/JRP - AMB CARE RETRANSMISSION ;5/9/96
+1 ;;5.3;Scheduling;**44,640**;AUG 13, 1993;Build 8
+2 ;
RTRNRNG ;Mark all [Deleted] Outpatient Encounters for a user specified
+1 ; date range for retransmission to the National Ambulatory Care
+2 ; Database
+3 ;
+4 ;Input : None
+5 ;Output : None
+6 ;Note : User is prompted for the date range to retransmit
+7 ; : Encounters that are not contained in the Transmitted
+8 ; Outpatient Encounter file (#409.73) can not be
+9 ; retransmitted
+10 ; : [Deleted] Encounters that occurred before switching to new
+11 ; transmission format can not be retransmitted
+12 ; : [Deleted] Encounters that occurred within the last two days
+13 ; can not be retransmitted
+14 ;
+15 ;SD*640 Stop retransmit by date range
+16 QUIT
+17 ;
+18 ;Declare variables
+19 NEW MINDT,MAXDT,SCDXSTRT,SCDXEND,HELPTXT,X,%H,%,%I
+20 NEW ZTSK,ZTDESC,ZTRTN,ZTIO,ZTDTH
+21 WRITE !!
+22 ;Cut-off date for old transmission format is earliest date
+23 ; allowed for retransmission (default to 10/1/96)
+24 SET MINDT=+$PIECE($GET(^SD(404.91,1,"AMB")),"^",2)
+25 if ('MINDT)
SET MINDT=2961001
+26 ;Today is the latest date allowed for retransmission
+27 DO NOW^%DTC
+28 SET MAXDT=X
+29 ;Set up help text for getting beginning and ending dates
+30 SET HELPTXT("BGN")="Enter the beginning date for retransmitting encounters"
+31 SET HELPTXT("END")="Enter the ending date for retransmitting encounters"
+32 ;Get beginning and ending dates
+33 SET X=$$GETDTRNG^SCDXUTL1(MINDT,MAXDT,"HELPTXT(""BGN"")","HELPTXT(""END"")")
+34 ;User abort / time out
+35 if (X<0)
QUIT
+36 WRITE !!
+37 ;Verify that user wants to do this
+38 SET SCDXSTRT=$PIECE(X,"^",1)
+39 SET SCDXEND=$PIECE(X,"^",2)
+40 SET DIR("A",1)=" "
+41 SET DIR("A",2)=" "
+42 SET X=(+$EXTRACT(SCDXSTRT,4,5))_"/"_(+$EXTRACT(SCDXSTRT,6,7))_"/"_(1700+$EXTRACT(SCDXSTRT,1,3))
+43 SET DIR("A",3)="All outpatient encounters that occurred between "_X
+44 SET X=(+$EXTRACT(SCDXEND,4,5))_"/"_(+$EXTRACT(SCDXEND,6,7))_"/"_(1700+$EXTRACT(SCDXEND,1,3))
+45 SET DIR("A",4)="and "_X_" will be marked for retransmission to the"
+46 SET DIR("A",5)="National Patient Care Database."
+47 SET DIR("A",6)=" "
+48 SET DIR("A",7)=" "
+49 SET DIR("A")="Are you sure you want to do this ? "
+50 SET DIR(0)="YA"
+51 DO ^DIR
+52 ;Not verified / user abort / time out
+53 if ('Y)
QUIT
+54 ;Queue marking for retransmission
+55 SET ZTRTN="TASKRX^SCDXRT01"
+56 SET ZTDESC="Mark [Deleted] Outpatient Encounters for retransmission"
+57 SET ZTDTH=$HOROLOG
+58 SET ZTIO=""
+59 SET ZTSAVE("SCDXSTRT")=SCDXSTRT
+60 SET ZTSAVE("SCDXEND")=SCDXEND
+61 KILL ZTSK
DO ^%ZTLOAD
+62 if ('$GET(ZTSK))
WRITE !!,"** UNABLE TO QUEUE MARKING OF ENCOUNTERS FOR RETRANSMISSION **",!!
+63 if ($GET(ZTSK))
WRITE !!,"Marking of encounters for retransmission queued as task number ",ZTSK
+64 WRITE !!
+65 QUIT
+66 ;
TASKRX ;Mark all [Deleted] Outpatient Encounters in a given date range
+1 ; for retransmission
+2 ;
+3 ;Input : SCDXSTRT - Date to begin marking encounters from
+4 ; (FileMan format) (Required)
+5 ; SCDXEND - Date to end marking encounters at
+6 ; (FileMan format) (Required)
+7 ;Output : None
+8 ;Notes : Encounters that are not contained in the Transmitted
+9 ; Outpatient Encounter file (#409.73) can not be
+10 ; retransmitted
+11 ; : This entry point should be used when marking for
+12 ; retransmission is being queued. If queued, ZTSTOP will
+13 ; be set accordingly.
+14 ;
+15 ;Check input
+16 if ('$GET(SCDXSTRT))
QUIT
+17 if ('$GET(SCDXEND))
QUIT
+18 ;Declare variables
+19 NEW JUNK
+20 ;Call module to mark entries for retransmission
+21 SET JUNK=$$REXMIT(SCDXSTRT,SCDXEND)
+22 ;Set ZTSTOP accordingly
+23 if ($PIECE(JUNK,"^",4))
SET ZTSTOP=1
+24 ;Done
+25 QUIT
+26 ;
REXMIT(STARTDT,ENDDT) ;Mark all [Deleted] Outpatient Encounters in a
+1 ; given date range for retransmission
+2 ;
+3 ;Input : STARTDT - Date to begin marking encounters from
+4 ; (FileMan format) (Required)
+5 ; ENDDT - Date to end marking encounters at (FileMan format)
+6 ; (Required)
+7 ;Output : Tot^Enc^Del^Stop - Number of [deleted] encounters marked for
+8 ; retransmission
+9 ; Tot - Total number of encounters marked
+10 ; Enc - Number of existing encounters marked
+11 ; Del - Number of deleted encounters marked
+12 ; Stop - Flag indicating if task was asked to stop
+13 ; 1 = Task was asked to stop
+14 ; 0 = Task was not asked to stop
+15 ; 0 - No encounters marked / bad input
+16 ;Notes : Encounters that are not contained in the Transmitted
+17 ; Outpatient Encounter file (#409.73) can not be
+18 ; retransmitted
+19 ;
+20 ;Check input
+21 SET STARTDT=+$GET(STARTDT)
+22 if ('STARTDT)
QUIT
+23 SET ENDDT=+$GET(ENDDT)
+24 if ('ENDDT)
QUIT
+25 ;Declare variables
+26 NEW XMITPTR,ENCPTR,DELPTR,ENCDATE,EVNTDATE,DELCNT,ENCCNT,STOP,LOOP
+27 SET STOP=0
+28 ;Add one second before midnight to ending date
+29 SET ENDDT=ENDDT+.235959
+30 ;Find all deleted encounters that fall in date range
+31 SET ENCDATE=STARTDT-.000001
+32 SET DELCNT=0
+33 FOR LOOP=1:1
SET ENCDATE=+$ORDER(^SD(409.74,"B",ENCDATE))
if (('ENCDATE)!(ENCDATE>ENDDT))
QUIT
Begin DoDot:1
+34 ;Check for request to stop
+35 IF ('(LOOP#10))
SET STOP=$$S^%ZTLOAD(DELCNT_" encounters have been marked for retransmission")
if (STOP)
QUIT
+36 SET DELPTR=0
+37 FOR
SET DELPTR=+$ORDER(^SD(409.74,"B",ENCDATE,DELPTR))
if ('DELPTR)
QUIT
Begin DoDot:2
+38 ;Find entry in Transmitted Outpatient Encounter file
+39 SET XMITPTR=+$ORDER(^SD(409.73,"ADEL",DELPTR,0))
+40 ;Entry not found - don't retransmit
+41 if ('XMITPTR)
QUIT
+42 ;Mark entry for retransmission
+43 DO STREEVNT^SCDXFU01(XMITPTR,0)
+44 ;Turn on transmission flag
+45 DO XMITFLAG^SCDXFU01(XMITPTR)
+46 ;Increment count of deleted encounters marked
+47 SET DELCNT=DELCNT+1
End DoDot:2
End DoDot:1
if (STOP)
QUIT
+48 ;Task was asked to stop - abort
+49 if (STOP)
QUIT DELCNT_"^^"_DELCNT_"^1"
+50 ;Find all encounters that fall in date range
+51 SET ENCCNT=0
+52 SET ENCDATE=STARTDT-.000001
+53 FOR LOOP=1:1
SET ENCDATE=+$ORDER(^SCE("B",ENCDATE))
if (('ENCDATE)!(ENCDATE>ENDDT))
QUIT
Begin DoDot:1
+54 ;Check for request to stop
+55 IF ('(LOOP#10))
SET STOP=$$S^%ZTLOAD((ENCCNT+DELCNT)_" encounters have been marked for retransmission")
if (STOP)
QUIT
+56 SET ENCPTR=0
+57 FOR
SET ENCPTR=+$ORDER(^SCE("B",ENCDATE,ENCPTR))
if ('ENCPTR)
QUIT
Begin DoDot:2
+58 ;Find entry in Transmitted Outpatient Encounter file
+59 SET XMITPTR=+$ORDER(^SD(409.73,"AENC",ENCPTR,0))
+60 ;Entry not found - don't retransmit
+61 if ('XMITPTR)
QUIT
+62 ;Mark entry for retransmission
+63 DO STREEVNT^SCDXFU01(XMITPTR,0)
+64 ;Turn on transmission flag
+65 DO XMITFLAG^SCDXFU01(XMITPTR)
+66 ;Increment count of encounters marked
+67 SET ENCCNT=ENCCNT+1
End DoDot:2
End DoDot:1
if (STOP)
QUIT
+68 ;Done
+69 QUIT (DELCNT+ENCCNT)_"^"_ENCCNT_"^"_DELCNT_"^"_STOP