ACKQTE ; GENERATED FROM 'ACKQAS VISIT ENTRY' INPUT TEMPLATE(#1338), FILE 509850.6;11/10/10
D DE G BEGIN
DE S DIE="^ACK(509850.6,",DIC=DIE,DP=509850.6,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^ACK(509850.6,DA,""))=""
I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,2) S:%]"" DE(13)=% S %=$P(%Z,U,5) S:%]"" DE(18)=% S %=$P(%Z,U,8) S:%]"" DE(22)=%
I $D(^(5)) S %Z=^(5) S %=$P(%Z,U,2) S:%]"" DE(35)=%,DE(40)=% S %=$P(%Z,U,3) S:%]"" DE(44)=% S %=$P(%Z,U,4) S:%]"" DE(50)=% S %=$P(%Z,U,5) S:%]"" DE(55)=% S %=$P(%Z,U,8) S:%]"" DE(10)=%
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 S X="" W " (No Editing)" Q
TR 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 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",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
K DDER G X
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
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
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),";") S:%]"" 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
SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
D ^DIR I 'DDER S %=Y(0),X=Y
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="ACKQTE",DQ=1
N DIEZTMP,DIEZAR,DIEZRXR,DIIENS,DIXR K DIEFIRE,DIEBADK S DIEZTMP=$$GETTMP^DIKC1("DIEZ")
M DIEZAR=^DIE(1338,"AR") S DICRREC="TRIG^DIE17"
S:$D(DTIME)[0 DTIME=300 S D0=DA,DIIENS=DA_",",DIEZ=1338,U="^"
1 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=1 D X1 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
X1 I $G(ACKVISIT)'="NEW",$G(ACKVISIT)'="EDIT" W !!,"This option must only be run from QUASAR" S Y="@999"
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 D SETUP^ACKQUTL4
Q
3 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=3 D X3 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
X3 D HLOSS^ACKQUTL4
Q
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 S ACKCP=$$ACKCP^ACKQUTL4
Q
5 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=5 D X5 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
X5 S ACKCPNO=$S(+ACKCP=0:"",1:$P(ACKCP,U,2)),ACKCP=+ACKCP
Q
6 S DQ=7 ;@10
7 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=7 D X7 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
X7 D EN^ACKQUTL7
Q
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 I $D(ACKDIRUT) S Y="@999"
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 I $$TIMECHEK^ACKQASU5(ACKVIEN,1) S Y="@15"
Q
10 S DW="5;8",DV="RFXO",DU="",DLB="APPOINTMENT TIME",DIFLD=55
S DQ(10,2)="S Y(0)=Y Q:'$D(Y) S Y=$TR(Y,""."",""""),Y=$$FMT^ACKQUTL6(Y)"
S DE(DW)="C10^ACKQTE"
G RE
C10 G C10S:$D(DE(10))[0 K DB
S X=DE(10),DIC=DIE
X "D SEND^ACKQUTL5(DA)"
S X=DE(10),DIC=DIE
X "D KILLREF^ACKQUTL5(X,DA,""T"")"
C10S S X="" G:DG(DQ)=X C10F1 K DB
S X=DG(DQ),DIC=DIE
X "D SEND^ACKQUTL5(DA)"
S X=DG(DQ),DIC=DIE
X "D SETREF^ACKQUTL5(X,DA,""T"")"
C10F1 Q
X10 K:$L(X)>8!($L(X)<1) X I $D(X) S X=$$DATACHEK^ACKQUTL6(X,DA) K:'X X I $D(X) I '$$DUPECHK^ACKQUTL6(X,DA,$G(ACKPAT)) S ACKITME=X K X
I $D(X),X'?.ANP K X
Q
;
11 S DQ=12 ;@15
12 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
X12 I ACKVISIT="EDIT" S Y="@16"
Q
13 D:$D(DG)>9 F^DIE17,DE S DQ=13,DW="0;2",DV="RP509850.2X",DU="",DLB="PATIENT NAME",DIFLD=1
S DE(DW)="C13^ACKQTE"
S DU="ACK(509850.2,"
S X=ACKPAT
S Y=X
S X=Y,DB(DQ)=1,DE(DW,"4/")="" G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD:X="@",Z
C13 G C13S:$D(DE(13))[0 K DB
S X=DE(13),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^ACK(509850.6,D0,0)):^(0),1:"") S X=$P(Y(1),U,3),X=X S DIU=X K Y S X="" X ^DD(509850.6,1,1,1,2.4)
S X=DE(13),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^ACK(509850.6,D0,0)):^(0),1:"") S X=$P(Y(1),U,4),X=X S DIU=X K Y S X="" X ^DD(509850.6,1,1,2,2.4)
S X=DE(13),DIC=DIE
K ^ACK(509850.6,"APT",$E(X,1,30),DA)
S X=DE(13),DIC=DIE
;
S X=DE(13),DIC=DIE
K ^ACK(509850.6,"APD",X,+^ACK(509850.6,DA,0),DA)
S X=DE(13),DIC=DIE
K ^ACK(509850.6,"C",$E(X,1,30),DA)
S X=DE(13),DIC=DIE
X "D KILLREF^ACKQUTL5(X,DA,""P"")"
S X=DE(13),DIC=DIE
X "D SEND^ACKQUTL5(DA)"
C13S S X="" G:DG(DQ)=X C13F1 K DB
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^ACK(509850.6,D0,0)):^(0),1:"") S X=$P(Y(1),U,3),X=X S DIU=X K Y X ^DD(509850.6,1,1,1,1.1) X ^DD(509850.6,1,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(^ACK(509850.6,D0,0)):^(0),1:"") S X=$P(Y(1),U,4),X=X S DIU=X K Y S X=DIV D AOA^ACKQAS X ^DD(509850.6,1,1,2,1.4)
S X=DG(DQ),DIC=DIE
S ^ACK(509850.6,"APT",$E(X,1,30),DA)=""
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 X ^DD(509850.6,1,1,4,89.2) S X=$P(Y(101),U,2) S D0=I(0,0) S DIU=X K Y S X=DIV D IVD^ACKQAS X ^DD(509850.6,1,1,4,1.4)
S X=DG(DQ),DIC=DIE
S ^ACK(509850.6,"APD",X,+^ACK(509850.6,DA,0),DA)=""
S X=DG(DQ),DIC=DIE
S ^ACK(509850.6,"C",$E(X,1,30),DA)=""
S X=DG(DQ),DIC=DIE
X "D SETREF^ACKQUTL5(X,DA,""P"")"
S X=DG(DQ),DIC=DIE
X "D SEND^ACKQUTL5(DA)"
C13F1 Q
X13 Q
14 S DQ=15 ;@16
15 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=15 S I(0,0)=D0 S Y(1)=$S($D(^ACK(509850.6,D0,0)):^(0),1:"") S X=$P(Y(1),U,2),X=X S D(0)=+X S X=$S(D(0)>0:D(0),1:"")
S DGO="^ACKQTE1",DC="^509850.2^ACK(509850.2," G DIEZ^DIE0
R15 D DE G A
;
16 S DQ=17 ;@30
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 ACKCP=0 S Y="@40"
Q
18 D:$D(DG)>9 F^DIE17,DE S DQ=18,DW="0;5",DV="S",DU="",DLB="Is this a C&P Visit ?",DIFLD=2.5
S DE(DW)="C18^ACKQTE"
S DU="0:NO;1:YES;"
S Y="YES"
G Y
C18 G C18S:$D(DE(18))[0 K DB
S X=DE(18),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^ACK(509850.6,D0,0)):^(0),1:"") S X=$P(Y(1),U,9),X=X S DIU=X K Y S X=DIV D TRIGCP^ACKQUTL X ^DD(509850.6,2.5,1,1,2.4)
C18S S X="" G:DG(DQ)=X C18F1 K DB
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^ACK(509850.6,D0,0)):^(0),1:"") S X=$P(Y(1),U,9),X=X S DIU=X K Y S X=DIV D TRIGCP^ACKQUTL X ^DD(509850.6,2.5,1,1,1.4)
C18F1 Q
X18 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 S ACKCP=X
Q
20 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=20 D X20 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
X20 S:'ACKCP Y="@40"
Q
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 S:ACKCPNO="" Y="@40"
Q
22 D:$D(DG)>9 F^DIE17,DE S DQ=22,DW="0;8",DV="F",DU="",DLB="LINKED C&P EXAM",DIFLD=.08
S DE(DW)="C22^ACKQTE"
S X=$S(ACKCPNO'="":ACKCPNO,1:"")
S Y=X
S X=Y,DB(DQ)=1,DE(DW,"4/")="" G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD:X="@",Z
C22 G C22S:$D(DE(22))[0 K DB
S X=DE(22),DIC=DIE
K ^ACK(509850.6,"ALCP",$E(X,1,30),DA)
C22S S X="" G:DG(DQ)=X C22F1 K DB
S X=DG(DQ),DIC=DIE
S ^ACK(509850.6,"ALCP",$E(X,1,30),DA)=""
C22F1 Q
X22 Q
23 S DQ=24 ;@40
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 D DIAGDIS^ACKQUTL4
Q
25 D:$D(DG)>9 F^DIE17,DE S DQ=25,D=0 K DE(1) ;3
S DIFLD=3,DGO="^ACKQTE2",DC="5^509850.63PA^1^",DV="509850.63M*P509850.1'X",DW="0;1",DOW="DIAGNOSTIC CODE",DLB=$P($$EZBLD^DIALOG(8042,DOW),": ") S:D DC=DC_D
S DU="ACK(509850.1,"
G RE:D I $D(DSC(509850.63))#2,$P(DSC(509850.63),"I $D(^UTILITY(",1)="" X DSC(509850.63) S D=$O(^(0)) S:D="" D=-1 G M25
S D=$S($D(^ACK(509850.6,DA,1,0)):$P(^(0),U,3,4),$O(^(0))'="":$O(^(0)),1:-1)
M25 I D>0 S DC=DC_D I $D(^ACK(509850.6,DA,1,+D,0)) S DE(25)=$P(^(0),U,1)
G RE
R25 D DE
S D=$S($D(^ACK(509850.6,DA,1,0)):$P(^(0),U,3,4),1:1) G 25+1
;
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 IF $O(^ACK(509850.6,ACKVIEN,1,0))="" WRITE !!,"You must enter at least one Diagnosis" S Y="@40"
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 I '$$POSTDIAG^ACKQASU5(ACKVIEN) S Y="@40"
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 D HLOSS^ACKQUTL4
Q
29 S DQ=30 ;@50
30 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=30 D X30 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
X30 W @IOF
Q
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 ACKPCE'=1 S Y="@100"
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 I ACKSC=0 D CLASDIS^ACKQNQ S Y="@55"
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 D PATDIS^ACKQUTL4
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 D ELIGDIS^ACKQUTL4
Q
35 S DW="5;2",DV="R*P8'",DU="",DLB="Enter the Eligibility for this Appointment",DIFLD=80
S DE(DW)="C35^ACKQTE"
S DU="DIC(8,"
S X=ACKELIG
S Y=X
G Y
C35 G C35S:$D(DE(35))[0 K DB
S X=DE(35),DIC=DIE
X "D SEND^ACKQUTL5(DA)"
C35S S X="" G:DG(DQ)=X C35F1 K DB
S X=DG(DQ),DIC=DIE
X "D SEND^ACKQUTL5(DA)"
C35F1 Q
X35 S DIC("S")="I $D(ACKELDIS(Y))",DIC("W")="W """"" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
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 S ACKELIG=$S(ACKPCE'=1:"",ACKELGCT=1:ACKELIG,1:X)
Q
37 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=37 D X37 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
X37 S Y="@60"
Q
38 S DQ=39 ;@55
39 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=39 D X39 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
X39 I $$GET1^DIQ(509850.6,ACKVIEN_",",80,"I")=ACKELIG1 S Y="@60"
Q
40 D:$D(DG)>9 F^DIE17,DE S DQ=40,DW="5;2",DV="R*P8'",DU="",DLB="VISIT ELIGIBILITY",DIFLD=80
S DE(DW)="C40^ACKQTE"
S DU="DIC(8,"
S X=ACKELIG1
S Y=X
S X=Y,DB(DQ)=1,DE(DW,"4/")="" G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
G RD:X="@",Z
C40 G C40S:$D(DE(40))[0 K DB
S X=DE(40),DIC=DIE
X "D SEND^ACKQUTL5(DA)"
C40S S X="" G:DG(DQ)=X C40F1 K DB
S X=DG(DQ),DIC=DIE
X "D SEND^ACKQUTL5(DA)"
C40F1 Q
X40 Q
41 S DQ=42 ;@60
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 ACKPCE'=1 S Y="@100"
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 ACKSC=0 S Y="@70"
Q
44 D:$D(DG)>9 F^DIE17,DE S DQ=44,DW="5;3",DV="RS",DU="",DLB="Was care for SC Condition ?",DIFLD=20
S DE(DW)="C44^ACKQTE"
S DU="0:NO;1:YES;"
S X=""
S Y=X
G Y
C44 G C44S:$D(DE(44))[0 K DB
S X=DE(44),DIC=DIE
X "D SEND^ACKQUTL5(DA)"
C44S S X="" G:DG(DQ)=X C44F1 K DB
S X=DG(DQ),DIC=DIE
X "D SEND^ACKQUTL5(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 I ACKPCE'=1 S Y="@100"
Q
46 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=46 D X46 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
X46 S ACKSC=$S(ACKSC=0:0,X=1:2,1:1)
Q
47 S DQ=48 ;@70
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 ACKAO=0 S Y="@80"
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 ACKSC=2 S Y="@90"
Q
50 D:$D(DG)>9 F^DIE17,DE S DQ=50,DW="5;4",DV="RS",DU="",DLB="Was care related to AO Exposure ?",DIFLD=25
S DE(DW)="C50^ACKQTE"
S DU="0:NO;1:YES;"
S X=""
S Y=X
G Y
C50 G C50S:$D(DE(50))[0 K DB
S X=DE(50),DIC=DIE
X "D SEND^ACKQUTL5(DA)"
C50S S X="" G:DG(DQ)=X C50F1 K DB
D ^ACKQTE3
C50F1 Q
X50 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 S ACKAO=$S(ACKAO=0:0,ACKSC'=1:ACKAO,X=1:2,1:1)
Q
52 S DQ=53 ;@80
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 ACKRAD=0 S Y="@85"
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 I ACKSC=2 S Y="@90"
Q
55 D:$D(DG)>9 F^DIE17,DE S DQ=55,DW="5;5",DV="RS",DU="",DLB="Was care related to IR Exposure ?",DIFLD=30
S DE(DW)="C55^ACKQTE"
S DU="0:NO;1:YES;"
S X=""
S Y=X
G Y
C55 G C55S:$D(DE(55))[0 K DB
D ^ACKQTE4
C55S S X="" G:DG(DQ)=X C55F1 K DB
D ^ACKQTE5
C55F1 Q
X55 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 S ACKRAD=$S(ACKRAD=0:0,ACKSC'=1:ACKRAD,X=1:2,1:1)
Q
57 S DQ=58 ;@85
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 ACKENV=0 S Y="@90"
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 ACKSC=2 S Y="@90"
Q
60 D:$D(DG)>9 F^DIE17 G ^ACKQTE6
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HACKQTE 15556 printed Dec 13, 2024@02:32:36 Page 2
ACKQTE ; GENERATED FROM 'ACKQAS VISIT ENTRY' INPUT TEMPLATE(#1338), FILE 509850.6;11/10/10
+1 DO DE
GOTO BEGIN
DE SET DIE="^ACK(509850.6,"
SET DIC=DIE
SET DP=509850.6
SET DL=1
SET DIEL=0
SET DU=""
KILL DG,DE,DB
if $ORDER(^ACK(509850.6,DA,""))=""
QUIT
+1 IF $DATA(^(0))
SET %Z=^(0)
SET %=$PIECE(%Z,U,2)
if %]""
SET DE(13)=%
SET %=$PIECE(%Z,U,5)
if %]""
SET DE(18)=%
SET %=$PIECE(%Z,U,8)
if %]""
SET DE(22)=%
+2 IF $DATA(^(5))
SET %Z=^(5)
SET %=$PIECE(%Z,U,2)
if %]""
SET DE(35)=%
SET DE(40)=%
SET %=$PIECE(%Z,U,3)
if %]""
SET DE(44)=%
SET %=$PIECE(%Z,U,4)
if %]""
SET DE(50)=%
SET %=$PIECE(%Z,U,5)
if %]""
SET DE(55)=%
SET %=$PIECE(%Z,U,8)
if %]""
SET DE(10)=%
+3 KILL %Z
QUIT
+4 ;
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
SET X=""
WRITE " (No Editing)"
QUIT
TR 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 $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 DV'["S"
GOTO P
if $DATA(^DD(DP,DIFLD,12.1))
XECUTE ^(12.1)
IF X?.ANP
DO SET
IF 'DDER
if $DATA(DIC("S"))
XECUTE DIC("S")
IF $TEST
if '$DATA(DB(DQ))
WRITE " "_%
GOTO V
+1 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
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
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=%
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
SET NEW DIR
SET DIR(0)="SV"_$EXTRACT("o",$DATA(DB(DQ)))_U_DU
SET DIR("V")=1
+1 IF $DATA(DB(DQ))
IF '$DATA(DIQUIET)
NEW DIQUIET
SET DIQUIET=1
+2 DO ^DIR
IF 'DDER
SET %=Y(0)
SET X=Y
+3 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="ACKQTE"
SET DQ=1
+1 NEW DIEZTMP,DIEZAR,DIEZRXR,DIIENS,DIXR
KILL DIEFIRE,DIEBADK
SET DIEZTMP=$$GETTMP^DIKC1("DIEZ")
+2 MERGE DIEZAR=^DIE(1338,"AR")
SET DICRREC="TRIG^DIE17"
+3 if $DATA(DTIME)[0
SET DTIME=300
SET D0=DA
SET DIIENS=DA_","
SET DIEZ=1338
SET U="^"
1 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=1
DO X1
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
X1 IF $GET(ACKVISIT)'="NEW"
IF $GET(ACKVISIT)'="EDIT"
WRITE !!,"This option must only be run from QUASAR"
SET Y="@999"
+1 QUIT
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 DO SETUP^ACKQUTL4
+1 QUIT
3 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=3
DO X3
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
X3 DO HLOSS^ACKQUTL4
+1 QUIT
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 SET ACKCP=$$ACKCP^ACKQUTL4
+1 QUIT
5 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=5
DO X5
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
X5 SET ACKCPNO=$SELECT(+ACKCP=0:"",1:$PIECE(ACKCP,U,2))
SET ACKCP=+ACKCP
+1 QUIT
6 ;@10
SET DQ=7
7 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=7
DO X7
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
X7 DO EN^ACKQUTL7
+1 QUIT
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 IF $DATA(ACKDIRUT)
SET Y="@999"
+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 IF $$TIMECHEK^ACKQASU5(ACKVIEN,1)
SET Y="@15"
+1 QUIT
10 SET DW="5;8"
SET DV="RFXO"
SET DU=""
SET DLB="APPOINTMENT TIME"
SET DIFLD=55
+1 SET DQ(10,2)="S Y(0)=Y Q:'$D(Y) S Y=$TR(Y,""."",""""),Y=$$FMT^ACKQUTL6(Y)"
+2 SET DE(DW)="C10^ACKQTE"
+3 GOTO RE
C10 if $DATA(DE(10))[0
GOTO C10S
KILL DB
+1 SET X=DE(10)
SET DIC=DIE
+2 XECUTE "D SEND^ACKQUTL5(DA)"
+3 SET X=DE(10)
SET DIC=DIE
+4 XECUTE "D KILLREF^ACKQUTL5(X,DA,""T"")"
C10S SET X=""
if DG(DQ)=X
GOTO C10F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 XECUTE "D SEND^ACKQUTL5(DA)"
+3 SET X=DG(DQ)
SET DIC=DIE
+4 XECUTE "D SETREF^ACKQUTL5(X,DA,""T"")"
C10F1 QUIT
X10 if $LENGTH(X)>8!($LENGTH(X)<1)
KILL X
IF $DATA(X)
SET X=$$DATACHEK^ACKQUTL6(X,DA)
if 'X
KILL X
IF $DATA(X)
IF '$$DUPECHK^ACKQUTL6(X,DA,$GET(ACKPAT))
SET ACKITME=X
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
11 ;@15
SET DQ=12
12 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=12
DO X12
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
X12 IF ACKVISIT="EDIT"
SET Y="@16"
+1 QUIT
13 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=13
SET DW="0;2"
SET DV="RP509850.2X"
SET DU=""
SET DLB="PATIENT NAME"
SET DIFLD=1
+1 SET DE(DW)="C13^ACKQTE"
+2 SET DU="ACK(509850.2,"
+3 SET X=ACKPAT
+4 SET Y=X
+5 SET X=Y
SET DB(DQ)=1
SET DE(DW,"4/")=""
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 if X="@"
GOTO RD
GOTO Z
C13 if $DATA(DE(13))[0
GOTO C13S
KILL DB
+1 SET X=DE(13)
SET DIC=DIE
+2 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^ACK(509850.6,D0,0)):^(0),1:"")
SET X=$PIECE(Y(1),U,3)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(509850.6,1,1,1,2.4)
+3 SET X=DE(13)
SET DIC=DIE
+4 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^ACK(509850.6,D0,0)):^(0),1:"")
SET X=$PIECE(Y(1),U,4)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(509850.6,1,1,2,2.4)
+5 SET X=DE(13)
SET DIC=DIE
+6 KILL ^ACK(509850.6,"APT",$EXTRACT(X,1,30),DA)
+7 SET X=DE(13)
SET DIC=DIE
+8 ;
+9 SET X=DE(13)
SET DIC=DIE
+10 KILL ^ACK(509850.6,"APD",X,+^ACK(509850.6,DA,0),DA)
+11 SET X=DE(13)
SET DIC=DIE
+12 KILL ^ACK(509850.6,"C",$EXTRACT(X,1,30),DA)
+13 SET X=DE(13)
SET DIC=DIE
+14 XECUTE "D KILLREF^ACKQUTL5(X,DA,""P"")"
+15 SET X=DE(13)
SET DIC=DIE
+16 XECUTE "D SEND^ACKQUTL5(DA)"
C13S SET X=""
if DG(DQ)=X
GOTO C13F1
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(^ACK(509850.6,D0,0)):^(0),1:"")
SET X=$PIECE(Y(1),U,3)
SET X=X
SET DIU=X
KILL Y
XECUTE ^DD(509850.6,1,1,1,1.1)
XECUTE ^DD(509850.6,1,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(^ACK(509850.6,D0,0)):^(0),1:"")
SET X=$PIECE(Y(1),U,4)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
DO AOA^ACKQAS
XECUTE ^DD(509850.6,1,1,2,1.4)
+5 SET X=DG(DQ)
SET DIC=DIE
+6 SET ^ACK(509850.6,"APT",$EXTRACT(X,1,30),DA)=""
+7 SET X=DG(DQ)
SET DIC=DIE
+8 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
XECUTE ^DD(509850.6,1,1,4,89.2)
SET X=$PIECE(Y(101),U,2)
SET D0=I(0,0)
SET DIU=X
KILL Y
SET X=DIV
DO IVD^ACKQAS
XECUTE ^DD(509850.6,1,1,4,1.4)
+9 SET X=DG(DQ)
SET DIC=DIE
+10 SET ^ACK(509850.6,"APD",X,+^ACK(509850.6,DA,0),DA)=""
+11 SET X=DG(DQ)
SET DIC=DIE
+12 SET ^ACK(509850.6,"C",$EXTRACT(X,1,30),DA)=""
+13 SET X=DG(DQ)
SET DIC=DIE
+14 XECUTE "D SETREF^ACKQUTL5(X,DA,""P"")"
+15 SET X=DG(DQ)
SET DIC=DIE
+16 XECUTE "D SEND^ACKQUTL5(DA)"
C13F1 QUIT
X13 QUIT
14 ;@16
SET DQ=15
15 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=15
SET I(0,0)=D0
SET Y(1)=$SELECT($DATA(^ACK(509850.6,D0,0)):^(0),1:"")
SET X=$PIECE(Y(1),U,2)
SET X=X
SET D(0)=+X
SET X=$SELECT(D(0)>0:D(0),1:"")
+1 SET DGO="^ACKQTE1"
SET DC="^509850.2^ACK(509850.2,"
GOTO DIEZ^DIE0
R15 DO DE
GOTO A
+1 ;
16 ;@30
SET DQ=17
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 ACKCP=0
SET Y="@40"
+1 QUIT
18 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=18
SET DW="0;5"
SET DV="S"
SET DU=""
SET DLB="Is this a C&P Visit ?"
SET DIFLD=2.5
+1 SET DE(DW)="C18^ACKQTE"
+2 SET DU="0:NO;1:YES;"
+3 SET Y="YES"
+4 GOTO Y
C18 if $DATA(DE(18))[0
GOTO C18S
KILL DB
+1 SET X=DE(18)
SET DIC=DIE
+2 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^ACK(509850.6,D0,0)):^(0),1:"")
SET X=$PIECE(Y(1),U,9)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
DO TRIGCP^ACKQUTL
XECUTE ^DD(509850.6,2.5,1,1,2.4)
C18S SET X=""
if DG(DQ)=X
GOTO C18F1
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(^ACK(509850.6,D0,0)):^(0),1:"")
SET X=$PIECE(Y(1),U,9)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
DO TRIGCP^ACKQUTL
XECUTE ^DD(509850.6,2.5,1,1,1.4)
C18F1 QUIT
X18 QUIT
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 SET ACKCP=X
+1 QUIT
20 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=20
DO X20
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
X20 if 'ACKCP
SET Y="@40"
+1 QUIT
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 ACKCPNO=""
SET Y="@40"
+1 QUIT
22 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=22
SET DW="0;8"
SET DV="F"
SET DU=""
SET DLB="LINKED C&P EXAM"
SET DIFLD=.08
+1 SET DE(DW)="C22^ACKQTE"
+2 SET X=$SELECT(ACKCPNO'="":ACKCPNO,1:"")
+3 SET Y=X
+4 SET X=Y
SET DB(DQ)=1
SET DE(DW,"4/")=""
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 if X="@"
GOTO RD
GOTO Z
C22 if $DATA(DE(22))[0
GOTO C22S
KILL DB
+1 SET X=DE(22)
SET DIC=DIE
+2 KILL ^ACK(509850.6,"ALCP",$EXTRACT(X,1,30),DA)
C22S SET X=""
if DG(DQ)=X
GOTO C22F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 SET ^ACK(509850.6,"ALCP",$EXTRACT(X,1,30),DA)=""
C22F1 QUIT
X22 QUIT
23 ;@40
SET DQ=24
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 DO DIAGDIS^ACKQUTL4
+1 QUIT
25 ;3
if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=25
SET D=0
KILL DE(1)
+1 SET DIFLD=3
SET DGO="^ACKQTE2"
SET DC="5^509850.63PA^1^"
SET DV="509850.63M*P509850.1'X"
SET DW="0;1"
SET DOW="DIAGNOSTIC CODE"
SET DLB=$PIECE($$EZBLD^DIALOG(8042,DOW),": ")
if D
SET DC=DC_D
+2 SET DU="ACK(509850.1,"
+3 if D
GOTO RE
IF $DATA(DSC(509850.63))#2
IF $PIECE(DSC(509850.63),"I $D(^UTILITY(",1)=""
XECUTE DSC(509850.63)
SET D=$ORDER(^(0))
if D=""
SET D=-1
GOTO M25
+4 SET D=$SELECT($DATA(^ACK(509850.6,DA,1,0)):$PIECE(^(0),U,3,4),$ORDER(^(0))'="":$ORDER(^(0)),1:-1)
M25 IF D>0
SET DC=DC_D
IF $DATA(^ACK(509850.6,DA,1,+D,0))
SET DE(25)=$PIECE(^(0),U,1)
+1 GOTO RE
R25 DO DE
+1 SET D=$SELECT($DATA(^ACK(509850.6,DA,1,0)):$PIECE(^(0),U,3,4),1:1)
GOTO 25+1
+2 ;
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 $ORDER(^ACK(509850.6,ACKVIEN,1,0))=""
WRITE !!,"You must enter at least one Diagnosis"
SET Y="@40"
+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 IF '$$POSTDIAG^ACKQASU5(ACKVIEN)
SET Y="@40"
+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 DO HLOSS^ACKQUTL4
+1 QUIT
29 ;@50
SET DQ=30
30 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=30
DO X30
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
X30 WRITE @IOF
+1 QUIT
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 ACKPCE'=1
SET Y="@100"
+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 IF ACKSC=0
DO CLASDIS^ACKQNQ
SET Y="@55"
+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 DO PATDIS^ACKQUTL4
+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 DO ELIGDIS^ACKQUTL4
+1 QUIT
35 SET DW="5;2"
SET DV="R*P8'"
SET DU=""
SET DLB="Enter the Eligibility for this Appointment"
SET DIFLD=80
+1 SET DE(DW)="C35^ACKQTE"
+2 SET DU="DIC(8,"
+3 SET X=ACKELIG
+4 SET Y=X
+5 GOTO Y
C35 if $DATA(DE(35))[0
GOTO C35S
KILL DB
+1 SET X=DE(35)
SET DIC=DIE
+2 XECUTE "D SEND^ACKQUTL5(DA)"
C35S SET X=""
if DG(DQ)=X
GOTO C35F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 XECUTE "D SEND^ACKQUTL5(DA)"
C35F1 QUIT
X35 SET DIC("S")="I $D(ACKELDIS(Y))"
SET DIC("W")="W """""
DO ^DIC
KILL DIC
SET DIC=DIE
SET X=+Y
if Y<0
KILL X
+1 QUIT
+2 ;
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 SET ACKELIG=$SELECT(ACKPCE'=1:"",ACKELGCT=1:ACKELIG,1:X)
+1 QUIT
37 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=37
DO X37
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
X37 SET Y="@60"
+1 QUIT
38 ;@55
SET DQ=39
39 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=39
DO X39
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
X39 IF $$GET1^DIQ(509850.6,ACKVIEN_",",80,"I")=ACKELIG1
SET Y="@60"
+1 QUIT
40 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=40
SET DW="5;2"
SET DV="R*P8'"
SET DU=""
SET DLB="VISIT ELIGIBILITY"
SET DIFLD=80
+1 SET DE(DW)="C40^ACKQTE"
+2 SET DU="DIC(8,"
+3 SET X=ACKELIG1
+4 SET Y=X
+5 SET X=Y
SET DB(DQ)=1
SET DE(DW,"4/")=""
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 if X="@"
GOTO RD
GOTO Z
C40 if $DATA(DE(40))[0
GOTO C40S
KILL DB
+1 SET X=DE(40)
SET DIC=DIE
+2 XECUTE "D SEND^ACKQUTL5(DA)"
C40S SET X=""
if DG(DQ)=X
GOTO C40F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 XECUTE "D SEND^ACKQUTL5(DA)"
C40F1 QUIT
X40 QUIT
41 ;@60
SET DQ=42
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 ACKPCE'=1
SET Y="@100"
+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 ACKSC=0
SET Y="@70"
+1 QUIT
44 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=44
SET DW="5;3"
SET DV="RS"
SET DU=""
SET DLB="Was care for SC Condition ?"
SET DIFLD=20
+1 SET DE(DW)="C44^ACKQTE"
+2 SET DU="0:NO;1:YES;"
+3 SET X=""
+4 SET Y=X
+5 GOTO Y
C44 if $DATA(DE(44))[0
GOTO C44S
KILL DB
+1 SET X=DE(44)
SET DIC=DIE
+2 XECUTE "D SEND^ACKQUTL5(DA)"
C44S SET X=""
if DG(DQ)=X
GOTO C44F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 XECUTE "D SEND^ACKQUTL5(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 IF ACKPCE'=1
SET Y="@100"
+1 QUIT
46 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=46
DO X46
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
X46 SET ACKSC=$SELECT(ACKSC=0:0,X=1:2,1:1)
+1 QUIT
47 ;@70
SET DQ=48
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 ACKAO=0
SET Y="@80"
+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 ACKSC=2
SET Y="@90"
+1 QUIT
50 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=50
SET DW="5;4"
SET DV="RS"
SET DU=""
SET DLB="Was care related to AO Exposure ?"
SET DIFLD=25
+1 SET DE(DW)="C50^ACKQTE"
+2 SET DU="0:NO;1:YES;"
+3 SET X=""
+4 SET Y=X
+5 GOTO Y
C50 if $DATA(DE(50))[0
GOTO C50S
KILL DB
+1 SET X=DE(50)
SET DIC=DIE
+2 XECUTE "D SEND^ACKQUTL5(DA)"
C50S SET X=""
if DG(DQ)=X
GOTO C50F1
KILL DB
+1 DO ^ACKQTE3
C50F1 QUIT
X50 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 SET ACKAO=$SELECT(ACKAO=0:0,ACKSC'=1:ACKAO,X=1:2,1:1)
+1 QUIT
52 ;@80
SET DQ=53
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 ACKRAD=0
SET Y="@85"
+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 IF ACKSC=2
SET Y="@90"
+1 QUIT
55 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=55
SET DW="5;5"
SET DV="RS"
SET DU=""
SET DLB="Was care related to IR Exposure ?"
SET DIFLD=30
+1 SET DE(DW)="C55^ACKQTE"
+2 SET DU="0:NO;1:YES;"
+3 SET X=""
+4 SET Y=X
+5 GOTO Y
C55 if $DATA(DE(55))[0
GOTO C55S
KILL DB
+1 DO ^ACKQTE4
C55S SET X=""
if DG(DQ)=X
GOTO C55F1
KILL DB
+1 DO ^ACKQTE5
C55F1 QUIT
X55 QUIT
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 SET ACKRAD=$SELECT(ACKRAD=0:0,ACKSC'=1:ACKRAD,X=1:2,1:1)
+1 QUIT
57 ;@85
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 ACKENV=0
SET Y="@90"
+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 ACKSC=2
SET Y="@90"
+1 QUIT
60 if $DATA(DG)>9
DO F^DIE17
GOTO ^ACKQTE6