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

BQIRGCOP.m

Go to the documentation of this file.
BQIRGCOP ;GDIT/HS/ALA-COPD Care Mgmt ; 26 Oct 2012  9:24 AM
 ;;2.5;ICARE MANAGEMENT SYSTEM;;May 24, 2016;Build 27
 ;
MS(DFN,TYP) ;EP
 NEW RESULT,RES,DATE,VALUE,VISIT
 S RES=$$MEAS^BQITUTL(DFN,TYP)
 I RES=0 Q ""
 S DATE=$P(RES,U,2),RESULT=$P(RES,U,3),VISIT=$P(RES,U,4)
 I TYP="WC"!(TYP="AG") D  Q VALUE
 . S VALUE=$$FMTMDY^BQIUL1(DATE)_" ("_RESULT_")"_U_VISIT_U_DATE
 Q $$FMTMDY^BQIUL1(DATE)_U_VISIT_U_DATE
 ;
TBHF(DFN) ;EP
 NEW N,HDATA,HC,IEN,HF,VISIT,VDATE,HFN,DATE,CAT,TOB,PAT
 ; Get the tobacco categories first
 S N=0
 F  S N=$O(^AUTTHF(N)) Q:'N  D
 . S HDATA=$G(^AUTTHF(N,0))
 . I $P(HDATA,U,13)=1 Q
 . I $P(HDATA,U,10)'="C" Q
 . I $P(HDATA,U,1)'["TOBACCO" Q
 . S CAT(N)=""
 ;
 ; Get the tobacco health factors
 S N=0
 F  S N=$O(^AUTTHF(N)) Q:'N  D
 . S HDATA=$G(^AUTTHF(N,0))
 . I $P(HDATA,U,13)=1 Q
 . S HC=$P(HDATA,U,3) I HC="" Q
 . I '$D(CAT(HC)) Q
 . S TOB(N)=""
 ;
 S IEN=""
 F  S IEN=$O(^AUPNVHF("AC",DFN,IEN),-1) Q:IEN=""  D
 . S HDATA=$G(^AUPNVHF(IEN,0))
 . S HF=$P(HDATA,U,1) I HF="" Q
 . I '$D(TOB(HF)) Q
 . S VISIT=$P(HDATA,U,3) I VISIT="" Q
 . S VDATE=$P($G(^AUPNVSIT(VISIT,0)),U,1)\1
 . S PAT(VDATE)=IEN
 ;
 S DATE=$O(PAT(""),-1)
 I DATE="" Q DATE
 S IEN=PAT(DATE),HFN=$P(^AUPNVHF(IEN,0),U,1),HF=$P(^AUTTHF(HFN,0),U,1)
 Q $$FMTMDY^BQIUL1(DATE)_" ("_HF_")"_U_$P(^AUPNVHF(IEN,0),U,3)_U_DATE
 ;
INHST(DFN) ; EP - Inhaled Steroids
 NEW TAX,TREF,DESC,MEET,X,RESULT,OTHER,VISIT
 I $G(UID)="" S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DESC=""
 S TREF=$NA(^TMP(UID,"BQITAX")) K @TREF
 F TAX="BGP ASTHMA INHALED STEROIDS","BGP ASTHMA INHALED STEROIDS NDC" D BLD^BQITUTL(TAX,TREF)
 S X=$$TAX^BQITRUTL("","",1,DFN,9000010.14,"","",.TREF)
 ; if returns a found medication, check if it is an active medication
 I $P(X,U,1)=1 D
 . I $$ACTMED^BKMQQCR4($P(X,U,5)) Q
 . S $P(X,U,1)=0
 K @TREF
 S RESULT="N/A",OTHER="",VISIT=""
 I 'X S RESULT="NO" Q RESULT
 S RESULT="YES",VISIT=$P(X,U,4),OTHER=$P(X,U,2)
 Q RESULT_U_OTHER_U_VISIT
 ;
GLS(DATA,FAKE) ;EP - BQI GET COPD GLOSSARY
 NEW UID,II,TRIEN,CAT,TIT,SORT,RMK,REMARK,CT,NXT,GLIEN,IEN
 ;
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP(UID,"BQIRGCOP"))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIRGCOP D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S @DATA@(II)="T32767REPORT_TEXT"_$C(30)
 S GLIEN=$O(^BQI(90508.2,"B","COPD","")) I GLIEN="" S BMXSEC="Problem with COPD glossary in file 90508.2" G DONE
 S IEN=0 F  S IEN=$O(^BQI(90508.2,GLIEN,1,IEN)) Q:'IEN  D
 . S II=II+1,@DATA@(II)=$G(^BQI(90508.2,GLIEN,1,IEN,0))
 I II>0 S @DATA@(II)=@DATA@(II)_$C(30)
 ;
DONE S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
ERR ;
 D ^%ZTER
 NEW Y,ERRDTM
 S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
 S BMXSEC="Recording that an error occurred at "_ERRDTM
 I $D(II),$D(DATA) S II=II+1,@DATA@(II)=$C(31)
 Q