source: WorldVistAEHR/trunk/r/AUTOMATED_MED_INFO_EXCHANGE-DVBA-DVBC/DVBAXA7.m@ 1093

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

initial load of WorldVistAEHR

File size: 8.5 KB
Line 
1DVBAXA7 ; ;06/08/01
2 D DE G BEGIN
3DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
4 I $D(^(.11)) S %Z=^(.11) S %=$P(%Z,U,1) S:%]"" DE(6)=% S %=$P(%Z,U,2) S:%]"" DE(7)=% S %=$P(%Z,U,3) S:%]"" DE(8)=% S %=$P(%Z,U,4) S:%]"" DE(9)=%
5 I $D(^(.32)) S %Z=^(.32) S %=$P(%Z,U,3) S:%]"" DE(5)=%
6 I $D(^(.36)) S %Z=^(.36) S %=$P(%Z,U,1) S:%]"" DE(3)=%
7 I $D(^(.52)) S %Z=^(.52) S %=$P(%Z,U,5) S:%]"" DE(4)=%
8 I $D(^("TYPE")) S %Z=^("TYPE") S %=$P(%Z,U,1) S:%]"" DE(1)=%
9 I $D(^("VET")) S %Z=^("VET") S %=$P(%Z,U,1) S:%]"" DE(2)=%
10 K %Z Q
11 ;
12W W !?DL+DL-2,DLB_": "
13 Q
14O D W W Y W:$X>45 !?9
15 I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
16 W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W " (No Editing)" Q
17TR R X:DTIME E S (DTOUT,X)=U W $C(7)
18 Q
19A K DQ(DQ) S DQ=DQ+1
20B G @DQ
21RE G PR:$D(DE(DQ)) D W,TR
22N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
23RD G QS:X?."?" I X["^" D D G ^DIE17
24 I X="@" D D G Z^DIE2
25 I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W " "_X
26T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I W:'$D(DB(DQ)) " "_% G V
27 K DDER G X
28P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
29 G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
30 I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
31V D @("X"_DQ) K YS
32Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
33X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
34 S X="?BAD"
35QS S DZ=X D D,QQ^DIEQ G B
36D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
37Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
38PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
39R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
40 I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
41 X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
42RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
43I I DV'["I",DV'["#" G RD
44 D E^DIE0 G RD:$D(X),PR
45 Q
46SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
47 I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
48 D ^DIR I 'DDER S %=Y(0),X=Y
49 Q
50SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
51 I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
52 E K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
53 Q
54NKEY W:'$D(ZTQUEUED) "?? Required key field" S X="?BAD" G QS
55KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
56BEGIN S DNM="DVBAXA7",DQ=1
571 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW="TYPE;1",DV="RP391'a",DU="",DLB="TYPE",DIFLD=391
58 S DE(DW)="C1^DVBAXA7"
59 S DU="DG(391,"
60 G RE
61C1 G C1S:$D(DE(1))[0 K DB
62 S X=DE(1),DIC=DIE
63 I ($T(AVAFC^VAFCDD01)'="") S VAFCF="391;" D AVAFC^VAFCDD01(DA)
64 S X=DE(1),DIIX=2_U_DIFLD D AUDIT^DIET
65C1S S X="" Q:DG(DQ)=X K DB
66 S X=DG(DQ),DIC=DIE
67 I ($T(AVAFC^VAFCDD01)'="") S VAFCF="391;" D AVAFC^VAFCDD01(DA)
68 I $D(DE(1))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
69 Q
70X1 Q
712 D:$D(DG)>9 F^DIE17,DE S DQ=2,DW="VET;1",DV="RSXa",DU="",DLB="VETERAN (Y/N)?",DIFLD=1901
72 S DE(DW)="C2^DVBAXA7"
73 S DU="Y:YES;N:NO;"
74 G RE
75C2 G C2S:$D(DE(2))[0 K DB
76 S X=DE(2),DIC=DIE
77 S DFN=DA D EN^DGMTCOR K DGMTCOR
78 S X=DE(2),DIC=DIE
79 ;
80 S X=DE(2),DIC=DIE
81 D AUTOUPD^DGENA2(DA)
82 S X=DE(2),DIC=DIE
83 I ($T(AVAFC^VAFCDD01)'="") S VAFCF="1901;" D AVAFC^VAFCDD01(DA)
84 S X=DE(2),DIC=DIE
85 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
86 S X=DE(2),DIIX=2_U_DIFLD D AUDIT^DIET
87C2S S X="" Q:DG(DQ)=X K DB
88 S X=DG(DQ),DIC=DIE
89 S DFN=DA D EN^DGMTCOR K DGMTCOR
90 S X=DG(DQ),DIC=DIE
91 X ^DD(2,1901,1,3,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.3)):^(.3),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y S X=DIV S X="N" X ^DD(2,1901,1,3,1.4)
92 S X=DG(DQ),DIC=DIE
93 D AUTOUPD^DGENA2(DA)
94 S X=DG(DQ),DIC=DIE
95 I ($T(AVAFC^VAFCDD01)'="") S VAFCF="1901;" D AVAFC^VAFCDD01(DA)
96 S X=DG(DQ),DIC=DIE
97 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
98 I $D(DE(2))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
99 Q
100X2 I $D(X) S:'$D(DPTX) DFN=DA D:'$D(^XUSEC("DG ELIGIBILITY",DUZ)) VAGE^DGLOCK:X="Y" I $D(X) D:$D(DFN) EV^DGLOCK
101 Q
102 ;
1033 D:$D(DG)>9 F^DIE17,DE S DQ=3,DW=".36;1",DV="*P8'XaR",DU="",DLB="PRIMARY ELIGIBILITY CODE",DIFLD=.361
104 S DE(DW)="C3^DVBAXA7"
105 S DU="DIC(8,"
106 G RE
107C3 G C3S:$D(DE(3))[0 K DB
108 S X=DE(3),DIC=DIE
109 ;
110 S X=DE(3),DIC=DIE
111 K DIV S DIV=X,D0=DA,DIV(0)=D0 X ^DD(2,.361,1,2,2.2) I DIV(1)>0 S DIK(0)=DA,DIK="^DPT(DIV(0),""E"",",DA(1)=DIV(0),DA=DIV(1) D ^DIK S DA=DIK(0) K DIK
112 S X=DE(3),DIC=DIE
113 X "I $S('$D(^DIC(8,+X,0)):0,$P(^(0),""^"",1)[""DOM"":0,'$D(^DPT(DA,.36)):1,'$D(^DIC(8,+^(.36),0)):1,$P(^(0),""^"",1)'[""DOM"":1,1:0) S DGXRF=.361 D ^DGDDC Q"
114 S X=DE(3),DIC=DIE
115 K ^DPT("AEL",DA,+X)
116 S X=DE(3),DIC=DIE
117 D AUTOUPD^DGENA2(DA)
118 S X=DE(3),DIIX=2_U_DIFLD D AUDIT^DIET
119C3S S X="" Q:DG(DQ)=X K DB
120 S X=DG(DQ),DIC=DIE
121 X "S DFN=DA D EN^DGMTR K DGREQF"
122 S X=DG(DQ),DIC=DIE
123 K DIV S DIV=X,D0=DA,DIV(0)=D0 X ^DD(2,.361,1,2,89.4) S Y(102)=$S($D(^DPT(D0,"E",D1,0)):^(0),1:"") S X=$S('$D(^DIC(8,+$P(Y(102),U,1),0)):"",1:$P(^(0),U,1)) S D0=I(0,0) S D1=I(1,0) S DIU=X K Y S X=DIV S X=DIV,X=X X ^DD(2,.361,1,2,1.4)
124 S X=DG(DQ),DIC=DIE
125 ;
126 S X=DG(DQ),DIC=DIE
127 S ^DPT("AEL",DA,+X)=""
128 S X=DG(DQ),DIC=DIE
129 D AUTOUPD^DGENA2(DA)
130 I $D(DE(3))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
131 Q
132X3 S DFN=DA D EV^DGLOCK I $D(X) D ECD^DGLOCK1
133 Q
134 ;
1354 D:$D(DG)>9 F^DIE17,DE S DQ=4,DW=".52;5",DV="RSXR",DU="",DLB="POW STATUS INDICATED?",DIFLD=.525
136 S DE(DW)="C4^DVBAXA7"
137 S DU="Y:YES;N:NO;U:UNKNOWN;"
138 G RE
139C4 G C4S:$D(DE(4))[0 K DB
140 S X=DE(4),DIC=DIE
141 ;
142 S X=DE(4),DIC=DIE
143 ;
144 S X=DE(4),DIC=DIE
145 ;
146 S X=DE(4),DIC=DIE
147 D AUTOUPD^DGENA2(DA)
148 S X=DE(4),DIC=DIE
149 X "S DFN=DA D EN^DGMTR K DGREQF"
150C4S S X="" Q:DG(DQ)=X K DB
151 S X=DG(DQ),DIC=DIE
152 X ^DD(2,.525,1,1,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.52)):^(.52),1:"") S X=$S('$D(^DIC(22,+$P(Y(1),U,6),0)):"",1:$P(^(0),U,1)) S DIU=X K Y S X=DIV S X="" X ^DD(2,.525,1,1,1.4)
153 S X=DG(DQ),DIC=DIE
154 X ^DD(2,.525,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.52)):^(.52),1:"") S X=$P(Y(1),U,7) S DIU=X K Y S X=DIV S X="" X ^DD(2,.525,1,2,1.4)
155 S X=DG(DQ),DIC=DIE
156 X ^DD(2,.525,1,3,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.52)):^(.52),1:"") S X=$P(Y(1),U,8) S DIU=X K Y S X=DIV S X="" X ^DD(2,.525,1,3,1.4)
157 S X=DG(DQ),DIC=DIE
158 D AUTOUPD^DGENA2(DA)
159 S X=DG(DQ),DIC=DIE
160 X "S DFN=DA D EN^DGMTR K DGREQF"
161 Q
162X4 S DFN=DA D SV^DGLOCK
163 Q
164 ;
1655 D:$D(DG)>9 F^DIE17,DE S DQ=5,DW=".32;3",DV="*P21'XaR",DU="",DLB="PERIOD OF SERVICE",DIFLD=.323
166 S DE(DW)="C5^DVBAXA7"
167 S DU="DIC(21,"
168 G RE
169C5 G C5S:$D(DE(5))[0 K DB
170 S X=DE(5),DIC=DIE
171 K ^DPT("APOS",$E(X,1,30),DA)
172 S X=DE(5),DIC=DIE
173 ;
174 S X=DE(5),DIC=DIE
175 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".323;" D AVAFC^VAFCDD01(DA)
176 S X=DE(5),DIIX=2_U_DIFLD D AUDIT^DIET
177C5S S X="" Q:DG(DQ)=X K DB
178 S X=DG(DQ),DIC=DIE
179 S ^DPT("APOS",$E(X,1,30),DA)=""
180 S X=DG(DQ),DIC=DIE
181 X ^DD(2,.323,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,"ODS")):^("ODS"),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y X ^DD(2,.323,1,2,1.1) X ^DD(2,.323,1,2,1.4)
182 S X=DG(DQ),DIC=DIE
183 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".323;" D AVAFC^VAFCDD01(DA)
184 I $D(DE(5))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
185 Q
186X5 S DFN=DA D POS^DGLOCK1
187 Q
188 ;
1896 D:$D(DG)>9 F^DIE17,DE S DQ=6,DW=".11;1",DV="FaR",DU="",DLB="STREET ADDRESS [LINE 1]",DIFLD=.111
190 S DE(DW)="C6^DVBAXA7"
191 G RE
192C6 G C6S:$D(DE(6))[0 K DB
193 D ^DVBAXA8
194C6S S X="" Q:DG(DQ)=X K DB
195 D ^DVBAXA9
196 Q
197X6 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>35!($L(X)<3) X
198 I $D(X),X'?.ANP K X
199 Q
200 ;
2017 D:$D(DG)>9 F^DIE17,DE S DQ=7,DW=".11;2",DV="Fa",DU="",DLB="STREET ADDRESS [LINE 2]",DIFLD=.112
202 S DE(DW)="C7^DVBAXA7"
203 G RE
204C7 G C7S:$D(DE(7))[0 K DB
205 D ^DVBAXA10
206C7S S X="" Q:DG(DQ)=X K DB
207 D ^DVBAXA11
208 Q
209X7 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>30!($L(X)<3) X D:$D(X) UP^DGHELP
210 I $D(X),X'?.ANP K X
211 Q
212 ;
2138 D:$D(DG)>9 F^DIE17,DE S DQ=8,DW=".11;3",DV="Fa",DU="",DLB="STREET ADDRESS [LINE 3]",DIFLD=.113
214 S DE(DW)="C8^DVBAXA7"
215 G RE
216C8 G C8S:$D(DE(8))[0 K DB
217 D ^DVBAXA12
218C8S S X="" Q:DG(DQ)=X K DB
219 D ^DVBAXA13
220 Q
221X8 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>30!($L(X)<3) X
222 I $D(X),X'?.ANP K X
223 Q
224 ;
2259 D:$D(DG)>9 F^DIE17,DE S DQ=9,DW=".11;4",DV="FaR",DU="",DLB="CITY",DIFLD=.114
226 S DE(DW)="C9^DVBAXA7"
227 G RE
228C9 G C9S:$D(DE(9))[0 K DB
229 D ^DVBAXA14
230C9S S X="" Q:DG(DQ)=X K DB
231 D ^DVBAXA15
232 Q
233X9 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>15!($L(X)<2) X
234 I $D(X),X'?.ANP K X
235 Q
236 ;
23710 D:$D(DG)>9 F^DIE17 G ^DVBAXA16
Note: See TracBrowser for help on using the repository browser.