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

BGPDC.m

Go to the documentation of this file.
BGPDC ; IHS/CMI/LAB - indicator C ;
 ;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
 ;
IC ;EP ;EP - indicator C
 ;Q:'$D(BGPIND(29))
 S BGPSEX=$P(^DPT(DFN,0),U,2),BGPSEX=$S(BGPSEX="M":1,1:2)
 D SAGE(BGPRPT,$S(BGPTIME=1:29,BGPTIME=0:59,BGPTIME=8:99,1:999),19,BGPSEX,1)
 S BGPAGEEP=$S(BGPAGEE<10:2,BGPAGEE>9&(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:29,BGPTIME=0:59,BGPTIME=8:99,1:999),BGPAGEEP,BGPSEX,1)
 S BGPEDPAT=$$ED(DFN,BGPEDATE)
 D SAGE(BGPRPT,$S(BGPTIME=1:29,BGPTIME=0:59,BGPTIME=8:99,1:"999"),10,BGPSEX,BGPEDPAT)
 I 'BGPEDPAT,$D(BGPLIST(26)),BGPTIME=1 S ^XTMP("BGPGAGD",BGPJ,BGPH,"LIST",26,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEE,DFN)=""
 S BGPAGEEP=$S(BGPAGEE<10:11,BGPAGEE>9&(BGPAGEE<20):12,BGPAGEE>19&(BGPAGEE<25):13,BGPAGEE>24&(BGPAGEE<35):14,BGPAGEE>34&(BGPAGEE<45):15,BGPAGEE>44&(BGPAGEE<55):16,BGPAGEE>54&(BGPAGEE<65):17,BGPAGEE>64:18,1:"")
 D SAGE(BGPRPT,$S(BGPTIME=1:29,BGPTIME=0:59,BGPTIME=8:99,1:999),BGPAGEEP,BGPSEX,BGPEDPAT)
 I 'BGPEDPAT,$D(BGPLIST(29)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",29,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEE,DFN)="No Diet/Exc Educ provided"
 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
ED(P,EDATE) ;education in past year
 NEW BDATE,%,X,E,R,BGPG
 K BGPG
 S BDATE=$$FMADD^XLFDT(EDATE,-365)
 S X=P_"^EDUC [BGP GPRA EX EDUC TOPICS;DURING "_BDATE_"-"_EDATE S E=$$START1^APCLDF(X,"BGPG(")
 I $D(BGPG(1)) Q 1
 Q 0