source: ccr/trunk/p/GPLLABS.m@ 250

Last change on this file since 250 was 250, checked in by George Lilly, 16 years ago

testing LABs

File size: 2.2 KB
Line 
1GPLALABS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR LAB RESULTS ; 10/01/08
2 ;;0.3;CCDCCR;nopatch;noreleasedate
3 ;Copyright 2008 WorldVistA. Licensed under the terms of the GNU
4 ;General Public License See attached copy of the License.
5 ;
6 ;This program is free software; you can redistribute it and/or modify
7 ;it under the terms of the GNU General Public License as published by
8 ;the Free Software Foundation; either version 2 of the License, or
9 ;(at your option) any later version.
10 ;
11 ;This program is distributed in the hope that it will be useful,
12 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;GNU General Public License for more details.
15 ;
16 ;You should have received a copy of the GNU General Public License along
17 ;with this program; if not, write to the Free Software Foundation, Inc.,
18 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ;
20EXTRACT(LABXML,DFN,LABOUTXML) ; EXTRACT LABS INTO PROVIDED XML TEMPLATE
21 ;
22 ; LABXML AND LABOUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED
23 ;
24 ;
25 ;
26 ; N C0CPTID,C0CSPC,C0CSDT,C0CEDT,C0CR
27 ; SET UP FOR LAB API CALL
28 S C0CPTID=$$SSN^CCRDPT(DFN) ; GET THE SSN FOR THIS PATIENT
29 I C0CPTID="" D Q ; NO SSN, COMPLAIN AND QUIT
30 . W "LAB LOOKUP FAILED, NO SSN",!
31 S C0CSPC="*" ; LOOKING FOR ALL LABS
32 D DT^DILF(,"T-5000",.C0CSDT) ; START DATE LONG AGO TO GET EVERYTHING
33 D DT^DILF(,"T",.C0CEDT) ; END DATE TODAY TO GET EVERYTHING
34 S C0CR=$$GCPR^LA7QRY(C0CPTID,C0CSDT,C0CEDT,C0CSPC,C0CSPC) ; CALL LAB LOOKUP
35 W "i'm back",!
36 Q
37 ;
38LIST ; LIST THE HL7 MESSAGE
39 ;
40 ; N C0CI,C0CJ,C0COBT,C0CHB
41 ; D EXTRACT^GPLLABS(,1,)
42 S C0CTAB=$NA(^KBAI) ; BASE OF OBX TABLE
43 S C0CHB=$NA(^TMP("HLS",$J))
44 S C0CI=""
45 F S C0CI=$O(@C0CHB@(C0CI)) Q:C0CI="" D ; FOR ALL RECORDS IN HL7 MSG
46 . S C0CTYP=$P(@C0CHB@(C0CI),"|",1)
47 . D LTYP(@C0CHB@(C0CI),C0CTYP)
48 . W C0CI," ",C0CTYP,!
49 . ; S C0CI=$O(@C0CHB@(C0CI))
50 Q
51LTYP(OSEG,OTYP) ;
52 S OTAB=$NA(@C0CTAB@(OTYP)) ; TABLE FOR SEGMENT TYPE
53 I OTYP="OBX" D ; RIGHT NOW JUST OBX
54 . S OI="" ; INDEX INTO SEGS
55 . F S OI=$O(@OTAB@(OI)) Q:OI="" D ; FOR EACH ELEMENT OF THE SEGMENT
56 . . S OV=$P(OSEG,"|",$P(@OTAB@(OI),"^",1)) ; PULL OUT VALUE
57 . . I OV'="" W OI_": "_$P(@OTAB@(OI),"^",3),": ",OV,!
58 Q
59LOBX ;
60 Q
61 ;
Note: See TracBrowser for help on using the repository browser.