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

BGPD1B.m

Go to the documentation of this file.
BGPD1B ; IHS/CMI/LAB - ind 1b ;
 ;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
 ;
I1B ;EP - indicator 1B
 S BGPSEX=$P(^DPT(DFN,0),U,2),BGPSEX=$S(BGPSEX="M":1,1:2)
 S D=$$FMADD^XLFDT(BGPEDATE,-365)
 S BGPDMLY=$$DM(DFN,D,BGPEDATE)
 D SAGE(BGPRPT,$S(BGPTIME=1:11,BGPTIME=0:41,BGPTIME=8:81,1:"999"),1,BGPSEX,BGPDMLY)
 S BGPAGEEP=$S(BGPAGEE<15:2,BGPAGEE>14&(BGPAGEE<20):3,BGPAGEE>19&(BGPAGEE<25):4,BGPAGEE>24&(BGPAGEE<35):5,BGPAGEE>34&(BGPAGEE<45):6,BGPAGEE>44&(BGPAGEE<55):7,BGPAGEE>54&(BGPAGEE<65):8,BGPAGEE>64:9,1:"")
 D SAGE(BGPRPT,$S(BGPTIME=1:11,BGPTIME=0:41,BGPTIME=8:81,1:999),BGPAGEEP,BGPSEX,BGPDMLY)
 I BGPDMLY,$D(BGPLIST(2)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",2,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEE,DFN)=""
 Q
SAGE(R,N,P,S,V) ;set age into file
 I 'V Q  ;no value
 NEW X,Y
 S X=$P($G(^BGPD(R,N)),U,P)
 S $P(X,"!",S)=$P(X,"!",S)+V
 S $P(^BGPD(R,N),U,P)=X
 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
DM(P,BDATE,EDATE) ;is patient diabetic 1 or 0
 I $G(P)="" Q ""
 ;check povs
 NEW X,E,BGPG,Y
 K BGPG
 S Y="BGPG("
 S X=P_"^LAST DX [SURVEILLANCE DIABETES;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE) S E=$$START1^APCLDF(X,Y)
 I $D(BGPG(1)) Q 1  ;has a dx
 Q 0
 ;
 ;