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

APCLIPC3.m

Go to the documentation of this file.
APCLIPC3 ; IHS/OHPRD/TMJ - continuation of APCLIPC2 ;  [ 03/19/01  9:47 AM ]
 ;;3.0;IHS PCC REPORTS;**7**;FEB 05, 1997
VISITS ;
 K APCLGOTA,APCLGOTB,APCLSKIP,APCLLOCC
 S APCLV=0 F  S APCLV=$O(^AUPNVSIT("AA",APCLDFN,APCLV)) Q:APCLV'=+APCLV!($D(APCLGOTA)&($D(APCLGOTB)))!($P(APCLV,".")>APCLSDI)  S APCLVD=$P(APCLV,".") D PROC
 Q
PROC ;
 S APCLVDFN=0 F  S APCLVDFN=$O(^AUPNVSIT("AA",APCLDFN,APCLV,APCLVDFN)) Q:APCLVDFN'=+APCLVDFN  S APCLVREC=^AUPNVSIT(APCLVDFN,0) D SEEN
 Q
SEEN ;determine if patient was seen in FYs
 K APCLSKIP
 G:$D(APCLGOTA) ALL
 Q:APCLVD>APCLSDI
 Q:APCLVD<APCLEDI
 I APCLVFL="L",APCLSU'=$P(APCLVREC,U,6) Q
 Q:$P(APCLVREC,U,7)'="H"  ;Quit if Not Inpatient
 Q:$P(APCLVREC,U,11)
 Q:'$P(APCLVREC,U,9)
 S APCLGOTA="",$P(^XTMP("APCLPCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,2)=$P(^XTMP("APCLPCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,2)+1
ALL ;
 Q:$D(APCLGOTB)
 Q:$P(APCLVREC,U,7)'="H"  ;Quit if Not Inpatient
 I APCLVFL="L",APCLSU'=$P(APCLVREC,U,6) Q
 Q:$P(APCLVREC,U,11)
 Q:'$P(APCLVREC,U,9)
 I APCLVD>APCLSDI S APCLGOTB="" Q
 Q:APCLVD<APCLEDI
 S $P(^XTMP("APCLPCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,3)=$P(^XTMP("APCLPCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,3)+1
APC ;
 Q:$P(APCLVREC,U,7)'="H"  ;Quit if not Inpatient
 Q:$D(^APCLCNTL(4,11,"B",$P(APCLVREC,U,3)))
 Q:'$D(^AUPNVPOV("AD",APCLVDFN))
 Q:'$D(^AUPNVPRV("AD",APCLVDFN))
 S APCLVLOC=$P(APCLVREC,U,6) Q:APCLVLOC=""
 Q:'$D(^DIC(4,APCLVLOC))
 Q:'$D(^AUTTLOC(APCLVLOC))
 S APCLCLIN=$P(APCLVREC,U,8) I APCLCLIN="" G PCP
CHKCL ;
 S X=$S(APCLCLIN="":"",$D(^DIC(40.7,APCLCLIN,0)):$P(^DIC(40.7,APCLCLIN,0),U,2),1:"")
 Q:X=""
 I X=56,'$D(^AUPNVMED("AD",APCLVDFN)) Q
 I $D(^APCLCNTL(2,11,"B",X)) Q
PCP ;
 S (APCL1,APCL2)=0 F I=0:0 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 DISC
 Q:$D(APCLSKIP)
 S APCLPPOV=$O(^AUPNVPOV("AD",APCLVDFN,""))
 Q:$P(^ICD9($P(^AUPNVPOV(APCLPPOV,0),U),0),U)=".9999"
 S $P(^XTMP("APCLPCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,4)=$P(^XTMP("APCLPCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,4)+1
 I APCLDISC>69,APCLDISC<91,APCLDISC'=88 G PCP1
 S X="P"_APCLDISC I $T(@X)="" Q
PCP1 S $P(^XTMP("APCLPCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,5)=$P(^XTMP("APCLPCT",APCLJOB,APCLBT,@APCLMAJ,@APCLMIN),U,5)+1
 Q
DISC ;
 I $P(^DD(9000010.06,.01,0),U,2)[6 G DISC6
 S APCLDISC=$$PROVCLSC^XBFUNC1(APCLAP)
 I APCLDISC'?.N S APCLSKIP="" 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
DISC6 ;
 I '$D(^DIC(6,APCLAP)) S APCLSKIP="" Q
 S APCLY=$P(^DIC(6,APCLAP,0),U,4)
 I APCLY="" S APCLSKIP="" Q
 I '$D(^DIC(7,APCLY,9999999)) S APCLSKIP="" Q
 S APCLDISC=$P(^DIC(7,APCLY,9999999),U) I APCLDISC="" S APCLSKIP="" 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
P00 ;;
P11 ;;
P16 ;;
P17 ;;
P18 ;;
P21 ;;
P41 ;;
P44 ;;
P25 ;;
P33 ;;