BQIPTELD ;PRXM/HC/ALA - PATIENT ELDER CARE ; 27 Mar 2007 1:32 PM
;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
;
Q
;
ELD(DATA,DFN,DRANGE) ; EP -- BQI PATIENT ELDER CARE
;
;Description - all the elder care data that a patient has
;
;Input
; DFN - Patient internal entry number
;
NEW UID,II,IEN,VISIT,VSDTM,HDR,VALUE,FLD,ELDN,ORPHY,ENPHY
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S DATA=$NA(^TMP("BQIPTELD",UID))
K @DATA
;
S II=0
NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPTELD D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
;
S DRANGE=$$DATE^BQIUL1($G(DRANGE))
S HDR="I00010ELD_IEN^I00010VISIT_IEN^T00009FORM^D00030VISIT_DATETIME^T00035ORD_PROV^T00035ENC_PROV^"
F FLD=.04:.01:.09,.11:.01:.15 S HDR=HDR_"T00020"_$E($$GET1^DID(9000010.35,FLD,"","LABEL"),1,4)_U
S HDR=HDR_"T00020TRANSP^T00020CHANGE^T00003CAREGIVE"
S @DATA@(II)=HDR_$C(30)
S IEN=""
F S IEN=$O(^AUPNVELD("AC",DFN,IEN),-1) Q:IEN="" D
. S VALUE=""
. S ELDN=$$GET1^DIQ(9000010.35,IEN_",",.01,"E") I ELDN="" Q
. S VISIT=$$GET1^DIQ(9000010.35,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 ORPHY=$$GET1^DIQ(9000010.35,IEN_",",1202,"E")
. S ENPHY=$$GET1^DIQ(9000010.35,IEN_",",1204,"E")
. S VALUE=IEN_U_VISIT_U_ELDN_U_$$FMTE^BQIUL1(VSDTM)_U_ORPHY_U_ENPHY_U
. F FLD=.04:.01:.09,.11:.01:.18 S VALUE=VALUE_$$GET1^DIQ(9000010.35,IEN_",",FLD,"E")_U
. S II=II+1,@DATA@(II)=$$TKO^BQIUL1(VALUE,"^")_$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
BQIPTELD ;PRXM/HC/ALA - PATIENT ELDER CARE ; 27 Mar 2007 1:32 PM
+1 ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
+2 ;
+3 QUIT
+4 ;
ELD(DATA,DFN,DRANGE) ; EP -- BQI PATIENT ELDER CARE
+1 ;
+2 ;Description - all the elder care data that a patient has
+3 ;
+4 ;Input
+5 ; DFN - Patient internal entry number
+6 ;
+7 NEW UID,II,IEN,VISIT,VSDTM,HDR,VALUE,FLD,ELDN,ORPHY,ENPHY
+8 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+9 SET DATA=$NAME(^TMP("BQIPTELD",UID))
+10 KILL @DATA
+11 ;
+12 SET II=0
+13 ; SAC 2006 2.2.3.3.2
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^BQIPTELD D UNWIND^%ZTER"
+14 ;
+15 SET DRANGE=$$DATE^BQIUL1($GET(DRANGE))
+16 SET HDR="I00010ELD_IEN^I00010VISIT_IEN^T00009FORM^D00030VISIT_DATETIME^T00035ORD_PROV^T00035ENC_PROV^"
+17 FOR FLD=.04:.01:.09,.11:.01:.15
SET HDR=HDR_"T00020"_$EXTRACT($$GET1^DID(9000010.35,FLD,"","LABEL"),1,4)_U
+18 SET HDR=HDR_"T00020TRANSP^T00020CHANGE^T00003CAREGIVE"
+19 SET @DATA@(II)=HDR_$CHAR(30)
+20 SET IEN=""
+21 FOR
SET IEN=$ORDER(^AUPNVELD("AC",DFN,IEN),-1)
IF IEN=""
QUIT
Begin DoDot:1
+22 SET VALUE=""
+23 SET ELDN=$$GET1^DIQ(9000010.35,IEN_",",.01,"E")
IF ELDN=""
QUIT
+24 SET VISIT=$$GET1^DIQ(9000010.35,IEN_",",.03,"I")
IF VISIT=""
QUIT
+25 SET VSDTM=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
IF VSDTM=0
QUIT
+26 IF DRANGE'=""
IF (VSDTM\1<DRANGE)
QUIT
+27 SET ORPHY=$$GET1^DIQ(9000010.35,IEN_",",1202,"E")
+28 SET ENPHY=$$GET1^DIQ(9000010.35,IEN_",",1204,"E")
+29 SET VALUE=IEN_U_VISIT_U_ELDN_U_$$FMTE^BQIUL1(VSDTM)_U_ORPHY_U_ENPHY_U
+30 FOR FLD=.04:.01:.09,.11:.01:.18
SET VALUE=VALUE_$$GET1^DIQ(9000010.35,IEN_",",FLD,"E")_U
+31 SET II=II+1
SET @DATA@(II)=$$TKO^BQIUL1(VALUE,"^")_$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