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

BDMDM6.m

Go to the documentation of this file.
BDMDM6 ; IHS/CMI/LAB - TOBACCO USE ;
 ;;2.0;DIABETES MANAGEMENT SYSTEM;**2,4,8**;JUN 14, 2007;Build 53
 ;
 ;cmi/anch/maw 9/10/2007 code set versioning in TOBACCO1
 ;
TOBACCO ;EP
 K BDMTOB
 D TOBACCO3
 I $D(^TMP("BDM",$J,1)) D TOBCUML G X1
 D TOBACCO0
 I $D(^TMP("BDM",$J,1)) D TOBCUML G X1
 D TOBACCO1 ;check Problem file for tobacco use
 I $D(^TMP("BDM",$J,1)) D TOBCUML G X1
 D TOBACCO2 ;check POVs for tobacco use
 I $D(^TMP("BDM",$J,1)) D TOBCUML G X1
 S BDMTOB(44)="UNDOCUMENTED",^TMP("BDM",$J,1)="UNDOCUMENTED"
 D TOBCUML
X1 S:BDMER ^TMP("BDM",$J,1)="*** SCRIPT ERROR IN TOBACCO^BDMDM1.  CONTACT SITE MANAGER"
 Q
TOBCUML ;
 I BDMCUML F BDMSUB=7,42,43,44 S BDMGOT1=$S('$D(BDMTOB(BDMSUB)):0,1:1) D CUML^BDMDM1
 K BDMTOB,BDMTOBN
 Q
TOBACCO0 ;check for tobacco documented in health factors
 K BDM S BDMX=BDMPD_"^LAST HEALTH [DM AUDIT TOBACCO HLTH FACTORS" S BDMER=$$START1^APCLDF(BDMX,BDMY) G:BDMER X1 I $D(BDM(1)) D  S BDMTOBN=$O(BDMTOB("")),^TMP("BDM",$J,1)=BDMTOB(BDMTOBN)
 . I $P(BDM(1),U,3)["NON" S BDMTOB(42)="NO, DOES NOT USE TOBACCO" Q
 . I $P(BDM(1),U,3)["PREVIOUS" S BDMTOB(43)="PAST USE OF TOBACCO" Q
 . S BDMTOB(7)="YES, USES TOBACCO"
 .Q
 Q
TOBACCO3 ;lookup in health status
 S %=$O(^ATXAX("B","DM AUDIT TOBACCO HLTH FACTORS",0))
 Q:'%
 S (X,Y)=0 F  S X=$O(^AUPNHF("AA",BDMPD,X)) Q:X'=+X!(Y)  I $D(^ATXAX(%,21,"B",X)) S Y=X
 Q:'Y
 S Y=$P(^AUTTHF(Y,0),U)
 S ^TMP("BDM",$J,1)=Y
 I Y["NON" S BDMTOB(42)="NO, DOES NOT USE TOBACCO" Q
 I Y["PREVIOUS" S BDMTOB(43)="PAST USE OF TOBACCO" Q
 S BDMTOB(7)="YES, USES TOBACCO"
 Q
TOBACCO1 ;check problem file for tobacco use
 K BDM S BDMX=BDMPD_"^PROBLEMS [DM AUDIT PROBLEM SMOKING DXS" S BDMER=$$START1^APCLDF(BDMX,BDMY) G:BDMER X1 I $D(BDM(1)) D  S BDMTOBN=$O(BDMTOB("")),^TMP("BDM",$J,1)=BDMTOB(BDMTOBN)
 . ;I $P(^ICD9($P(BDM(1),U,2),0),U,1)=305.13 S BDMTOB(43)="PAST USE OF TOBACCO"_" - "_$E($P(^AUTNPOV($P(^AUPNPROB(+$P(BDM(1),U,4),0),U,5),0),U),1,30) Q  ;cmi/anch/maw 9/10/2007 orig line
 . I $P($$ICDDX^BDMUTL($P(BDM(1),U,2)),U,2)=305.13 S BDMTOB(43)="PAST USE OF TOBACCO"_" - "_$E($$VAL^XBDIQ1(9000011,+$P(BDM(1),U,4),.05),1,30) Q  ;cmi/anch/maw 9/10/2007 csv
 . S BDMTOB(7)="YES, USES TOBACCO - "_$E($$VAL^XBDIQ1(9000011,+$P(BDM(1),U,4),.05),1,30)
 .Q
 Q
TOBACCO2 ;check pov file for TOBACCO USE DOC
 K BDM S BDMX=BDMPD_"^LAST DX [DM AUDIT SMOKING RELATED DXS"_BDMDATE S BDMER=$$START1^APCLDF(BDMX,BDMY) G:BDMER X1 I $D(BDM(1)) D  S BDMTOBN=$O(BDMTOB("")),^TMP("BDM",$J,1)=BDMTOB(BDMTOBN)
 . I $P(BDM(1),U,2)=305.13 S BDMTOB(43)="PAST USE OF TOBACCO"_" - "_$E($$VAL^XBDIQ1(9000010.07,+$P(BDM(1),U,4),.05),1,30) Q
 . S BDMTOB(7)="YES, USES TOBACCO"_" - "_$E($$VAL^XBDIQ1(9000010.07,+$P(BDM(1),U,4),.05),1,30)
 .Q
 Q
 ;
RSTAT(R,S) ;EP - return # pts on register REG with status STAT
 I $G(R)="" Q ""
 I '$D(^ACM(41,"B",R)) Q ""
 I "AITUDN"'[S Q ""
 NEW %,C
 S (%,C)=0 F  S %=$O(^ACM(41,"B",R,%)) Q:%'=+%  I $P($G(^ACM(41,%,"DT")),U)=S S C=C+1
 Q C
LASTHT(P,F) ;PEP - return last ht
 I 'P Q -1
 I '$D(^AUPNVSIT("AC",P)) Q -1
 NEW %,BDMARRY,H,E
 S %=P_"^LAST MEAS HT" NEW X S E=$$START1^APCLDF(%,"BDMARRY(") S H=$P($G(BDMARRY(1)),U,2)
 I H="" Q H
 S H=$J(H,2,0)
 Q $S(F="I":H,1:(H\12)_" "_(H#12))
 ;F="I" - in inches, F="E" - feet and inches 5 5
LASTWT(P,F) ;PEP - return last wt
 I 'P Q ""
 NEW %,BDMARRY,E,W
 S %=P_"^LAST MEAS WT" NEW X S E=$$START1^APCLDF(%,"BDMARRY(") S W=$P($G(BDMARRY(1)),U,2)
 Q W
BMI(P) ;PEP - return BMI with last weight,last height
 I 'P Q -1
 NEW %,W,H,B
 S %=""
 S W=$$LASTWT(P) I W="" Q %
 S H=$$LASTHT(P,"I") I H="" Q %
 ;S W=(W/5)*2.3,H=(H*2.5),H=(H*H)/10000,%=(W/H),%=$J(%,4,1)
 S W=W*.45359,H=(H*.0254),H=(H*H),%=(W/H),%=$J(%,4,1)
 Q %