source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SD11STOP.m@ 1147

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

initial load of WorldVistAEHR

File size: 7.3 KB
Line 
1SD11STOP ;ALB/CAW,GTS,ESD,JAM - Stop Code/DSS Identifier Update 10/12/06
2 ;;5.3;Scheduling;**494**;AUG 13, 1993;Build 2
3 ;
4 ;** This patch is used as a Post-Init in a KIDS build to modify the
5 ;** the DSS Identifier file [^DIC(40.7,]
6 ;
7EN ;** Add/inactivate/change/reactivate DSS IDs (stop codes)
8 ;** The following code executes if file modifications exist
9 ;
10 N SDVAR
11 D:$P($T(NEW+1),";;",2)'="QUIT" ADD
12 D:$P($T(OLD+1),";;",2)'="QUIT" INACT
13 D:$P($T(CHNG+1),";;",2)'="QUIT" CHANGE
14 D:$P($T(CDR+1),";;",2)'="QUIT" CDRNUM
15 D:$P($T(ACT+1),";;",2)'="QUIT" REACT
16 D:$P($T(REST+1),";;",2)'="QUIT" RESTR
17 Q
18 ;
19 ;
20ADD ;** Add DSS IDs
21 ;
22 ; SDXX is in format:
23 ; STOP CODE NAME^AMIS #^RESTRICTION TYPE^REST. DATE^CDR #
24 ;
25 N SDX,SDXX
26 S SDVAR=1
27 D MES^XPDUTL("")
28 D BMES^XPDUTL(">>> Adding new Clinic Stops (DSS IDs) to CLINIC STOP File (#40.7)...")
29 ;
30 ;** NOTE: The following line is for DSS IDs that are not yet active
31 D BMES^XPDUTL(" [NOTE: These Stop Codes CANNOT be used UNTIL 05/1/06]")
32 S DIC(0)="L",DLAYGO=40.7,DIC="^DIC(40.7,"
33 F SDX=1:1 K DD,DO,DA S SDXX=$P($T(NEW+SDX),";;",2) Q:SDXX="QUIT" DO
34 .S DIC("DR")="1////"_$P(SDXX,"^",2)_$S('+$P(SDXX,U,5):"",1:";4////"_$P(SDXX,"^",5))
35 .S DIC("DR")=DIC("DR")_";5////"_$P(SDXX,"^",3)_";6///"_$P(SDXX,"^",4)
36 .S X=$P(SDXX,"^",1)
37 .I '$D(^DIC(40.7,"C",$P(SDXX,"^",2))) D FILE^DICN,MESS Q
38 .I $D(^DIC(40.7,"C",$P(SDXX,"^",2))) D EDIT(SDXX),MESSEX
39 K DIC,DLAYGO,X
40 Q
41 ;
42EDIT(SDXX) ;- Edit fields w/new values if stop code record already exists
43 ;
44 Q:$G(SDXX)=""
45 N DA,DIE,DLAYGO,DR
46 S DA=+$O(^DIC(40.7,"C",+$P(SDXX,"^",2),0))
47 Q:'DA
48 S DIE="^DIC(40.7,",DR=".01////"_$P(SDXX,"^")_";1////"_$P(SDXX,"^",2)_";2////@"_$S('+$P(SDXX,U,5):"",1:";4////"_$P(SDXX,"^",5))_";5////"_$P(SDXX,"^",3)_";6///"_$P(SDXX,"^",4)
49 D ^DIE
50 Q
51INACT ;** Inactivate DSS IDs
52 ;
53 ; SDXX is in format:
54 ; AMIS #^^INACTIVATION DATE (in FileMan format)
55 ;
56 N SDX,SDDA,SDXX,SDINDT,SDEXDT
57 S SDVAR=1
58 D MES^XPDUTL("")
59 D BMES^XPDUTL(">>> Inactivating Clinic Stops (DSS IDs) in CLINIC STOP File (#40.7)...")
60 D BMES^XPDUTL(" [NOTE: These Stop Codes CANNOT be used AFTER the indicated inactivation date]")
61 F SDX=1:1 K DD,DO,DA S SDXX=$P($T(OLD+SDX),";;",2) Q:SDXX="QUIT" DO
62 . I +$P(SDXX,"^",3) D
63 .. S X=$P(SDXX,"^",3)
64 .. ;
65 .. ;- Validate date passed in
66 .. S %DT="FTX"
67 .. D ^%DT
68 .. Q:Y<0
69 .. S SDINDT=Y
70 .. D DD^%DT
71 .. S SDEXDT=Y
72 .. S SDDA=+$O(^DIC(40.7,"C",+SDXX,0))
73 .. I $D(^DIC(40.7,SDDA,0)) D
74 ... S DA=SDDA,DR="2////^S X=SDINDT",DIE="^DIC(40.7,"
75 ... D ^DIE,MESI(SDEXDT)
76 K %,%H,%I,DR,DA,DIC,DIE,DLAYGO,X,%DT,Y
77 Q
78 ;
79CHANGE ;** Change DSS ID names
80 ;
81 ; SDXX is in format:
82 ; STOP CODE NAME^AMIS #^^NEW STOP CODE NAME
83 ;
84 N SDX,SDXX,SDDA
85 S SDVAR=1
86 D MES^XPDUTL("")
87 D BMES^XPDUTL(">>> Changing Clinic Stop (DSS ID) names in CLINIC STOP File (#40.7)...")
88 F SDX=1:1 K DD,DO,DA S SDXX=$P($T(CHNG+SDX),";;",2) Q:SDXX="QUIT" DO
89 .S SDDA=+$O(^DIC(40.7,"C",$P(SDXX,U,2),0))
90 .I $D(^DIC(40.7,SDDA,0)) DO
91 ..S DA=SDDA,DR=".01///"_$P(SDXX,U,4),DIE="^DIC(40.7,"
92 ..D ^DIE,MESC
93 K DIE,DR,DA
94 Q
95 ;
96CDRNUM ;** Change CDR numbers
97 ;
98 ; SDXX is in format:
99 ; STOP CODE NAME (AMIS #) ^ AMIS # ^ OLD CDR # ^ NEW CDR #
100 ;
101 N SDX,SDXX,SDDA
102 S SDVAR=2
103 D MES^XPDUTL("")
104 D BMES^XPDUTL(">>> Changing CDR numbers in CLINIC STOP File (#40.7)...")
105 F SDX=1:1 K DD,DO,DA S SDXX=$P($T(CDR+SDX),";;",2) Q:SDXX="QUIT" DO
106 .S SDDA=+$O(^DIC(40.7,"C",$P(SDXX,U,2),0))
107 .I $D(^DIC(40.7,SDDA,0)) DO
108 ..S DA=SDDA,DR="4///"_$P(SDXX,U,4),DIE="^DIC(40.7,"
109 ..D ^DIE,MESN
110 K DIE,DR,DA,X
111 Q
112 ;
113REACT ;** Reactivate DSS IDs
114 ;
115 ; SDXX is in format:
116 ; AMIS #^
117 ;
118 N SDX,SDDA,SDXX
119 ;S SDDA=+$O(^DIC(40.7,"C",510,0)) I $P($G(^DIC(40.7,SDDA,0)),"^",3)="" Q
120 S SDVAR=1
121 D MES^XPDUTL("")
122 D BMES^XPDUTL(">>> Reactivating Clinic Stops (DSS IDs) in CLINIC STOP File (#40.7)...")
123 F SDX=1:1 K DD,DO,DA S SDXX=$P($T(ACT+SDX),";;",2) Q:SDXX="QUIT" DO
124 .S SDDA=+$O(^DIC(40.7,"C",+SDXX,0))
125 .I $P($G(^DIC(40.7,SDDA,0)),"^",3)'="" DO
126 .. S $P(^DIC(40.7,SDDA,0),"^",3)=""
127 ..D MESA
128 Q
129 ;
130RESTR ;** Change Restriction Data
131 ;
132 ; SDXX is in format:
133 ; STOP CODE NAME^STOP CODE NUMBER^RESTRICTION TYPE^RESTRICTION DATE
134 ;
135 N SDX,SDXX,SDDA
136 S SDVAR=3
137 D MES^XPDUTL("")
138 D BMES^XPDUTL(">>> Changing Restriction Data in CLINIC STOP File (#40.7)...")
139 F SDX=1:1 K DD,DO,DA S SDXX=$P($T(REST+SDX),";;",2) Q:SDXX="QUIT" D
140 .S SDDA=+$O(^DIC(40.7,"C",$P(SDXX,U,2),0))
141 .I $D(^DIC(40.7,SDDA,0)) D
142 ..S DA=SDDA,DR="5////"_$P(SDXX,U,3)_";6///"_$P(SDXX,U,4),DIE="^DIC(40.7,"
143 ..D ^DIE,MESR
144 ..S $P(^DIC(40.7,SDDA,0),"^",7)=""
145 K DIE,DR,DA,X
146 Q
147 ;
148MESS ;** Add message
149 N ECXADMSG
150 I +$G(SDVAR) D HDR(SDVAR)
151 D MES^XPDUTL(" ")
152 S ECXADMSG="Added: "_$P(SDXX,"^",2)_" "_$P(SDXX,"^")
153 I $P(SDXX,"^",5)'="" S ECXADMSG=ECXADMSG_" [CDR#: "_$P(SDXX,"^",5)_"]"
154 D MES^XPDUTL(ECXADMSG)
155 I $P(SDXX,"^",3)'="" S ECXADMSG=" Restricted Type: "_$P(SDXX,"^",3)_" Restricted Date: "_$P(SDXX,"^",4)
156 D MES^XPDUTL(ECXADMSG)
157 K SDVAR
158 Q
159 ;
160MESSEX ;** Display message if stop code already exists
161 N ECXADMSG
162 I +$G(SDVAR) D HDR(SDVAR)
163 D MES^XPDUTL(" ")
164 S ECXADMSG=" "_$P(SDXX,"^",2)_" "_$P(SDXX,"^")_" already exists."
165 D MES^XPDUTL(ECXADMSG)
166 K SDVAR
167 Q
168 ;
169MESI(SDEXDT) ;** Inactivate message
170 ;
171 ; Parameter:
172 ; SDEXDT - Date inactivation affective (External Format)
173 ;
174 N SDINMSG
175 I +$G(SDVAR) D HDR(SDVAR)
176 I $G(SDEXDT)="" S SDEXDT="UNKNOWN"
177 D MES^XPDUTL(" ")
178 S SDINMSG="Inactivated: "_+SDXX_" "_$P($G(^DIC(40.7,SDDA,0)),"^")_" as of "_SDEXDT
179 D MES^XPDUTL(SDINMSG)
180 K SDVAR
181 Q
182 ;
183MESA ;** Reactivate message
184 ;
185 N SDACMSG
186 I +$G(SDVAR) D HDR(SDVAR)
187 D MES^XPDUTL(" ")
188 S SDACMSG="Reactivated: "_+SDXX_" "_$P($G(^DIC(40.7,SDDA,0)),"^")
189 D MES^XPDUTL(SDACMSG)
190 K SDVAR
191 Q
192 ;
193MESC ;** Change message
194 N SDCMSG,SDCMSG1
195 I +$G(SDVAR) D HDR(SDVAR)
196 D MES^XPDUTL(" ")
197 S SDCMSG="Changed: "_$P(SDXX,U,2)_" "_$P(SDXX,U)
198 S SDCMSG1=" to: "_$P(SDXX,U,2)_" "_$P(SDXX,U,4)
199 D MES^XPDUTL(SDCMSG)
200 D MES^XPDUTL(SDCMSG1)
201 K SDVAR
202 Q
203 ;
204MESN ;** Change number
205 N SDNMSG,SDNMSG1
206 I +$G(SDVAR) D HDR(SDVAR)
207 D MES^XPDUTL(" ")
208 S SDNMSG=" Changed: "_$P(SDXX,U,2)_" "_$P(SDXX,U)
209 S SDNMSG1=" : "_$P(SDXX,U,3)_" Date: "_$P(SDXX,U,5)
210 D MES^XPDUTL(SDNMSG)
211 D MES^XPDUTL(SDNMSG1)
212 K SDVAR
213 Q
214MESR ;** Restricting Stop Code
215 N SDNMSG,SDNMSG1
216 I +$G(SDVAR) D HDR(SDVAR)
217 D MES^XPDUTL(" ")
218 S SDNMSG="Changed: "_$P(SDXX,U,2)_" "_$P(SDXX,U)_" "_$P(SDXX,U,5)_" "_$P(SDXX,U,6)
219 S SDNMSG1=" to: "_$P(SDXX,U,3)_" "_$P(SDXX,U,4)
220 D MES^XPDUTL(SDNMSG)
221 D MES^XPDUTL(SDNMSG1)
222 K SDVAR
223 Q
224 ;
225HDR(SDVAR) ;- Header
226 Q:'$G(SDVAR)
227 N SDHDR
228 S SDHDR=$P($T(@("HDR"_SDVAR)),";;",2)
229 D BMES^XPDUTL(SDHDR)
230 Q
231 ;
232 ;
233HDR1 ;; Stop Code Name
234 ;
235HDR2 ;; CDR Stop Code Name
236 ;
237HDR3 ;; Stop Code Name Rest. Type Date
238 ;
239NEW ;DSS IDs to add- ex ;;STOP CODE NAME^NUMBER^RESTRICTION TYPE^RESTRICTION DATE^CDR
240 ;;QUIT
241 ;
242OLD ;DSS IDs to be inactivated- ex. ;;AMIS NUMBER^^INACTIVE DATE
243 ;;QUIT
244 ;
245CHNG ;DSS ID name changes- example ;;STOP CODE NAME^NUMBER^^NEW NAME
246 ;;QUIT
247 ;
248CDR ;CDR account change- ex. ;;STOP CODE NAME^NUMBER^CDR # (old)^CDR# (new)
249 ;;QUIT
250 ;
251ACT ;DSS IDs to be reactivated- example ;;NUMBER^
252 ;;QUIT
253REST ;Change restriction - ;;STOP CODE NAME^NUMBER^REST TYPE^RES DATE^OLD
254 ;;COMPLEMENTARY & ALTERNATIVE RX^159^E^^
255 ;;QUIT
Note: See TracBrowser for help on using the repository browser.