DVBHCE18 ; ;07/06/22
D DE G BEGIN
DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
I $D(^(.11)) S %Z=^(.11) S %=$P(%Z,U,7) S:%]"" DE(1)=%
I $D(^(.29)) S %Z=^(.29) S %=$P(%Z,U,12) S:%]"" DE(44)=%
I $D(^(.31)) S %Z=^(.31) S %=$P(%Z,U,3) S:%]"" DE(18)=%
I $D(^(.35)) S %Z=^(.35) S %=$P(%Z,U,1) S:%]"" DE(37)=%
I $D(^(.52)) S %Z=^(.52) S %=$P(%Z,U,5) S:%]"" DE(55)=%
K %Z Q
;
W W !?DL+DL-2,DLB_": "
Q
O D W W Y W:$X>45 !?9
I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 K X S X("FIELD")=DIFLD,X("FILE")=DP W " ("_$$EZBLD^DIALOG(710,.X)_")" K X S X="" Q ;**
TR Q:DV["K"&(DUZ(0)'="@") R X:DTIME E S (DTOUT,X)=U W $C(7)
Q
A K DQ(DQ) S DQ=DQ+1
B G @DQ
RE G A:DV["K"&(DUZ(0)'["@"),PR:$D(DE(DQ)) D W,TR
N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
RD G QS:X?."?" I X["^" D D G ^DIE17
I X="@" D D G Z^DIE2
I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W " "_X
T G M^DIE17:DV,^DIE3:DV["V",X:X'?.ANP
I DV["t" D G UNIQ ;EXTENSIBLE DATA TYPES ;p21
.X $S($D(DB(DQ)):$$VALEXTS^DIETLIBF(DP,DIFLD),1:$$VALEXT^DIETLIBF(DP,DIFLD)) K DIPA
I DV["S" D SET^DIED G V:'DDER K DDER G X ;p22
P 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
G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
V D @("X"_DQ) K YS
UNIQ I DV["U",$D(X),DIFLD=.01 K % M %=@(DIE_"""B"",X)") K %(DA) K:$O(%(0)) X
Z 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
X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
S X="?BAD"
QS S DZ=X D D,QQ^DIEQ G B
D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
I DG["t" X $$OUTPUT^DIETLIBF(DP,DIFLD) K DIPA G RP ;p21
R 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
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
X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") I %]"" S Y=$S($G(DUZ("LANG"))'>1:%,'DIFLD:%,1:$$SET^DIQ(DP,DIFLD,Y))
RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
I I DV'["I",DV'["#" G RD
D E^DIE0 G RD:$D(X),PR
Q
SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
E K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
Q
NKEY W:'$D(ZTQUEUED) "?? Required key field" S X="?BAD" G QS
KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
BEGIN S DNM="DVBHCE18",DQ=1
1 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW=".11;7",DV="NJ3,0XOa",DU="",DIFLD=.117,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DQ(1,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)"
S DE(DW)="C1^DVBHCE18"
G RE
C1 G C1S:$D(DE(1))[0 K DB
S X=DE(1),DIC=DIE
S A1B2TAG="PAT" D ^A1B2XFR
S X=DE(1),DIC=DIE
D EVENT^IVMPLOG(DA)
S X=DE(1),DIC=DIE
S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
S X=DE(1),DIC=DIE
I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".117;" D AVAFC^VAFCDD01(DA)
S X=DE(1),DIIX=2_U_DIFLD D AUDIT^DIET
C1S S X="" G:DG(DQ)=X C1F1 K DB
S X=DG(DQ),DIC=DIE
S A1B2TAG="PAT" D ^A1B2XFR
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
S X=DG(DQ),DIC=DIE
S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
S X=DG(DQ),DIC=DIE
I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".117;" D AVAFC^VAFCDD01(DA)
I $D(DE(1))'[0!($G(^DD(DP,DIFLD,"AUDIT"))["y") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
C1F1 Q
X1 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
Q
;
2 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=2 D X2 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
X2 S Y="@1001"
Q
3 S DQ=4 ;@5
4 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
X4 D SCRQ^DVBHUTIL
Q
5 S DQ=6 ;@6
6 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
X6 D B^DVBHQEDT R AA:DTIME K AA S Y=$S(DVBJS=11:"@1001",DVBJS=28:"@1",DVBJS=35:"@2",DVBJS=44:"@3",DVBJS=53:"@104",1:"@10")
Q
7 S DQ=8 ;@8
8 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
X8 S Y=$S(ANS="^0":"@101",ANS="^1":"@1001",ANS="^2":"@1",ANS="^3":"@2",ANS="^4":"@3",ANS="^5":"@104",1:Y) I Y["@" W @$S('$D(IOF):"#",IOF="":"#",1:IOF)
Q
9 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=9 D X9 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
X9 D A^DVBHQEDT S Z2=Z I ERROR K ERROR S Y=$S(DVBJS=11:"@1001",DVBJS=28:"@1",DVBJS=35:"@2",DVBJS=44:"@3",DVBJS=53:"@104",1:"@10")
Q
10 S DQ=11 ;@20
11 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
X11 S JP=1,Y=$S(DVBJS=11:"@11",DVBJS=35:"@40",DVBJS=44:"@30",DVBJS=53:"@204",1:Y)
Q
12 S DQ=13 ;@21
13 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
X13 I $P(Z2,U,JP)'=1 S Y="@22"
Q
14 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=14 D X14 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
X14 I '$D(DVBCN) S Y="@22",JP=JP+1
Q
15 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=15 D X15 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
X15 I 'DVBCN S Y="@22",JP=JP+1
Q
16 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
X16 S DVBCN=$TR(DVBCN," ")
Q
17 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=17 D X17 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
X17 I $L(DVBCN)=9,(DVBCN?9N),(DVBCN'=$P(^DPT(D0,0),U,9)) W !!,*7,"HINQ claim # is a SSN, does not match patient file SSN NO UPDATING claim #" R !,?25,"<RET to continue>",DVBQ:DTIME K DVBQ S Y="@22",JP=JP+1
Q
18 D:$D(DG)>9 F^DIE17,DE S DQ=18,DW=".31;3",DV="FXOa",DU="",DIFLD=.313,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DQ(18,2)="S Y(0)=Y S Y=$E(Y,1,10)"
S DE(DW)="C18^DVBHCE18"
S X=DVBCN
S Y=X
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
C18 G C18S:$D(DE(18))[0 K DB
S X=DE(18),DIC=DIE
I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".313;" D AVAFC^VAFCDD01(DA)
S X=DE(18),DIC=DIE
D EVENT^IVMPLOG(DA)
S X=DE(18),DIIX=2_U_DIFLD D AUDIT^DIET
C18S S X="" G:DG(DQ)=X C18F1 K DB
S X=DG(DQ),DIC=DIE
I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".313;" D AVAFC^VAFCDD01(DA)
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
I $D(DE(18))'[0!($G(^DD(DP,DIFLD,"AUDIT"))["y") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
C18F1 Q
X18 S DFN=DA D EV^DGLOCK I $D(X) S L=$S($D(^DPT(DA,0)):$P(^(0),U,9),1:X) W:X?1"SS".E " ",L S:X?1"SS".E X=L K:$L(X)>9 X Q:'$D(X) I X'=L K:$L(X)>8!($L(X)<7)!'(X?.N) X
I $D(X),X'?.ANP K X
Q
;
19 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=19 D X19 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
X19 W "." S JP=JP+1,DVBJ2=1
Q
20 S DQ=21 ;@22
21 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=21 D X21 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
X21 I $P(Z2,U,JP)'=2 S Y="@225"
Q
22 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=22 D X22 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
X22 W !,"Date of Birth cannot be edited with this option."
Q
23 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=23 D X23 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
X23 H 1
Q
24 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=24 D X24 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
X24 W "." S JP=JP+1,DVBJ2=1
Q
25 S DQ=26 ;@225
26 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=26 D X26 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
X26 I $P(Z2,U,JP)'=3 S Y="@23"
Q
27 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=27 D X27 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
X27 W !,"Sex cannot be edited with this option."
Q
28 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=28 D X28 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
X28 H 1
Q
29 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=29 D X29 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
X29 W "." S JP=JP+1,DVBJ2=1
Q
30 S DQ=31 ;@23
31 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=31 D X31 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
X31 I $P(Z2,U,JP)'=4 S Y="@24"
Q
32 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=32 D X32 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
X32 K Z1 I $D(DVBP(6)),+$P(DVBP(6),U) S Z1=$P(DVBP(6),U),Z1=$E(Z1,1,2)_" "_$E(Z1,3,4)_" "_$E(Z1,5,8)
Q
33 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=33 D X33 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
X33 I $D(DVBVET),$P(DVBVET,U,1)="B",+$P(DVBVET,U,12) S Z1=$P(DVBVET,U,12),Z1=$E(Z1,5,6)_" "_$E(Z1,7,8)_" "_$E(Z1,1,4)
Q
34 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=34 D X34 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
X34 I '$D(Z1) S Y="@24",JP=JP+1
Q
35 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=35 D X35 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
X35 I 'Z1 S Y="@24",JP=JP+1
Q
36 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=36 D X36 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
X36 I $D(^DPT(D0,.105)) W !!,"Patient is currently in-house." W !,"Discharge patient with a discharge type of DEATH." R !,?25,"<RET to continue>",DVBQ:DTIME K DVBQ S Y="@24",JP=JP+1
Q
37 D:$D(DG)>9 F^DIE17,DE S DQ=37,DW=".35;1",DV="DXa",DU="",DIFLD=.351,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C37^DVBHCE18",DE(DW,"INDEX")=1
S X=Z1
S Y=X
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
C37 G C37S:$D(DE(37))[0 K DB
S X=DE(37),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,0)):^(0),1:"") S X=$P(Y(1),U,10),X=X S DIU=X K Y X ^DD(2,.351,1,1,2.1) S DIH=$G(^DPT(DIV(0),0)),DIV=X S $P(^(0),U,10)=DIV,DIH=2,DIG=.091 D ^DICR
S X=DE(37),DIC=DIE
;
S X=DE(37),DIC=DIE
D DKBULL^DGDEATH
S X=DE(37),DIC=DIE
K ^DPT("AEXP1",$E(X,1,30),DA)
S X=DE(37),DIC=DIE
;
S X=DE(37),DIC=DIE
;
S X=DE(37),DIC=DIE
S RCX=X,X="RCAMDTH" X ^%ZOSF("TEST") S X=RCX K RCX I D ERR^RCAMDTH
S X=DE(37),DIC=DIE
D KILL^DGDEPINA
S X=DE(37),DIC=DIE
D AUTOUPD^DGENA2(DA)
S X=DE(37),DIC=DIE
;
S X=DE(37),DIC=DIE
I $$VERSION^XPDUTL("PSO")>6 D APSOD^PSOAUTOC(DA)
S X=DE(37),DIC=DIE
S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
S X=DE(37),DIC=DIE
I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".351;" D AVAFC^VAFCDD01(DA)
S X=DE(37),DIC=DIE
D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
S X=DE(37),DIIX=2_U_DIFLD D AUDIT^DIET
C37S S X="" G:DG(DQ)=X C37F1 K DB
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,0)):^(0),1:"") S X=$P(Y(1),U,10),X=X S DIU=X K Y S X=DIV X ^DD(2,.351,1,1,49.3) S X=$E(Y(8),Y(9),X) S Y=X,X=Y(7),X=X_Y_"]" X ^DD(2,.351,1,1,1.4)
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.35)):^(.35),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X=DIV S X=$S(($D(DUZ)#2):DUZ,1:"") S DIH=$G(^DPT(DIV(0),.35)),DIV=X S $P(^(.35),U,2)=DIV,DIH=2,DIG=.352 D ^DICR
S X=DG(DQ),DIC=DIE
D DSBULL^DGDEATH
S X=DG(DQ),DIC=DIE
S ^DPT("AEXP1",$E(X,1,30),DA)=""
S X=DG(DQ),DIC=DIE
D DEATH^DGOERNOT
S X=DG(DQ),DIC=DIE
S XX=X,X="PSJADT" X ^%ZOSF("TEST") S X=XX K XX I D END^PSJADT
S X=DG(DQ),DIC=DIE
S RCX=X,X="RCAMDTH" X ^%ZOSF("TEST") S X=RCX K RCX I D SET^RCAMDTH
S X=DG(DQ),DIC=DIE
D SET^DGDEPINA
S X=DG(DQ),DIC=DIE
D AUTOUPD^DGENA2(DA)
S X=DG(DQ),DIC=DIE
D START^DGMTDELS(DA)
S X=DG(DQ),DIC=DIE
I $$VERSION^XPDUTL("PSO")>6 D APSOD^PSOCAN3(DA)
S X=DG(DQ),DIC=DIE
S IVMX=X,X="IVMPXFR" X ^%ZOSF("TEST") D:$T DPT^IVMPXFR S X=IVMX K IVMX
S X=DG(DQ),DIC=DIE
I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".351;" D AVAFC^VAFCDD01(DA)
S X=DG(DQ),DIC=DIE
D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
I $D(DE(37))'[0!($G(^DD(DP,DIFLD,"AUDIT"))["y") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
C37F1 N X,X1,X2 S DIXR=886 D C37X1(U) K X2 M X2=X D C37X1("O") K X1 M X1=X
D
. D FC^DGFCPROT(.DA,2,.351,"KILL",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
K X M X=X2 D
. D FC^DGFCPROT(.DA,2,.351,"SET",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
G C37F2
C37X1(DION) K X
S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.351,DION),$P($G(^DPT(DA,.35)),U,1))
S X=$G(X(1))
Q
C37F2 S DIXR=889 D C37X2(U) K X2 M X2=X D C37X2("O") K X1 M X1=X
D
. D FC^DGFCPROT(.DA,2,.351,"KILL",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
K X M X=X2 D
. D FC^DGFCPROT(.DA,2,.351,"SET",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
G C37F3
C37X2(DION) K X
S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.351,DION),$P($G(^DPT(DA,.35)),U,1))
S X=$G(X(1))
Q
C37F3 S DIXR=1351 D C37X3(U) K X2 M X2=X D C37X3("O") K X1 M X1=X
K X M X=X2 D
. N DIEXARR M DIEXARR=X S DIEZCOND=1
. S X=$S((X(1)'="")&(X1(1)=""):1,1:0)
. S DIEZCOND=$G(X) K X M X=DIEXARR Q:'DIEZCOND
. D DEATH^IBCNEUT7(DA,X(1))
G C37F4
C37X3(DION) K X
S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.351,DION),$P($G(^DPT(DA,.35)),U,1))
S X=$G(X(1))
Q
C37F4 Q
X37 S %DT="PXT" D ^%DT S X=Y K:Y<1 X I $D(X) D H^DGUTL K:X>DGTIME X K DGTIME,DGDATE I $D(X) S DFN=DA D DEATH^DGLOCK
Q
;
38 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=38 D X38 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
X38 W "." S JP=JP+1,DVBJ2=1
Q
39 S DQ=40 ;@24
40 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=40 D X40 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
X40 I $P(Z2,U,JP)'=5 S Y="@25"
Q
41 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=41 D X41 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
X41 K DVBSICK I $D(DVBP(6)) S DVBSICK=$P(DVBP(6),U,7)
Q
42 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=42 D X42 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
X42 I $D(DVBCI) S DVBSICK=DVBCI
Q
43 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=43 D X43 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
X43 I '$D(DVBSICK) S Y="@25",JP=JP+1
Q
44 D:$D(DG)>9 F^DIE17,DE S DQ=44,DW=".29;12",DV="S",DU="",DIFLD=.293,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C44^DVBHCE18"
S DU="0:NO;1:YES;"
S X=$S((DVBSICK="I")!(DVBSICK="Y"):1,1:0)
S Y=X
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
C44 G C44S:$D(DE(44))[0 K DB
S X=DE(44),DIC=DIE
D EVENT^IVMPLOG(DA)
C44S S X="" G:DG(DQ)=X C44F1 K DB
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
C44F1 Q
X44 Q
45 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=45 D X45 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
X45 W "." S JP=JP+1,DVBJ2=1 K DVBSICK
Q
46 S DQ=47 ;@25
47 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=47 D X47 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
X47 I $P(Z2,U,JP)'=6 S Y="@26"
Q
48 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=48 D X48 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
X48 I '$D(DVBPOW),'$D(DVBPOWD) S Y="@26",JP=JP+1
Q
49 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=49 D X49 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
X49 I '$D(DVBPOW),$D(DVBPOWD),+DVBPOWD W !!,*7,?17,DVBON,"POW Indicator Discrepancy! <RET>",DVBOFF X DVBLIT1 R DVBZ:DTIME K DVBZ S JP=JP+1,Y="@26"
Q
50 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=50 D X50 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
X50 I '$D(DVBPOW),'+DVBPOWD S Y="@26",JP=JP+1
Q
51 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=51 D X51 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
X51 I '$D(DVBPOWD),$D(DVBPOW),DVBPOW>0 W !!,*7,?17,DVBON,"POW Indicator Discrepancy! <RET>",DVBOFF X DVBLIT1 R DVBZ:DTIME K DVBZ S JP=JP+1,Y="@26"
Q
52 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=52 D X52 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
X52 I $D(DVBPOWD),$D(DVBPOW),DVBPOWD=0,DVBPOW>0 W !!,*7,?17,DVBON,"POW Indicator Discrepancy! <RET>",DVBOFF X DVBLIT1 R DVBZ:DTIME K DVBZ S JP=JP+1,Y="@26"
Q
53 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=53 D X53 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
X53 I $D(DVBPOWD),$D(DVBPOW),+DVBPOW<1,+DVBPOWD W !!,*7,?17,DVBON,"POW Indicator Discrepancy! <RET>",DVBOFF X DVBLIT1 R DVBZ:DTIME K DVBZ S JP=JP+1,Y="@26"
Q
54 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=54 D X54 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
X54 D POW^DVBHUTIL
Q
55 D:$D(DG)>9 F^DIE17,DE S DQ=55,DW=".52;5",DV="RSX",DU="",DIFLD=.525,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C55^DVBHCE18",DE(DW,"INDEX")=1
S DU="Y:YES;N:NO;U:UNKNOWN;"
S X=DVBPOW1
S Y=X
S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD
C55 G C55S:$D(DE(55))[0 K DB
S X=DE(55),DIC=DIE
;
S X=DE(55),DIC=DIE
;
S X=DE(55),DIC=DIE
;
S X=DE(55),DIC=DIE
D AUTOUPD^DGENA2(DA)
S X=DE(55),DIC=DIE
X "S DFN=DA D EN^DGMTR K DGREQF"
S X=DE(55),DIC=DIE
D EVENT^IVMPLOG(DA)
C55S S X="" G:DG(DQ)=X C55F1 K DB
S X=DG(DQ),DIC=DIE
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)
S X=DG(DQ),DIC=DIE
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)
S X=DG(DQ),DIC=DIE
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)
S X=DG(DQ),DIC=DIE
D AUTOUPD^DGENA2(DA)
S X=DG(DQ),DIC=DIE
X "S DFN=DA D EN^DGMTR K DGREQF"
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
C55F1 N X,X1,X2 S DIXR=627 D C55X1(U) K X2 M X2=X D C55X1("O") K X1 M X1=X
D
. D FC^DGFCPROT(.DA,2,.525,"KILL",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
K X M X=X2 D
. D FC^DGFCPROT(.DA,2,.525,"SET",$H,$G(DUZ),.X,.X1,.X2,$G(XQY0)) Q
G C55F2
C55X1(DION) K X
S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.525,DION),$P($G(^DPT(DA,.52)),U,5))
S X=$G(X(1))
Q
C55F2 Q
X55 S DFN=DA D POWV^DGLOCK I $D(X) D SV^DGLOCK
Q
;
56 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=56 D X56 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
X56 K DVBPOW1 W "." S JP=JP+1,DVBJ2=1
Q
57 S DQ=58 ;@26
58 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=58 D X58 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
X58 I $P(Z2,U,JP)'=7 S Y="@27"
Q
59 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=59 D X59 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
X59 I '$D(DVBFL) S Y="@27",JP=JP+1
Q
60 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=60 D X60 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
X60 I DVBFL']"" S Y="@27",JP=JP+1
Q
61 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=61 D X61 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
X61 I DVBFL'?3N1" - "1U.E S Y="@27",JP=JP+1
Q
62 D:$D(DG)>9 F^DIE17 G ^DVBHCE19
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDVBHCE18 19888 printed Nov 22, 2024@17:08:14 Page 2
DVBHCE18 ; ;07/06/22
+1 DO DE
GOTO BEGIN
DE SET DIE="^DPT("
SET DIC=DIE
SET DP=2
SET DL=1
SET DIEL=0
SET DU=""
KILL DG,DE,DB
if $ORDER(^DPT(DA,""))=""
QUIT
+1 IF $DATA(^(.11))
SET %Z=^(.11)
SET %=$PIECE(%Z,U,7)
if %]""
SET DE(1)=%
+2 IF $DATA(^(.29))
SET %Z=^(.29)
SET %=$PIECE(%Z,U,12)
if %]""
SET DE(44)=%
+3 IF $DATA(^(.31))
SET %Z=^(.31)
SET %=$PIECE(%Z,U,3)
if %]""
SET DE(18)=%
+4 IF $DATA(^(.35))
SET %Z=^(.35)
SET %=$PIECE(%Z,U,1)
if %]""
SET DE(37)=%
+5 IF $DATA(^(.52))
SET %Z=^(.52)
SET %=$PIECE(%Z,U,5)
if %]""
SET DE(55)=%
+6 KILL %Z
QUIT
+7 ;
W WRITE !?DL+DL-2,DLB_": "
+1 QUIT
O DO W
WRITE Y
if $X>45
WRITE !?9
+1 IF $LENGTH(Y)>19
IF 'DV
IF DV'["I"
IF (DV["F"!(DV["K"))
GOTO RW^DIR2
+2 ;**
if Y]""
WRITE "// "
IF 'DV
IF DV["I"
IF $DATA(DE(DQ))#2
KILL X
SET X("FIELD")=DIFLD
SET X("FILE")=DP
WRITE " ("_$$EZBLD^DIALOG(710,.X)_")"
KILL X
SET X=""
QUIT
TR if DV["K"&(DUZ(0)'="@")
QUIT
READ X:DTIME
IF '$TEST
SET (DTOUT,X)=U
WRITE $CHAR(7)
+1 QUIT
A KILL DQ(DQ)
SET DQ=DQ+1
B GOTO @DQ
RE if DV["K"&(DUZ(0)'["@")
GOTO A
if $DATA(DE(DQ))
GOTO PR
DO W
DO TR
N IF X=""
if $DATA(^DD("KEY","F",DP,DIFLD))
GOTO NKEY
if DV'["R"
GOTO A
if 'DV
GOTO X
if D'>0
GOTO X
GOTO A
RD if X?."?"
GOTO QS
IF X["^"
DO D
GOTO ^DIE17
+1 IF X="@"
DO D
GOTO Z^DIE2
+2 IF X=" "
IF DV["d"
IF DV'["P"
IF $DATA(^DISV(DUZ,"DIE",DLB))
SET X=^(DLB)
IF DV'["D"
IF DV'["S"
WRITE " "_X
T if DV
GOTO M^DIE17
if DV["V"
GOTO ^DIE3
if X'?.ANP
GOTO X
+1 ;EXTENSIBLE DATA TYPES ;p21
IF DV["t"
Begin DoDot:1
+2 XECUTE $SELECT($DATA(DB(DQ)):$$VALEXTS^DIETLIBF(DP,DIFLD),1:$$VALEXT^DIETLIBF(DP,DIFLD))
KILL DIPA
End DoDot:1
GOTO UNIQ
+3 ;p22
IF DV["S"
DO SET^DIED
if 'DDER
GOTO V
KILL DDER
GOTO X
P IF DV["P"
SET DIC=U_DU
SET DIC(0)=$EXTRACT("EN",$DATA(DB(DQ))+1)_"M"_$EXTRACT("L",DV'["'")
if DIC(0)["L"
SET DLAYGO=+$PIECE(DV,"P",2)
if DV["*"
GOTO AST^DIED
DO NOSCR^DIED
SET X=+Y
SET DIC=DIE
if X<0
GOTO X
+1 if DV'["N"
GOTO V
DO D
IF $LENGTH($PIECE(X,"."))>24
KILL X
GOTO Z
+2 IF $PIECE(DQ(DQ),U,5)'["$"
IF X?.1"-".N.1".".N
IF $PIECE(DQ(DQ),U,5,99)["+X'=X"
SET X=+X
V DO @("X"_DQ)
KILL YS
UNIQ IF DV["U"
IF $DATA(X)
IF DIFLD=.01
KILL %
MERGE %=@(DIE_"""B"",X)")
KILL %(DA)
if $ORDER(%(0))
KILL X
Z KILL DIC("S"),DLAYGO
IF $DATA(X)
IF X'=U
if $GET(DE(DW,"INDEX"))
DO SAVEVALS
if '$$KEYCHK
GOTO UNIQFERR^DIE17
SET DG(DW)=X
if DV["d"
SET ^DISV(DUZ,"DIE",DLB)=X
GOTO A
X if '$DATA(ZTQUEUED)
WRITE $CHAR(7),"??"
IF $DATA(DB(DQ))
GOTO Z^DIE17
+1 SET X="?BAD"
QS SET DZ=X
DO D
DO QQ^DIEQ
GOTO B
D SET D=DIFLD
SET DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$PIECE($TEXT(@("X"_DQ))," ",2,99)
QUIT
Y IF '$DATA(DE(DQ))
DO O
if "@"'[X
GOTO RD
if DV'["R"&(X="@")
GOTO A
if X="@"
GOTO X
SET X=Y
GOTO N
PR SET DG=DV
SET Y=DE(DQ)
SET X=DU
IF $DATA(DQ(DQ,2))
XECUTE DQ(DQ,2)
GOTO RP
+1 ;p21
IF DG["t"
XECUTE $$OUTPUT^DIETLIBF(DP,DIFLD)
KILL DIPA
GOTO RP
R IF DG["P"
IF @("$D(^"_X_"0))")
SET X=+$PIECE(^(0),U,2)
if '$DATA(^(Y,0))
GOTO RP
SET Y=$PIECE(^(0),U)
SET X=$PIECE(^DD(X,.01,0),U,3)
SET DG=$PIECE(^(0),U,2)
GOTO R
+1 IF DG["V"
IF +Y
IF $PIECE(Y,";",2)["("
IF $DATA(@(U_$PIECE(Y,";",2)_"0)"))
SET X=+$PIECE(^(0),U,2)
if '$DATA(^(+Y,0))
GOTO RP
SET Y=$PIECE(^(0),U)
IF $DATA(^DD(+X,.01,0))
SET DG=$PIECE(^(0),U,2)
SET X=$PIECE(^(0),U,3)
GOTO R
+2 if DG["D"
XECUTE ^DD("DD")
IF DG["S"
SET %=$PIECE($PIECE(";"_X,";"_Y_":",2),";")
IF %]""
SET Y=$SELECT($GET(DUZ("LANG"))'>1:%,'DIFLD:%,1:$$SET^DIQ(DP,DIFLD,Y))
RP DO O
IF X=""
SET X=DE(DQ)
if 'DV
GOTO A
if DC<2
GOTO A
GOTO N^DIE17
I IF DV'["I"
IF DV'["#"
GOTO RD
+1 DO E^DIE0
if $DATA(X)
GOTO RD
GOTO PR
+2 QUIT
SAVEVALS SET @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$GET(DE(DQ))
if $DATA(^("F"))[0
SET ^("F")=$GET(DE(DQ))
+1 IF $DATA(DE(DW,"4/"))
SET @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
+2 IF '$TEST
KILL @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
+3 QUIT
NKEY if '$DATA(ZTQUEUED)
WRITE "?? Required key field"
SET X="?BAD"
GOTO QS
KEYCHK() if $GET(DE(DW,"KEY"))=""
QUIT 1
QUIT @DE(DW,"KEY")
BEGIN SET DNM="DVBHCE18"
SET DQ=1
1 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=1
SET DW=".11;7"
SET DV="NJ3,0XOa"
SET DU=""
SET DIFLD=.117
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DQ(1,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)"
+2 SET DE(DW)="C1^DVBHCE18"
+3 GOTO RE
C1 if $DATA(DE(1))[0
GOTO C1S
KILL DB
+1 SET X=DE(1)
SET DIC=DIE
+2 SET A1B2TAG="PAT"
DO ^A1B2XFR
+3 SET X=DE(1)
SET DIC=DIE
+4 DO EVENT^IVMPLOG(DA)
+5 SET X=DE(1)
SET DIC=DIE
+6 SET IVMX=X
SET X="IVMPXFR"
XECUTE ^%ZOSF("TEST")
if $TEST
DO DPT^IVMPXFR
SET X=IVMX
KILL IVMX
+7 SET X=DE(1)
SET DIC=DIE
+8 IF ($TEXT(AVAFC^VAFCDD01)'="")
SET VAFCF=".117;"
DO AVAFC^VAFCDD01(DA)
+9 SET X=DE(1)
SET DIIX=2_U_DIFLD
DO AUDIT^DIET
C1S SET X=""
if DG(DQ)=X
GOTO C1F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 SET A1B2TAG="PAT"
DO ^A1B2XFR
+3 SET X=DG(DQ)
SET DIC=DIE
+4 DO EVENT^IVMPLOG(DA)
+5 SET X=DG(DQ)
SET DIC=DIE
+6 SET IVMX=X
SET X="IVMPXFR"
XECUTE ^%ZOSF("TEST")
if $TEST
DO DPT^IVMPXFR
SET X=IVMX
KILL IVMX
+7 SET X=DG(DQ)
SET DIC=DIE
+8 IF ($TEXT(AVAFC^VAFCDD01)'="")
SET VAFCF=".117;"
DO AVAFC^VAFCDD01(DA)
+9 IF $DATA(DE(1))'[0!($GET(^DD(DP,DIFLD,"AUDIT"))["y")
SET X=DG(DQ)
SET DIIX=3_U_DIFLD
DO AUDIT^DIET
C1F1 QUIT
X1 SET Z0=$SELECT($DATA(^DPT(D0,.11)):+$PIECE(^(.11),"^",5),1:0)
if 'Z0
KILL X
if 'Z0!'$DATA(^DIC(5,Z0,1,0))
QUIT
SET DIC="^DIC(5,Z0,1,"
SET DIC(0)="QEM"
DO ^DIC
SET X=+Y
if Y'>0
KILL X
KILL Z0,DIC
+1 QUIT
+2 ;
2 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=2
DO X2
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X2 SET Y="@1001"
+1 QUIT
3 ;@5
SET DQ=4
4 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=4
DO X4
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X4 DO SCRQ^DVBHUTIL
+1 QUIT
5 ;@6
SET DQ=6
6 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=6
DO X6
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X6 DO B^DVBHQEDT
READ AA:DTIME
KILL AA
SET Y=$SELECT(DVBJS=11:"@1001",DVBJS=28:"@1",DVBJS=35:"@2",DVBJS=44:"@3",DVBJS=53:"@104",1:"@10")
+1 QUIT
7 ;@8
SET DQ=8
8 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=8
DO X8
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X8 SET Y=$SELECT(ANS="^0":"@101",ANS="^1":"@1001",ANS="^2":"@1",ANS="^3":"@2",ANS="^4":"@3",ANS="^5":"@104",1:Y)
IF Y["@"
WRITE @$SELECT('$DATA(IOF):"#",IOF="":"#",1:IOF)
+1 QUIT
9 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=9
DO X9
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X9 DO A^DVBHQEDT
SET Z2=Z
IF ERROR
KILL ERROR
SET Y=$SELECT(DVBJS=11:"@1001",DVBJS=28:"@1",DVBJS=35:"@2",DVBJS=44:"@3",DVBJS=53:"@104",1:"@10")
+1 QUIT
10 ;@20
SET DQ=11
11 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=11
DO X11
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X11 SET JP=1
SET Y=$SELECT(DVBJS=11:"@11",DVBJS=35:"@40",DVBJS=44:"@30",DVBJS=53:"@204",1:Y)
+1 QUIT
12 ;@21
SET DQ=13
13 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=13
DO X13
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X13 IF $PIECE(Z2,U,JP)'=1
SET Y="@22"
+1 QUIT
14 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=14
DO X14
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X14 IF '$DATA(DVBCN)
SET Y="@22"
SET JP=JP+1
+1 QUIT
15 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=15
DO X15
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X15 IF 'DVBCN
SET Y="@22"
SET JP=JP+1
+1 QUIT
16 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=16
DO X16
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X16 SET DVBCN=$TRANSLATE(DVBCN," ")
+1 QUIT
17 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=17
DO X17
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X17 IF $LENGTH(DVBCN)=9
IF (DVBCN?9N)
IF (DVBCN'=$PIECE(^DPT(D0,0),U,9))
WRITE !!,*7,"HINQ claim # is a SSN, does not match patient file SSN NO UPDATING claim #"
READ !,?25,"<RET to continue>",DVBQ:DTIME
KILL DVBQ
SET Y="@22"
SET JP=JP+1
+1 QUIT
18 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=18
SET DW=".31;3"
SET DV="FXOa"
SET DU=""
SET DIFLD=.313
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DQ(18,2)="S Y(0)=Y S Y=$E(Y,1,10)"
+2 SET DE(DW)="C18^DVBHCE18"
+3 SET X=DVBCN
+4 SET Y=X
+5 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+6 GOTO RD
C18 if $DATA(DE(18))[0
GOTO C18S
KILL DB
+1 SET X=DE(18)
SET DIC=DIE
+2 IF ($TEXT(AVAFC^VAFCDD01)'="")
SET VAFCF=".313;"
DO AVAFC^VAFCDD01(DA)
+3 SET X=DE(18)
SET DIC=DIE
+4 DO EVENT^IVMPLOG(DA)
+5 SET X=DE(18)
SET DIIX=2_U_DIFLD
DO AUDIT^DIET
C18S SET X=""
if DG(DQ)=X
GOTO C18F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 IF ($TEXT(AVAFC^VAFCDD01)'="")
SET VAFCF=".313;"
DO AVAFC^VAFCDD01(DA)
+3 SET X=DG(DQ)
SET DIC=DIE
+4 DO EVENT^IVMPLOG(DA)
+5 IF $DATA(DE(18))'[0!($GET(^DD(DP,DIFLD,"AUDIT"))["y")
SET X=DG(DQ)
SET DIIX=3_U_DIFLD
DO AUDIT^DIET
C18F1 QUIT
X18 SET DFN=DA
DO EV^DGLOCK
IF $DATA(X)
SET L=$SELECT($DATA(^DPT(DA,0)):$PIECE(^(0),U,9),1:X)
if X?1"SS".E
WRITE " ",L
if X?1"SS".E
SET X=L
if $LENGTH(X)>9
KILL X
if '$DATA(X)
QUIT
IF X'=L
if $LENGTH(X)>8!($LENGTH(X)<7)!'(X?.N)
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
19 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=19
DO X19
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X19 WRITE "."
SET JP=JP+1
SET DVBJ2=1
+1 QUIT
20 ;@22
SET DQ=21
21 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=21
DO X21
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X21 IF $PIECE(Z2,U,JP)'=2
SET Y="@225"
+1 QUIT
22 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=22
DO X22
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X22 WRITE !,"Date of Birth cannot be edited with this option."
+1 QUIT
23 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=23
DO X23
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X23 HANG 1
+1 QUIT
24 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=24
DO X24
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X24 WRITE "."
SET JP=JP+1
SET DVBJ2=1
+1 QUIT
25 ;@225
SET DQ=26
26 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=26
DO X26
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X26 IF $PIECE(Z2,U,JP)'=3
SET Y="@23"
+1 QUIT
27 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=27
DO X27
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X27 WRITE !,"Sex cannot be edited with this option."
+1 QUIT
28 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=28
DO X28
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X28 HANG 1
+1 QUIT
29 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=29
DO X29
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X29 WRITE "."
SET JP=JP+1
SET DVBJ2=1
+1 QUIT
30 ;@23
SET DQ=31
31 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=31
DO X31
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X31 IF $PIECE(Z2,U,JP)'=4
SET Y="@24"
+1 QUIT
32 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=32
DO X32
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X32 KILL Z1
IF $DATA(DVBP(6))
IF +$PIECE(DVBP(6),U)
SET Z1=$PIECE(DVBP(6),U)
SET Z1=$EXTRACT(Z1,1,2)_" "_$EXTRACT(Z1,3,4)_" "_$EXTRACT(Z1,5,8)
+1 QUIT
33 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=33
DO X33
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X33 IF $DATA(DVBVET)
IF $PIECE(DVBVET,U,1)="B"
IF +$PIECE(DVBVET,U,12)
SET Z1=$PIECE(DVBVET,U,12)
SET Z1=$EXTRACT(Z1,5,6)_" "_$EXTRACT(Z1,7,8)_" "_$EXTRACT(Z1,1,4)
+1 QUIT
34 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=34
DO X34
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X34 IF '$DATA(Z1)
SET Y="@24"
SET JP=JP+1
+1 QUIT
35 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=35
DO X35
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X35 IF 'Z1
SET Y="@24"
SET JP=JP+1
+1 QUIT
36 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=36
DO X36
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X36 IF $DATA(^DPT(D0,.105))
WRITE !!,"Patient is currently in-house."
WRITE !,"Discharge patient with a discharge type of DEATH."
READ !,?25,"<RET to continue>",DVBQ:DTIME
KILL DVBQ
SET Y="@24"
SET JP=JP+1
+1 QUIT
37 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=37
SET DW=".35;1"
SET DV="DXa"
SET DU=""
SET DIFLD=.351
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C37^DVBHCE18"
SET DE(DW,"INDEX")=1
+2 SET X=Z1
+3 SET Y=X
+4 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+5 GOTO RD
C37 if $DATA(DE(37))[0
GOTO C37S
KILL DB
+1 SET X=DE(37)
SET DIC=DIE
+2 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DPT(D0,0)):^(0),1:"")
SET X=$PIECE(Y(1),U,10)
SET X=X
SET DIU=X
KILL Y
XECUTE ^DD(2,.351,1,1,2.1)
SET DIH=$GET(^DPT(DIV(0),0))
SET DIV=X
SET $PIECE(^(0),U,10)=DIV
SET DIH=2
SET DIG=.091
DO ^DICR
+3 SET X=DE(37)
SET DIC=DIE
+4 ;
+5 SET X=DE(37)
SET DIC=DIE
+6 DO DKBULL^DGDEATH
+7 SET X=DE(37)
SET DIC=DIE
+8 KILL ^DPT("AEXP1",$EXTRACT(X,1,30),DA)
+9 SET X=DE(37)
SET DIC=DIE
+10 ;
+11 SET X=DE(37)
SET DIC=DIE
+12 ;
+13 SET X=DE(37)
SET DIC=DIE
+14 SET RCX=X
SET X="RCAMDTH"
XECUTE ^%ZOSF("TEST")
SET X=RCX
KILL RCX
IF $TEST
DO ERR^RCAMDTH
+15 SET X=DE(37)
SET DIC=DIE
+16 DO KILL^DGDEPINA
+17 SET X=DE(37)
SET DIC=DIE
+18 DO AUTOUPD^DGENA2(DA)
+19 SET X=DE(37)
SET DIC=DIE
+20 ;
+21 SET X=DE(37)
SET DIC=DIE
+22 IF $$VERSION^XPDUTL("PSO")>6
DO APSOD^PSOAUTOC(DA)
+23 SET X=DE(37)
SET DIC=DIE
+24 SET IVMX=X
SET X="IVMPXFR"
XECUTE ^%ZOSF("TEST")
if $TEST
DO DPT^IVMPXFR
SET X=IVMX
KILL IVMX
+25 SET X=DE(37)
SET DIC=DIE
+26 IF ($TEXT(AVAFC^VAFCDD01)'="")
SET VAFCF=".351;"
DO AVAFC^VAFCDD01(DA)
+27 SET X=DE(37)
SET DIC=DIE
+28 if ($TEXT(ADGRU^DGRUDD01)'="")
DO ADGRU^DGRUDD01(DA)
+29 SET X=DE(37)
SET DIIX=2_U_DIFLD
DO AUDIT^DIET
C37S SET X=""
if DG(DQ)=X
GOTO C37F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DPT(D0,0)):^(0),1:"")
SET X=$PIECE(Y(1),U,10)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
XECUTE ^DD(2,.351,1,1,49.3)
SET X=$EXTRACT(Y(8),Y(9),X)
SET Y=X
SET X=Y(7)
SET X=X_Y_"]"
XECUTE ^DD(2,.351,1,1,1.4)
+3 SET X=DG(DQ)
SET DIC=DIE
+4 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DPT(D0,.35)):^(.35),1:"")
SET X=$PIECE(Y(1),U,2)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
SET X=$SELECT(($DATA(DUZ)#2):DUZ,1:"")
SET DIH=$GET(^DPT(DIV(0),.35))
SET DIV=X
SET $PIECE(^(.35),U,2)=DIV
SET DIH=2
SET DIG=.352
DO ^DICR
+5 SET X=DG(DQ)
SET DIC=DIE
+6 DO DSBULL^DGDEATH
+7 SET X=DG(DQ)
SET DIC=DIE
+8 SET ^DPT("AEXP1",$EXTRACT(X,1,30),DA)=""
+9 SET X=DG(DQ)
SET DIC=DIE
+10 DO DEATH^DGOERNOT
+11 SET X=DG(DQ)
SET DIC=DIE
+12 SET XX=X
SET X="PSJADT"
XECUTE ^%ZOSF("TEST")
SET X=XX
KILL XX
IF $TEST
DO END^PSJADT
+13 SET X=DG(DQ)
SET DIC=DIE
+14 SET RCX=X
SET X="RCAMDTH"
XECUTE ^%ZOSF("TEST")
SET X=RCX
KILL RCX
IF $TEST
DO SET^RCAMDTH
+15 SET X=DG(DQ)
SET DIC=DIE
+16 DO SET^DGDEPINA
+17 SET X=DG(DQ)
SET DIC=DIE
+18 DO AUTOUPD^DGENA2(DA)
+19 SET X=DG(DQ)
SET DIC=DIE
+20 DO START^DGMTDELS(DA)
+21 SET X=DG(DQ)
SET DIC=DIE
+22 IF $$VERSION^XPDUTL("PSO")>6
DO APSOD^PSOCAN3(DA)
+23 SET X=DG(DQ)
SET DIC=DIE
+24 SET IVMX=X
SET X="IVMPXFR"
XECUTE ^%ZOSF("TEST")
if $TEST
DO DPT^IVMPXFR
SET X=IVMX
KILL IVMX
+25 SET X=DG(DQ)
SET DIC=DIE
+26 IF ($TEXT(AVAFC^VAFCDD01)'="")
SET VAFCF=".351;"
DO AVAFC^VAFCDD01(DA)
+27 SET X=DG(DQ)
SET DIC=DIE
+28 if ($TEXT(ADGRU^DGRUDD01)'="")
DO ADGRU^DGRUDD01(DA)
+29 IF $DATA(DE(37))'[0!($GET(^DD(DP,DIFLD,"AUDIT"))["y")
SET X=DG(DQ)
SET DIIX=3_U_DIFLD
DO AUDIT^DIET
C37F1 NEW X,X1,X2
SET DIXR=886
DO C37X1(U)
KILL X2
MERGE X2=X
DO C37X1("O")
KILL X1
MERGE X1=X
+1 Begin DoDot:1
+2 DO FC^DGFCPROT(.DA,2,.351,"KILL",$HOROLOG,$GET(DUZ),.X,.X1,.X2,$GET(XQY0))
QUIT
End DoDot:1
+3 KILL X
MERGE X=X2
Begin DoDot:1
+4 DO FC^DGFCPROT(.DA,2,.351,"SET",$HOROLOG,$GET(DUZ),.X,.X1,.X2,$GET(XQY0))
QUIT
End DoDot:1
+5 GOTO C37F2
C37X1(DION) KILL X
+1 SET X(1)=$GET(@DIEZTMP@("V",2,DIIENS,.351,DION),$PIECE($GET(^DPT(DA,.35)),U,1))
+2 SET X=$GET(X(1))
+3 QUIT
C37F2 SET DIXR=889
DO C37X2(U)
KILL X2
MERGE X2=X
DO C37X2("O")
KILL X1
MERGE X1=X
+1 Begin DoDot:1
+2 DO FC^DGFCPROT(.DA,2,.351,"KILL",$HOROLOG,$GET(DUZ),.X,.X1,.X2,$GET(XQY0))
QUIT
End DoDot:1
+3 KILL X
MERGE X=X2
Begin DoDot:1
+4 DO FC^DGFCPROT(.DA,2,.351,"SET",$HOROLOG,$GET(DUZ),.X,.X1,.X2,$GET(XQY0))
QUIT
End DoDot:1
+5 GOTO C37F3
C37X2(DION) KILL X
+1 SET X(1)=$GET(@DIEZTMP@("V",2,DIIENS,.351,DION),$PIECE($GET(^DPT(DA,.35)),U,1))
+2 SET X=$GET(X(1))
+3 QUIT
C37F3 SET DIXR=1351
DO C37X3(U)
KILL X2
MERGE X2=X
DO C37X3("O")
KILL X1
MERGE X1=X
+1 KILL X
MERGE X=X2
Begin DoDot:1
+2 NEW DIEXARR
MERGE DIEXARR=X
SET DIEZCOND=1
+3 SET X=$SELECT((X(1)'="")&(X1(1)=""):1,1:0)
+4 SET DIEZCOND=$GET(X)
KILL X
MERGE X=DIEXARR
if 'DIEZCOND
QUIT
+5 DO DEATH^IBCNEUT7(DA,X(1))
End DoDot:1
+6 GOTO C37F4
C37X3(DION) KILL X
+1 SET X(1)=$GET(@DIEZTMP@("V",2,DIIENS,.351,DION),$PIECE($GET(^DPT(DA,.35)),U,1))
+2 SET X=$GET(X(1))
+3 QUIT
C37F4 QUIT
X37 SET %DT="PXT"
DO ^%DT
SET X=Y
if Y<1
KILL X
IF $DATA(X)
DO H^DGUTL
if X>DGTIME
KILL X
KILL DGTIME,DGDATE
IF $DATA(X)
SET DFN=DA
DO DEATH^DGLOCK
+1 QUIT
+2 ;
38 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=38
DO X38
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X38 WRITE "."
SET JP=JP+1
SET DVBJ2=1
+1 QUIT
39 ;@24
SET DQ=40
40 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=40
DO X40
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X40 IF $PIECE(Z2,U,JP)'=5
SET Y="@25"
+1 QUIT
41 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=41
DO X41
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X41 KILL DVBSICK
IF $DATA(DVBP(6))
SET DVBSICK=$PIECE(DVBP(6),U,7)
+1 QUIT
42 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=42
DO X42
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X42 IF $DATA(DVBCI)
SET DVBSICK=DVBCI
+1 QUIT
43 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=43
DO X43
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X43 IF '$DATA(DVBSICK)
SET Y="@25"
SET JP=JP+1
+1 QUIT
44 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=44
SET DW=".29;12"
SET DV="S"
SET DU=""
SET DIFLD=.293
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C44^DVBHCE18"
+2 SET DU="0:NO;1:YES;"
+3 SET X=$SELECT((DVBSICK="I")!(DVBSICK="Y"):1,1:0)
+4 SET Y=X
+5 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+6 GOTO RD
C44 if $DATA(DE(44))[0
GOTO C44S
KILL DB
+1 SET X=DE(44)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C44S SET X=""
if DG(DQ)=X
GOTO C44F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C44F1 QUIT
X44 QUIT
45 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=45
DO X45
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X45 WRITE "."
SET JP=JP+1
SET DVBJ2=1
KILL DVBSICK
+1 QUIT
46 ;@25
SET DQ=47
47 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=47
DO X47
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X47 IF $PIECE(Z2,U,JP)'=6
SET Y="@26"
+1 QUIT
48 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=48
DO X48
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X48 IF '$DATA(DVBPOW)
IF '$DATA(DVBPOWD)
SET Y="@26"
SET JP=JP+1
+1 QUIT
49 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=49
DO X49
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X49 IF '$DATA(DVBPOW)
IF $DATA(DVBPOWD)
IF +DVBPOWD
WRITE !!,*7,?17,DVBON,"POW Indicator Discrepancy! <RET>",DVBOFF
XECUTE DVBLIT1
READ DVBZ:DTIME
KILL DVBZ
SET JP=JP+1
SET Y="@26"
+1 QUIT
50 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=50
DO X50
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X50 IF '$DATA(DVBPOW)
IF '+DVBPOWD
SET Y="@26"
SET JP=JP+1
+1 QUIT
51 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=51
DO X51
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X51 IF '$DATA(DVBPOWD)
IF $DATA(DVBPOW)
IF DVBPOW>0
WRITE !!,*7,?17,DVBON,"POW Indicator Discrepancy! <RET>",DVBOFF
XECUTE DVBLIT1
READ DVBZ:DTIME
KILL DVBZ
SET JP=JP+1
SET Y="@26"
+1 QUIT
52 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=52
DO X52
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X52 IF $DATA(DVBPOWD)
IF $DATA(DVBPOW)
IF DVBPOWD=0
IF DVBPOW>0
WRITE !!,*7,?17,DVBON,"POW Indicator Discrepancy! <RET>",DVBOFF
XECUTE DVBLIT1
READ DVBZ:DTIME
KILL DVBZ
SET JP=JP+1
SET Y="@26"
+1 QUIT
53 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=53
DO X53
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X53 IF $DATA(DVBPOWD)
IF $DATA(DVBPOW)
IF +DVBPOW<1
IF +DVBPOWD
WRITE !!,*7,?17,DVBON,"POW Indicator Discrepancy! <RET>",DVBOFF
XECUTE DVBLIT1
READ DVBZ:DTIME
KILL DVBZ
SET JP=JP+1
SET Y="@26"
+1 QUIT
54 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=54
DO X54
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X54 DO POW^DVBHUTIL
+1 QUIT
55 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=55
SET DW=".52;5"
SET DV="RSX"
SET DU=""
SET DIFLD=.525
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C55^DVBHCE18"
SET DE(DW,"INDEX")=1
+2 SET DU="Y:YES;N:NO;U:UNKNOWN;"
+3 SET X=DVBPOW1
+4 SET Y=X
+5 SET X=Y
SET DB(DQ)=1
if X=""
if DV
GOTO N^DIE17
GOTO A
IF $DATA(DE(DQ))
IF DV["I"!(DV["#")
DO E^DIE0
if '$DATA(X)
GOTO A
+6 GOTO RD
C55 if $DATA(DE(55))[0
GOTO C55S
KILL DB
+1 SET X=DE(55)
SET DIC=DIE
+2 ;
+3 SET X=DE(55)
SET DIC=DIE
+4 ;
+5 SET X=DE(55)
SET DIC=DIE
+6 ;
+7 SET X=DE(55)
SET DIC=DIE
+8 DO AUTOUPD^DGENA2(DA)
+9 SET X=DE(55)
SET DIC=DIE
+10 XECUTE "S DFN=DA D EN^DGMTR K DGREQF"
+11 SET X=DE(55)
SET DIC=DIE
+12 DO EVENT^IVMPLOG(DA)
C55S SET X=""
if DG(DQ)=X
GOTO C55F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 XECUTE ^DD(2,.525,1,1,1.3)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DPT(D0,.52)):^(.52),1:"")
SET X=$SELECT('$DATA(^DIC(22,+$PIECE(Y(1),U,6),0)):"",1:$PIECE(^(0),U,1))
SET DIU=X
KILL Y
SET X=DIV
SET X=""
XECUTE ^DD(2,.525,1,1,1.4)
+3 SET X=DG(DQ)
SET DIC=DIE
+4 XECUTE ^DD(2,.525,1,2,1.3)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DPT(D0,.52)):^(.52),1:"")
SET X=$PIECE(Y(1),U,7)
SET DIU=X
KILL Y
SET X=DIV
SET X=""
XECUTE ^DD(2,.525,1,2,1.4)
+5 SET X=DG(DQ)
SET DIC=DIE
+6 XECUTE ^DD(2,.525,1,3,1.3)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DPT(D0,.52)):^(.52),1:"")
SET X=$PIECE(Y(1),U,8)
SET DIU=X
KILL Y
SET X=DIV
SET X=""
XECUTE ^DD(2,.525,1,3,1.4)
+7 SET X=DG(DQ)
SET DIC=DIE
+8 DO AUTOUPD^DGENA2(DA)
+9 SET X=DG(DQ)
SET DIC=DIE
+10 XECUTE "S DFN=DA D EN^DGMTR K DGREQF"
+11 SET X=DG(DQ)
SET DIC=DIE
+12 DO EVENT^IVMPLOG(DA)
C55F1 NEW X,X1,X2
SET DIXR=627
DO C55X1(U)
KILL X2
MERGE X2=X
DO C55X1("O")
KILL X1
MERGE X1=X
+1 Begin DoDot:1
+2 DO FC^DGFCPROT(.DA,2,.525,"KILL",$HOROLOG,$GET(DUZ),.X,.X1,.X2,$GET(XQY0))
QUIT
End DoDot:1
+3 KILL X
MERGE X=X2
Begin DoDot:1
+4 DO FC^DGFCPROT(.DA,2,.525,"SET",$HOROLOG,$GET(DUZ),.X,.X1,.X2,$GET(XQY0))
QUIT
End DoDot:1
+5 GOTO C55F2
C55X1(DION) KILL X
+1 SET X(1)=$GET(@DIEZTMP@("V",2,DIIENS,.525,DION),$PIECE($GET(^DPT(DA,.52)),U,5))
+2 SET X=$GET(X(1))
+3 QUIT
C55F2 QUIT
X55 SET DFN=DA
DO POWV^DGLOCK
IF $DATA(X)
DO SV^DGLOCK
+1 QUIT
+2 ;
56 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=56
DO X56
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X56 KILL DVBPOW1
WRITE "."
SET JP=JP+1
SET DVBJ2=1
+1 QUIT
57 ;@26
SET DQ=58
58 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=58
DO X58
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X58 IF $PIECE(Z2,U,JP)'=7
SET Y="@27"
+1 QUIT
59 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=59
DO X59
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X59 IF '$DATA(DVBFL)
SET Y="@27"
SET JP=JP+1
+1 QUIT
60 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=60
DO X60
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X60 IF DVBFL']""
SET Y="@27"
SET JP=JP+1
+1 QUIT
61 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=61
DO X61
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X61 IF DVBFL'?3N1" - "1U.E
SET Y="@27"
SET JP=JP+1
+1 QUIT
62 if $DATA(DG)>9
DO F^DIE17
GOTO ^DVBHCE19