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

BKMQQCR8.m

Go to the documentation of this file.
BKMQQCR8 ;PRXM/HC/BWF - BKMV Quality of Care Report; [ 1/19/2005  7:16 PM ] ; 28 Apr 2005  3:44 PM
 ;;2.1;HIV MANAGEMENT SYSTEM;;Feb 07, 2011
 ; Quality of Care Audit Report
 Q
PNEUMOC ; EP - Pneumo Calculation
 N PNTOT,BKMDFN,TOT5YR,TOTB5YR,VSTDT,HVSTDT,CNT,CNT1,CNT2,PTOTAL
 N REFVSTDT,PNDT5
 S PTOTAL=$G(@GLOB@("HIVTOT1"))
 S PNTOT=$G(@GLOB@("HIVCHK","PNEUMOCNT"))
 I PNTOT<1 Q
 S PNDT5=$$FMADD^XLFDT(EDATE,-1825)
 S BKMDFN=0,(TOTB5YR,TOT5YR)=0,(CNT,CNT1,CNT2)=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .S VSTDT=0,TOT5YR=0,TOTB5YR=0
 .F  S VSTDT=$O(@GLOB@("HIVCHK",BKMDFN,"PNEUMO",VSTDT)) Q:VSTDT=""  D
 ..I VSTDT>PNDT5 S TOT5YR=TOT5YR+1
 ..S TOTB5YR=TOTB5YR+1
 .;We only want patients who have 1+ result in last 5 years, or 2+ results ever (including last 5 years)
 .I TOT5YR>0 S CNT1=CNT1+1,CNT=CNT+1 Q
 .I TOTB5YR>1 S CNT2=CNT2+1,CNT=CNT+1 Q
 .; Also include any refusals in the past year.
 .S REFVSTDT=$O(@GLOB@("HIVCHK",BKMDFN,"PNEUMOREF",""),-1)
 .I REFVSTDT]"",$$FMDIFF^XLFDT(REFVSTDT,EDATE,1)'>365 S CNT=CNT+1
 I CNT=0 Q
 S @GLOB@("PNEUMOT","TOTAL","CNT")=CNT
 S @GLOB@("PNEUMOT","TOTAL","PERC")=CNT/PTOTAL*100
 S @GLOB@("PNEUMOT","2B45YR","CNT")=CNT2
 S @GLOB@("PNEUMOT","2B45YR","PERC")=CNT2/CNT*100
 S @GLOB@("PNEUMOT","5YR","CNT")=CNT1
 S @GLOB@("PNEUMOT","5YR","PERC")=CNT1/CNT*100
 Q
TETCALC ; EP - Tetanus Calculation
 N TETTOT,PTOTAL
 S PTOTAL=$G(@GLOB@("HIVTOT1"))
 S TETTOT=$G(@GLOB@("HIVCHK","TETPTCNT"))
 ; NOTE: Refusals were checked earlier and are included in TETPTCNT.
 I TETTOT=0 Q
 S @GLOB@("TETT","TOTAL","CNT")=TETTOT
 S @GLOB@("TETT","TOTAL","PERC")=TETTOT/PTOTAL*100
 Q
EYECALC ; EP - Eye exam Calculation
 N EYETOT,PTOTAL
 S PTOTAL=$G(@GLOB@("HIVTOT1"))
 S EYETOT=$G(@GLOB@("HIVCHK","EYEPTCNT"))
 ; NOTE: Refusals were checked earlier and are included in EYEPTCNT.
 I EYETOT=0 Q
 S @GLOB@("EYET","TOTAL","CNT")=EYETOT
 S @GLOB@("EYET","TOTAL","PERC")=EYETOT/PTOTAL*100
 Q
DENTCALC ;EP - Dental exam calculation
 N DENTTOT,PTOTAL
 S PTOTAL=$G(@GLOB@("HIVTOT1"))
 S DENTTOT=$G(@GLOB@("HIVCHK","DENTPTCNT"))
 ; NOTE: Refusals were checked earlier and are included in DENTPTCNT.
 I DENTTOT=0 Q
 S @GLOB@("DENTT","TOTAL","CNT")=DENTTOT
 S @GLOB@("DENTT","TOTAL","PERC")=DENTTOT/PTOTAL*100
 Q
PAPCALC ; EP - Pap Smear Calculation
 N PAPT,FTOTAL
 S FTOTAL=$G(@GLOB@("FEMALE"))
 I FTOTAL=0 Q
 S PAPT=$G(@GLOB@("HIVCHK","PAPPTCNT"))
 ; NOTE: Refusals were checked earlier and are included in PAPPTCNT.
 S @GLOB@("PAPT","TOTAL","CNT")=PAPT
 S @GLOB@("PAPT","TOTAL","PERC")=PAPT/FTOTAL*100
 Q
LIPCALC ; EP - Lipids Calculation
 N CNT1,CNT2,LIPTOT,BKMDFN,PTOTAL
 N DFNSTAT,REFVSTDT
 S PTOTAL=$G(@GLOB@("HIVTOT1"))
 S LIPTOT=$G(@GLOB@("HIVCHK","LIPIDCNT")) I 'LIPTOT Q
 S (BKMDFN,CNT1,CNT2)=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .I '$D(@GLOB@("HIVCHK",BKMDFN,"LIPID")),'$D(@GLOB@("HIVCHK",BKMDFN,"LIPIDREF")) Q
 .I $D(@GLOB@("HIVCHK",BKMDFN,"LIPIDARV")) S CNT1=CNT1+1
 .I $D(@GLOB@("HIVCHK",BKMDFN,"LIPIDREF")) S CNT2=CNT2+1
 S @GLOB@("LIPT","TOTAL","PERC")=LIPTOT/PTOTAL*100
 S @GLOB@("LIPT","TOTAL","CNT")=LIPTOT
 S @GLOB@("LIPT","LIPIDARV","PERC")=CNT1/LIPTOT*100
 S @GLOB@("LIPT","LIPIDARV","CNT")=CNT1
 S @GLOB@("LIPT","LIPIDREF","PERC")=CNT2/LIPTOT*100
 S @GLOB@("LIPT","LIPIDREF","CNT")=CNT2
 Q
HEPCCALC ; EP - Hep C Calculation
 N HEPCTOT,PTOTAL
 N DFNSTAT,REFVSTDT
 S PTOTAL=$G(@GLOB@("HIVTOT1"))
 S HEPCTOT=$G(@GLOB@("HIVCHK","HEPCCNT")) I 'HEPCTOT Q
 S @GLOB@("HEPCT","TOTAL","PERC")=HEPCTOT/PTOTAL*100
 S @GLOB@("HEPCT","TOTAL","CNT")=HEPCTOT
 Q
CRCCALC ; EP - Colorectal Cancer Screen Calculation
 N CNT1,CNT2,CRCTOT,BKMDFN,PTOTAL
 N DFNSTAT,REFVSTDT
 S PTOTAL=$G(@GLOB@("HIVTOT1"))
 S CRCTOT=$G(@GLOB@("HIVCHK","CRCCNT")) I 'CRCTOT Q
 S (BKMDFN,CNT1,CNT2)=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .I '$D(@GLOB@("HIVCHK",BKMDFN,"CRC")),'$D(@GLOB@("HIVCHK",BKMDFN,"CRCREF")) Q
 .S CNT1=CNT1+1
 .I $D(@GLOB@("HIVCHK",BKMDFN,"CRCREF")) S CNT2=CNT2+1
 S @GLOB@("CRCT","TOTAL","PERC")=CRCTOT/PTOTAL*100
 S @GLOB@("CRCT","TOTAL","CNT")=CRCTOT
 S @GLOB@("CRCT","CRC","PERC")=CNT1/CRCTOT*100
 S @GLOB@("CRCT","CRC","CNT")=CNT1
 S @GLOB@("CRCT","CRCR","PERC")=CNT2/CRCTOT*100
 S @GLOB@("CRCT","CRCR","CNT")=CNT2
 Q