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

BGP8C3.m

Go to the documentation of this file.
BGP8C3 ; IHS/CMI/LAB - calc CMS measures 26 Sep 2004 11:28 AM 04 May 2008 2:38 PM ;
 ;;8.0;IHS CLINICAL REPORTING;**2**;MAR 12, 2008
 ;
PNALL ;EP
 ;was there pneumonia on this visit?
 Q:$$PNEUMODX^BGP8CU(BGPVSIT)=""
 I $$AGE^AUPNPAT(DFN,$P($P(BGPVSIT0,U),"."))<18 Q  ; no one under 18 at admission date
 S ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$P(^DPT(DFN,0),U),DFN,BGPVSIT)=""
 Q
 ;
PN1 ;EP
 S BGPEX=""
 Q:$$PNEUMODX^BGP8CU(BGPVSIT)=""  ;no pneumonia dx
 I $$AGE^AUPNPAT(DFN,$P($P(BGPVSIT0,U),"."))<18 Q  ; no one under 18 at admission date
 ;exclusions
 I $$DDA^BGP8CU(BGPVSIT,BGPVINP) S BGPEX=1  ;discharged on day of arrival, exclusion 1
 I $$DEATHAMA^BGP8CU(BGPVINP),$$DODA^BGP8CU(BGPVSIT,BGPVINP) S BGPEX=BGPEX_"|2"  ;death/ama, discharged day of or day after arrival
 S BGPADMER="",BGPERPN=""
 I '$$ADMDX^BGP8CU(BGPVINP,"BGP CMS PNEUMONIA DXS") S BGPADMER="|3"  ;no admitting dx of pneumonia
 I '$$ERPNEU^BGP8CU(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-1),$P($P(BGPVSIT0,U),"."),"BGP CMS PNEUMONIA DXS") S BGPERPN="|4"
 I BGPADMER]""&(BGPERPN]"") S BGPEX=BGPADMER_BGPERPN
 I $$LASTDX^BGP8UTL1(DFN,"BGP CMS CYSTIC FIBROSIS DXS",$$DOB^AUPNPAT(DFN),$$DSCH^BGP8CU(BGPVINP)) S BGPEX=BGPEX_"|5"
PN1A ;
 I $G(BGPEXCL),BGPEX]"" Q
 S ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$P(^DPT(DFN,0),U),DFN,BGPVSIT)=BGPEX
 Q
 ;
PN2 ;EP
 S BGPEX=""
 Q:$$PNEUMODX^BGP8CU(BGPVSIT)=""  ;no pneumonia dx
 I $$AGE^AUPNPAT(DFN,$P($P(BGPVSIT0,U),"."))<65 Q  ; no one under 18 at admission date
 ;exclusions
 I $$DEATHAMA^BGP8CU(BGPVINP) S BGPEX=BGPEX_"|9"  ;death/ama, discharged day of or day after arrival
 I $$LASTDX^BGP8UTL1(DFN,"BGP CMS CYSTIC FIBROSIS DXS",$$DOB^AUPNPAT(DFN),$$DSCH^BGP8CU(BGPVINP)) S BGPEX=BGPEX_"|5"
PN2A ;
 I $G(BGPEXCL),BGPEX]"" Q
 S ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$P(^DPT(DFN,0),U),DFN,BGPVSIT)=BGPEX
 Q
 ;
PN3B ;EP
 S BGPEX=""
 Q:$$PNEUMODX^BGP8CU(BGPVSIT)=""  ;no pneumonia dx
 I $$AGE^AUPNPAT(DFN,$P($P(BGPVSIT0,U),"."))<18 Q  ; no one under 18 at admission date
 S BGPERBC=""
 K BGPDATA
 D ERBC^BGP8CU3(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-1),$P($P(BGPVSIT0,U),"."),.BGPDATA)
 I $D(BGPDATA) S BGPERBC=1
 S BGPANTIH=""
 K BGPDATA
 D ANTIRX^BGP8CU3(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP8CU(BGPVINP),.BGPDATA)
 I $D(BGPDATA) S BGPANTIH=1
 I 'BGPANTIH!('BGPERBC) Q  ;S BGPEX="|6"
 ;exclusions
 I $$DDA^BGP8CU(BGPVSIT,BGPVINP) S BGPEX=1  ;discharged on day of arrival, exclusion 1
 S BGPADMER="",BGPERPN=""
 I '$$ADMDX^BGP8CU(BGPVINP,"BGP CMS PNEUMONIA DXS") S BGPADMER="|3"  ;no admitting dx of pneumonia
 I '$$ERPNEU^BGP8CU(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-1),$P($P(BGPVSIT0,U),"."),"BGP CMS PNEUMONIA DXS") S BGPERPN="|4"
 I BGPADMER]""&(BGPERPN]"") S BGPEX=BGPADMER_BGPERPN
 I $$DEATHAMA^BGP8CU(BGPVINP) S BGPEX=BGPEX_"|9"  ;death/ama, discharged day of or day after arrival
 I $$LASTDX^BGP8UTL1(DFN,"BGP CMS CYSTIC FIBROSIS DXS",$$DOB^AUPNPAT(DFN),$$DSCH^BGP8CU(BGPVINP)) S BGPEX=BGPEX_"|5"
PN3A ;
 I $G(BGPEXCL),BGPEX]"" Q
 S ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$P(^DPT(DFN,0),U),DFN,BGPVSIT)=BGPEX
 Q
 ;
PN4 ;EP
 S BGPEX=""
 Q:$$PNEUMODX^BGP8CU(BGPVSIT)=""  ;no pneumonia dx
 I $$AGE^AUPNPAT(DFN,$P($P(BGPVSIT0,U),"."))<18 Q  ; no one under 18 at admission date
 K BGPDATA
 D SMOKER^BGP8CU2(DFN,$$FMADD^XLFDT($P($P(^AUPNVSIT(BGPVSIT,0),U),"."),-365),$$DSCH^BGP8CU(BGPVINP),.BGPDATA)
 I '$D(BGPDATA) Q  ;not a smoker
 ;exclusions
 I $$DEATHAMA^BGP8CU(BGPVINP) S BGPEX=BGPEX_"|9"  ;death/ama, discharged day of or day after arrival
 I $$LASTDX^BGP8UTL1(DFN,"BGP CMS CYSTIC FIBROSIS DXS",$$DOB^AUPNPAT(DFN),$$DSCH^BGP8CU(BGPVINP)) S BGPEX=BGPEX_"|5"
PN4A ;
 I $G(BGPEXCL),BGPEX]"" Q
 S ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$P(^DPT(DFN,0),U),DFN,BGPVSIT)=BGPEX
 Q
 ;
PN5B ;EP
 S BGPEX=""
 Q:$$PNEUMODX^BGP8CU(BGPVSIT)=""  ;no pneumonia dx
 I $$AGE^AUPNPAT(DFN,$P($P(BGPVSIT0,U),"."))<18 Q  ; no one under 18 at admission date
 ;exclusions
 I $$DDA^BGP8CU(BGPVSIT,BGPVINP) S BGPEX=BGPEX_"|1"  ;discharged on day of arrival, exclusion 1
 S BGPADMER="",BGPERPN=""
 I '$$ADMDX^BGP8CU(BGPVINP,"BGP CMS PNEUMONIA DXS") S BGPADMER="|3"  ;no admitting dx of pneumonia
 I '$$ERPNEU^BGP8CU(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-1),$P($P(BGPVSIT0,U),"."),"BGP CMS PNEUMONIA DXS") S BGPERPN="|4"
 I BGPADMER]""&(BGPERPN]"") S BGPEX=BGPADMER_BGPERPN
 I $$DEATHAMA^BGP8CU(BGPVINP),$$DODA^BGP8CU(BGPVSIT,BGPVINP) S BGPEX=BGPEX_"|2"  ;death/ama, discharged day of or day after arrival
 I $$LASTDX^BGP8UTL1(DFN,"BGP CMS CYSTIC FIBROSIS DXS",$$DOB^AUPNPAT(DFN),$$DSCH^BGP8CU(BGPVINP)) S BGPEX=BGPEX_"|5"
 S BGPANTIH=""
 K BGPDATA,BGPY
 D ANTIRX^BGP8CU3(DFN,$P($P(BGPVSIT0,U),"."),$$DSCH^BGP8CU(BGPVINP),.BGPDATA)
 I '$D(BGPDATA) S BGPEX=BGPEX_"|7"
 D GETMEDS^BGP8CU(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-180),$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-1),"BGP CMS ANTIBIOTIC MEDS","BGP CMS ANTIBIOTIC MEDS NDC","BGP CMS ANTIBIOTICS MEDS CLASS",1,"","",0,1)
 I $G(BGPY)]"" S BGPEX=BGPEX_"|8"
PN5BA ;
 I $G(BGPEXCL),BGPEX]"" Q
 S ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$P(^DPT(DFN,0),U),DFN,BGPVSIT)=BGPEX
 Q
 ;
PN6 ;EP
 S BGPEX=""
 Q:$$PNEUMODX^BGP8CU(BGPVSIT)=""  ;no pneumonia dx
 I $$AGE^AUPNPAT(DFN,$P($P(BGPVSIT0,U),"."))<18 Q  ; no one under 18 at admission date
 ;exclusions
 I $$DDA^BGP8CU(BGPVSIT,BGPVINP) S BGPEX=BGPEX_"|1"  ;discharged on day of arrival, exclusion 1
 S BGPADMER="",BGPERPN=""
 I '$$ADMDX^BGP8CU(BGPVINP,"BGP CMS PNEUMONIA DXS") S BGPADMER="|3"  ;no admitting dx of pneumonia
 I '$$ERPNEU^BGP8CU(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-1),$P($P(BGPVSIT0,U),"."),"BGP CMS PNEUMONIA DXS") S BGPERPN="|4"
 I BGPADMER]""&(BGPERPN]"") S BGPEX=BGPADMER_BGPERPN
 I $$DEATHAMA^BGP8CU(BGPVINP),$$DODA^BGP8CU(BGPVSIT,BGPVINP) S BGPEX=BGPEX_"|2"  ;death/ama, discharged day of or day after arrival
 I $$LASTDX^BGP8UTL1(DFN,"BGP CMS CYSTIC FIBROSIS DXS",$$DOB^AUPNPAT(DFN),$$DSCH^BGP8CU(BGPVINP)) S BGPEX=BGPEX_"|5"
 K BGPDATA
 I $$HIV^BGP8CU4(DFN,$$DOB^AUPNPAT(DFN),$P($P(BGPVSIT0,U),".")) S BGPEX=BGPEX_"|A"
 I $$SYSCHEMO^BGP8CU4(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-90),$P($P(BGPVSIT0,U),".")) S BGPEX=BGPEX_"|B"
 I $$SYSIMMUN^BGP8CU4(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-90),$P($P(BGPVSIT0,U),".")) S BGPEX=BGPEX_"|C"
 I $$LEUKEMIA^BGP8CU4(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-90),$P($P(BGPVSIT0,U),".")) S BGPEX=BGPEX_"|D"
 I $$LYMPHOMA^BGP8CU4(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-90),$P($P(BGPVSIT0,U),".")) S BGPEX=BGPEX_"|K"
 I $$RADTHER^BGP8CU4(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-90),$P($P(BGPVSIT0,U),".")) S BGPEX=BGPEX_"|E"
 I $$PRIORHOS^BGP8CU4(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-14),$P($P(BGPVSIT0,U),"."),BGPVSIT) S BGPEX=BGPEX_"|F"
 I $$HOS2DAYS^BGP8CU4(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-90),$P($P(BGPVSIT0,U),".")) S BGPEX=BGPEX_"|G"
 I $$NURSHOME^BGP8CU4(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-90),$P($P(BGPVSIT0,U),".")) S BGPEX=BGPEX_"|H"
 I $$CHRDIAL^BGP8CU4(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-30),$P($P(BGPVSIT0,U),".")) S BGPEX=BGPEX_"|I"
 I $$WOUNDCAR^BGP8CU4(DFN,$$FMADD^XLFDT($P($P(BGPVSIT0,U),"."),-30),$P($P(BGPVSIT0,U),".")) S BGPEX=BGPEX_"|J"
PN6BA ;
 I $G(BGPEXCL),BGPEX]"" Q
 S ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$P(^DPT(DFN,0),U),DFN,BGPVSIT)=BGPEX
 Q
 ;
PN7 ;EP
 S BGPEX=""
 Q:$$PNEUMODX^BGP8CU(BGPVSIT)=""  ;no pneumonia dx
 I $$AGE^AUPNPAT(DFN,$P($P(BGPVSIT0,U),"."))<50 Q  ; no one under 18 at admission date
 S M=$E($$DSCH^BGP8CU(BGPVINP),4,5)
 I +M>2,+M<10 Q  ;only 10 through 2 months
 ;exclusions
 I $$DEATHAMA^BGP8CU(BGPVINP) S BGPEX=BGPEX_"|9"  ;death/ama, discharged day of or day after arrival
 I $$LASTDXI^BGP8UTL1(DFN,"487.0",$P($P(BGPVSIT0,U),"."),$$DSCH^BGP8CU(BGPVINP),"HI") S BGPEX=BGPEX_"|L"
 I $$LASTDX^BGP8UTL1(DFN,"BGP CMS CYSTIC FIBROSIS DXS",$$DOB^AUPNPAT(DFN),$$DSCH^BGP8CU(BGPVINP)) S BGPEX=BGPEX_"|5"
PN7A ;
 I $G(BGPEXCL),BGPEX]"" Q
 S ^XTMP("BGP8C1",BGPJ,BGPH,"LIST",BGPIND,BGPPLSTL,$P(^DPT(DFN,0),U),DFN,BGPVSIT)=BGPEX
 Q
 ;