source: FOIAVistA/tag/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DG53S451.m@ 1699

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

initial load of FOIAVistA 6/30/08 version

File size: 4.4 KB
Line 
1DG53S451 ;ALB/TDM - Combat Veteran End Date Synchronization ; 6/3/04 3:43pm
2 ;;5.3;Registration;**451**; Aug 13,1993
3 ;This post install routine will loop through the "E" cross reference
4 ;of the PATIENT (#2) file and trigger a Z07 message to the HEC system
5 ;for all entries that have a value in the COMBAT VETERAN END DATE
6 ;(#.5295) field that is less than 1/17/03.
7 Q
8 ;
9EP ;Entry point
10 N OK
11 D CHK Q:'OK
12 D MSG
13 D QUETASK
14 Q
15 ;
16QUETASK ;Queue the task
17 N TXT,ZTRTN,ZTDESC,ZTSK,ZTIO,ZTDTH
18 S ZTRTN="EP1^DG53S451",ZTIO="",ZTDTH=$$NOW^XLFDT()
19 S ZTDESC="COMBAT VETERAN END DATE SYNCHRONIZATION PROCESS"
20 K ^XTMP("DG53S451")
21 D ^%ZTLOAD S ^XTMP("DG53S451","TASK")=ZTSK
22 S TXT(1)="Task: "_ZTSK_" Queued."
23 D BMES^XPDUTL(.TXT)
24 Q
25 ;
26EP1 ;Entry point
27 N X1,X2,X,XCVDT,XIEN,TOT,CNT,EVENT,IYR
28 S X1=DT,X2=60 D C^%DTC
29 S ^XTMP("DG53S451",0)=X_"^"_$$DT^XLFDT_"^DG*5.3*451 HVE PHASE II POST INSTALL"
30 S $P(^XTMP("DG53S451","DATE"),"^")=$$FMTE^XLFDT($$NOW^XLFDT(),"5P")
31 ;
32 ;Create index by patient.
33 I $D(^DPT("E")) D
34 . S (XCVDT,XIEN)=0
35 . F S XCVDT=$O(^DPT("E",XCVDT)) Q:XCVDT="" D
36 . . F S XIEN=$O(^DPT("E",XCVDT,XIEN)) Q:XIEN="" D
37 . . . S ^XTMP("DG53S451","INDEX",XIEN)=""
38 ;
39 ;Loop through ^XTMP("DG53S451","INDEX") index.
40 I $D(^XTMP("DG53S451","INDEX")) D
41 . S (XIEN,TOT,CNT)=0,EVENT("ENROLL")=1
42 . F S XIEN=$O(^XTMP("DG53S451","INDEX",XIEN)) Q:+XIEN=0 D
43 . . S CVDT=$P($G(^DPT(XIEN,.52)),"^",15) Q:'CVDT ;No CV End Date
44 . . S TOT=TOT+1,$P(^XTMP("DG53S451",1),"^")=TOT ;Tot records
45 . . Q:(CVDT>3030116) ;CVEDT>01/16/03
46 . . S IYR=$$INCYR(XIEN) Q:'$$LOG^IVMPLOG(XIEN,IYR,.EVENT) ;Queue Z07
47 . . S CNT=CNT+1,$P(^XTMP("DG53S451",1),"^",2)=CNT ;Tot Z07's queued
48 . . S ^XTMP("DG53S451","INDEX",XIEN)="Z07 Queued"
49 S $P(^XTMP("DG53S451","DATE"),"^",2)=$$FMTE^XLFDT($$NOW^XLFDT(),"5P")
50 S ^XTMP("DG53S451","COMPLETED")=1
51 D MAIL ;send mailman message to User
52 D BMES^XPDUTL("Post install process for Combat Veteran End Date synchronization is complete.")
53 Q
54 ;
55CHK ;check for completion
56 N TXT,TASKNUM,STAT
57 S OK=1
58 I $D(^XTMP("DG53S451","COMPLETED")) D
59 . S OK=0
60 . N TXT
61 . S TXT(1)="The Combat Veteran End Date synchronization process was completed in a"
62 . S TXT(2)="previous run. Nothing Done!"
63 . D BMES^XPDUTL(.TXT)
64 ;
65 S TASKNUM=$G(^XTMP("DG53S451","TASK"))
66 I +TASKNUM D Q
67 . S STAT=$$ACTIVE(TASKNUM)
68 . I STAT>0 D
69 . . S OK=0
70 . . S TXT(1)="Task: "_TASKNUM_" is currently running the Combat Veteran End Date"
71 . . S TXT(2)="synchronization process. Duplicate processes cannot be started."
72 . . D BMES^XPDUTL(.TXT)
73 Q
74 ;
75MSG ;create bulletin message in install file.
76 N TXT
77 S TXT(1)="This Post Install routine will queue a Z07 HL7 message to be sent to the"
78 S TXT(2)="Health Eligibility Center (HEC) for all entries in the PATIENT (#2) file"
79 S TXT(3)="that have a value in the COMBAT VETERAN END DATE (#.5295) field that is"
80 S TXT(4)="prior to 1/17/03. "
81 S TXT(5)=" "
82 D BMES^XPDUTL(.TXT)
83 Q
84 ;
85MAIL N SITE,STATN,SITENM,XMDUZ,XMSUB,XMY,XMTEXT,MSG
86 S SITE=$$SITE^VASITE,STATN=$P($G(SITE),"^",3),SITENM=$P($G(SITE),"^",2)
87 S:$$GET1^DIQ(869.3,"1,",.03,"I")'="P" STATN=STATN_" [TEST]"
88 S XMDUZ="CV END DATE SYNCHRONIZATION",XMSUB=XMDUZ_" - "_STATN_" (DG*5.3*451)"
89 S (XMY(DUZ),XMY(.5))=""
90 S XMY("terry.moore3@med.va.gov")="",XMY("pat.wilson@med.va.gov")=""
91 S XMTEXT="MSG("
92 S MSG(1)="Combat Veteran End Date synchronization process has completed successfully."
93 S MSG(1.5)="Task: "_$G(^XTMP("DG53S451","TASK"))
94 S MSG(2)=""
95 S MSG(3)="Site Station number: "_STATN
96 S MSG(4)="Site Name: "_SITENM
97 S MSG(5)=""
98 S MSG(6)="Process started at : "_$P($G(^XTMP("DG53S451","DATE")),"^",1)
99 S MSG(7)="Process completed at : "_$P($G(^XTMP("DG53S451","DATE")),"^",2)
100 S MSG(8)="Total Veterans processed : "_+$P($G(^XTMP("DG53S451",1)),"^",1)
101 S MSG(9)="Total Veterans queued for Z07: "_+$P($G(^XTMP("DG53S451",1)),"^",2)
102 D ^XMD
103 Q
104 ;
105INCYR(XIEN) ;Get valid income year
106 N I,LMT,TMP,INCYR
107 I $D(^IVM(301.5,"APT",XIEN)) Q $O(^IVM(301.5,"APT",XIEN,""),-1)
108 F I=1,2,4 S LMT=$$LST^DGMTU(XIEN,,I) S:+$G(LMT) TMP($P(LMT,"^",2))=""
109 I $D(TMP) S LMT=$O(TMP(""),-1),INCYR=($E(LMT,1,3)-1)_"0000" Q INCYR
110 S INCYR=($E(DT,1,3)-1)_"0000"
111 Q INCYR
112 ;
113ACTIVE(TASK) ;Checks if task is running
114 ; input -- The taskman ID
115 ; output -- 1=The task is running
116 ; 0=The task is not running
117 N STAT,ZTSK,Y
118 S STAT=0,ZTSK=+TASK
119 D STAT^%ZTLOAD
120 S Y=ZTSK(1)
121 I Y=0 S STAT=-1
122 I ",1,2,"[(","_Y_",") S STAT=1
123 I ",3,5,"[(","_Y_",") S STAT=0
124 Q STAT
Note: See TracBrowser for help on using the repository browser.