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

BGPAP4.m

Go to the documentation of this file.
  1. BGPAP4 ; IHS/CMI/LAB -print ind 4 ;
  1. ;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
  1. ;
  1. ;
  1. I4A ;EP ;
  1. ;Q:'$D(BGPIND(9))
  1. D HEADER^BGPAPH
  1. W !,"Indicator 4A: Diabetes-Reduce Diabetic Complications-Assessed for Dyslipidemia"
  1. W !,"Denominator is all patients with a DM diagnosis ever."
  1. W !,"Continue the trend of increasing the proportion of I/T/U clients with"
  1. W !,"diagnosed diabetes who have been assessed for dyslipidemia using LDL as",!,"the screening test.",!,"% with LDL done",!
  1. I $Y>(IOSL-5) D HEADER^BGPAPH Q:BGPQUIT
  1. D H
  1. S BGPRPT=0 F S BGPRPT=$O(BGPSUL(BGPRPT)) Q:BGPRPT'=+BGPRPT!(BGPQUIT) D
  1. .S BGPCYD=$P($$V(BGPRPT,10,10),"!",1)+$P($$V(BGPRPT,10,10),"!",2),BGPCYN=$$V(BGPRPT,14,6),BGPCYP=$S(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
  1. .S BGP98D=$P($$V(BGPRPT,80,10),"!",1)+$P($$V(BGPRPT,80,10),"!",2),BGP98N=$$V(BGPRPT,84,6),BGP98P=$S(BGP98D:((BGP98N/BGP98D)*100),1:"")
  1. .S BGPPRD=$P($$V(BGPRPT,40,10),"!",1)+$P($$V(BGPRPT,40,10),"!",2),BGPPRN=$$V(BGPRPT,44,6),BGPPRP=$S(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
  1. .D LOCW Q:BGPQUIT
  1. Q
  1. I4B ;EP ;
  1. ;Q:'$D(BGPIND(10))
  1. D HEADER^BGPAPH
  1. W !,"Indicator 4B: Diabetes-Reduce Diabetic Complications-Assessed for Dyslipidemia"
  1. W !,"Denominator is all patients with a DM diagnosis ever, with at least",!,"2 visits in the year prior to the end of the time period and the first",!,"ever recorded diagnosis of Diabetes > 1year prior to the end of the time period."
  1. W !,"Continue the trend of increasing the proportion of I/T/U clients with"
  1. W !,"diagnosed diabetes who have been assessed for dyslipidemia using LDL as",!,"the screening test.",!,"% with LDL done",!
  1. I $Y>(IOSL-5) D HEADER^BGPAPH Q:BGPQUIT
  1. D H
  1. S BGPRPT=0 F S BGPRPT=$O(BGPSUL(BGPRPT)) Q:BGPRPT'=+BGPRPT!(BGPQUIT) D
  1. .S BGPCYD=$$V(BGPRPT,12,5),BGPCYN=$$V(BGPRPT,14,14),BGPCYP=$S(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
  1. .S BGP98D=$$V(BGPRPT,82,5),BGP98N=$$V(BGPRPT,84,14),BGP98P=$S(BGP98D:((BGP98N/BGP98D)*100),1:"")
  1. .S BGPPRD=$$V(BGPRPT,42,5),BGPPRN=$$V(BGPRPT,44,14),BGPPRP=$S(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
  1. .D LOCW Q:BGPQUIT
  1. Q
  1. I4C ;EP ;
  1. ;Q:'$D(BGPIND(11))
  1. D HEADER^BGPAPH
  1. W !,"Indicator 4C: Diabetes-Reduce Diabetic Complications-Assessed for Dyslipidemia"
  1. W !,"Denominator is all patients with a DM diagnosis ever, who are 19 or older",!,"who had at least 2 diabetes related encounters ever, at least one",!,"encounter in a primary clinic with a primary provider for diabetes,"
  1. W !,"and an absence of a creatinine value of 5.0 or greater."
  1. W !,"Continue the trend of increasing the proportion of I/T/U clients with"
  1. W !,"diagnosed diabetes who have been assessed for dyslipidemia using LDL as",!,"the screening test.",!,"% with LDL done",!
  1. I $Y>(IOSL-5) D HEADER^BGPAPH Q:BGPQUIT
  1. D H
  1. S BGPRPT=0 F S BGPRPT=$O(BGPSUL(BGPRPT)) Q:BGPRPT'=+BGPRPT!(BGPQUIT) D
  1. .S BGPCYD=$$V(BGPRPT,12,10),BGPCYN=$$V(BGPRPT,14,22),BGPCYP=$S(BGPCYD:((BGPCYN/BGPCYD)*100),1:"")
  1. .S BGP98D=$$V(BGPRPT,82,10),BGP98N=$$V(BGPRPT,84,22),BGP98P=$S(BGP98D:((BGP98N/BGP98D)*100),1:"")
  1. .S BGPPRD=$$V(BGPRPT,42,10),BGPPRN=$$V(BGPRPT,44,22),BGPPRP=$S(BGPPRD:((BGPPRN/BGPPRD)*100),1:"")
  1. .D LOCW Q:BGPQUIT
  1. Q
  1. CALC(N,O) ;ENTRY POINT
  1. NEW Z
  1. I O=0!(N=0)!(O="")!(N="") Q "**"
  1. NEW X,X2,X3
  1. S X=N,X2=1,X3=0 D COMMA^%DTC S N=X
  1. S X=O,X2=1,X3=0 D COMMA^%DTC S O=X
  1. I +O=0 Q "**"
  1. S Z=(((N-O)/O)*100),Z=$FN(Z,"+,",1)
  1. Q Z
  1. Q
  1. H ;write header
  1. W !?44,"% CHANGE",?62,"% CHANGE",!?44,"FROM BASE YR",?62,"FROM PREV YR"
  1. Q
  1. LOCW ;
  1. I $Y>(IOSL-3) D HEADER^BGPDPH Q:BGPQUIT
  1. W !?3,$P(^BGPD(BGPRPT,0),U,5)
  1. S X=$P(^BGPD(BGPRPT,0),U,5)
  1. I X="" W ?11,"?????" Q
  1. S X=$O(^AUTTLOC("C",X,0))
  1. I X="" W ?11,"?????" Q
  1. W ?11,$E($P(^DIC(4,X,0),U),1,20)
  1. S BGPX=$J($$CALC(BGPCYP,BGP98P),6),$E(BGPX,20)=$J($$CALC(BGPCYP,BGPPRP),6)
  1. W ?46,BGPX
  1. Q
  1. WLOC ;
  1. I $Y>(IOSL-3) D HEADER^BGPDPH Q:BGPQUIT
  1. W !?3,$P(^BGPD(BGPRPT,0),U,5)
  1. S X=$P(^BGPD(BGPRPT,0),U,5)
  1. I X="" W ?11,"?????" Q
  1. S X=$O(^AUTTLOC("C",X,0))
  1. I X="" W ?11,"?????" Q
  1. W ?11,$E($P(^DIC(4,X,0),U),1,20)
  1. Q
  1. V(R,N,P) ;
  1. NEW Y
  1. I $G(BGPAREAA),'$G(BGPSUMR) G VA
  1. Q $P($G(^BGPD(R,N)),U,P)
  1. VA ;
  1. NEW X,C,V,MT,FT,M,F,B S X=0,C="" F S X=$O(BGPSUL(X)) Q:X'=+X D
  1. .S V=$P($G(^BGPD(X,N)),U,P)
  1. .I C="" S C=V Q
  1. .S MT=$P(C,"!"),FT=$P(C,"!",2),M=$P(V,"!"),F=$P(V,"!",2)
  1. .F B=1:1:6 S $P(MT,"~",B)=$P(MT,"~",B)+$P(M,"~",B)
  1. .F B=1:1:6 S $P(FT,"~",B)=$P(FT,"~",B)+$P(F,"~",B)
  1. .S C=MT_"!"_FT
  1. .Q
  1. Q C
  1. C(X,X2,X3) ;
  1. D COMMA^%DTC
  1. Q X