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

BQIIPCMF.m

Go to the documentation of this file.
BQIIPCMF ;GDIT/HCSD/ALA-Monthly File Output ; 16 Mar 2018  7:35 AM
 ;;2.7;ICARE MANAGEMENT SYSTEM;**1**;Dec 19, 2017;Build 12
 ;
PROV ;EP - Provider List
 NEW UID,II,HDR,PRV,PRVR,TEAM,ASUFAC,TRMDT,TMN,TMNM,DBID
 ;S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S UID=$J
 S DATA=$NA(^BQIDATA1(UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIIPCMF D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S HDR="T00010ASUFAC^T000020PROV_ID^T00050PROVIDER^D00015INACTIVE_DATE^T00050TEAM"
 S ASUFAC=$P($G(^AUTTLOC($P(^AUTTSITE(1,0),U),0)),U,10)
 S PRV="" F  S PRV=$O(^AUPNPAT("AK",PRV)) Q:PRV=""  D
 . S PRVR=$P($G(^VA(200,PRV,"NPI")),U,1)
 . I PRVR="" D
 .. S ASUFAC=$P($G(^AUTTLOC($P(^AUTTSITE(1,0),U),0)),U,10)
 .. S DBID=$P($G(^AUTTLOC($P(^AUTTSITE(1,0),U),1)),U,3)
 .. S PRVR=DBID_"_"_PRV
 . S TRMDT=$P($G(^VA(200,PRV,0)),"^",11)
 . S TEAM=""
 . S TMN="" F  S TMN=$O(^BSDPCT("AB",PRV,TMN)) Q:TMN=""  D
 .. S TMNM=$P(^BSDPCT(TMN,0),U,1),TEAM=TEAM_TMNM_"; "
 . S TEAM=$$TKO^BQIUL1(TEAM,"; ")
 . S II=II+1,@DATA@(II)=ASUFAC_U_DBID_U_PRVR_U_$P(^VA(200,PRV,0),"^",1)_U_$$DATE^BQIIPCME(TRMDT)_U_TEAM
 D WRITE("PROV")
 Q
 ;
MEAS ;EP - Measure List
 NEW UID,II,HDR,VER,XVER,CRIPC,CRN
 D EN^BQIVER(.XVER,"BGP")
 S VER=$P(@XVER@(2),U,2)_$S($P(@XVER@(2),U,4)'="":"p"_$P(@XVER@(2),U,4),1:"")
 ;S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S UID=$J
 S DATA=$NA(^BQIDATA1(UID))
 K @DATA
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIIPCMF D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S HDR="T00010ASUFAC^T000020MEAS_ID^T00050MEAS_NAME"
 S ASUFAC=$P($G(^AUTTLOC($P(^AUTTSITE(1,0),U),0)),U,10)
 S DBID=$P($G(^AUTTLOC($P(^AUTTSITE(1,0),U),1)),U,3)
 ; Get current IPC
 S CRIPC=$P($G(^BQI(90508,1,11)),U,1)
 I CRIPC'="IPCMH" S CRIPC="IPCMH"
 S CRN=$O(^BQI(90508,1,22,"B",CRIPC,"")) I CRN="" Q
 ;
 S MN=0 F  S MN=$O(^BQI(90508,1,22,CRN,1,MN)) Q:'MN  D
 . S ID=$P(^BQI(90508,1,22,CRN,1,MN,0),"^",1)
 . S II=II+1,@DATA@(II)=ASUFAC_U_DBID_U_VER_U_ID_U_$P(^BQI(90508,1,22,CRN,1,MN,0),"^",4)
 D WRITE("MEAS")
 Q
 ;
WRITE(NAME) ;EP - Write out to file
 S FLNM=$S('$$PROD^XUPROD():"IPCZ",1:"IPC")_NAME
 S ZTQUEUED=1
 NEW XBGL,XBQ,XBQTO,XBNAR,XBMED,XBFLT,XBUF,XBFN
 S XBMED="F",XBQ="N",XBFLT=1,XBF=UID,XBE=UID
 S XBGL="BQIDATA1"
 S XBNAR="IPC DATA WAREHOUSE EXPORT"
 S ASUFAC=$P($G(^AUTTLOC($P(^AUTTSITE(1,0),U),0)),U,10)  ;asufac for file name
 S XBFN=FLNM_"_"_ASUFAC_"_"_$$FDATE(DT)_".txt"
 S XBS1="DATA WAREHOUSE SEND"
 S XBUF=$P($G(^AUTTSITE(1,1)),"^",2)
 I XBUF="" S XBUF=$P($G(^XTV(8989.3,1,"DEV")),"^",1)
 ;
 D ^XBGSAVE
 K @DATA,ZTQUEUED,FLN,ASUFAC,XBS1,FLNM
 K V,VAL,VISIT,WDA,XBFLG,XBFLG(1),XBPAFN,XBS1,YEAR,YES,ZISHC,ZISHDA1,ZTQUEUED
 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
 ;
FDATE(D) ;
 Q (1700+$E(D,1,3))_$E(D,4,5)_$E(D,6,7)