source: WorldVistAEHR/trunk/r/AUTOMATED_MED_INFO_EXCHANGE-DVBA-DVBC/DVBAXA16.m@ 1154

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

initial load of WorldVistAEHR

File size: 9.0 KB
Line 
1DVBAXA16 ; ;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,5) S:%]"" DE(1)=% S %=$P(%Z,U,7) S:%]"" DE(3)=% S %=$P(%Z,U,12) S:%]"" DE(2)=%
5 I $D(^(.13)) S %Z=^(.13) S %=$P(%Z,U,1) S:%]"" DE(4)=% S %=$P(%Z,U,2) S:%]"" DE(5)=%
6 I $D(^(.32)) S %Z=^(.32) S %=$P(%Z,U,6) S:%]"" DE(7)=% S %=$P(%Z,U,7) S:%]"" DE(8)=%
7 K %Z Q
8 ;
9W W !?DL+DL-2,DLB_": "
10 Q
11O D W W Y W:$X>45 !?9
12 I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
13 W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W " (No Editing)" Q
14TR R X:DTIME E S (DTOUT,X)=U W $C(7)
15 Q
16A K DQ(DQ) S DQ=DQ+1
17B G @DQ
18RE G PR:$D(DE(DQ)) D W,TR
19N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
20RD G QS:X?."?" I X["^" D D G ^DIE17
21 I X="@" D D G Z^DIE2
22 I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W " "_X
23T 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
24 K DDER G X
25P 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
26 G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
27 I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
28V D @("X"_DQ) K YS
29Z 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
30X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
31 S X="?BAD"
32QS S DZ=X D D,QQ^DIEQ G B
33D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
34Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
35PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
36R 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
37 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
38 X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
39RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
40I I DV'["I",DV'["#" G RD
41 D E^DIE0 G RD:$D(X),PR
42 Q
43SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
44 I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
45 D ^DIR I 'DDER S %=Y(0),X=Y
46 Q
47SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
48 I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
49 E K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
50 Q
51NKEY W:'$D(ZTQUEUED) "?? Required key field" S X="?BAD" G QS
52KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
53BEGIN S DNM="DVBAXA16",DQ=1
541 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW=".11;5",DV="P5'aR",DU="",DLB="STATE",DIFLD=.115
55 S DE(DW)="C1^DVBAXA16"
56 S DU="DIC(5,"
57 G RE
58C1 G C1S:$D(DE(1))[0 K DB
59 S X=DE(1),DIC=DIE
60 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.11)):^(.11),1:""),Y=$P(Y(1),U,7) X:$D(^DD(2,.117,2)) ^(2) S X=Y S DIU=X K Y S X=DIV S X="" X ^DD(2,.115,1,1,2.4)
61 S X=DE(1),DIC=DIE
62 S A1B2TAG="PAT" D ^A1B2XFR
63 S X=DE(1),DIC=DIE
64 D EVENT^IVMPLOG(DA)
65 S X=DE(1),DIC=DIE
66 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
67 S X=DE(1),DIC=DIE
68 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".115;" D AVAFC^VAFCDD01(DA)
69 S X=DE(1),DIC=DIE
70 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
71 S X=DE(1),DIIX=2_U_DIFLD D AUDIT^DIET
72C1S S X="" Q:DG(DQ)=X K DB
73 S X=DG(DQ),DIC=DIE
74 ;
75 S X=DG(DQ),DIC=DIE
76 S A1B2TAG="PAT" D ^A1B2XFR
77 S X=DG(DQ),DIC=DIE
78 D EVENT^IVMPLOG(DA)
79 S X=DG(DQ),DIC=DIE
80 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
81 S X=DG(DQ),DIC=DIE
82 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".115;" D AVAFC^VAFCDD01(DA)
83 S X=DG(DQ),DIC=DIE
84 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
85 I $D(DE(1))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
86 Q
87X1 Q
882 D:$D(DG)>9 F^DIE17,DE S DQ=2,DW=".11;12",DV="FXOaR",DU="",DLB="ZIP+4",DIFLD=.1112
89 S DQ(2,2)="S Y(0)=Y D ZIPOUT^VAFADDR"
90 S DE(DW)="C2^DVBAXA16"
91 G RE
92C2 G C2S:$D(DE(2))[0 K DB
93 S X=DE(2),DIC=DIE
94 D KILL^DGREGDD1(DA,.116,.11,6,$E(X,1,5))
95 S X=DE(2),DIC=DIE
96 D EVENT^IVMPLOG(DA)
97 S X=DE(2),DIC=DIE
98 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
99 S X=DE(2),DIC=DIE
100 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".1112;" D AVAFC^VAFCDD01(DA)
101 S X=DE(2),DIC=DIE
102 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
103 S X=DE(2),DIIX=2_U_DIFLD D AUDIT^DIET
104C2S S X="" Q:DG(DQ)=X K DB
105 S X=DG(DQ),DIC=DIE
106 D SET^DGREGDD1(DA,.116,.11,6,$E(X,1,5))
107 S X=DG(DQ),DIC=DIE
108 D EVENT^IVMPLOG(DA)
109 S X=DG(DQ),DIC=DIE
110 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
111 S X=DG(DQ),DIC=DIE
112 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".1112;" D AVAFC^VAFCDD01(DA)
113 S X=DG(DQ),DIC=DIE
114 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
115 I $D(DE(2))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
116 Q
117X2 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>20!($L(X)<5) X I $D(X) D ZIPIN^VAFADDR
118 I $D(X),X'?.ANP K X
119 Q
120 ;
1213 D:$D(DG)>9 F^DIE17,DE S DQ=3,DW=".11;7",DV="NJ3,0XOaR",DU="",DLB="COUNTY",DIFLD=.117
122 S DQ(3,2)="S Y(0)=Y Q:Y']"""" S Z0=$S($D(^DPT(D0,.11)):+$P(^(.11),""^"",5),1:"""") Q:'Z0 S Y=$P($S($D(^DIC(5,Z0,1,Y,0)):^(0),1:""""),""^"",3)"
123 S DE(DW)="C3^DVBAXA16"
124 G RE
125C3 G C3S:$D(DE(3))[0 K DB
126 S X=DE(3),DIC=DIE
127 S A1B2TAG="PAT" D ^A1B2XFR
128 S X=DE(3),DIC=DIE
129 D EVENT^IVMPLOG(DA)
130 S X=DE(3),DIC=DIE
131 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
132 S X=DE(3),DIC=DIE
133 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".117;" D AVAFC^VAFCDD01(DA)
134 S X=DE(3),DIIX=2_U_DIFLD D AUDIT^DIET
135C3S S X="" Q:DG(DQ)=X K DB
136 S X=DG(DQ),DIC=DIE
137 S A1B2TAG="PAT" D ^A1B2XFR
138 S X=DG(DQ),DIC=DIE
139 D EVENT^IVMPLOG(DA)
140 S X=DG(DQ),DIC=DIE
141 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
142 S X=DG(DQ),DIC=DIE
143 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".117;" D AVAFC^VAFCDD01(DA)
144 I $D(DE(3))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
145 Q
146X3 S Z0=$S($D(^DPT(D0,.11)):+$P(^(.11),"^",5),1:0) K:'Z0 X Q:'Z0!'$D(^DIC(5,Z0,1,0)) S DIC="^DIC(5,Z0,1,",DIC(0)="QEM" D ^DIC S X=+Y K:Y'>0 X K Z0,DIC
147 Q
148 ;
1494 D:$D(DG)>9 F^DIE17,DE S DQ=4,DW=".13;1",DV="Fa",DU="",DLB="PHONE NUMBER [RESIDENCE]",DIFLD=.131
150 S DE(DW)="C4^DVBAXA16"
151 G RE
152C4 G C4S:$D(DE(4))[0 K DB
153 S X=DE(4),DIC=DIE
154 D EVENT^IVMPLOG(DA)
155 S X=DE(4),DIC=DIE
156 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
157 S X=DE(4),DIC=DIE
158 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".131;" D AVAFC^VAFCDD01(DA)
159 S X=DE(4),DIC=DIE
160 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
161 S X=DE(4),DIIX=2_U_DIFLD D AUDIT^DIET
162C4S S X="" Q:DG(DQ)=X K DB
163 S X=DG(DQ),DIC=DIE
164 D EVENT^IVMPLOG(DA)
165 S X=DG(DQ),DIC=DIE
166 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
167 S X=DG(DQ),DIC=DIE
168 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".131;" D AVAFC^VAFCDD01(DA)
169 S X=DG(DQ),DIC=DIE
170 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
171 I $D(DE(4))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
172 Q
173X4 K:$L(X)>20!($L(X)<4) X
174 I $D(X),X'?.ANP K X
175 Q
176 ;
1775 D:$D(DG)>9 F^DIE17,DE S DQ=5,DW=".13;2",DV="Fa",DU="",DLB="PHONE NUMBER [WORK]",DIFLD=.132
178 S DE(DW)="C5^DVBAXA16"
179 G RE
180C5 G C5S:$D(DE(5))[0 K DB
181 S X=DE(5),DIC=DIE
182 D EVENT^IVMPLOG(DA)
183 S X=DE(5),DIC=DIE
184 S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
185 S X=DE(5),DIC=DIE
186 I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".132;" D AVAFC^VAFCDD01(DA)
187 S X=DE(5),DIC=DIE
188 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
189 S X=DE(5),DIIX=2_U_DIFLD D AUDIT^DIET
190C5S S X="" Q:DG(DQ)=X K DB
191 D ^DVBAXA17
192 Q
193X5 K:$L(X)>20!($L(X)<4) X
194 I $D(X),X'?.ANP K X
195 Q
196 ;
1976 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=6 D X6 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
198X6 S DVBACPLT=1
199 Q
2007 D:$D(DG)>9 F^DIE17,DE S DQ=7,DW=".32;6",DV="DX",DU="",DLB="SERVICE ENTRY DATE [LAST]",DIFLD=.326
201 S DE(DW)="C7^DVBAXA16"
202 G RE
203C7 G C7S:$D(DE(7))[0 K DB
204 D ^DVBAXA18
205C7S S X="" Q:DG(DQ)=X K DB
206 D ^DVBAXA19
207 Q
208X7 S %DT="E",%DT(0)=-DT D ^%DT K %DT S X=Y K:Y<1 X I $D(X) S DFN=DA D SV^DGLOCK I $D(X),$D(^DG(43,1)) S SD1=1 D POS^DGINP
209 Q
210 ;
2118 D:$D(DG)>9 F^DIE17,DE S DQ=8,DW=".32;7",DV="DX",DU="",DLB="SERVICE SEPARATION DATE [LAST]",DIFLD=.327
212 S DE(DW)="C8^DVBAXA16"
213 G RE
214C8 G C8S:$D(DE(8))[0 K DB
215 D ^DVBAXA20
216C8S S X="" Q:DG(DQ)=X K DB
217 D ^DVBAXA21
218 Q
219X8 S %DT="E",%DT(0)=-DT D ^%DT K %DT S X=Y K:Y<1 X I $D(X) S DFN=DA D SV^DGLOCK I $D(X),$D(^DG(43,1)) S SD1=1 D PS^DGINP
220 Q
221 ;
2229 S DQ=10 ;@2
22310 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=10 D X10 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
224X10 W *7,!!,"Need to edit the information you've just entered" S %=1 D YN^DICN
225 Q
22611 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=11 D X11 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
227X11 I $D(%Y) I %Y["?" W !!,"Enter Y to go back and correct any errors or ",!,"you may enter N to proceed." S Y="@2"
228 Q
22912 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=12 D X12 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
230X12 I $D(%),%=1 W @IOF,! S Y="@1"
231 Q
23213 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=13 D X13 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
233X13 K %,%Y
234 Q
23514 G 0^DIE17
Note: See TracBrowser for help on using the repository browser.