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

BTPWTAX.m

Go to the documentation of this file.
BTPWTAX ;VNGT/HS/ALA-CMET Taxonomy List ; 05 Feb 2009  11:33 AM
 ;;1.2;CARE MANAGEMENT EVENT TRACKING;;Jul 07, 2017;Build 71
 ;
 ;
LST(DATA,PROC) ; EP -- BQI GET CMET TAXONOMY LIST
 ; Input
 ;  PROC - Retrieves taxonomies for a particular CMET procedure.  
 ;        If left blank, it retrieves all taxonomies for CMET
 ;
 NEW UID,II,TIEN,TTXT,TAXV,X
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BTPWTAX",UID))
 K @DATA
 ;
 S PROC=$G(PROC,"")
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BTPWTAX D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S @DATA@(II)="T00030TAXONOMY_NAME^T00015TAXONOMY_IEN^T00020TAX_CATEGORY^T00003TAX_SITE_DEFINED^T00030TAX_ID^T00003TAX_ITEMS^T00030REGISTER^T00003USER_EDITABLE"_$C(30)
 ;
 I PROC'="" D PRCS
 ;
 I PROC="" D CMET
 ;
DONE ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
CMET ; EP
 S PROC=0
 F  S PROC=$O(^BTPW(90621,PROC)) Q:'PROC  D PRCS
 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
 ;
PRCS ;
 NEW TIEN,TDATA,TY,ID,IID,USER,CCAT,TTXT,TXTN
 S TIEN=0
 F  S TIEN=$O(^BTPW(90621,PROC,1,TIEN)) Q:'TIEN  D
 . NEW DA,IENS
 . S DA(1)=PROC,DA=TIEN,IENS=$$IENS^DILF(.DA)
 . S TDATA=^BTPW(90621,PROC,1,TIEN,0)
 . S ID="",TY=$P(TDATA,U,3),CAT="",USER="",IID=""
 . I TY'="" S ID=$$GET1^DIQ(90621.1,TY,.06,"E"),CAT=$$GET1^DIQ(90621.1,TY,.07,"E"),IID=$$GET1^DIQ(90621.1,TY,.06,"I")
 . S II=II+1
 . S USER=$S(IID="CM":"YES",1:"NO")
 . S CCAT=$$CAT^BTPWPDSP(PROC),CCAT=$$LOWER^VALM1(CCAT)
 . S TTXT=$P(TDATA,U,1),TXTN=$P(TDATA,U,2),SITE=$S($$GET1^DIQ(90621.01,IENS,.04,"I")=1:"YES",1:"NO")
 . S ITEM=$S('$$ENTRS^BQITAXX($P(TDATA,U,2)):"NO",1:"YES")
 . S @SORT@(TTXT,CAT,ID)=TTXT_U_TXTN_U_CAT_U_SITE_U_ID_U_ITEM_U_CCAT_U_USER
 . ;S @DATA@(II)=$P(TDATA,U,1)_U_$P(TDATA,U,2)_U_CAT
 . ;S @DATA@(II)=@DATA@(II)_U_$S($$GET1^DIQ(90621.01,IENS,.04,"I")=1:"YES",1:"NO")_U_ID_U_$S('$$ENTRS^BQITAXX($P(TDATA,U,2)):"NO",1:"YES")_U_CCAT_U_USER_$C(30)
 Q
 ;
ITM(DATA,TAXIEN,VDATE) ;EP - BTPW GET TAXONOMY ITEMS
 NEW UID,II,TIEN,IEN,CODE,DESC,BTPWX,TAX,VALUE,N,HDR
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BTPWTAXI",UID))
 K @DATA
 ;
 I $G(VDATE)'="" S VDATE=$$DATE^BQIUL1(VDATE)
 I $G(VDATE)="" S VDATE=DT
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BTPWTAX D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D ITM^BQITAXX5(.DATA,TAXIEN)
 NEW VALUE,VVDATE,VVTYP,VVFIL,VVTN,VOK,CT,VVTYP1,VVTYP2,IMPL1,IMPL2
 K BTPWX
 S TIEN=0,HDR="I00010IVALIEN^T00080IVALDESC"
 F  S TIEN=$O(@DATA@(TIEN)) Q:'TIEN  D
 . I @DATA@(TIEN)[$C(31) Q
 . S VALUE=$$TKO^BQIUL1(@DATA@(TIEN),$C(30))
 . S VVDATE=$P(VALUE,U,11),VVDATE=$$DATE^BQIUL1(VVDATE)
 . S VVTYP=$P(VALUE,U,10)
 . ;
 . I VVTYP["ICD" D  Q
 .. I VALUE=$C(31) Q
 .. S VVFIL=$P(VALUE,U,2)
 .. S VVTN="",VOK=0,CT=0 F  S VVTN=$O(^ICDS("F",VVFIL,VVTN)) Q:VVTN=""  D
 ... S CT=CT+1,@("IMPL"_CT)=$P(^ICDS(VVTN,0),"^",4),@("VVTYP"_CT)=$P(^ICDS(VVTN,0),"^",1)
 .. I VDATE>IMPL2 D  Q
 ... I VVTYP'=VVTYP2 Q
 ... D VOK
 .. I VDATE<IMPL2,VDATE>IMPL1 D  Q
 ... I VVDATE="",VVTYP=VVTYP1 D VOK Q
 ... I VDATE'>VVDATE D VOK Q
 . ;
 . I VVTYP="CPT" D  Q
 .. S VVTN=$P(VALUE,U,7),IMPL=$P(^ICPT(VVTN,0),U,8)
 .. I VVDATE="",VDATE>IMPL D VOK Q
 .. I VVDATE'="",VDATE<VVDATE,VDATE>IMPL D VOK Q
 . ;
 . D VOK
 ;
 K @DATA
 S @DATA@(II)=HDR_$C(30)
 I TAXIEN["ATXLAB" S II=II+1,@DATA@(II)="  "_$C(30)
 S N=0 F  S N=$O(BTPWX(N)) Q:N=""  S II=II+1,@DATA@(II)=BTPWX(N)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
VOK ;EP
 S IEN=$P(VALUE,U,7),CODE=$P(VALUE,U,8),DESC=$P(VALUE,U,9)
 S BTPWX(TIEN)=IEN_U_CODE_$S(CODE'="":"  -  ",1:"")_DESC_$C(30)
 Q