source: WorldVistAEHR/trunk/r/QUASAR-ACKQ/ACKQTE.m@ 1046

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

initial load of WorldVistAEHR

File size: 7.9 KB
Line 
1ACKQTE ; GENERATED FROM 'ACKQAS VISIT ENTRY' INPUT TEMPLATE(#1338), FILE 509850.6;07/15/03
2 D DE G BEGIN
3DE 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 ;
8W W !?DL+DL-2,DLB_": "
9 Q
10O 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
13TR R X:DTIME E S (DTOUT,X)=U W $C(7)
14 Q
15A K DQ(DQ) S DQ=DQ+1
16B G @DQ
17RE G PR:$D(DE(DQ)) D W,TR
18N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
19RD 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
22T 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
24P 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
27V D @("X"_DQ) K YS
28Z 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
29X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
30 S X="?BAD"
31QS S DZ=X D D,QQ^DIEQ G B
32D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
33Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
34PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
35R 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=%
38RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
39I I DV'["I",DV'["#" G RD
40 D E^DIE0 G RD:$D(X),PR
41 Q
42SET 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
46SAVEVALS 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
50NKEY W:'$D(ZTQUEUED) "?? Required key field" S X="?BAD" G QS
51KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
52BEGIN 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="^"
561 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
57X1 I $G(ACKVISIT)'="NEW",$G(ACKVISIT)'="EDIT" W !!,"This option must only be run from QUASAR" S Y="@999"
58 Q
592 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
60X2 D SETUP^ACKQUTL4
61 Q
623 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
63X3 D HLOSS^ACKQUTL4
64 Q
654 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
66X4 S ACKCP=$$ACKCP^ACKQUTL4
67 Q
685 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
69X5 S ACKCPNO=$S(+ACKCP=0:"",1:$P(ACKCP,U,2)),ACKCP=+ACKCP
70 Q
716 S DQ=7 ;@10
727 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
73X7 D EN^ACKQUTL7
74 Q
758 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
76X8 I $D(ACKDIRUT) S Y="@999"
77 Q
789 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
79X9 I $$TIMECHEK^ACKQASU5(ACKVIEN,1) S Y="@15"
80 Q
8110 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
85C10 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"")"
90C10S 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"")"
95C10F1 Q
96X10 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 ;
10011 S DQ=12 ;@15
10112 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
102X12 I ACKVISIT="EDIT" S Y="@16"
103 Q
10413 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
111C13 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)"
128C13S 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)"
145C13F1 Q
146X13 Q
14714 S DQ=15 ;@16
14815 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
150R15 D DE G A
151 ;
15216 S DQ=17 ;@30
15317 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
154X17 I ACKCP=0 S Y="@40"
155 Q
15618 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
161C18 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)
164C18S S X="" G:DG(DQ)=X C18F1 K DB
165 D ^ACKQTE2
166C18F1 Q
167X18 Q
16819 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
169X19 S ACKCP=X
170 Q
17120 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
172X20 S:'ACKCP Y="@40"
173 Q
17421 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
175X21 S:ACKCPNO="" Y="@40"
176 Q
17722 D:$D(DG)>9 F^DIE17 G ^ACKQTE3
Note: See TracBrowser for help on using the repository browser.