source: FOIAVistA/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGROHLS.m@ 1800

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

initial load of FOIAVistA 6/30/08 version

File size: 3.9 KB
Line 
1DGROHLS ;DJH/AMA - ROM HL7 SEND DRIVERS ; 27 Apr 2004 5:16 PM
2 ;;5.3;Registration;**533,572**;Aug 13, 1993
3 ;
4SNDACK(DGACKTYP,DGMIEN,DGHL,DGSEGERR,DGSTOERR) ;Send ACK Message Type (ACK~R01)
5 ;This procedure assumes that the VistA HL7 environment is providing the
6 ;environment variables and will produce a fatal error if they are missing.
7 ;
8 ; Input:
9 ; DGACKTYP - (required) ACK message type ("AA","AE")
10 ; DGMIEN - (required) IEN of message entry in file #773
11 ; DGHL - (required) HL7 environment array
12 ; DGSEGERR - (optional) Errors found during parsing
13 ; DGSTOERR - (optional) Errors during data storage
14 ;
15 ; Output:
16 ; none
17 ;
18 N DGHLROOT,DGHLERR
19 ;
20 Q:($G(DGACKTYP)']"")
21 Q:('+$G(DGMIEN))
22 ;
23 S DGHLROOT=$NA(^TMP("HLA",$J))
24 K @DGHLROOT
25 ;
26 ;build ACK segments array
27 I $$BLDACK^DGROHLU4(DGACKTYP,DGHLROOT,.DGHL,.DGSEGERR,.DGSTOERR) D
28 . ;
29 . ;generate the message
30 . D GENACK^HLMA1(DGHL("EID"),DGMIEN,DGHL("EIDS"),"GM",1,.DGHLERR)
31 ;
32 ;cleanup
33 K @DGHLROOT
34 Q
35 ;
36SNDQRY(DGDFN) ;Send QRY Message Types (QRY~R02)
37 ;
38 ; Input:
39 ; DGDFN - (required) pointer to patient in PATIENT (#2) file
40 ;
41 ; Output:
42 ; Function value - 1 on success, 0 on failure
43 ;
44 ; Use of the API $$GET^XUESSO1() supported by DBIA # 4342
45 ;
46 N DGLST,DGHLROOT,DGHLLNK,DGHL,DGUSER,DGICN,DGMSG,DGRSLT,HLL,HLEID,HLRSLT
47 ;
48 ;the following HL* variables are created by DIRECT^HLMA
49 N HL,HLCS,HLDOM,HLECH,HLFS,HLINST,HLINSTN,HLQ,ACKCODE
50 N HLMTIEN,HLNEXT,HLNODE,HLPARAM,HLPROD,HLQUIT
51 ;
52 S DGRSLT=0
53 S DGHLROOT=$NA(^TMP("HLS",$J))
54 K @DGHLROOT
55 ;
56 I +$G(DGDFN)>0,$D(^DPT(DGDFN,0)) D
57 . ;
58 . ;ICN must be national and LST must not be local site
59 . Q:'$$MPIOK^DGROUT(DGDFN,.DGICN,.DGLST)
60 . ;
61 . ;retrieve LST's HL Logical Link and build HLL array
62 . S DGHLLNK=$$GETLINK^DGROHLUT(DGLST)
63 . Q:(DGHLLNK=0)
64 . S HLL("LINKS",1)="DGRO ROM ORF/R04 SUBSC"_U_DGHLLNK
65 . ;
66 . ;initialize VistA HL7 environment
67 . S HLEID=$$INIT^DGROHLUT("DGRO ROM QRY/R02 EVENT",.DGHL)
68 . Q:'HLEID
69 . ;
70 . ;retrieve user info ;DG*5.3*572
71 . S DGUSER=$$GET^XUESSO1()
72 . I +DGUSER<0 D Q
73 . . ;display error message to interactive users
74 . . S DGMSG(1)=" "
75 . . S DGMSG(2)="The query to the LST has been terminated due to insufficient user data"
76 . . D EN^DDIOL(.DGMSG)
77 . S DGUSER=$P(DGUSER,U,1,2)_U_$P(DGUSER,U,5,6)
78 . S DGUSER=$TR(DGUSER,U,"~")
79 . ;
80 . ;build QRY segments array
81 . Q:'$$BLDQRY^DGROHLQ(DGDFN,DGICN,DGHLROOT,.DGHL,DGUSER)
82 . ;
83 . ;display busy message to interactive users
84 . S DGMSG(1)=" "
85 . S DGMSG(2)="Attempting to connect to the Last Site of Treatment ("_$G(DGLST)_") to search for Patient"
86 . S DGMSG(3)="Demographic Data. This request may take some time, please be patient ..."
87 . D EN^DDIOL(.DGMSG)
88 . ;
89 . ;generate HL7 message
90 . D DIRECT^HLMA(HLEID,"GM",1,.HLRSLT,"","")
91 . Q:$P(HLRSLT,U,2)]""
92 . I HLMTIEN N DGROVRCK S DGROVRCK=1 D RCV^DGROHLR
93 . I ($D(DGROVRCK)),(DGROVRCK=0) K DGROVRCK QUIT
94 . Q:$G(ACKCODE)
95 . ;success
96 . S DGRSLT=1
97 ;
98 ;cleanup
99 K @DGHLROOT
100 Q DGRSLT
101 ;
102SNDORF(DGQRY,DGMIEN,DGHL,DGDFN,DGSEGERR,DGQRYERR) ;Send ORF Message Type (ORF~R04)
103 ;This procedure assumes the the VistA HL7 environment is providing the
104 ;environment variables and will produce a fatal error if they are
105 ;missing. (Called from RCVQRY^DGROHLR)
106 ;
107 ; Input:
108 ; DGQRY - (required) Array of QRY parsing results
109 ; DGMIEN - (required) IEN of message entry in file #773
110 ; DGHL - (required) HL7 environment array
111 ; DGDFN - (required) Pointer to patient in PATIENT (#2) file
112 ; DGSEGERR - (optional) Errors found during parsing
113 ; DGQRYERR - (optional) Errors found during query
114 ;
115 ; Output:
116 ; none
117 ;
118 N DGHLROOT
119 N DGHLERR
120 ;
121 Q:('$D(DGQRY))
122 Q:('+$G(DGMIEN))
123 Q:($TR(DGQRY("USER"),"~",U)']"")
124 ;
125 S DGHLROOT=$NA(^TMP("HLA",$J)) K @DGHLROOT
126 ;
127 ;build ORF segments array
128 I $$BLDORF^DGROHLQ(DGHLROOT,.DGHL,DGDFN,.DGQRY,.DGSEGERR,.DGQRYERR) D
129 . ;
130 . ;generate the message
131 . D GENACK^HLMA1(DGHL("EID"),DGMIEN,DGHL("EIDS"),"GM",1,.DGHLERR)
132 ;
133 ;cleanup
134 K @DGHLROOT
135 Q
Note: See TracBrowser for help on using the repository browser.