Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BQICAEP1

BQICAEP1.m

Go to the documentation of this file.
BQICAEP1 ;VNGT/HS/ALA-Dept of EPI Comm Alert Logic ; 25 May 2011  2:28 PM
 ;;2.5;ICARE MANAGEMENT SYSTEM;**1**;May 24, 2016;Build 17
 ;
 ;
CHL(BQDFN,RESULT) ;EP - Chlamydia
 NEW UID,TREF,TAX,X
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 K RESULT
 S RESULT(1)=0,CT=1
 S TREF=$NA(^TMP(UID,"BQITAX")) K @TREF
 F TAX="BQI C.TRACH SPECIFIC LOINC","BQI C.TRACH NON-SPECIFIC LOINC","BQI C.TRACH DNA QUANT LOINC" D BLD^BQITUTL(TAX,.TREF)
 F TAX="BQI C.TRACH SPECIFIC TAX","BQI C.TRACH NON-SPECIFIC TAX","BQI C.TRACH DNA QUANT TAX" D BLD^BQITUTL(TAX,.TREF,"L")
 S SEARCH(1)="POS"_U_"=",SEARCH(2)="0"_U_">"
 S X=$$LAB^BQICAUTL(TMFRAME,0,BQDFN,"",.SEARCH,.TREF)
 I X D LB(X,CT)
 K SEARCH,@TREF
 Q
 ;
HEPB(BQDFN,RESULT) ;EP - Hep B
 NEW UID,TREF,TAX,X
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 K RESULT
 S RESULT(1)=0,CT=1
 S TREF=$NA(^TMP(UID,"BQITAX")) K @TREF
 F TAX="BQI HEP B QUAL TEST LOINC","BQI HEP B QUANT TEST LOINC" D BLD^BQITUTL(TAX,.TREF)
 F TAX="BQI HEP B QUAL TEST TAX","BQI HEP B QUANT TEST TAX" D BLD^BQITUTL(TAX,.TREF,"L")
 S SEARCH(1)="POS"_U_"=",SEARCH(2)="0"_U_">"
 S X=$$LAB^BQICAUTL(TMFRAME,0,BQDFN,"",.SEARCH,.TREF)
 I X D LB(X,CT)
 K SEARCH,@TREF
 Q
 ;
HEPC(BQDFN,RESULT) ;EP - Hepatitis C
 NEW UID,TREF,TAX,X
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 K RESULT
 S RESULT(1)=0,CT=1
 S TREF=$NA(^TMP(UID,"BQITAX")) K @TREF
 F TAX="BQI HEP C QUAL TEST LOINC","BQI HEP C QUANT TEST LOINC" D BLD^BQITUTL(TAX,.TREF)
 F TAX="BQI HEP C QUAL TEST TAX","BQI HEP C QUANT TEST TAX" D BLD^BQITUTL(TAX,.TREF,"L")
 S SEARCH(1)="POS"_U_"=",SEARCH(2)="1"_U_"'<"
 S X=$$LAB^BQICAUTL(TMFRAME,0,BQDFN,"",.SEARCH,.TREF)
 K SEARCH,@TREF
 ; if neither one found, quit
 I 'X K @TREF Q
 ; check whether other HEP tests are negative
 D
 . NEW X1,X2
 . K @TREF
 . S TAX="BQI HEP A TESTS LOINC" D BLD^BQITUTL(TAX,.TREF)
 . S TAX="BQI HEP A TESTS TAX" D BLD^BQITUTL(TAX,.TREF,"L")
 . S SEARCH(1)="NEG"_U_"=",SEARCH(2)="1"_U_"<"
 . S X1=$$LAB^BQICAUTL(TMFRAME,0,BQDFN,"",.SEARCH,.TREF)
 . K @TREF
 . S TAX="BQI HEP B CORE TEST LOINC" D BLD^BQITUTL(TAX,.TREF)
 . S TAX="BQI HEP B CORE TESTS TAX" D BLD^BQITUTL(TAX,.TREF,"L")
 . S X2=$$LAB^BQICAUTL(TMFRAME,0,BQDFN,"",.SEARCH,.TREF)
 . I 'X1!('X2) D  Q
 .. I 'X1,$P(X1,U,2)="No Test" D LB(X,CT) Q
 .. I 'X2,$P(X2,U,2)="No Test" D LB(X,CT) Q
 . ; if both tests are negative
 . I X1!(X2) D LB(X,CT) Q
 K @TREF
 Q
 ;
HIV(BQDFN,RESULT) ;EP - HIV
 NEW UID,TREF,TAX,X
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 K RESULT
 S RESULT(1)=0,CT=1
 S TREF=$NA(^TMP(UID,"BQITAX")) K @TREF
 F TAX="BQI HIV AB QUAL SCREEN LOINC","BQI HIV QUAL CONFIRM LOINC" D BLD^BQITUTL(TAX,.TREF)
 F TAX="BQI HIV AB QUAL SCREEN TAX","BQI HIV QUAL CONFIRM TAX" D BLD^BQITUTL(TAX,.TREF,"L")
 F TAX="BQI HIV ID SPEC CONFIRM LOINC","BQI HIV QUAL NUC ACID LOINC" D BLD^BQITUTL(TAX,.TREF)
 F TAX="BQI HIV ID SPEC CONFIRM TAX","BQI HIV QUAL NUC ACID TAX" D BLD^BQITUTL(TAX,.TREF,"L")
 F TAX="BQI HIV QUAL ANTIGEN LOINC","BQI HIV VIROLOGIC TEST LOINC" D BLD^BQITUTL(TAX,.TREF)
 F TAX="BQI HIV QUAL ANTIGEN TAX","BQI HIV VIROLOGIC TEST TAX" D BLD^BQITUTL(TAX,.TREF,"L")
 F TAX="BQI HIV AB QUANT SCREEN LOINC","BQI HIV QUANT CONFIRM LOINC" D BLD^BQITUTL(TAX,.TREF)
 F TAX="BQI HIV AB QUANT SCREEN TAX","BQI HIV QUANT CONFIRM TAX" D BLD^BQITUTL(TAX,.TREF,"L")
 F TAX="BQI HIV QUANT NUC ACID LOINC","BQI HIV QUANT ANTIGEN LOINC" D BLD^BQITUTL(TAX,.TREF)
 F TAX="BQI HIV QUANT NUC ACID TAX","BQI HIV QUANT ANTIGEN TAX" D BLD^BQITUTL(TAX,.TREF,"L")
 S SEARCH(1)="POS"_U_"=",SEARCH(2)="0"_U_">"
 S X=$$LAB^BQICAUTL(TMFRAME,0,BQDFN,"",.SEARCH,.TREF)
 I X D LB(X,CT) Q
 K @TREF
 F TAX="BGP CD4 LOINC CODES","BKMV CD4 ABS LOINC CODES","BGP VIRAL LOAD LOINC CODES" D BLD^BQITUTL(TAX,.TREF)
 F TAX="BGP CD4 TAX","BKMV CD4 ABS TESTS TAX","BGP HIV VIRAL LOAD TAX" D BLD^BQITUTL(TAX,.TREF,"L")
 S X=$$LAB^BQITRUTL(TMFRAME,0,BQDFN,"","","'=","","",.TREF)
 I X D LB(X,CT) Q
 K @TREF
 F TAX="BGP CD4 CPTS","BKMV CD4 ABS CPTS","BGP HIV VIRAL LOAD CPTS" D BLD^BQITUTL(TAX,.TREF)
 S X=$$TAX^BQITRUTL(TMFRAME,"",1,BQDFN,9000010.18,0,1,.TREF,"","")
 I X D
 . S $P(X,U,6)=$P(^AUPNVCPT($P(X,U,5),0),U,1)
 . D LB(X,CT)
 K @TREF
 Q
 ;
DRGP(BQDFN,RESULT) ;EP -
 NEW UID,TREF,TAX,DX,LX1,LX2
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 K RESULT
 S RESULT(1)=0,CT=1
 S DX=$$TAX^BQITRUTL(TMFRAME,"BQI PNEUMOCOCCAL DXS",1,BQDFN,9000010.07,"","",.TREF)
 ;
 S TREF=$NA(^TMP(UID,"BQITAX")) K @TREF
 S TAX="BQI S PNEUM CULTURE TEST LOINC" D BLD^BQITUTL(TAX,.TREF)
 S TAX="BQI S PNEUM CULTURE TEST TAX" D BLD^BQITUTL(TAX,.TREF,"L")
 S SEARCH(1)="POS"_U_"="
 S LX1=$$LAB^BQICAUTL(TMFRAME,0,BQDFN,"",.SEARCH,.TREF)
 K @TREF
 S TAX="BQI S PNEUM SUSCEPT TEST LOINC" D BLD^BQITUTL(TAX,.TREF)
 S TAX="BQI S PNEUM SUSCEPT TEST TAX" D BLD^BQITUTL(TAX,.TREF,"L")
 S LX2=$$LAB^BQICAUTL(TMFRAME,0,BQDFN,"",.SEARCH,.TREF)
 ;
 I LX1,LX2 D
 . D LB(LX1,CT) S CT=CT+1 D LB(LX2,CT)
 . I DX D DXF^BQICAEP2(DX)
 K @TREF,SEARCH
 Q
 ;
INVP(BQDFN,RESULT) ; EP -
 NEW UID,TREF,TAX,DX,LX1,LX2
 K RESULT
 S RESULT(1)=0,CT=1
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DX=$$TAX^BQITRUTL(TMFRAME,"BQI PNEUMOCOCCAL DXS",1,BQDFN,9000010.07,"","",.TREF)
 ;
 S TREF=$NA(^TMP(UID,"BQITAX")) K @TREF
 S TAX="BQI S PNEUM CULTURE TEST LOINC" D BLD^BQITUTL(TAX,.TREF)
 S TAX="BQI S PNEUM CULTURE TEST TAX" D BLD^BQITUTL(TAX,.TREF,"L")
 S SEARCH(1)="POS"_U_"="
 S LX1=$$LAB^BQICAUTL(TMFRAME,0,BQDFN,"",.SEARCH,.TREF)
 K @TREF
 S TAX="BQI S PNEUM SUSCEPT TEST LOINC" D BLD^BQITUTL(TAX,.TREF)
 S TAX="BQI S PNEUM SUSCEPT TEST TAX" D BLD^BQITUTL(TAX,.TREF,"L")
 S SEARCH(1)="NEG"_U_"="
 S LX2=$$LAB^BQICAUTL(TMFRAME,0,BQDFN,"",.SEARCH,.TREF)
 ;
 I LX1,LX2 D
 . D LB(LX1,CT) S CT=CT+1 D LB(LX2,CT)
 . I DX D DXF^BQICAEP2(DX)
 K @TREF
 Q
 ;
LB(LX,CT) ;EP
 NEW LDATE
 S RESULT(CT)=LX
 S LDATE=$P(RESULT(CT),U,2),$P(RESULT(CT),U,2)=$$DATE^BQIUL1(LDATE)
 K @TREF
 Q