GPLALABS ; CCDCCR/GPL - CCR/CCD PROCESSING FOR LAB RESULTS ; 10/01/08 ;;0.3;CCDCCR;nopatch;noreleasedate ;Copyright 2008 WorldVistA. Licensed under the terms of the GNU ;General Public License See attached copy of the License. ; ;This program is free software; you can redistribute it and/or modify ;it under the terms of the GNU General Public License as published by ;the Free Software Foundation; either version 2 of the License, or ;(at your option) any later version. ; ;This program is distributed in the hope that it will be useful, ;but WITHOUT ANY WARRANTY; without even the implied warranty of ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;GNU General Public License for more details. ; ;You should have received a copy of the GNU General Public License along ;with this program; if not, write to the Free Software Foundation, Inc., ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ; EXTRACT(LABXML,DFN,LABOUTXML) ; EXTRACT LABS INTO PROVIDED XML TEMPLATE ; ; LABXML AND LABOUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED ; ; ; ; N C0CPTID,C0CSPC,C0CSDT,C0CEDT,C0CR ; SET UP FOR LAB API CALL S C0CPTID=$$SSN^CCRDPT(DFN) ; GET THE SSN FOR THIS PATIENT I C0CPTID="" D Q ; NO SSN, COMPLAIN AND QUIT . W "LAB LOOKUP FAILED, NO SSN",! S C0CSPC="*" ; LOOKING FOR ALL LABS D DT^DILF(,"T-5000",.C0CSDT) ; START DATE LONG AGO TO GET EVERYTHING D DT^DILF(,"T",.C0CEDT) ; END DATE TODAY TO GET EVERYTHING S C0CR=$$GCPR^LA7QRY(C0CPTID,C0CSDT,C0CEDT,C0CSPC,C0CSPC) ; CALL LAB LOOKUP W "i'm back",! Q ; LIST ; LIST THE HL7 MESSAGE ; ; N C0CI,C0CJ,C0COBT,C0CHB ; D EXTRACT^GPLLABS(,1,) S C0CTAB=$NA(^KBAI) ; BASE OF OBX TABLE S C0CHB=$NA(^TMP("HLS",$J)) S C0CI="" F S C0CI=$O(@C0CHB@(C0CI)) Q:C0CI="" D ; FOR ALL RECORDS IN HL7 MSG . S C0CTYP=$P(@C0CHB@(C0CI),"|",1) . D LTYP(@C0CHB@(C0CI),C0CTYP) . W C0CI," ",C0CTYP,! . ; S C0CI=$O(@C0CHB@(C0CI)) Q LTYP(OSEG,OTYP) ; S OTAB=$NA(@C0CTAB@(OTYP)) ; TABLE FOR SEGMENT TYPE I OTYP="OBX" D ; RIGHT NOW JUST OBX . S OI="" ; INDEX INTO SEGS . F S OI=$O(@OTAB@(OI)) Q:OI="" D ; FOR EACH ELEMENT OF THE SEGMENT . . S OV=$P(OSEG,"|",$P(@OTAB@(OI),"^",1)) ; PULL OUT VALUE . . I OV'="" W OI_": "_$P(@OTAB@(OI),"^",3),": ",OV,! Q LOBX ; Q ;