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

APCLAA1.m

Go to the documentation of this file.
APCLAA1 ; IHS/CMI/LAB - Process APC 1A report ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;CMI/TUCSON/LAB - patch 3 FY fix
START ;
 S APCLBT=$H,APCLJOB=$J
 K ^XTMP("APCLAA",APCLJOB,APCLBT)
 D XTMP^APCLOSUT("APCLAA","PCC VISITS BY PROV DISC")
 ;beginning Y2K fix
 ;S X1=APCLFY,X2=-1 D C^%DTC S APCLSD=X S X1=APCLFY,X2=365 D C^%DTC S APCLFYE=$E(X,1,3)_"0930" ;Y2000
 ;end Y2K
V ; Run by visit date
 S APCLGRAN=0
 S APCLSD=APCLSD_".9999" F  S APCLSD=$O(^AUPNVSIT("B",APCLSD)) Q:APCLSD=""!((APCLSD\1)>APCLFYE)  D V1
 ;
XIT ;
 D EOJ
 S APCLET=$H
 Q
V1 ;
 S APCLVDFN="" F  S APCLVDFN=$O(^AUPNVSIT("B",APCLSD,APCLVDFN)) Q:APCLVDFN'=+APCLVDFN  I $D(^AUPNVSIT(APCLVDFN,0)) S APCLVREC=^(0) D PROC,EOJ
 Q
PROC ;
 K APCLSKIP
 Q:'$P(APCLVREC,U,9)
 Q:$P(APCLVREC,U,11)
 Q:"EHI"[$P(APCLVREC,U,7)
 Q:"CV"[$P(APCLVREC,U,3)
 I APCLLOC]"",APCLLOC'=$P(APCLVREC,U,6) Q
 S DFN=$P(APCLVREC,U,5)
 Q:$$DEMO^APCLUTL(DFN,$G(APCLDEMO))  ;IHS/CMI/LAB - all demo patients
 Q:'$D(^AUPNVPOV("AD",APCLVDFN))
 Q:'$D(^AUPNVPRV("AD",APCLVDFN))
 S APCLVLOC=$P(APCLVREC,U,6)
 Q:'$D(^DIC(4,APCLVLOC))
 Q:'$D(^AUTTLOC(APCLVLOC))
 ;
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=0
 Q:APCL1>1
 S APCLDISC="" D CHKDISC
 Q:$D(APCLSKIP)
 S APCLMOS=+$E(APCLSD,4,5)
 S ^(APCLMOS)=$S($D(^XTMP("APCLAA",APCLJOB,APCLBT,"MODISC",APCLDPTR,APCLMOS)):^(APCLMOS)+1,1:1)
 S ^(APCLDPTR)=$S($D(^XTMP("APCLAA",APCLJOB,APCLBT,"DISCTOT",APCLDPTR)):^(APCLDPTR)+1,1:1)
 S APCLGRAN=APCLGRAN+1
 Q
EOJ K APCLVLOC,APCLVREC,APCLCLIN,APCLSKIP,APCL1,APCL2,APCLAP,APCLDISC,APCLDPTR,APCLLOCC,APCLCLN
 K X,X1,X2
 Q
 ;
CHKDISC ;
 I $P(^DD(9000010.06,.01,0),U,2)[200 D CHKDISC2 Q  ;FILE 200 CONV
 I '$D(^DIC(6,APCLAP)) S APCLSKIP=1 Q
 S APCLDPTR=$P(^DIC(6,APCLAP,0),U,4)
 I APCLDPTR="" S APCLDISC="??",APCLDPTR="??" Q
 I '$D(^DIC(7,APCLDPTR,9999999)) S APCLDISC="??" Q
 S APCLDISC=$P(^DIC(7,APCLDPTR,9999999),U) I APCLDISC="" S APCLSKIP=1 Q
 S APCLLOCC=$E($P(^AUTTLOC(APCLVLOC,0),U,10),5,6)
 I (APCLDISC=13!(APCLDISC=32))&((APCLLOCC>49)!(APCLLOCC'=+APCLLOCC)) S APCLSKIP=1
 Q
 ;
 ;
CHKDISC2 ;CHECK DISC IF CONVERTED TO FILE 200
 I '$D(^VA(200,APCLAP)) S APCLSKIP=1 Q
 S APCLDPTR=$$PROVCLS^XBFUNC1(APCLAP,"I") I APCLDPTR=""!(APCLDPTR="UNKNOWN") S APCLDISC="???" Q
 S APCLDISC=$$PROVCLSC^XBFUNC1(APCLAP) I APCLDISC="UNKNOWN"!(APCLDISC="") S APCLSKIP=1 Q
 S APCLLOCC=$E($P(^AUTTLOC(APCLVLOC,0),U,10),5,6)
 I (APCLDISC=13!(APCLDISC=32))&((APCLLOCC>49)!(APCLLOCC'=+APCLLOCC)) S APCLSKIP=1
 Q
 ;