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

BGP3DCLP.m

Go to the documentation of this file.
BGP3DCLP ; IHS/CMI/LAB - IHS gpra print ;
 ;;13.0;IHS CLINICAL REPORTING;;NOV 20, 2012;Build 81
 ;
CPPL1 ;EP
 Q:$G(BGPAREAA)
 ;
 S BGPCNT=BGPCPLC,BGPPCNT=0
 I BGPCNT<11!(BGPLIST'="R") S BGPCNT=1 G GO
 I BGPCNT<100 S BGPCNT=BGPCNT\10 G GO
 S BGPCNT=10
GO ;
 S BGPQUIT="",BGPGPG=0,BGPYH1P=1
 S BGPXL=1 D HEADER
 S BGPY=$O(^BGPCTRL("B",2013,0))
 S BGPX=0 F  S BGPX=$O(^BGPCTRL(BGPY,28,BGPX)) Q:BGPX'=+BGPX!(BGPQUIT)  D
 .I BGPPTYPE="P",$Y>(IOSL-2) D HEADER Q:BGPQUIT
 .D W^BGP3DP(^BGPCTRL(BGPY,28,BGPX,0),0,1,BGPPTYPE)
 S BGPXL=0
 D HEADER
 S BGPCOM="",BGPCOUNT=0 F  S BGPCOM=$O(^XTMP("BGP28CPL",BGPJ,BGPH,"LIST",BGPCOM)) Q:BGPCOM=""!(BGPQUIT)  D CPL1
 D W^BGP3DP("Total # of patients on list: "_+$G(BGPPCNT),0,2,BGPPTYPE)
 D W^BGP3DP("",0,1,BGPPTYPE)
 Q
CPL1 ;EP
 S BGPSEX="" F  S BGPSEX=$O(^XTMP("BGP28CPL",BGPJ,BGPH,"LIST",BGPCOM,BGPSEX)) Q:BGPSEX=""!(BGPQUIT)  D CPL2
 Q
CPL2 ;
 S BGPAGE="" F  S BGPAGE=$O(^XTMP("BGP28CPL",BGPJ,BGPH,"LIST",BGPCOM,BGPSEX,BGPAGE)) Q:BGPAGE=""!(BGPQUIT)  D
 .S DFN=0 F  S DFN=$O(^XTMP("BGP28CPL",BGPJ,BGPH,"LIST",BGPCOM,BGPSEX,BGPAGE,DFN)) Q:DFN'=+DFN!(BGPQUIT)  S BGPCOUNT=BGPCOUNT+1 D PRINTL
 .I BGPPTYPE="P",$Y>(BGPIOSL-3) D HEADER Q:BGPQUIT
 Q
PRINTL ;print one line
 Q:(BGPCOUNT#BGPCNT)
 I BGPPTYPE="P",$Y>(BGPIOSL-2) D HEADER Q:BGPQUIT
 S BGPPCNT=BGPPCNT+1
 D W^BGP3DP($E($P(^DPT(DFN,0),U),1,22),0,1,BGPPTYPE,1)
 D W^BGP3DP($$HRN^AUPNPAT(DFN,DUZ(2)),0,0,BGPPTYPE,2,24)
 D W^BGP3DP($E(BGPCOM,1,14),0,0,BGPPTYPE,3,31)
 D W^BGP3DP(BGPSEX,0,0,BGPPTYPE,4,46)
 D W^BGP3DP(BGPAGE,0,0,BGPPTYPE,5,49)
 S W="",X=$P(^XTMP("BGP28CPL",BGPJ,BGPH,"LIST",BGPCOM,BGPSEX,BGPAGE,DFN),"|||",1) F Y=1:1:12 I $P(X,"$$",Y)]"" S:W]"" W=W_"," S W=W_$P(X,"$$",Y)
 S Z="",X=$P(^XTMP("BGP28CPL",BGPJ,BGPH,"LIST",BGPCOM,BGPSEX,BGPAGE,DFN),"|||",2) F Y=1:1  Q:$P(X,"#",Y)=""  S:Z]"" Z=Z_", " S Z=Z_$P(X,"#",Y)
 D W^BGP3DP(W,0,0,BGPPTYPE,6,53)
 D W^BGP3DP(Z_$S(BGPPTYPE="P":"/",1:""),0,0,BGPPTYPE,7,53)
 D W^BGP3DP($$LAST(DFN,BGPED),0,0,BGPPTYPE,8,65)
 Q
 ;
LAST(P,EDATE) ;EP
 I '$D(^AUPNVSIT("AC",P)) Q ""
 K ^TMP($J,"A")
 S A="^TMP($J,""A"",",B=P_"^ALL VISITS;DURING "_$$FMTE^XLFDT($$FMADD^XLFDT(EDATE,-(365*3)))_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(B,A)
 I '$D(^TMP($J,"A",1)) Q ""
 K ^TMP($J,"A","VDO")
 S (X,G)=0 F  S X=$O(^TMP($J,"A",X)) Q:X'=+X  S V=$P(^TMP($J,"A",X),U,5) S ^TMP($J,"A","VDO",(9999999-$P($P(^AUPNVSIT(V,0),U),".")),X)=^TMP($J,"A",X)
 S (X,G,D)=0 F  S D=$O(^TMP($J,"A","VDO",D)) Q:D'=+D!(G)  S X=0 F  S X=$O(^TMP($J,"A","VDO",D,X)) Q:X'=+X!(G)  S V=$P(^TMP($J,"A",X),U,5) D
 .Q:'$D(^AUPNVSIT(V,0))
 .Q:'$P(^AUPNVSIT(V,0),U,9)
 .Q:$P(^AUPNVSIT(V,0),U,11)
 .Q:'$D(^AUPNVPRV("AD",V))
 .Q:"SAHO"'[$P(^AUPNVSIT(V,0),U,7)
 .;Q:"V"[$P(^AUPNVSIT(V,0),U,3)
 .Q:$P(^AUPNVSIT(V,0),U,6)=""
 .;I $G(BGPMFITI),'$D(^ATXAX(BGPMFITI,21,"B",$P(^AUPNVSIT(V,0),U,6))) Q
 .S G=V
 .Q
 I G Q $$PRIMPROV^APCLV(G,"N")_","_$S($$PRIMPROV^APCLV(G,"F"):$P(^DIC(7,+$$PRIMPROV^APCLV(G,"F"),0),U,2),1:"")_","_$$DATE^BGP3UTL($P($P(^AUPNVSIT(G,0),U),"."))
 Q ""
 I BGPPTYPE="D" G HEADER1
 G:'BGPGPG HEADER1
 K DIR I $E(IOST)="C",IO=IO(0),'$D(ZTQUEUED) W ! S DIR(0)="EO" D ^DIR K DIR I Y=0!(Y="^")!($D(DTOUT)) S BGPQUIT=1 Q
HEADER1 ;
 I BGPPTYPE="P" W:$D(IOF) @IOF S BGPGPG=BGPGPG+1
 I BGPPTYPE="P",$G(BGPGUI) D W^BGP3DP("ZZZZZZZ",0,1,BGPPTYPE) ;!  ;maw
 D W^BGP3DP("***** CONFIDENTIAL PATIENT INFORMATION, COVERED BY THE PRIVACY ACT *****",1,$S(BGPPTYPE="D":3,1:1),BGPPTYPE)
 I BGPPTYPE="P" S X=$P(^VA(200,DUZ,0),U,2),$E(X,35)=$$FMTE^XLFDT(DT),$E(X,70)="Page "_BGPGPG D W^BGP3DP(X,1,1,BGPPTYPE)
 D W^BGP3DP("***  IHS 2013 Comprehensive National GPRA/GPRAMA Patient List  ***",1,1,BGPPTYPE)
 D W^BGP3DP("*** List of Patients Not Meeting a National GPRA or PART measure  ***",1,1,BGPPTYPE)
 D W^BGP3DP($$RPTVER^BGP3BAN,1,1,BGPPTYPE)
 D W^BGP3DP($P(^DIC(4,DUZ(2),0),U),1,1,BGPPTYPE)
 S X="Report Period: "_$$FMTE^XLFDT(BGPBD)_" to "_$$FMTE^XLFDT(BGPED) D W^BGP3DP(X,1,1,BGPPTYPE)
 D W^BGP3DP($S(BGPLIST="A":"All Patients",BGPLIST="R":"Random Patient List",1:"Patient List by Provider: "_BGPLPROV),1,1,BGPPTYPE)
 D W^BGP3DP($TR($J("",80)," ","-"),0,1,BGPPTYPE)
 Q:BGPXL
H1 ;
 D W^BGP3DP("UP=User Pop; AC=Active Clinical; AD=Active Diabetic; AAD=Active Adult Diabetic",0,1,BGPPTYPE)
 D W^BGP3DP("PREG=Pregnant Female; IMM=Active IMM Pkg Pt",0,1,BGPPTYPE)
 D W^BGP3DP("",0,1,BGPPTYPE)
 D W^BGP3DP("PATIENT NAME",0,1,BGPPTYPE)
 D W^BGP3DP("HRN",0,0,BGPPTYPE,2,24)
 D W^BGP3DP("COMMUNITY",0,0,BGPPTYPE,3,31)
 D W^BGP3DP("SEX",0,0,BGPPTYPE,4,45)
 D W^BGP3DP("AGE",0,0,BGPPTYPE,5,49)
 D W^BGP3DP("DENOMINATOR",0,0,BGPPTYPE,6,53)
 D W^BGP3DP("NOT MET/LST PRVDR",0,0,BGPPTYPE,7,65)
 D W^BGP3DP($TR($J("",80)," ","-"),0,1,BGPPTYPE)
 Q
CTR(X,Y) ;EP - Center X in a field Y wide.
 Q $J("",$S($D(Y):Y,1:IOM)-$L(X)\2)_X
 ;----------
USR() ;EP - Return name of current user from ^VA(200.
 Q $S($G(DUZ):$S($D(^VA(200,DUZ,0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ UNDEFINED OR 0")
 ;----------
LOC() ;EP - Return location name from file 4 based on DUZ(2).
 Q $S($G(DUZ(2)):$S($D(^DIC(4,DUZ(2),0)):$P(^(0),U),1:"UNKNOWN"),1:"DUZ(2) UNDEFINED OR 0")
 ;----------