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

APCLAP11.m

Go to the documentation of this file.
APCLAP11 ; IHS/CMI/LAB - APC REPORT PROCESS ;
 ;;2.0;IHS PCC SUITE;**8,10,11**;MAY 14, 2009;Build 58
 ;
 ;cmi/anch/maw 9/7/2007 code set versioning in PROC
 ;
START ;
 S APCLBT=$H
 K ^XTMP("APCLAP1",APCLJOB,APCLBTH)
 D XTMP^APCLOSUT("APCLAP1","PCC/APC VISIT REPORT")
 ;
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
 D EOJ
 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),"AOS"[$P(^(0),U,7) S APCLVREC=^(0) D PROC,EOJ
 Q
PROC ;
 Q:$$DEMO^APCLUTL($P(APCLVREC,U,5),$G(APCLDEMO))
 I $$CHKLOC^APCLOCCK(APCLLOC,$P(APCLVREC,U,6))=0 Q
 S APCLVLOC=$P(APCLVREC,U,6) Q:APCLVLOC=""
 Q:'$$APCWL^APCLV(APCLVDFN)  ;not workload reportable
 S APCLCLIN=$P(APCLVREC,U,8) I APCLCLIN="" S APCLCLIN=9999
 S APCLY=$$PRIMPROV^APCLV(APCLVDFN,"F")
 I APCLY="" S APCLDISC="??"
 I APCLY S APCLDISC=$P($G(^DIC(7,APCLY,9999999)),U)
 S APCLAP=$$PRIMPROV^APCLV(APCLVDFN,"I")
 Q:APCLAP=""
 S APCLPPOV=$O(^AUPNVPOV("AD",APCLVDFN,""))
 ;S (APCLX,APCLICD)=$P(^ICD9($P(^AUPNVPOV(APCLPPOV,0),U),0),U)
 ;cmi/anch/maw 9/7/2007 code set versioning mods
 N APCLVDT
 S APCLVDT=+$P($G(^AUPNVSIT(APCLVDFN,0)),".")
 ;cmi/anch/maw 9/7/2007 end of mods
 S (APCLX,APCLICD)=$$VAL^XBDIQ1(9000010.07,APCLPPOV,.01)
 D @APCLPROC
 S ^(APCLSRT2)=$S($D(^XTMP("APCLAP1",APCLJOB,APCLBTH,@APCLSORT,APCLSRT2)):^(APCLSRT2)+1,1:1)
 S:APCLPROC="ALLP" APCLSORT="APCLSEC"
 S:APCLPROC="ALLDISC" APCLSORT="APCLADIS"
 Q
EOJ ;
 D EOJ^APCLAP12
 Q
 ;
CHKDISC ;
 I $P(^DD(9000010.06,.01,0),U,2)[6 D CHKDISC6 Q  ;no file 200 conversion
 I '$D(^VA(200,APCLAP)) S APCLSKIP=1 Q
 S APCLY=$$PROVCLS^XBFUNC1(APCLAP,"I") I 'APCLY S APCLDISC="??" Q
 S APCLDISC=$$PROVCLSC^XBFUNC1(APCLAP) I APCLDISC="" S APCLDISC="??" 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
CHKDISC6 ;
 I '$D(^DIC(6,APCLAP)) S APCLSKIP=1 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
 S APCLLOCC=$E($P(^AUTTLOC(APCLVLOC,0),U,10),5,6)
 I (APCLDISC=13!(APCLDISC=32))&((APCLLOCC>49)!(APCLLOCC'=+APCLLOCC)) S APCLSKIP=1
 Q
 ;
DISC ;
 D DISC^APCLAP12
 Q
 ;
CLIN ;
 D CLIN^APCLAP12
 Q
 ;
DATE ;
 D DATE^APCLAP12
 Q
PROV ;
 D PROV^APCLAP12
 Q
LOS ;
 S APCLSRT2=$P(^AUTTLOC(APCLVLOC,0),U,10),APCLVLOC=$P(^DIC(4,APCLVLOC,0),U)
 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 ;no file 200 conv
 S APCLSEC=$P(^AUPNVPRV(APCL2,0),U)
 Q:APCLSEC=""
 Q:'$D(^VA(200,APCLSEC,0))
 S APCLSRT2=$$PROVCLS^XBFUNC1(APCLSEC,"I") I 'APCLSRT2 G SETSEC1
 S APCLSRT2=$P(^DIC(7,APCLSRT2,0),U)
SETSEC1 S APCLSEC=$P(^VA(200,APCLSEC,0),U)
 S ^(APCLSRT2)=$S($D(^XTMP("APCLAP1",APCLJOB,APCLBTH,@APCLSORT,APCLSRT2)):^(APCLSRT2)+1,1:1)
 ;S ^(APCLSRT2)=$S($D(^XTMP("APCLAP1",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="DISCIPLINE NOT AVAILABLE" G SETSEC61
 I '$D(^DIC(7,APCLZ,9999999)) S APCLSRT2="DISCIPLINE NOT AVAILABLE" G SETSEC1
 S APCLSRT2=$P(^DIC(7,APCLZ,9999999),U) Q:APCLSRT2=""
 S APCLSRT2=$P(^DIC(7,APCLZ,0),U)
SETSEC61 S APCLSEC=$P(^DIC(16,APCLSEC,0),U)
 S ^(APCLSRT2)=$S($D(^XTMP("APCLAP1",APCLJOB,APCLBTH,@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:APCLADIS=""
 Q:'$D(^VA(200,APCLADIS,0))
 S APCLSRT2=$$PROVCLSC^XBFUNC1(APCLADIS)
 S APCLADIS=$$PROVCLS^XBFUNC1(APCLADIS)
 S ^(APCLSRT2)=$S($D(^XTMP("APCLAP1",APCLJOB,APCLBTH,@APCLSORT,APCLSRT2)):^(APCLSRT2)+1,1:1)
 ;S ^(APCLSRT2)=$S($D(^XTMP("APCLAP1",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 APCLADIS="DISCIPLINE NOT AVAILABLE",APCLSRT2="??" G SETSECD1
 I '$D(^DIC(7,APCLZ,9999999)) S APCLADIS="DISCIPLINE NOT AVAILABLE",APCLSRT2="??" 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("APCLAP1",APCLJOB,APCLBTH,@APCLSORT,APCLSRT2)):^(APCLSRT2)+1,1:1)
 Q
DX ;
 D DXX^APCLAP0
 Q
 ;
APCC ;APC CATEGORY
 D DXX^APCLAP0
 S APCLAPCC=$P(^AUTTRCDC($P(^AUTTRCD(APCLDA1,0),U,4),0),U)
 S APCLSRT2=" "
 Q
CLEX ;
09 ;;
11 ;;
36 ;;
41 ;;
42 ;;
51 ;;
52 ;;
53 ;;
54 ;;
56 ;;
60  ;;
99 ;;