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

APCLP810.m

Go to the documentation of this file.
APCLP810 ; IHS/CMI/LAB -IHS -GETS DATA FOR DIABETES QA REPORT ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;
 ;
EN ; - ENTRY POINT - from ^APCLASK
 K ^APCLDATA("APCLEPI",$J)
 S ^XTMP("APCLP81",0)=$$FMADD^XLFDT(DT,14)_"^"_DT_"^PRE DM AUDIT 2007"
 S APCLEPIN=0
 S APCLPD=0 F  S APCLPD=$O(^XTMP("APCLP81",APCLJOB,APCLBTH,"PATS",APCLPD)) Q:'APCLPD  D
 .I APCLTYPE'="P",APCLTYPE'="S" Q:$$DEMO^APCLUTL(APCLPD,$G(APCLDEMO))
 .;I APCLPREP=2 D EPIREC Q
 .D GATHER
 ;I APCLPREP=2 D WRITEF^APCLP81 Q
 I APCLPREP=2!(APCLPREP=3) D CUML^APCLP815
 Q
S(P,I,V) ;
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",P,I)=V
 Q
GATHER ;gather data for 1 patient
 S APCLER=0
 ;set report dates
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,1)=$S($G(APCLFISC)]"":APCLFISC,1:APCLRBD_" - "_APCLRED)
 ;set audit date to DT
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,2)=$$FMTE^XLFDT(DT)
 ;set area, su, facility code and name
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,4)=$P(^DIC(4,DUZ(2),0),U)
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,6)=$E($P(^AUTTLOC(DUZ(2),0),U,10),1,2)
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,8)=$E($P(^AUTTLOC(DUZ(2),0),U,10),3,4)
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,10)=$E($P(^AUTTLOC(DUZ(2),0),U,10),5,6)
 ;# pats in register
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,12)=$S(APCLDMRG:$$RSTAT^APCLDM6(APCLDMRG,"A"),1:"")
 ;reviewer
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,14)=$P(^VA(200,DUZ,0),U,2)
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,15)=$$VAL^XBDIQ1(9000001,APCLPD,.14)
DEMO ;pat demographics
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,16)=$$HRN^AUPNPAT(APCLPD,DUZ(2))
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,18)=$$DOB^AUPNPAT(APCLPD,"E")
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,20)=$$VAL^XBDIQ1(2,APCLPD,.02)
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,120)=$$TRIBE(APCLPD)
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,121)=$$COMM(APCLPD)
DXDT ;dates of and dm dxs
 K APCLDATA D IFG^APCLP813(APCLPD,.APCLDATA)
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,200)=$S($D(APCLDATA):"Yes",1:"No")
 S X=0 F  S X=$O(APCLDATA(X)) Q:X'=+X  D
 .S Y=200_"."_X
 .S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,Y)=APCLDATA(X)
 K APCLDATA D IGT^APCLP813(APCLPD,.APCLDATA)
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,210)=$S($D(APCLDATA):"Yes",1:"No")
 S X=0 F  S X=$O(APCLDATA(X)) Q:X'=+X  D
 .S Y=210_"."_X
 .S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,Y)=APCLDATA(X)
 K APCLDATA D MS^APCLP813(APCLPD,.APCLDATA)
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,220)=$S($D(APCLDATA):"Yes",1:"No")
 S X=0 F  S X=$O(APCLDATA(X)) Q:X'=+X  D
 .S Y=220_"."_X
 .S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,Y)=APCLDATA(X)
 K APCLDATA D ABNG^APCLP813(APCLPD,.APCLDATA)
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,230)=$S($D(APCLDATA):"Yes",1:"No")
 S X=0 F  S X=$O(APCLDATA(X)) Q:X'=+X  D
 .S Y=230_"."_X
 .S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,Y)=APCLDATA(X)
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,22)=$S(APCLDMRG:$$CMSFDX^APCLP813(APCLPD,APCLDMRG,"D"),1:"")
 S ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,24)=$S(APCLDMRG:$$CMSFDX^APCLP813(APCLPD,APCLDMRG,"DX"),1:"")
 I $$PLDMDXS^APCLP813(APCLPD)]"" D S(APCLPD,25,"PLEASE NOTE:  Diabetes is on the Problem list for this patient")
 S X=$$FRSTDMDX^APCLP813(APCLPD,"E") I X]"" D S(APCLPD,26,"PLEASE NOTE:  Diabetes has been used as a diagnosis in PCC: "_X)
 D S(APCLPD,27,$$TOBACCO^APCLP816(APCLPD,APCLRED))
 D S(APCLPD,28,$$CESS^APCLP811(APCLPD,APCLRBD,APCLRED))
VITAL ;
 D S(APCLPD,30,$$LASTHT^APCLP813(APCLPD,APCLRED))
 D S(APCLPD,32,$$LASTWT^APCLP813(APCLPD,APCLRED))
 D S(APCLPD,33,$$LASTWC^APCLP813(APCLPD,APCLRED))
 ;htn dx
 D S(APCLPD,34,$$HTNDX^APCLP813(APCLPD,APCLRED))
 ;last 3 BPs
 D S(APCLPD,36,$$BPS^APCLP813(APCLPD,APCLRBD,APCLRED))
EXAMS ;
 D S(APCLPD,44,$$DIETEDUC^APCLP817(APCLPD,APCLRBD,APCLRED))
 D S(APCLPD,46,$$EXEDUC^APCLP817(APCLPD,APCLRBD,APCLRED))
THERAPY ;
 S APCL6MBD=$$FMADD^XLFDT(APCLADAT,-(6*31)),APCL6MBD=$$FMTE^XLFDT(APCL6MBD)
 D S(APCLPD,53,$$SULF^APCLP812(APCLPD,APCL6MBD,APCLRED))
 D S(APCLPD,54,$$MET^APCLP812(APCLPD,APCL6MBD,APCLRED))
 D S(APCLPD,55,$$ACAR^APCLP812(APCLPD,APCL6MBD,APCLRED))
 D S(APCLPD,56,$$TROG^APCLP812(APCLPD,APCL6MBD,APCLRED))
 S Y="" F X=53:1:56 I ^XTMP("APCLP81",APCLJOB,APCLBTH,"AUDIT",APCLPD,X)="X" S Y=1
 D S(APCLPD,51,$S(Y:"",1:"X"))
 D S(APCLPD,60,$$ACE^APCLP816(APCLPD,APCL6MBD,APCLRED))
IMM ;
 D S(APCLPD,62,$$ASPIRIN^APCLP816(APCLPD,APCLRBD,APCLRED))
 D S(APCLPD,61,$$LIPID^APCLP816(APCLPD,APCL6MBD,APCLRED))
 D S(APCLPD,76,$$EKG^APCLP812(APCLPD,APCLRED))
LABS ;
 D S(APCLPD,90,$$FGLUCOSE^APCLD718(APCLPD,$P(^DPT(APCLPD,0),U,3),APCLADAT))
 D S(APCLPD,91,$$G75^APCLD718(APCLPD,$P(^DPT(APCLPD,0),U,3),APCLADAT))
 D S(APCLPD,86,$$CHOL^APCLD718(APCLPD,APCLBDAT,APCLADAT))
 D S(APCLPD,88,$$LDL^APCLD718(APCLPD,APCLBDAT,APCLADAT))
 D S(APCLPD,89,$$HDL^APCLD718(APCLPD,APCLBDAT,APCLADAT))
 D S(APCLPD,90,$$TRIG^APCLD718(APCLPD,APCLBDAT,APCLADAT))
 ;
 D S(APCLPD,112,$$BMI^APCLD718(APCLPD,APCLRBD,APCLRED))
 Q
DATE(D) ;EP
 I $G(D)="" Q ""
 Q $E(D,4,5)_"/"_$E(D,6,7)_"/"_(1700+($E(D,1,3)))
TRIBE(P) ;EP
 I '$G(P) Q ""
 I '$D(^AUPNPAT(P,11)) Q ""
 Q $$TRIBE^AUPNPAT(P,"C")_"^"_$$TRIBE^AUPNPAT(P,"E")
COMM(P) ;EP
 I '$G(P) Q ""
 I '$D(^AUPNPAT(P,11)) Q ""
 Q $$COMMRES^AUPNPAT(P,"C")_"^"_$$COMMRES^AUPNPAT(P,"E")