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

BQISYSIT.m

Go to the documentation of this file.
BQISYSIT ;APTIV/HC/ALA-System Site Parameters for iCare ; 11 Apr 2008  3:43 PM
 ;;2.7;ICARE MANAGEMENT SYSTEM;**1**;Dec 19, 2017;Build 12
 ;
GET(DATA,FAKE) ;EP -- BQI GET SYSTEM PARAMETERS
 ; Get specific iCare system parameters from the Site Parameter file
 NEW UID,II,NUM,IEN
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQISYSIT",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQISYSIT D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S @DATA@(II)="I00010NUM_CONN"_$C(30)
 ;
 S IEN=$$SPM^BQIGPUTL()
 S NUM=$$GET1^DIQ(90508,IEN_",",.19,"E") S:NUM="" NUM=3
 S II=II+1,@DATA@(II)=NUM_$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
 ;
JOB(DATA,FAKE) ; EP - BQI GET SYSTEM JOB DATA
 NEW UID,II,NUM,IEN,OPTN,JOB,FLDS,BQSCHED,BQI,SDATA,TYPE,START,FROM,THRU
 NEW END,STAT,OPN,TYP,TASK,TSK,BQNSCH
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQISYSIT",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQISYSIT D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S @DATA@(II)="T00015JOB^T00015TYPE^D00030START^D00030END^T00015STATUS^T00050NEXT_DUE"_$C(30)
 ;
 S IEN=$$SPM^BQIGPUTL(),BQSCHED=""
 S OPTN=$$FIND^BQISCHED("BQI NIGHTLY BACKGROUND")
 I $O(^DIC(19.2,"B",OPTN,""))="" S BQSCHED="Not scheduled"
 S JOB="NIGHTLY"
 S FLDS="Flags;3.01;3.02;3.03^Natl Measures;3.07;3.08;3.09^Diagnostic Tags;3.04;3.05;3.06^Reminders;3.1;3.11;3.12^Best Practice Prompts;3.13;3.14;"
 S FLDS=FLDS_"3.15^Comm Alerts;3.16;3.17;3.18^Panel Autopopulate;3.19;3.2;3.21^Care Mgmt Update;3.22;3.23;3.24" D RET
 ; CMET
 S START=$$FMTE^BQIUL1($P(^BTPW(90628,IEN,0),U,6))
 S END=$$FMTE^BQIUL1($P(^BTPW(90628,IEN,0),U,7))
 S STAT=$$GET1^DIQ(90628,IEN_",",.08,"E")
 S TASK=24.11,TSK=$$GET1^DIQ(90508,IEN_",",TASK,"E") I TSK'="" S STAT=$$TSK(TSK)
 S II=II+1,@DATA@(II)=JOB_U_"CMET Data Mining"_U_START_U_END_U_STAT_U_BQSCHED_$C(30)
 ;
 S OPTN=$$FIND^BQISCHED("BQI UPDATE TASK")
 I $O(^DIC(19.2,"B",OPTN,""))="" S BQSCHED="Not scheduled"
 S JOB="WEEKLY",FLDS="Diagnostic Tags;4.01;4.02;4.03;24.04^Natl Measures;4.04;4.05;4.06;24.05^Reminders;4.07;4.08;4.09;24.06^Best Practice Prompts;4.1;4.11;4.12;24.02" D RET
 S JOB="WEEKLY",FLDS="Care Mgmt Update;4.13;4.14;4.15;24.03^IPC;8.04;8.05;8.06;11.06" D RET
 ;
 S JOB="MONTHLY",FLDS="IPC Update;8.1;8.11;8.12;24.08" D RET
 ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
RET ; Retrieve data
 F BQI=1:1:$L(FLDS,"^") D
 . S SDATA=$P(FLDS,"^",BQI)
 . S TYP=$P(SDATA,";",1),FROM=$P(SDATA,";",2),THRU=$P(SDATA,";",3),STAT=$P(SDATA,";",4),TASK=$P(SDATA,";",5)
 . S START=$$FMTE^BQIUL1($$GET1^DIQ(90508,IEN_",",FROM,"I"))
 . S END=$$FMTE^BQIUL1($$GET1^DIQ(90508,IEN_",",THRU,"I"))
 . S STAT=$$GET1^DIQ(90508,IEN_",",STAT,"E"),BQSCHED=""
 . S TSK=$$GET1^DIQ(90508,IEN_",",TASK,"E") I TSK'="" S STAT=$$TSK(TSK)
 . I JOB="NIGHTLY" D
 .. I STAT'="" S TASK=24.01,TSK=$$GET1^DIQ(90508,IEN_",",TASK,"E") I TSK'="" S STAT=$$TSK(TSK)
 .. S OPTN=$$FIND^BQISCHED("BQI NIGHTLY BACKGROUND")
 .. I OPTN'>0 S BQSCHED="Not scheduled" Q
 .. S OPN=$O(^DIC(19.2,"B",OPTN,""))
 .. I OPN="" S BQSCHED="Not scheduled" Q
 .. S BQSCHED=$$FMTE^BQIUL1($P(^DIC(19.2,OPN,0),U,2)),BQNSCH=$P(^DIC(19.2,OPN,0),U,2)
 . I JOB="WEEKLY" D
 .. I TYP="Diagnostic Tags"!(TYP="Natl Measures") D
 ... S OPTN=$$FIND^BQISCHED("BQI UPDATE TASK")
 ... I OPTN'>0 S BQSCHED="Not scheduled" Q
 ... S OPN=$O(^DIC(19.2,"B",OPTN,""))
 ... I OPN="" S BQSCHED="Not scheduled" Q
 ... S BQSCHED=$$FMTE^BQIUL1($P(^DIC(19.2,OPN,0),U,2))
 .. I TYP="Reminders" D OPRET("BQI UPDATE ALL REMINDERS")
 .. I TYP="Best Practice Prompts" D OPRET("BQI UPDATE TREATMENT")
 .. I TYP="Care Mgmt Update" D OPRET("BQI UPDATE CARE MGMT")
 .. I TYP="IPC" D
 ... NEW CDOW,DFL,WDATE
 ... S CDOW=$$DOW^XLFDT(DT,1) I CDOW'=0 D
 ... S DFL=0
 ... F I=1:1 Q:DFL  D  Q:DFL
 .... S WDATE=$$FMADD^XLFDT(DT,+I),CDOW=$$DOW^XLFDT(WDATE,1)
 .... I CDOW=0 S DFL=1,BQSCHED=WDATE_"."_$P($P($G(^BQI(90508,1,4)),"^",19),".",2),BQSCHED=$$FMTE^BQIUL1(BQSCHED)
 . ;
 . I JOB="MONTHLY" D
 .. I TYP="MU Clinical Quality" D
 ... NEW ZTSK
 ... S ZTSK=$P(^BQI(90508,1,12),U,5) I ZTSK'="" D QTSK(ZTSK) Q
 ... I ZTSK="" D NXRUN("01") Q
 .. I TYP="MU Performance" D
 ... NEW ZTSK
 ... S ZTSK=$P(^BQI(90508,1,12),U,6) I ZTSK'="" D QTSK(ZTSK) Q
 ... I ZTSK="" D NXRUN("01")
 .. I TYP="IPC Update" D
 ... NEW DY
 ... S DY=$P(^BQI(90508,1,11),U,2)
 ... D NXRUN("0"_DY) Q
 . S II=II+1,@DATA@(II)=JOB_U_TYP_U_START_U_END_U_STAT_U_BQSCHED_$C(30)
 Q
 ;
PTCH(DATA,PATCH) ;EP - BQI CHECK PATCH STATUS
 ; Input parameter
 ;   PATCH - Standard KIDS patch format e.g. BQI*1.1*2 or BGP*8.0*2
 NEW UID,II,RESULT,MSG
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQISYPTCH",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQISYSIT D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S @DATA@(II)="I00010RESULT^T00100MSG"_$C(30)
 S RESULT=$$PATCH^XPDUTL(PATCH)
 I RESULT=0 S RESULT=-1,MSG="Patch is not installed"
 S II=II+1,@DATA@(II)=RESULT_"^"_$G(MSG)_$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
VRCH(DATA,PKG) ; EP - BQI CHECK VERSION STATUS
 ; Input parameter
 ;   PKG - Standard Package namespace e.g. BQI or BGP.
 NEW UID,II,RESULT
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQISYVRCH",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQISYSIT D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S @DATA@(II)="T00010VERSION"_$C(30)
 S RESULT=$$VERSION^XPDUTL(PKG)
 S II=II+1,@DATA@(II)=RESULT_$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
JTIP(DATA,FAKE) ;EP - BQI GET JOB TOOLTIPS
 NEW UID,II,BQIDA,TDTA,PC,ND,TEXT,NN,TXT
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQISYSTP",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQISYSIT D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S @DATA@(II)="T01024JOB^T01024TYPE^T01024END^T01024START^T01024STATUS^T01024NEXT_DUE"_$C(30)
 ;
 S BQIDA=$$SPM^BQIGPUTL(),II=II+1
 ;  Process the word-processing tooltips
 F TDTA="5,1","6,2","7,3" D JTXT
 ;
 F PC=1:1:3 S $P(@DATA@(II),U,(PC+3))=$P(^BQI(90508,BQIDA,8),U,PC)
 S @DATA@(II)=@DATA@(II)_$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
JTXT ;
 S ND=$P(TDTA,",",1),PC=$P(TDTA,",",2)
 S TEXT="",NN=0
 F  S NN=$O(^BQI(90508,BQIDA,ND,NN)) Q:'NN  D
 . S TXT=^BQI(90508,BQIDA,ND,NN,0)
 . S TEXT=TEXT_TXT_$C(10)
 S $P(@DATA@(II),U,PC)=$$TKO^BQIUL1(TEXT,$C(10))
 Q
 ;
OPRET(RPC) ;EP
 S OPTN=$$FIND^BQISCHED(RPC)
 I OPTN'>0 S BQSCHED="Not scheduled" Q
 S OPN=$O(^DIC(19.2,"B",OPTN,""))
 I OPN="" S BQSCHED="Not scheduled" Q
 S BQSCHED=$$FMTE^BQIUL1($P(^DIC(19.2,OPN,0),U,2))
 Q
 ;
NXRUN(DAY) ;EP
 NEW CIPC
 S CIPC=$P($G(^BQI(90508,1,8)),U,10)
 S BQMON=$E(CIPC,4,5),CYR=$E(CIPC,1,3)
 ;S BQMON=$E(DT,4,5),CYR=$E(DT,1,3)
 I BQMON=12 S BQMON=1,CYR=CYR+1
 E  S BQMON=BQMON+1
 I $L(BQMON)=1 S BQMON="0"_BQMON
 S BEGDT=CYR_BQMON_DAY
 S BQSCHED=$$FMTE^BQIUL1(BEGDT)_" "_$P($$FMTE^XLFDT(BQNSCH),"@",2)
 Q
 ;
TSK(ZTSK) ;EP
 I $G(ZTSK)="" Q ""
 D STAT^%ZTLOAD
 Q $G(ZTSK(2))
 ;
QTSK(ZTSK) ;EP
 NEW STRT
 S STRT=$P($G(^%ZTSK(ZTSK,0)),U,6),STRT=$$HTFM^XLFDT(STRT)
 S BQSCHED=$$FMTE^BQIUL1(STRT)
 Q