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

BKMQQCR2.m

Go to the documentation of this file.
BKMQQCR2 ;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
CHLAM ; EP - Chlamydia Tests
 N CHDT,SITETAX,LOINTAX,CPTTAX,ICDTAX,PRCTAX,GLOBAL,GLOBAL2,REFGLOB,TOTPTS,BKMDFN
 S CHDT=$$FMADD^XLFDT(EDATE,-365)
 S SITETAX="BGP CHLAMYDIA TESTS TAX"
 S LOINTAX="BGP CHLAMYDIA LOINC CODES"
 S CPTTAX="BTPW CHLAMYDIA CPTS"
 ;S PRCTAX="BGP CHLAMYDIA TEST PROCEDURES"
 S ICDTAX="BQI CHLAMYDIA SCREEN DXS"
 S GLOBAL=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""CHLAM"",VSTDT,TEST)"
 S REFGLOB=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""CHLAMREF"",VSTDT,TEST)"
 S TOTPTS=$P(GLOB,")")_",""HIVCHK"",""CHLAMPTCNT"")"
 S BKMDFN=0,@TOTPTS=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .;D PRCTAX^BKMIXX1(BKMDFN,PRCTAX,EDATE,CHDT,GLOBAL)
 .D ICDTAX^BKMIXX1(BKMDFN,ICDTAX,EDATE,CHDT,GLOBAL)
 .D CPTTAX^BKMIXX(BKMDFN,CPTTAX,EDATE,CHDT,GLOBAL)
 .D LOINC^BKMIXX(BKMDFN,LOINTAX,EDATE,CHDT,GLOBAL)
 .D LABTAX^BKMIXX(BKMDFN,SITETAX,EDATE,CHDT,GLOBAL)
 .D REFUSAL^BKMIXX2(BKMDFN,60,LOINTAX,EDATE,CHDT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,60,SITETAX,EDATE,CHDT,REFGLOB)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"CHLAM"))!$D(@GLOB@("HIVCHK",BKMDFN,"CHLAMREF")) S @TOTPTS=@TOTPTS+1
 Q
GON ; EP - Gonorrhea Tests
 N GONDT,SITETAX,LOINTAX,CPTTAX,GLOBAL,GLOBAL2,REFGLOB,TOTPTS,BKMDFN
 S GONDT=$$FMADD^XLFDT(EDATE,-365)
 S SITETAX="BKM GONORRHEA TEST TAX"
 S LOINTAX="BKM GONORRHEA LOINC CODES"
 S CPTTAX="BKM GONORRHEA TESTS CPTS"
 S GLOBAL=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""GON"",VSTDT,TEST)"
 S REFGLOB=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""GONREF"",VSTDT,TEST)"
 S TOTPTS=$P(GLOB,")")_",""HIVCHK"",""GONPTCNT"")"
 S BKMDFN=0,@TOTPTS=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .D CPTTAX^BKMIXX(BKMDFN,CPTTAX,EDATE,GONDT,GLOBAL)
 .D LOINC^BKMIXX(BKMDFN,LOINTAX,EDATE,GONDT,GLOBAL)
 .D LABTAX^BKMIXX(BKMDFN,SITETAX,EDATE,GONDT,GLOBAL)
 .D REFUSAL^BKMIXX2(BKMDFN,60,LOINTAX,EDATE,GONDT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,60,SITETAX,EDATE,GONDT,REFGLOB)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"GON"))!$D(@GLOB@("HIVCHK",BKMDFN,"GONREF")) S @TOTPTS=@TOTPTS+1
 Q
TBT21 ; EP - Tuberculosis Status
 N TBT21DT,SITETAX,LOINTAX,CPTTAX,CVXTAX,ICDTAX,ICDTAX1,MEDTAX,NDCTAX
 N GLOBAL,GLOBAL1,GLOBAL2,REFGLOB,TOTPTS,BKMDFN
 S TBT21DT=""
 S CPTTAX="BKM PPD CPTS"
 S LOINTAX="BKM PPD LOINC CODES"
 S SITETAX="BKM PPD TAX"
 S CVXTAX="BKM PPD CVX CODES"
 S ICDTAX="BKM PPD ICDS"
 S ICDTAX1="DM AUDIT PROBLEM TB DXS"
 S MEDTAX="BKM TB MEDS"
 S NDCTAX="BKM TB MED NDCS"
 S GLOBAL=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""TBT21"",VSTDT,TEST)"
 S GLOBAL1=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""TBT21MED"",VSTDT,TEST)"
 S GLOBAL2=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""TBT21DX"",VSTDT,TEST)"
 S GLOBAL3=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""TBT21POSNEG"",VSTDT,TEST)"
 S REFGLOB=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""TBT21REF"",VSTDT,TEST)"
 S TOTPTS=$P(GLOB,")")_",""HIVCHK"",""TBT21PTCNT"")"
 S BKMDFN=0,@TOTPTS=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .D ICDTAX^BKMIXX1(BKMDFN,ICDTAX,EDATE,TBT21DT,GLOBAL)
 .D ICDTAX^BKMIXX1(BKMDFN,ICDTAX1,EDATE,TBT21DT,GLOBAL2)
 .D CPTTAX^BKMIXX(BKMDFN,CPTTAX,EDATE,TBT21DT,GLOBAL)
 .D SKNTAX^BKMIXX1(BKMDFN,"21",EDATE,TBT21DT,GLOBAL3)
 .D CVXTAX^BKMIXX1(BKMDFN,CVXTAX,EDATE,TBT21DT,GLOBAL)
 .D LOINC^BKMIXX(BKMDFN,LOINTAX,EDATE,TBT21DT,GLOBAL3)
 .M @GLOB@("HIVCHK",BKMDFN,"TBT21")=@GLOB@("HIVCHK",BKMDFN,"TBT21POSNEG")
 .D LABTAX^BKMIXX(BKMDFN,SITETAX,EDATE,TBT21DT,GLOBAL)
 .D MEDTAX^BKMIXX(BKMDFN,MEDTAX,EDATE,TBT21DT,GLOBAL1)
 .D NDCTAX^BKMIXX1(BKMDFN,NDCTAX,EDATE,TBT21DT,GLOBAL1)
 .D REFUSAL^BKMIXX2(BKMDFN,9999999.28,"21",EDATE,TBT21DT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,9999999.14,CVXTAX,EDATE,TBT21DT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,60,LOINTAX,EDATE,TBT21DT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,60,SITETAX,EDATE,TBT21DT,REFGLOB)
 .; Store Medication refusals in same global as regular Medications.
 .D REFUSAL^BKMIXX2(BKMDFN,50,MEDTAX,EDATE,TBT21DT,GLOBAL1)
 .D REFUSAL^BKMIXX2(BKMDFN,50,NDCTAX,EDATE,TBT21DT,GLOBAL1)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"TBT21"))!$D(@GLOB@("HIVCHK",BKMDFN,"TBT21REF"))!$D(@GLOB@("HIVCHK",BKMDFN,"TBT21MED")) S @TOTPTS=@TOTPTS+1 Q
 Q
PNEUMO ; EP - Pneumovax Status
 N PNEUMODT,CPTTAX,CVXTAX,ICDTAX,PRCTAX,GLOBAL,REFGLOB,TOTPTS,BKMDFN
 S PNEUMODT=""
 S CVXTAX="BKM PNEUMO IZ CVX CODES"
 S ICDTAX="BQI PNEUMO IZ DXS"
 S PRCTAX="BQI PNEUMO IZ PROCEDURES"
 S CPTTAX="BGP PNEUMO IZ CPTS"
 S GLOBAL=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""PNEUMO"",VSTDT,TEST)"
 S REFGLOB=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""PNEUMOREF"",VSTDT,TEST)"
 S TOTPTS=$P(GLOB,")")_",""HIVCHK"",""PNEUMOCNT"")"
 S BKMDFN=0,@TOTPTS=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .D ICDTAX^BKMIXX1(BKMDFN,ICDTAX,EDATE,PNEUMODT,GLOBAL)
 .D CPTTAX^BKMIXX(BKMDFN,CPTTAX,EDATE,PNEUMODT,GLOBAL)
 .D PRCTAX^BKMIXX1(BKMDFN,PRCTAX,EDATE,PNEUMODT,GLOBAL)
 .D CVXTAX^BKMIXX1(BKMDFN,CVXTAX,EDATE,PNEUMODT,GLOBAL)
 .D REFUSAL^BKMIXX2(BKMDFN,9999999.14,CVXTAX,EDATE,PNEUMODT,REFGLOB)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"PNEUMO"))!$D(@GLOB@("HIVCHK",BKMDFN,"PNEUMOREF")) S @TOTPTS=@TOTPTS+1
 Q
LIPIDS ; EP - Lipids Screening
 N LIPDT,LOINTAX,LABTAX,GLOBAL,REFGLOB,GLOBAL1,TOTPTS,BKMDFN,MEDTAX,NDCTAX,CPTTAX
 S LIPDT=$$FMADD^XLFDT(EDATE,-365)
 S LOINTAX="BGP LIPID PROFILE LOINC CODES"
 S CPTTAX="BGP LIPID PROFILE CPTS"
 S SITETAX="DM AUDIT LIPID PROFILE TAX"
 S GLOBAL=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""LIPID"",VSTDT,TEST)"
 S REFGLOB=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""LIPIDREF"",VSTDT,TEST)"
 S GLOBAL1=$P(GLOB,")")_",""HIVCHK"",BKMDFN,""LIPIDARV"",VSTDT,TEST)"
 S TOTPTS=$P(GLOB,")")_",""HIVCHK"",""LIPIDCNT"")"
 S BKMDFN=0,@TOTPTS=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .;D LOINC^BKMIXX(BKMDFN,LOINTAX,EDATE,LIPDT,GLOBAL)
 .;D LABTAX^BKMIXX(BKMDFN,SITETAX,EDATE,LIPDT,GLOBAL)
 .D GETLAB(LOINTAX,BKMDFN,EDATE,LIPDT,GLOBAL)
 .D GETLAB(SITETAX,BKMDFN,EDATE,LIPDT,GLOBAL)
 .D CPTTAX^BKMIXX(BKMDFN,CPTTAX,EDATE,LIPDT,GLOBAL)
 .D REFUSAL^BKMIXX2(BKMDFN,60,LOINTAX,EDATE,LIPDT,REFGLOB)
 .D REFUSAL^BKMIXX2(BKMDFN,60,SITETAX,EDATE,LIPDT,REFGLOB)
 .I '$D(@GLOB@("HIVCHK",BKMDFN,"LIPID")),'$D(@GLOB@("HIVCHK",BKMDFN,"LIPIDREF")) Q
 .S @TOTPTS=@TOTPTS+1
 .I '$D(@GLOB@("HIVCHK",BKMDFN,"LIPID")) Q
 .; Identify who is receiving ARV meds
 .F MEDTAX="BKMV NNRTI MEDS","BKMV NRTI MEDS","BKMV PI MEDS" D  I $D(@GLOB@("HIVCHK",BKMDFN,"LIPIDARV")) Q
 ..D MEDTAX^BKMIXX(BKMDFN,MEDTAX,EDATE,LIPDT,GLOBAL1)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"LIPIDARV")) Q
 .F MEDTAX="BKMV EI MEDS","BKMV II MEDS","BKMV NRTI/NNRTI MEDS" D  I $D(@GLOB@("HIVCHK",BKMDFN,"LIPIDARV")) Q
 ..D MEDTAX^BKMIXX(BKMDFN,MEDTAX,EDATE,LIPDT,GLOBAL1)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"LIPIDARV")) Q
 .F MEDTAX="BKMV NRTI COMBO MEDS","BKMV PI BOOSTER MEDS" D  I $D(@GLOB@("HIVCHK",BKMDFN,"LIPIDARV")) Q
 ..D MEDTAX^BKMIXX(BKMDFN,MEDTAX,EDATE,LIPDT,GLOBAL1)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"LIPIDARV")) Q
 .F NDCTAX="BKMV NNRTI MED NDCS","BKMV NRTI MED NDCS","BKMV PI MED NDCS" D  I $D(@GLOB@("HIVCHK",BKMDFN,"LIPIDARV")) Q
 ..D NDCTAX^BKMIXX1(BKMDFN,NDCTAX,EDATE,LIPDT,GLOBAL1)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"LIPIDARV")) Q
 .F NDCTAX="BKMV EI MED NDCS","BKMV II MED NDCS","BKMV NRTI/NNRTI MED NDCS" D  I $D(@GLOB@("HIVCHK",BKMDFN,"LIPIDARV")) Q
 ..D NDCTAX^BKMIXX1(BKMDFN,NDCTAX,EDATE,LIPDT,GLOBAL1)
 .I $D(@GLOB@("HIVCHK",BKMDFN,"LIPIDARV")) Q
 .F NDCTAX="BKMV NRTI COMBO MED NDCS","BKMV PI BOOSTER MED NDCS" D  I $D(@GLOB@("HIVCHK",BKMDFN,"LIPIDARV")) Q
 ..D NDCTAX^BKMIXX1(BKMDFN,NDCTAX,EDATE,LIPDT,GLOBAL1)
 Q
GETLAB(TAX,DFN,EDATE,SDATE,TARGET) ; EP
 ; Get lab result associated with a lab panel for a patient
 ;
 N RESULT,LAB,LB,IEN,TEST,VISIT,VSTDT
 S RESULT=""
 D BLDTAX^BKMIXX5(TAX,"LAB")
 S LAB=""
 F  S LAB=$O(LAB(LAB)) Q:LAB=""  I $O(^LAB(60,LAB,2)) D
 . S IEN=0
 . F  S IEN=$O(^LAB(60,LAB,2,IEN)) Q:'IEN  S LB=$G(^(IEN,0)) I LB'="" S LAB(LB)=""
 S TEST="" ;,LDATE=$G(LDATE,""),LIEN=$G(LIEN,"")
 F  S TEST=$O(^AUPNVLAB("AC",DFN,TEST),-1) Q:TEST=""  D
 .S LAB=$$GET1^DIQ(9000010.09,TEST,.01,"I")
 .I LAB="" Q
 .I '$D(LAB(LAB)) Q
 .S VISIT=$$GET1^DIQ(9000010.09,TEST,.03,"I")
 .S VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
 .I $G(SDATE)'="",(VSTDT<SDATE) Q
 .I $G(EDATE)'="",(VSTDT\1>EDATE) Q
 .;I VSTDT>LDATE S LDATE=VSTDT,LIEN=TEST
 .;I VSTDT=LDATE,TEST>LIEN S LDATE=VSTDT,LIEN=TEST
 .S RESULT=$$GET1^DIQ(9000010.09,TEST,.04,"I")
 .I $G(TARGET)]"" S @TARGET=RESULT
 Q