source: WorldVistAEHR/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LA7VIN3.m@ 1800

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

initial load of WorldVistAEHR

File size: 3.2 KB
Line 
1LA7VIN3 ;DALOI/JMC - Process Incoming UI Msgs, continued ; 01/14/99
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**46,64**;Sep 27, 1994
3 ;This routine is a continuation of LA7VIN1 and is only called from there.
4 Q
5 ;
6MSA ; Process MSA segment
7 ; The incoming MSA is used to update the status of the message
8 ; in the LA7 MESSAGE QUEUE (#62.49)
9 ;
10 ; and
11 ;
12 ; if acknowledging ORU message - the ORDERS PENDING (#69.6) file
13 ; if acknowledging ORM message - the SHIPPING MANIFEST (#62.8) file
14 ;
15 N LA7696,LA76964,LA7I,LA7MSAID,LA7MSTAT,LA7ORT,LA7RUID,LA7ST,LA7SITE,LA7X,LA7Y
16 S LA7MSTAT=$$P^LA7VHLU(.LA7SEG,2,LA7FS)
17 S LA7MSAID=$$P^LA7VHLU(.LA7SEG,3,LA7FS)
18 ;
19 ; Extract text message from MSA-3
20 S LA7X=$$P^LA7VHLU(.LA7SEG,4,LA7FS)
21 S LA7MSATM=$$UNESC^LA7VHLU3(LA7X,LA7FS_LA7ECH)
22 ;
23 ; Extract error condition from MSA-6
24 S LA7X=$$P^LA7VHLU(.LA7SEG,7,LA7FS)
25 I LA7X'="" D
26 . S LA7Y=""
27 . I $P(LA7X,$E(LA7ECH),2)'="" S LA7Y=$$UNESC^LA7VHLU3($P(LA7X,$E(LA7ECH),2),LA7FS_LA7ECH)
28 . I $P(LA7X,$E(LA7ECH))'="" D
29 . . I LA7Y="" S LA7Y=$$UNESC^LA7VHLU3($P(LA7X,$E(LA7ECH)),LA7FS_LA7ECH) Q
30 . . S LA7Y="["_$P(LA7X,$E(LA7ECH))_"] "_LA7Y
31 . S LA7MSATM=$S(LA7MSATM'="":LA7MSATM_" ",1:"")_LA7Y
32 I LA7MSAID="" Q
33 ;
34 D SETID^LA7VHLU1(LA76249,LA7ID,"ACK-"_LA7MSAID)
35 ;
36 S LA7ST=$$FIND1^DIC(64.061,"","MX","Results/data Received","","I $P(^(0),U,7)=""U""")
37 ;
38 ; Only look for messages id's that are outgoing messages, those that
39 ; originated from this system. Other systems (incoming) messages can
40 ; use a message id that is the same as a Vista message.
41 ;
42 N LA76249
43 S LA76249=0
44 F S LA76249=$O(^LAHM(62.49,"ID",LA7MSAID,LA76249)) Q:'LA76249 D
45 . I $P($G(^LAHM(62.49,LA76249,0)),"^",2)'="O" Q
46 . D UPDF
47 ;
48 Q
49 ;
50UPDF ; Update respective files
51 ;
52 N FDA,I,LA7ERR,LA7MTYPE,X
53 ;
54 F I=63,100 S LA76249(I)=$G(^LAHM(62.49,LA76249,I))
55 ;
56 ; Update original message in #62.49
57 S FDA(1,62.49,LA76249_",",2)="X"
58 I LA7MSTAT'="AA",LA7MSTAT'="CA" D
59 . S FDA(1,62.49,LA76249_",",2)="E"
60 . S FDA(1,62.49,LA76249_",",160)=LA7MSTAT
61 . I LA7MSATM'="" S FDA(1,62.49,LA76249_",",161)=LA7MSATM
62 D FILE^DIE("","FDA(1)","LA7ERR(1)")
63 ;
64 ; Send alert that original message had error.
65 I LA7MSTAT'="AA",LA7MSTAT'="CA" D
66 . D CREATE^LA7LOG(48)
67 ;
68 ; Retrieve original message's type.
69 S LA7MTYPE=$P(LA76249(100),"^",9)
70 ;
71 ; If original message was an ORM, then update collecting facility's shipping manifest.
72 I LA7MTYPE="ORM" D Q
73 . ; Need to code this section - JMC 1/12/00
74 . ; Need to figure out the shipping manifest which is being acknowledged
75 . Q
76 ;
77 I LA7MTYPE'="ORU" Q
78 ; Rest of this deals with updating order/test status in LAB PENDING ORDER file
79 ; at host lab when collection facility is acknowledging receipt of ORU message.
80 ;
81 I LA76249(63)="" Q
82 S LA7SITE=$P(LA76249(63),U,2),LA7RUID=$P(LA76249(63),U,3)
83 S LA7696=$O(^LRO(69.6,"RST",LA7SITE,LA7RUID,0))
84 I LA7696="" Q
85 ;
86 ; Update order status in 69.6
87 S FDA(2,69.6,LA7696_",",6)=LA7ST
88 D FILE^DIE("","FDA(2)","LA7ERR(2)")
89 ;
90 S LA7ORT=$P(LA76249(63),U,4),LA76964=0
91 I LA7ORT'="" S LA76964=$O(^LRO(69.6,LA7696,2,"B",LA7ORT,0))
92 I 'LA76964 D
93 . S LA7ORT=$P(LA76249(63),U,5)
94 . I LA7ORT'="" S LA76964=$O(^LRO(69.6,LA7696,2,"C",LA7ORT,0))
95 I LA76964<1 Q
96 ;
97 ; Update test status in 69.6
98 S FDA(3,69.64,LA76964_","_LA7696_",",5)=LA7ST
99 D FILE^DIE("","FDA(3)","LA7ERR(3)")
100 ;
101 Q
Note: See TracBrowser for help on using the repository browser.