1 | ACKQTE ; GENERATED FROM 'ACKQAS VISIT ENTRY' INPUT TEMPLATE(#1338), FILE 509850.6;07/15/03
|
---|
2 | D DE G BEGIN
|
---|
3 | 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,""))=""
|
---|
4 | I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,2) S:%]"" DE(13)=% S %=$P(%Z,U,5) S:%]"" DE(18)=%
|
---|
5 | I $D(^(5)) S %Z=^(5) S %=$P(%Z,U,8) S:%]"" DE(10)=%
|
---|
6 | K %Z Q
|
---|
7 | ;
|
---|
8 | W W !?DL+DL-2,DLB_": "
|
---|
9 | Q
|
---|
10 | O D W W Y W:$X>45 !?9
|
---|
11 | I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
|
---|
12 | W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W " (No Editing)" Q
|
---|
13 | TR R X:DTIME E S (DTOUT,X)=U W $C(7)
|
---|
14 | Q
|
---|
15 | A K DQ(DQ) S DQ=DQ+1
|
---|
16 | B G @DQ
|
---|
17 | RE G PR:$D(DE(DQ)) D W,TR
|
---|
18 | N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
|
---|
19 | RD G QS:X?."?" I X["^" D D G ^DIE17
|
---|
20 | I X="@" D D G Z^DIE2
|
---|
21 | I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W " "_X
|
---|
22 | 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
|
---|
23 | K DDER G X
|
---|
24 | 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
|
---|
25 | G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
|
---|
26 | I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
|
---|
27 | V D @("X"_DQ) K YS
|
---|
28 | 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
|
---|
29 | X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
|
---|
30 | S X="?BAD"
|
---|
31 | QS S DZ=X D D,QQ^DIEQ G B
|
---|
32 | D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
|
---|
33 | Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
|
---|
34 | PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
|
---|
35 | 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
|
---|
36 | 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
|
---|
37 | X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
|
---|
38 | RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
|
---|
39 | I I DV'["I",DV'["#" G RD
|
---|
40 | D E^DIE0 G RD:$D(X),PR
|
---|
41 | Q
|
---|
42 | SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
|
---|
43 | I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
|
---|
44 | D ^DIR I 'DDER S %=Y(0),X=Y
|
---|
45 | Q
|
---|
46 | SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
|
---|
47 | I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
|
---|
48 | E K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
|
---|
49 | Q
|
---|
50 | NKEY W:'$D(ZTQUEUED) "?? Required key field" S X="?BAD" G QS
|
---|
51 | KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
|
---|
52 | BEGIN S DNM="ACKQTE",DQ=1
|
---|
53 | N DIEZTMP,DIEZAR,DIEZRXR,DIIENS,DIXR K DIEFIRE,DIEBADK S DIEZTMP=$$GETTMP^DIKC1("DIEZ")
|
---|
54 | M DIEZAR=^DIE(1338,"AR") S DICRREC="TRIG^DIE17"
|
---|
55 | S:$D(DTIME)[0 DTIME=300 S D0=DA,DIIENS=DA_",",DIEZ=1338,U="^"
|
---|
56 | 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
|
---|
57 | X1 I $G(ACKVISIT)'="NEW",$G(ACKVISIT)'="EDIT" W !!,"This option must only be run from QUASAR" S Y="@999"
|
---|
58 | Q
|
---|
59 | 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
|
---|
60 | X2 D SETUP^ACKQUTL4
|
---|
61 | Q
|
---|
62 | 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
|
---|
63 | X3 D HLOSS^ACKQUTL4
|
---|
64 | Q
|
---|
65 | 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
|
---|
66 | X4 S ACKCP=$$ACKCP^ACKQUTL4
|
---|
67 | Q
|
---|
68 | 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
|
---|
69 | X5 S ACKCPNO=$S(+ACKCP=0:"",1:$P(ACKCP,U,2)),ACKCP=+ACKCP
|
---|
70 | Q
|
---|
71 | 6 S DQ=7 ;@10
|
---|
72 | 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
|
---|
73 | X7 D EN^ACKQUTL7
|
---|
74 | Q
|
---|
75 | 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
|
---|
76 | X8 I $D(ACKDIRUT) S Y="@999"
|
---|
77 | Q
|
---|
78 | 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
|
---|
79 | X9 I $$TIMECHEK^ACKQASU5(ACKVIEN,1) S Y="@15"
|
---|
80 | Q
|
---|
81 | 10 S DW="5;8",DV="RFXO",DU="",DLB="APPOINTMENT TIME",DIFLD=55
|
---|
82 | S DQ(10,2)="S Y(0)=Y Q:'$D(Y) S Y=$TR(Y,""."",""""),Y=$$FMT^ACKQUTL6(Y)"
|
---|
83 | S DE(DW)="C10^ACKQTE"
|
---|
84 | G RE
|
---|
85 | C10 G C10S:$D(DE(10))[0 K DB
|
---|
86 | S X=DE(10),DIC=DIE
|
---|
87 | X "D SEND^ACKQUTL5(DA)"
|
---|
88 | S X=DE(10),DIC=DIE
|
---|
89 | X "D KILLREF^ACKQUTL5(X,DA,""T"")"
|
---|
90 | C10S S X="" G:DG(DQ)=X C10F1 K DB
|
---|
91 | S X=DG(DQ),DIC=DIE
|
---|
92 | X "D SEND^ACKQUTL5(DA)"
|
---|
93 | S X=DG(DQ),DIC=DIE
|
---|
94 | X "D SETREF^ACKQUTL5(X,DA,""T"")"
|
---|
95 | C10F1 Q
|
---|
96 | 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
|
---|
97 | I $D(X),X'?.ANP K X
|
---|
98 | Q
|
---|
99 | ;
|
---|
100 | 11 S DQ=12 ;@15
|
---|
101 | 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
|
---|
102 | X12 I ACKVISIT="EDIT" S Y="@16"
|
---|
103 | Q
|
---|
104 | 13 D:$D(DG)>9 F^DIE17,DE S DQ=13,DW="0;2",DV="RP509850.2X",DU="",DLB="PATIENT NAME",DIFLD=1
|
---|
105 | S DE(DW)="C13^ACKQTE"
|
---|
106 | S DU="ACK(509850.2,"
|
---|
107 | S X=ACKPAT
|
---|
108 | S Y=X
|
---|
109 | 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)
|
---|
110 | G RD:X="@",Z
|
---|
111 | C13 G C13S:$D(DE(13))[0 K DB
|
---|
112 | S X=DE(13),DIC=DIE
|
---|
113 | 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)
|
---|
114 | S X=DE(13),DIC=DIE
|
---|
115 | 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)
|
---|
116 | S X=DE(13),DIC=DIE
|
---|
117 | K ^ACK(509850.6,"APT",$E(X,1,30),DA)
|
---|
118 | S X=DE(13),DIC=DIE
|
---|
119 | ;
|
---|
120 | S X=DE(13),DIC=DIE
|
---|
121 | K ^ACK(509850.6,"APD",X,+^ACK(509850.6,DA,0),DA)
|
---|
122 | S X=DE(13),DIC=DIE
|
---|
123 | K ^ACK(509850.6,"C",$E(X,1,30),DA)
|
---|
124 | S X=DE(13),DIC=DIE
|
---|
125 | X "D KILLREF^ACKQUTL5(X,DA,""P"")"
|
---|
126 | S X=DE(13),DIC=DIE
|
---|
127 | X "D SEND^ACKQUTL5(DA)"
|
---|
128 | C13S S X="" G:DG(DQ)=X C13F1 K DB
|
---|
129 | S X=DG(DQ),DIC=DIE
|
---|
130 | 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)
|
---|
131 | S X=DG(DQ),DIC=DIE
|
---|
132 | 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)
|
---|
133 | S X=DG(DQ),DIC=DIE
|
---|
134 | S ^ACK(509850.6,"APT",$E(X,1,30),DA)=""
|
---|
135 | S X=DG(DQ),DIC=DIE
|
---|
136 | 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)
|
---|
137 | S X=DG(DQ),DIC=DIE
|
---|
138 | S ^ACK(509850.6,"APD",X,+^ACK(509850.6,DA,0),DA)=""
|
---|
139 | S X=DG(DQ),DIC=DIE
|
---|
140 | S ^ACK(509850.6,"C",$E(X,1,30),DA)=""
|
---|
141 | S X=DG(DQ),DIC=DIE
|
---|
142 | X "D SETREF^ACKQUTL5(X,DA,""P"")"
|
---|
143 | S X=DG(DQ),DIC=DIE
|
---|
144 | X "D SEND^ACKQUTL5(DA)"
|
---|
145 | C13F1 Q
|
---|
146 | X13 Q
|
---|
147 | 14 S DQ=15 ;@16
|
---|
148 | 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:"")
|
---|
149 | S DGO="^ACKQTE1",DC="^509850.2^ACK(509850.2," G DIEZ^DIE0
|
---|
150 | R15 D DE G A
|
---|
151 | ;
|
---|
152 | 16 S DQ=17 ;@30
|
---|
153 | 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
|
---|
154 | X17 I ACKCP=0 S Y="@40"
|
---|
155 | Q
|
---|
156 | 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
|
---|
157 | S DE(DW)="C18^ACKQTE"
|
---|
158 | S DU="0:NO;1:YES;"
|
---|
159 | S Y="YES"
|
---|
160 | G Y
|
---|
161 | C18 G C18S:$D(DE(18))[0 K DB
|
---|
162 | S X=DE(18),DIC=DIE
|
---|
163 | 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)
|
---|
164 | C18S S X="" G:DG(DQ)=X C18F1 K DB
|
---|
165 | D ^ACKQTE2
|
---|
166 | C18F1 Q
|
---|
167 | X18 Q
|
---|
168 | 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
|
---|
169 | X19 S ACKCP=X
|
---|
170 | Q
|
---|
171 | 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
|
---|
172 | X20 S:'ACKCP Y="@40"
|
---|
173 | Q
|
---|
174 | 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
|
---|
175 | X21 S:ACKCPNO="" Y="@40"
|
---|
176 | Q
|
---|
177 | 22 D:$D(DG)>9 F^DIE17 G ^ACKQTE3
|
---|