BGP4D712 ; IHS/CMI/LAB - TOBACCO HF ;
;;14.1;IHS CLINICAL REPORTING;;MAY 29, 2014;Build 114
;IHS/CMI/LAB
TOBHF(P,BDATE,EDATE) ;EP - return DATE^SMOKER CAT^DATE^SMOKELESS CAT^DATE^ETS CATEGORY
NEW SM,SL,EX,BGPTOB
S BGPTOB=""
S SM=$$LASTHF^BGP4D7(P,"TOBACCO (SMOKING)",BDATE,EDATE) K O,D,H
S SL=$$LASTHF^BGP4D7(P,"TOBACCO (SMOKELESS - CHEWING/DIP)",BDATE,EDATE) K O,D,H
S EX=$$LASTHF^BGP4D7(P,"TOBACCO (EXPOSURE)",BDATE,EDATE) K O,D,H
I SM]""!(SL]"")!(EX]"") D TOBHFS Q BGPTOB
S BGPTOB=$$LASTHF^BGP4D7(P,"TOBACCO",BDATE,EDATE) K O,D,H
I $P(BGPTOB,U,1)["SMOKELESS" S $P(BGPTOB,U,4)=BGPTOB
I $P(BGPTOB,U,1)["ENVIRON"!($P(BGPTOB,U,1)["IN HOME") S $P(BGPTOB,U,7)=BGPTOB
Q BGPTOB
TOBHFS ;
I SM]"" S BGPTOB=SM
I SL]"" S $P(BGPTOB,U,4)=SL
I EX]"" S $P(BGPTOB,U,7)=EX
Q
BGP4D712 ; IHS/CMI/LAB - TOBACCO HF ;
+1 ;;14.1;IHS CLINICAL REPORTING;;MAY 29, 2014;Build 114
+2 ;IHS/CMI/LAB
TOBHF(P,BDATE,EDATE) ;EP - return DATE^SMOKER CAT^DATE^SMOKELESS CAT^DATE^ETS CATEGORY
+1 NEW SM,SL,EX,BGPTOB
+2 SET BGPTOB=""
+3 SET SM=$$LASTHF^BGP4D7(P,"TOBACCO (SMOKING)",BDATE,EDATE)
KILL O,D,H
+4 SET SL=$$LASTHF^BGP4D7(P,"TOBACCO (SMOKELESS - CHEWING/DIP)",BDATE,EDATE)
KILL O,D,H
+5 SET EX=$$LASTHF^BGP4D7(P,"TOBACCO (EXPOSURE)",BDATE,EDATE)
KILL O,D,H
+6 IF SM]""!(SL]"")!(EX]"")
DO TOBHFS
QUIT BGPTOB
+7 SET BGPTOB=$$LASTHF^BGP4D7(P,"TOBACCO",BDATE,EDATE)
KILL O,D,H
+8 IF $PIECE(BGPTOB,U,1)["SMOKELESS"
SET $PIECE(BGPTOB,U,4)=BGPTOB
+9 IF $PIECE(BGPTOB,U,1)["ENVIRON"!($PIECE(BGPTOB,U,1)["IN HOME")
SET $PIECE(BGPTOB,U,7)=BGPTOB
+10 QUIT BGPTOB
TOBHFS ;
+1 IF SM]""
SET BGPTOB=SM
+2 IF SL]""
SET $PIECE(BGPTOB,U,4)=SL
+3 IF EX]""
SET $PIECE(BGPTOB,U,7)=EX
+4 QUIT