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

BQIMUUPD.m

Go to the documentation of this file.
BQIMUUPD ;GDIT/HS/ALA-Update MU Performance version ; 01 Mar 2013  3:34 PM
 ;;2.3;ICARE MANAGEMENT SYSTEM;**3,4**;Apr 18, 2012;Build 66
 ;
EN ;EP
 I '$$PATCH^XPDUTL("APCM*1.0*2") Q
 NEW CURR
 S CURR=$P($G(^BQI(90508,1,9)),U,3)
 I CURR="" D
 . S CURR="INTERIM STAGE 1 2013"
 . I '$D(^APCMMUCN("B",CURR)) Q
 . D UP
 . I $P($G(^BQI(90508,1,9)),U,3)="" S $P(^BQI(90508,1,9),U,3)=CURR
 NEW DIK
 S DIK="^BQIPROV(" D IXALL^DIK
 S DIK="^BQIFAC(" D IXALL^DIK
 Q
 ;
UP ;EP - Facility
 NEW FAC,FN,MN
 S FAC=0
 F  S FAC=$O(^BQIFAC(FAC)) Q:'FAC  D
 . S FN=0
 . F  S FN=$O(^BQIFAC(FAC,40,FN)) Q:'FN  D
 .. S MN=0
 .. F  S MN=$O(^BQIFAC(FAC,40,FN,1,MN)) Q:'MN  D
 ... NEW DA,IENS
 ... S DA(2)=FAC,DA(1)=FN,DA=MN,IENS=$$IENS^DILF(.DA)
 ... I $$GET1^DIQ(90505.641,IENS,.04,"E")="" S BQIUPD(90505.641,IENS,.04)=CURR
 . S FN=0
 . F  S FN=$O(^BQIFAC(FAC,70,FN)) Q:'FN  D
 .. S MN=0
 .. F  S MN=$O(^BQIFAC(FAC,70,FN,1,MN)) Q:'MN  D
 ... NEW DA,IENS
 ... S DA(2)=FAC,DA(1)=FN,DA=MN,IENS=$$IENS^DILF(.DA)
 ... I $$GET1^DIQ(90505.671,IENS,.04,"E")="" S BQIUPD(90505.671,IENS,.04)=CURR
 I $D(BQIUPD) D FILE^DIE("","BQIUPD","ERROR")
 ;
 ;Provider
 NEW PRV,FN,MN
 S PRV=0
 F  S PRV=$O(^BQIPROV(PRV)) Q:'PRV  D
 . S FN=0
 . F  S FN=$O(^BQIPROV(PRV,40,FN)) Q:'FN  D
 .. S MN=0
 .. F  S MN=$O(^BQIPROV(PRV,40,FN,1,MN)) Q:'MN  D
 ... NEW DA,IENS
 ... S DA(2)=PRV,DA(1)=FN,DA=MN,IENS=$$IENS^DILF(.DA)
 ... I $$GET1^DIQ(90505.441,IENS,.04,"E")="" S BQIUPD(90505.441,IENS,.04)=CURR
 I $D(BQIUPD) D FILE^DIE("","BQIUPD","ERROR")
 Q
 ;
SXRF ; Set cross-reference
 I $G(^BQIPROV(DA(2),40,DA(1),0))'="" S ^BQIPROV("AC",X,^BQIPROV(DA(2),40,DA(1),0),DA(2))=""
 Q
 ;
KXRF ; Kill cross-reference
 I $G(^BQIPROV(DA(2),40,DA(1),0))'="" K ^BQIPROV("AC",X,^BQIPROV(DA(2),40,DA(1),0),DA(2))
 Q
 ;
SHRF ; Set hospital cross-reference
 I $G(^BQIFAC(DA(2),40,DA(1),0))'="" S ^BQIFAC("AC",X,^BQIFAC(DA(2),40,DA(1),0),DA(2))=""
 Q
 ;
KHRF ; Kill hospital
 I $G(^BQIFAC(DA(2),40,DA(1),0))'="" K ^BQIFAC("AC",X,^BQIFAC(DA(2),40,DA(1),0),DA(2))
 Q
 ;
P3 ;EP - Patch 3 update CQ data by division
 ; Clean up and reset to zero
 S DV=0
 F  S DV=$O(^BQIFAC(DV)) Q:'DV  D
 . S BQDTMN=0
 . F  S BQDTMN=$O(^BQIFAC(DV,80,BQDTMN)) Q:'BQDTMN  D
 .. S DN=0
 .. F  S DN=$O(^BQIFAC(DV,80,BQDTMN,1,DN)) Q:'DN  D
 ... S $P(^BQIFAC(DV,80,BQDTMN,1,DN,0),U,2)=0,$P(^(0),U,3)=0,$P(^(0),U,4)=0
 ;
 ; Update by provider
 S BGPPROV=0
 F  S BGPPROV=$O(^BQIPROV(BGPPROV)) Q:'BGPPROV  D
 . S BQTMN=0
 . F  S BQTMN=$O(^BQIPROV(BGPPROV,50,BQTMN)) Q:'BQTMN  D
 .. S BQDATE=^BQIPROV(BGPPROV,50,BQTMN,0)
 .. S BQID=0
 .. F  S BQID=$O(^BQIPROV(BGPPROV,50,BQTMN,1,BQID)) Q:'BQID  D
 ... S ID=$P(^BQIPROV(BGPPROV,50,BQTMN,1,BQID,0),U,1),CDEN=$P(^(0),U,2),CNUM=$P(^(0),U,3),CEXC=$P(^(0),U,4)
 ... S DV=0,NODE=80
 ... F  S DV=$O(^VA(200,BGPPROV,2,DV)) Q:'DV  D
 .... I $G(^BQIFAC(DV,0))="" S ^BQIFAC(DV,0)=DV,^BQIFAC("B",DV,DV)=""
 .... S FAC=DV D UPD
 .... S DN=$O(^BQIFAC(DV,NODE,BQDTMN,1,"B",ID,"")) I DN="" S DN=BQID
 .... I $G(^BQIFAC(DV,NODE,BQDTMN,1,DN,0))="" S ^BQIFAC(DV,NODE,BQDTMN,1,DN,0)=ID,^BQIFAC(DV,NODE,BQDTMN,1,"B",ID,DN)=""
 .... S $P(^BQIFAC(DV,NODE,BQDTMN,1,DN,0),U,2)=$P($G(^BQIFAC(DV,NODE,BQDTMN,1,DN,0)),U,2)+$G(CDEN)
 .... S $P(^BQIFAC(DV,NODE,BQDTMN,1,DN,0),U,3)=$P($G(^BQIFAC(DV,NODE,BQDTMN,1,DN,0)),U,3)+$G(CNUM)
 .... S $P(^BQIFAC(DV,NODE,BQDTMN,1,DN,0),U,4)=$P($G(^BQIFAC(DV,NODE,BQDTMN,1,DN,0)),U,4)+$G(CEXC)
 Q
 ;
UPD ;EP
 I $G(^BQIFAC(FAC,80,0))="" S ^BQIFAC(FAC,80,0)="^90505.68D^^"
 ;
 NEW DA,X,IENS,Y,DIC,DLAYGO
 S DA(1)=FAC,DIC="^BQIFAC("_DA(1)_",80,",X=BQDATE,DIC(0)="LNZ",DLAYGO=90505.68,DIC("P")=DLAYGO
 D ^DIC
 S DA=+Y I DA=-1 Q
 S BQDTMN=DA
 Q