source: WorldVistAEHR/trunk/r/AUTOMATED_LAB_INSTRUMENTS-LA/LA7UTL03.m@ 1005

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

initial load of WorldVistAEHR

File size: 5.7 KB
Line 
1LA7UTL03 ;HOIFO/BH - Surgical Pathology Query Utility ; 3/11/03 10:45am
2 ;;5.2;AUTOMATED LAB INSTRUMENTS;**69**;Sep 27, 1994
3 ;
4 ;
5SPATH(LRDFN,IEN,RET,ERR) ; Returns data for a given SP Encounter
6 ;
7 ; Input:
8 ;
9 ; LRDFN - Patient Lab DFN (Required)
10 ; IEN - IEN of SP entry (Required)
11 ; RET - Array reference for passing back data (Required)
12 ; ERR - Error array to pass back (Not required)
13 ;
14 ; Output:
15 ;
16 ; '0' - If the API encountered an Error along with @ERR array
17 ;
18 ; '1' - if the API ran successfully and the following data if it exists
19 ;
20 ; Specimen field .01 of file 63.812.
21 ; @RET("SPEC",ien of Specimen entry)=Specimen Data
22 ;
23 ; Clinical History field .01 of sub file 63.813.
24 ; @RET("CHIS",ien of the Clinical History entry)=Clinical His.
25 ;
26 ; Pre Operative Diagnosis field .01 of sub file 63.814.
27 ; @RET@("PREDX",ien of the Pre. Op. Diagnosis entry)=Pre Op Diag.
28 ;
29 ; Operative Diagnosis field .01 of sub file 63.815.
30 ; @RET@("OPERDX",ien of the Op. Diagnosis entry)=Op Diag.
31 ;
32 ; Post Operative Diagnosis field .01 of sub file 63.816.
33 ; @RET@("POSTDX,ien of the Post. Op Diagnosis entry)=Pst. Op Diag.
34 ;
35 ; Gross Description field .01 of sub file 63.81.
36 ; @RET@("GROSSD",ien of the Gross Description entry)=Gross Desc.
37 ;
38 ; Microscopic Description field .01 of sub file 63.811.
39 ; @RET@("MICROD",ien of the Microspc. Description entry)=Micro Desc.
40 ;
41 ; Surgical Pathology field .01 of sub file 63.802.
42 ; @RET@("SURGP",ien of the Surgical Path. entry)=Surgical Path.
43 ;
44 ; ICD field .01 of sub file 63.88.
45 ; @RET@("ICD9",ien of the ICD9 entry)=ICD9
46 ;
47 K @RET
48 K @ERR
49 I $G(LRDFN)="" D Q 0
50 . I $G(ERR)'="" S @ERR@("-1")="No Lab DFN." Q
51 ;
52 I $G(IEN)="" D Q 0
53 . I $G(ERR)'="" S @ERR@("-1")="No Surgical Pathology record IEN." Q
54 ;
55 I $G(RET)="" D Q 0
56 . I $G(ERR)'="" S @ERR@("-1")="No results array reference passed." Q
57 ;
58 ;
59 N QUIT
60 D SPECIMEN
61 I 'QUIT D HISTORY
62 I 'QUIT D PDIAG
63 I 'QUIT D OPDIAG
64 I 'QUIT D POSTDIAG
65 I 'QUIT D GROSSD
66 I 'QUIT D MICROD
67 I 'QUIT D SURGPATH
68 I 'QUIT D ICD
69 I QUIT Q 0
70 Q 1
71 ;
72 ;
73SPECIMEN ;
74 N SPIENS,SPIEN,SPECIMEN S SPIEN="0",QUIT=0
75 F S SPIEN=$O(^LR(LRDFN,"SP",IEN,.1,SPIEN)) Q:'SPIEN!(QUIT) D
76 . Q:QUIT
77 . S SPIENS=SPIEN_","_IEN_","_LRDFN_","
78 . S SPECIMEN=$$GET1^DIQ(63.812,SPIENS,.01,"I")
79 . I $G(DIERR) D Q
80 . . K @RET
81 . . I $G(ERR)'="" S @ERR@("-1")="Fileman Error within GET1 call (Specimen data)."
82 . . S QUIT=1
83 . I SPECIMEN="" Q
84 . S @RET@("SPEC",SPIEN)=SPECIMEN
85 Q
86 ;
87 ;
88HISTORY N CHIENS,CHIEN,HISTORY S CHIEN="0"
89 F S CHIEN=$O(^LR(LRDFN,"SP",IEN,.2,CHIEN)) Q:'CHIEN!(QUIT) D
90 . Q:QUIT
91 . S CHIENS=CHIEN_","_IEN_","_LRDFN_","
92 . S HISTORY=$$GET1^DIQ(63.813,CHIENS,.01,"I")
93 . I $G(DIERR) D Q
94 . . K @RET
95 . . I $G(ERR)'="" S @ERR@("-1")="Fileman Error within GET1 call (Clinical History data)."
96 . . S QUIT=1
97 . I HISTORY="" Q
98 . S @RET@("CHIS",CHIEN)=HISTORY
99 Q
100 ;
101PDIAG N PDIENS,PDIEN,PREOPDX S PDIEN="0"
102 F S PDIEN=$O(^LR(LRDFN,"SP",IEN,.3,PDIEN)) Q:'PDIEN!(QUIT) D
103 . Q:QUIT
104 . S PDIENS=PDIEN_","_IEN_","_LRDFN_","
105 . S PREOPDX=$$GET1^DIQ(63.814,PDIENS,.01,"I")
106 . I $G(DIERR) D Q
107 . . K @RET
108 . . I $G(ERR)'="" S @ERR@("-1")="Fileman Error within GET1 call (Pre Operative Diagnosis data)."
109 . . S QUIT=1
110 . I PREOPDX="" Q
111 . S @RET@("PREDX",PDIEN)=PREOPDX
112 Q
113 ;
114 ;
115OPDIAG N ODIENS,ODIEN,OPERDX S ODIEN="0"
116 F S ODIEN=$O(^LR(LRDFN,"SP",IEN,.4,ODIEN)) Q:'ODIEN!(QUIT) D
117 . Q:QUIT
118 . S ODIENS=ODIEN_","_IEN_","_LRDFN_","
119 . S OPERDX=$$GET1^DIQ(63.815,ODIENS,.01,"I")
120 . I $G(DIERR) D Q
121 . . K @RET
122 . . I $G(ERR)'="" S @ERR@("-1")="Fileman Error within GET1 call (Operative Diagnosis data)."
123 . . S QUIT=1
124 . I OPERDX="" Q
125 . S @RET@("OPERDX",ODIEN)=OPERDX
126 Q
127 ;
128 ;
129POSTDIAG ;
130 N PSDIENS,PSDIEN,POSTDX S PSDIEN="0"
131 F S PSDIEN=$O(^LR(LRDFN,"SP",IEN,.5,PSDIEN)) Q:'PSDIEN!(QUIT) D
132 . Q:QUIT
133 . S PSDIENS=PSDIEN_","_IEN_","_LRDFN_","
134 . S POSTDX=$$GET1^DIQ(63.816,PSDIENS,.01,"I")
135 . I $G(DIERR) D Q
136 . . K @RET
137 . . I $G(ERR)'="" S @ERR@("-1")="Fileman Error within GET1 call (Post Operative Diagnosis data)."
138 . . S QUIT=1
139 . I POSTDX="" Q
140 . S @RET@("POSTDX",PSDIEN)=POSTDX
141 Q
142 ;
143 ;- Gross Description Data
144GROSSD N GDIENS,GDIEN,GROSSD S GDIEN="0"
145 F S GDIEN=$O(^LR(LRDFN,"SP",IEN,1,GDIEN)) Q:'GDIEN!(QUIT) D
146 . Q:QUIT
147 . S GDIENS=GDIEN_","_IEN_","_LRDFN_","
148 . S GROSSD=$$GET1^DIQ(63.81,GDIENS,.01,"I")
149 . I $G(DIERR) D Q
150 . . K @RET
151 . . I $G(ERR)'="" S @ERR@("-1")="Fileman Error within GET1 call (Gross Description data)."
152 . . S QUIT=1
153 . I GROSSD="" Q
154 . S @RET@("GROSSD",GDIEN)=GROSSD
155 Q
156 ;
157MICROD ; Microscopic Description
158 N MDIENS,MDIEN,MICROD S MDIEN="0"
159 F S MDIEN=$O(^LR(LRDFN,"SP",IEN,1.1,MDIEN)) Q:'MDIEN!(QUIT) D
160 . Q:QUIT
161 . S MDIENS=MDIEN_","_IEN_","_LRDFN_","
162 . S MICROD=$$GET1^DIQ(63.811,MDIENS,.01,"I")
163 . I $G(DIERR) D Q
164 . . K @RET
165 . . I $G(ERR)'="" S @ERR@("-1")="Fileman Error within GET1 call (Microscopic Description data)."
166 . . S QUIT=1
167 . I MICROD="" Q
168 . S @RET@("MICROD",MDIEN)=MICROD
169 Q
170 ;
171SURGPATH ; - Surgical Pathology
172 N SGIENS,SGIEN,SURGP S SGIEN="0"
173 F S SGIEN=$O(^LR(LRDFN,"SP",IEN,1.4,SGIEN)) Q:'SGIEN!(QUIT) D
174 . Q:QUIT
175 . S SGIENS=SGIEN_","_IEN_","_LRDFN_","
176 . S SURGP=$$GET1^DIQ(63.802,SGIENS,.01,"I")
177 . I $G(DIERR) D Q
178 . . K @RET
179 . . I $G(ERR)'="" S @ERR@("-1")="Fileman Error within GET1 call (Surgical Pathology data)."
180 . . S QUIT=1
181 . I SURGP="" Q
182 . S @RET@("SURGP",SGIEN)=SURGP
183 Q
184 ;
185ICD ; - Get ICD Data
186 N ICDIENS,ICDIEN,ICD9 S ICDIEN="0"
187 F S ICDIEN=$O(^LR(LRDFN,"SP",IEN,3,ICDIEN)) Q:'ICDIEN!(QUIT) D
188 . Q:QUIT
189 . S ICDIENS=ICDIEN_","_IEN_","_LRDFN_","
190 . S ICD9=$$GET1^DIQ(63.88,ICDIENS,.01,"E")
191 . I $G(DIERR) D Q
192 . . K @RET
193 . . I $G(ERR)'="" S @ERR@("-1")="Fileman Error within GET1 call (ICD9 data)."
194 . . S QUIT=1
195 . I ICD9="" Q
196 . S @RET@("ICD9",ICDIEN)=ICD9
197 Q
198 ;
Note: See TracBrowser for help on using the repository browser.