source: FOIAVistA/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LA7SCE.m@ 808

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

initial load of FOIAVistA 6/30/08 version

File size: 8.3 KB
Line 
1LA7SCE ;DALOI/JMC - Shipping Configuration Utility ;5/5/97 14:44
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**27,46,61,64**;Sep 27, 1994
3 Q
4 ;
5SCFE ; Edit file #62.9, Shipping Configuration.
6 ;
7 N DA,DIE,DIC,DIR,DLAYGO,DIRUT,DR,DTOUT,DIROUT,X,Y
8 N LA7CHECK,LA7COPY,LA7NVAF,LA7SCFG,LA7SCFR,LA7TYPE,LA7VAF,LA7X,LR62,LRSS
9 ;
10 S DIC="^LAHM(62.9,",DIC(0)="AELMQZ",DIC("A")="Select SHIPPING CONFIGURATION: "
11 S DIC("DR")=".02;.03",DLAYGO=62.9
12 D ^DIC
13 K DA,DIC,DIE,DR
14 I Y<1 Q
15 ;
16 S LA7SCFG=+Y,LA7SCFG(0)=Y(0)
17 ;
18 L +^LAHM(62.9,LA7SCFG):5
19 I '$T D Q
20 . D EN^DDIOL("Unable to obtain lock on entry "_$P(LA7SCFG(0),"^"),"","!?3")
21 ;
22 S DIR(0)="SO^1:Collecting facility;2:Host facility",DIR("A")="Are you editing this entry as the"
23 S DIR("?",1)="Is this entry used by the Collecting facility to ship specimens,"
24 S DIR("?",2)="or by the Host facility to accept a shipment."
25 S DIR("?")="This determines which fields are edited in the file."
26 D ^DIR
27 I $D(DIRUT) D UNL629 Q
28 S LA7TYPE=+Y
29 ;
30 ; Determine if other facility is non-VA.
31 ; When acting as collecting facility is host non-VA
32 ; When acting as host is collecting facility non-VA
33 S LA7VAF="",LA7NVAF=0
34 I $P(LA7SCFG(0),"^",2),$P(LA7SCFG(0),"^",3) D
35 . S LA7X=$S(LA7TYPE=1:$P(LA7SCFG(0),"^",3),1:$P(LA7SCFG(0),"^",2))
36 . S LA7VAF=$$GET1^DIQ(4,LA7X_",","AGENCY CODE","I")
37 . S LA7NVAF=$$NVAF^LA7VHLU2(LA7X)
38 I LA7VAF="" D Q
39 . N LA7MSG
40 . S LA7MSG="Unable to proceed - institution "
41 . S LA7MSG=LA7MSG_$$GET1^DIQ(4,$S(LA7TYPE=1:$P(LA7SCFG(0),"^",3),1:$P(LA7SCFG(0),"^",2))_",",.01)
42 . S LA7MSG=LA7MSG_" missing AGENCY CODE field in INSITUTION file (#4)"
43 . D EN^DDIOL(LA7MSG,"","!!?3")
44 . D UNL629
45 ;
46 ; If acting as host ask if user wants to copy test config from another entry.
47 I LA7TYPE=2 D
48 . N DIC,Y
49 . S LA7COPY=$$ASKCOPY
50 . I LA7COPY<1 Q
51 . S LA7CHECK=$$CHECK(LA7SCFG)
52 . I LA7CHECK<1 S LA7COPY=LA7CHECK Q
53 . I LA7COPY<1 Q
54 . I LA7COPY=1 D Q
55 . . S DIC="^LAHM(62.9,",DIC(0)="AEMQZ",DIC("A")="Select SHIPPING CONFIGURATION to COPY FROM: ",DIC("S")="I Y'=LA7SCFG"
56 . . D ^DIC K DIC("S")
57 . . I Y<1 Q
58 . . S LA7SCFR=+Y,LA7SCFR(0)=Y(0)
59 . . D CLRSCT(.LA7SCFG)
60 . . D COPYSC(.LA7SCFR,.LA7SCFG)
61 . I LA7COPY=2 D Q
62 . . D CLRSCT(.LA7SCFG)
63 . . D COPY60(.LA7SCFG)
64 I LA7TYPE=2,LA7COPY<0 D UNL629 Q
65 K DA,DIE,DIC,DIR,DLAYGO,DIRUT,DR,DTOUT,DIROUT,X,Y
66 ;
67 ; Set up DR string when acting as collecting facility
68 I LA7TYPE=1 D
69 . S DR=".01;.02;.06;.03;.031;"
70 . I LA7NVAF>1 S DR=DR_".11;.12;.14;.15;"
71 . I LA7NVAF=1 S DR=DR_".14////1;.15////1;"
72 . S DR=DR_".04;.07;.08;.09;.1;.13;60"
73 . S DR(2,62.9001)=".01;.02;.025;.03;.04;.05;.06;.07"
74 ;
75 ; Set up DR string when acting as host facility
76 I LA7TYPE=2 D
77 . S DR=".01;.02;.06;.03;.031;"
78 . I LA7NVAF>1 S DR=DR_".11;.14;.15;"
79 . I LA7NVAF=1 S DR=DR_".14////0;.15////1;"
80 . S DR=DR_".04;.05;60"
81 . S DR(2,62.9001)=".01;S LRSS=$P(^LAB(60,X,0),U,4);.04;.09;S LR62=X I LRSS'=""MI"" S Y=""@2"";I LR62,$P(^LAB(62,LR62,0),U,2)'="""" S Y=""@2"";.03;5.7;@2"
82 ;
83 ; Determine if non-VA test codes/specimen fields should be asked
84 I LA7VAF'="V" D
85 . S DR(2,62.9001)=DR(2,62.9001)_";I $P(^LAHM(62.9,LA7SCFG,0),U,15)'=1 S Y=""@9"";5.1;5.2;5.5"
86 . I LA7TYPE=1,LA7NVAF=1 S DR(2,62.9001)=DR(2,62.9001)_"////99LST"
87 . S DR(2,62.9001)=DR(2,62.9001)_";@9"
88 . I LA7TYPE=1 D
89 . . S DR(2,62.9001)=DR(2,62.9001)_";I $P(^LAHM(62.9,LA7SCFG,0),U,16)'=1 S Y=""@10"";5.3;5.4;5.6"
90 . . I LA7NVAF=1 S DR(2,62.9001)=DR(2,62.9001)_"////99LRP;5.7;5.8;5.9////99LRS"
91 . . S DR(2,62.9001)=DR(2,62.9001)_";@10"
92 . I LA7TYPE=2 D
93 . . S DR(2,62.9001)=DR(2,62.9001)_";I $P(^LAHM(62.9,LA7SCFG,0),U,16)'=1 S Y=""@10"";5.3;5.4;5.6"
94 . . I LA7NVAF=1 S DR(2,62.9001)=DR(2,62.9001)_"////99LRP"
95 . . S DR(2,62.9001)=DR(2,62.9001)_";@10"
96 ;
97 I LA7TYPE=1 D
98 . N J,K
99 . S DR(2,62.9001)=DR(2,62.9001)_";"
100 . S X="1.1;I 'X S Y=1.2;1.15;1.16;1.2;I 'X S Y=2.1;1.25;1.26;2.1;I '+X S Y=2.3;2.15;2.16;2.3;I '+X S Y=2.2;2.35;2.36;2.2;I '+X S Y=""@12"";2.25;2.26;@12"
101 . I ($L(DR(2,62.9001))+$L(X))<246 S DR(2,62.9001)=DR(2,62.9001)_X Q
102 . S K=$L(X,";")
103 . F J=1:1:K D
104 . . I ($L(DR(2,62.9001))+$L($P(X,";")))>244 S J=K Q
105 . . S DR(2,62.9001)=DR(2,62.9001)_$P(X,";")_";",X=$P(X,";",2,K)
106 . I X'="" S DR(2,62.9001,1)=X
107 ;
108 S DA=LA7SCFG,DIE="^LAHM(62.9,"
109 D ^DIE,UNL629
110 Q
111 ;
112 ;
113 ; Unlock entry in 62.9
114UNL629 L -^LAHM(62.9,LA7SCFG)
115 ;
116 Q
117 ;
118 ;
119SCTE ; Edit file #62.91, Shipping Container.
120 N DA,DIE,DIC,DLAYGO,DR,X,Y
121 S DIC="^LAHM(62.91,",DIC(0)="AELMQZ",DIC("A")="Select SHIPPING CONTAINER: ",DLAYGO=62.91
122 D ^DIC
123 I Y<1 Q
124 S DA=+Y,DIE=DIC,DR=".01;.02"
125 D ^DIE
126 Q
127 ;
128 ;
129SCME ; Edit file #62.92, Shipping Method.
130 N DA,DIE,DIC,DLAYGO,DR,X,Y
131 S DIC="^LAHM(62.92,",DIC(0)="AELMQZ",DIC("A")="Select SHIPPING METHOD: ",DLAYGO=62.92
132 D ^DIC
133 I Y<1 Q
134 S DA=+Y,DIE=DIC,DR=".01;.02"
135 D ^DIE
136 Q
137 ;
138 ;
139SCDE ; Edit file #62.93, Shipping Condition.
140 N DA,DIE,DIC,DLAYGO,DR,X,Y
141 S DIC="^LAHM(62.93,",DIC(0)="AELMQZ",DIC("A")="Select SHIPPING CONDITION: ",DLAYGO=62.93
142 D ^DIC
143 I Y<1 Q
144 S DA=+Y,DIE=DIC,DR=".01;.02"
145 D ^DIE
146 Q
147 ;
148 ;
149ASKCOPY() ; Ask if user want to copy tests from file #60 or another configuration in file #62.9 LAB SHIPPING CONFIGURATION
150 ; Returns LA7COPY = -1 user quit/aborted
151 ; = 0 do not copy
152 ; = 1 use file #60
153 ; = 2 use another entry in #62.49
154 N DIR,DIRUT,DTOUT,DUOUT,X,Y
155 S DIR(0)="SMO^0:Do NOT copy;1:Another Shipping Configuration;2:Test Catalog - LABORATORY TEST File #60"
156 S DIR("A")="Copy a test profile from",DIR("B")="Do NOT copy"
157 S DIR("?",1)="If you want to duplicate a shipping configuration using another configuration"
158 S DIR("?",2)="or build from the tests marked as catalog tests in the LABORATORY TEST file."
159 S DIR("?")="Select the appropiate option."
160 D ^DIR
161 I $D(DIRUT) S Y=-1
162 Q Y
163 ;
164 ;
165CHECK(LA7SCFG) ; Check if test exists for configuration and warn if overwriting
166 ; Call with LA7SCFG = shiping configuration ien
167 ; Returns -1 = user aborted/timeout
168 ; 0 = no - don't overwrite
169 ; 1 = yes - overwrite
170 I '$O(^LAHM(62.9,LA7SCFG,60,0)) Q 1
171 N DIR,DIRUT,DTOUT,DUOUT,X,Y
172 S DIR(0)="SBO^0:NO;1:YES"
173 S DIR("A",1)="Tests already exist for this configuration!",DIR("A")="Are you sure",DIR("B")="NO"
174 D ^DIR
175 I $D(DIRUT) S Y=-1
176 Q Y
177 ;
178 ;
179COPYSC(LA7FR,LA7TO) ; Copy one shipping configuration to another
180 ; Call with LA7FR = shipping configuration to copy FROM.
181 ; LA7TO = shipping configuration ien to copy TO.
182 N LA760,LA762,LA6205,LA7X
183 W !!,"Copying tests from configuration: ",$P(LA7FR(0),"^")," to ",$P(LA7TO(0),"^"),!
184 S LA7X=0
185 F S LA7X=$O(^LAHM(62.9,LA7FR,60,LA7X)) Q:'LA7X D
186 . S LA760=$P($G(^LAHM(62.9,LA7FR,60,LA7X,0)),"^") ; file #60 laboratory test ien.
187 . S LA76205=$P($G(^LAHM(62.9,LA7FR,60,LA7X,0)),"^",4) ; file #62.05, urgency ien.
188 . S LA762=$P($G(^LAHM(62.9,LA7FR,60,LA7X,0)),"^",9) ; file #62, collection sample ien.
189 . I LA760 D FDA629(LA7TO,LA760,LA762,LA76205)
190 Q
191 ;
192 ;
193COPY60(LA7SCFG) ; Copy catalog tests from file #60 to shipping configuration.
194 ; Call with LA7SCFG = shipping configuration ien to add tests to from file #60
195 N LA760,LA762,LA7X
196 W !!,"Copying tests from file #60 LABORATORY TEST to ",$P(LA7SCFG(0),"^"),!
197 S LA760=0 ; file #60 pointer
198 I '$D(^LAHM(62.9,LA7SCFG,60,0)) S ^LAHM(62.9,LA7SCFG,60,0)="^62.9001P^0^0" ; set subfile zeroth node
199 F S LA760=$O(^LAB(60,LA760)) Q:'LA760 D
200 . I '$P($G(^LAB(60,LA760,64)),"^",3) Q ; Not a catalog item
201 . S LA7X=0
202 . F S LA7X=$O(^LAB(60,LA760,3,LA7X)) Q:'LA7X D
203 . . S LA762=+$G(^LAB(60,LA760,3,LA7X,0)) ; file #62 pointer (collection sample)
204 . . I LA762 D FDA629(LA7SCFG,LA760,LA762,"")
205 Q
206 ;
207 ;
208FDA629(LA7SCFG,LA760,LA762,LA76205) ; Add entry to TEST/PROFILE multiple
209 ; Call with LA7SCFG = file #62.9, shipping configuration ien
210 ; LA760 = file #60, lab test ien
211 ; LA762 = file #62, collection sample ien
212 ; LA76205 = file #62.05 , urgency ien
213 N FDA,LA7DIE,LA7629
214 S LA7629(1)=LA7SCFG
215 S FDA(629,62.9001,"+2,"_+LA7SCFG_",",.01)=LA760
216 I LA76205 S FDA(629,62.9001,"+2,"_+LA7SCFG_",",.04)=LA76205
217 I LA762 S FDA(629,62.9001,"+2,"_+LA7SCFG_",",.09)=LA762
218 W:$X>(IOM-2) ! W "#"
219 D UPDATE^DIE("","FDA(629)","LA7629","LA7DIE(629)") ; Add test to shipping configuration.
220 Q
221 ;
222 ;
223CLRSCT(LA7SCFG) ; Clear shipping configuration tests.
224 ; Call with LA7SCFG = file #62.9, shipping configuration ien
225 N DA,DIK,LA7X
226 W !!,"Clearing existing tests from configuration: ",$P(LA7SCFG(0),"^"),!
227 S DA(1)=+LA7SCFG,DIK="^LAHM(62.9,"_DA(1)_",60,"
228 S LA7X=0
229 F S LA7X=$O(^LAHM(62.9,LA7SCFG,60,LA7X)) Q:'LA7X D
230 . W:$X>(IOM-2) ! W "*"
231 . S DA=LA7X D ^DIK
232 Q
Note: See TracBrowser for help on using the repository browser.