source: WorldVistAEHR/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LA7POC.m@ 701

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

initial load of WorldVistAEHR

File size: 3.8 KB
Line 
1LA7POC ;DALOI/JMC - Lab HL7 Point of Care; Jan 12, 2004
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**67**;Sep 27, 1994
3 ;
4 ; Reference to HLL("SET FOR APP ACK") supported by DBIA #TBD
5 Q
6 ;
7RTRA ; Setup links and subscriber array for HL7 ADT message generation
8 ; for those LA7POC* entries in file #62.48 which indicate they want to
9 ; subscribe to ADT messages. Interface types POCA in file #62.48
10 ; will be subscribers to VistA HL7 ADT messages.
11 ;
12 ; Called by subscriber protocol LA7POC ADT RTR which functions as a
13 ; router.
14 ;
15 N LA76248,LA7Y
16 ;
17 ; Check entries with root 'LA7POC" as name and interface type POCA (21)
18 ; to subscribe to ADT message feed from VistA.
19 S LA76248=0
20 F S LA76248=$O(^LAHM(62.48,LA76248)) Q:'LA76248 D
21 . S LA76248(0)=$G(^LAHM(62.48,LA76248,0)),LA7Y=$P(LA76248(0),"^")
22 . I $E(LA7Y,1,6)'="LA7POC" Q
23 . I $P(LA76248(0),"^",3)'=1 Q ; Inactive status
24 . I $P(LA76248(0),"^",9)'=21 Q
25 . S HLL("LINKS",LA76248)=LA7Y_" ADT SUBS^"_LA7Y_"A"
26 Q
27 ;
28 ;
29ACK(LA7) ; Returns the application acknowledgement to the sending POC
30 ; application. Indicates any error encountered in processing the POC
31 ; results. Setup link for HL7 ACK message generation for LA7POC* entries
32 ; in file #62.48 when POC ORU message has been processed in VistA.
33 ;
34 ; Called by routine LA7VPOC
35 ;
36 ; Call with LA7 array passed by reference
37 ; LA7(62.48)=ien of related configuration in file #62.48
38 ; LA7(62.49)=ien of message in file #62.49 being acknowledged
39 ; LA7("ACK")=acknowledgment status (AA, AE, AR)
40 ; LA7("MSG")=text of error message to be returned
41 ;
42 N HL,HLMTIENS,LA6249,LA76248,LA7X,LA7Y
43 ;
44 ; Check for entry in 62.48
45 S LA76248=+$G(LA7(62.48))
46 I '$G(LA76248)!('$D(^LAHM(62.48,LA76248,0))) Q
47 S LA76248(0)=$G(^LAHM(62.48,LA7(62.48),0)),LA7X=$P(LA76248(0),"^")
48 ;
49 ; Check for entry in 62.49
50 S LA6249=+$G(LA7(62.49))
51 I '$G(LA6249)!('$D(^LAHM(62.49,LA6249,0))) Q
52 F I=0,700 S LA6249(I)=$G(^LAHM(62.49,LA6249,I))
53 ;
54 ; Call reprocess message to build and send ACK and clear purge flag
55 S LA7Y=$$REPROC^HLUTIL($P(LA6249(700),";",2),"D BLDACK^LA7POC")
56 I LA7Y=0 S HLMTIENS=$P(LA6249(700),";",2),LA7X=$$TOPURG^HLUTIL()
57 ;
58 Q
59 ;
60 ;
61BLDACK ; Create/initialize HL ACK message
62 ;
63 N GBL,HLL,HLP,I,X
64 N LA76249,LA7AERR,LA7DATA,LA7ECH,LA7FS,LA7ID,LA7MID,LA7MSA,LA7MSH,LA7X,LA7Y
65 ;
66 ; No application acknowledgement
67 I HL("APAT")="NE" Q
68 ;
69 ; Other system only wants ACK on successful completion condition and we found an error.
70 I LA7("ACK")'="AA",HL("APAT")="SU" Q
71 ;
72 ; Other system only wants ACK on error/reject condition
73 I LA7("ACK")="AA",HL("APAT")="ER" Q
74 ;
75 S GBL="^TMP(""HLA"","_$J_")"
76 K @GBL
77 S LA76249=$$INIT6249^LA7VHLU
78 D RSPINIT^HLFNC2(HL("EIDS"),.HL)
79 S LA7FS=HL("RFS"),LA7ECH=HL("RECH")
80 ;
81 ; Build pseudo MSH for file #62.49 entry
82 S LA7MSH(0)="MSH",LA7MSH(1)=LA7ECH,LA7MSH(2)=HL("RAN"),LA7MSH(3)=HL("RAF"),LA7MSH(4)=HL("SAN"),LA7MSH(5)=HL("SAF")
83 S LA7MSH(9)=HL("RMTN")_$E(LA7ECH,1)_HL("RETN"),LA7MSH(11)=HL("PID"),LA7MSH(12)=HL("VER")
84 S LA7MSH(15)="AL",LA7MSH(16)="NE"
85 D BUILDSEG^LA7VHLU(.LA7MSH,.LA7DATA,LA7FS)
86 D FILE6249^LA7VHLU(LA76249,.LA7DATA)
87 ;
88 ; Build and file MSA segment
89 K LA7DATA
90 S LA7MSA(0)="MSA",LA7MSA(1)=LA7("ACK"),LA7MSA(2)=HL("MID")
91 I $G(LA7("MSG"))'="" D
92 . S LA7MSA(3)=$$CHKDATA^LA7VHLU3($P(LA7("MSG"),"^"),LA7FS_LA7ECH)
93 . I $P(LA7("MSG"),"^",2)="" Q
94 . S $P(LA7MSA(3),$E(LA7ECH),2)=$$CHKDATA^LA7VHLU3($P(LA7("MSG"),"^",2),LA7FS_LA7ECH)
95 S LA7ID=$P(LA76248(0),"^",1)_"-O-ACK-"_LA7MSA(2)
96 D BUILDSEG^LA7VHLU(.LA7MSA,.LA7DATA,LA7FS)
97 D FILESEG^LA7VHLU(GBL,.LA7DATA)
98 D FILE6249^LA7VHLU(LA76249,.LA7DATA)
99 ;
100 ; Send the HL7 message.
101 S HLL("SET FOR APP ACK")=1
102 S HLL("LINKS",1)=HL("EIDS")_"^"_$P(LA76248(0),"^")
103 S HLP("NAMESPACE")="LA"
104 D GENACK^HLMA1(HL("EID"),HLMTIENS,HL("EIDS"),"GM",1,.LA7MID,"",.HLP)
105 ;
106 S HL("MTN")=HL("RMTN"),HL("SAN")=HL("RAN"),HL("SAF")=HL("RAF"),HL("APAT")=""
107 D UPDT6249^LA7VORM1
108 L -^LAHM(62.49,LA76249)
109 Q
Note: See TracBrowser for help on using the repository browser.