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

APCLAP61.m

Go to the documentation of this file.
APCLAP61 ; IHS/CMI/LAB - PRIM CARE PROVIDERREPORT PROCESS ;
 ;;2.0;IHS PCC SUITE;**15**;MAY 14, 2009;Build 11
 ;
START ;
 S APCLBT=$H
 K ^XTMP("APCLAP6",APCLJOB,APCLBTH)
 D XTMP^APCLOSUT("APCLAP6","PCC - PCP VISITS BY DAY/YEAR")
 ;
V ; Run by visit date
 S APCLODAT=APCLSD_".9999" F  S APCLODAT=$O(^AUPNVSIT("B",APCLODAT)) Q:APCLODAT=""!((APCLODAT\1)>APCLED)  D V1
 ;
END ;
 S APCLET=$H
 K APCLSKIP,APCLVREC,APCLVDFN,APCLAP,APCLVD,APCLDISC
 Q
V1 ;
 ;count only visits with service category of A, O, R, S
 S APCLVDFN="" F  S APCLVDFN=$O(^AUPNVSIT("B",APCLODAT,APCLVDFN)) Q:APCLVDFN'=+APCLVDFN  I $D(^AUPNVSIT(APCLVDFN,0)),$P(^(0),U,9),'$P(^(0),U,11),"AORS"[$P(^(0),U,7) S APCLVREC=^(0) D PROC
 Q
PROC ;
 K APCLSKIP
 Q:$$DEMO^APCLUTL($P(APCLVREC,U,5),$G(APCLDEMO))
 Q:'$D(^AUPNVPRV("AD",APCLVDFN))  ;quit if no provider entry
 Q:'$D(^AUPNVPOV("AD",APCLVDFN))  ;quit if no pov entry
 I $D(APCLLOC),$$CHKLOC^APCLOCCK(APCLLOC,$P(APCLVREC,U,6))=0 Q
 I $D(APCLCLNT),'$P(APCLVREC,U,8) Q
 I $D(APCLCLNT),'$D(APCLCLNT($P(APCLVREC,U,8))) Q
 I $D(APCLLOCT),$P(APCLVREC,U,6)="" Q
 I $D(APCLLOCT),'$D(APCLLOCT($P(APCLVREC,U,6))) Q
 ;
PROC1 ;
 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,APCLAP=$P(^(0),U)
 Q:APCL1'=1
 S APCLDISC="" D CHKDISC
 Q:'$D(APCLPRIM)
 S APCLSORT=$S($D(APCLCLNT):$P(APCLVREC,U,8),1:$P(APCLVREC,U,6))
 S ^(APCLSORT)=$S($D(^XTMP("APCLAP6",APCLJOB,APCLBTH,APCLAP,APCLSORT)):^(APCLSORT)+1,1:1)
 Q
 ;
CHKDISC ;
 K APCLPRIM
 ;I $P(^DD(9000010.06,.01,0),U,2)[6 G CHKDISC6
 Q:'$D(^VA(200,APCLAP))
 ;S APCLDISC=$$PROVCLSC^XBFUNC1(APCLAP) I APCLDISC="UNKNOWN"!(APCLDISC="") Q
 NEW X
 S X=$$VALI^XBDIQ1(200,APCLAP,53.5) I X,$P($G(^DIC(7,X,9999999)),U,3)="Y" S APCLPRIM=1
 ;I $D(^APCLCNTL(1,11,"B",APCLDISC)) S APCLPRIM=1
 Q
CHKDISC6 ;
 I '$D(^DIC(6,APCLAP)) Q
 S APCLY=$P(^DIC(6,APCLAP,0),U,4)
 I APCLY="" S APCLDISC="??" Q
 I '$D(^DIC(7,APCLY,9999999)) S APCLDISC="??" Q
 S APCLDISC=$P(^DIC(7,APCLY,9999999),U) I APCLDISC="" S APCLDISC="??" Q
 I $D(^APCLCNTL(1,11,"B",APCLDISC)) S APCLPRIM=1
 Q