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

BQI23POS.m

Go to the documentation of this file.
BQI23POS ;VNGT/HS/ALA - Version 2.3 PostInstall ; 20 May 2011  2:00 PM
 ;;2.3;ICARE MANAGEMENT SYSTEM;;Apr 18, 2012;Build 59
 ;
 ;
EN ;
 ;Set the version number
 NEW DA
 S DA=$O(^BQI(90508,0))
 S BQIUPD(90508,DA_",",.08)="2.3.0.26"
 S BQIUPD(90508,DA_",",.09)="2.3.0T26"
 S BQIUPD(90508,DA_",",11)="IPC3"
 S BQIUPD(90508,DA_",",11.02)=1
 S BQIUPD(90508,DA_",",.07)=1
 I $G(^BQI(90508,DA,16))="" S BQIUPD(90508,DA_",",16.01)="L"
 ;
 ;Set the timeout values
 S BQIUPD(90508,DA_",",.21)="60"
 S BQIUPD(90508,DA_",",.22)="5"
 S BQIUPD(90508,DA_",",.23)="60"
 ;
 D FILE^DIE("","BQIUPD","ERROR")
 K BQIUPD
 ;
 NEW NDZ
 S NDZ=0
 F  S NDZ=$O(^BQICARE(NDZ)) Q:'NDZ  D
 . I $P($G(^BQICARE(NDZ,2)),U,5)="" D
 .. S BQIUPD(90505,NDZ_",",2.05)=$$FIND1^DIC(90506.4,"","BX","Patient List","","","ERROR")
 .. S BQIUPD(90505,NDZ_",",2.06)="N"
 D FILE^DIE("","BQIUPD","ERROR")
 K BQIUPD
 ;
 ;Set the group order parm to no
 NEW DA,BQIUPD,ERROR
 S DA=$$SPM^BQIGPUTL()
 S BQIUPD(90508,DA_",",.2)="@"
 I $D(BQIUPD) D FILE^DIE("E","BQIUPD","ERROR")
 K DA,BQIUPD,ERROR
 ;
 ;For CANES 2.0 
 ;D DX^BQI202PU
 ;
 ; Set BTPWRPC into BQIRPC
 NEW IEN,DA,X,DIC,Y
 S DA(1)=$$FIND1^DIC(19,"","B","BQIRPC","","","ERROR"),DIC="^DIC(19,"_DA(1)_",10,",DIC(0)="LMNZ"
 I $G(^DIC(19,DA(1),10,0))="" S ^DIC(19,DA(1),10,0)="^19.01IP^^"
 S X="BTPWRPC"
 D ^DIC I +Y<1 K DO,DD D FILE^DICN
 ;
 ; Add reports to menu
 S X=$$ADD^XPDMENU("APCL IPC REPORTS MENU","BQI IPC MISMATCH PROV","MIS")
 S X=$$ADD^XPDMENU("APCL IPC REPORTS MENU","BQI IPC PROVIDER COUNT","CNT")
 ;
 ; Convert pointers to codes
 NEW NDZ,NPL,CRN,OVL,OVAL,SHZ
 S NDZ=0
 F  S NDZ=$O(^BQICARE(NDZ)) Q:'NDZ  D
 . I $G(^BQICARE(NDZ,0))="" K ^BQICARE(NDZ) Q
 . S NPL=0
 . F  S NPL=$O(^BQICARE(NDZ,1,NPL)) Q:'NPL  D
 .. S CRN=0
 .. F  S CRN=$O(^BQICARE(NDZ,1,NPL,20,CRN)) Q:'CRN  D
 ... S OVAL=$P(^BQICARE(NDZ,1,NPL,20,CRN,0),"^",1)
 ... I OVAL'?.N Q
 ... NEW DA,IENS
 ... S DA(2)=NDZ,DA(1)=NPL,DA=CRN,IENS=$$IENS^DILF(.DA)
 ... S BQIUPD(90505.05,IENS,.01)=$P(^BQI(90506.1,OVAL,0),U,1)
 .. S CRN=0
 .. F  S CRN=$O(^BQICARE(NDZ,1,NPL,23,CRN)) Q:'CRN  D
 ... S IEN=0
 ... F  S IEN=$O(^BQICARE(NDZ,1,NPL,23,CRN,1,IEN)) Q:'IEN  D
 .... S OVAL=$P(^BQICARE(NDZ,1,NPL,23,CRN,1,IEN,0),"^",1)
 .... I OVAL'?.N Q
 .... NEW DA,IENS
 .... S DA(3)=NDZ,DA(2)=NPL,DA(1)=CRN,DA=IEN,IENS=$$IENS^DILF(.DA)
 .... S BQIUPD(90505.1231,IENS,.01)=$P(^BQI(90506.1,OVAL,0),U,1)
 .. S SHZ=0
 .. F  S SHZ=$O(^BQICARE(NDZ,1,NPL,30,SHZ)) Q:'SHZ  D
 ... S CRN=0
 ... F  S CRN=$O(^BQICARE(NDZ,1,NPL,30,SHZ,20,CRN)) Q:'CRN  D
 .... S OVAL=$P(^BQICARE(NDZ,1,NPL,30,SHZ,20,CRN,0),"^",1)
 .... I OVAL'?.N Q
 .... NEW DA,IENS
 .... S DA(3)=NDZ,DA(2)=NPL,DA(1)=SHZ,DA=CRN,IENS=$$IENS^DILF(.DA)
 .... S BQIUPD(90505.06,IENS,.01)=$P(^BQI(90506.1,OVAL,0),U,1)
 ... S CRN=0
 ... F  S CRN=$O(^BQICARE(NDZ,1,NPL,30,SHZ,23,CRN)) Q:'CRN  D
 .... S IEN=0
 .... F  S IEN=$O(^BQICARE(NDZ,1,NPL,30,SHZ,23,CRN,1,IEN)) Q:'IEN  D
 ..... S OVAL=$P(^BQICARE(NDZ,1,NPL,30,SHZ,23,CRN,1,IEN,0),"^",1)
 ..... I OVAL'?.N Q
 ..... NEW DA,IENS
 ..... S DA(4)=NDZ,DA(3)=NPL,DA(2)=SHZ,DA(1)=CRN,DA=IEN,IENS=$$IENS^DILF(.DA)
 ..... S BQIUPD(90505.3231,IENS,.01)=$P(^BQI(90506.1,OVAL,0),U,1)
 . I $D(BQIUPD) D FILE^DIE("","BQIUPD","ERROR")
 ; 
 ; Add new patient entries to 90506.1
 NEW BI,BJ,BK,BN,BQIUPD,ERROR,IEN,ND,NDATA,TEXT,VAL
 F BI=1:1 S TEXT=$P($T(LYT+BI),";;",2) Q:TEXT=""  D
 . F BJ=1:1:$L(TEXT,"~") D
 .. S NDATA=$P(TEXT,"~",BJ)
 .. S ND=$P(NDATA,"|",1),VAL=$P(NDATA,"|",2)
 .. I ND=0 D
 ... NEW DIC,X,Y
 ... S DIC(0)="LQZ",DIC="^BQI(90506.1,",X=$P(VAL,U,1)
 ... D ^DIC
 ... S IEN=+Y
 ... I IEN=-1 K DO,DD D FILE^DICN S IEN=+Y
 .. I ND=1 S BQIUPD(90506.1,IEN_",",1)=VAL Q
 .. F BK=1:1:$L(VAL,"^") D
 ... S BN=$O(^DD(90506.1,"GL",ND,BK,"")) I BN="" Q
 ... I $P(VAL,"^",BK)'="" S BQIUPD(90506.1,IEN_",",BN)=$P(VAL,"^",BK) Q
 ... I $P(VAL,"^",BK)="" S BQIUPD(90506.1,IEN_",",BN)="@"
 . D FILE^DIE("","BQIUPD","ERROR")
 ;
 ; Re-Index File
 K ^BQI(90506.1,"AC"),^BQI(90506.1,"AD")
 NEW DIK
 S DIK="^BQI(90506.1,",DIK(1)=3.01
 D ENALL^DIK
 ;
 ; Update IPC measures
 D ^BQI23PU
 ;
 ; Fix Template Pointer Issues
 D FIX()
 ;
 ;Regenerate Panel Descriptions
 D PDESC()
 ;
 ;Make Reproductive Factors Definition fields Active/Inactive
 D UVDEF^BQIPTRP1()
 ;
IP ; Fix Outcome Bundle update
 I $D(^BQI(90508,1,22,1,3,"B",3120200)) D
 . D DM^BQIIPOTC(1,32,3120200,"IPC_DMCTRL","")
 . D LD^BQIIPOTC(1,57,3120200,"IPC_LDCTRL","")
 . D BP^BQIIPOTC(1,58,3120200,"IPC_BPCTRL","")
 . D EN^BQIIPOTC(3120200)
 . D GS(3120200)
 ;
 I $D(^BQI(90508,1,22,1,3,"B",3120300)) D
 . D DM^BQIIPOTC(1,32,3120300,"IPC_DMCTRL","")
 . D LD^BQIIPOTC(1,57,3120300,"IPC_LDCTRL","")
 . D BP^BQIIPOTC(1,58,3120300,"IPC_BPCTRL","")
 . D EN^BQIIPOTC(3120300)
 . D GS(3120300)
 ;
MU ; Run MU Provider data for first Monthly periods
 ; Clean up old data
 S PRV=0 F  S PRV=$O(^BQIPROV(PRV)) Q:'PRV  K ^BQIPROV(PRV,11),^BQIPROV(PRV,21),^BQIPROV(PRV,60),^BQIPROV(PRV,50)
 S FAC=$O(^BQIFAC(0)) I FAC'="" K ^BQIFAC(FAC,11),^BQIFAC(FAC,21),^BQIFAC(FAC,60),^BQIFAC(FAC,50)
 ;
 D
 . NEW BQDT,FAC,BQTMN,BQNO,CDTM
 . S BQDT=$E(DT,1,5)_"00"
 . S FAC=$$HME^BQIGPUTL()
 . S BQTMN=$O(^BQIFAC(FAC,50,"B",BQDT,""))
 . D CKM
 . I BQTMN="",'BQNO D EN^BQIMUMON($E(DT,1,5)_"01")
 . I BQTMN="",BQNO S ^XTMP("BQIMMON",$E(DT,1,5)_"01")=""
 . S ^XTMP("BQIMMON",0)=$$FMADD^XLFDT(DT,365)_U_DT_U_"Month list"
 . S CDTM=$E(DT,4,5)
 . F BI=7:1:12 S ^XTMP("BQIMMON","311"_$S(BI<10:"0"_BI,1:BI)_"01")=""
 . I $E(DT,1,3)>311 F BI=1:1:CDTM S ^XTMP("BQIMMON","312"_$S(BI<10:"0"_BI,1:BI)_"01")=""
 ;
RSC ; Remove the scheduled tasks
 NEW RPC,OPTN,OPN,LIST,ZTSK
 F RPC="BQI UPDATE MU CQM 1 YEAR","BQI UPDATE MU CQM 90 DAYS" D
 . S OPTN=$$FIND^BQISCHED(RPC)
 . I OPTN'>0 Q
 . S OPN=$O(^DIC(19.2,"B",OPTN,""))
 . I OPN'="" D
 .. NEW DA,DIK
 .. S DIK="^DIC(19.2,",DA=OPN D ^DIK
 . NEW DA,DIK
 . S DA=OPTN,DIK="^DIC(19," D ^DIK
 . K LIST
 . D OPTION^%ZTLOAD(RPC,.LIST)
 . S ZTSK=""
 . F  S ZTSK=$O(@LIST@(ZTSK)) Q:ZTSK=""  D
 .. D PCLEAR^%ZTLOAD(ZTSK)
 .. D KILL^%ZTLOAD
 Q
 ;
GS(BQDATE)  ; Update the Goal Set
 NEW TPRN,PRV,TPRD,GPRN,GPRD,DEN,FAC,YEAR
 S PRV="",YEAR=$$GET1^DIQ(90508,1_",",2,"E")
 F  S PRV=$O(^AUPNPAT("AK",PRV)) Q:PRV=""  D
 . S TPRN=$O(^BQIPROV(PRV,30,"B","IPC_TOTP","")) I TPRN="" Q
 . S TPRD=$O(^BQIPROV(PRV,30,TPRN,1,"B",BQDATE,"")) I TPRD="" Q
 . S GPRN=$O(^BQIPROV(PRV,30,"B",YEAR_"_2452","")) I GPRN="" Q
 . S GPRD=$O(^BQIPROV(PRV,30,GPRN,1,"B",BQDATE,"")) I GPRD="" Q
 . S DEN=$P(^BQIPROV(PRV,30,TPRN,1,TPRD,0),U,2)
 . S $P(^BQIPROV(PRV,30,GPRN,1,GPRD,0),U,2)=DEN
 S FAC=$$HME^BQIGPUTL()
 S TPRN=$O(^BQIFAC(FAC,30,"B","IPC_TOTP","")) I TPRN="" Q
 S TPRD=$O(^BQIFAC(FAC,30,TPRN,1,"B",BQDATE,"")) I TPRD="" Q
 S GPRN=$O(^BQIFAC(FAC,30,"B",YEAR_"_2452","")) I GPRN="" Q
 S GPRD=$O(^BQIFAC(FAC,30,GPRN,1,"B",BQDATE,"")) I GPRD="" Q
 S DEN=$P(^BQIFAC(FAC,30,TPRN,1,TPRD,0),U,2)
 S $P(^BQIFAC(FAC,30,GPRN,1,GPRD,0),U,2)=DEN
 Q
 ;
PDESC() ;EP - Regenerate Panel Descriptions
 NEW USER,PLIEN
 S USER=0 F  S USER=$O(^BQICARE(USER)) Q:'USER  D
 . S PLIEN=0 F  S PLIEN=$O(^BQICARE(USER,1,PLIEN)) Q:'PLIEN  D
 .. NEW DESC,DA,IENS
 .. S DA(1)=USER,DA=PLIEN,IENS=$$IENS^DILF(.DA)
 .. D DESC^BQIPDSCM(USER,PLIEN,.DESC)
 .. D WP^DIE(90505.01,IENS,5,"","DESC")
 Q
 ;
FIX() ;EP - FIX INVALID TEMPLATE POINTERS
 ;
 NEW USER,PLIEN,TIEN,SHR
 S USER=0 F  S USER=$O(^BQICARE(USER)) Q:'USER  D
 . S PLIEN=0 F  S PLIEN=$O(^BQICARE(USER,1,PLIEN)) Q:'PLIEN  D
 .. S TIEN=0 F  S TIEN=$O(^BQICARE(USER,1,PLIEN,4,TIEN)) Q:'TIEN  D
 ... NEW DA,IENS,TEMPL,DIC,X,Y,DIK
 ... S DA(2)=USER,DA(1)=PLIEN,DA=TIEN,IENS=$$IENS^DILF(.DA)
 ... S TEMPL=$$GET1^DIQ(90505.14,IENS,.01,"I")
 ... S X=TEMPL,DIC="^BQICARE("_USER_",15,",DIC(0)="X"
 ... D ^DIC
 ... I +Y>0 Q
 ... S DIK="^BQICARE("_DA(2)_",1,"_DA(1)_",4,"
 ... D ^DIK
 .. ;
 .. ;Look for templates in use in shared panels
 .. S SHR=0 F  S SHR=$O(^BQICARE(USER,1,PLIEN,30,SHR)) Q:'SHR  D
 ... S TIEN=0 F  S TIEN=$O(^BQICARE(USER,1,PLIEN,30,SHR,4,TIEN)) Q:'TIEN  D
 .... NEW DA,IENS,TEMPL,DIC,X,Y,DIK
 .... S DA(3)=USER,DA(2)=PLIEN,DA(1)=SHR,DA=TIEN,IENS=$$IENS^DILF(.DA)
 .... S TEMPL=$$GET1^DIQ(90505.34,IENS,.01,"I")
 .... S X=TEMPL,DIC="^BQICARE("_USER_",15,",DIC(0)="X"
 .... D ^DIC
 .... I +Y>0 Q
 .... S DIK="^BQICARE("_DA(3)_",1,"_DA(2)_",30,"_DA(1)_",4,"
 .... D ^DIK
 ;
 Q
 ;
CKM ;EP - Check for existing job
 NEW LIST,TSK,ZTSK
 D DESC^%ZTLOAD("MU CQ Monthly Compile",.LIST)
 S TSK="",BQNO=0
 F  S TSK=$O(@LIST@(TSK)) Q:TSK=""  S ZTSK=TSK D STAT^%ZTLOAD I ZTSK(2)["Active" S BQNO=1
 Q
 ;
LYT ;EP - Layout items
 ;;0|EMPL^^Employer^^9000001^.19^^T00060EMPL~1|~3|1^^Other Patient Data^O^42^^^^^BQIZEMPHLTH~5|
 ;;0|LVDPCP^^Last Visit Date w DPCP^^^^^D00030LVDPCP~1|S VAL=$$LVDPCP^BQIULPT(DFN)~3|1^^Visit Related^O^16^^^D~5|
 ;;