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

APCLTEN1.m

Go to the documentation of this file.
APCLTEN1 ; IHS/CMI/LAB - TOP TEN POVS ;
 ;;2.0;IHS PCC SUITE;**7,11**;MAY 14, 2009;Build 58
 ;
 ;cmi/anch/maw 9/12/2007 code set versioning POVX
 ;
VISIT ;
 S APCLJOB=$J,APCLBT=$H
 K ^XTMP("APCLTEN",APCLJOB,APCLBT)
 D XTMP^APCLOSUT("APCLTEN","PCC TOP TEN DX REPORT")
 S %="^XTMP(""APCLTEN"",APCLJOB,APCLBT,",APCLA=%_"""POV"",APCLPOV)",APCLB=%_"""APC"",APCLAPC)",APCLC=%_"1)",APCLE=%_"2)",APCLF=%_"3)",APCLG=%_"4)",APCLTOT=0,APCLVTOT=0,APCLLINO=0
 S APCLBD=APCLBD-.00001
 S APCLDATE=APCLBD F  S APCLDATE=$O(^AUPNVSIT("B",APCLDATE)) Q:'APCLDATE  Q:(APCLDATE\1)>APCLED  F APCLVIEN=0:0 S APCLVIEN=$O(^AUPNVSIT("B",APCLDATE,APCLVIEN)) Q:'APCLVIEN  I $D(^AUPNVSIT(APCLVIEN,0)),$D(^AUPNVPOV("AD",APCLVIEN)) D CK
 D SET
 S APCLET=$H
 Q
 ;
CK ;
 S APCLVREC=^AUPNVSIT(APCLVIEN,0),DFN=$P(APCLVREC,U,5) I '$G(APCLSEAT) Q:$$DEMO^APCLUTL(DFN,$G(APCLDEMO))
 I $G(APCLSEAT),'$D(^DIBT(APCLSEAT,1,DFN)) Q  ;not in search template
 Q:'$P(APCLVREC,U,9)
 Q:$P(APCLVREC,U,11)
 D SCREENS
 Q:$D(APCLSKIP)
POV S APCLPOVN="",APCLVTOT=APCLVTOT+1,APCLCC=0
 F  S APCLPOVN=$O(^AUPNVPOV("AD",APCLVIEN,APCLPOVN)) Q:'APCLPOVN  Q:'$D(^AUPNVPOV(APCLPOVN,0))  S APCLPOV=+^(0),APCLCC=APCLCC+1,APCLPREC=^(0) D POVX
 Q
 ;
POVX I '$D(^ICD9($P(APCLPREC,U))) Q
 I $D(APCLPRIM),$P(APCLVREC,U,7)="H",$P(APCLPREC,U,12)'="P" Q
 I $D(APCLPRIM),APCLCC>1 Q
 I APCLEXCL,$D(APCLDXT($P(APCLPREC,U))) Q  ;excluded dx
 S APCLTOT=APCLTOT+1
 S %=$P($$ICDDX^ICDEX(APCLPOV),U,6) K APCLAPC I %,$D(^ICM(%,0)) S APCLAPC=%
 S APCLPAT=$P(^AUPNVPOV(APCLPOVN,0),U,2) I '$D(^XTMP("APCLTEN",APCLJOB,APCLBT,"PTIND",APCLPAT,APCLPOV)) D
 .S ^XTMP("APCLTEN",APCLJOB,APCLBT,"PTIND",APCLPAT,APCLPOV)=""
 .S ^XTMP("APCLTEN",APCLJOB,APCLBT,"PCOUNT",APCLPOV)=$G(^XTMP("APCLTEN",APCLJOB,APCLBT,"PCOUNT",APCLPOV))+1
 F X=APCLA,APCLB D UTL
 Q
 ;
SCREENS ;
 K APCLSKIP
 S APCLI=0 F  S APCLI=$O(^APCLVRPT(APCLRPT,11,APCLI)) Q:APCLI'=+APCLI!($D(APCLSKIP))  D
 .I '$P(^APCLVSTS(APCLI,0),U,8) D SINGLE Q
 .D MULT
 .Q
 Q
SINGLE ;
 K X,APCLSPEC S X="",APCLX=0
 X:$D(^APCLVSTS(APCLI,1)) ^(1)
 I X="" S APCLSKIP="" Q
 I '$D(APCLSPEC),'$D(^APCLVRPT(APCLRPT,11,APCLI,11,"B",X)) S APCLSKIP="" Q
 Q
MULT ;
 K APCLFOUN,APCLSKIP,APCLSPEC,X S APCLX=0,X=""
 X:$D(^APCLVSTS(APCLI,1)) ^(1)
 I $O(X(""))="" S APCLSKIP="" Q
 I '$D(APCLSPEC) S Y="" F  S Y=$O(X(Y)) Q:Y=""  I $D(^APCLVRPT(APCLRPT,11,APCLI,11,"B",Y)) S APCLFOUN="" Q
 I $D(APCLSPEC),$D(X) S APCLFOUN=1 Q
 S:'$D(APCLFOUN) APCLSKIP=""
 Q
UTL I X=APCLB,'$D(APCLAPC) Q
 I '$D(@X) S @X=0
 S %=@X,%=%+1,@X=%
 Q
 ;
SET F APCLPOV=0:0 S APCLPOV=$O(@APCLA) Q:'APCLPOV  S %=^(APCLPOV),@APCLC@(9999999-%,APCLPOV)=""
 F APCLAPC=0:0 S APCLAPC=$O(@APCLB) Q:'APCLAPC  S %=^(APCLAPC),@APCLE@(9999999-%,APCLAPC)=""
S1 S (X,I)=0 F  S X=$O(@APCLC@(X)) Q:'X  F Y=0:0 S Y=$O(@APCLC@(X,Y)) Q:'Y  S I=I+1,@APCLF@(I)=Y I I=APCLLNO G S2
S2 S (X,I)=0 F  S X=$O(@APCLE@(X)) Q:'X  F Y=0:0 S Y=$O(@APCLE@(X,Y)) Q:'Y  S I=I+1,@APCLG@(I)=Y I I=APCLLNO G S3
S3 Q
 ;
 ;
FF I IOST["P-" W:$D(IOF) @IOF Q
 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 X="^"
 W:$D(IOF) @IOF
 Q
 ;
EXIT ;EP
 K A,B,C,D,E,F,G,H,I,J,K,X,Y,Z,%
 K APCLBD,APCLED,APCLDOB1,APCLDOB2,APCLSEX,A,B,C,X,Y,Z,%,APCLFAC,APCLJOB,APCLLNO,E,F,G,ZTQUEUED,APCLCLN,APCLTYPE,APCLSC,APCLC,APCLPREC,APCLSD,APCLET,APCLSEAT,APCLCHRT,APCLLHDR,APCLDASH,APCLA,APCLB,APCLC,APCLD,APCLE,APCLF,APCLG
 K APCLQUIT,APCLAPC,APCLDATE,APCLPOV,APCLVIEN,APCLNOCK,APCLTOT,APCLPROV,APCLVTOT,APCLLINO,L,I,APCLCMA,APCLPOVN,APCLV,APCLTYPP,APCLSCP,APCLPRIM,APCLALL
 K APCLANS,AMQQTAX,APCLBDD,APCLCNT,APCLCRIT,APCLCTYP,APCLCUT,APCLDISP,APCLEDD,APCLHIGH,APCLI,APCLNCAN,APCLPTVS,APCLRPT,APCLSEL,APCLSKIP,APCLTCW,APCLTEXT,APCLVAR,APCLVIEN,APCLVREC,DFN,APCLX,APCLY,APCLCC
 K APCLBT
 Q