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

BGPD3.m

Go to the documentation of this file.
  1. BGPD3 ; IHS/CMI/LAB - indicator 3 ;
  1. ;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
  1. ;
  1. I3A ;EP ;EP - indicator 2a
  1. Q:'BGPDMPAT ;not in the simple population for denominator
  1. S BGPMBP=$$MEANBP(DFN,BGPEDATE)
  1. ;set value 2,3,4 piece and set list
  1. I $P(BGPMBP,U,2) D S(BGPRPT,$S(BGPTIME=1:13,BGPTIME=0:43,BGPTIME=8:83,1:999),$P(BGPMBP,U,2),1) ;set piece 2,3,4
  1. I $D(BGPLIST(6)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",6,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEE,DFN)=$P(BGPMBP,U)
  1. Q
  1. I3B ;EP
  1. ;;Q:'$D(BGPIND(7))
  1. Q:'BGPDMPAT ;not in the simple population for denominator
  1. Q:'BGP2BD
  1. ;set value 2,3,4 piece and set list
  1. I $P(BGPMBP,U,2) D S(BGPRPT,$S(BGPTIME=1:13,BGPTIME=0:43,BGPTIME=8:83,1:999),$P(BGPMBP,U,2)+5,1) ;set piece 2,3,4
  1. I $D(BGPLIST(7)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",7,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEE,DFN)=$P(BGPMBP,U)
  1. Q
  1. I3C ;EP
  1. ;Q:'$D(BGPIND(8))
  1. Q:'BGPDMPAT ;not in the simple population for denominator
  1. Q:'BGP2CD
  1. ;set value 2,3,4 piece and set list
  1. I $P(BGPMBP,U,2) D S(BGPRPT,$S(BGPTIME=1:13,BGPTIME=0:43,BGPTIME=8:83,1:999),$P(BGPMBP,U,2)+10,1) ;set piece 2,3,4
  1. I $D(BGPLIST(8)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",8,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEE,DFN)=$P(BGPMBP,U)
  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. MEANBP(P,EDATE) ;
  1. NEW S,D,DS,X
  1. S D=$$FMADD^XLFDT(EDATE,-365)
  1. S X=$$BPS(P,D,EDATE,"I")
  1. S S=$$SYSMEAN(X) I S="" Q "^4"
  1. S DS=$$DIAMEAN(X) I DS="" Q "^4"
  1. I S<130&(DS<80) Q S_"/"_DS_" CON"_U_2
  1. Q S_"/"_DS_" UNC"_U_3
  1. SYSMEAN(X) ;EP
  1. I X="" Q ""
  1. NEW Y,C S C=0 F Y=1:1:3 I $P(X,";",Y)]"" S C=C+1
  1. I C'=3 Q ""
  1. S C=0 F Y=1:1:3 S C=$P($P(X,";",Y),"/")+C
  1. Q C\3
  1. DIAMEAN(X) ;EP
  1. I X="" Q ""
  1. NEW Y,C S C=0 F Y=1:1:3 I $P(X,";",Y)]"" S C=C+1
  1. I C'=3 Q ""
  1. S C=0 F Y=1:1:3 S C=$P($P(X,";",Y),"/",2)+C
  1. Q C\3
  1. BPS(P,BDATE,EDATE,F) ;EP ;
  1. I $G(F)="" S F="E"
  1. NEW X,BGPG,E,BGPGL,BGPGLL,BGPGV
  1. S BGPGLL=0,BGPGV=""
  1. K BGPG
  1. S X=P_"^LAST 50 MEAS BP;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE) S E=$$START1^APCLDF(X,"BGPG(")
  1. S BGPGL=0 F S BGPGL=$O(BGPG(BGPGL)) Q:BGPGL'=+BGPGL!(BGPGLL=3) S BGPGBP=$P($G(BGPG(BGPGL)),U,2) D
  1. .Q:$$CLINIC^APCLV($P(BGPG(BGPGL),U,5),"C")=30
  1. .S BGPGLL=BGPGLL+1
  1. .I F="E" S $P(BGPGV,";",BGPGLL)=BGPGBP_" "_$$FMTE^XLFDT($P(BGPG(BGPGL),U))
  1. .I F="I" S $P(BGPGV,";",BGPGLL)=$P(BGPGBP," ")
  1. Q BGPGV