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

APCLDP1P.m

Go to the documentation of this file.
APCLDP1P ; IHS/CMI/LAB - print active client list ;
 ;;2.0;IHS PCC SUITE;**2,7,11**;MAY 14, 2009;Build 58
 ;
 ;cmi/anch/maw 9/10/2007 code set versioning in VSTS
 ;
PRINT ;
START ;
 S APCL80D="-------------------------------------------------------------------------------"
 S Y=APCLBD D DD^%DT S APCLBDD=Y S Y=APCLED D DD^%DT S APCLEDD=Y
 S APCLPG=0
 I '$D(^XTMP("APCLDP1",APCLJOB,APCLBTH)) D HEAD W !!,"NO PATIENTS TO REPORT" G DONE
 S APCLPROV=0 F  S APCLPROV=$O(^XTMP("APCLDP1",APCLJOB,APCLBTH,APCLPROV)) Q:APCLPROV'=+APCLPROV!($D(APCLQ))  D
 .S DFN="" K APCLQ
 .S APCLSUB=0
 .D HEAD Q:$D(APCLQ)  F  S DFN=$O(^XTMP("APCLDP1",APCLJOB,APCLBTH,APCLPROV,DFN)) Q:DFN=""!($D(APCLQ))  D DFN
 .Q:$D(APCLQ)
 .I $Y>(IOSL-3) D HEAD Q:$D(APCLQ)
 .W !,"Total # of Patients for "_$$VAL^XBDIQ1(200,APCLPROV,.01),":  ",APCLSUB,!
 G:$D(APCLQ) DONE
DONE D DONE^APCLOSUT
 K ^XTMP("APCLDP1",APCLJOB,APCLBTH),APCLJOB,APCLBTH
 Q
DFN ;
 S APCLSUB=APCLSUB+1
 I $Y>(IOSL-6) D HEAD Q:$D(APCLQ)
 W !,$E($P(^DPT(DFN,0),U),1,15)
 S APCLHRCN=$S($D(^AUPNPAT(DFN,41,DUZ(2),0)):$P(^(0),U,2),1:"<none>")
 W ?17,$J(APCLHRCN,7)
 K ^UTILITY("DIQ1",$J) S DIC=9000001,DA=DFN,DR=1102.99 D EN^DIQ1
 S APCLAGE=$G(^UTILITY("DIQ1",$J,9000001,DFN,1102.99)) K ^UTILITY("DIQ1",$J)
 W ?26,APCLAGE
VSTS ; process visits
 S APCLRCNT=0
 K APCLRLOC,APCLPRV,APCLPROB
 S APCLR=0,APCLBDO=9999999-APCLBD,APCLEDO=9999999-APCLED,APCLSD=APCLED-1,APCLRCNT=0
 F  S APCLSD=$O(^AUPNVSIT("AA",DFN,APCLSD)) Q:APCLSD>APCLBDO!(APCLSD="")  D
 .S APCLR=0 F  S APCLR=$O(^AUPNVSIT("AA",DFN,APCLSD,APCLR)) Q:APCLR'=+APCLR  D
 ..;TABLE PROVIDERS
 ..S APCLP=0 F  S APCLP=$O(^AUPNVPRV("AD",APCLR,APCLP)) Q:APCLP'=+APCLP  S P=$P(^AUPNVPRV(APCLP,0),U) D
 ...I P=APCLPROV S APCLRCNT=APCLRCNT+1 Q
 ...S:'$D(APCLPRV($S($P(^DD(9000010.06,.01,0),U,2)[200:$P(^VA(200,P,0),U),1:$P(^DIC(16,P,0),U)))) APCLPRV($S($P(^DD(9000010.06,.01,0),U,2)[200:$P(^VA(200,P,0),U),1:$P(^DIC(16,P,0),U)))=0
 ...S APCLPRV($S($P(^DD(9000010.06,.01,0),U,2)[200:$P(^VA(200,P,0),U),1:$P(^DIC(16,P,0),U)))=APCLPRV($S($P(^DD(9000010.06,.01,0),U,2)[200:$P(^VA(200,P,0),U),1:$P(^DIC(16,P,0),U)))+1
 ..;TABLE PROBLEMS
 ..;S APCLP=0 F  S APCLP=$O(^AUPNVPOV("AD",APCLR,APCLP)) Q:APCLP'=+APCLP  S P=$P(^AUPNVPOV(APCLP,0),U),APCLPROB($P(^ICD9(P,0),U)_" - "_$E($P(^ICD9(P,0),U,3),1,25))=""  ;cmi/anch/maw 9/10/2007 orig line
 ..S APCLP=0 F  S APCLP=$O(^AUPNVPOV("AD",APCLR,APCLP)) Q:APCLP'=+APCLP  S P=$P(^AUPNVPOV(APCLP,0),U),APCLPROB($P($$ICDDX^ICDEX(P),U,2)_" - "_$E($P($$ICDDX^ICDEX(P),U,4),1,25))=""  ;cmi/anch/maw 9/10/2007 csv
 ..Q
 .Q
 K APCLLINE,APCLPRNT,APCLPCNT,APCLPRNM
 S APCLLINE(1)=""
 K APCLPRNM S X="",C=0,K=15 F  S X=$O(APCLPRV(X)) Q:X=""  S C=C+1,APCLPRNM(C)=$E(X,1,10)_" ("_APCLPRV(X)_")"
 D LINE
 K APCLPRNM S X="",C=0,K=25 F  S X=$O(APCLPROB(X)) Q:X=""  S C=C+1,APCLPRNM(C)=X
 D LINE
 S APCLRCNT=$J(APCLRCNT,4) W ?31,APCLRCNT S X=0 F  S X=$O(APCLLINE(X)) Q:X'=+X  W ?38,APCLLINE(X),!
 Q
LINE ;
 I '$D(APCLPRNM) S APCLPRNT="--" D
 .S APCLPRNT=$E(APCLPRNT,1,K) D
 ..S J=$L(APCLPRNT),APCLLINE(1)=APCLLINE(1)_APCLPRNT F I=J:1:K S APCLLINE(1)=APCLLINE(1)_" "
 S X=0 F  S X=$O(APCLPRNM(X)) Q:X'=+X  D
 .I X=1 D  Q
 ..S APCLPRNT=$E(APCLPRNM(1),1,K) D
 ...S J=$L(APCLPRNT),APCLLINE(1)=APCLLINE(1)_APCLPRNT F I=J:1:K S APCLLINE(1)=APCLLINE(1)_" "
 .S APCLPRNT=$E(APCLPRNM(X),1,K) D
 ..I '$D(APCLLINE(X)) S APCLLINE(X)="",$P(APCLLINE(X)," ",($L(APCLLINE(1))-K))=""
 ..S J=$L(APCLPRNT),APCLLINE(X)=APCLLINE(X)_APCLPRNT F I=J:1:K S APCLLINE(X)=APCLLINE(X)_" "
 S X=1 F  S X=$O(APCLLINE(X)) Q:X'=+X  I $L(APCLLINE(X))<$L(APCLLINE(1)) S K=$L(APCLLINE(X))+1,J=$L(APCLLINE(1)) F I=K:1:J S APCLLINE(X)=APCLLINE(X)_" "
 Q
 I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S APCLQ="" Q
HEAD1 ;
 W:$D(IOF) @IOF S APCLPG=APCLPG+1
 W $P(^VA(200,DUZ,0),U,2),?72,"Page ",APCLPG,!
 W ?(80-$L($P(^DIC(4,DUZ(2),0),U))/2),$P(^DIC(4,DUZ(2),0),U),!
 W ?5,"PATIENTS BY DESIGNATED PRIMARY CARE PROVIDER, WITH VISIT COUNTS",!
 I $G(APCLPROV) S P=$S($P(^DD(9000010.06,.01,0),U,2)[200:$P(^VA(200,APCLPROV,0),U),1:$P(^DIC(16,APCLPROV,0),U)),L=$L(P) W ?(80-(L+35)/2),"DESIGNATED PRIMARY CARE PROVIDER:  ",P,!
 W ?17,"VISIT DATES:  ",APCLBDD,"  TO  ",APCLEDD,!
PIH ;
 W !!?31,"TIMES",?38,"OTHER"
 W !?31,"SEEN",?38,"PROVIDERS",!
 W "PATIENT NAME",?17,"CHART #",?26,"AGE",?31,"BY DP",?38,"SEEN",?54,"ICD DIAGNOSES",!,APCL80D
 Q