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

BQIPTPOV.m

Go to the documentation of this file.
BQIPTPOV ;GDHS/HCD/ALA-Patient POVs ; 02 Nov 2016  2:28 PM
 ;;2.6;ICARE MANAGEMENT SYSTEM;;Jul 07, 2017;Build 72
 ;;
 ;
 Q
 ;
POV(DATA,DFN,DRANGE) ; EP -- BQI PATIENT POVS
 ;
 ;Description - all the POVs that a patient has
 ;
 ;Input
 ;  DFN - Patient internal entry number
 ;  DRANGE - Date range as a relative date ie. T-6M
 ;
 NEW UID,II,IEN,TIEN,TNAME,VISIT,VSDTM,VALUE,TCODE,TFREV,TPRSC,TENCPRV,TNARR
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIPTPOV",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPTPOV D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S DRANGE=$$DATE^BQIUL1($G(DRANGE))
 S HEADR="I00010POV_IEN^I00010VISIT_IEN^D00030VISIT_DATETIME^T00015TYPE_CODE^T00030TYPE_DESC^T00011FIRSTREVISIT^"
 S HEADR=HEADR_"T00009PRIMSEC^T00030ENCOUNTERPROV^T00080PROV_NARR"
 S @DATA@(II)=HEADR_$C(30)
 S IEN=""
 F  S IEN=$O(^AUPNVPOV("AC",DFN,IEN),-1) Q:IEN=""  D
 . S TIEN=$$GET1^DIQ(9000010.07,IEN_",",.01,"I") I TIEN="" Q
 . S VISIT=$$GET1^DIQ(9000010.07,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 TCODE=$$CODEC^ICDCODE(TIEN,80)
 . S TNAME=$$VST^ICDCODE(TIEN,"",80)
 . S TFREV=$$GET1^DIQ(9000010.07,IEN_",",.08,"E")
 . S TPRSC=$$GET1^DIQ(9000010.07,IEN_",",.12,"E")
 . S TENCPRV=$$GET1^DIQ(9000010.07,IEN_",",1204,"E")
 . S TNARR=$$GET1^DIQ(9000010.07,IEN_",",.04,"E")
 . S II=II+1,@DATA@(II)=IEN_U_VISIT_U_$$FMTE^BQIUL1(VSDTM)_U_TCODE_U_TNAME_U_TFREV_U_TPRSC_U_TENCPRV_U_TNARR_$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