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

BQIMUSIT.m

Go to the documentation of this file.
BQIMUSIT ;VNGT/HS/ALA-MU Site Parameters ; 03 Mar 2011  3:13 PM
 ;;2.3;ICARE MANAGEMENT SYSTEM;;Apr 18, 2012;Build 59
 ;
 ;
GUSR(DATA,FAKE) ;EP -- BQI MU GET SITE PARAMETERS
 ;
 ; Get specific MU system parameters from the Site Parameter file
 NEW UID,II,IEN,CLASS,CN,CLSN,DTE,DATE,CLS,CDTE,CDATE
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIMUSIT",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIMUSIT D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S @DATA@(II)="T00010TIMEFRAME^T00010CQTIMEFRAME^T00001TYPE^T01024USER_CLASSES"_$C(30)
 ;
 S IEN=$O(^BQI(90508,0)) I IEN="" S BMXSEC="No site defined" Q
 S CLASS="",CN=0
 F  S CN=$O(^BQI(90508,IEN,13,CN)) Q:'CN  D
 . S CLSN=$P(^BQI(90508,IEN,13,CN,0),U,1)
 . S CLASS=CLASS_CLSN_$C(28)_$P(^USR(8930,CLSN,0),U,4)_$C(29)
 . S DTE=$$GET1^DIQ(90508,IEN_",",12.01,"I") I DTE="" S DATE="90"_$C(28)_"90 Days"
 . I DTE'="" S DATE=DTE_$C(28)_$$GET1^DIQ(90508,IEN_",",12.01,"E")
 . S CDTE=$$GET1^DIQ(90508,IEN_",",12.1,"I") I CDTE="" S CDATE="90"_$C(28)_"90 Days"
 . I CDTE'="" S CDATE=CDTE_$C(28)_$$GET1^DIQ(90508,IEN_",",12.1,"E")
 . S CLS=$$GET1^DIQ(90508,IEN_",",12.02,"I")
 S II=II+1,@DATA@(II)=DATE_U_CDATE_U_CLS_U_$$TKO^BQIUL1(CLASS,$C(29))_$C(30)
 ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
UUSR(DATA,PARMS) ;EP -- BQI MU UPDATE SITE PARAMETERS
 NEW RESULT,ERROR,LIST,BN,BQ,PDATA,NAME,VALUE,CLASS,BI,CDATA,BQIUPD
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIUUSR",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIMUSIT D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S @DATA@(II)="I00010RESULT^T001024ERROR"_$C(30)
 ;
 S PARMS=$G(PARMS,"")
 I PARMS="" D
 . S LIST="",BN=""
 . F  S BN=$O(PARMS(BN)) Q:BN=""  S LIST=LIST_PARMS(BN)
 . K PARMS
 . S PARMS=LIST
 . K LIST
 ;
 F BQ=1:1:$L(PARMS,$C(28)) D  Q:$G(BMXSEC)'=""
 . S PDATA=$P(PARMS,$C(28),BQ) Q:PDATA=""
 . S NAME=$P(PDATA,"=",1),VALUE=$P(PDATA,"=",2,99)
 . I NAME="TIMEFRAME" S BQIUPD(90508,1_",",12.01)=VALUE Q
 . I NAME="CQTIMEFRAME" S BQIUPD(90508,1_",",12.1)=VALUE Q
 . I NAME="TYPE" S BQIUPD(90508,1_",",12.02)=$S(VALUE="Y":VALUE,1:"@") Q
 . I NAME="CLASS" F BI=1:1:$L(VALUE,$C(29)) D
 .. S CDATA=$P(VALUE,$C(29),BI),CLASS(CDATA)=""
 ;
 S RESULT=1
 I $D(BQIUPD) D FILE^DIE("","BQIUPD","ERROR")
 I $D(CLASS) D
 . I $G(^BQI(90508,1,13,0))="" S ^BQI(90508,1,13,0)="^90508.013P^^"
 . NEW DA,DIK
 . S DA(1)=1,DA=0,DIK="^BQI(90508,"_DA(1)_",13,"
 . F  S DA=$O(^BQI(90508,DA(1),13,DA)) Q:'DA  D ^DIK
 . S DA(1)=1
 . S CLS="",DIC(0)="LMNZ",DLAYGO="90508.13",DIC("P")=DLAYGO,DIC="^BQI(90508,"_DA(1)_",13,"
 . F  S CLS=$O(CLASS(CLS)) Q:CLS=""  S X="`"_CLS D ^DIC I Y=-1 S RESULT=-1
 ;
 I $D(ERROR)>0 S RESULT=-1_U_$G(ERROR("DIERR",1,"TEXT",1))
 I $P(RESULT,U,1)'=-1 S RESULT=1_U
 S II=II+1,@DATA@(II)=RESULT_$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
 ;
ACT(DATA,FAKE) ;EP -- BQI GET NUMBER OF PATIENTS
 NEW II,UID,VALUE
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIPTACT",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIMUSIT D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S @DATA@(II)="I00010TOTAL^I00010ACTIVE^I00010NOTSEEN"_$C(30)
 S VALUE=$G(^XTMP("BQIPTACT",1))
 I VALUE="" D NUM S VALUE=$G(^XTMP("BQIPTACT",1))
 S II=II+1,@DATA@(II)=VALUE_$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
NUM ;EP
 NEW TOT,ACT,NOT,DFN
 S TOT=0,ACT=0,NOT=0
 S DFN=0
 F  S DFN=$O(^AUPNPAT(DFN)) Q:'DFN  D
 . I $G(^AUPNPAT(DFN,0))="" Q
 . S TOT=TOT+1
 . I $$HRN^BQIUL1(DFN) S ACT=ACT+1
 . I '$$VTHR^BQIUL1(DFN) S NOT=NOT+1
 S ^XTMP("BQIPTACT",0)=$$FMADD^XLFDT(DT,2)_U_$$DT^XLFDT()_U_"Count of Patients"
 S ^XTMP("BQIPTACT",1)=TOT_U_ACT_U_NOT
 Q