source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SCMCHLA.m@ 1590

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

initial load of FOIAVistA 6/30/08 version

File size: 6.3 KB
Line 
1SCMCHLA ;ALB/KCL - PCMM HL7 Transmission Log File API'S ;25-JAN-2000
2 ;;5.3;Scheduling;**210,272**;AUG 13, 1993
3 ;
4LOCK(SCTLIEN) ; Description: Used to lock a record in the PCMM HL7
5 ; TANSMISSION LOG file.
6 ;
7 ; Input:
8 ; SCTLIEN - ien of a record in the PCMM HL7 TRANSMISSION LOG file
9 ;
10 ; Output:
11 ; Function Value: Returns 1 on success, 0 on faliure
12 ;
13 I $G(SCTLIEN) L +^SCPT(404.471,SCTLIEN):3
14 ;
15 Q $T
16 ;
17 ;
18UNLOCK(SCTLIEN) ; Description: Used to unlock a record in the PCMM HL7
19 ; TANSMISSION LOG file.
20 ;
21 ; Input:
22 ; SCTLIEN - ien of a record in the PCMM HL7 TRANSMISSION LOG file
23 ;
24 ; Output: None
25 ;
26 I $G(SCTLIEN) L -^SCPT(404.471,SCTLIEN)
27 Q
28 ;
29 ;
30GETLOG(SCTLIEN,SCECIEN,TLOG) ;
31 ; Description: Used to obtain a record in the PCMM HL7 TRANSMISSION LOG
32 ; file and a record in the Error Code subfile. The field values will
33 ; be returned in the TLOG array.
34 ;
35 ; Input:
36 ; SCTLIEN - ien of a record in the PCMM HL7 TRANSMISSION LOG file
37 ; SCECIEN - ien of record in the Error Code subfile
38 ;
39 ; Output:
40 ; Function Value: Returns 1 on success, 0 on faliure
41 ; TLOG - this is the name of a local array, it should be passed by
42 ; reference. If the function is successful the array will
43 ; contain the PCMM HL7 TRANSMISSION LOG record and the
44 ; Error Code subfile record.
45 ;
46 ; subscript field name
47 ; --------- ----------
48 ; "MSGID" Message Control ID
49 ; "DFN" Patient
50 ; "TRANS" Transmission Date/Time
51 ; "STATUS" Status
52 ; "ACK DT/TM" ACK Received Date/Time
53 ;
54 ; Error Code subfile record:
55 ; "ERR","CODE" Error Code
56 ; "ERR","SEG" Segment
57 ; "ERR","SEQ" Sequence
58 ; "ERR","ZPCID" ZPC ID
59 ; "ERR","EPS" Error Processing Status
60 ;
61 N NODE
62 K TLOG S TLOG=""
63 Q:'$G(SCTLIEN) 0
64 ;
65 S NODE=$G(^SCPT(404.471,SCTLIEN,0))
66 Q:(NODE="") 0
67 S TLOG("MSGID")=$P(NODE,"^")
68 S TLOG("DFN")=$P(NODE,"^",2)
69 S TLOG("TRANS")=$P(NODE,"^",3)
70 S TLOG("STATUS")=$P(NODE,"^",4)
71 S TLOG("ACK DT/TM")=$P(NODE,"^",5)
72 S TLOG("WORK")=$P(NODE,"^",7)
73 ;
74 S TLOG("ERR")=""
75 I $G(SCECIEN) D
76 .S NODE=$G(^SCPT(404.471,SCTLIEN,"ERR",SCECIEN,0))
77 .S TLOG("ERR","CODE")=$P(NODE,"^")
78 .S TLOG("ERR","SEG")=$P(NODE,"^",2)
79 .S TLOG("ERR","SEQ")=$P(NODE,"^",3)
80 .S TLOG("ERR","ZPCID")=$P(NODE,"^",5)
81 .S TLOG("ERR","EPS")=$P(NODE,"^",6)
82 ;
83 Q 1
84 ;
85 ;
86STATUS(SCTLIEN) ;
87 ; Description: Used to get STATUS field for record in PCMM HL7
88 ; TRANSMISSION LOG file.
89 ;
90 ; Input:
91 ; SCTLIEN - IEN of PCM HL7 TRANSMISSION LOG file
92 ;
93 ; Output:
94 ; Funtion Value: Returns STATUS field value, null otherwise.
95 ;
96 Q:'$G(SCTLIEN) ""
97 Q $P($G(^SCPT(404.471,SCTLIEN,0)),"^",4)
98 ;
99 ;
100UPDSTAT(SCTLIEN,STATUS,ERROR) ;
101 ; Description: Used to update the STATUS field of record in PCMM HL7
102 ; TRANSMISSION LOG file.
103 ;
104 ; Input:
105 ; SCTLIEN - IEN of PCM HL7 TRANSMISSION LOG file
106 ; STATUS - T=Transmitted, A=Accepted, RJ=Rejected,
107 ; M=Marked for re-transmission, RT=Re-transmitted
108 ;
109 ; Output:
110 ; Funtion Value: Returns 1 on success, 0 on failure.
111 ; ERROR - returns error message on failure, pass by reference
112 ;
113 N SCERR,SCFDA,SCIENS
114 ;
115 S ERROR=""
116 ;
117 I '$G(SCTLIEN) S ERROR="NO RECORD SPECIFIED" Q 0
118 I '$$LOCK(SCTLIEN) S ERROR="UNABLE TO OBTAIN LOCK ON RECORD" Q 0
119 I ",T,A,RJ,M,RT,"'[(","_$G(STATUS)_",") S ERROR="INVALID STATUS" Q 0
120 ;
121 S SCIENS=SCTLIEN_","
122 S SCFDA(404.471,SCIENS,.04)=STATUS ; Status
123 D FILE^DIE("","SCFDA","SCERR")
124 ;
125 D UNLOCK(SCTLIEN)
126 ;
127 ; if error returned from DBS call, unable to file data
128 I $G(SCERR) S ERROR="UNABLE TO UPDATE STATUS FIELD" Q 0
129 ;
130 Q 1
131 ;
132 ;
133INCLUDE(SCTLIEN) ;
134 ; Description: Used to get INCLUDED IN REJECT BULLETIN? field for
135 ; record in PCMM HL7 TRANSMISSION LOG file.
136 ;
137 ; Input:
138 ; SCTLIEN - IEN of PCM HL7 TRANSMISSION LOG file
139 ;
140 ; Output:
141 ; Funtion Value: Returns INCLUDED IN REJECT BULLETIN? field value, null otherwise.
142 ;
143 Q:'$G(SCTLIEN) ""
144 Q $P($G(^SCPT(404.471,SCTLIEN,0)),"^",6)
145 ;
146 ;
147UPDINCL(SCTLIEN,SCINCL,ERROR) ;
148 ; Description: Used to update the INCLUDED IN REJECT BULLETIN? field of
149 ; record in the PCMM HL7 TRANSMISSION LOG file.
150 ;
151 ; Input:
152 ; SCTLIEN - IEN of record in PCMM HL7 TRANSMISSION LOG file
153 ; SCINCL - 'Y'=YES
154 ;
155 ; Output:
156 ; Funtion Value: Returns 1 on success, 0 on failure.
157 ; ERROR - returns error message on failure, pass by reference
158 ;
159 N SCERR,SCFDA,SCIENS
160 ;
161 S ERROR=""
162 ;
163 I '$G(SCTLIEN) S ERROR="NO RECORD SPECIFIED" Q 0
164 I $G(SCINCL)'="Y" S ERROR="INVALID FIELD VALUE" Q 0
165 I '$$LOCK(SCTLIEN) S ERROR="UNABLE TO OBTAIN LOCK ON RECORD" Q 0
166 ;
167 S SCIENS=SCTLIEN_","
168 S SCFDA(404.471,SCIENS,.06)=SCINCL ; Included In Reject Bulletin?
169 D FILE^DIE("","SCFDA","SCERR")
170 ;
171 D UNLOCK(SCTLIEN)
172 ;
173 ; if error returned from DBS call, unable to file data
174 I $G(SCERR) S ERROR="UNABLE TO UPDATE 'INCLUDED IN REJECT BULLETIN?' FIELD" Q 0
175 ;
176 Q 1
177 ;
178 ;
179ACK(SCTLIEN) ;
180 ; Description: Used to get ACK RECEIVED DATE/TIME field for
181 ; record in PCMM HL7 TRANSMISSION LOG file.
182 ;
183 ; Input:
184 ; SCTLIEN - IEN of PCM HL7 TRANSMISSION LOG file
185 ;
186 ; Output:
187 ; Funtion Value: Returns ACK RECEIVED DATE/TIME field value, 0 otherwise.
188 ;
189 Q:'$G(SCTLIEN) 0
190 Q $P($G(^SCPT(404.471,SCTLIEN,0)),"^",5)
191 ;
192 ;
193UPDEPS(SCTLIEN,SCERIEN,EPSTAT,ERROR) ;
194 ; Description: Used to update the ERROR PROCESSING STATUS field of
195 ; record in the Error Code (#404.47142) subfile.
196 ;
197 ; Input:
198 ; SCTLIEN - IEN of record in PCMM HL7 TRANSMISSION LOG file
199 ; SCERIEN - IEN record in ERROR CODE (#404.47142) subfile
200 ; EPSTAT - 1=NEW, 2=CHECKED
201 ;
202 ; Output:
203 ; Funtion Value: Returns 1 on success, 0 on failure.
204 ; ERROR - returns error message on failure, pass by reference
205 ;
206 N SCERR,SCFDA,SCIENS,STATUS
207 ;
208 S ERROR=""
209 ;
210 I '$G(SCTLIEN) S ERROR="NO RECORD SPECIFIED" Q 0
211 I '$G(SCERIEN) S ERROR="NO SUB-RECORD SPECIFIED" Q 0
212 I '$G(EPSTAT) S ERROR="INVALID ERROR PROCESSING STATUS" Q 0
213 S STATUS=$$STATUS(SCTLIEN)
214 I (STATUS'="RJ")&(STATUS'="M") S ERROR="STATUS IS NOT 'REJECTED' OR 'MARKED FOR RE-TRANSMIT'" Q 0
215 I '$$LOCK(SCTLIEN) S ERROR="UNABLE TO OBTAIN LOCK ON RECORD" Q 0
216 ;
217 S SCIENS=SCERIEN_","_SCTLIEN_","
218 S SCFDA(404.47142,SCIENS,.06)=EPSTAT ; Error Processing Status
219 D FILE^DIE("","SCFDA","SCERR")
220 ;
221 D UNLOCK(SCTLIEN)
222 ;
223 ; if error returned from DBS call, unable to file data
224 I $G(SCERR) S ERROR="UNABLE TO UPDATE STATUS FIELD" Q 0
225 ;
226 Q 1
Note: See TracBrowser for help on using the repository browser.