source: ePrescribing/trunk/p/C0PREFIL.m@ 1800

Last change on this file since 1800 was 1595, checked in by George Lilly, 12 years ago

initial release of ePrescribing

File size: 15.1 KB
RevLine 
[1595]1C0PREFIL ; ERX/GPL - eRx Refill utilities ; 5/9/12 12:03am
2 ;;1.0;C0P;;Apr 25, 2012;Build 103
3 ;Copyright 2009,2010 George Lilly. Licensed under the terms of the GNU
4 ;General Public License See attached copy of the License.
5 ;
6 ;This program is free software; you can redistribute it and/or modify
7 ;it under the terms of the GNU General Public License as published by
8 ;the Free Software Foundation; either version 2 of the License, or
9 ;(at your option) any later version.
10 ;
11 ;This program is distributed in the hope that it will be useful,
12 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;GNU General Public License for more details.
15 ;
16 ;You should have received a copy of the GNU General Public License along
17 ;with this program; if not, write to the Free Software Foundation, Inc.,
18 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ;
20 Q
21 ;
22 ; TEST Lines below not intended for End Users. Programmers only.
23 ; BEWARE ZWRITE SYNTAX. It may not work in other M Implementations.
24TESTREQ(ZDUZ,ZDFN) ; TEST REFILL REQUEST
25 I '$D(ZDFN) S ZDFN=""
26 D REFREQ("ZG",ZDUZ,ZDFN)
27 W !
28 ZWRITE C0PRXML
29 Q
30 ;
31REFREQ(GRTN,IDUZ,IDFN) ; MAKE A WEB SERVICE CALL TO GENERATE A REFIL REQUEST
32 ;
33 N GPL,C0PFARY,GVOR
34 D ENCREQ("GPL",IDUZ,IDFN)
35 S GVOR("XMLIN")=GPL
36 S GVOR("ORIG-FILL-DATE")=""
37 S GVOR("CREATE-MED-YN")="0"
38 ;D EN^C0PMAIN("GG","GURL",IDUZ,IDFN,"GENREFILL","GVOR")
39 D INITXPF^C0PWS2("C0PFARY")
40 D SOAP^C0PWS2("GRTN","GENREFILL",IDUZ,IDFN,"GVOR")
41 ;D SOAP^C0CSOAP("GRTN","GENREFILL",,,"GG","C0PFARY") ;
42 Q
43 ;
44ENCREQ(ZRTN,ZDUZ,ZDFN) ; ENCODE AN NCSCRIPT RENEWAL REQUEST
45 ;
46 D GENTEST("GPL","GURL",ZDUZ,ZDFN,1)
47 ;S ZI=""
48 ;S GPL(1)="RxInput="_GPL(1)
49 S ZI=0 ;
50 ;F S ZI=$O(GPL(ZI)) Q:ZI="" D ; MAKE IT XML SAFE
51 ;. S GPL(ZI)=$$SYMENC^MXMLUTL(GPL(ZI))
52 ;. W !,GPL(ZI)
53 S ZI=0
54 S G=""
55 K GPL(0) ; GET RID OF LINE COUNT
56 F S ZI=$O(GPL(ZI)) Q:ZI="" D ;
57 . S G=G_GPL(ZI)
58 S @ZRTN=$$ENCODE^RGUTUU(G)
59 ;S @ZRTN=G
60 Q
61 ;
62CERTTEST ; GENERATE XML FILES FOR NEWCROP CERTIFICATION
63 ;
64 N ZII
65 S ZDFN=18 ; TEST PATIENT TO USE
66 F ZII=154,155,156,157 D ; IENS OF SUBSCRIBER PROFILES
67 . D CERTONE(ZII,ZDFN)
68 Q
69 ;
70CERTONE(ZI,ZDFN) ; GENERATE ONE XML FILE
71 N ZN
72 D EN^C0PMAIN("C0PG1","G2",ZI,ZDFN) ; GET THE NCSCRIPT
73 S ZN=$P($P(^VA(200,ZI,0),U,1),",",2) ; GIVEN NAME OF USER
74 ; ON OUR SYSTEM THESE ARE ERX,DOCTOR ERX,MID-LEVEL ERX,NURSE AND ERX,MANAGER
75 S ZN=ZN_".xml" ; APPEND .xml extension
76 K C0PG1(0)
77 S ZDIR=^TMP("C0CCCR","ODIR")
78 W !,$$OUTPUT^C0CXPATH("C0PG1(1)",ZN,ZDIR)
79 Q
80 ;
81GENTEST(RTNXML,RTNURL,ZDUZ,ZDFN,ZFILE) ; GENERATE A TEST
82 ; CLICK-THROUGH HTLM FILE FOR
83 ; GENERATING REFILL REQUESTS , XML IS RETURNED IN RTN,PASSED BY NAME
84 ; IF ZFILE IS 1, THE FILE IS WRITTEN TO HOST FILE
85 D EN^C0PMAIN("C0PG1","G2",ZDUZ,ZDFN) ; GET THE NCSCRIPT
86 ;D GETMEDS("G6",ZDFN) ;GET MEDICATIONS
87 ;D QUERY^C0CXPATH("G6","//NewPrescription[1]","G7") ;JUST THE FIRST ONE
88 ;D INSERT^C0CXPATH("C0PG1","G7","//NCScript")
89 K C0PG1(0)
90 M @RTNXML=C0PG1 ;
91 S ZDIR=^TMP("C0CCCR","ODIR")
92 I $G(ZFILE)=1 W $$OUTPUT^C0CXPATH("C0PG1(1)","REFILL-"_ZDFN_".xml",ZDIR)
93 Q
94 ;
95GETMEDS(OUTARY,ZDFN) ; GET THE PATIENT'S MEDS AND PUT INTO XML
96 ;
97 N ZG,ZG2,ZB,ZN
98 S DEBUG=0
99 D GETTEMP^C0PWS2("ZG","OUTMEDS") ;GET THE MEDICATIONS TEMPLATE
100 D SOAP^C0PWS2("ZG2","GETMEDS",$$PRIMARY^C0PMAIN(),ZDFN) ; GET MEDS
101 I '$D(ZG2) Q ; SHOULDN'T HAPPEN
102 I ZG2(1,"Status")'="OK" D Q ; BAD RETURN FROM WEB SERVER
103 . W $G(ZG2(1,"Message")),!
104 N ZI S ZI=""
105 S ZN=$NA(^TMP("C0PREFIL",$J))
106 K @ZN
107 F S ZI=$O(ZG2(ZI)) Q:ZI="" D ; FOR EACH MED
108 . N ZV
109 . S ZV=$NA(@ZN@("DATA",ZI))
110 . S ZX=$NA(@ZN@("XML",ZI))
111 . S @ZV@("dispenseNumber")=$G(ZG2(ZI,"Dispense"))
112 . S @ZV@("dosage")="Take "_$G(ZG2(ZI,"DosageNumberDescription"))_" "_$G(ZG2(ZI,"Route"))_" "_$G(ZG2(ZI,"DosageFrequencyDescription"))
113 . S @ZV@("drugIdentifier")=ZG2(ZI,"DrugID")
114 . S @ZV@("drugIdentifierType")="FDB"
115 . S @ZV@("pharmacistMessage")="No childproof caps please"
116 . S @ZV@("pharmacyIdentifier")=1231212
117 . S @ZV@("refillCount")=ZG2(ZI,"Refills")
118 . S @ZV@("substitution")="SubstitutionAllowed"
119 . D MAP^C0CXPATH("ZG",ZV,ZX)
120 . D QUEUE^C0CXPATH("ZB",ZX,2,$O(@ZX@(""),-1))
121 D BUILD^C0CXPATH("ZB",OUTARY)
122 K @ZN ;CLEAN UP
123 Q
124 ;
125 ;B
126 ;
127 ;D GET^C0PCUR(.ZG2,ZDFN) ; GET THE MEDS FOR THIS PATIENT
128 ;D EXTRACT^C0CALERT("ZG",ZDFN,"ZG2","ALGYCBK^C0PALGY3(ALTVMAP,A1)")
129 S ZN=$O(ZR(""),-1) ;NUMBER OF LINES IN OUTPUT
130 D QUEUE^C0CXPATH("ZB","ZG2",2,ZN-1)
131 D BUILD^C0CXPATH("ZB",OUTARY)
132 Q
133 ;
134RGUIDS(ZARY,ZDUZ) ; RETURNS AN ARRAY OF ALL REFILL REQUEST GUIDS FOR
135 ; DUZ ZDUZ. ZARY IS PASSED BY NAME
136 ; FORMAT IS @ZARY@("GUID")=IEN
137 ; THIS ROUTINE IS REUSED FOR THE STATUS ROUTINE - INCOMPLETE ORDERS
138 N ZI,ZJ,ZK,ZL,ZM,ZN
139 S ZI=0
140 ;F S ZI=$O(^XTV(8992.1,"R",ZDUZ,ZI)) Q:ZI="" D ; ALL ALERT FOR DUZ
141 F S ZI=$O(^XTV(8992,ZDUZ,"XQA",ZI)) Q:ZI="" D ; USE XQA MULTIPLE
142 . S ZL=^XTV(8992,ZDUZ,"XQA",ZI,0) ;
143 . S ZM=$P(ZL,U,2) ; RECORD ID
144 . S ZN=$O(^XTV(8992.1,"B",ZM,"")) ;IEN OF ALERT TRACKING RECORD
145 . S ZK=$$GET1^DIQ(8992.1,ZN_",",.03)
146 . I ZK'["OR,1130" Q ; NOT OUR PACKAGE - ALL ERX ALERTS START WITH 1130
147 . ; 11305 IS FOR REFILLS
148 . ; 11306 IS FOR INCOMPLETE ORDERS
149 . S ZJ=""
150 . S ZJ=$$GET1^DIQ(8992.1,ZN_",",2)
151 . I ZJ="" Q
152 . ; FOR RENEWALS (11305) NEED TO PULL THE GUID OUT - IT IS THE FIRST PIECE
153 . ; OTHERWISE USE THE ENTIRE STRING. FOR INCOMPLETE ORDERS THIS WILL
154 . ; INCLUDE THE MED AND PRESCRIPTION DATE
155 . I ZK["OR,11305" S ZJ=$P(ZJ,"^",1) ; FIRST PIECE IS THE GUILD GUID^DOB^SEX
156 . S @ZARY@(ZJ)=ZN
157 Q
158 ;
159EN ; BATCH ENTRY POINT FOR REFILL (RENEWAL) STATUS AND FAILEDFAX CHECKING
160 D REFILL
161 K ZRSLT
162 ;D STATUS ; ALSO RUN CHECK FOR INCOMPLETE ORDERS
163 D FAILFAX ; ALSO RUN CHECK FOR FAILED FAXES
164 ; smh - C0PTRAK depends on code that's not available... won't use.
165 ; D RUNAWAY^C0PTRAK ; kill runaway jobs gpl 4/19/2012; smh comment out 5/9/2012
166 Q
167 ;
168 ; TEST Lines below not intended for End Users. Programmers only.
169 ; BEWARE ZWRITE SYNTAX. It may not work in other M Implementations.
170SHOW ; SHOW THE CURRENT REFILL ALERTS ON THE SYSTEM
171 ZWRITE ^XTV(8992,"AXQAN","OR,0,11305",*)
172 Q
173 ;
174REFILL ; PULL REFILL REQUESTS AND POST ALERTS
175 ;
176 N ZDUZ ; USER NUMBER UNDER WHICH WE BUILD THE WEB SERVICE CALL
177 N ZDFN ; PATIENT NUMBER USED TO BUILD THE WEB SERVICE CALL
178 S ZDUZ=$$PRIMARY^C0PMAIN() ; PRIMARY ERX USER FOR BATCH CALLS
179 ;S ZDUZ=DUZ ; SHOULD CHANGE THIS FOR PRODUCTION TO A "BATCH" USER
180 S ZDFN="" ; NO PATIENT NEEDED FOR THESE CALLS
181 ; S ZDFN=18 ; SHOULD NOT NEED THIS BE MAKE THE CALL - FIX IN EN^C0PMAIN
182 N ZRSLT
183 D SOAP^C0PWS2("ZRSLT","REFILLS",ZDUZ,ZDFN) ; WS CALL TO RETURN REFILS
184 ;S XXX=YYY ;
185 I $G(ZRSLT(1,"Status"))'="OK" Q ; NO ROWS WERE RETURNED
186 I $G(ZRSLT(1,"RowCount"))=0 Q ; NO ROWS WERE RETURNED
187 D NOTIPURG^XQALBUTL(11305) ; DELETE ALL CURRENT REFILL ALERTS
188 S C0PNPIF=$$GET1^DIQ(C0PAF,C0PACCT_",",8,"I") ; LEGACY FLAG TO USE NPI FOR SID
189 N ZI S ZI=0
190 N ZAPACK S ZAPACK="OR" ; ALERT PACKAGE CODE
191 N ZADFN S ZADFN=0 ; DFN TO ASSOCIATE ALERT WITH - WE DON'T KNOW THIS
192 N ZACODE S ZACODE=11305 ; IEN TO OE/RR NOTIFICATIONS file for eRx Refills
193 F S ZI=$O(ZRSLT(ZI)) Q:+ZI=0 D ; FOR EACH RETURNED REFILL REQUEST
194 . N ZSID S ZSID=ZRSLT(ZI,"ExternalDoctorId") ; NPI FOR SUBSCRIBER
195 . I C0PNPIF'=1 S ZDUZ=$O(^VA(200,"AC0PSID",ZSID,"")) ; GUID SID
196 . E S ZDUZ=$O(^VA(200,"C0PNPI",ZSID,"")) ; DUZ FOR SUBSCRIBER
197 . S ZRSLT("DUZ",ZDUZ,ZI)=""
198 N ZJ S ZJ=""
199 F S ZJ=$O(ZRSLT("DUZ",ZJ)) Q:ZJ="" D ; FOR EACH PROVIDER
200 . N ZGUIDS
201 . D RGUIDS("ZGUIDS",ZJ) ; GET ARRAY OF CURRENT ACTIVE GUIDS
202 . S ZI=""
203 . F S ZI=$O(ZRSLT("DUZ",ZJ,ZI)) Q:ZI="" D ; FOR EACH REQUEST
204 . . N ZRRG S ZRRG=ZRSLT(ZI,"RenewalRequestGuid") ;renewal request number
205 . . I $D(ZGUIDS(ZRRG)) D Q ; THIS REQUEST IS A DUPLICATE, SKIP IT
206 . . . W ZRRG_" IS A DUP",!
207 . . N ZDATE S ZDATE=$P(ZRSLT(ZI,"ReceivedTimestamp")," ",1) ;DATE RECEIVED
208 . . I $G(^TMP("C0P","TestNoMatch"))=1 D ;
209 . . . S ZRSLT(ZI,"PatientMiddleName")="XXX" ;TESTING NO MATCH REMOVE ME
210 . . ;I DUZ=135 S ZRSLT(ZI,"PatientMiddleName")="Uta" ;TESTING NO MATCH REMOVE
211 . . N ZPAT S ZPAT=$G(ZRSLT(ZI,"PatientLastName"))_","_$G(ZRSLT(ZI,"PatientFirstName")) ; PATIENT NAME LAST,FIRST
212 . . I $G(ZRSLT(ZI,"PatientMiddleName"))'="" S ZPAT=ZPAT_" "_$G(ZRSLT(ZI,"PatientMiddleName"))
213 . . S ZDOB=$G(ZRSLT(ZI,"PatientDOB")) ;patient date of birth
214 . . S ZSEX=$G(ZRSLT(ZI,"PatientGender")) ;patient gender
215 . . S ZADFN=$$PATMAT(ZPAT,ZDOB,ZSEX) ; TRY AND MATCH THE PATIENT
216 . . ;W "DFN="_ZADFN," ",ZI,!
217 . . N ZXQAID S ZXQAID=ZAPACK_","_ZADFN_","_ZACODE ; FORMAT FOR P1 OF XQAID
218 . . N ZMED S ZMED=ZRSLT(ZI,"DrugInfo")
219 . . ;S XQA(ZDUZ)="" ; WHO TO SEND THE ALERT TO
220 . . I '$D(^TMP("C0P","AlertVerify")) S XQA(ZJ)="" ; WHO TO SEND THE ALERT TO
221 . . E D ; AlertVerify sends alerts only to testers, not recipients
222 . . . ; use this when installing eRx to verify ewd installation
223 . . . N ZZZ S ZZZ=""
224 . . . F S ZZZ=$O(^TMP("C0P","AlertVerify",ZZZ)) Q:ZZZ="" D ; WHICH DUZ
225 . . . . S XQA(ZZZ)="" ; MARK THIS USER TO RECIEVE ALERTS
226 . . ;S XQA(135)="" ; ALWAYS SEND TO GPL
227 . . ;S XQA(148)="" ; ALWAYS SEND TO RICH
228 . . N ZP6 ; STRING THAT CPRS WILL RETURN FOR MATCHING
229 . . I ZADFN=0 D ; NO MATCH
230 . . . S XQAMSG="no match: ): [eRx] "_ZPAT_" Renewal request for "_ZMED
231 . . . S ZP6=ZPAT_" Renewal request for "_ZMED
232 . . E D ;
233 . . . S XQAMSG=ZPAT_": ): [eRx] Renewal request for "_ZMED
234 . . . S ZP6="Renewal request for "_ZMED
235 . . ;S XQAMSG=$E(XQAMSG,1,70) ; TRUNCATE TO 70 CHARS
236 . . S XQAID=ZXQAID ; PACKAGE IDENTIFIER
237 . . ;S XQADATA=ZRRG ; THE GUID OF THE REQUEST. NEEDED TO PROCESS THE ALERT
238 . . S XQADATA=ZRRG_"^"_ZDOB_"^"_ZSEX ; SAVE DOB AND SEX WITH GUID
239 . . W "SENDING",XQAID_" "_XQADATA,!
240 . . D SETUP^XQALERT ; MAKE THE CALL TO SET THE ALERT
241 . . HANG 1 ; NEED TO MAKE SURE TIME STAMP IS UNIQUE
242 K ZRSLT
243 ;D STATUS ; ALSO RUN CHECK FOR INCOMPLETE ORDERS
244 ;D FAILFAX ; ALSO RUN CHECK FOR FAILED FAXES
245 Q
246 ;
247PATMAT(ZNAME,INDOB,INSEX) ;EXTRINSIC TO TRY AND MATCH THE PATIENT
248 ; RETURNS ZERO IF NO EXACT MATCH IS FOUND
249 N ZP
250 S ZP=$O(^DPT("B",ZNAME,""))
251 I ZP="" Q 0 ; EXACT MATCH NOT FOUND ON NAME
252 ; CHECK DATE OF BIRTH
253 ;W "CHECKING DATE OF BIRTH",!
254 N DOB
255 S DOB=$$GET1^DIQ(2,ZP_",",.03,"I") ; PATIENT'S DATE OF BIRTH IN VISTA
256 N ZD ;INCOMING DATE OF BIRTH IS IN YYYYMMDD FORMAT
257 S ZD=($E(INDOB,1,4)-1700)_$E(INDOB,5,8) ; DATE OF BIRTH CONVERTED TO FM FORMAT
258 ;W ZD_" "_DOB,!
259 I +ZD'=+DOB Q 0 ; DATE OF BIRTH DOES NOT MATCH
260 ;
261 ; CHECK GENDER
262 ;W "CHECKING GENDER",!
263 N GENDER
264 S GENDER=$$GET1^DIQ(2,ZP_",",.02,"I") ; PATIENT'S GENDER IN VISTA
265 ;W GENDER_INSEX,!
266 I GENDER'=INSEX Q 0 ;GENDER DOESN'T MATCH
267 Q ZP
268 ;
269STATUS ; BATCH CALL TO RETRIEVE ERX ACCOUNT STATUS
270 ; RETURNS UNFINISHED ORDERS FOR ALL PROVIDERS
271 ; AND SENDS STATUS ALERTS
272 N VOR
273 S VOR("STATUS-SECTION-TYPE")="AllDoctorReview"
274 S VOR("SORT-ORDER")="A"
275 S VOR("INCLUDE-SCHEMA")="N"
276 S ZDUZ=$$PRIMARY^C0PMAIN() ; PRIMARY ERX USER FOR BATCH CALLS
277 K ZRSLT
278 ; D SOAP^C0PWS1("ZRSLT","STATUS",ZDUZ,"","VOR")
279 D SOAP^C0PWS2("ZRSLT","STATUS",ZDUZ,"","VOR")
280 I '$D(ZRSLT) Q ; SHOULDN'T HAPPEN
281 I $G(ZRSLT(1,"DrugInfo"))="" Q ; NO ROWS
282 S C0PNPIF=$$GET1^DIQ(C0PAF,C0PACCT_",",8,"I") ; LEGACY FLAG TO USE NPI FOR SID
283 N ZI S ZI=0
284 N ZAPACK S ZAPACK="OR" ; ALERT PACKAGE CODE
285 N ZADFN S ZADFN=0 ; DFN TO ASSOCIATE ALERT WITH - WE DON'T KNOW THIS
286 N ZACODE S ZACODE=11306 ; IEN TO OE/RR NOTIFICATIONS file for eRx incomplete
287 ; orders
288 F S ZI=$O(ZRSLT(ZI)) Q:+ZI=0 D ; FOR EACH RETURNED REFILL REQUEST
289 . N ZSID S ZSID=$G(ZRSLT(ZI,"ExternalDoctorId")) ; NPI FOR SUBSCRIBER
290 . I ZSID="" Q ; NO EXTERNAL ID FOR THIS STATUS
291 . I C0PNPIF'=1 S ZDUZ=$O(^VA(200,"AC0PSID",ZSID,"")) ; GUID SID
292 . E S ZDUZ=$O(^VA(200,"C0PNPI",ZSID,"")) ; DUZ FOR SUBSCRIBER
293 . S ZRSLT("DUZ",ZDUZ,ZI)=""
294 N ZJ S ZJ=""
295 D RMSTATUS ; REMOVE ALL STATUS ALERTS
296 F S ZJ=$O(ZRSLT("DUZ",ZJ)) Q:ZJ="" D ; FOR EACH PROVIDER
297 . N ZGUIDS
298 . D RGUIDS("ZGUIDS",ZJ) ; GET ARRAY OF CURRENT ACTIVE ALERTS
299 . S ZI=""
300 . F S ZI=$O(ZRSLT("DUZ",ZJ,ZI)) Q:ZI="" D ; FOR EACH REQUEST
301 . . N ZRRG S ZRRG=$G(ZRSLT(ZI,"DrugInfo")) ; first piece of XQDATA
302 . . S $P(ZRRG,"^",2)=$G(ZRSLT(ZI,"PrescriptionDate")) ; second piece
303 . . I $D(ZGUIDS(ZRRG)) D Q ; THIS REQUEST IS A DUPLICATE, SKIP IT
304 . . . ;W ZRRG_" IS A DUP",!
305 . . I ZRRG="^" D ERROR^C0PMAIN(",U113059004,",$ST($ST,"PLACE"),"ERX-NOT","Notification Error") QUIT
306 . . N ZDATE S ZDATE=$P($G(ZRSLT(ZI,"PrescriptionDate"))," ",1) ;
307 . . N ZPAT S ZPAT=$G(ZRSLT(ZI,"ExternalPatientId")) ; format PATIENTDFN
308 . . I ZPAT="" Q ;THIS IS AN ERROR
309 . . S ZADFN=$P(ZPAT,"PATIENT",2) ; EXTRACT THE DFN
310 . . S ZPAT=$$GET1^DIQ(2,ZADFN_",",.01) ;PATIENT'S NAME
311 . . ;W "DFN="_ZADFN," ",ZI,!
312 . . N ZXQAID S ZXQAID=ZAPACK_","_ZADFN_","_ZACODE ; FORMAT FOR P1 OF XQAID
313 . . N ZMED S ZMED=ZRSLT(ZI,"DrugInfo")
314 . . ;S XQA(ZDUZ)="" ; WHO TO SEND THE ALERT TO
315 . . S XQA(ZJ)="" ; WHO TO SEND THE ALERT TO
316 . . ;S XQA(135)="" ; ALWAYS SEND TO GPL
317 . . ;S XQA(148)="" ; ALWAYS SEND TO RICH
318 . . N ZP6 ; STRING THAT CPRS WILL RETURN FOR MATCHING
319 . . I ZADFN=0 D ; NO MATCH
320 . . . S XQAMSG="no match: ): [eRx] "_ZPAT_" Incomplete Order for "_ZMED
321 . . . S ZP6=ZPAT_" Incomplete Order for "_ZMED
322 . . E D ;
323 . . . S XQAMSG=ZPAT_": ): [eRx] Incomplete Order for "_ZMED
324 . . . S ZP6="Incomplete Order for "_ZMED
325 . . ;S XQAMSG=$E(XQAMSG,1,70) ; TRUNCATE TO 70 CHARS
326 . . S XQAID=ZXQAID ; PACKAGE IDENTIFIER
327 . . S XQADATA=ZRRG ; THE GUID OF THE REQUEST. NEEDED TO PROCESS THE ALERT
328 . . D SETUP^XQALERT ; MAKE THE CALL TO SET THE ALERT
329 Q
330 ;
331RMSTATUS ; DELETES ALL STATUS ALERTS FOR ALL USERS (THEY WILL BE
332 ; RESTORED NEXT TIME STATUS^C0PREFIL IS RUN - IN ERX BATCH
333 D NOTIPURG^XQALBUTL(11306) ;
334 W !,"ALL ERX STATUS ALERTS HAVE BEEN DELETED"
335 Q
336 ;
337FAILFAX ; BATCH CALL TO RETRIEVE ERX FAILED FAX STATUS
338 ; RETURNS A COUNT OF FAILED FAXES AND AN ARRAY OF PATIENTS
339 N VOR,ZRSLT
340 S VOR("STATUS-SECTION-TYPE")="FailedFax"
341 ;S VOR("ACCOUNT-PARTNERNAME")="demo"
342 S VOR("SORT-ORDER")="A"
343 S VOR("INCLUDE-SCHEMA")="N"
344 S ZDUZ=$$PRIMARY^C0PMAIN() ; PRIMARY ERX USER FOR BATCH CALLS
345 D SOAP^C0PWS1("ZRSLT","STATUS",ZDUZ,"","VOR")
346 N ZCOUNT
347 S ZCOUNT=$O(ZRSLT(""),-1) ; HOW MANY FAILED FAXES
348 I +ZCOUNT=0 Q ; NO FAILED FAXES
349 ;I $G(ZRSLT(1,"RowCount"))=0 Q ; NO FAILED FAXES
350 ;I $G(ZRSLT(1,"RowCount"))="" Q ; SHOULD NOT HAPPEN
351 N XQA,XQAMSG,XQAID,XQAKILL
352 S XQAID="C0P" ; GOING TO FIRST KILL ALL FAILED FAX ALERTS
353 D DELETEA^XQALERT ; KILL ALL FAILED FAX ALERTS
354 S XQA("G.ERX HELP DESK")=""
355 ;S XQA(135)=""
356 S XQAID="C0P"
357 S XQAMSG="eRx: "_ZCOUNT_" Failed Faxes on ePrescribing"
358 D SETUP^XQALERT ; CREATE NEW FAILED FAX ALERTS TO THE MAILGROUP
359 Q
360 ;
361RUN ; USED TO PROCESS AN ALERT. THIS ROUTINE IS LISTED IN
362 ; 0E/RR CPRS NOTIFICATIONS AS THE ROUTINE TO RUN TO PROCESS
363 ; A C0P ERX ALERT
364 W "MADE IT TO RUN C0PREFIL",!
365 W XQADATA
366 ; B
367 Q
368 ;
369GETALRT(ZARY,ZID) ; LOOKS UP AN ALERT BY USING THE "RECORDID" FROM CPRS,
370 ; PASSED BY VALUE IN ZID. RESULTS ARE RETURNED IN ZARY, PASSED BY NAME
371 ;N ZIEN
372 ;S ZIEN=$O(^XTV(8992.1,"B",ZID,"")) ;IEN IN THE ALERT TRACKING FILE
373 ;I ZIEN="" W "ERROR RETRIEVING ALERT",! Q ;
374 D GETN^C0CRNF(ZARY,8992.1,ZID,"B") ; GET ALL THE ALERT FIELDS
375 ; THE FORMAT IS @ZARY@("DATA FOR PROCESSING")="FILE^FIELD^VALUE"
376 ; ALL POPULATED FIELDS (BUT NOT SUBFILES) ARE RETURNED
377 Q
378 ;
379UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
380 K ZERR
381 D CLEAN^DILF
382 D UPDATE^DIE("","C0PFDA","","ZERR")
383 I $D(ZERR) D ERROR^C0PMAIN(",U113059008,",$ST($ST,"PLACE"),"ERX-UPDIE-FAIL","Fileman Data Update Failure") QUIT
384 K C0PFDA
385 Q
Note: See TracBrowser for help on using the repository browser.