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

APCLPP2P.m

Go to the documentation of this file.
  1. APCLPP2P ; IHS/CMI/LAB - provider profile print ;
  1. ;;2.0;IHS PCC SUITE;**2,7,10,11**;MAY 14, 2009;Build 58
  1. ;
  1. ;cmi/anch/maw 9/10/2007 code set versioning in PV
  1. ;
  1. START ;
  1. S APCLPG=0,APCLQUIT=""
  1. S APCLNITM=$S(APCLLSV="S":5,1:10)
  1. S APCLPRV=0 F S APCLPRV=$O(APCLPROV(APCLPRV)) Q:APCLPRV'=+APCLPRV!(APCLQUIT) D PRN
  1. DONE ;
  1. D DONE^APCLOSUT
  1. K ^XTMP("APCLPP2",APCLJOB,APCLBTH)
  1. K APCLQUIT
  1. Q
  1. PRN ;
  1. D HEAD Q:APCLQUIT
  1. W !,"1 - Designated Primary Care Provider Panel",!
  1. W !,"You are the Designated Primary Care Provider for ",$$C(APCLDPPT(APCLPRV),0)," patients. In this"
  1. W !,"time period you have provided services (any type) to ",$$C(APCLDPPS(APCLPRV),0)," (",$$PER(APCLDPPS(APCLPRV),APCLDPPT(APCLPRV)),") patients"
  1. W !,"from your Designated Primary Care Provider Panel."
  1. W !!,"In this time period, you provided ambulatory services at least twice to ",$$C(APCLDP2V(APCLPRV),0)
  1. W !,"patients who have no Designated Primary Care Provider identified."
  1. W !!,"2 - Demographics and Workload for All Patients Served (Any Type of Service)"
  1. I $Y>(IOSL-4) D HEAD Q:APCLQUIT
  1. W !!,"In this time period you have provided services (any type) to ",$$C(APCLDW1(APCLPRV),0)," patients. "
  1. W !,$$C(APCLDW2(APCLPRV),0)," (",$$PER(APCLDW2(APCLPRV),APCLDW1(APCLPRV)),") are from your Designated Primary Provider Panel. ",$$C(APCLDW3(APCLPRV),0)," (",$$PER(APCLDW3(APCLPRV),APCLDW1(APCLPRV)),") are"
  1. I $Y>(IOSL-4) D HEAD Q:APCLQUIT
  1. I $Y>(IOSL-4) D HEAD Q:APCLQUIT
  1. W !,"not from your Designated Primary Care Provider Panel."
  1. I $Y>(IOSL-4) D HEAD Q:APCLQUIT
  1. W !!,$$PER(APCLDW4(APCLPRV),APCLDW1(APCLPRV))," of your patients were Male, ",$$PER(APCLDW5(APCLPRV),APCLDW1(APCLPRV))," Female, and ",$$PER(APCLDW51(APCLPRV),APCLDW1(APCLPRV))," Unknown Gender."
  1. I $Y>(IOSL-4) D HEAD Q:APCLQUIT
  1. W !!,$$PER(APCLDW6(APCLPRV),APCLDW1(APCLPRV))," were 18 and under; ",$$PER(APCLDW7(APCLPRV),APCLDW1(APCLPRV))," were 19-49; "
  1. W $$PER(APCLDW8(APCLPRV),APCLDW1(APCLPRV))," were 50-64; and ",$$PER(APCLDW9(APCLPRV),APCLDW1(APCLPRV))," were 65 and over."
  1. I $Y>(IOSL-3) D HEAD Q:APCLQUIT
  1. COMM ;communities
  1. I $Y>(IOSL-APCLNITM) D HEAD Q:APCLQUIT
  1. K APCLDISP F X=1:1:APCLNITM S APCLDISP(X)=""
  1. W !!,"The leading residences for your ",?40,"The leading tribes represented",!,"patients are:",?40,"among your patients are:"
  1. S (APCLX,APCLC)=0 F S APCLX=$O(^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","COMMC",APCLX)) Q:APCLX'=+APCLX!(APCLC>4)!(APCLQUIT) D
  1. .S APCLY="" F S APCLY=$O(^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","COMMC",APCLX,APCLY)) Q:APCLY=""!(APCLQUIT) D
  1. ..S APCLC=APCLC+1 S APCLA=^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","COMMC",APCLX,APCLY)
  1. ..S APCLB=$$C(APCLA,0)
  1. ..S Z=$$PER(APCLA,APCLDW1(APCLPRV))
  1. ..I '$D(APCLDISP(APCLC)) S APCLDISP(APCLC)=""
  1. ..S $P(APCLDISP(APCLC),U)=$E(APCLY,1,20)_U_APCLB_U_Z
  1. S (APCLX,APCLC)=0 F S APCLX=$O(^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","TRIBEC",APCLX)) Q:APCLX'=+APCLX!(APCLC>4)!(APCLQUIT) D
  1. .S APCLY="" F S APCLY=$O(^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","TRIBEC",APCLX,APCLY)) Q:APCLY=""!(APCLQUIT) D
  1. ..S APCLC=APCLC+1 S APCLA=^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","TRIBEC",APCLX,APCLY)
  1. ..S APCLB=$$C(APCLA,0)
  1. ..S Z=$$PER(APCLA,APCLDW1(APCLPRV))
  1. ..I '$D(APCLDISP(APCLC)) S APCLDISP(APCLC)=""
  1. ..S $P(APCLDISP(APCLC),U,4)=$E(APCLY,1,22)_U_APCLB_U_Z
  1. I $Y>(IOSL-4) D HEAD Q:APCLQUIT
  1. S APCLX=0 F S APCLX=$O(APCLDISP(APCLX)) Q:APCLX'=+APCLX!(APCLX>APCLNITM)!(APCLQUIT) D
  1. .I $Y>(IOSL-3) D HEAD Q:APCLQUIT
  1. .W !?1,$P(APCLDISP(APCLX),U) I $P(APCLDISP(APCLX),U,2)]"" W ?22,$$PAD($P(APCLDISP(APCLX),U,2),6),?29,$J($P(APCLDISP(APCLX),U,3),4,0),"%"
  1. .W ?41,$P(APCLDISP(APCLX),U,4) I $P(APCLDISP(APCLX),U,5)]"" W ?66,$$PAD($P(APCLDISP(APCLX),U,5),6),?73,$J($P(APCLDISP(APCLX),U,6),4,0),"%"
  1. Q:APCLQUIT
  1. W !!,"Of these services, ",$$C(APCLTCR(APCLPRV),0)," (",$$PER(APCLTCR(APCLPRV),APCLDW1(APCLPRV))
  1. W ") were chart reviews and ",$$C(APCLTTEL(APCLPRV),0)," (",$$PER(APCLTTEL(APCLPRV),APCLDW1(APCLPRV)),") were",!,"telecommunications services."
  1. I $Y>(IOSL-4) D HEAD Q:APCLQUIT
  1. AMB ;
  1. W !!,"3 - Ambulatory Workload: You had a total of ",$$C(APCLDW10(APCLPRV),0)," ambulatory visits during",!
  1. W "this time period. You were the Primary Provider for ",$$C(APCLDW11(APCLPRV),0)," visits (",$$PER(APCLDW11(APCLPRV),APCLDW10(APCLPRV)),") and"
  1. W !,"Secondary Provider for ",$$C(APCLDW12(APCLPRV),0)," visits (",$$PER(APCLDW12(APCLPRV),APCLDW10(APCLPRV)),")."
  1. LOCSC ;
  1. I $Y>(IOSL-8) D HEAD Q:APCLQUIT
  1. W !!,"Your services were provided at the",?40,"Your services included the following",!,"following locations:",?40,"Service Categories:"
  1. K APCLDISP F X=1:1:APCLNITM S APCLDISP(X)=""
  1. ;tally up top 4 locations and other.
  1. S (APCLX,APCLC)=0 F S APCLX=$O(^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","LOCC",APCLX)) Q:APCLX'=+APCLX!(APCLC>3)!(APCLQUIT) D
  1. .S APCLY="" F S APCLY=$O(^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","LOCC",APCLX,APCLY)) Q:APCLY=""!(APCLQUIT)!(APCLC>3) D
  1. ..S APCLC=APCLC+1 S APCLA=^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","LOCC",APCLX,APCLY)
  1. ..K ^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","LOCC",APCLX,APCLY)
  1. ..S APCLB=$$C(APCLA,0)
  1. ..S Z=$$PER(APCLA,APCLDW10(APCLPRV))
  1. ..I '$D(APCLDISP(APCLC)) S APCLDISP(APCLC)=""
  1. ..S $P(APCLDISP(APCLC),U)=$E(APCLY,1,20)_U_APCLB_U_Z
  1. S APCLTOTH="",APCLX=0 F S APCLX=$O(^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","LOCC",APCLX)) Q:APCLX'=+APCLX D
  1. .S APCLY=0 F S APCLY=$O(^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","LOCC",APCLX,APCLY)) Q:APCLY=""!(APCLY>3) S APCLTOTH(APCLPRV)=APCLTOTH(APCLPRV)+^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","LOCC",APCLX,APCLY)
  1. I APCLTOTH(APCLPRV) S APCLDISP(5)="OTHER"_U_$$C(APCLTOTH(APCLPRV),0)_U_$$PER(APCLTOTH(APCLPRV),APCLDW10(APCLPRV))
  1. SC ;
  1. S (APCLX,APCLC)=0 F S APCLX=$O(^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","SCC",APCLX)) Q:APCLX'=+APCLX!(APCLC>(APCLNITM-1))!(APCLQUIT) D
  1. .S APCLY="" F S APCLY=$O(^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","SCC",APCLX,APCLY)) Q:APCLY=""!(APCLQUIT) D
  1. ..S APCLC=APCLC+1 S APCLA=^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","SCC",APCLX,APCLY)
  1. ..S APCLB=$$C(APCLA,0)
  1. ..S Z=$$PER(APCLA,APCLDW10(APCLPRV))
  1. ..I '$D(APCLDISP(APCLC)) S APCLDISP(APCLC)=""
  1. ..S $P(APCLDISP(APCLC),U,4)=$E(APCLY,1,22)_U_APCLB_U_Z
  1. I $Y>(IOSL-APCLNITM) D HEAD Q:APCLQUIT
  1. S APCLX=0 F S APCLX=$O(APCLDISP(APCLX)) Q:APCLX'=+APCLX!(APCLX>APCLNITM)!(APCLQUIT) D
  1. .I $Y>(IOSL-3) D HEAD Q:APCLQUIT
  1. .W !?1,$P(APCLDISP(APCLX),U) I $P(APCLDISP(APCLX),U,2)]"" W ?22,$$PAD($P(APCLDISP(APCLX),U,2),6),?29,$J($P(APCLDISP(APCLX),U,3),4,0),"%"
  1. .W ?41,$P(APCLDISP(APCLX),U,4) I $P(APCLDISP(APCLX),U,5)]"" W ?66,$$PAD($P(APCLDISP(APCLX),U,5),6),?73,$J($P(APCLDISP(APCLX),U,6),4,0),"%"
  1. Q:APCLQUIT
  1. PV ;
  1. I $Y>(IOSL-APCLNITM) D HEAD Q:APCLQUIT
  1. K APCLDISP F X=1:1:APCLNITM S APCLDISP(X)=""
  1. W !!,"The ",APCLNITM," leading Purposes of Visit",?40,"The ",APCLNITM," leading Medications you"
  1. W !,"(including Primary and Secondary POV's)",?40,"prescribed or refilled as Primary"
  1. W !,"that you identified were:",?40,"Provider for the Visit were:"
  1. S (APCLX,APCLC)=0 F S APCLX=$O(^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","OUTDXC",APCLX)) Q:APCLX'=+APCLX!(APCLC>(APCLNITM-1))!(APCLQUIT) D
  1. .S APCLY="" F S APCLY=$O(^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","OUTDXC",APCLX,APCLY)) Q:APCLY=""!(APCLQUIT) D
  1. ..S APCLC=APCLC+1 S APCLA=^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","OUTDXC",APCLX,APCLY)
  1. ..S APCLB=$$C(APCLA,0)
  1. ..I '$D(APCLDISP(APCLC)) S APCLDISP(APCLC)=""
  1. ..;S Z=$P(^ICD9(APCLY,0),U),$E(Z,8)=$E($P(^ICD9(APCLY,0),U,3),1,19),$P(APCLDISP(APCLC),U)=Z_U_APCLB ;cmi/anch/maw 9/10/2007 orig line
  1. ..S Z=$P($$ICDDX^ICDEX(APCLY),U,2),$E(Z,10)=$E($P($$ICDDX^ICDEX(APCLY),U,4),1,16),$P(APCLDISP(APCLC),U)=Z_U_APCLB ;cmi/anch/maw 9/10/2007 csv
  1. S (APCLX,APCLC)=0 F S APCLX=$O(^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","RXC",APCLX)) Q:APCLX'=+APCLX!(APCLC>(APCLNITM-1))!(APCLQUIT) D
  1. .S APCLY="" F S APCLY=$O(^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","RXC",APCLX,APCLY)) Q:APCLY=""!(APCLQUIT) D
  1. ..S APCLC=APCLC+1 S APCLA=^XTMP("APCLPP2",APCLJOB,APCLBTH,"RP",APCLPRV,"REPORT","RXC",APCLX,APCLY)
  1. ..S APCLB=$$C(APCLA,0)
  1. ..I '$D(APCLDISP(APCLC)) S APCLDISP(APCLC)=""
  1. ..S $P(APCLDISP(APCLC),U,4)=$E(APCLY,1,30)_U_APCLB
  1. I $Y>(IOSL-APCLNITM) D HEAD Q:APCLQUIT
  1. S APCLX=0 F S APCLX=$O(APCLDISP(APCLX)) Q:APCLX'=+APCLX!(APCLX>APCLNITM)!(APCLQUIT) D
  1. .I $Y>(IOSL-APCLNITM) D HEAD Q:APCLQUIT
  1. .W !?1,$P(APCLDISP(APCLX),U) I $P(APCLDISP(APCLX),U,2)]"" W ?28,$$PAD($P(APCLDISP(APCLX),U,2),6)
  1. .W ?41,$P(APCLDISP(APCLX),U,4) I $P(APCLDISP(APCLX),U,5)]"" W ?72,$$PAD($P(APCLDISP(APCLX),U,5),6)
  1. Q:APCLQUIT
  1. D PROC^APCLPP2Q
  1. Q
  1. G:'APCLPG HEAD1
  1. K DIR I $E(IOST)="C",IO=IO(0) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S APCLQUIT=1 Q
  1. HEAD1 ;
  1. I $D(IOF) W @IOF
  1. S APCLPG=APCLPG+1
  1. W !?58,$$FMTE^XLFDT(DT),?72,"Page ",APCLPG,!
  1. W $$CTR("Provider Practice Description For "_APCLPRVN(APCLPRV)_", "_APCLPRVD(APCLPRV),80),!
  1. W !?12,"For the Time Period: ",$$FMTE^XLFDT(APCLBD)," - ",$$FMTE^XLFDT(APCLED),!
  1. I $G(APCLSEAT) W $$CTR("Search Template of Patients Used: "_$P(^DIBT(APCLSEAT,0),U)),!
  1. I APCLEXCL W !,"** Please Note that certain diagnoses codes have been excluded",!,"from the list of purpose of visits.",!
  1. Q
  1. PER(N,D) ;return % of n/d
  1. I 'D Q "0%"
  1. NEW Z
  1. S Z=N/D,Z=Z*100,Z=$J(Z,3,0)
  1. Q $$STRIP^XLFSTR(Z," ")_"%"
  1. C(X,X2,X3) ;
  1. D COMMA^%DTC
  1. Q $$STRIP^XLFSTR(X," ")
  1. PAD(D,L) ; -- SUBRTN to pad length of data
  1. ; -- D=data L=length
  1. S L=L-$L(D)
  1. Q $E($$REPEAT^XLFSTR(" ",L),1,L)_D
  1. ;
  1. CTR(X,Y) ;EP - Center X in a field Y wide.
  1. Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
  1. ;----------
  1. EOP ;EP - End of page.
  1. Q:$E(IOST)'="C"
  1. Q:$D(ZTQUEUED)!'(IOT="TRM")!$D(IO("S"))
  1. NEW DIR
  1. K DIRUT,DFOUT,DLOUT,DTOUT,DUOUT
  1. S DIR("A")="End of Report. Press return",DIR(0)="E" D ^DIR
  1. Q
  1. ;----------
  1. USR() ;EP - Return name of current user from ^VA(200.
  1. Q $S($G(DUZ):$S($D(^VA(200,DUZ,0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
  1. ;----------
  1. LOC() ;EP - Return location name from file 4 based on APCLPRV.
  1. Q $S($G(DUZ(2)):$S($D(^DIC(4,DUZ(2),0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")
  1. ;----------
  1. ;