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

BGPD8.m

Go to the documentation of this file.
  1. BGPD8 ; IHS/CMI/LAB - indicator 8 ;
  1. ;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
  1. ;
  1. I8 ;EP ;EP - indicator 8
  1. ;Q:'$D(BGPIND(18))
  1. S BGPAMON=$$MON(DFN,BGPBDATE,BGPEDATE)
  1. I BGPAMON D
  1. .D S(BGPRPT,$S(BGPTIME=1:15,BGPTIME=0:45,BGPTIME=8:85,1:999),10,1)
  1. .S BGPP=$$WCV(DFN)
  1. .I BGPP>3 D S(BGPRPT,$S(BGPTIME=1:15,BGPTIME=0:45,BGPTIME=8:85,1:999),11,1)
  1. .I $D(BGPLIST(18)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",18,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEE,DFN)=BGPP
  1. Q
  1. S(R,N,P,V) ;
  1. I 'V Q ;no value to add
  1. S $P(^BGPD(R,N),U,P)=$P($G(^BGPD(R,N)),U,P)+V
  1. Q
  1. ;
  1. WCPV(V) ;
  1. I '$G(V) Q ""
  1. NEW X,I,G S (X,G)=0 F S X=$O(^AUPNVPOV("AD",V,X)) Q:X'=+X!(G) S I=$P(^AUPNVPOV(X,0),U),I=$P($$ICDDX^ICDCODE(I),U,2) I I="V20.1"!(I="V20.2") S G=1
  1. Q G
  1. WCV(P) ;
  1. ;return # of well child visits between dob and 27 month birthday
  1. NEW C S C=0
  1. I '$D(^AUPNVSIT("AA",P)) Q C
  1. NEW B S B=$P(^DPT(P,0),U,3)
  1. I B="" Q C
  1. NEW X,E S E=$$FMADD^XLFDT(B,(27*30.42))
  1. S X=0 F S X=$O(^AUPNVSIT("AC",P,X)) Q:X'=+X S D=$P($P(^AUPNVSIT(X,0),U),".") I D<E,'$$DNKA(X),$$CLINIC^APCLV(X,"C")=24!($$CLINIC^APCLV(X,"C")=27)!($$CLINIC^APCLV(X,"C")=57)!($$WCPV(X)) S C=C+1
  1. Q C
  1. DNKA(V) ;is this a DNKA visit?
  1. I '$G(V) Q ""
  1. NEW D,N S D=$$PRIMPOV^APCLV(V,"C")
  1. I D=".0860" Q 1
  1. S N=$$PRIMPOV^APCLV(V,"N")
  1. I $E(D)="V",N["DNKA" Q 1
  1. I $E(D)="V",N["DID NOT KEEP APPOINTMENT" Q 1
  1. I $E(D)="V",N["DID NOT KEEP APPT" Q 1
  1. Q 0
  1. MON(P,BDATE,EDATE) ;EP
  1. ;is patient's 27 month BD during time frame
  1. NEW D,X
  1. S D=$P(^DPT(DFN,0),U,3)
  1. S D=$$FMADD^XLFDT(D,(30.42*27)) ;d=date turning 27 months
  1. I BDATE>D Q ""
  1. I EDATE<D Q ""
  1. Q 1