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

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

initial load of WorldVistAEHR

File size: 7.4 KB
RevLine 
[613]1DGNTAPI ;ALB/RPM - API's for N/T Radium Treatments ; 8/24/01 3:49pm
2 ;;5.3;Registration;**397,423**;Aug 13, 1993
3 Q
4 ;
5 ;
6GETPRIM(DFN) ; Used to get the patient's primary record in the (#28.11) file.
7 ;
8 ; Input:
9 ; DFN - IEN of patient in the PATIENT (#2) file
10 ;
11 ; Output:
12 ; Function Value - If successful, returns IEN of record in (#28.11) file, otherwise returns null on failure.
13 ;
14 Q:'$G(DFN) ""
15 Q $O(^DGNT(28.11,"APR",DFN,1,0))
16 ;
17 ;
18GETREC(DGIEN,DGNTAPA) ; Used to obtain a record in the (#28.11) file.
19 ;
20 ; Input:
21 ; DGIEN - IEN of record in the (#28.11) file
22 ; DGNTAPA - Array name of return values [Optional - Default DGNTARR]
23 ;
24 ; Output:
25 ; Function Value: Returns 1 on success, 0 on failure.
26 ; DGNTAPA() array, passed by reference. If the function is successful
27 ; this array will contain the record.
28 ;
29 ; subscript field name
30 ; --------- ----------
31 ; "DFN" Patient
32 ; "IND" NTR Indicator - internal^external
33 ; "STAT" Screening Status - internal^external
34 ; "NTR" NTR Treatment - internal^external
35 ; "AVI" Military Aviator Pre 1/31/1955 - internal^external
36 ; "SUB" Submarine Training Pre 1/1/65 - internal^external
37 ; "EDT" Date/Time NTR Entered
38 ; "EUSR" NTR Entered By
39 ; "PRIM" NTR Primary Entry
40 ; "SUPER" Date/Time Superseded
41 ; "VER" Verification Method - internal^external
42 ; "VDT" Date/Time Verified
43 ; "VUSR" Verified By
44 ; "VSIT" Site Verifying Documentation
45 ; "HNC" Head/Neck CA DX - internal^external
46 ; "HDT" Date/Time DX Verified
47 ; "HUSR" DX Verified By
48 ; "HSIT" Site Verifying DX
49 ;
50 N DGFDA,DGMSG
51 ;
52 I '$G(DGIEN) Q 0
53 I '$D(^DGNT(28.11,DGIEN,0)) Q 0
54 ;
55 S DGNTAPA=$G(DGNTAPA)
56 I DGNTAPA']"" S DGNTAPA="DGNTARR"
57 ;
58 ; Obtain record
59 D GETS^DIQ(28.11,DGIEN_",","*","IE","DGFDA","DGMSG")
60 S @DGNTAPA@("DFN")=$G(DGFDA(28.11,+DGIEN_",",.01,"I"))
61 S @DGNTAPA@("IND")=$G(DGFDA(28.11,+DGIEN_",",.02,"I"))_"^"_$G(DGFDA(28.11,+DGIEN_",",.02,"E"))
62 S @DGNTAPA@("STAT")=$G(DGFDA(28.11,+DGIEN_",",.03,"I"))_"^"_$G(DGFDA(28.11,+DGIEN_",",.03,"E"))
63 S @DGNTAPA@("NTR")=$G(DGFDA(28.11,+DGIEN_",",.04,"I"))_"^"_$G(DGFDA(28.11,+DGIEN_",",.04,"E"))
64 S @DGNTAPA@("AVI")=$G(DGFDA(28.11,+DGIEN_",",.05,"I"))_"^"_$G(DGFDA(28.11,+DGIEN_",",.05,"E"))
65 S @DGNTAPA@("SUB")=$G(DGFDA(28.11,+DGIEN_",",.06,"I"))_"^"_$G(DGFDA(28.11,+DGIEN_",",.06,"E"))
66 S @DGNTAPA@("EDT")=$G(DGFDA(28.11,+DGIEN_",",.07,"I"))
67 S @DGNTAPA@("EUSR")=$G(DGFDA(28.11,+DGIEN_",",.08,"I"))
68 S @DGNTAPA@("PRIM")=$G(DGFDA(28.11,+DGIEN_",",.09,"I"))
69 S @DGNTAPA@("SUPER")=$G(DGFDA(28.11,+DGIEN_",",.1,"I"))
70 S @DGNTAPA@("VER")=$G(DGFDA(28.11,+DGIEN_",",1.01,"I"))_"^"_$G(DGFDA(28.11,+DGIEN_",",1.01,"E"))
71 S @DGNTAPA@("VDT")=$G(DGFDA(28.11,+DGIEN_",",1.02,"I"))
72 S @DGNTAPA@("VUSR")=$G(DGFDA(28.11,+DGIEN_",",1.03,"I"))
73 S @DGNTAPA@("VSIT")=$G(DGFDA(28.11,+DGIEN_",",1.04,"I"))
74 S @DGNTAPA@("HNC")=$G(DGFDA(28.11,+DGIEN_",",2.01,"I"))_"^"_$G(DGFDA(28.11,+DGIEN_",",2.01,"E"))
75 S @DGNTAPA@("HDT")=$G(DGFDA(28.11,+DGIEN_",",2.02,"I"))
76 S @DGNTAPA@("HUSR")=$G(DGFDA(28.11,+DGIEN_",",2.03,"I"))
77 S @DGNTAPA@("HSIT")=$G(DGFDA(28.11,+DGIEN_",",2.04,"I"))
78 ;
79 Q 1
80 ;
81GETCUR(DGDFN,DGNTAPIA) ; Retrieve current record
82 ;This is a supported API (DBIA #3457)
83 ; Input:
84 ; DGDFN - IEN of patient in the PATIENT (#2) file
85 ; DGNTAPIA - Array name of return values [Optional - Default DGNTARR]
86 ;
87 ; Output:
88 ; function result - IEN of current NTR HISTORY file (#28.11) record.
89 ; DGNTAPIA - Array of current NTR HISTORY file record field values.
90 ; See $$GETREC for documentation.
91 ; The node, "INTRP", a calculated free text intrepretation
92 ; is added to the array.
93 ;
94 N DGIEN
95 ;
96 I '$G(DGDFN) Q 0
97 ;
98 S DGNTAPIA=$G(DGNTAPIA)
99 I DGNTAPIA']"" S DGNTAPIA="DGNTARR"
100 ;
101 S DGIEN=+$$GETPRIM(DGDFN)
102 I $$GETREC(DGIEN,DGNTAPIA) D
103 . S @DGNTAPIA@("INTRP")=$$INTERP^DGNTUT(DGNTAPIA)
104 Q DGIEN
105 ;
106FILENTR(DFN,DGNUPD,DGXMIT) ; NTR HISTORY (#28.11) filer
107 ; Callpoint to create a new NTR HISTORY FILE (#28.11) entry.
108 ; Will also queue HL7 message for HEC database updates.
109 ;
110 ; Input
111 ; DFN - Patients DFN
112 ; DGNUPD - question response array
113 ; "NTR" - NTR exposure code
114 ; "AVI" - Military Aviator prior to 1/31/55
115 ; "SUB" - Submarine Training prior to 1/1/65
116 ; "EDT" - Date/Time entered
117 ; "EUSR" - Entered by
118 ; "VER" - verification method
119 ; "VDT" - Date/Time verified
120 ; "VUSR" - verified by
121 ; "VSIT" - Site verifying Documentation
122 ; "HNC" - Head/Neck Cancer DX
123 ; "HDT" - Date/Time diagnosis verified
124 ; "HUSR" - diagnosis verified by
125 ; "HSIT" - Site verifying DX
126 ; DGXMIT - flag to transmit update to the HEC
127 ; "0" - don't transmit, "1" - transmit [default]
128 ;
129 ; Output
130 ; DGRSLT - Returns IEN of file (#28.11) entry if successful
131 ;
132 ; If an error occurred during parameter validation, then:
133 ; DGRSLT = 0^Error Description
134 ;
135 ; If an error occured during filing, then:
136 ; DGRSLT = 0^Error Code IEN
137 ; (returned by UPDATE^DIE call)
138 ;
139 N DGRSLT,DGFDA,DGNERR
140 S DFN=+$G(DFN)
141 S DGXMIT=$S($G(DGXMIT)=0:0,1:1)
142 S DGRSLT=0
143 ;
144 I DFN>0,$D(DGNUPD) D
145 . S DGNUPD("DFN")=DFN
146 . ;validate the input array parameter
147 . I '$$VALID^DGNTAPI1(.DGNUPD,.DGNERR) D Q
148 . . S DGRSLT="0^"_$G(DGNERR)
149 . I $$BLDFDA(DFN,.DGNUPD,.DGFDA) S DGRSLT=$$NEWNTR(.DGFDA)
150 . Q:'DGRSLT
151 . ;queue message to the HEC
152 . I DGXMIT D AUTOUPD^DGENA2(DFN)
153 ;
154 Q DGRSLT
155 ;
156BLDFDA(DFN,DGNTUPD,DGBFDA) ;
157 ;Build the field desription array
158 ; Input
159 ; DFN - Patients DFN
160 ; DGNTUPD - question response array - refer to $$FILENTR
161 ; DGBFDA - FDA name passed by reference
162 ;
163 ; Output
164 ; DGBFDA - field array built by reference
165 ; DGRSLT - function return
166 ; 1 - successful build
167 ; 0 - nothing built
168 ;
169 N DGSTAT ;screening status internal code
170 N DGIENS ;IENS string
171 N DGRSLT ;did anything get built
172 ;
173 S DGIENS="+1,"
174 S DGRSLT=0
175 S DGBFDA(28.11,DGIENS,.01)=DFN
176 S DGBFDA(28.11,DGIENS,.04)=$P(DGNTUPD("NTR"),"^")
177 S DGBFDA(28.11,DGIENS,.05)=$P(DGNTUPD("AVI"),"^")
178 S DGBFDA(28.11,DGIENS,.06)=$P(DGNTUPD("SUB"),"^")
179 S DGBFDA(28.11,DGIENS,.07)=$G(DGNTUPD("EDT"))
180 S DGBFDA(28.11,DGIENS,.08)=$G(DGNTUPD("EUSR"))
181 S DGBFDA(28.11,DGIENS,1.01)=$P(DGNTUPD("VER"),"^")
182 S DGBFDA(28.11,DGIENS,1.02)=$G(DGNTUPD("VDT"))
183 S DGBFDA(28.11,DGIENS,1.03)=$G(DGNTUPD("VUSR"))
184 S DGBFDA(28.11,DGIENS,1.04)=$G(DGNTUPD("VSIT"))
185 S DGBFDA(28.11,DGIENS,2.01)=$P(DGNTUPD("HNC"),"^")
186 S DGBFDA(28.11,DGIENS,2.02)=$G(DGNTUPD("HDT"))
187 S DGBFDA(28.11,DGIENS,2.03)=$G(DGNTUPD("HUSR"))
188 S DGBFDA(28.11,DGIENS,2.04)=$G(DGNTUPD("HSIT"))
189 ;indicator and status
190 S DGSTAT=$$STATUS^DGNTUT(.DGNTUPD) ;determine pending/verified status
191 S DGBFDA(28.11,DGIENS,.02)=$S(DGSTAT=4!(DGSTAT=5):"Y",1:"N")
192 S DGBFDA(28.11,DGIENS,.03)=DGSTAT
193 S DGBFDA(28.11,DGIENS,.09)=1
194 Q 1
195 ;
196NEWNTR(DGNFDA) ;Create new record
197 ; Input
198 ; DGNFDA - Field description array
199 ;
200 ; Output
201 ; DGRSLT - 1=success
202 ; 0=failed
203 ;
204 N DGERR,DGRSLT,DGNTIEN
205 D UPDATE^DIE("","DGNFDA","DGNTIEN","DGERR")
206 S DGRSLT=+$G(DGNTIEN(1))
207 I $D(DGERR) D
208 . S DGRSLT="0^"_$G(DGERR("DIERR",1))
209 Q DGRSLT
210 ;
211 ;
212UPDNTR(DGUFDA) ;Update existing record
213 ; Input
214 ; DGUFDA - Field description array
215 ;
216 ; Output
217 ; DGRSLT - 1=success
218 ; 0=failed
219 ;
220 N DGERR,DGRSLT
221 S DGRSLT=0
222 D FILE^DIE("K","DGUFDA","DGERR")
223 I '$D(DGERR) S DGRSLT=1
224 Q DGRSLT
Note: See TracBrowser for help on using the repository browser.