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

BKMQQCR6.m

Go to the documentation of this file.
BKMQQCR6 ;PRXM/HC/BWF - BKMV Quality of Care Report; [ 1/19/2005  7:16 PM ]
 ;;2.1;HIV MANAGEMENT SYSTEM;;Feb 07, 2011
 ; Quality of Care Audit Report
 Q
CD4CALC ; EP - CD4 calculation
 N CD4TOT,BKMDFN,CNT1,CNT2,CNT3,CNT4,CNT5,CNT6,FOUND,FOUND1,FOUND2,VSTDT,TEST,CD4CNT,PTOTAL
 S PTOTAL=$G(@GLOB@("HIVTOT1"))
 S CD4TOT=$G(@GLOB@("HIVCHK","CD4PTCNT"))
 I CD4TOT=""!(CD4TOT=0) Q
 S BKMDFN=0,(CNT1,CNT2,CNT3,CNT4,CNT5,CNT6)=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .I '$D(@GLOB@("HIVCHK",BKMDFN,"CD4ABS")),'$D(@GLOB@("HIVCHK",BKMDFN,"CD4ALL")) Q
 .S VSTDT="",(FOUND,FOUND1,FOUND2)=0
 .F  S VSTDT=$O(@GLOB@("HIVCHK",BKMDFN,"CD4ABS",VSTDT),-1) Q:VSTDT=""!(FOUND&FOUND1&FOUND2)  D
 ..S TEST=""
 ..F  S TEST=$O(@GLOB@("HIVCHK",BKMDFN,"CD4ABS",VSTDT,TEST),-1) Q:TEST=""!(FOUND&FOUND1&FOUND2)  D
 ...S CD4CNT=$P($G(@GLOB@("HIVCHK",BKMDFN,"CD4ABS",VSTDT,TEST)),U)
 ...I CD4CNT'?1N.E Q
 ...;S FOUND=1
 ...I CD4CNT<50,'FOUND1 S:'FOUND CNT1=CNT1+1,FOUND=1 S FOUND1=1 Q
 ...I CD4CNT<200,'FOUND2 S:'FOUND CNT2=CNT2+1,FOUND=1 S FOUND2=1 Q
 ...S:'FOUND CNT3=CNT3+1
 ...S FOUND=1
 .I 'FOUND S CNT4=CNT4+1 Q  ; Includes patients with no ABS test but with an ALL test.
 .;I FOUND1 S CNT5=CNT5+1
 .;I FOUND2 S CNT6=CNT6+1
 S BKMDFN=0,(CNT5,CNT6)=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .I '$D(@GLOB@("HIVCHK",BKMDFN,"CD4ABS12")) Q
 .S VSTDT="",(FOUND,FOUND1,FOUND2)=0
 .F  S VSTDT=$O(@GLOB@("HIVCHK",BKMDFN,"CD4ABS12",VSTDT),-1) Q:VSTDT=""!(FOUND1&FOUND2)  D
 ..S TEST=""
 ..F  S TEST=$O(@GLOB@("HIVCHK",BKMDFN,"CD4ABS12",VSTDT,TEST),-1) Q:TEST=""!(FOUND1&FOUND2)  D
 ...S CD4CNT=$P($G(@GLOB@("HIVCHK",BKMDFN,"CD4ABS12",VSTDT,TEST)),U)
 ...I CD4CNT'?1N.E Q
 ...;S FOUND=1
 ...I CD4CNT<50,'FOUND1 S FOUND1=1 Q
 ...I CD4CNT<200,'FOUND2 S FOUND2=1 Q
 .I FOUND1 S CNT5=CNT5+1
 .I FOUND2 S CNT6=CNT6+1
 S @GLOB@("CD4T","TOTAL","CNT")=CD4TOT
 S @GLOB@("CD4T","TOTAL","PERC")=CD4TOT/PTOTAL*100
 S @GLOB@("CD4T","LT50","PERC")=CNT1/CD4TOT*100
 S @GLOB@("CD4T","LT50","CNT")=CNT1
 S @GLOB@("CD4T","BET50/200","PERC")=CNT2/CD4TOT*100
 S @GLOB@("CD4T","BET50/200","CNT")=CNT2
 S @GLOB@("CD4T","GTE200","PERC")=CNT3/CD4TOT*100
 S @GLOB@("CD4T","GTE200","CNT")=CNT3
 S @GLOB@("CD4T","UND","PERC")=CNT4/CD4TOT*100
 S @GLOB@("CD4T","UND","CNT")=CNT4
 S @GLOB@("CD4T","LT50 ANY","CNT")=CNT5
 ;S @GLOB@("CD4T","BET50/200 ANY","CNT")=CNT6
 S @GLOB@("CD4T","LT200 ANY","CNT")=CNT5+CNT6 ;***
 Q
VRLLDC ; EP - Viral Load Calculation
 N VRLTOT,BKMDFN,CNT1,CNT2,CNT3,VSTDT,TEST,VRLRES,FOUND,PTOTAL,RES,OPER
 S PTOTAL=$G(@GLOB@("HIVTOT1"))
 S VRLTOT=$G(@GLOB@("HIVCHK","VRLPTCNT"))
 I VRLTOT=""!(VRLTOT=0) Q
 S BKMDFN=0,(CNT1,CNT2,CNT3)=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .I '$D(@GLOB@("HIVCHK",BKMDFN,"VRL")) Q
 .S VSTDT="",FOUND=0
 .F  S VSTDT=$O(@GLOB@("HIVCHK",BKMDFN,"VRL",VSTDT),-1) Q:VSTDT=""!FOUND  D
 ..S TEST=""
 ..F  S TEST=$O(@GLOB@("HIVCHK",BKMDFN,"VRL",VSTDT,TEST),-1) Q:TEST=""!FOUND  D
 ...S VRLRES=$P($G(@GLOB@("HIVCHK",BKMDFN,"VRL",VSTDT,TEST)),U)
 ...I VRLRES=""!(VRLRES?.A) Q
 ...;I VRLRES'?1N.E Q
 ...S FOUND=1
 ...S OPER=$S($E(VRLRES,1)="<":"<",$E(VRLRES,1)=">":">",1:"")
 ...S VRLRES=$S($E(VRLRES,1)?.P:$E(VRLRES,2,99),1:VRLRES)
 ...S RES=100000
 ...I OPER="" S OPER="<"
 ...I OPER="<",@(VRLRES_OPER_RES) S CNT1=CNT1+1 Q
 ...;I VRLRES<100000 S CNT1=CNT1+1 Q
 ...S CNT2=CNT2+1
 .I 'FOUND S CNT3=CNT3+1
 S @GLOB@("VRLT","TOTAL","CNT")=VRLTOT
 S @GLOB@("VRLT","TOTAL","PERC")=VRLTOT/PTOTAL*100
 S @GLOB@("VRLT","LT100K","CNT")=CNT1
 S @GLOB@("VRLT","LT100K","PERC")=CNT1/VRLTOT*100
 S @GLOB@("VRLT","GTE100K","CNT")=CNT2
 S @GLOB@("VRLT","GTE100K","PERC")=CNT2/VRLTOT*100
 S @GLOB@("VRLT","UND","CNT")=CNT3
 S @GLOB@("VRLT","UND","PERC")=CNT3/VRLTOT*100
 Q
RPRCALC ; EP - Rapid Plasma Reagin (and FTA-ABS) Calculation
 N TOTALRPR,BKMDFN,CNT1,CNT2,CNT3,CNT4,CNT5,VSTDT,TEST,RPRRES,PTOTAL,REFVSTDT,DFNSTAT
 S PTOTAL=$G(@GLOB@("HIVTOT1"))
 S TOTALRPR=$G(@GLOB@("HIVCHK","RPRPTCNT"))
 I +TOTALRPR=0 Q
 S BKMDFN=0,(CNT1,CNT2,CNT3,CNT4,CNT5)=0
 F  S BKMDFN=$O(@GLOB@("HIVCHK",BKMDFN)) Q:'BKMDFN  D
 .I '$D(@GLOB@("HIVCHK",BKMDFN,"RPRREF")),'$D(@GLOB@("HIVCHK",BKMDFN,"RPR")) Q
 .S VSTDT="",FOUND=0,DFNSTAT=0
 .F  S VSTDT=$O(@GLOB@("HIVCHK",BKMDFN,"RPR",VSTDT),-1) Q:VSTDT=""  D  Q:FOUND
 ..S TEST=""
 ..F  S TEST=$O(@GLOB@("HIVCHK",BKMDFN,"RPR",VSTDT,TEST),-1) Q:TEST=""  D  Q:FOUND
 ...S RPRRES=$P($G(@GLOB@("HIVCHK",BKMDFN,"RPR",VSTDT,TEST)),U)
 ...I $$POSITIVE^BKMVF32(RPRRES) S DFNSTAT=1,FOUND=1 Q
 ...I $$NEGATIVE^BKMVF32(RPRRES) S DFNSTAT=2,FOUND=1 Q
 .S REFVSTDT=$O(@GLOB@("HIVCHK",BKMDFN,"RPRREF",""),-1)
 .D
 ..I REFVSTDT'="",REFVSTDT>VSTDT D  Q
 ...S TEST=$O(@GLOB@("HIVCHK",BKMDFN,"RPRREF",REFVSTDT,""),-1)
 ...S RPRRES=$P($G(@GLOB@("HIVCHK",BKMDFN,"RPRREF",REFVSTDT,TEST)),U)
 ...I $P(RPRRES,"^")="NOT MEDICALLY INDICATED" S CNT5=CNT5+1 Q
 ...S CNT4=CNT4+1
 ..I DFNSTAT=1 S CNT1=CNT1+1 Q
 ..I DFNSTAT=2 S CNT2=CNT2+1 Q
 ..S CNT3=CNT3+1
 S @GLOB@("RPRT","TOTAL","CNT")=TOTALRPR
 S @GLOB@("RPRT","TOTAL","PERC")=TOTALRPR/PTOTAL*100
 S @GLOB@("RPRT","REAC","CNT")=CNT1
 S @GLOB@("RPRT","REAC","PERC")=CNT1/TOTALRPR*100
 S @GLOB@("RPRT","NONREAC","CNT")=CNT2
 S @GLOB@("RPRT","NONREAC","PERC")=CNT2/TOTALRPR*100
 S @GLOB@("RPRT","UND","CNT")=CNT3
 S @GLOB@("RPRT","UND","PERC")=CNT3/TOTALRPR*100
 S @GLOB@("RPRT","REF","CNT")=CNT4
 S @GLOB@("RPRT","REF","PERC")=CNT4/TOTALRPR*100
 S @GLOB@("RPRT","REFNMI","CNT")=CNT5
 S @GLOB@("RPRT","REFNMI","PERC")=CNT5/TOTALRPR*100
 Q