source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCDXRT01.m@ 824

Last change on this file since 824 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 6.0 KB
Line 
1SCDXRT01 ;ALB/JRP - AMB CARE RETRANSMISSION;09-MAY-1996
2 ;;5.3;Scheduling;**44**;AUG 13, 1993
3 ;
4RTRNRNG ;Mark all [Deleted] Outpatient Encounters for a user specified
5 ; date range for retransmission to the National Ambulatory Care
6 ; Database
7 ;
8 ;Input : None
9 ;Output : None
10 ;Note : User is prompted for the date range to retransmit
11 ; : Encounters that are not contained in the Transmitted
12 ; Outpatient Encounter file (#409.73) can not be
13 ; retransmitted
14 ; : [Deleted] Encounters that occurred before switching to new
15 ; transmission format can not be retransmitted
16 ; : [Deleted] Encounters that occurred within the last two days
17 ; can not be retransmitted
18 ;
19 ;Declare variables
20 N MINDT,MAXDT,SCDXSTRT,SCDXEND,HELPTXT,X,%H,%,%I
21 N ZTSK,ZTDESC,ZTRTN,ZTIO,ZTDTH
22 W !!
23 ;Cut-off date for old transmission format is earliest date
24 ; allowed for retransmission (default to 10/1/96)
25 S MINDT=+$P($G(^SD(404.91,1,"AMB")),"^",2)
26 S:('MINDT) MINDT=2961001
27 ;Today is the latest date allowed for retransmission
28 D NOW^%DTC
29 S MAXDT=X
30 ;Set up help text for getting beginning and ending dates
31 S HELPTXT("BGN")="Enter the beginning date for retransmitting encounters"
32 S HELPTXT("END")="Enter the ending date for retransmitting encounters"
33 ;Get beginning and ending dates
34 S X=$$GETDTRNG^SCDXUTL1(MINDT,MAXDT,"HELPTXT(""BGN"")","HELPTXT(""END"")")
35 ;User abort / time out
36 Q:(X<0)
37 W !!
38 ;Verify that user wants to do this
39 S SCDXSTRT=$P(X,"^",1)
40 S SCDXEND=$P(X,"^",2)
41 S DIR("A",1)=" "
42 S DIR("A",2)=" "
43 S X=(+$E(SCDXSTRT,4,5))_"/"_(+$E(SCDXSTRT,6,7))_"/"_(1700+$E(SCDXSTRT,1,3))
44 S DIR("A",3)="All outpatient encounters that occurred between "_X
45 S X=(+$E(SCDXEND,4,5))_"/"_(+$E(SCDXEND,6,7))_"/"_(1700+$E(SCDXEND,1,3))
46 S DIR("A",4)="and "_X_" will be marked for retransmission to the"
47 S DIR("A",5)="National Patient Care Database."
48 S DIR("A",6)=" "
49 S DIR("A",7)=" "
50 S DIR("A")="Are you sure you want to do this ? "
51 S DIR(0)="YA"
52 D ^DIR
53 ;Not verified / user abort / time out
54 Q:('Y)
55 ;Queue marking for retransmission
56 S ZTRTN="TASKRX^SCDXRT01"
57 S ZTDESC="Mark [Deleted] Outpatient Encounters for retransmission"
58 S ZTDTH=$H
59 S ZTIO=""
60 S ZTSAVE("SCDXSTRT")=SCDXSTRT
61 S ZTSAVE("SCDXEND")=SCDXEND
62 K ZTSK D ^%ZTLOAD
63 W:('$G(ZTSK)) !!,"** UNABLE TO QUEUE MARKING OF ENCOUNTERS FOR RETRANSMISSION **",!!
64 W:($G(ZTSK)) !!,"Marking of encounters for retransmission queued as task number ",ZTSK
65 W !!
66 Q
67 ;
68TASKRX ;Mark all [Deleted] Outpatient Encounters in a given date range
69 ; for retransmission
70 ;
71 ;Input : SCDXSTRT - Date to begin marking encounters from
72 ; (FileMan format) (Required)
73 ; SCDXEND - Date to end marking encounters at
74 ; (FileMan format) (Required)
75 ;Output : None
76 ;Notes : Encounters that are not contained in the Transmitted
77 ; Outpatient Encounter file (#409.73) can not be
78 ; retransmitted
79 ; : This entry point should be used when marking for
80 ; retransmission is being queued. If queued, ZTSTOP will
81 ; be set accordingly.
82 ;
83 ;Check input
84 Q:('$G(SCDXSTRT))
85 Q:('$G(SCDXEND))
86 ;Declare variables
87 N JUNK
88 ;Call module to mark entries for retransmission
89 S JUNK=$$REXMIT(SCDXSTRT,SCDXEND)
90 ;Set ZTSTOP accordingly
91 S:($P(JUNK,"^",4)) ZTSTOP=1
92 ;Done
93 Q
94 ;
95REXMIT(STARTDT,ENDDT) ;Mark all [Deleted] Outpatient Encounters in a
96 ; given date range for retransmission
97 ;
98 ;Input : STARTDT - Date to begin marking encounters from
99 ; (FileMan format) (Required)
100 ; ENDDT - Date to end marking encounters at (FileMan format)
101 ; (Required)
102 ;Output : Tot^Enc^Del^Stop - Number of [deleted] encounters marked for
103 ; retransmission
104 ; Tot - Total number of encounters marked
105 ; Enc - Number of existing encounters marked
106 ; Del - Number of deleted encounters marked
107 ; Stop - Flag indicating if task was asked to stop
108 ; 1 = Task was asked to stop
109 ; 0 = Task was not asked to stop
110 ; 0 - No encounters marked / bad input
111 ;Notes : Encounters that are not contained in the Transmitted
112 ; Outpatient Encounter file (#409.73) can not be
113 ; retransmitted
114 ;
115 ;Check input
116 S STARTDT=+$G(STARTDT)
117 Q:('STARTDT)
118 S ENDDT=+$G(ENDDT)
119 Q:('ENDDT)
120 ;Declare variables
121 N XMITPTR,ENCPTR,DELPTR,ENCDATE,EVNTDATE,DELCNT,ENCCNT,STOP,LOOP
122 S STOP=0
123 ;Add one second before midnight to ending date
124 S ENDDT=ENDDT+.235959
125 ;Find all deleted encounters that fall in date range
126 S ENCDATE=STARTDT-.000001
127 S DELCNT=0
128 F LOOP=1:1 S ENCDATE=+$O(^SD(409.74,"B",ENCDATE)) Q:(('ENCDATE)!(ENCDATE>ENDDT)) D Q:(STOP)
129 .;Check for request to stop
130 .I ('(LOOP#10)) S STOP=$$S^%ZTLOAD(DELCNT_" encounters have been marked for retransmission") Q:(STOP)
131 .S DELPTR=0
132 .F S DELPTR=+$O(^SD(409.74,"B",ENCDATE,DELPTR)) Q:('DELPTR) D
133 ..;Find entry in Transmitted Outpatient Encounter file
134 ..S XMITPTR=+$O(^SD(409.73,"ADEL",DELPTR,0))
135 ..;Entry not found - don't retransmit
136 ..Q:('XMITPTR)
137 ..;Mark entry for retransmission
138 ..D STREEVNT^SCDXFU01(XMITPTR,0)
139 ..;Turn on transmission flag
140 ..D XMITFLAG^SCDXFU01(XMITPTR)
141 ..;Increment count of deleted encounters marked
142 ..S DELCNT=DELCNT+1
143 ;Task was asked to stop - abort
144 Q:(STOP) DELCNT_"^^"_DELCNT_"^1"
145 ;Find all encounters that fall in date range
146 S ENCCNT=0
147 S ENCDATE=STARTDT-.000001
148 F LOOP=1:1 S ENCDATE=+$O(^SCE("B",ENCDATE)) Q:(('ENCDATE)!(ENCDATE>ENDDT)) D Q:(STOP)
149 .;Check for request to stop
150 .I ('(LOOP#10)) S STOP=$$S^%ZTLOAD((ENCCNT+DELCNT)_" encounters have been marked for retransmission") Q:(STOP)
151 .S ENCPTR=0
152 .F S ENCPTR=+$O(^SCE("B",ENCDATE,ENCPTR)) Q:('ENCPTR) D
153 ..;Find entry in Transmitted Outpatient Encounter file
154 ..S XMITPTR=+$O(^SD(409.73,"AENC",ENCPTR,0))
155 ..;Entry not found - don't retransmit
156 ..Q:('XMITPTR)
157 ..;Mark entry for retransmission
158 ..D STREEVNT^SCDXFU01(XMITPTR,0)
159 ..;Turn on transmission flag
160 ..D XMITFLAG^SCDXFU01(XMITPTR)
161 ..;Increment count of encounters marked
162 ..S ENCCNT=ENCCNT+1
163 ;Done
164 Q (DELCNT+ENCCNT)_"^"_ENCCNT_"^"_DELCNT_"^"_STOP
Note: See TracBrowser for help on using the repository browser.