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

APCLGVP.m

Go to the documentation of this file.
APCLGVP ; IHS/CMI/LAB - print active client list ;
 ;;2.0;IHS PCC SUITE;**11**;MAY 14, 2009;Build 58
 ;
 ;cmi/anch/maw 9/10/2007 code set versioning in VSTS
 ;
PRINT ;
 I APCLOUT="S" D  D DONE Q
 .S X=0 F  S X=$O(^XTMP("APCLGV",APCLJOB,APCLBTH,"PATIENTS","TEMPLATE",X)) Q:X'=+X  S ^DIBT(APCLSTMP,1,X)=""
 .W !,"Search template: ",$P(^DIBT(APCLSTMP,0),U)," has been created."
START ;
 S APCL80D="-------------------------------------------------------------------------------"
 K APCLQ
 S Y=APCLBD D DD^%DT S APCLBDD=Y S Y=APCLED D DD^%DT S APCLEDD=Y
 S APCLPG=0
 I '$D(^XTMP("APCLGV",APCLJOB,APCLBTH)) D HEAD W !!,"NO PATIENTS TO REPORT" G DONE
SRTV ;
 D HEAD
 S APCLSRT="" F  S APCLSRT=$O(^XTMP("APCLGV",APCLJOB,APCLBTH,"PATIENTS",APCLSRT)) Q:APCLSRT=""!($D(APCLQ))  D PAT
 G DONE
PAT ;
 I 'APCLNPAG D  Q:$D(APCLQ)
 .I $Y>(IOSL-5) D HEAD Q:$D(APCLQ)
 .W !!,APCLSORV,":  ",APCLSRT,!
 I APCLNPAG D HEAD Q:$D(APCLQ)  W !,APCLSORV,":  ",APCLSRT,!
 S DFN="" F  S DFN=$O(^XTMP("APCLGV",APCLJOB,APCLBTH,"PATIENTS",APCLSRT,DFN)) Q:DFN=""!($D(APCLQ))  D DFN
 Q
DONE D DONE^APCLOSUT
 K ^XTMP("APCLGV",APCLJOB,APCLBTH),APCLJOB,APCLBTH
 Q
DFN ;
 I $Y>(IOSL-4) 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)
 ;begin Y2K
 ;W ?27,$P(^DPT(DFN,0),U,2) S Y=$P(^DPT(DFN,0),U,3) W ?31,$E(Y,4,5),"/",$E(Y,6,7),"/",$E(Y,2,3) ;Y2000
 W ?27,$P(^DPT(DFN,0),U,2) S Y=$P(^DPT(DFN,0),U,3) W ?30,$E(Y,4,5),"/",$E(Y,6,7),"/",(1700+($E(Y,1,3))) ;Y2000
 ;end Y2K
VSTS ; process visits
 K APCLRLOC,APCLPRV,APCLPROB
 S APCLVIEN=0,APCLBDO=(9999999-APCLBD)_".9999",APCLEDO=9999999-APCLED,APCLSD=(APCLEDO-1)_".9999",APCLRCNT=0
 F  S APCLSD=$O(^AUPNVSIT("AA",DFN,APCLSD)) Q:APCLSD>APCLBDO!(APCLSD="")  D
 .S APCLVIEN=0 F  S APCLVIEN=$O(^AUPNVSIT("AA",DFN,APCLSD,APCLVIEN)) Q:APCLVIEN'=+APCLVIEN  D
 ..Q:'$P(^AUPNVSIT(APCLVIEN,0),U,9)
 ..Q:$P(^AUPNVSIT(APCLVIEN,0),U,11)
 ..S APCLVREC=^AUPNVSIT(APCLVIEN,0)
 ..D SCREENS^APCLGV
 ..Q:$D(APCLSKIP)
 ..S APCLRCNT=APCLRCNT+1 ;COUNT # VISITS
 ..;TABLE LOC SEEN
 ..I $P(^AUPNVSIT(APCLVIEN,0),U,6)]"",'$D(APCLRLOC($P(^DIC(4,$P(^(0),U,6),0),U))) S APCLRLOC($P(^DIC(4,$P(^AUPNVSIT(APCLVIEN,0),U,6),0),U))=""
 ..;TABLE PROVIDERS
 ..S APCLP=0 F  S APCLP=$O(^AUPNVPRV("AD",APCLVIEN,APCLP)) Q:APCLP'=+APCLP  S P=$P(^AUPNVPRV(APCLP,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)))=""
 ..;TABLE PROBLEMS
 ..;S APCLP=0 F  S APCLP=$O(^AUPNVPOV("AD",APCLVIEN,APCLP)) Q:APCLP'=+APCLP  S P=$P(^AUPNVPOV(APCLP,0),U),APCLPROB($P(^ICD9(P,0),U))=""  ;cmi/anch/maw 9/10/2007 orig line
 ..S APCLP=0 F  S APCLP=$O(^AUPNVPOV("AD",APCLVIEN,APCLP)) Q:APCLP'=+APCLP  S P=$P(^AUPNVPOV(APCLP,0),U),APCLPROB($P($$ICDDX^ICDEX(P),U,2))=""  ;cmi/anch/maw 9/10/2007 csv
 ..Q
 .Q
 K APCLLINE,APCLPRNT,APCLPCNT,APCLPRNM
 S APCLLINE(1)=""
 S X="",C=0,K=11 F  S X=$O(APCLRLOC(X)) Q:X=""  S C=C+1,APCLPRNM(C)=X
 D LINE
 K APCLPRNM S X="",C=0,K=11 F  S X=$O(APCLPRV(X)) Q:X=""  S C=C+1,APCLPRNM(C)=X
 D LINE
 K APCLPRNM S X="",C=0,K=9 F  S X=$O(APCLPROB(X)) Q:X=""  S C=C+1,APCLPRNM(C)=X
 D LINE
 S APCLRCNT=$J(APCLRCNT,4),APCLLINE(1)=APCLLINE(1)_APCLRCNT,X=0 F  S X=$O(APCLLINE(X)) Q:X'=+X!($D(APCLQ))  D
 .I $Y>(IOSL-5) D HEAD Q:$D(APCLQ)
 .W ?41,APCLLINE(X),!
 Q
LINE ;
 I '$D(APCLPRNM) S APCLPRNT="--" D
 .S APCLPRNT=$E(APCLPRNT,1,10) 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,10) 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,10) 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 'APCLPG G HEAD1
 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 ?25,"PATIENTS SEEN AT LEAST ",APCLNUM," TIMES",!
 W ?17,"VISIT DATES:  ",APCLBDD,"  TO  ",APCLEDD,!
PIH W !!,?41,"LOCATION",?53,"PROVIDER",?65,"DX",?75,"#",!
 W "PATIENT NAME",?17,"CHART #",?26,"SEX",?31,"DOB",?41,"SEEN",?53,"SEEN",?65,"CODES",?73,"VISITS",!,APCL80D,!
 Q