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

BGPD6.m

Go to the documentation of this file.
BGPD6 ; IHS/CMI/LAB - indicator 6 ;
 ;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
 ;
I6 ;EP ;EP - indicator 6
 ;Q:'$D(BGPIND(15))
 Q:$P(^DPT(DFN,0),U,2)'="F"
 Q:BGPAGEB<18
 Q:BGPAGEB>70
 Q:$$HYSTER(DFN,BGPEDATE)
 D S(BGPRPT,$S(BGPTIME=1:15,BGPTIME=0:45,BGPTIME=8:85,1:999),5,1)
 S BGPPAP=$$PAP(DFN,BGPEDATE,1)
 I $E(BGPPAP)="Y" D S(BGPRPT,$S(BGPTIME=1:15,BGPTIME=0:45,BGPTIME=8:85,1:999),6,1)
 I $D(BGPLIST(15)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",15,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEE,DFN)=BGPPAP
 Q
I6A ;EP
 ;Q:'$D(BGPIND(16))
 Q:$P(^DPT(DFN,0),U,2)'="F"
 Q:BGPAGEB<18
 Q:BGPAGEB>70
 Q:$$HYSTER(DFN,BGPEDATE)
 S BGPPAP=$$PAP(DFN,BGPEDATE,3)
 I $E(BGPPAP)="Y" D S(BGPRPT,$S(BGPTIME=1:15,BGPTIME=0:45,BGPTIME=8:85,1:999),7,1)
 I $D(BGPLIST(16)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",16,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEE,DFN)=BGPPAP
 Q
S(R,N,P,V) ;
 I 'V Q  ;no value to add
 S $P(^BGPD(R,N),U,P)=$P($G(^BGPD(R,N)),U,P)+V
 Q
HYSTER(P,EDATE) ;EP has patient had hysterectomy?
 I '$G(P) Q ""
 I '$D(^AUPNVPRC("AC",P)) Q ""
 NEW F,S,C,G S (F,S)=0 F  S F=$O(^AUPNVPRC("AC",P,F)) Q:F'=+F!(S)  S C=$P($$ICDOP^ICDCODE(+^AUPNVPRC(F,0)),U,2) D
 .S G=0 S:C=68.3!(C=68.4)!(C=68.5)!(C=68.6)!(C=68.7)!(C=68.9) G=1
 .Q:G=0
 .S D=$P(^AUPNVPRC(F,0),U,6) I D="" S D=$P($P(^AUPNVSIT($P(^AUPNVPRC(F,0),U,3),0),U),".")
 .I D>EDATE Q
 .S S=1
 Q S
REFUSAL(P,F,I,B,E) ;EP
 I '$G(P) Q ""
 I '$G(F) Q ""
 I '$G(I) Q ""
 I $G(B)="" Q ""
 I $G(E)="" Q ""
 NEW G,X
 S (X,G)=0 F  S X=$O(^AUPNPREF("AA",P,F,I,X)) Q:X'=+X!(G)  S Y=0 F  S Y=$O(^AUPNPREF("AA",P,F,I,X,Y)) Q:Y'=+Y  S D=$P(^AUPNPREF(Y,0),U,3) I D'<B&(D'>E) S G=1
 Q G
PAP(P,EDATE,YEARS) ;
 NEW BGP,%,E,BDATE S BDATE=$$FMADD^XLFDT(EDATE,-(365*YEARS)),%=P_"^LAST LAB PAP SMEAR;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGP(")
 I $D(BGP(1)) Q "Yes "_$$FMTE^XLFDT($P(BGP(1),U))
 K BGP S %=P_"^LAST DX V76.2;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGP(")
 I $D(BGP(1)) Q "Yes "_$$FMTE^XLFDT($P(BGP(1),U))_" V76.2"
 K BGP S %=P_"^LAST DX V72.3;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGP(")
 I $D(BGP(1)) Q "Yes "_$$FMTE^XLFDT($P(BGP(1),U))_" V72.3"
 K BGP S %=P_"^LAST PROCEDURE 91.46;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGP(")
 I $D(BGP(1)) Q "Yes "_$$FMTE^XLFDT($P(BGP(1),U))_" 91.46"
 S T=$O(^ATXAX("B","BGP CPT PAP",0))
 I T D  I X]"" Q "Yes "_X_" CPT"
 .S X=$$CPT^BGPDU(P,,EDATE,T,4)
 S T="PAP SMEAR",T=$O(^BWPN("B",T,0))
 I T D  I X]"" Q "Yes "_X_" WHTP"
 .S X=$$WH^BGPDU(P,,EDATE,T,4)
 S T=$$REFUSAL(P,60,$O(^LAB(60,"B","PAP SMEAR",0)),$$FMADD^XLFDT(EDATE,-365),EDATE)
 I T Q "Yes - Refused or NMI"
 Q "No"