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

BKMVQCR8.m

Go to the documentation of this file.
BKMVQCR8 ;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,DFN,TOT5YR,TOTB5YR,VSTDT,HVSTDT,CNT,CNT1,CNT2,PTOTAL
 N REFVSTDT,PNDT5
 S PTOTAL=$G(^TMP("BKMVQCR",$J,"HIVTOT1"))
 S PNTOT=$G(^TMP("BKMVQCR",$J,"HIVCHK","PNEUMOCNT"))
 I PNTOT<1 Q
 S PNDT5=$$FMADD^XLFDT(EDATE,-1825)
 S DFN=0,(TOTB5YR,TOT5YR)=0,(CNT,CNT1,CNT2)=0
 F  S DFN=$O(^TMP("BKMVQCR",$J,"HIVCHK",DFN)) Q:'DFN  D
 .S VSTDT=0,TOT5YR=0,TOTB5YR=0
 .F  S VSTDT=$O(^TMP("BKMVQCR",$J,"HIVCHK",DFN,"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(^TMP("BKMVQCR",$J,"HIVCHK",DFN,"PNEUMOREF",""),-1)
 .I REFVSTDT]"",$$FMDIFF^XLFDT(REFVSTDT,EDATE,1)'>365 S CNT=CNT+1
 I CNT=0 Q
 S ^TMP("BKMVQCR",$J,"PNEUMOT","TOTAL","CNT")=CNT
 S ^TMP("BKMVQCR",$J,"PNEUMOT","TOTAL","PERC")=CNT/PTOTAL*100
 S ^TMP("BKMVQCR",$J,"PNEUMOT","2B45YR","CNT")=CNT2
 S ^TMP("BKMVQCR",$J,"PNEUMOT","2B45YR","PERC")=CNT2/CNT*100
 S ^TMP("BKMVQCR",$J,"PNEUMOT","5YR","CNT")=CNT1
 S ^TMP("BKMVQCR",$J,"PNEUMOT","5YR","PERC")=CNT1/CNT*100
 Q
TETCALC ; EP - Tetanus Calculation
 N TETTOT,PTOTAL
 S PTOTAL=$G(^TMP("BKMVQCR",$J,"HIVTOT1"))
 S TETTOT=$G(^TMP("BKMVQCR",$J,"HIVCHK","TETPTCNT"))
 ; NOTE: Refusals were checked earlier and are included in TETPTCNT.
 I TETTOT=0 Q
 S ^TMP("BKMVQCR",$J,"TETT","TOTAL","CNT")=TETTOT
 S ^TMP("BKMVQCR",$J,"TETT","TOTAL","PERC")=TETTOT/PTOTAL*100
 Q
EYECALC ; EP - Eye exam Calculation
 N EYETOT,PTOTAL
 S PTOTAL=$G(^TMP("BKMVQCR",$J,"HIVTOT1"))
 S EYETOT=$G(^TMP("BKMVQCR",$J,"HIVCHK","EYEPTCNT"))
 ; NOTE: Refusals were checked earlier and are included in EYEPTCNT.
 I EYETOT=0 Q
 S ^TMP("BKMVQCR",$J,"EYET","TOTAL","CNT")=EYETOT
 S ^TMP("BKMVQCR",$J,"EYET","TOTAL","PERC")=EYETOT/PTOTAL*100
 Q
DENTCALC ;EP - Dental exam calculation
 N DENTTOT,PTOTAL
 S PTOTAL=$G(^TMP("BKMVQCR",$J,"HIVTOT1"))
 S DENTTOT=$G(^TMP("BKMVQCR",$J,"HIVCHK","DENTPTCNT"))
 ; NOTE: Refusals were checked earlier and are included in DENTPTCNT.
 I DENTTOT=0 Q
 S ^TMP("BKMVQCR",$J,"DENTT","TOTAL","CNT")=DENTTOT
 S ^TMP("BKMVQCR",$J,"DENTT","TOTAL","PERC")=DENTTOT/PTOTAL*100
 Q
PAPCALC ; EP - Pap Smear Calculation
 N PAPT,FTOTAL
 S FTOTAL=$G(^TMP("BKMVQCR",$J,"FEMALE"))
 I FTOTAL=0 Q
 S PAPT=$G(^TMP("BKMVQCR",$J,"HIVCHK","PAPPTCNT"))
 ; NOTE: Refusals were checked earlier and are included in PAPPTCNT.
 S ^TMP("BKMVQCR",$J,"PAPT","TOTAL","CNT")=PAPT
 S ^TMP("BKMVQCR",$J,"PAPT","TOTAL","PERC")=PAPT/FTOTAL*100
 Q