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

BQIVFTRT.m

Go to the documentation of this file.
BQIVFTRT ;GDHD/HCS/ALA-V File trigger for CMET Event ; 06 Jan 2017  12:38 PM
 ;;2.6;ICARE MANAGEMENT SYSTEM;;Jul 07, 2017;Build 72
 ;;
 ;
 ;
EN(DATA,EVIEN,EVTYPE,TAXIEN) ;EP - BQI VFILE TRIGGER EVENT
 NEW UID,II,VALUE,IVIEN,EVVALUE,IVALIEN,TY
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIVFTRT",UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIVFTRT D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 D HDR
 I $G(EVTYPE)'="" D TYP(EVIEN,EVTYPE) G DONE
 I $G(TAXIEN)'="" D TAX G DONE
 I $G(EVIEN)'="" D EVT(EVIEN) G DONE
 Q
 ;
EVT(EVIEN) ;EP
 NEW EVTYPE,EVVALUE,IVALIEN,TY,IEN,DVAL,DVAL1,LIEN,TYPE,DEF,TAX,TAXP,TAXIEN,DEFN
 S EVTYPE="",EVVALUE="",IVALIEN=""
 S TY=$$GET1^DIQ(90621,EVIEN_",",.12,"I")
 I TY'="" S EVTYPE=$$GET1^DIQ(90621.1,TY_",",.09,"E")
 I TY'="" S IEN=$O(^BTPW(90621,EVIEN,1,"C",TY,""))
 I $G(IEN)'="" D
 . S EVVALUE=$P(^BTPW(90621,EVIEN,1,IEN,0),"^",5),IVIEN=$P(^(0),"^",6),TAXIEN=$P(^(0),U,2)
 . S SOURCE="EVTYPE",TYPE="",ABLE="Y",TYPE="",VALUE=EVTYPE,HELP="",CLEAR="" D UP
 . S SOURCE="EVVALUE",TYPE="",ABLE="Y",TYPE="",VALUE=EVVALUE,HELP="",CLEAR="" D UP
 . S SOURCE="IVALIEN",TYPE="",ABLE="Y",TYPE="",VALUE=IVIEN,HELP="",CLEAR="" D UP
 . S SOURCE="TAXIEN",TYPE="",ABLE="Y",TYPE="",VALUE=TAXIEN,HELP="",CLEAR="" D UP
 . ;S IEN=0 F  S IEN=$O(^BTPW(90621,EVIEN,1,IEN)) Q:'IEN  D
 . S TY=$P(^BTPW(90621,EVIEN,1,IEN,0),U,3),TAX=$P(^(0),U,1),DEF=$P(^(0),U,5),TAXP=$P(^(0),U,2),DEFN=$P(^(0),U,6)
 . I TY=1!(TY=6) Q
 . S LIEN=$P(^BTPW(90621,EVIEN,1,IEN,0),U,6) I TY=3,LIEN'="" S DEF=$P(^LAB(60,LIEN,0),"^",1)
 . S TYPE=$$GET1^DIQ(90621.1,TY_",",.09,"E")
 . I $D(DVAL(TYPE)) Q
 . S N="" F  S N=$O(DVAL1(N)) Q:N=""  S LN=N
 . S DVAL(TYPE)=(LN+1)_U_DEF_U_TAXP_U_DEFN,DVAL1((LN+1))=TYPE
 ;
 ;S N="" F  S N=$O(DVAL1(N)) Q:N=""  D
 ;. S EVTYPE=$P(DVAL1(N),"^",1)
 ;. ;S EVTYPE=$P(DVAL1(N),"^",1),EVVALUE=$P(DVAL(EVTYPE),"^",2),TAXIEN=$P(DVAL(EVTYPE),"^",3),IVALIEN=$P(DVAL(EVTYPE),"^",4)
 ;. S II=II+1,@DATA@(II)="EVTYPE"_U_U_EVTYPE_U_$C(30)
 ;. ;S II=II+1,@DATA@(II)="EVVALUE"_U_U_EVVALUE_U_$C(30)
 ;. ;S II=II+1,@DATA@(II)="IVALIEN"_U_U_IVIEN_U_$C(30)
 ;. ;S II=II+1,@DATA@(II)="TAXIEN"_U_U_TAXIEN_U_$C(30)
 Q
 ;
EVTY(DATA,EVIEN) ;EP - Get event types
 NEW EVTYPE,EVVALUE,IVALIEN,TY,IEN,DVAL,DVAL1,LIEN,TYPE,DEF,TAX,TAXP,TAXIEN,DEFN
 S EVTYPE="",EVVALUE="",IVALIEN=""
 S @DATA@(II)="I00010EVIEN^T00010EVTYPE"_$C(30)
 S TY=$$GET1^DIQ(90621,EVIEN_",",.12,"I")
 I TY'="" S EVTYPE=$$GET1^DIQ(90621.1,TY_",",.09,"E")
 I TY'="" S IEN=$O(^BTPW(90621,EVIEN,1,"C",TY,""))
 I IEN'="" S DVAL(EVTYPE)=1,DVAL1(1)=EVTYPE
 S IEN=0 F  S IEN=$O(^BTPW(90621,EVIEN,1,IEN)) Q:'IEN  D
 . S TY=$P(^BTPW(90621,EVIEN,1,IEN,0),U,3)
 . I TY=1!(TY=6) Q
 . S TYPE=$$GET1^DIQ(90621.1,TY_",",.09,"E")
 . I $D(DVAL(TYPE)) Q
 . S N="" F  S N=$O(DVAL1(N)) Q:N=""  S LN=N
 . S DVAL(TYPE)=(LN+1),DVAL1((LN+1))=TYPE
 ;
 S N="" F  S N=$O(DVAL1(N)) Q:N=""  D
 . S EVTYPE=$P(DVAL1(N),"^",1),II=II+1,@DATA@(II)=EVIEN_U_EVTYPE_$C(30)
 Q
 ;
EVTAX(DATA,EVIEN,EVTYPE) ;EP - Get taxonomy for event type
 Q
 ;
TAX ;EP
 D ITM^BTPWTAX(.TDATA,TAXIEN)
 S N=0 F  S N=$O(@TDATA@(N)) Q:'N  D
 . I @TDATA@(N)=$C(31) Q
 . S II=II+1,@DATA@(II)="IVALIEN"_U_U_$P(@TDATA@(N),"^",1)_U_$C(30)
 . S II=II+1,@DATA@(II)="EVVALUE"_U_U_$P($P(@TDATA@(N),"^",2),"  -  ",1)_U_$C(30)
 Q
 ;
TYP(EVIEN,EVTYPE) ;EP
 NEW EVVALUE,IVALIEN,TAXIEN,IEN,TY
 S EVVALUE="",IVALIEN="",TAXIEN=""
 S TY=$O(^BTPW(90621.1,"D",EVTYPE,""))
 S IEN=$O(^BTPW(90621,EVIEN,1,"C",TY,""))
 I $G(IEN)'="" D
 . S EVVALUE=$P(^BTPW(90621,EVIEN,1,IEN,0),"^",5),IVIEN=$P(^(0),"^",6),TAXIEN=$P(^(0),U,2)
 . S II=II+1,@DATA@(II)="EVTYPE"_U_U_EVTYPE_U_$C(30)
 . S II=II+1,@DATA@(II)="EVVALUE"_U_U_EVVALUE_U_$C(30)
 . S II=II+1,@DATA@(II)="IVALIEN"_U_U_IVIEN_U_$C(30)
 . S II=II+1,@DATA@(II)="TAXIEN"_U_U_TAXIEN_U_$C(30)
 Q
 ;
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
 ;
ETYP(ECODE) ;EP -
 Q $G(^XTMP("BQIEVT",UID,ECODE))
 ;
HDR ; Header for BQI VFILE TRIGGER MEAS
 S @DATA@(II)="T00008SOURCE^T00001CODE_TYPE^T00001ABLE_FLAG^T01024PARMS^T00200HELP_TEXT^T01024CLEAR_FIELDS"_$C(30)
 Q
 ;
UP ; Update
 S II=II+1,@DATA@(II)=SOURCE_U_TYPE_U_ABLE_U_VALUE_U_HELP_U_CLEAR_$C(30)
 Q