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

APCLCP91.m

Go to the documentation of this file.
APCLCP91 ; IHS/CMI/LAB - APC report - process ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
START ; EP - process report
 S APCLBT=$H,APCLJOB=$J
 K ^XTMP("APCLCP9",APCLJOB,APCLBT)
 D XTMP^APCLOSUT("APCLCP9","PCC ACTIVITY REPORT")
 I $P(^APCLACTG(APCLACTG,0),U,2)]"",$P(^(0),U,3)]"",$P(^(0),U,4)]"" D  I 1
 .S APCLRRTN=$S($P($P(^APCLACTG(APCLACTG,0),U,2),"~",2)]"":$P($P(^APCLACTG(APCLACTG,0),U,2),"~")_"^"_$P($P(^APCLACTG(APCLACTG,0),U,2),"~",2),1:$P(^APCLACTG(APCLACTG,0),U,2)),APCLPIEC=$P(^(0),U,4),APCLGLOB="^"_$P(^(0),U,3)_"("
 .S X=APCLRRTN X ^%ZOSF("TEST") I '$T S APCLRRTN="",APCLGLOB="^ICD9(",APCLPIEC=3 Q
 E  S APCLGLOB="^ICD9(",APCLRRTN="",APCLPIEC=3
 I APCLRRTN]"" S APCLRRTN="^"_APCLRRTN
V ; Run by visit date
 S APCLODAT=$O(^AUPNVSIT("B",APCLSD)) I APCLODAT="" S APCLET=$H Q
 S APCLODAT=APCLSD_".9999" F  S APCLODAT=$O(^AUPNVSIT("B",APCLODAT)) Q:APCLODAT=""!((APCLODAT\1)>APCLED)  D V1
 D SET
 S APCLET=$H
 Q
V1 ;
 S APCLVDFN=0 F  S APCLVDFN=$O(^AUPNVSIT("B",APCLODAT,APCLVDFN)) Q:APCLVDFN'=+APCLVDFN  I $D(^AUPNVSIT(APCLVDFN,0)) S APCLVREC=^(0) I $P(APCLVREC,U,9),'$P(APCLVREC,U,11),$D(^AUPNVPOV("AD",APCLVDFN)),$D(^AUPNVPRV("AD",APCLVDFN)) D PROC
 Q
PROC ;
 K APCLSKIP
 Q:$$DEMO^APCLUTL($P(APCLVREC,U,5),$G(APCLDEMO))
 Q:"DXECH"[$P(APCLVREC,U,7)
 Q:$D(^APCLCNTL(4,11,"AC",$P(APCLVREC,U,3)))
 I $D(APCLCLN) Q:$P(APCLVREC,U,8)=""  I '$D(APCLCLN($P(APCLVREC,U,8))) Q
 S (APCL1,APCL2)=0 F  S APCL2=$O(^AUPNVPRV("AD",APCLVDFN,APCL2)) Q:APCL2=""  I $P(^AUPNVPRV(APCL2,0),U,4)="P" S APCL1=APCL1+1
 I APCL1=0 Q
 I APCL1>1 Q
 S APCLVLOC=$P(APCLVREC,U,6)
 S APCLSU=$P(^AUTTLOC(APCLVLOC,0),U,5)
 Q:APCLSU'=APCLSUF
 S APCLFOUN=0 D PROC2
 Q:'APCLFOUN
 D SETCODE
 Q
EOJ K APCLVLOC,APCLVREC,APCLSKIP,APCL1,APCL2,APCLX,APCLY,APCLPRIM,APCLSU,APCLDISC,APCLCODE,APCLVTM,APCLVTT
 Q
 ;
 ;
PROC2 ;
 S APCLX=0 F  S APCLX=$O(^AUPNVPRV("AD",APCLVDFN,APCLX)) Q:APCLX'=+APCLX!(APCLFOUN)  S APCLCHN=APCLX D
 . S APCLAP=$P(^AUPNVPRV(APCLX,0),U)
 . I $P(^DD(9000010.06,.01,0),U,2)[200 S APCLDISC=$$PROVCLSC^XBFUNC1(APCLAP) Q:'$D(^APCLACTG(APCLACTG,11,"AC",APCLDISC))  S APCLFOUN=1 Q
 . S APCLY=$P(^DIC(6,APCLAP,0),U,4)
 . I APCLY="" Q
 . I '$D(^DIC(7,APCLY,9999999)) Q
 . Q:'$D(^APCLACTG(APCLACTG,11,"AC",$P(^DIC(7,APCLY,9999999),U)))
 . S APCLFOUN=1
 . Q
 Q
SETCODE ;
 S APCLCODE="" D GETCODE
 Q:'APCLCODE
 S ^("TOTAL")=$S($D(^XTMP("APCLCP9",APCLJOB,APCLBT,APCLSU,APCLCODE,"TOTAL")):^("TOTAL")+1,1:1)
 Q
GETCODE ;
 D GETPPOV
 S APCLIPTR=$P(^AUPNVPOV(APCL1,0),U)
 I $G(APCLRRTN)]"" D @APCLRRTN Q
 S APCLCODE=APCLIPTR
 Q
GETPPOV ;
 I $P(APCLVREC,U,7)'="H" S APCL1=$O(^AUPNVPOV("AD",APCLVDFN,"")) Q
 S (APCL1,APCL2)=0 F  S APCL2=$O(^AUPNVPOV("AD",APCLVDFN,APCL2)) Q:APCL2'=+APCL2!(APCL1)  I $P(^AUPNVPOV(APCL2,0),U,12)="P" S APCL1=APCL2
 Q
SET ;
 S X=0 F  S X=$O(^XTMP("APCLCP9",APCLJOB,APCLBT,APCLSUF,X)) Q:X'=+X  S Y=^XTMP("APCLCP9",APCLJOB,APCLBT,APCLSUF,X,"TOTAL"),^XTMP("APCLCP9",APCLJOB,APCLBT,APCLSUF,"TOP TEN",9999999-Y,X)=Y
 Q