source: WorldVistAEHR/trunk/r/AUTOMATED_MED_INFO_EXCHANGE-DVBA-DVBC/DVBAYAPE.m@ 1234

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

initial load of WorldVistAEHR

File size: 2.2 KB
Line 
1DVBAYAPE ;ALB/MLI - Clean-up stray APE cross-references ; 2/15/96@1pm
2 ;;2.7;AMIE;**4**;Apr 10, 1995
3 ;
4 ; this routine will queue a process to run which will cleanup
5 ; any errant APE cross-references
6 ;
7EN ; begin processing
8 N ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
9 S ZTRTN="DQ^DVBAYAPE",ZTDESC="DVBA*2.7*4 - APE x-ref cleanup process"
10 S ZTDTH=XPDQUES("POS001"),ZTIO="",ZTSAVE("DVBAKILL")=""
11 D ^%ZTLOAD
12 I $D(ZTSK) D BMES^XPDUTL(" APE x-ref cleanup queued...task="_ZTSK)
13 Q
14 ;
15 ;
16DQ ; dequeue task (or call in direct mode)
17 D CLEAN
18 D MAIL
19 Q
20 ;
21 ;
22CLEAN ; cleanup data
23 S DVBACT=3 ; counter for bad x-refs...start after first 3 lines
24 K ^TMP("DVBA*2.7*4",$J)
25 D LINE(1,"Start Time of process: "_$$NOW^XLFDT())
26 D LINE(2," ")
27 D LINE(3,"Results of search in DA^DFN^Request Date^Exam Type format")
28 S DIK="^DVB(396.4,"
29 F DFN=0:0 S DFN=$O(^DVB(396.4,"APE",DFN)) Q:'DFN D
30 . S DVBAET=0 ; loop variable for exam type
31 . F S DVBAET=$O(^DVB(396.4,"APE",DFN,DVBAET)) Q:DVBAET="" D
32 . . S DVBARD=0 ; loop variable for request date
33 . . F S DVBARD=$O(^DVB(396.4,"APE",DFN,DVBAET,DVBARD)) Q:'DVBARD D
34 . . . S DA=$O(^DVB(396.4,"APE",DFN,DVBAET,DVBARD,0))
35 . . . S DVBA0ND=$G(^DVB(396.4,+DA,0)),DVBAD=0
36 . . . I $G(^DVB(396.6,+$O(^DVB(396.6,"B",$E(DVBAET,1,30),0)),0))']"" S DVBAD=1
37 . . . I DVBA0ND']""!DVBAD D ; exam doesn't exist or event type name is bad
38 . . . . S DVBACT=DVBACT+1
39 . . . . D LINE(DVBACT,DA_"^"_DFN_"^"_DVBARD_"^"_DVBAET)
40 . . . . I $G(DVBAKILL)="NO" Q ; don't cleanup
41 . . . . K ^DVB(396.4,"APE",DFN,DVBAET,DVBARD,DA)
42 . . . . I DVBA0ND]"" D IX1^DIK ; reindex entry (sets only)
43 I DVBACT=3 S DVBACT=DVBACT+1 D LINE(DVBACT,"No bad APE x-refs found!")
44 D LINE(DVBACT+1,"End Time: "_$$NOW^XLFDT())
45 I $G(DVBAKILL)="NO" D LINE(DVBACT+2,"NOTHING WAS KILLED!! D EN^DVBAYAPE TO HAVE KILLS EXECUTED")
46 K DA,DFN,DIK,DVBA0ND,DVBACT,DVBAD,DVBAET,DVBARD
47 Q
48 ;
49 ;
50LINE(NUMBER,TEXT) ; set data into TMP global for e-mail message
51 S ^TMP("DVBA*2.7*4",$J,NUMBER)=TEXT
52 Q
53 ;
54 ;
55MAIL ; mail message of results
56 N DIFROM
57 S XMSUB="DVBA*2.7*4 "_$S($G(DVBAKILL)'="NO":"Cleanup",1:"Diagnostic")_" has run"
58 S XMTEXT="^TMP(""DVBA*2.7*4"",$J,"
59 S XMY(DUZ)="",XMDUZ=.5
60 D ^XMD
61 K XMDUZ,XMSUB,XMTEXT,XMY
62 Q
63 ;
64 ;
65NOKILL ; don't kill anything
66 S DVBAKILL="NO"
67 D EN
68 K DVBAKILL
69 Q
Note: See TracBrowser for help on using the repository browser.