source: FOIAVistA/tag/r/CLINICAL_CASE_REGISTRIES-ROR/RORRP025.m@ 628

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

initial load of FOIAVistA 6/30/08 version

File size: 7.8 KB
Line 
1RORRP025 ;HCIOFO/SG - RPC: RORICR CDC LOAD ; 2/3/04 8:11am
2 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
3 ;
4 ; This routine uses the following IAs:
5 ;
6 ; #10060 Read access to the NEW PERSON file (#200)
7 ;
8 ;--------------------------------------------------------------------
9 ; Registry: [VA HIV]
10 ;--------------------------------------------------------------------
11 Q
12 ;
13 ;***** DEMOGRAPHIC INFORMATION (III)
14CDM(IENS) ;
15 N BUF,RC,RORBUF,TMP
16 S BUF="CDM"
17 S RC=$$LOAD^RORRP026(IENS,"CDM^RORRP026",.BUF,.RORBUF) Q:RC<0 RC
18 ;--- Age at diagnosis
19 S TMP=+$G(RORBUF(799.4,IENS,9.02,"I"))
20 S:TMP=1 $P(BUF,U,4)=$G(RORBUF(799.4,IENS,9.03,"I"))
21 S:TMP=2 $P(BUF,U,4)=$G(RORBUF(799.4,IENS,9.04,"I"))
22 ;--- Country of birth
23 S TMP=+$G(RORBUF(799.4,IENS,9.07,"I"))
24 S:TMP=7 $P(BUF,U,8)=$G(RORBUF(799.4,IENS,9.08,"I"))
25 S:TMP=8 $P(BUF,U,8)=$G(RORBUF(799.4,IENS,9.09,"I"))
26 ;--- Store the data into the result buffer
27 S RORPTR=RORPTR+1,RORDST(RORPTR)=BUF
28 Q 0
29 ;
30 ;***** COMMENTS (X)
31CMT(IENS) ;
32 N BUF,I,RC,RORBUF,RORMSG,TMP
33 S TMP=$$GET1^DIQ(799.4,IENS,25,,"RORBUF","RORMSG")
34 I $G(DIERR) D Q RC
35 . S RC=$$DBS^RORERR("RORMSG",-9,,,799.4,IENS)
36 ;--- Store the data into the result buffer
37 S I=0
38 F S I=$O(RORBUF(I)) Q:I'>0 D
39 . S RORPTR=RORPTR+1,RORDST(RORPTR)="CMT"_U_I_U_RORBUF(I)
40 Q 0
41 ;
42 ;***** CLINICAL STATUS (VIII)
43CS(IENS) ;
44 N BUF,I,IENS1,RC,RORBUF,RORMSG,TMP
45 S BUF="CS"
46 S RC=$$LOAD^RORRP026(IENS,"CS^RORRP026",.BUF) Q:RC<0 RC
47 ;--- Store the data into the result buffer
48 S RORPTR=RORPTR+1,RORDST(RORPTR)=BUF
49 ;--- Load the AIDS Indicator diseases
50 S IENS1=","_IENS,TMP="@;.01I;.02I;.03I"
51 D LIST^DIC(799.41,IENS1,TMP,,,,,"B",,,"RORBUF","RORMSG")
52 I $G(DIERR) D Q RC
53 . S RC=$$DBS^RORERR("RORMSG",-9,,,799.41,IENS1)
54 ;--- Process the list
55 S I=0
56 F S I=$O(RORBUF("DILIST","ID",I)) Q:I'>0 D
57 . S BUF="AID"_U_$G(RORBUF("DILIST","ID",I,.01))
58 . S TMP=$G(RORBUF("DILIST","ID",I,.02)) Q:TMP'>0
59 . S $P(BUF,U,3)=TMP
60 . S $P(BUF,U,4)=$$DATE^RORRP026($G(RORBUF("DILIST","ID",I,.03)))
61 . ;--- Store the data into the result buffer
62 . S RORPTR=RORPTR+1,RORDST(RORPTR)=BUF
63 Q 0
64 ;
65 ;***** PROCESSES THE ERROR(S) AND UNLOCKS THE RECORDS
66ERROR(RESULTS,RC) ;
67 D RPCSTK^RORERR(.RESULTS,RC)
68 D UNLOCK^RORLOCK(.RORLOCK)
69 Q
70 ;
71 ;***** FACILITY OF DIAGNOSIS (IV)
72FD(IENS) ;
73 N BUF,RC,RORBUF,TMP
74 S BUF="FD"
75 S RC=$$LOAD^RORRP026(IENS,"FD^RORRP026",.BUF) Q:RC<0 RC
76 ;--- Store the data into the result buffer
77 S RORPTR=RORPTR+1,RORDST(RORPTR)=BUF
78 Q 0
79 ;
80 ;***** FORM HEADERS
81HDR(IENS) ;
82 N BUF,IENS200,RC,RORBUF,RORMSG,TMP
83 S BUF="HDR"
84 S RC=$$LOAD^RORRP026(IENS,"HDR^RORRP026",.BUF) Q:RC<0 RC
85 ;--- Date when the CDC form was completed
86 S:$P(BUF,U,3)="" $P(BUF,U,3)=$$DT^XLFDT
87 ;--- Person who is completing the form
88 S IENS200=DUZ_","
89 D GETS^DIQ(200,IENS200,".01;.132",,"RORBUF","RORMSG")
90 Q:$G(DIERR) $$DBS^RORERR("RORMSG",-9,,,200,IENS200)
91 S $P(BUF,U,4)=DUZ
92 S $P(BUF,U,5)=$G(RORBUF(200,IENS200,.01))
93 S $P(BUF,U,6)=$G(RORBUF(200,IENS200,.132))
94 ;--- Medical record number (it is the SSN now)
95 S $P(BUF,U,7)=$P($G(RORDST(1)),U,6)
96 ;--- Store the data into the result buffer
97 S RORPTR=RORPTR+1,RORDST(RORPTR)=BUF
98 Q 0
99 ;
100 ;***** LABORATORY DATA (VI)
101LD(IENS) ;
102 N BUF,FLD,RC,RORBUF,TMP
103 S BUF="LD1"
104 S RC=$$LOAD^RORRP026(IENS,"LD1^RORRP026",.BUF,.RORBUF) Q:RC<0 RC
105 ;--- Positive HIV detection test
106 S FLD=$$PHIVFLD^RORRP026($P(BUF,U,12))
107 S:FLD $P(BUF,U,13)=$$DATE^RORRP026($G(RORBUF(799.4,IENS,FLD,"I")))
108 ;--- Store the data into the result buffer
109 S RORPTR=RORPTR+1,RORDST(RORPTR)=BUF
110 ;--- The second segment
111 S BUF="LD2"
112 S RC=$$LOAD^RORRP026(IENS,"LD2^RORRP026",.BUF) Q:RC<0 RC
113 ;--- Store the data into the result buffer
114 S RORPTR=RORPTR+1,RORDST(RORPTR)=BUF
115 Q 0
116 ;
117 ;***** LOADS THE ICR CDC DATA
118 ; RPC: [RORICR CDC LOAD]
119 ;
120 ; .RORDST Reference to a local variable where the results
121 ; are returned to.
122 ;
123 ; REGIEN Registry IEN
124 ;
125 ; PATIEN IEN of the registry patient (DFN)
126 ;
127 ; [LOCK] Lock the ICR record before loading the data and
128 ; leave it locked.
129 ;
130 ; Return Values:
131 ;
132 ; A negative value of the first "^"-piece of the RORDST(0)
133 ; indicates an error (see the RPCSTK^RORERR procedure for more
134 ; details).
135 ;
136 ; If locking was requested (see the LOCK parameter) and the record
137 ; could not be locked then the first "^"-piece of the RORDST(0)
138 ; would be greater than 0. The RORDST(0) would contain the lock
139 ; descriptor and subsequent nodes of the global array would contain
140 ; the data (see below). The lock descriptor contains information
141 ; about the propcess, which owns the most recent lock of the record.
142 ;
143 ; RORDST(0) Lock Descriptor
144 ; ^01: Date/Time (FileMan)
145 ; ^02: User/Process name
146 ; ^03: User IEN (DUZ)
147 ; ^04: $JOB
148 ; ^05: Task number
149 ;
150 ; THE DATA ARE LOADED ONLY FOR VIEWING PURPOSES (READ-ONLY)!
151 ;
152 ; Otherwise, zero is returned in the RORDST(0) and the subsequent
153 ; nodes of the array contain the data.
154 ;
155 ; RORDST(0) 0
156 ;
157 ; RORDST(i) Data Item
158 ; ^01: Type
159 ; ^02: Sequential Number or Item Code
160 ; ^03: Value
161 ; ^04: ...
162 ;
163 ; Item Types:
164 ; DEM Demographic Information
165 ; ADR Patient's Address
166 ; RCE Race Information
167 ; ETN Ethnicity Information
168 ; HDR Headers
169 ; CDM CDC Demographics
170 ; FD Facility of Diagnosis
171 ; PH Patient History
172 ; LD1 Laboratory Data
173 ; LD2 Laboratory Data
174 ; CS Clinical Status
175 ; AID AIDS Indicator Disease
176 ; TS1 Treatment/Services
177 ; TS2 Treatment/Services
178 ; CMT Comments
179 ;
180 ; See the CDC FIELD TABLE section (CDCFLDS^RORRP026) and the
181 ; description of the RORICR CDC LOAD remote procedure for details.
182 ;
183LOADCDC(RORDST,REGIEN,PATIEN,LOCK) ;
184 N BUF,IEN,RC,RDONLY,RORERRDL,RORLOCK,RORPTR
185 D CLEAR^RORERR("LOADCDC^RORRP025",1)
186 K RORDST S (RDONLY,RORDST(0))=0
187 ;--- Check the parameters
188 S RC=0 D I RC<0 D ERROR(.RORDST,RC) Q
189 . ;--- Registry IEN
190 . I $G(REGIEN)'>0 D Q
191 . . S RC=$$ERROR^RORERR(-88,,,,"REGIEN",$G(REGIEN))
192 . S REGIEN=+REGIEN
193 . ;--- Patient IEN
194 . I $G(PATIEN)'>0 D Q
195 . . S RC=$$ERROR^RORERR(-88,,,,"PATIEN",$G(PATIEN))
196 . S PATIEN=+PATIEN
197 ;
198 ;--- Load the patient's demographic data
199 D GETPTDAT^RORRP021(.RORDST,PATIEN,"AER")
200 Q:$G(RORDST(0))<0
201 S RORPTR=+$O(RORDST(""),-1)
202 ;
203 ;--- Get the IEN of the registry record
204 S IEN=$$PRRIEN^RORUTL01(PATIEN,REGIEN) Q:IEN'>0
205 S IENS=IEN_","
206 ;
207 ;--- Lock the record
208 I $G(LOCK) D I RDONLY<0 D ERROR(.RORDST,+RDONLY) Q
209 . S RORLOCK(799.4,IENS)=""
210 . S RDONLY=$$LOCK^RORLOCK(799.4,IENS)
211 ;
212 ;--- Create the data segments
213 S RC=0 D I RC<0 D ERROR(.RORDST,RC) Q
214 . S RC=$$HDR(IENS) Q:RC<0
215 . S RC=$$CDM(IENS) Q:RC<0
216 . S RC=$$FD(IENS) Q:RC<0
217 . S RC=$$PH(IENS) Q:RC<0
218 . S RC=$$LD(IENS) Q:RC<0
219 . S RC=$$CS(IENS) Q:RC<0
220 . S RC=$$TS(IENS) Q:RC<0
221 . S RC=$$CMT(IENS) Q:RC<0
222 ;---
223 S RORDST(0)=RDONLY
224 Q
225 ;
226 ;***** PATIENT HISTORY (V)
227PH(IENS) ;
228 N BUF,RC,RORBUF,TMP
229 S BUF="PH"
230 S RC=$$LOAD^RORRP026(IENS,"PH^RORRP026",.BUF) Q:RC<0 RC
231 ;--- Store the data into the result buffer
232 S RORPTR=RORPTR+1,RORDST(RORPTR)=BUF
233 Q 0
234 ;
235 ;***** TREATMENT/SERVICES REFERRALS (IX)
236TS(IENS) ;
237 N BUF,RC,RORBUF,TMP
238 S BUF="TS1"
239 S RC=$$LOAD^RORRP026(IENS,"TS1^RORRP026",.BUF) Q:RC<0 RC
240 ;--- Store the data into the result buffer
241 S RORPTR=RORPTR+1,RORDST(RORPTR)=BUF
242 ;--- The second segment
243 S BUF="TS2"
244 S RC=$$LOAD^RORRP026(IENS,"TS2^RORRP026",.BUF) Q:RC<0 RC
245 ;--- Store the data into the result buffer
246 S RORPTR=RORPTR+1,RORDST(RORPTR)=BUF
247 Q 0
Note: See TracBrowser for help on using the repository browser.