1 | C0CALABS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR LAB RESULTS ; 10/01/08
|
---|
2 | ;;0.3;CCDCCR;nopatch;noreleasedate
|
---|
3 | ;Copyright 2008,2009 George Lilly, University of Minnesota.
|
---|
4 | ;Licensed under the terms of the GNU General Public License.
|
---|
5 | ;See attached copy of the License.
|
---|
6 | ;
|
---|
7 | ;This program is free software; you can redistribute it and/or modify
|
---|
8 | ;it under the terms of the GNU General Public License as published by
|
---|
9 | ;the Free Software Foundation; either version 2 of the License, or
|
---|
10 | ;(at your option) any later version.
|
---|
11 | ;
|
---|
12 | ;This program is distributed in the hope that it will be useful,
|
---|
13 | ;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | ;GNU General Public License for more details.
|
---|
16 | ;
|
---|
17 | ;You should have received a copy of the GNU General Public License along
|
---|
18 | ;with this program; if not, write to the Free Software Foundation, Inc.,
|
---|
19 | ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
---|
20 | ;
|
---|
21 | ;MAP(DFN,MOXML,MIVAR,MIXML) ; MAP RESULTS VARIABLES TO XML - GPL -TBD
|
---|
22 | MAP(MIXML,DFN,MOXML) ;TO MAKE THIS COMPATIBLE WITH OLD CALLING FOR EXTRACT
|
---|
23 | ; ASSUMES THAT EXTRACT HAS BEEN RUN AND THE VARIABLES STORED IN MIVAR
|
---|
24 | ; MIXML,MIVAR, AND MOXML ARE PASSED BY NAME
|
---|
25 | ; MIXML IS THE TEMPLATE TO USE
|
---|
26 | ; MOXML IS THE OUTPUT XML ARRAY
|
---|
27 | ; DFN IS THE PATIENT RECORD NUMBER
|
---|
28 | N C0COXML,C0CO,C0CV,C0CIXML
|
---|
29 | I '$D(MIVAR) S C0CV="" ;DEFAULT
|
---|
30 | E S C0CV=MIVAR ;PASSED VARIABLE ARRAY
|
---|
31 | I '$D(MIXML) S C0CIXML="" ;DEFAULT
|
---|
32 | E S C0CIXML=MIXML ;PASSED INPUT XML
|
---|
33 | D RPCMAP(.C0COXML,DFN,C0CV,C0CIXML) ; CALL RPC TO DO THE WORK
|
---|
34 | I '$D(MOXML) S C0CO=$NA(^TMP("C0CCCR",$J,DFN,"RESULTS")) ;DEFAULT FOR OUTPUT
|
---|
35 | E S C0CO=MOXML
|
---|
36 | ; ZWR C0COXML
|
---|
37 | M @C0CO=C0COXML ; COPY RESULTS TO OUTPUT
|
---|
38 | Q
|
---|
39 | ;
|
---|
40 | RPCMAP(RTN,DFN,RMIVAR,RMIXML) ; RPC ENTRY POINT FOR MAPPING RESULTS
|
---|
41 | ; RTN IS PASSED BY REFERENCE
|
---|
42 | ;N C0CT0,C0CT,C0CV ; CCR TEMPLATE, RESULTS SUBTEMPLATE, VARIABLES
|
---|
43 | ;N C0CRT,C0CTT ; TEST REQUEST TEMPLATE, TEST RESULT TEMPLATE
|
---|
44 | I '$D(DEBUG) S DEBUG=0 ; DEFAULT NO DEBUGGING
|
---|
45 | I RMIXML="" D ; INPUT XML NOT PASSED
|
---|
46 | . D LOAD^C0CCCR0("C0CT0") ; LOAD ENTIRE CCR TEMPLATE
|
---|
47 | . D QUERY^C0CXPATH("C0CT0","//ContinuityOfCareRecord/Body/Results","C0CT0R")
|
---|
48 | . S C0CT="C0CT0R" ; NAME OF EXTRACTED RESULTS TEMPLATE
|
---|
49 | E S C0CT=RMIXML ; WE ARE PASSED THE RESULTS PART OF THE TEMPLATE
|
---|
50 | I RMIVAR="" D ; LOCATION OF VARIABLES NOT PASSED
|
---|
51 | . S C0CV=$NA(^TMP("C0CCCR",$J,"RESULTS")) ;DEFAULT VARIABLE LOCATION
|
---|
52 | E S C0CV=RMIVAR ; PASSED LOCATIONS OF VARS
|
---|
53 | D CP^C0CXPATH(C0CT,"C0CRT") ; START MAKING TEST REQUEST TEMPLATE
|
---|
54 | D REPLACE^C0CXPATH("C0CRT","","//Results/Result/Test") ; DELETE TEST FROM REQ
|
---|
55 | D QUERY^C0CXPATH(C0CT,"//Results/Result/Test","C0CTT") ; MAKE TEST TEMPLATE
|
---|
56 | I '$D(C0CQT) S C0CQT=0 ; DEFAULT NOT SILENT
|
---|
57 | I 'C0CQT D ; WE ARE DEBUGGING
|
---|
58 | . W "I MAPPED",!
|
---|
59 | . W "VARS:",C0CV,!
|
---|
60 | . W "DFN:",DFN,!
|
---|
61 | . ;D PARY^C0CXPATH("C0CT") ; SECTION TEMPLATE
|
---|
62 | . ;D PARY^C0CXPATH("C0CRT") ;REQUEST TEMPLATE (OCR)
|
---|
63 | . ;D PARY^C0CXPATH("C0CTT") ;TEST TEMPLATE (OCX)
|
---|
64 | D EXTRACT("C0CT",DFN,) ; FIRST CALL EXTRACT
|
---|
65 | I '$D(@C0CV@(0)) D Q ; NO VARS THERE
|
---|
66 | . S RTN(0)=0 ; PASS BACK NO RESULTS INDICATOR
|
---|
67 | I @C0CV@(0)=0 S RTN(0)=0 Q ; NO RESULTS
|
---|
68 | S RIMVARS=$NA(^TMP("C0CRIM","VARS",DFN,"RESULTS"))
|
---|
69 | K @RIMVARS
|
---|
70 | M @RIMVARS=@C0CV ; UPDATE RIMVARS SO THEY STAY IN SYNCH
|
---|
71 | N C0CI,C0CJ,C0CMAP,C0CTMAP,C0CTMP
|
---|
72 | S C0CIN=@C0CV@(0) ; COUNT OF RESULTS (OBR)
|
---|
73 | N C0CRTMP ; AREA TO BUILD ONE RESULT REQUEST AND ALL TESTS FOR IT
|
---|
74 | N C0CRBASE S C0CRBASE=$NA(^TMP($J,"TESTTMP")) ;WORK AREA
|
---|
75 | N C0CRBLD ; BUILD LIST FOR XML - THE BUILD IS DELAYED UNTIL THE END
|
---|
76 | ; TO IMPROVE PERFORMANCE
|
---|
77 | D QUEUE^C0CXPATH("C0CRBLD","C0CRT",1,1) ;<Results>
|
---|
78 | F C0CI=1:1:C0CIN D ; LOOP THROUGH VARIABLES
|
---|
79 | . K C0CMAP,C0CTMP ;EMPTY OUT LAST BATCH OF VARIABLES
|
---|
80 | . S C0CRTMP=$NA(@C0CRBASE@(C0CI)) ;PARTITION OF WORK AREA FOR EACH TEST
|
---|
81 | . S C0CMAP=$NA(@C0CV@(C0CI)) ;
|
---|
82 | . I 'C0CQT W "MAPOBR:",C0CMAP,!
|
---|
83 | . ;MAPPING FOR TEST REQUEST GOES HERE
|
---|
84 | . D MAP^C0CXPATH("C0CRT",C0CMAP,C0CRTMP) ; MAP OBR DATA
|
---|
85 | . ;D QOPEN^C0CXPATH("C0CRBLD",C0CRTMP,C0CIS) ;1ST PART OF XML
|
---|
86 | . D QUEUE^C0CXPATH("C0CRBLD",C0CRTMP,2,@C0CRTMP@(0)-4) ;UP TO <Test>
|
---|
87 | . I $D(@C0CMAP@("M","TEST",0)) D ; TESTS EXIST
|
---|
88 | . . S C0CJN=@C0CMAP@("M","TEST",0) ; NUMBER OF TESTS
|
---|
89 | . . K C0CTO ; CLEAR OUTPUT VARIABLE
|
---|
90 | . . F C0CJ=1:1:C0CJN D ;FOR EACH TEST RESULT
|
---|
91 | . . . K C0CTMAP ; EMPTY MAPS FOR TEST RESULTS
|
---|
92 | . . . S C0CTMP=$NA(@C0CRBASE@(C0CI,C0CJ)) ;WORK AREA FOR TEST RESULTS
|
---|
93 | . . . S C0CTMAP=$NA(@C0CMAP@("M","TEST",C0CJ)) ;
|
---|
94 | . . . I 'C0CQT W "MAPOBX:",C0CTMAP,!
|
---|
95 | . . . D MAP^C0CXPATH("C0CTT",C0CTMAP,C0CTMP) ; MAP TO TMP
|
---|
96 | . . . I C0CJ=1 S C0CJS=2 E S C0CJS=1 ;FIRST TIME,SKIP THE <Test>
|
---|
97 | . . . I C0CJ=C0CJN S C0CJE=@C0CTMP@(0)-1 E S C0CJE=@C0CTMP@(0) ;</Test>
|
---|
98 | . . . S C0CJS=1 S C0CJE=@C0CTMP@(0) ; INSERT ALL OF THE TEXT XML
|
---|
99 | . . . D QUEUE^C0CXPATH("C0CRBLD",C0CTMP,C0CJS,C0CJE) ; ADD TO BUILD LIST
|
---|
100 | . . . ;I C0CJ=1 D ; FIRST TIME, JUST COPY
|
---|
101 | . . . ;. D CP^C0CXPATH("C0CTMP","C0CTO") ; START BUILDING TEST XML
|
---|
102 | . . . ;E D INSINNER^C0CXPATH("C0CTO","C0CTMP")
|
---|
103 | . . . ;
|
---|
104 | . . . ;D PUSHA^C0CXPATH("C0CTO",C0CTMP) ;ADD THE TEST TO BUFFER
|
---|
105 | . . ; I 'C0CQT D PARY^C0CXPATH("C0CTO")
|
---|
106 | . . ;D INSINNER^C0CXPATH(C0CRTMP,"C0CTO","//Results/Result/Test") ;INSERT TST
|
---|
107 | . ;D QCLOSE^C0CXPATH("C0CRBLD",C0CRTMP,"//Results/Result/Test") ;END OF XML
|
---|
108 | . D QUEUE^C0CXPATH("C0CRBLD","C0CRT",C0CRT(0)-1,C0CRT(0)-1) ;</Result>
|
---|
109 | . ;I C0CI=1 D ; FIRST TIME, COPY INSTEAD OF INSERT
|
---|
110 | . . ;D CP^C0CXPATH(C0CRTMP,"RTN") ;
|
---|
111 | . ;E D INSINNER^C0CXPATH("RTN",C0CRTMP) ; INSERT THIS TEST REQUEST
|
---|
112 | D QUEUE^C0CXPATH("C0CRBLD","C0CRT",C0CRT(0),C0CRT(0)) ;</Results>
|
---|
113 | D BUILD^C0CXPATH("C0CRBLD","RTN") ;RENDER THE XML
|
---|
114 | K @C0CRBASE ; CLEAR OUT TEMPORARY STURCTURE
|
---|
115 | Q
|
---|
116 | ;
|
---|
117 | EXTRACT(ILXML,DFN,OLXML) ; EXTRACT LABS INTO THE C0CLVAR GLOBAL
|
---|
118 | ;
|
---|
119 | ; LABXML AND LABOUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
|
---|
120 | ;
|
---|
121 | ;
|
---|
122 | ;
|
---|
123 | N C0CNSSN ; IS THERE AN SSN FLAG
|
---|
124 | S C0CNSSN=0
|
---|
125 | S C0CLB=$NA(^TMP("C0CCCR",$J,"RESULTS")) ; BASE GLB FOR LABS VARS
|
---|
126 | D GHL7 ; GET HL7 MESSAGE FOR THIS PATIENT
|
---|
127 | I C0CNSSN=1 D Q ; NO SSN, CAN'T GET HL7 FOR THIS PATIENT
|
---|
128 | . S @C0CLB@(0)=0
|
---|
129 | K @C0CLB ; CLEAR OUT OLD VARS IF ANY
|
---|
130 | N QTSAV S QTSAV=C0CQT ;SAVE QUIET FLAG
|
---|
131 | S C0CQT=1 ; SURPRESS LISTING
|
---|
132 | D LIST ; EXTRACT THE VARIABLES
|
---|
133 | S C0CQT=QTSAV ; RESET SILENT FLAG
|
---|
134 | K ^TMP("HLS",$J) ; KILL HL7 MESSAGE OUTPUT
|
---|
135 | I $D(OLXML) S @OLXML@(0)=0 ; EXTRACT DOES NOT PRODUCE XML... SEE MAP^C0CLABS
|
---|
136 | Q
|
---|
137 | ;
|
---|
138 | GHL7 ; GET HL7 MESSAGE FOR LABS FOR THIS PATIENT
|
---|
139 | ; N C0CPTID,C0CSPC,C0CSDT,C0CEDT,C0CR
|
---|
140 | ; SET UP FOR LAB API CALL
|
---|
141 | S C0CPTID=$$SSN^C0CDPT(DFN) ; GET THE SSN FOR THIS PATIENT
|
---|
142 | I C0CPTID="" D Q ; NO SSN, COMPLAIN AND QUIT
|
---|
143 | . W "LAB LOOKUP FAILED, NO SSN",!
|
---|
144 | . S C0CNSSN=1 ; SET NO SSN FLAG
|
---|
145 | S C0CSPC="*" ; LOOKING FOR ALL LABS
|
---|
146 | ;I $D(^TMP("C0CCCR","RPMS")) D ; RUNNING RPMS
|
---|
147 | ;. D DT^DILF(,"T-365",.C0CSDT) ; START DATE ONE YEAR AGO TO LIMIT VOLUME
|
---|
148 | ;E D DT^DILF(,"T-5000",.C0CSDT) ; START DATE LONG AGO TO GET EVERYTHING
|
---|
149 | ;D DT^DILF(,"T",.C0CEDT) ; END DATE TODAY
|
---|
150 | S C0CLLMT=$$GET^C0CPARMS("LABLIMIT") ; GET THE LIMIT PARM
|
---|
151 | S C0CLSTRT=$$GET^C0CPARMS("LABSTART") ; GET START PARM
|
---|
152 | D DT^DILF(,C0CLLMT,.C0CSDT) ;
|
---|
153 | W "LAB LIMIT: ",C0CLLMT,!
|
---|
154 | D DT^DILF(,C0CLSTRT,.C0CEDT) ; END DATE TODAY - IMPLEMENT END DATE PARM
|
---|
155 | S C0CR=$$LAB^C0CLA7Q(C0CPTID,C0CSDT,C0CEDT,C0CSPC,C0CSPC) ; CALL LAB LOOKUP
|
---|
156 | Q
|
---|
157 | ;
|
---|
158 | LIST ; LIST THE HL7 MESSAGE; ALSO, EXTRACT THE RESULT VARIABLES TO C0CLB
|
---|
159 | ;
|
---|
160 | ; N C0CI,C0CJ,C0COBT,C0CHB,C0CVAR
|
---|
161 | I '$D(C0CLB) S C0CLB=$NA(^TMP("C0CCCR",$J,"RESULTS")) ; BASE GLB FOR LABS VARS
|
---|
162 | I '$D(C0CQT) S C0CQT=0
|
---|
163 | I '$D(DFN) S DFN=1 ; DEFAULT TEST PATIENT
|
---|
164 | I '$D(^TMP("C0CCCR","LABTBL",0)) D SETTBL ;INITIALIZE LAB TABLE
|
---|
165 | I ^TMP("C0CCCR","LABTBL",0)'="V3" D SETTBL ;NEED NEWEST VERSION
|
---|
166 | I '$D(^TMP("HLS",$J,1)) D GHL7 ; GET HL7 MGS IF NOT ALREADY DONE
|
---|
167 | S C0CTAB=$NA(^TMP("C0CCCR","LABTBL")) ; BASE OF OBX TABLE
|
---|
168 | S C0CHB=$NA(^TMP("HLS",$J))
|
---|
169 | S C0CI=""
|
---|
170 | S @C0CLB@(0)=0 ; INITALIZE RESULTS VARS COUNT
|
---|
171 | F S C0CI=$O(@C0CHB@(C0CI)) Q:C0CI="" D ; FOR ALL RECORDS IN HL7 MSG
|
---|
172 | . K C0CVAR,XV ; CLEAR OUT VARIABLE VALUES
|
---|
173 | . S C0CTYP=$P(@C0CHB@(C0CI),"|",1)
|
---|
174 | . D LTYP(@C0CHB@(C0CI),C0CTYP,.C0CVAR,C0CQT)
|
---|
175 | . M XV=C0CVAR ;
|
---|
176 | . I C0CTYP="OBR" D ; BEGINNING OF NEW SECTION
|
---|
177 | . . S @C0CLB@(0)=@C0CLB@(0)+1 ; INCREMENT COUNT
|
---|
178 | . . S C0CLI=@C0CLB@(0) ; INDEX FOR THIS RESULT
|
---|
179 | . . ;M @C0CLB@(C0CLI)=C0CVAR ; PERSIST THE OBR VARS
|
---|
180 | . . S XV("RESULTOBJECTID")="RESULT_"_C0CLI
|
---|
181 | . . S C0CX1=XV("RESULTSOURCEACTORID") ; SOURCE FROM OBR
|
---|
182 | . . S XV("RESULTSOURCEACTORID")="ACTORPROVIDER_"_$P($P(C0CX1,"^",1),"-",1)
|
---|
183 | . . S C0CX1=XV("RESULTASSESSMENTDATETIME") ;DATE TIME IN HL7 FORMAT
|
---|
184 | . . S C0CX2=$$HL7TFM^XLFDT(C0CX1,"L") ;FM DT LOCAL
|
---|
185 | . . S XV("RESULTASSESSMENTDATETIME")=$$FMDTOUTC^C0CUTIL(C0CX2,"DT") ;UTC TIME
|
---|
186 | . . M @C0CLB@(C0CLI)=XV ; PERSIST THE OBR VARS
|
---|
187 | . . S C0CLOBX=0 ; MARK THE BEGINNING OF A NEW SECTION
|
---|
188 | . I C0CTYP="OBX" D ; SPECIAL CASE FOR OBX3
|
---|
189 | . . ; RESULTTESTCODEVALUE
|
---|
190 | . . ; RESULTTESTDESCRIPTIONTEXT
|
---|
191 | . . I C0CVAR("C3")="LN" D ; PRIMARY CODE IS LOINC
|
---|
192 | . . . S XV("RESULTTESTCODEVALUE")=C0CVAR("C1") ; THE LOINC CODE VALUE
|
---|
193 | . . . S XV("RESULTTESTCODINGSYSTEM")="LOINC" ; DISPLAY NAME FOR LOINC
|
---|
194 | . . . S XV("RESULTTESTDESCRIPTIONTEXT")=C0CVAR("C2") ; DESCRIPTION TEXT
|
---|
195 | . . E I C0CVAR("C6")="LN" D ; SECONDARY CODE IS LOINC
|
---|
196 | . . . S XV("RESULTTESTCODEVALUE")=C0CVAR("C4") ; THE LOINC CODE VALUE
|
---|
197 | . . . S XV("RESULTTESTCODINGSYSTEM")="LOINC" ; DISPLAY NAME FOR LOINC
|
---|
198 | . . . S XV("RESULTTESTDESCRIPTIONTEXT")=C0CVAR("C5") ; DESCRIPTION TEXT
|
---|
199 | . . E I C0CVAR("C6")'="" D ; NO LOINC CODES, USE SECONDARY IF PRESENT
|
---|
200 | . . . S XV("RESULTTESTCODEVALUE")=C0CVAR("C4") ; SECONDARY CODE VALUE
|
---|
201 | . . . S XV("RESULTTESTCODINGSYSTEM")=C0CVAR("C6") ; SECONDARY CODE NAME
|
---|
202 | . . . S XV("RESULTTESTDESCRIPTIONTEXT")=C0CVAR("C5") ; SECONDARY TEXT
|
---|
203 | . . E D ; NO SECONDARY, USE PRIMARY
|
---|
204 | . . . S XV("RESULTTESTCODEVALUE")=C0CVAR("C1") ; PRIMARY CODE VALUE
|
---|
205 | . . . S XV("RESULTTESTCODINGSYSTEM")=C0CVAR("C3") ; PRIMARY DISPLAY NAME
|
---|
206 | . . . S XV("RESULTTESTDESCRIPTIONTEXT")=C0CVAR("C2") ; USE PRIMARY TEXT
|
---|
207 | . . N C0CZG S C0CZG=XV("RESULTTESTNORMALDESCTEXT") ;
|
---|
208 | . . S XV("RESULTTESTNORMALDESCTEXT")=$$SYMENC^MXMLUTL(C0CZG) ;ESCAPE
|
---|
209 | . . S C0CZG=XV("RESULTTESTVALUE")
|
---|
210 | . . S XV("RESULTTESTVALUE")=$$SYMENC^MXMLUTL(C0CZG) ;ESCAPE
|
---|
211 | . I C0CTYP="OBX" D ; PROCESS TEST RESULTS
|
---|
212 | . . I C0CLOBX=0 D ; FIRST TEST RESULT FOR THIS SECTION
|
---|
213 | . . . S C0CLB2=$NA(@C0CLB@(C0CLI,"M","TEST")) ; INDENT FOR TEST RESULTS
|
---|
214 | . . S C0CLOBX=C0CLOBX+1 ; INCREMENT TEST COUNT
|
---|
215 | . . S @C0CLB2@(0)=C0CLOBX ; STORE THE TEST COUNT
|
---|
216 | . . S XV("RESULTTESTOBJECTID")="RESULTTEST_"_C0CLI_"_"_C0CLOBX
|
---|
217 | . . S C0CX1=XV("RESULTTESTSOURCEACTORID") ; TEST SOURCE
|
---|
218 | . . S C0CX2=$P($P(C0CX1,"^",1),"-",1) ; PULL OUT STATION NUMBER
|
---|
219 | . . S XV("RESULTTESTSOURCEACTORID")="ACTORORGANIZATION_"_C0CX2
|
---|
220 | . . S XV("RESULTTESTNORMALSOURCEACTORID")=XV("RESULTTESTSOURCEACTORID")
|
---|
221 | . . S C0CX1=XV("RESULTTESTDATETIME") ;DATE TIME IN HL7 FORMAT
|
---|
222 | . . S C0CX2=$$HL7TFM^XLFDT(C0CX1,"L") ;FM DT LOCAL
|
---|
223 | . . S XV("RESULTTESTDATETIME")=$$FMDTOUTC^C0CUTIL(C0CX2,"DT") ;UTC TIME
|
---|
224 | . . ; I 'C0CQT ZWR XV
|
---|
225 | . . M @C0CLB2@(C0CLOBX)=XV ; PERSIST THE TEST RESULT VARIABLES
|
---|
226 | . I 'C0CQT D ;
|
---|
227 | . . W C0CI," ",C0CTYP,!
|
---|
228 | . ; S C0CI=$O(@C0CHB@(C0CI))
|
---|
229 | ;K ^TMP("C0CRIM","VARS",DFN,"RESULTS")
|
---|
230 | ;M ^TMP("C0CRIM","VARS",DFN,"RESULTS")=@C0CLB
|
---|
231 | Q
|
---|
232 | LTYP(OSEG,OTYP,OVARA,OC0CQT) ;
|
---|
233 | S OTAB=$NA(@C0CTAB@(OTYP)) ; TABLE FOR SEGMENT TYPE
|
---|
234 | I '$D(OC0CQT) S C0CQT=0 ; NOT C0CQT IS DEFAULT
|
---|
235 | E S C0CQT=OC0CQT ; ACCEPT C0CQT FLAG
|
---|
236 | I 1 D ; FOR HL7 SEGMENT TYPE
|
---|
237 | . S OI="" ; INDEX INTO FIELDS IN SEG
|
---|
238 | . F S OI=$O(@OTAB@(OI)) Q:OI="" D ; FOR EACH FIELD OF THE SEGMENT
|
---|
239 | . . S OTI=$P(@OTAB@(OI),"^",1) ; TABLE INDEX
|
---|
240 | . . S OVAR=$P(@OTAB@(OI),"^",4) ; CCR VARIABLE IF DEFINED
|
---|
241 | . . S OV=$P(OSEG,"|",OTI+1) ; PULL OUT VALUE
|
---|
242 | . . I $P(OI,";",2)'="" D ; THIS IS DEFINING A SUB-VALUE
|
---|
243 | . . . S OI2=$P(OTI,";",2) ; THE SUB-INDEX
|
---|
244 | . . . S OV=$P(OV,"^",OI2) ; PULL OUT SUB-VALUE
|
---|
245 | . . I OVAR'="" S OVARA(OVAR)=OV ; PASS BACK VARIABLE AND VALUE
|
---|
246 | . . I 'C0CQT D ; PRINT OUTPUT IF C0CQT IS FALSE
|
---|
247 | . . . I OV'="" W OI_": "_$P(@OTAB@(OI),"^",3),": ",OVAR,": ",OV,!
|
---|
248 | Q
|
---|
249 | LOBX ;
|
---|
250 | Q
|
---|
251 | ;
|
---|
252 | OUT(DFN) ; WRITE OUT A CCR THAT HAS JUST BEEN PROCESSED (FOR TESTING)
|
---|
253 | N GA,GF,GD
|
---|
254 | S GA=$NA(^TMP("C0CCCR",$J,DFN,"CCR",1))
|
---|
255 | S GF="RPMS_CCR_"_DFN_"_"_DT_".xml"
|
---|
256 | S GD=^TMP("C0CCCR","ODIR")
|
---|
257 | W $$OUTPUT^C0CXPATH(GA,GF,GD)
|
---|
258 | Q
|
---|
259 | ;
|
---|
260 | SETTBL ;
|
---|
261 | K X ; CLEAR X
|
---|
262 | S X("PID","PID1")="1^00104^Set ID - Patient ID"
|
---|
263 | S X("PID","PID2")="2^00105^Patient ID (External ID)"
|
---|
264 | S X("PID","PID3")="3^00106^Patient ID (Internal ID)"
|
---|
265 | S X("PID","PID4")="4^00107^Alternate Patient ID"
|
---|
266 | S X("PID","PID5")="5^00108^Patient's Name"
|
---|
267 | S X("PID","PID6")="6^00109^Mother's Maiden Name"
|
---|
268 | S X("PID","PID7")="7^00110^Date of Birth"
|
---|
269 | S X("PID","PID8")="8^00111^Sex"
|
---|
270 | S X("PID","PID9")="9^00112^Patient Alias"
|
---|
271 | S X("PID","PID10")="10^00113^Race"
|
---|
272 | S X("PID","PID11")="11^00114^Patient Address"
|
---|
273 | S X("PID","PID12")="12^00115^County Code"
|
---|
274 | S X("PID","PID13")="13^00116^Phone Number - Home"
|
---|
275 | S X("PID","PID14")="14^00117^Phone Number - Business"
|
---|
276 | S X("PID","PID15")="15^00118^Language - Patient"
|
---|
277 | S X("PID","PID16")="16^00119^Marital Status"
|
---|
278 | S X("PID","PID17")="17^00120^Religion"
|
---|
279 | S X("PID","PID18")="18^00121^Patient Account Number"
|
---|
280 | S X("PID","PID19")="19^00122^SSN Number - Patient"
|
---|
281 | S X("PID","PID20")="20^00123^Drivers License - Patient"
|
---|
282 | S X("PID","PID21")="21^00124^Mother's Identifier"
|
---|
283 | S X("PID","PID22")="22^00125^Ethnic Group"
|
---|
284 | S X("PID","PID23")="23^00126^Birth Place"
|
---|
285 | S X("PID","PID24")="24^00127^Multiple Birth Indicator"
|
---|
286 | S X("PID","PID25")="25^00128^Birth Order"
|
---|
287 | S X("PID","PID26")="26^00129^Citizenship"
|
---|
288 | S X("PID","PID27")="27^00130^Veteran.s Military Status"
|
---|
289 | S X("PID","PID28")="28^00739^Nationality"
|
---|
290 | S X("PID","PID29")="29^00740^Patient Death Date/Time"
|
---|
291 | S X("PID","PID30")="30^00741^Patient Death Indicator"
|
---|
292 | S X("NTE","NTE1")="1^00573^Set ID - NTE"
|
---|
293 | S X("NTE","NTE2")="2^00574^Source of Comment"
|
---|
294 | S X("NTE","NTE3")="3^00575^Comment"
|
---|
295 | S X("ORC","ORC1")="1^00215^Order Control"
|
---|
296 | S X("ORC","ORC2")="2^00216^Placer Order Number"
|
---|
297 | S X("ORC","ORC3")="3^00217^Filler Order Number"
|
---|
298 | S X("ORC","ORC4")="4^00218^Placer Order Number"
|
---|
299 | S X("ORC","ORC5")="5^00219^Order Status"
|
---|
300 | S X("ORC","ORC6")="6^00220^Response Flag"
|
---|
301 | S X("ORC","ORC7")="7^00221^Quantity/Timing"
|
---|
302 | S X("ORC","ORC8")="8^00222^Parent"
|
---|
303 | S X("ORC","ORC9")="9^00223^Date/Time of Transaction"
|
---|
304 | S X("ORC","ORC10")="10^00224^Entered By"
|
---|
305 | S X("ORC","ORC11")="11^00225^Verified By"
|
---|
306 | S X("ORC","ORC12")="12^00226^Ordering Provider"
|
---|
307 | S X("ORC","ORC13")="13^00227^Enterer's Location"
|
---|
308 | S X("ORC","ORC14")="14^00228^Call Back Phone Number"
|
---|
309 | S X("ORC","ORC15")="15^00229^Order Effective Date/Time"
|
---|
310 | S X("ORC","ORC16")="16^00230^Order Control Code Reason"
|
---|
311 | S X("ORC","ORC17")="17^00231^Entering Organization"
|
---|
312 | S X("ORC","ORC18")="18^00232^Entering Device"
|
---|
313 | S X("ORC","ORC19")="19^00233^Action By"
|
---|
314 | S X("OBR","OBR1")="1^00237^Set ID - Observation Request"
|
---|
315 | S X("OBR","OBR2")="2^00216^Placer Order Number"
|
---|
316 | S X("OBR","OBR3")="3^00217^Filler Order Number"
|
---|
317 | S X("OBR","OBR4")="4^00238^Universal Service ID"
|
---|
318 | S X("OBR","OBR4;LOINC")="4;1^00238^Universal Service ID - LOINC^RESULTCODE"
|
---|
319 | S X("OBR","OBR4;DESC")="4;2^00238^Universal Service ID - DESC^RESULTDESCRIPTIONTEXT"
|
---|
320 | S X("OBR","OBR4;VACODE")="4;3^00238^Universal Service ID - VACODE^RESULTCODINGSYSTEM"
|
---|
321 | S X("OBR","OBR5")="5^00239^Priority"
|
---|
322 | S X("OBR","OBR6")="6^00240^Requested Date/Time"
|
---|
323 | S X("OBR","OBR7")="7^00241^Observation Date/Time^RESULTASSESSMENTDATETIME"
|
---|
324 | S X("OBR","OBR8")="8^00242^Observation End Date/Time"
|
---|
325 | S X("OBR","OBR9")="9^00243^Collection Volume"
|
---|
326 | S X("OBR","OBR10")="10^00244^Collector Identifier"
|
---|
327 | S X("OBR","OBR11")="11^00245^Specimen Action Code"
|
---|
328 | S X("OBR","OBR12")="12^00246^Danger Code"
|
---|
329 | S X("OBR","OBR13")="13^00247^Relevant Clinical Info."
|
---|
330 | S X("OBR","OBR14")="14^00248^Specimen Rcv'd. Date/Time"
|
---|
331 | S X("OBR","OBR15")="15^00249^Specimen Source"
|
---|
332 | S X("OBR","OBR16")="16^00226^Ordering Provider XCN^RESULTSOURCEACTORID"
|
---|
333 | S X("OBR","OBR17")="17^00250^Order Callback Phone Number"
|
---|
334 | S X("OBR","OBR18")="18^00251^Placers Field 1"
|
---|
335 | S X("OBR","OBR19")="19^00252^Placers Field 2"
|
---|
336 | S X("OBR","OBR20")="20^00253^Filler Field 1"
|
---|
337 | S X("OBR","OBR21")="21^00254^Filler Field 2"
|
---|
338 | S X("OBR","OBR22")="22^00255^Results Rpt./Status Change"
|
---|
339 | S X("OBR","OBR23")="23^00256^Charge to Practice"
|
---|
340 | S X("OBR","OBR24")="24^00257^Diagnostic Service Sect"
|
---|
341 | S X("OBR","OBR25")="25^00258^Result Status^RESULTSTATUS"
|
---|
342 | S X("OBR","OBR26")="26^00259^Parent Result"
|
---|
343 | S X("OBR","OBR27")="27^00221^Quantity/Timing"
|
---|
344 | S X("OBR","OBR28")="28^00260^Result Copies to"
|
---|
345 | S X("OBR","OBR29")="29^00261^Parent Number"
|
---|
346 | S X("OBR","OBR30")="30^00262^Transportation Mode"
|
---|
347 | S X("OBR","OBR31")="31^00263^Reason for Study"
|
---|
348 | S X("OBR","OBR32")="32^00264^Principal Result Interpreter"
|
---|
349 | S X("OBR","OBR33")="33^00265^Assistant Result Interpreter"
|
---|
350 | S X("OBR","OBR34")="34^00266^Technician"
|
---|
351 | S X("OBR","OBR35")="35^00267^Transcriptionist"
|
---|
352 | S X("OBR","OBR36")="36^00268^Scheduled Date/Time"
|
---|
353 | S X("OBR","OBR37")="37^01028^Number of Sample Containers"
|
---|
354 | S X("OBR","OBR38")="38^38^01029 Transport Logistics of Collected Sample"
|
---|
355 | S X("OBR","OBR39")="39^01030^Collector.s Comment"
|
---|
356 | S X("OBR","OBR40")="40^01031^Transport Arrangement Responsibility"
|
---|
357 | S X("OBR","OBR41")="41^01032^Transport Arranged"
|
---|
358 | S X("OBR","OBR42")="42^01033^Escort Required"
|
---|
359 | S X("OBR","OBR43")="43^01034^Planned Patient Transport Comment"
|
---|
360 | S X("OBX","OBX1")="1^00559^Set ID - OBX"
|
---|
361 | S X("OBX","OBX2")="2^00676^Value Type"
|
---|
362 | S X("OBX","OBX3")="3^00560^Observation Identifier"
|
---|
363 | S X("OBX","OBX3;C1")="3;1^00560^Observation Identifier^C1"
|
---|
364 | S X("OBX","OBX3;C2")="3;2^00560^Observation Identifier^C2"
|
---|
365 | S X("OBX","OBX3;C3")="3;3^00560^Observation Identifier^C3"
|
---|
366 | S X("OBX","OBX3;C4")="3;4^00560^Observation Identifier^C4"
|
---|
367 | S X("OBX","OBX3;C5")="3;5^00560^Observation Identifier^C5"
|
---|
368 | S X("OBX","OBX3;C6")="3;6^00560^Observation Identifier^C6"
|
---|
369 | S X("OBX","OBX4")="4^00769^Observation Sub-Id"
|
---|
370 | S X("OBX","OBX5")="5^00561^Observation Results^RESULTTESTVALUE"
|
---|
371 | S X("OBX","OBX6")="6^00562^Units^RESULTTESTUNITS"
|
---|
372 | S X("OBX","OBX7")="7^00563^Reference Range^RESULTTESTNORMALDESCTEXT"
|
---|
373 | S X("OBX","OBX8")="8^00564^Abnormal Flags^RESULTTESTFLAG"
|
---|
374 | S X("OBX","OBX9")="9^00639^Probability"
|
---|
375 | S X("OBX","OBX10")="10^00565^Nature of Abnormal Test"
|
---|
376 | S X("OBX","OBX11")="11^00566^Observ. Result Status^RESULTTESTSTATUSTEXT"
|
---|
377 | S X("OBX","OBX12")="12^00567^Date Last Normal Value"
|
---|
378 | S X("OBX","OBX13")="13^00581^User Defined Access Checks"
|
---|
379 | S X("OBX","OBX14")="14^00582^Date/Time of Observation^RESULTTESTDATETIME"
|
---|
380 | S X("OBX","OBX15")="15^00583^Producer.s ID^RESULTTESTSOURCEACTORID"
|
---|
381 | S X("OBX","OBX16")="16^00584^Responsible Observer"
|
---|
382 | S X("OBX","OBX17")="17^00936^Observation Method"
|
---|
383 | K ^TMP("C0CCCR","LABTBL")
|
---|
384 | M ^TMP("C0CCCR","LABTBL")=X ; SET VALUES IN LAB TBL
|
---|
385 | S ^TMP("C0CCCR","LABTBL",0)="V3"
|
---|
386 | Q
|
---|
387 | ;
|
---|