1 | DVBA2807 ;SPH - PATCH DRIVER ; 3/29/06
|
---|
2 | ;;2.7;AMIE;**107**;Apr 10, 1995
|
---|
3 | ;
|
---|
4 | ; Make sure to call each exam name being sent in the patch
|
---|
5 | ; This routine will find existing matching entries and will ensure they're disabled.
|
---|
6 | ; Call as a pre-init or else it'll disable the exams just loaded.
|
---|
7 | PRE ;
|
---|
8 | N DVBVERSS,DVBVERSN
|
---|
9 | S DVBVERSS="107F" ; What the version will be in the incoming file
|
---|
10 | S DVBVERSN="107" ; What the final version should be named
|
---|
11 | W !!!,"**** PRE-PROCESSING ****",!!
|
---|
12 | D DISABLE("INITIAL EVALUATION FOR POST-TRAUMATIC STRESS DISORDER (PTSD)")
|
---|
13 | D DISABLE("MENTAL DISORDERS (EXCEPT PTSD AND EATING DISORDERS)")
|
---|
14 | Q
|
---|
15 | POST ;
|
---|
16 | N DVBVERSS,DVBVERSN
|
---|
17 | S DVBVERSS="107F" ; What the version will be in the incoming file
|
---|
18 | S DVBVERSN="107" ; What the final version should be named
|
---|
19 | W !!!,"**** POST-PROCESSING ****",!!
|
---|
20 | D POSTP("INITIAL EVALUATION FOR POST-TRAUMATIC STRESS DISORDER (PTSD)")
|
---|
21 | D POSTP("MENTAL DISORDERS (EXCEPT PTSD AND EATING DISORDERS)")
|
---|
22 | D RBXREF
|
---|
23 | Q
|
---|
24 | POSTP(NM) ;
|
---|
25 | ; Rename XXXXXXX~imported version to XXXXXXX~new version
|
---|
26 | N DVBABCNT,DVBABIEN,DVBABST,DVBACH
|
---|
27 | N DVBABCN2,DVBABIE2,DVBABS2
|
---|
28 | S DVBABCNT=0,DVBABIEN=0
|
---|
29 | F S DVBABIEN=$O(^DVB(396.18,DVBABIEN)) Q:'DVBABIEN D
|
---|
30 | .S DVBABST=$P($G(^DVB(396.18,DVBABIEN,0)),"^",1)
|
---|
31 | .I $P(DVBABST,"~",1)=NM I $P(DVBABST,"~",2)=DVBVERSS D
|
---|
32 | ..;Check and be sure the new version isn't in the file yet
|
---|
33 | ..S DVBABCN2=0,DVBABIE2=0,DVBACH=0
|
---|
34 | ..F S DVBABIE2=$O(^DVB(396.18,DVBABIE2)) Q:'DVBABIE2 D
|
---|
35 | ...S DVBABS2=$P($G(^DVB(396.18,DVBABIE2,0)),"^",1)
|
---|
36 | ...I $P(DVBABS2,"~",1)=NM I $P(DVBABS2,"~",2)=DVBVERSN S DVBACH=1
|
---|
37 | ..;If new version is found, delete the import version and don't import
|
---|
38 | ..I DVBACH=1 D
|
---|
39 | ...W "FOUND EXISTING "_NM_". NO MODIFICATIONS MADE.",!
|
---|
40 | ...K ^DVB(396.18,DVBABIEN)
|
---|
41 | ..;If existing version isn't found, go ahead and rename imported entry to new version name
|
---|
42 | ..I DVBACH=0 D
|
---|
43 | ...S $P(^DVB(396.18,DVBABIEN,0),"^",1)=NM_"~"_DVBVERSN
|
---|
44 | ...W "ACTIVATED: "_$P($G(^DVB(396.18,DVBABIEN,0)),"^",1),!
|
---|
45 | K DVBABCNT,DVBABIEN,DVBABST,DVBACH
|
---|
46 | Q
|
---|
47 | RBXREF ;
|
---|
48 | ; Rebuild cross-references
|
---|
49 | ; XRef: B
|
---|
50 | W !!,"CLEANING UP FILES AND REBUILDING 2 CROSS-REFERENCES.",!,"THIS MAY TAKE A FEW MINUTES.",!
|
---|
51 | W !!,"REBUILDING 'B' XREF, CAPRI TEMPLATE DEFINITIONS FILE",!
|
---|
52 | N DA,DIK,REGIEN,ROOT
|
---|
53 | S ROOT=$$ROOT^DILFD(396.18,,1) K @ROOT@("B")
|
---|
54 | S REGIEN=0
|
---|
55 | F S REGIEN=$O(@ROOT@(REGIEN)) Q:'REGIEN D
|
---|
56 | . S DIK=$$ROOT^DILFD(396.18,","_REGIEN_","),DIK(1)=".01^B"
|
---|
57 | . S DA(1)=REGIEN D ENALL^DIK
|
---|
58 | ;
|
---|
59 | ; XRef: AV
|
---|
60 | W !!,"REBUILDING 'AV' XREF, CAPRI TEMPLATE DEFINITIONS FILE",!
|
---|
61 | N DA,DIK,REGIEN,ROOT
|
---|
62 | S ROOT=$$ROOT^DILFD(396.18,,1) K @ROOT@("AV")
|
---|
63 | S REGIEN=0
|
---|
64 | F S REGIEN=$O(@ROOT@(REGIEN)) Q:'REGIEN D
|
---|
65 | . S DIK=$$ROOT^DILFD(396.18,","_REGIEN_","),DIK(1)=".01^AV"
|
---|
66 | . S DA(1)=REGIEN D ENALL^DIK
|
---|
67 | K DA,DIK,REGIEN,ROOT
|
---|
68 | Q
|
---|
69 | DISABLE(NM) ;
|
---|
70 | ; First look for matches and turn off the "selectable by user field"
|
---|
71 | ; This will keep the entry from showing in the list
|
---|
72 | ; Next, look at disabled date. If there's no date, set it to today.
|
---|
73 | ; File is 396.18. Field 3 is de-activation date. Field 7 is selectable by user (0=no)
|
---|
74 | N DVBABCNT,DVBABIEN,DVBABST,DVBACH
|
---|
75 | S DVBABCNT=0,DVBABIEN=0
|
---|
76 | F S DVBABIEN=$O(^DVB(396.18,DVBABIEN)) Q:'DVBABIEN D
|
---|
77 | .S DVBABST=$P($G(^DVB(396.18,DVBABIEN,0)),"^",1)
|
---|
78 | .I $P(DVBABST,"~",1)=NM I $P(DVBABST,"~",2)'=DVBVERSN D
|
---|
79 | ..S DVBACH=0
|
---|
80 | ..I $P(^DVB(396.18,DVBABIEN,6),"^",1)'="0" S $P(^DVB(396.18,DVBABIEN,6),"^",1)="0",DVBACH=1
|
---|
81 | ..I $P(^DVB(396.18,DVBABIEN,2),"^",2)="" S $P(^DVB(396.18,DVBABIEN,2),"^",2)=DT,DVBACH=1 ; This is deactivation date
|
---|
82 | ..I DVBACH=1 W "MODIFIED: "_DVBABST,!
|
---|
83 | K DVBABCNT,DVBABIEN,DVBABST,DVBACH
|
---|
84 | Q
|
---|