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

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

initial load of WorldVistAEHR

File size: 4.3 KB
RevLine 
[613]1DGQEHLL ;ALB/RPM - VIC REPLACEMENT VIC HL7 TRAN LOG FILE ACCESS API'S ; 12/09/03
2 ;;5.3;Registration;**571**;Aug 13, 1993
3 ;
4 ; This routine contains the functions and procedures used to access
5 ; and manipulate the VIC HL7 TRANSMISSION LOG (#39.7) file.
6 ;
7 ; $$FINDMID - locate transmission record for a given HL7 message ID
8 ; $$FINDLST - locate last transmission record for a given request
9 ; $$GETLOG - retrieve a single VIC HL7 TRANSMISSION LOG record
10 ; STOXMIT - store a new VIC HL7 TRANSMISSION LOG record
11 ; STOACK - store acknowledgment status and date
12 ; $$DELXMIT - delete a single VIC HL7 TRANSMISSION LOG record
13 ;
14 Q ;no direct entry
15 ;
16FINDMID(DGMID) ;locate record for a given HL7 message ID
17 ; This function performs a lookup of the VIC HL7 TRANSMISSION LOG
18 ; (#39.7) file for a given HL7 Message ID.
19 ;
20 ; Input:
21 ; DGMID - HL7 message ID
22 ;
23 ; Output:
24 ; Function value - IEN of VIC HL7 TRANSMISSION LOG (#39.7) on success;
25 ; 0 on failure
26 ;
27 S DGMID=+$G(DGMID)
28 Q +$O(^DGQE(39.7,"B",DGMID,""))
29 ;
30 ;
31FINDLST(DGREQ) ;locate the last transmission record for a given request
32 ;
33 ; Input:
34 ; DGIEN - pointer to VIC REQUEST (#39.6) file
35 ;
36 ; Output:
37 ; Function value - IEN of VIC HL7 TRANSMISSION LOG (#39.7) on success,
38 ; 0 on failure
39 ;
40 N DGDAT
41 ;
42 S DGDAT=+$O(^DGQE(39.7,"ADATE",DGREQ,""),-1)
43 Q +$O(^DGQE(39.7,"ADATE",DGREQ,DGDAT,0))
44 ;
45 ;
46GETLOG(DGIEN,DGLOG) ;retrieve a single record
47 ; This function retrieves all fields belonging to a single record
48 ; in the VIC HL7 TRANSMISSION LOG (#39.7) file for a given IEN.
49 ; The field data is placed in an array format.
50 ;
51 ; Input:
52 ; DGIEN - VIC HL7 TRANSMISSION LOG (#39.7) file record number
53 ;
54 ; Output:
55 ; Function value - 1 on success, 0 on failure
56 ; DGLOG - array of field data
57 ; Array subscripts are:
58 ; "HLMID" - HL7 Message ID
59 ; "REQIEN" - pointer to request in VIC REQUEST (#39.6) file
60 ; "XMITDT" - HL7 Transmission date/time
61 ; "XMSTAT" - Transmission status
62 ; "ACKDT" - ACK received date/time
63 ;
64 N DGERR ;FM result error message
65 N DGFIL ;FM file number
66 N DGFLD ;FM result field array
67 N DGIENS ;FM IENS value
68 N DGRSLT ;function value
69 ;
70 S DGRSLT=0
71 S DGFIL=39.7
72 ;
73 I $G(DGIEN),$D(^DGQE(DGFIL,DGIEN)) D
74 . S DGIENS=DGIEN_","
75 . D GETS^DIQ(DGFIL,DGIENS,"*","I","DGFLD","DGERR")
76 . Q:$D(DGERR)
77 . S DGLOG("HLMID")=$G(DGFLD(DGFIL,DGIENS,.01,"I"))
78 . S DGLOG("REQIEN")=$G(DGFLD(DGFIL,DGIENS,.02,"I"))
79 . S DGLOG("XMITDT")=$G(DGFLD(DGFIL,DGIENS,.03,"I"))
80 . S DGLOG("XMSTAT")=$G(DGFLD(DGFIL,DGIENS,.04,"I"))
81 . S DGLOG("ACKDT")=$G(DGFLD(DGFIL,DGIENS,.05,"I"))
82 . S DGRSLT=1 ;success
83 ;
84 Q DGRSLT
85 ;
86 ;
87STOXMIT(DGMID,DGRIEN) ;create a transmit record
88 ; This procedure creates a record in the VIC HL7 TRANSMISSION LOG
89 ; (#39.7) file.
90 ;
91 ; Input:
92 ; DGMID - HL7 Message Control ID
93 ; DGRIEN - IEN of record in VIC REQUEST (#39.6) file
94 ;
95 ; Output:
96 ; none
97 ;
98 N DGERR
99 N DGFDA
100 N DGFIL
101 N DGIEN
102 N DGIENS
103 ;
104 ;validate input params
105 Q:$G(DGMID)'>0
106 Q:'$G(DGRIEN)
107 Q:'$D(^DGQE(39.6,DGRIEN))
108 ;
109 S DGFIL=39.7
110 S DGIEN=$$FINDMID(DGMID)
111 S DGIENS=$S('DGIEN:"+1,",1:DGIEN_",")
112 ;
113 S DGFDA(DGFIL,DGIENS,.01)=DGMID
114 S DGFDA(DGFIL,DGIENS,.02)=DGRIEN
115 S DGFDA(DGFIL,DGIENS,.03)=$$NOW^XLFDT()
116 S DGFDA(DGFIL,DGIENS,.04)="T" ;transmitted
117 D UPDATE^DIE("","DGFDA","","DGERR")
118 ;
119 Q
120 ;
121 ;
122STOACK(DGIEN,DGSTAT) ;update STATUS
123 ; This procedure updates the STATUS (#.04) field of the VIC HL7
124 ; TRANSMISSION LOG (#39.7) file
125 ;
126 ; Input:
127 ; DGIEN - IEN of record in VIC HL7 TRANSMISSION LOG (#39.7) file
128 ; DGSTAT - transmission status ("A":Accepted,"RJ":Rejected)
129 ;
130 ; Output:
131 ; none
132 ;
133 N DGERR
134 N DGFDA
135 N DGIENS
136 ;
137 ;validate input params
138 Q:'$G(DGIEN)
139 Q:$G(DGSTAT)']""
140 Q:$$EXTERNAL^DILFD(39.7,.04,"F",DGSTAT,"")']""
141 ;
142 S DGIENS=DGIEN_","
143 S DGFDA(39.7,DGIENS,.04)=DGSTAT
144 S DGFDA(39.7,DGIENS,.05)=$$NOW^XLFDT()
145 D FILE^DIE("","DGFDA","DGERR")
146 Q
147 ;
148 ;
149DELXMIT(DGIEN) ;delete a single VIC HL7 TRANSMISSION LOG record
150 ;
151 ; Input:
152 ; DGIEN - IEN of record in VIC HL7 TRANSMISSION LOG (#39.7) file
153 ;
154 ; Output:
155 ; Function value - 1 on success, 0 on failure
156 ;
157 N DGERR
158 N DGFDA
159 N DGRSLT ;function value
160 ;
161 S DGRSLT=0
162 I $G(DGIEN) D
163 . S DGFDA(39.7,DGIEN_",",.01)="@"
164 . D FILE^DIE("","DGFDA","DGERR")
165 . Q:$D(DGERR)
166 . S DGRSLT=1 ;success
167 ;
168 Q DGRSLT
Note: See TracBrowser for help on using the repository browser.