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

BQIIPCMH.m

Go to the documentation of this file.
  1. BQIIPCMH ;GDIT/HS/ALA-Get IPC Monthly Data Export by Provider ; 11 Oct 2011 4:10 PM
  1. ;;2.7;ICARE MANAGEMENT SYSTEM;**1**;Dec 19, 2017;Build 12
  1. ;
  1. ;
  1. RET(DATA,DATE,PLIST) ;EP -- BQI GET IPC PROV MON EXPORT
  1. NEW UID,II,HDR,C1,C2,C3,C4,NAME,HEAD,HX,PEC,SORT,QFL,PCT,CT,DDATA,CPER,PPER,TIT,BQMON
  1. NEW BN,LIST,FAC
  1. S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
  1. S DATA=$NA(^TMP("BQIMUPROV",UID))
  1. K @DATA
  1. S II=0
  1. NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIIPCM D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
  1. ; If a list of IENs, process them instead of entire panel
  1. I $D(PLIST)>0 D
  1. . I $D(PLIST)>1 D
  1. .. S LIST="",BN=""
  1. .. F S BN=$O(PLIST(BN)) Q:BN="" S LIST=LIST_PLIST(BN)
  1. .. K PLIST S PLIST=LIST
  1. ;
  1. ; Get current IPC
  1. S CRIPC=$P($G(^BQI(90508,1,11)),U,1)
  1. I CRIPC="IPCMH" S CRIPC="IPC4/IPC5"
  1. S CRN=$O(^BQI(90508,1,22,"B",CRIPC,"")) I CRN="" Q
  1. ;
  1. K Z
  1. ;S HDR="T00050PROVIDER^T00050IPC_MEAS^T00030CATEGORY^T00030NUMERATOR^T00030DENOMINATOR"
  1. S HDR="T00050IPC_MEAS^T00030CATEGORY^T00030NUMERATOR^T00030DENOMINATOR"
  1. S @DATA@(II)=HDR_$C(30)
  1. ;
  1. S (C1,C2,C3,C4,CT,PCT)=0
  1. ;S PROV=$G(PROV,"")
  1. F BQI=1:1 S PROV=$P(PLIST,$C(28),BQI) Q:PROV="" D RTE(PROV)
  1. ;I PROV'="" D RTE(PROV) G DONE
  1. ;I PROV="" S PROV=+PROV
  1. ;F S PROV=$O(^BQIPROV(PROV)) Q:'PROV D RTE(PROV)
  1. ;
  1. S ID=""
  1. F S ID=$O(DDATA(ID)) Q:ID="" D
  1. . S FDATA=DDATA(ID)_Z(ID,DATE)_U
  1. . S FDATA=$$TKO^BQIUL1(FDATA,"^")
  1. . S II=II+1,@DATA@(II)=FDATA_$C(30)
  1. ;
  1. DONE ;
  1. S II=II+1,@DATA@(II)=$C(31)
  1. Q
  1. ;
  1. ERR ;
  1. D ^%ZTER
  1. NEW Y,ERRDTM
  1. S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
  1. S BMXSEC="Recording that an error occurred at "_ERRDTM
  1. I $D(II),$D(DATA) S II=II+1,@DATA@(II)=$C(31)
  1. Q
  1. ;
  1. RTE(PRV) ;EP
  1. ;S DDATA=""
  1. ;S PRVR=PRV_$C(28)_$P($G(^VA(200,PRV,0)),U,1)
  1. ;S DDATA=PRVR_U
  1. S CYR=$E(DT,1,3)
  1. S FAC=$$HME^BQIGPUTL()
  1. ;
  1. S ORD=""
  1. F S ORD=$O(^BQI(90508,1,22,CRN,1,"C",ORD)) Q:ORD="" D
  1. . S IDD=""
  1. . F S IDD=$O(^BQI(90508,1,22,CRN,1,"C",ORD,IDD)) Q:IDD="" D
  1. .. S ID=$P(^BQI(90508,1,22,CRN,1,IDD,0),U,1),MEAS=$P(^(0),U,4)
  1. .. I $P(^BQI(90508,1,22,CRN,1,IDD,0),U,7)=1 Q
  1. .. NEW DA,IENS
  1. .. S DA(2)=1,DA(1)=CRN,DA=IDD,IENS=$$IENS^DILF(.DA)
  1. .. S CAT=$$GET1^DIQ(90508.221,IENS,.03,"E")
  1. .. I CAT="" D
  1. ... S CODE=ID
  1. ... S RIEN=$O(^BQI(90506.1,"B",CODE,"")) I RIEN="" Q
  1. ... S CAT=$$GET1^DIQ(90506.1,RIEN_",",3.02,"E")
  1. .. S DDATA(ID)=ID_$C(28)_MEAS_U_CAT_U
  1. .. I ID="IPC_PEMP" D Q
  1. ... S IDN=$O(^BQIFAC(FAC,30,"B",ID,"")) I IDN="" D Q
  1. .... S $P(Z(ID,DATE),U,1)=$P($G(Z(ID,DATE)),U,1)+0
  1. .... S $P(Z(ID,DATE),U,2)=$P($G(Z(ID,DATE)),U,2)+0
  1. ... S MSDN=$O(^BQIFAC(FAC,30,IDN,1,"B",DATE,""))
  1. ... I MSDN="" S $P(Z(ID,DATE),U,1)=$P($G(Z(ID,DATE)),U,1)+0,$P(Z(ID,DATE),U,2)=$P($G(Z(ID,DATE)),U,2)+0 Q
  1. ... S DEN=+$P(^BQIFAC(FAC,30,IDN,1,MSDN,0),U,2),NUM=+$P(^BQIFAC(FAC,30,IDN,1,MSDN,0),U,3)
  1. ... S $P(Z(ID,DATE),U,1)=NUM,$P(Z(ID,DATE),U,2)=DEN
  1. .. S IDN=$O(^BQIPROV(PRV,30,"B",ID,"")) I IDN="" D Q
  1. ... S $P(Z(ID,DATE),U,1)=$P($G(Z(ID,DATE)),U,1)+0
  1. ... S $P(Z(ID,DATE),U,2)=$P($G(Z(ID,DATE)),U,2)+0
  1. .. D
  1. ... S MSDN=$O(^BQIPROV(PRV,30,IDN,1,"B",DATE,""))
  1. ... I MSDN="" S $P(Z(ID,DATE),U,1)=$P($G(Z(ID,DATE)),U,1)+0,$P(Z(ID,DATE),U,2)=$P($G(Z(ID,DATE)),U,2)+0 Q
  1. ... S DEN=+$P(^BQIPROV(PRV,30,IDN,1,MSDN,0),U,2),NUM=+$P(^BQIPROV(PRV,30,IDN,1,MSDN,0),U,3)
  1. ... I ID="IPC_TOTP" D Q
  1. .... ;S Z(ID,DATE)="0^"_DEN
  1. .... S $P(Z(ID,DATE),U,2)=$P($G(Z(ID,DATE)),U,2)+DEN
  1. ... I ID="IPC_REVG" D Q
  1. .... I DEN=0 S $P(Z(ID,DATE),U,1)=$P($G(Z(ID,DATE)),U,1)+0,$P(Z(ID,DATE),U,2)=$P($G(Z(ID,DATE)),U,2)+0 Q
  1. .... I DEN'=0,NUM=0 S $P(Z(ID,DATE),U,1)=$P($G(Z(ID,DATE)),U,1)+0,$P(Z(ID,DATE),U,2)=$P($G(Z(ID,DATE)),U,2)+DEN Q
  1. .... I DEN'=0,NUM'=0 S $P(Z(ID,DATE),U,1)=$P($G(Z(ID,DATE)),U,1)+NUM,$P(Z(ID,DATE),U,2)=$P($G(Z(ID,DATE)),U,2)+DEN Q
  1. ... I DEN=0 S $P(Z(ID,DATE),U,1)=$P($G(Z(ID,DATE)),U,1)+0,$P(Z(ID,DATE),U,2)=$P($G(Z(ID,DATE)),U,2)+0 Q
  1. ... I DEN'=0,NUM=0 S $P(Z(ID,DATE),U,1)=$P($G(Z(ID,DATE)),U,1)+0,$P(Z(ID,DATE),U,2)=$P($G(Z(ID,DATE)),U,2)+DEN Q
  1. ... I NUM'=0 S $P(Z(ID,DATE),U,1)=$P($G(Z(ID,DATE)),U,1)+NUM,$P(Z(ID,DATE),U,2)=$P($G(Z(ID,DATE)),U,2)+DEN
  1. Q