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

BQIMTCRT.m

Go to the documentation of this file.
BQIMTCRT ;GDIT/HS/ALA-Matched Criteria Utilities ; 23 Jan 2013  12:42 PM
 ;;2.6;ICARE MANAGEMENT SYSTEM;;Jul 07, 2017;Build 72
 ;
 ;
TAB(DATA,OWNR,PLIEN) ;EP -- BQI GET MATCH CRITERIA DROP
 NEW UID,II
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIMTCRT",UID))
 K @DATA
 ;
 S II=0
 D THDR
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIMTCRT D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 I $P(^BQICARE(OWNR,1,PLIEN,0),U,10)=0 G DONE
 NEW DA,IENS,TYPE,SOURCE,FSOURCE,PPIEN,ARRAY
 S DA(1)=OWNR,DA=PLIEN,IENS=$$IENS^DILF(.DA)
 S SOURCE=$$GET1^DIQ(90505.01,IENS,.11,"E")
 I SOURCE="INPATIENTS" S ARRAY("IN")="IN^Inpatients"
 I SOURCE="ER VISITS" S ARRAY("ER")="ER^ER Visits"
 ;I SOURCE="RPMS REGISTER PATIENTS" S ARRAY("RG")="RG^Register"
 S FSOURCE=$$GET1^DIQ(90505.01,IENS,.14,"E")
 S PPIEN=$$PP^BQIDCDF(FSOURCE) I PPIEN=-1 G CONT
 ;
 F TYPE="PROB","MED","LAB","ALLERGY","MEDTX","LABTX","PROBTX","CPT","CPTTX","EDUPICK","EDUTX","EDUC","EDUTOP","REMCODE","POV","POVTX","POVS","POVSB","MEAS" D
 . I '$D(^BQICARE(OWNR,1,PLIEN,15,"B",TYPE)) Q
 . I TYPE="PROB"!(TYPE="PROBTX") S ARRAY("PR")="PR^Problems"
 . I TYPE="POV"!(TYPE="POVS")!(TYPE="POVTX")!(TYPE="POVSB") S ARRAY("DX")="DX^POVs"
 . I TYPE="MEAS" S ARRAY("MS")="MS^Measurements"
 . I TYPE="MED"!(TYPE="MEDTX") D
 .. I $D(^BQICARE(OWNR,1,PLIEN,15,"B","MNOT")) Q
 .. S ARRAY("ME")="ME^Medications"
 . I TYPE="LAB"!(TYPE="LABTX") D
 .. I $D(^BQICARE(OWNR,1,PLIEN,15,"B","LNOT")) Q
 .. S ARRAY("LA")="LA^Lab Tests"
 . I TYPE="ALLERGY" S ARRAY("AL")="AL^Allergies"
 . I TYPE="CPT"!(TYPE="CPTTX") D
 .. I $D(^BQICARE(OWNR,1,PLIEN,15,"B","CNOT")) Q
 .. S ARRAY("CP")="CP^CPTs"
 . I TYPE="EDUC"!(TYPE="EDUPICK")!(TYPE="EDUTX")!(TYPE="EDUTOP") D
 .. I $D(^BQICARE(OWNR,1,PLIEN,15,"B","EDUNOT")) Q
 .. S ARRAY("ED")="ED^Pt Education"
 . I TYPE="REMCODE" S ARRAY("RE")="RE^Reminder Notifications"
 ;
CONT ;
 NEW TIEN
 S TYPE=""
 F  S TYPE=$O(ARRAY(TYPE)) Q:TYPE=""  D
 . S TIEN=$O(^BQI(90506.5,"C",TYPE,"")) I TIEN="" Q
 . I $P(^BQI(90506.5,TIEN,0),"^",10)=1 Q
 . S II=II+1,@DATA@(II)=ARRAY(TYPE)_$C(30)
 ;
DONE ;
 I '$G(NFLG) 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
 ;
THDR ;
 S @DATA@(II)="T00010IEN^T00030NAME"_$C(30)
 Q
 ;
 ;
COL(DATA,TYPE) ;EP -- BQI GET MATCH CRITERIA COLUMN
 NEW UID,II
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIMTCRT",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIMTCRT D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;S MTYP=$S(TYPE="PR":"PROB",TYPE="ME":"MED",TYPE="LA":"LAB",TYPE="IN":"INP",TYPE="CP":"CPT",TYPE="AL":"ALGY",1:"") I MTYP="" Q
 S HDR="T00015CODE^T00050DISPLAY_NAME"
 S @DATA@(II)=HDR_$C(30)
 ;
 NEW CRIEN,TYP,ORD,IEN,KEY,CODE
 S CRIEN=$$FIND1^DIC(90506.5,"","B","Patient","","","ERROR")
 S TYP=$P(^BQI(90506.5,CRIEN,0),U,2)
 S ORD=""
 F  S ORD=$O(^BQI(90506.1,"AD",TYP,ORD)) Q:ORD=""  D
 . S IEN=""
 . F  S IEN=$O(^BQI(90506.1,"AD",TYP,ORD,IEN)) Q:IEN=""  D
 .. I $$GET1^DIQ(90506.1,IEN_",",.1,"I")=1 Q
 .. S KEY=$$GET1^DIQ(90506.1,IEN_",",3.1,"E")
 .. I KEY'="",'$$KEYCHK^BQIULSC(KEY,DUZ) Q
 .. I $$GET1^DIQ(90506.1,IEN_",",3.04,"I")'="O" D
 ... S CODE=$P(^BQI(90506.1,IEN,0),U,1) Q:CODE=""
 ... I $P($G(^BQI(90506.1,IEN,0)),U,10)=1 Q
 ... S II=II+1,@DATA@(II)=CODE_U_$P(^BQI(90506.1,IEN,0),U,3)_$C(30)
 ;
 NEW CRIEN,BN,CDATA,CODE
 S CRIEN=$$FIND1^DIC(90506.5,,"X",TYPE,"C","","ERROR")
 S BN=0
 F  S BN=$O(^BQI(90506.5,CRIEN,10,BN)) Q:'BN  D
 . S CDATA=^BQI(90506.5,CRIEN,10,BN,0)
 . S CODE=$P(CDATA,U,1)
 . S II=II+1,@DATA@(II)=CODE_U_$P(CDATA,U,3)_$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 Q