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

BKMQQCR1.m

Go to the documentation of this file.
BKMQQCR1 ;PRXM/HC/BWF - BKMV Quality of Care Report; [ 1/19/2005  7:16 PM ]
 ;;2.2;HIV MANAGEMENT SYSTEM;**2**;Apr 01, 2015;Build 3
 ; Quality of Care Audit Report
 Q
CD4CHK ; EP - CD4 algorithm
 N HIVDT,HIVDT12,SITETAX,SITETAX1,LOINTAX,LOINTAX1,CPTTAX,CPTTAX1,GLOBAL,GLOBAL2,GLOBAL3
 N TOTPTS,BKMDFN,TREF
 S HIVDT=$$FMADD^XLFDT(EDATE,-122) ;***
 S HIVDT12=$$FMADD^XLFDT(EDATE,-365) ; CD4 last 12 months for PCP and MAC Prophylaxis
 S TREF=$NA(^TMP("BKMTAX",UID)) K @TREF
 S SITETAX="BGP CD4 TAX"
 S SITETAX1="BKMV CD4 ABS TESTS TAX"
 S LOINTAX="BGP CD4 LOINC CODES"
 S LOINTAX1="BKMV CD4 ABS LOINC CODES"
 S CPTTAX="BGP CD4 CPTS"
 S CPTTAX1="BKMV CD4 ABS CPTS"
 S GLOBAL=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""CD4ALL"",VSTDT,TEST)"
 S GLOBAL2=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""CD4ABS"",VSTDT,TEST)"
 S GLOBAL3=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""CD4ABS12"",VSTDT,TEST)"
 S TOTPTS=$P(GLOB,")")_",""HIVCHK"",""CD4PTCNT"")"
 S BKMDFN=0,@TOTPTS=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .N CPT,EDT,HDT,GBL
 .S CPT=CPTTAX_$C(29)_CPTTAX1_$C(29)_CPTTAX1
 .S EDT=EDATE_$C(29)_EDATE_$C(29)_EDATE
 .S HDT=HIVDT_$C(29)_HIVDT_$C(29)_HIVDT12
 .S GBL=GLOBAL_$C(29)_GLOBAL2_$C(29)_GLOBAL3
 .D CPTTAX^BKMIXX(BKMDFN,CPT,EDT,HDT,GBL)
 .K CPT,EDT,HDT,GBL
 .;D CPTTAX^BKMIXX(BKMDFN,CPTTAX,EDATE,HIVDT,GLOBAL)
 .;D CPTTAX^BKMIXX(BKMDFN,CPTTAX1,EDATE,HIVDT,GLOBAL2)
 .;D CPTTAX^BKMIXX(BKMDFN,CPTTAX1,EDATE,HIVDT12,GLOBAL3)
 .;F TAX=LOINCTAX,SITETAX D BLDTAX^BKMIXX5(TAX,.TREF)
 .;D LAB^BKMIXX6(BKMDFN,.TREF,EDATE,HIVDT,GLOBAL)
 .D LOINC^BKMIXX(BKMDFN,LOINTAX,EDATE,HIVDT,GLOBAL)
 .D LABTAX^BKMIXX(BKMDFN,SITETAX,EDATE,HIVDT,GLOBAL)
 .;
 .D LOINC^BKMIXX(BKMDFN,LOINTAX1,EDATE,HIVDT,GLOBAL2)
 .D LABTAX^BKMIXX(BKMDFN,SITETAX1,EDATE,HIVDT,GLOBAL2)
 .;
 .D LOINC^BKMIXX(BKMDFN,LOINTAX1,EDATE,HIVDT12,GLOBAL3)
 .D LABTAX^BKMIXX(BKMDFN,SITETAX1,EDATE,HIVDT12,GLOBAL3)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"CD4ALL"))!$D(@GLOB@("HIVCHK",BKMDFN,"CD4ABS")) S @TOTPTS=@TOTPTS+1
 Q
VRLLD ; EP - Viral Load Check
 N VRLDT,SITETAX,LOINTAX,CPTTAX,GLOBAL,GLOBAL2,TOTPTS,BKMDFN
 S VRLDT=$$FMADD^XLFDT(EDATE,-122) ;***
 S SITETAX="BGP HIV VIRAL LOAD TAX"
 S LOINTAX="BGP VIRAL LOAD LOINC CODES"
 S CPTTAX="BGP HIV VIRAL LOAD CPTS"
 S GLOBAL=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""VRL"",VSTDT,TEST)"
 S TOTPTS=$P(GLOB,")")_",""HIVCHK"",""VRLPTCNT"")"
 S BKMDFN=0,@TOTPTS=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .D CPTTAX^BKMIXX(BKMDFN,CPTTAX,EDATE,VRLDT,GLOBAL)
 .D LOINC^BKMIXX(BKMDFN,LOINTAX,EDATE,VRLDT,GLOBAL)
 .D LABTAX^BKMIXX(BKMDFN,SITETAX,EDATE,VRLDT,GLOBAL)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"VRL")) S @TOTPTS=@TOTPTS+1
 Q
RPR ; EP - Rapid Plasma Reagin tests
 N RPRDT,SITETAX,LOINTAX,CPTTAX,GLOBAL,GLOBAL2,REFGLOB,TOTPTS,BKMDFN
 N SITETAX1,LOINTAX1,CPTTAX1
 S RPRDT=$$FMADD^XLFDT(EDATE,-365)
 S SITETAX="BKM RPR TAX"
 S LOINTAX="BKM RPR LOINC CODES"
 S CPTTAX="BKM RPR CPTS"
 S SITETAX1="BKM FTA-ABS TEST TAX"
 S LOINTAX1="BKM FTA-ABS LOINC CODES"
 S CPTTAX1="BKM FTA-ABS CPTS"
 S GLOBAL=$P(GLOB,")")_",""HIVCHK"",DFN,""RPR"",VSTDT,TEST)"
 S REFGLOB=$P(GLOB,")")_",""HIVCHK"",DFN,""RPRREF"",VSTDT,TEST)"
 S TOTPTS=$P(GLOB,")")_",""HIVCHK"",""RPRPTCNT"")"
 S BKMDFN=0,@TOTPTS=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .;D CPTTAX^BKMIXX(BKMDFN,CPTTAX,EDATE,RPRDT,GLOBAL)
 .D LOINC^BKMIXX(BKMDFN,LOINTAX,EDATE,RPRDT,GLOBAL)
 .D LABTAX^BKMIXX(BKMDFN,SITETAX,EDATE,RPRDT,GLOBAL)
 .;D CPTTAX^BKMIXX(BKMDFN,CPTTAX1,EDATE,RPRDT,GLOBAL)
 .N CPT,EDT,RDT,GBL
 .S CPT=CPTTAX_$C(29)_CPTTAX1
 .S EDT=EDATE_$C(29)_EDATE
 .S RDT=RPRDT_$C(29)_RPRDT
 .S GBL=GLOBAL_$C(29)_GLOBAL
 .D CPTTAX^BKMIXX(BKMDFN,CPT,EDT,RDT,GBL)
 .K CPT,EDT,RDT,GBL
 .D LOINC^BKMIXX(BKMDFN,LOINTAX1,EDATE,RPRDT,GLOBAL)
 .D LABTAX^BKMIXX(BKMDFN,SITETAX1,EDATE,RPRDT,GLOBAL)
 .D REFUSAL^BKMIXX2(BKMDFN,60,LOINTAX,EDATE,RPRDT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,60,SITETAX,EDATE,RPRDT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,60,LOINTAX1,EDATE,RPRDT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,60,SITETAX1,EDATE,RPRDT,REFGLOB)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"RPR"))!$D(@GLOB@("HIVCHK",BKMDFN,"RPRREF")) S @TOTPTS=@TOTPTS+1
 Q
CRC ; EP - Colorectal Cancer Screen
 ;Patients who needed a CRC in the 10 years prior to end date of the report.
 ;Defined as including patients:
 ; 1) Greater than or equal to 50 years of age
 ; 2) No CRC diagnosis ever (DX.18)
 ; 3) No history of a total Colectomy (P.06)
 ;
 N CRCDT,GLOBAL,GLOBAL1,REFGLOB,CPTTAX,ICDTAX,CPTTAX1,PRCTAX,PRCTAX1,PRCTAX2
 N CPTTAX2,CPTTAX3,CPTTAX4,CPTTAX5,LOINTAX,SITETAX,TOTPTS,BKMDFN,AGEDT
 S CRCDT=$$FMADD^XLFDT(EDATE,-3650),AGEDT=$$FMADD^XLFDT(EDATE,-365)\1
 S GLOBAL=$P(GLOB,")")_",""HIVCHK"",DFN,""NOCRC"",VSTDT,TEST)"
 S GLOBAL1=$P(GLOB,")")_",""HIVCHK"",DFN,""CRC"",VSTDT,TEST)"
 S REFGLOB=$P(GLOB,")")_",""HIVCHK"",DFN,""CRCREF"",VSTDT,TEST)"
 S CPTTAX="BGP COLORECTAL CANCER CPTS"
 S ICDTAX="BGP COLORECTAL CANCER DXS"
 S CPTTAX1="BGP TOTAL CHOLECTOMY CPTS"
 S PRCTAX="BGP TOTAL CHOLECTOMY PROCS"
 S PRCTAX1="BGP SIG PROCS"
 S PRCTAX2="BGP COLO PROCS"
 S CPTTAX2="BGP COLO CPTS"
 S CPTTAX3="BGP FOBT CPTS"
 S CPTTAX4="BTPW SIGMOID CPTS"
 S CPTTAX5="BGP BE CPTS"
 S LOINTAX="BGP FOBT LOINC CODES"
 S SITETAX="BGP GPRA FOB TESTS"
 S TOTPTS=$P(GLOB,")")_",""HIVCHK"",""CRCCNT"")"
 S BKMDFN=0,@TOTPTS=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .; Age at beginning of reporting period
 .I $$AGE^BQIAGE(BKMDFN,AGEDT)<50 Q
 .D ICDTAX^BKMIXX1(BKMDFN,ICDTAX,EDATE,CRCDT,GLOBAL)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"NOCRC")) Q
 .D CPTTAX^BKMIXX(BKMDFN,CPTTAX,EDATE,CRCDT,GLOBAL)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"NOCRC")) Q
 .D CPTTAX^BKMIXX(BKMDFN,CPTTAX1,EDATE,CRCDT,GLOBAL)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"NOCRC")) Q
 .D PRCTAX^BKMIXX1(BKMDFN,PRCTAX,EDATE,CRCDT,GLOBAL)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"NOCRC")) Q
 .; Patient needs CRC
 .S @TOTPTS=@TOTPTS+1
 .; Check CRC Screens
 .; *** if only checking for presence of Screening or Refusal, same check ***
 .; *** as for NOCRC above can be applied here.                           ***
 .;D CPTTAX^BKMIXX(BKMDFN,CPTTAX2,EDATE,CRCDT,GLOBAL1)
 .;D CPTTAX^BKMIXX(BKMDFN,CPTTAX3,EDATE,CRCDT,GLOBAL1)
 .;D CPTTAX^BKMIXX(BKMDFN,CPTTAX4,EDATE,CRCDT,GLOBAL1)
 .;D CPTTAX^BKMIXX(BKMDFN,CPTTAX5,EDATE,CRCDT,GLOBAL1)
 .N CPT,EDT,CDT,GBL
 .S CPT=CPTTAX2_$C(29)_CPTTAX3_$C(29)_CPTTAX4_$C(29)_CPTTAX5
 .S EDT=EDATE_$C(29)_EDATE_$C(29)_EDATE_$C(29)_EDATE
 .S CDT=CRCDT_$C(29)_CRCDT_$C(29)_CRCDT_$C(29)_CRCDT
 .S GBL=GLOBAL1_$C(29)_GLOBAL1_$C(29)_GLOBAL1_$C(29)_GLOBAL1
 .D CPTTAX^BKMIXX(BKMDFN,CPT,EDT,CDT,GBL)
 .K CPT,EDT,CDT,GBL
 .D PRCTAX^BKMIXX1(BKMDFN,PRCTAX1,EDATE,CRCDT,GLOBAL1)
 .D PRCTAX^BKMIXX1(BKMDFN,PRCTAX2,EDATE,CRCDT,GLOBAL1)
 .D ICDTAX^BKMIXX1(BKMDFN,"BGP COLO DXS",EDATE,CRCDT,GLOBAL1)
 .D LOINC^BKMIXX(BKMDFN,LOINTAX,EDATE,CRCDT,GLOBAL1)
 .D LABTAX^BKMIXX(BKMDFN,SITETAX,EDATE,CRCDT,GLOBAL1)
 .; May get taxonomy for hard coded values for Flex Sig, Double Contrast Barium Enema, Colonoscopy and FOBT
 .; If not these will need to be dealt with.
 .D REFUSAL^BKMIXX2(BKMDFN,60,LOINTAX,EDATE,CRCDT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,60,SITETAX,EDATE,CRCDT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,81,CPTTAX2,EDATE,CRCDT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,81,CPTTAX3,EDATE,CRCDT,REFGLOB)
 Q
HEPC ; EP - Hepatitis C Screen Baseline
 ;Total # of patients with a Hepatitis C Screen (T.13; T.14)
 ;baseline completed or refused ever.
 ;
 N HEPCDT,GLOBAL,REFGLOB,CPTTAX,LOINTAX,SITETAX,CPTTAX1,LOINTAX1
 N SITETAX1,TOTPTS,BKMDFN,RHEPCDT
 S HEPCDT=""
 ; Refused in past year
 S RHEPCDT=$$FMADD^XLFDT(EDATE,-365)
 S GLOBAL=$P(GLOB,")")_",""HIVCHK"",DFN,""HEPC"",VSTDT,TEST)"
 S REFGLOB=$P(GLOB,")")_",""HIVCHK"",DFN,""HEPCREF"",VSTDT,TEST)"
 S CPTTAX="BKM HEP C SCREEN TESTS CPTS"
 S LOINTAX="BKM HEP C SCREEN LOINC CODES"
 S SITETAX="BKM HEP C SCREENING TAX"
 S CPTTAX1="BKM HEP C CONFIRM TESTS CPTS"
 S LOINTAX1="BKM HEP C CONFIRM LOINC CODES"
 S SITETAX1="BKM HEP C CONFIRMATORY TAX"
 S TOTPTS=$P(GLOB,")")_",""HIVCHK"",""HEPCCNT"")"
 S BKMDFN=0,@TOTPTS=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .;D CPTTAX^BKMIXX(BKMDFN,CPTTAX,EDATE,HEPCDT,GLOBAL)
 .D LOINC^BKMIXX(BKMDFN,LOINTAX,EDATE,HEPCDT,GLOBAL)
 .D LABTAX^BKMIXX(BKMDFN,SITETAX,EDATE,HEPCDT,GLOBAL)
 .;D CPTTAX^BKMIXX(BKMDFN,CPTTAX1,EDATE,HEPCDT,GLOBAL)
 .N CPT,EDT,HDT,GBL
 .S CPT=CPTTAX_$C(29)_CPTTAX1
 .S EDT=EDATE_$C(29)_EDATE
 .S HDT=HEPCDT_$C(29)_HEPCDT
 .S GBL=GLOBAL_$C(29)_GLOBAL
 .D CPTTAX^BKMIXX(BKMDFN,CPT,EDT,HDT,GBL)
 .K CPT,EDT,HDT,GBL
 .D LOINC^BKMIXX(BKMDFN,LOINTAX1,EDATE,HEPCDT,GLOBAL)
 .D LABTAX^BKMIXX(BKMDFN,SITETAX1,EDATE,HEPCDT,GLOBAL)
 .D REFUSAL^BKMIXX2(BKMDFN,81,CPTTAX,EDATE,RHEPCDT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,60,LOINTAX,EDATE,RHEPCDT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,60,SITETAX,EDATE,RHEPCDT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,81,CPTTAX1,EDATE,RHEPCDT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,60,LOINTAX1,EDATE,RHEPCDT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,60,SITETAX1,EDATE,RHEPCDT,REFGLOB)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"HEPC"))!$D(@GLOB@("HIVCHK",BKMDFN,"HEPCREF")) S @TOTPTS=@TOTPTS+1
 Q