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

BQIIPUTL.m

Go to the documentation of this file.
BQIIPUTL ;VNGT/HS/ALA-utility program for IPC ; 05 May 2011  12:55 PM
 ;;2.7;ICARE MANAGEMENT SYSTEM;;Dec 19, 2017;Build 23
 ;
 ;
STORF(FAC,ID,BQDATE,DEN,NUM) ;EP - Store facility data Monthly
 ; Input parameters
 ;   FAC    - Facility IEN
 ;   ID     - Measure ID
 ;   BQDATE - Month and Year date
 ;   DEN    - Denominator value
 ;   NUM    - Numerator value
 ;
 NEW DA,DIC,DLAYGO,MSRN,X
 I '$D(^BQIFAC(FAC,30,0)) S ^BQIFAC(FAC,30,0)="^90505.63^^"
 S DA(1)=FAC,DIC(0)="LMNXZ",DLAYGO=90505.63,X=ID,DIC="^BQIFAC("_DA(1)_",30,"
 D ^DIC I Y=-1 K DO,DD D FILE^DICN
 S MSRN=+Y
 I '$D(^BQIFAC(FAC,30,MSRN,1,0)) S ^BQIFAC(FAC,30,MSRN,1,0)="^90505.631D^^"
 S DA(2)=FAC,DA(1)=MSRN,DIC(0)="LMNZ",DLAYGO=90505.631,X=$S($L(BQDATE)=5:BQDATE_"00",1:BQDATE)
 S DIC="^BQIFAC("_DA(2)_",30,"_DA(1)_",1,"
 D ^DIC I Y=-1 K DO,DD D FILE^DICN
 S DA=+Y
 S $P(^BQIFAC(FAC,30,MSRN,1,DA,0),U,2,3)=DEN_U_NUM
 Q
 ;
STORP(PROV,ID,BQDATE,DEN,NUM) ;EP - Store for provider Monthly
 ;   PROV   - Provider IEN
 ;   ID     - Measure ID
 ;   BQDATE - Month and Year date
 ;   DEN    - Denominator value
 ;   NUM    - Numerator value
 ;
 NEW DA,DIC,MSRN,DLAYGO,X
 I $G(^BQIPROV(PROV,0))="" D NPR(PROV)
 I '$D(^BQIPROV(PROV,30,0)) S ^BQIPROV(PROV,30,0)="^90505.43^^"
 S DA(1)=PROV,DIC(0)="LMNXZ",DLAYGO=90505.43,X=ID,DIC="^BQIPROV("_DA(1)_",30,"
 D ^DIC I Y=-1 K DO,DD D FILE^DICN
 S MSRN=+Y
 I '$D(^BQIPROV(PROV,30,MSRN,1,0)) S ^BQIPROV(PROV,30,MSRN,1,0)="^90505.431D^^"
 S DA(2)=PROV,DA(1)=MSRN,DIC(0)="LMNZ",DLAYGO=90505.431,X=$S($L(BQDATE)=5:BQDATE_"00",1:BQDATE)
 S DIC="^BQIPROV("_DA(2)_",30,"_DA(1)_",1,"
 D ^DIC I Y=-1 K DO,DD D FILE^DICN
 S DA=+Y
 S $P(^BQIPROV(PROV,30,MSRN,1,DA,0),U,2,3)=DEN_U_NUM
 Q
 ;
STORT(TEAM,ID,BQDATE,DEN,NUM) ;EP - Store for team Monthly
 ;   Team   - Team Name
 ;   ID     - Measure ID
 ;   BQDATE - Month and Year date
 ;   DEN    - Denominator value
 ;   NUM    - Numerator value
 ;
 NEW DA,DIC,MSRN,DLAYGO,X,TMN
 S TMN=$O(^BQITEAM("B",TEAM,"")) I TMN="" D NTM(TEAM)
 I '$D(^BQITEAM(TMN,10,0)) S ^BQITEAM(TMN,10,0)="^90505.801^^"
 S DA(1)=TMN,DIC(0)="LMNXZ",DLAYGO=90505.801,X=ID,DIC="^BQITEAM("_DA(1)_",10,"
 D ^DIC I Y=-1 K DO,DD D FILE^DICN
 S MSRN=+Y
 I '$D(^BQITEAM(TMN,10,MSRN,10,0)) S ^BQITEAM(TMN,10,MSRN,10,0)="^90505.802^^"
 S DA(2)=TMN,DA(1)=MSRN,DIC(0)="LMNZ",DLAYGO=90505.802,X=$S($L(BQDATE)=5:BQDATE_"00",1:BQDATE)
 S DIC="^BQITEAM("_DA(2)_",10,"_DA(1)_",10,"
 D ^DIC I Y=-1 K DO,DD D FILE^DICN
 S (DA,WDA)=+Y
 S $P(^BQITEAM(TMN,10,MSRN,10,DA,0),U,2,3)=DEN_U_NUM
 ;
 ;Add Team Members
 I '$D(^BQITEAM(TMN,10,MSRN,10,WDA,30,0)) S ^BQITEAM(TMN,10,MSRN,10,WDA,30,0)="^90505.804P^^"
 S PTMN=$O(^BSDPCT("B",TEAM,"")) I PTMN="" Q
 S TMM="" F  S TMM=$O(^BSDPCT(PTMN,1,"B",TMM)) Q:TMM=""  D
 . NEW DA,DIC,DLAYGO,X
 . S DA(3)=TMN,DA(2)=MSRN,DA(1)=WDA,X=$P(^VA(200,TMM,0),"^",1),DIC(0)="LMNZ",DLAYGO=90505.804
 . S DIC="^BQITEAM("_DA(3)_",10,"_DA(2)_",10,"_DA(1)_",30,"
 . D ^DIC I Y=-1 K DO,DD D FILE^DICN
 . S DA=+Y
 Q
 ;
STORPW(PROV,ID,BQFROM,BQTHRU,DEN,NUM) ;EP - Store for provider Weekly
 ;   PROV   - Provider IEN
 ;   ID     - Measure ID
 ;   BQFROM - Week From Date
 ;   BQTHRU - Week Thru Date
 ;   DEN    - Denominator value
 ;   NUM    - Numerator value
 ;
 NEW DA,DIC,MSRN,DLAYGO,X,BQIUPD
 I $G(^BQIPROV(PROV,0))="" D NPR(PROV)
 I '$D(^BQIPROV(PROV,30,0)) S ^BQIPROV(PROV,30,0)="^90505.43^^"
 S DA(1)=PROV,DIC(0)="LMNXZ",DLAYGO=90505.43,X=ID,DIC="^BQIPROV("_DA(1)_",30,"
 D ^DIC I Y=-1 K DO,DD D FILE^DICN
 S MSRN=+Y
 I '$D(^BQIPROV(PROV,30,MSRN,2,0)) S ^BQIPROV(PROV,30,MSRN,2,0)="^90505.432^^"
 S DA(2)=PROV,DA(1)=MSRN,DIC(0)="LMNZ",DLAYGO=90505.432
 S DA=$O(^BQIPROV(PROV,30,MSRN,2,"AC",BQTHRU,""))
 I DA="" D
 . S X=0,LX=0 F  S X=$O(^BQIPROV(PROV,30,MSRN,2,X)) Q:'X  S LX=X
 . S X=LX+1
 . S DIC="^BQIPROV("_DA(2)_",30,"_DA(1)_",2,"
 . D ^DIC I Y=-1 K DO,DD D FILE^DICN
 . S DA=+Y
 NEW IENS
 S DA(2)=PROV,DA(1)=MSRN,IENS=$$IENS^DILF(.DA)
 S BQIUPD(90505.432,IENS,.02)=DEN
 S BQIUPD(90505.432,IENS,.03)=NUM
 S BQIUPD(90505.432,IENS,.04)=BQFROM
 S BQIUPD(90505.432,IENS,.05)=BQTHRU
 ;S $P(^BQIPROV(PROV,30,MSRN,2,DA,0),U,2,3)=DEN_U_NUM_U_BQFROM_U_BQTHRU
 D FILE^DIE("","BQIUPD","ERROR")
 Q
 ;
STORTW(TEAM,ID,BQFROM,BQTHRU,DEN,NUM) ;EP - Store for team Weekly
 ;   Team   - Team Name
 ;   ID     - Measure ID
 ;   BQFROM - Week From Date
 ;   BQTHRU - Week Thru Date
 ;   DEN    - Denominator value
 ;   NUM    - Numerator value
 ;
 NEW DA,DIC,MSRN,DLAYGO,X,TMN
 S TMN=$O(^BQITEAM("B",TEAM,"")) I TMN="" D NTM(TEAM)
 I '$D(^BQITEAM(TMN,10,0)) S ^BQITEAM(TMN,10,0)="^90505.801^^"
 S DA(1)=TMN,DIC(0)="LMNXZ",DLAYGO=90505.801,X=ID,DIC="^BQITEAM("_DA(1)_",10,"
 D ^DIC I Y=-1 K DO,DD D FILE^DICN
 S MSRN=+Y
 I '$D(^BQITEAM(TMN,10,MSRN,20,0)) S ^BQITEAM(TMN,10,MSRN,20,0)="^90505.803^^"
 S DA(2)=TMN,DA(1)=MSRN,DIC(0)="LMNZ",DLAYGO=90505.803
 S WDA=$O(^BQITEAM(TMN,10,MSRN,20,"AC",BQTHRU,"")),DA=WDA
 I WDA="" D
 . S X=0,LX=0 F  S X=$O(^BQITEAM(TMN,10,MSRN,20,X)) Q:'X  S LX=X
 . S X=LX+1
 . S DIC="^BQITEAM("_DA(2)_",10,"_DA(1)_",20,"
 . D ^DIC I Y=-1 K DO,DD D FILE^DICN
 . S (DA,WDA)=+Y
 ;S $P(^BQITEAM(TMN,10,MSRN,20,DA,0),U,2,3)=DEN_U_NUM_U_BQFROM_U_BQTHRU
 NEW IENS
 S DA(2)=TMN,DA(1)=MSRN,IENS=$$IENS^DILF(.DA)
 S BQIUPD(90505.803,IENS,.02)=DEN
 S BQIUPD(90505.803,IENS,.03)=NUM
 S BQIUPD(90505.803,IENS,.04)=BQFROM
 S BQIUPD(90505.803,IENS,.05)=BQTHRU
 D FILE^DIE("","BQIUPD","ERROR")
 ;
 ;Add Team Members
 I '$D(^BQITEAM(TMN,10,MSRN,20,WDA,30,0)) S ^BQITEAM(TMN,10,MSRN,20,WDA,30,0)="^90505.805P^^"
 S PTMN=$O(^BSDPCT("B",TEAM,"")) I PTMN="" Q
 S TMM="" F  S TMM=$O(^BSDPCT(PTMN,1,"B",TMM)) Q:TMM=""  D
 . NEW DA,DIC,DLAYGO,X
 . S DA(3)=TMN,DA(2)=MSRN,DA(1)=WDA,X=$P(^VA(200,TMM,0),"^",1),DIC(0)="LMNZ",DLAYGO=90505.805
 . S DIC="^BQITEAM("_DA(3)_",10,"_DA(2)_",20,"_DA(1)_",30,"
 . D ^DIC I Y=-1 K DO,DD D FILE^DICN
 . S DA=+Y
 Q
 ;
STORFW(FAC,ID,BQFROM,BQTHRU,DEN,NUM) ;EP - Store facility data Weekly
 ; Input parameters
 ;   FAC    - Facility IEN
 ;   ID     - Measure ID
 ;   BQFROM - Week From Date
 ;   BQTHRU - Week Thru Date
 ;   DEN    - Denominator value
 ;   NUM    - Numerator value
 ;
 NEW DA,DIC,DLAYGO,MSRN,X
 I '$D(^BQIFAC(FAC,30,0)) S ^BQIFAC(FAC,30,0)="^90505.63^^"
 S DA(1)=FAC,DIC(0)="LMNXZ",DLAYGO=90505.63,X=ID,DIC="^BQIFAC("_DA(1)_",30,"
 D ^DIC I Y=-1 K DO,DD D FILE^DICN
 S MSRN=+Y
 I '$D(^BQIFAC(FAC,30,MSRN,2,0)) S ^BQIFAC(FAC,30,MSRN,2,0)="^90505.632^^"
 S DA(2)=FAC,DA(1)=MSRN,DIC(0)="LMNZ",DLAYGO=90505.632
 S DA=$O(^BQIFAC(FAC,30,MSRN,2,"AC",BQTHRU,""))
 I DA="" D
 . S X=0,LX=0 F  S X=$O(^BQIFAC(FAC,30,MSRN,2,X)) Q:'X  S LX=X
 . S X=LX+1
 . S DIC="^BQIFAC("_DA(2)_",30,"_DA(1)_",2,"
 . D ^DIC I Y=-1 K DO,DD D FILE^DICN
 . S DA=+Y
 NEW IENS
 S DA(2)=FAC,DA(1)=MSRN,IENS=$$IENS^DILF(.DA)
 S BQIUPD(90505.632,IENS,.02)=DEN
 S BQIUPD(90505.632,IENS,.03)=NUM
 S BQIUPD(90505.632,IENS,.04)=BQFROM
 S BQIUPD(90505.632,IENS,.05)=BQTHRU
 D FILE^DIE("","BQIUPD","ERROR")
 Q
 ;
NPR(PROV) ; EP - Add a new provider
 NEW DA,DIC,X,DINUM,Y
 S (DINUM,X)=PROV,DIC(0)="L",DIC="^BQIPROV("
 K DO,DD D FILE^DICN
 Q
 ;
NTM(TEAM) ;EP - Add a team
 NEW DA,DIC,X,Y
 S X=TEAM,DIC(0)="L",DIC="^BQITEAM("
 K DO,DD D FILE^DICN
 S TMN=+Y
 Q
 ;
VIEW(DATA,FAKE) ;EP - BQI GET IPC VIEW
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIIPCV",UID))
 K @DATA
 S II=0
 S @DATA@(II)="T00010VIEW"_$C(30)
 S II=II+1,@DATA@(II)="MONTHLY"_$C(30)
 S II=II+1,@DATA@(II)="WEEKLY"_$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
TBL(DATA,FAKE) ;EP - BQI GET IPC RELEASES
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIIPCR",UID))
 K @DATA
 S II=0
 S @DATA@(II)="T00010CODE"_$C(30)
 S II=II+1,@DATA@(II)="IPC4/IPC5"_$C(30)
 S II=II+1,@DATA@(II)="IPCMH"_$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
CIPC(DATA,FAKE) ;EP - BQI GET IPC VERSION
 NEW IDATA,DATM
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIIPCV",UID))
 K @DATA
 S II=0
 S @DATA@(II)="T00010IPC_VERSION^D00010WHEN^T00035WHO"_$C(30)
 S IDATA=$G(^BQI(90508,1,11))
 S DATM=$$GET1^DIQ(90508,"1,",11.09,"I"),DATM=$$FMTMDY^BQIUL1(DATM)
 S II=II+1,@DATA@(II)=$P(IDATA,"^",1)_"^"_DATM_"^"_$$GET1^DIQ(90508,"1,",11.1,"E")_$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
SIPC(DATA,VERS) ;EP - BQI SAVE IPC VERSION
 NEW II,OK,BQIDA,BQIUPD,CRIPC,MSG,ERROR,SFL
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIIPCS",UID))
 K @DATA
 S II=0,OK=0
 S @DATA@(II)="I00010RESULT^T00080MESSAGE"_$C(30)
 ;
 S CRIPC=$P($G(^BQI(90508,1,11)),U,1),SFL=+$P($G(^BQI(90508,1,11)),U,8)
 I 'SFL S OK=1,MSG=""
 I SFL S OK=0,MSG="Cannot return to the previous version"
 I OK D
 . S BQIDA=$$SPM^BQIGPUTL()
 . S BQIUPD(90508,BQIDA_",",11)=VERS,BQIUPD(90508,BQIDA_",",11.08)=1,BQIUPD(90508,BQIDA_",",11.09)=$$NOW^XLFDT()
 . S BQIUPD(90508,BQIDA_",",11.1)=DUZ
 . D FILE^DIE("","BQIUPD","ERROR")
 . K BQIUPD
 . I $D(ERROR) S MSG=$G(ERROR("DIERR",1,"TEXT",1)),OK=0
 S II=II+1
 I '$D(ERROR) S @DATA@(II)="1^"_MSG_$C(30)
 I 'OK S @DATA@(II)="-1^"_MSG_$C(30)
 ;
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
RESET ;reset IPC version
 S $P(^BQI(90508,1,11),"^",1)="IPC4/IPC5",$P(^(11),"^",8)="",$P(^(11),"^",9)="",$P(^(11),"^",10)=""
 Q
 ;
MON ;EP - Months
 ;;JAN
 ;;FEB
 ;;MAR
 ;;APR
 ;;MAY
 ;;JUN
 ;;JUL
 ;;AUG
 ;;SEP
 ;;OCT
 ;;NOV
 ;;DEC