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

APCLAP21.m

Go to the documentation of this file.
APCLAP21 ; IHS/CMI/LAB - All visit report process ; 08 Dec 2010  12:01 PM
 ;;2.0;IHS PCC SUITE;**7,8,16**;MAY 14, 2009;Build 9
 ;FIX UNDEF PER ROSS
START ;
 S APCLBT=$H
 K ^XTMP("APCLAP2",APCLJOB,APCLBTH)
 D XTMP^APCLOSUT("APCLAP2","PCC VISIT COUNTS REPORT")
 ;
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
 ;
END ;
 S APCLET=$H
 D EOJ
 Q
V1 ;
 S APCLVDFN="" F  S APCLVDFN=$O(^AUPNVSIT("B",APCLODAT,APCLVDFN)) Q:APCLVDFN'=+APCLVDFN  I $D(^AUPNVSIT(APCLVDFN,0)) S APCLVREC=^(0) D PROC,EOJ
 Q
PROC ;
 K APCLSKIP
 Q:$$DEMO^APCLUTL($P(APCLVREC,U,5),$G(APCLDEMO))
 Q:'$P(APCLVREC,U,9)
 Q:$P(APCLVREC,U,11)
 Q:"EDXIH"[$P(APCLVREC,U,7)
 I 'APCLCRYN,$P(APCLVREC,U,7)="C" Q  ;don't want chart reviews and this is a chart review
 Q:$D(^APCLCNTL(4,11,"B",$P(APCLVREC,U,3)))  ;lab/ohprd changed CV to C for VA use
 S APCLVLOC=$P(APCLVREC,U,6) Q:APCLVLOC=""
 Q:'$D(^AUTTLOC(APCLVLOC))
 Q:'$D(^DIC(4,APCLVLOC))
 I $$CHKLOC^APCLOCCK(APCLLOC,APCLVLOC)=0 Q
 Q:'$D(^AUPNVPOV("AD",APCLVDFN))
 Q:'$D(^AUPNVPRV("AD",APCLVDFN))
 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)
 I APCL1=0 Q
 I APCL1>1 Q
 S APCLDISC="" D CHKDISC
 D @APCLPROC
 S ^(APCLSRT2)=$S($D(^XTMP("APCLAP2",APCLJOB,APCLBTH,"LOCTOT",APCLVLOC,@APCLSORT,APCLSRT2)):^(APCLSRT2)+1,1:1)
 S ^(APCLSRT2)=$S($D(^XTMP("APCLAP2",APCLJOB,APCLBTH,"ALLLOC",@APCLSORT,APCLSRT2)):^(APCLSRT2)+1,1:1)
 I APCLPROC="ALLP" S APCLSORT="APCLSEC"
 I APCLPROC="ALLDISC" S APCLSORT="APCLADIS"
 Q
EOJ K APCLVLOC,APCLVREC,APCLCLIN,APCLSKIP,APCL1,APCL2,APCLAP,APCLDISC,APCLPPOV,APCLX,APCLHIGH,APCLDX,APCLLOW,APCLICD,APCLDA1,APCLDA2,APCLY,APCLSRT2,APCLDATE,APCLPROV,APCLSEC,APCLZ
 Q
 ;
CLIN ;
 D CLIN^APCLAP22
 Q
 ;
SC ;
 D SC^APCLAP22
 Q
DATE ;
 D DATE^APCLAP22
 Q
DISC ;
 S APCLSRT2=APCLDISC
 S APCLDISC=$S($P(^DD(9000010.06,.01,0),U,2)[200:$$PROVCLS^XBFUNC1(APCLAP),APCLY:$P(^DIC(7,APCLY,0),U),1:"???")
 Q
PROV ;
 S APCLPROV=$S($P(^DD(9000010.06,.01,0),U,2)[200:$P(^VA(200,APCLAP,0),U),1:$P(^DIC(16,APCLAP,0),U))
 S APCLSRT2=$S($P(^DD(9000010.06,.01,0),U,2)[200:$$PROVCLS^XBFUNC1(APCLAP),APCLY:$P($G(^DIC(7,APCLY,0)),U),1:"???")
 I APCLSRT2="" S APCLSRT2="PROVIDER CLASS UNAVAILABLE" Q
 Q
CHKDISC ;
 I $P(^DD(9000010.06,.01,0),U,2)[6 G CHKDISC6
 I '$D(^VA(200,APCLAP)) S APCLPROV="NO PROVIDER ENTERED",APCLSRT2="NONE" Q
 S APCLDPTR=$$PROVCLS^XBFUNC1(APCLAP,"I") I APCLDPTR=""!(APCLDPTR="UNKNOWN") S APCLDISC="???" Q
 S APCLDISC=$$PROVCLSC^XBFUNC1(APCLAP) I APCLDISC="UNKNOWN"!(APCLDISC="") S APCLDISC="???" Q
 Q
CHKDISC6 ;
 I '$D(^DIC(6,APCLAP)) S APCLPROV="NO PROVIDER ENTERED",APCLSRT2="NONE" Q
 S APCLY=$P(^DIC(6,APCLAP,0),U,4)
 I APCLY="" S APCLPROV="NO PROVIDER DISC ENTERED",APCLSRT2="NONE",APCLDISC="???" Q
 I '$D(^DIC(7,APCLY,0)) S APCLPROV="NO PROVIDER DISC ENTERED",APCLSTR2="NONE" Q
 I '$D(^DIC(7,APCLY,9999999)) S APCLPROV=$P(^DIC(7,APCLY,0),U),APCLSRT2="???" Q
 S APCLDISC=$P(^DIC(7,APCLY,9999999),U) I APCLDISC="" S APCLPROV=$P(^DIC(7,APCLY,0),U),APCLSRT2="???",APCLDISC="???" Q
 Q
 ;
LOS ;
 S APCLSRT2=$P(^AUTTLOC(APCLVLOC,0),U,10)
 I APCLSRT2="" S APCLSRT2="??????"
 Q
 ;
ALLP ;
 S (APCL1,APCL2)=0 F  S APCL2=$O(^AUPNVPRV("AD",APCLVDFN,APCL2)) Q:APCL2=""  I $P(^AUPNVPRV(APCL2,0),U,4)="S" D SETSEC
 S APCLSORT="APCLPROV" D PROV
 Q
SETSEC ;
 I $P(^DD(9000010.06,.01,0),U,2)[6 G SETSEC6
 S APCLSEC=$P(^AUPNVPRV(APCL2,0),U)
 Q:'$D(^VA(200,APCLSEC,0))
 S APCLSRT2=$$PROVCLS^XBFUNC1(APCLSEC)
SETSEC1 S APCLSEC=$P(^VA(200,APCLSEC,0),U)
 S ^(APCLSRT2)=$S($D(^XTMP("APCLAP2",APCLJOB,APCLBTH,"LOCTOT",APCLVLOC,@APCLSORT,APCLSRT2)):^(APCLSRT2)+1,1:1)
 S ^(APCLSRT2)=$S($D(^XTMP("APCLAP2",APCLJOB,APCLBTH,"ALLLOC",@APCLSORT,APCLSRT2)):^(APCLSRT2)+1,1:1)
 Q
SETSEC6 ;
 S APCLSEC=$P(^AUPNVPRV(APCL2,0),U)
 Q:APCLSEC=""
 Q:'$D(^DIC(16,APCLSEC,0))
 S APCLZ=$P(^DIC(6,APCLSEC,0),U,4)
 I APCLZ="" S APCLSRT2="PROVIDER DISCIPLINE UNAVAILABLE" G SETSEC61
 Q:'$D(^DIC(7,APCLZ,9999999))
 S APCLSRT2=$P(^DIC(7,APCLZ,9999999),U) I APCLSRT2="" S APCLSRT2="PROVIDER DISCIPLINE UNAVAILABLE" G SETSEC61
 S APCLSRT2=$P(^DIC(7,APCLZ,0),U)
SETSEC61 S APCLSEC=$P(^DIC(16,APCLSEC,0),U)
 S ^(APCLSRT2)=$S($D(^XTMP("APCLAP2",APCLJOB,APCLBTH,"LOCTOT",APCLVLOC,@APCLSORT,APCLSRT2)):^(APCLSRT2)+1,1:1)
 Q
ALLDISC ;
 S (APCL1,APCL2)=0 F  S APCL2=$O(^AUPNVPRV("AD",APCLVDFN,APCL2)) Q:APCL2=""  I $P(^AUPNVPRV(APCL2,0),U,4)="S" D SETSECD
 S APCLSORT="APCLDISC" D DISC
 Q
SETSECD ;
 I $P(^DD(9000010.06,.01,0),U,2)[6 G SETSECD6
 S APCLADIS=$P(^AUPNVPRV(APCL2,0),U)
 Q:'$D(^VA(200,APCLADIS,0))
 S APCLSRT2=$$PROVCLSC^XBFUNC1(APCLADIS)
 S APCLADIS=$$PROVCLS^XBFUNC1(APCLADIS)
 S ^(APCLSRT2)=$S($D(^XTMP("APCLAP2",APCLJOB,APCLBTH,"LOCTOT",APCLVLOC,@APCLSORT,APCLSRT2)):^(APCLSRT2)+1,1:1)
 S ^(APCLSRT2)=$S($D(^XTMP("APCLAP2",APCLJOB,APCLBTH,"ALLLOC",@APCLSORT,APCLSRT2)):^(APCLSRT2)+1,1:1)
 Q
SETSECD6 ;
 S APCLADIS=$P(^AUPNVPRV(APCL2,0),U)
 Q:APCLADIS=""
 Q:'$D(^DIC(16,APCLADIS,0))
 S APCLZ=$P(^DIC(6,APCLADIS,0),U,4)
 I APCLZ="" S APCLSRT2="???",APCLADIS="PROVIDER DISC NOT AVAILABLE" G SETSECD1
 I '$D(^DIC(7,APCLZ,9999999)) S APCLSRT2="???",APCLADIS="PROVIDER DISC NOT AVAILABLE" G SETSECD1
 S APCLSRT2=$P(^DIC(7,APCLZ,9999999),U) Q:APCLSRT2=""
 S APCLADIS=$P(^DIC(7,APCLZ,0),U)
SETSECD1 S ^(APCLSRT2)=$S($D(^XTMP("APCLAP2",APCLJOB,APCLBTH,"LOCTOT",APCLVLOC,@APCLSORT,APCLSRT2)):^(APCLSRT2)+1,1:1)
 Q
DX ;
 D DX^APCLAP22
 Q