source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGRPTX10.m@ 1270

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

revised back to 6/30/08 version

File size: 7.9 KB
RevLine 
[623]1DGRPTX10 ; ;04/21/06
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(^(.21)) S %Z=^(.21) S %=$P(%Z,U,2) S:%]"" DE(1)=% S %=$P(%Z,U,3) S:%]"" DE(5)=% S %=$P(%Z,U,4) S:%]"" DE(7)=% S %=$P(%Z,U,5) S:%]"" DE(9)=% S %=$P(%Z,U,6) S:%]"" DE(10)=% S %=$P(%Z,U,7) S:%]"" DE(11)=% S %=$P(%Z,U,9) S:%]"" DE(13)=%
5 I S %=$P(%Z,U,10) S:%]"" DE(3)=% S %=$P(%Z,U,11) S:%]"" DE(14)=%
6 I $D(^(.22)) S %Z=^(.22) S %=$P(%Z,U,7) S:%]"" DE(12)=%
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="DGRPTX10",DQ=1
541 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW=".21;2",DV="FX",DU="",DLB="K-RELATIONSHIP TO PATIENT",DIFLD=.212
55 S DE(DW)="C1^DGRPTX10",DE(DW,"INDEX")=1
56 G RE
57C1 G C1S:$D(DE(1))[0 K DB
58 S X=DE(1),DIC=DIE
59 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
60C1S S X="" G:DG(DQ)=X C1F1 K DB
[613]61 S X=DG(DQ),DIC=DIE
[623]62 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
63C1F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
64 F DIXR=602 S DIEZRXR(2,DIXR)=""
65 Q
66X1 K:$L(X)>30!($L(X)<1) X I $D(X) S DFN=DA D K1^DGLOCK2
67 I $D(X),X'?.ANP K X
68 Q
69 ;
702 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=2 G A
713 D:$D(DG)>9 F^DIE17,DE S DQ=3,DW=".21;10",DV="RSX",DU="",DLB="K-ADDRESS SAME AS PATIENT'S?",DIFLD=.2125
72 S DE(DW)="C3^DGRPTX10",DE(DW,"INDEX")=1
73 S DU="Y:YES;N:NO;"
74 S Y="NO"
75 G Y
76C3 G C3S:$D(DE(3))[0 K DB
77C3S S X="" G:DG(DQ)=X C3F1 K DB
78C3F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
79 F DIXR=602 S DIEZRXR(2,DIXR)=""
80 Q
81X3 I $D(X),X="Y" S DFN=DA D K1^DGLOCK2
82 Q
83 ;
844 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=4 D X4 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
85X4 I X="Y" S DGADD=".21" D AD^DGRPE S Y=.21011
86 Q
875 D:$D(DG)>9 F^DIE17,DE S DQ=5,DW=".21;3",DV="FX",DU="",DLB="K-STREET ADDRESS [LINE 1]",DIFLD=.213
88 S DE(DW)="C5^DGRPTX10",DE(DW,"INDEX")=1
89 G RE
90C5 G C5S:$D(DE(5))[0 K DB
91 S X=DE(5),DIC=DIE
92 X "S DGXRF=.213 D ^DGDDC Q"
93 S X=DE(5),DIC=DIE
94 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
95C5S S X="" G:DG(DQ)=X C5F1 K DB
[613]96 S X=DG(DQ),DIC=DIE
[623]97 ;
[613]98 S X=DG(DQ),DIC=DIE
[623]99 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
100C5F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
101 F DIXR=602 S DIEZRXR(2,DIXR)=""
102 Q
103X5 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D K1^DGLOCK2
104 I $D(X),X'?.ANP K X
105 Q
106 ;
1076 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
108X6 S:X="" Y=.216
109 Q
1107 D:$D(DG)>9 F^DIE17,DE S DQ=7,DW=".21;4",DV="FX",DU="",DLB="K-STREET ADDRESS [LINE 2]",DIFLD=.214
111 S DE(DW)="C7^DGRPTX10",DE(DW,"INDEX")=1
112 G RE
113C7 G C7S:$D(DE(7))[0 K DB
114 S X=DE(7),DIC=DIE
115 X "S DGXRF=.214 D ^DGDDC Q"
116 S X=DE(7),DIC=DIE
117 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
118C7S S X="" G:DG(DQ)=X C7F1 K DB
[613]119 S X=DG(DQ),DIC=DIE
[623]120 ;
121 S X=DG(DQ),DIC=DIE
[613]122 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
[623]123C7F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
124 F DIXR=602 S DIEZRXR(2,DIXR)=""
125 Q
126X7 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D K1^DGLOCK2
127 I $D(X),X'?.ANP K X
128 Q
129 ;
1308 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=8 D X8 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
131X8 S:X="" Y=.216
132 Q
1339 D:$D(DG)>9 F^DIE17,DE S DQ=9,DW=".21;5",DV="FX",DU="",DLB="K-STREET ADDRESS [LINE 3]",DIFLD=.215
134 S DE(DW)="C9^DGRPTX10",DE(DW,"INDEX")=1
135 G RE
136C9 G C9S:$D(DE(9))[0 K DB
137C9S S X="" G:DG(DQ)=X C9F1 K DB
138C9F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
139 F DIXR=602 S DIEZRXR(2,DIXR)=""
140 Q
141X9 K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D K1^DGLOCK2
142 I $D(X),X'?.ANP K X
143 Q
144 ;
14510 D:$D(DG)>9 F^DIE17,DE S DQ=10,DW=".21;6",DV="FX",DU="",DLB="K-CITY",DIFLD=.216
146 S DE(DW)="C10^DGRPTX10",DE(DW,"INDEX")=1
147 G RE
148C10 G C10S:$D(DE(10))[0 K DB
149 S X=DE(10),DIC=DIE
150 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
151C10S S X="" G:DG(DQ)=X C10F1 K DB
152 S X=DG(DQ),DIC=DIE
153 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
154C10F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
155 F DIXR=602 S DIEZRXR(2,DIXR)=""
156 Q
157X10 K:$L(X)>30!($L(X)<3) X I $D(X) S DFN=DA D K1^DGLOCK2
158 I $D(X),X'?.ANP K X
159 Q
160 ;
16111 D:$D(DG)>9 F^DIE17,DE S DQ=11,DW=".21;7",DV="P5'X",DU="",DLB="K-STATE",DIFLD=.217
162 S DE(DW)="C11^DGRPTX10",DE(DW,"INDEX")=1
163 S DU="DIC(5,"
164 G RE
165C11 G C11S:$D(DE(11))[0 K DB
166 S X=DE(11),DIC=DIE
167 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
168C11S S X="" G:DG(DQ)=X C11F1 K DB
169 S X=DG(DQ),DIC=DIE
170 D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
171C11F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
172 F DIXR=602 S DIEZRXR(2,DIXR)=""
173 Q
174X11 I $D(X) S DFN=DA D K1^DGLOCK2
175 Q
176 ;
17712 D:$D(DG)>9 F^DIE17,DE S DQ=12,DW=".22;7",DV="FOX",DU="",DLB="K-ZIP+4",DIFLD=.2207
178 S DQ(12,2)="S Y(0)=Y D ZIPOUT^VAFADDR"
179 S DE(DW)="C12^DGRPTX10",DE(DW,"INDEX")=1
180 G RE
181C12 G C12S:$D(DE(12))[0 K DB
182 S X=DE(12),DIC=DIE
183 D KILL^DGREGDD1(DA,.218,.21,8,$E(X,1,5))
184C12S S X="" G:DG(DQ)=X C12F1 K DB
185 S X=DG(DQ),DIC=DIE
186 D SET^DGREGDD1(DA,.218,.21,8,$E(X,1,5))
187C12F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
188 F DIXR=602 S DIEZRXR(2,DIXR)=""
189 Q
190X12 K:X[""""!($A(X)=45) X I $D(X) S DFN=DA D K1^DGLOCK2 I $D(X) K:$L(X)>15!($L(X)<5) X I $D(X) D ZIPIN^VAFADDR
191 I $D(X),X'?.ANP K X
192 Q
193 ;
19413 D:$D(DG)>9 F^DIE17,DE S DQ=13,DW=".21;9",DV="FXa",DU="",DLB="K-PHONE NUMBER",DIFLD=.219
195 S DE(DW)="C13^DGRPTX10"
196 G RE
197C13 G C13S:$D(DE(13))[0 K DB
198 D ^DGRPTX11
199C13S S X="" G:DG(DQ)=X C13F1 K DB
200 D ^DGRPTX12
201C13F1 Q
202X13 K:$L(X)>20!($L(X)<4) X I $D(X) S DFN=DA D K1^DGLOCK2
203 I $D(X),X'?.ANP K X
204 Q
205 ;
20614 D:$D(DG)>9 F^DIE17,DE S DQ=14,DW=".21;11",DV="F",DU="",DLB="K-WORK PHONE NUMBER",DIFLD=.21011
207 G RE
208X14 K:$L(X)>20!($L(X)<4) X
209 I $D(X),X'?.ANP K X
210 Q
211 ;
21215 S DQ=16 ;@30
21316 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=16 D X16 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
214X16 I $S('$D(^DPT(DFN,.21)):1,$P(^(.21),U,1)="":1,1:0) S Y=.331
215 Q
21617 D:$D(DG)>9 F^DIE17 G ^DGRPTX13
Note: See TracBrowser for help on using the repository browser.