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

APCLTENP.m

Go to the documentation of this file.
  1. APCLTENP ; IHS/CMI/LAB - cont. of top ten ;
  1. ;;2.0;IHS PCC SUITE;**7,11**;MAY 14, 2009;Build 58
  1. ;
  1. ;
  1. PRINT W:$D(IOF) @IOF,?20,"***** FREQUENCY OF DIAGNOSIS REPORT *****",!!
  1. COVPAGE ;EP
  1. W:$D(IOF) @IOF
  1. W !?20,"********** FREQUENCY OF DIAGNOSES REPORT **********"
  1. S X=$P(^DIC(4,DUZ(2),0),U) W !,$$CTR("Report run at: "_X,80)
  1. W !!,"REPORT REQUESTED BY: ",$P(^VA(200,DUZ,0),U)
  1. W !!,"The following report contains a ",$S(APCLPTVS="V":"PCC Visit",1:"Patient")," report based on the",!,"following criteria:",!
  1. SHOW ;
  1. W !,$S(APCLPTVS="P":"PATIENT",1:"VISIT")," Selection Criteria"
  1. W:APCLTYPE="D" !!?6,"Encounter Date range: ",APCLBDD," to ",APCLEDD,!
  1. W:$G(APCLSEAT) !!?6,"Search Template: ",$P(^DIBT(APCLSEAT,0),U),!
  1. I '$D(^APCLVRPT(APCLRPT,11)) W !!?5,"ALL VISITS IN DATE RANGE SELECTED." G EXCLP
  1. S APCLI=0 F S APCLI=$O(^APCLVRPT(APCLRPT,11,APCLI)) Q:APCLI'=+APCLI D
  1. .I $Y>(IOSL-5) D PAUSE^APCLVL01 W @IOF
  1. .W !?6,$P(^APCLVSTS(APCLI,0),U),": "
  1. .K APCLQ S APCLY=0,C=0 K APCLQ F S APCLY=$O(^APCLVRPT(APCLRPT,11,APCLI,11,"B",APCLY)) S C=C+1 W:C'=1&(APCLY'="") " ; " Q:APCLY=""!($D(APCLQ)) S X=APCLY X:$D(^APCLVSTS(APCLI,2)) ^(2) W X
  1. EXCLP ;
  1. K APCLQ
  1. I $O(APCLDXT(0)),APCLEXCL=1 D
  1. .W !!,"The following diagnoses are excluded"
  1. .S APCLX=0 F S APCLX=$O(APCLDXT(APCLX)) Q:APCLX'=+APCLX!($D(APCLQ)) D
  1. ..I $Y>(IOSL-5) D PAUSE^APCLVL01 W:$D(IOF) @IOF
  1. ..W ":",$P($$ICDDX^ICDEX(APCLX),U,2) ;cmi/anch/maw 9/12/2007 csv
  1. ..Q
  1. .Q
  1. COUNT ;if COUNTING entries only
  1. I $Y>(IOSL-5) D PAUSE^APCLVL01 W:$D(IOF) @IOF
  1. I $D(APCLALL) W !!?5,"ALL (Primary and Secondary) POV's included.",!
  1. I $D(APCLPRIM) W !!?5,"PRIMARY POV's Only",!
  1. W:$D(APCLVTOT) !!!,"Total COUNT of ",$S(APCLPTVS="P":"Patients",1:"Visits"),": ",APCLVTOT
  1. D PAUSE^APCLVL01
  1. W:$D(IOF) @IOF
  1. K APCLQUIT
  1. W !?20,"********** FREQUENCY OF DIAGNOSES REPORT **********"
  1. PPOV I $E(IOST)="C",IO=IO(0),$Y>(IOSL-4) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S APCLQUIT="" Q
  1. S %="^XTMP(""APCLTEN"",APCLJOB,APCLBT,",A=%_"""POV"",APCLPOV)",B=%_"""APC"",APCLAPC)",C=%_"1)",E=%_"2)",F=%_"3)",G=%_"4)"
  1. W !!,"No. VISITs: ",APCLVTOT,?20,"No. POVs: ",APCLTOT,?40,"POV/VISIT ratio: ",$S(APCLVTOT>0:$J((APCLTOT/APCLVTOT),1,2),1:0)," (min. std. > 1.6)"
  1. W !!!,"TOP ",APCLLNO," POV's =>" I APCLCHRT="L" W !,?58,"# Visits",?68,"# Patients"
  1. S J=0 F I=1:1 Q:'$D(@F@(I))!($D(APCLQUIT)) D
  1. .S APCLPOV=@F@(I)
  1. .I $Y>(IOSL-4) D FF Q:$D(APCLQUIT)
  1. .I I=1,APCLCHRT="B" D SETDASH(A)
  1. .I APCLCHRT="L" W !?3,I,".",?7,$P($$ICDDX^ICDEX(APCLPOV),U,2),?17,$E($P($$ICDDX^ICDEX(APCLPOV),U,4),1,40) D Q ;cmi/anch/maw 9/12/2007 csv
  1. ..W ?58,@A,?70,$J($G(^XTMP("APCLTEN",APCLJOB,APCLBT,"PCOUNT",APCLPOV)),7,0)
  1. .W !,$E($P($$ICDDX^ICDEX(APCLPOV),U,4),1,17),?18," (",$P($$ICDDX^ICDEX(APCLPOV),U,2),")",?27,"|" S L=+(@A),D=L\APCLDASH F %=1:1:D W "*" ;cmi/anch/maw 9/12/2007 csv
  1. .W " ",+(@A)
  1. .Q
  1. G:$D(APCLQUIT) PEXIT
  1. I $Y>(IOSL-5) D FF G:$D(APCLQUIT) PEXIT
  1. I APCLCHRT="B" D
  1. .W ! S J=27 F X=1:1:10 W ?J,"|_________" S J=J+10
  1. .W "|",!
  1. .S J=27 F X=0:1:10 W ?J,APCLDASH*10*X S J=J+10
  1. .W !!,"each * represents ",APCLDASH," POV"_$S(APCLDASH>1:"'s",1:""),!
  1. I $Y>(IOSL-4) D FF G:$D(APCLQUIT) PEXIT
  1. PAPC W !!,"TOP ",APCLLNO," DIAGNOSTIC CATEGORIES =>",!
  1. F I=1:1 Q:'$D(@G@(I))!($D(APCLQUIT)) D
  1. .S APCLAPC=@G@(I)
  1. .I I=1,APCLCHRT="B" D SETDASH(B)
  1. .I $Y>(IOSL-4) D FF Q:$D(APCLQUIT)
  1. .I APCLCHRT="L" W !?3,I,".",?7,$P(^ICM(APCLAPC,0),U)," (",@B,")" Q
  1. .W !,$E($P(^ICM(APCLAPC,0),U),1,25),?27,"|" S L=+(@B),D=L\APCLDASH F %=1:1:D W "*"
  1. .W " ",+(@B)
  1. .Q
  1. I $Y>(IOSL-5) D FF G:$D(APCLQUIT) PEXIT
  1. I APCLCHRT="B" D
  1. .W ! S J=27 F X=1:1:10 W ?J,"|_________" S J=J+10
  1. .W "|",!
  1. .S J=27 F X=0:1:10 W ?J,APCLDASH*10*X S J=J+10
  1. .W !!,"each * represents ",APCLDASH," POV"_$S(APCLDASH>1:"'s",1:""),!
  1. PEXIT D DONE^APCLOSUT Q
  1. ;
  1. SETDASH(APCLG) ;
  1. NEW L,D,F,M
  1. S L=+(@APCLG)
  1. S M=$L(L),F=$E(L)+1,L=F F %=1:1:(M-1) S L=L_"0"
  1. S:L<100 L=100
  1. S APCLDASH=L\100
  1. Q
  1. CTR(X,Y) ;EP - Center X in a field Y wide.
  1. Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
  1. ;----------
  1. FF I IOST["P-" W:$D(IOF) @IOF Q
  1. I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S X="^",APCLQUIT=""
  1. W:$D(IOF) @IOF
  1. Q
  1. ;