BQIPTHF ;PRXM/HC/ALA - PATIENT HEALTH FACTORS ; 26 Mar 2007 3:21 PM
;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
;
Q
;
HF(DATA,DFN,DRANGE) ; EP -- BQI PATIENT HEALTH FACTORS
;
;Description - all the health factors that a patient has
;
;Input
; DFN - Patient internal entry number
;
NEW UID,II,IEN,HF,VISIT,VSDTM,PROV,ORPHY,ENPHY,LEVEL,QTY,COMMENT,HFN,CAT
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S DATA=$NA(^TMP("BQIPTHF",UID))
K @DATA
;
S II=0
NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPTHF D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
;
S DRANGE=$$DATE^BQIUL1($G(DRANGE))
S @DATA@(II)="I00010HF_IEN^I00010VISIT_IEN^D00030VISIT_DATETIME^T00040HF_CATEGORY^T00040HEALTH_FACTOR^T00020LEVEL^N00010QTY^T00035PROVIDER^T00245COMMENT"_$C(30)
S IEN=""
F S IEN=$O(^AUPNVHF("AC",DFN,IEN),-1) Q:IEN="" D
. S HF=$$GET1^DIQ(9000010.23,IEN_",",.01,"E") I HF="" Q
. S HFN=$$GET1^DIQ(9000010.23,IEN_",",.01,"I")
. S VISIT=$$GET1^DIQ(9000010.23,IEN_",",.03,"I") I VISIT="" Q
. S VSDTM=$$GET1^DIQ(9000010,VISIT_",",.01,"I") I VSDTM=0 Q
. I DRANGE'="",(VSDTM\1<DRANGE) Q
. S LEVEL=$$GET1^DIQ(9000010.23,IEN_",",.04,"E")
. S PROV=$$GET1^DIQ(9000010.23,IEN_",",.05,"E")
. S QTY=$$GET1^DIQ(9000010.23,IEN_",",.06,"E") S:QTY="" QTY="-1"
. S COMMENT=$$GET1^DIQ(9000010.23,IEN_",",81101,"E")
. S CAT=$$GET1^DIQ(9999999.64,HFN_",",.03,"E")
. ;S ORPHY=$$GET1^DIQ(9000010.23,IEN_",",1202,"E")
. ;S ENPHY=$$GET1^DIQ(9000010.23,IEN_",",1204,"E")
. S II=II+1,@DATA@(II)=IEN_U_VISIT_U_$$FMTE^BQIUL1(VSDTM)_U_CAT_U_HF_U_LEVEL_U_QTY_U_PROV_U_COMMENT_$C(30)
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
BQIPTHF ;PRXM/HC/ALA - PATIENT HEALTH FACTORS ; 26 Mar 2007 3:21 PM
+1 ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
+2 ;
+3 QUIT
+4 ;
HF(DATA,DFN,DRANGE) ; EP -- BQI PATIENT HEALTH FACTORS
+1 ;
+2 ;Description - all the health factors that a patient has
+3 ;
+4 ;Input
+5 ; DFN - Patient internal entry number
+6 ;
+7 NEW UID,II,IEN,HF,VISIT,VSDTM,PROV,ORPHY,ENPHY,LEVEL,QTY,COMMENT,HFN,CAT
+8 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+9 SET DATA=$NAME(^TMP("BQIPTHF",UID))
+10 KILL @DATA
+11 ;
+12 SET II=0
+13 ; SAC 2006 2.2.3.3.2
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^BQIPTHF D UNWIND^%ZTER"
+14 ;
+15 SET DRANGE=$$DATE^BQIUL1($GET(DRANGE))
+16 SET @DATA@(II)="I00010HF_IEN^I00010VISIT_IEN^D00030VISIT_DATETIME^T00040HF_CATEGORY^T00040HEALTH_FACTOR^T00020LEVEL^N00010QTY^T00035PROVIDER^T00245COMMENT"_$CHAR(30)
+17 SET IEN=""
+18 FOR
SET IEN=$ORDER(^AUPNVHF("AC",DFN,IEN),-1)
IF IEN=""
QUIT
Begin DoDot:1
+19 SET HF=$$GET1^DIQ(9000010.23,IEN_",",.01,"E")
IF HF=""
QUIT
+20 SET HFN=$$GET1^DIQ(9000010.23,IEN_",",.01,"I")
+21 SET VISIT=$$GET1^DIQ(9000010.23,IEN_",",.03,"I")
IF VISIT=""
QUIT
+22 SET VSDTM=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
IF VSDTM=0
QUIT
+23 IF DRANGE'=""
IF (VSDTM\1<DRANGE)
QUIT
+24 SET LEVEL=$$GET1^DIQ(9000010.23,IEN_",",.04,"E")
+25 SET PROV=$$GET1^DIQ(9000010.23,IEN_",",.05,"E")
+26 SET QTY=$$GET1^DIQ(9000010.23,IEN_",",.06,"E")
IF QTY=""
SET QTY="-1"
+27 SET COMMENT=$$GET1^DIQ(9000010.23,IEN_",",81101,"E")
+28 SET CAT=$$GET1^DIQ(9999999.64,HFN_",",.03,"E")
+29 ;S ORPHY=$$GET1^DIQ(9000010.23,IEN_",",1202,"E")
+30 ;S ENPHY=$$GET1^DIQ(9000010.23,IEN_",",1204,"E")
+31 SET II=II+1
SET @DATA@(II)=IEN_U_VISIT_U_$$FMTE^BQIUL1(VSDTM)_U_CAT_U_HF_U_LEVEL_U_QTY_U_PROV_U_COMMENT_$CHAR(30)
End DoDot:1
+32 SET II=II+1
SET @DATA@(II)=$CHAR(31)
+33 QUIT
+34 ;
ERR ;
+1 DO ^%ZTER
+2 NEW Y,ERRDTM
+3 SET Y=$$NOW^XLFDT()
XECUTE ^DD("DD")
SET ERRDTM=Y
+4 SET BMXSEC="Recording that an error occurred at "_ERRDTM
+5 IF $DATA(II)
IF $DATA(DATA)
SET II=II+1
SET @DATA@(II)=$CHAR(31)
+6 QUIT