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

APCLCZP1.m

Go to the documentation of this file.
APCLCZP1 ; IHS/CMI/LAB - All visit report process ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;
 ;cmi/anch/maw 9/10/2007 code set versioning in DX
 ;
START ;
 S APCLBT=$H
 K ^XTMP("APCLCZP",APCLJOB,APCLBTH)
 D XTMP^APCLOSUT("APCLCZ","PCC - ZIP CODE 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)),"AOS"[$P(^(0),U,7) 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:"EDXCIH"[$P(APCLVREC,U,7)
 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 APCLLOC]"",APCLLOC'=APCLVLOC 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
 ;CODE TO GET ZIP CODE
 S APCLCZP=$P($G(^DPT($P(APCLVREC,U,5),.11)),U,6) I APCLCZP="" S APCLCZP="NONE"
 S ^(APCLCZP)=$S($D(^XTMP("APCLCZP",APCLJOB,APCLBTH,"LOCTOT",APCLVLOC,@APCLSORT,APCLSRT2,APCLCZP)):^(APCLCZP)+1,1:1)
 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 ;
 S APCLCLIN=$P(APCLVREC,U,8) I APCLCLIN="" S APCLCLIN="NO CLINIC ENTERED",APCLSRT2="99999" Q
CLIN1 S APCLSRT2=$P(^DIC(40.7,APCLCLIN,0),U,2),APCLCLIN=$P(^DIC(40.7,APCLCLIN,0),U) I APCLSRT2="" S APCLSRT2="XX"
 Q
 ;
SC ;
 K ^UTILITY("DIQ1",$J)
 K DIQ,DIC,DA,DR
 S DIC="^AUPNVSIT(",DR=".07",DA=APCLVDFN,DIQ(0)="E" D EN^DIQ1 K DIC,DA,DR,DIQ
 S APCLCAT=^UTILITY("DIQ1",$J,9000010,APCLVDFN,.07,"E")
 S APCLSRT2=$P(APCLVREC,U,7)
 K ^UTILITY("DIQ1",$J)
 Q
DATE ;
 S APCLDATE=$P(APCLODAT,".")
 S X=APCLDATE D H^%DTC S APCLSRT2=$P("SUNDAY;MONDAY;TUESDAY;WEDNESDAY;THURSDAY;FRIDAY;SATURDAY",";",%Y+1) I APCLSRT2="" S APCLSRT2="UNKNOWN"
 Q
LOS ;
 S APCLSRT2=$P(^AUTTLOC(APCLVLOC,0),U,10)
 Q
 ;
SETSEC ;
 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 SETSEC1
 Q:'$D(^DIC(7,APCLZ,9999999))
 S APCLSRT2=$P(^DIC(7,APCLZ,9999999),U) I APCLSRT2="" S APCLSRT2="PROVIDER DISCIPLINE UNAVAILABLE" G SETSEC1
 S APCLSRT2=$P(^DIC(7,APCLZ,0),U)
SETSEC1 S APCLSEC=$P(^DIC(16,APCLSEC,0),U)
 S ^(APCLSRT2)=$S($D(^XTMP("APCLCZP",APCLJOB,APCLBTH,"LOCTOT",APCLVLOC,@APCLSORT,APCLSRT2)):^(APCLSRT2)+1,1:1)
 Q