BGP8PCUT ; IHS/CMI/LAB - ;
;;18.1;IHS CLINICAL REPORTING;;MAY 25, 2018;Build 66
;
;
;utility calls
;
STMP ;EP
Q:BGPTIME'=1
I BGPLIST="P",$P(^AUPNPAT(DFN,0),U,14)'=BGPLPRV Q
X ^BGPIPCMR(BGPIC,2) Q:'$T
S BGPLIST(BGPIC)=$G(BGPLIST(BGPIC))+1
S ^XTMP("BGP8D",BGPJ,BGPH,"LIST",BGPIC,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEB,DFN)=BGPVALUE
Q
D(D) ;EP
I D="" Q ""
Q (1700+$E(D,1,3))_$E(D,4,5)_$E(D,6,7)_$S($P(D,".",2)]"":$P(D,".",2),1:"")
JRNL ;EP
N (DT,U,ZTQUEUED) S %=$$NOJOURN^ZIBGCHAR("BGPGPDCR"),%=$$NOJOURN^ZIBGCHAR("BGPGPDPR"),%=$$NOJOURN^ZIBGCHAR("BGPGPDBR")
Q
DATE(D) ;EP
I D="" Q ""
Q $E(D,4,5)_"/"_$E(D,6,7)_"/"_$E(D,2,3)
;
REPORT ;EP - CREATE REPORT ENTRIES IN DATA FILES
S BGPRPT=""
W !!
;CREATE REPORT ENTRY IN FILEMAN FILE
;3 files must have the same ien
L +^BGPGPDCR:30 I '$T W !!,"Unable to lock global, try later." G REPORTX
L +^BGPGPDPR:30 I '$T W !!,"Unable to lock global, try later." G REPORTX
L +^BGPGPDBR:30 I '$T W !!,"Unable to lock global, try later." G REPORTX
D GETIEN
I 'BGPIEN W !!,"Something wrong with control files, notify programmer!" S BGPRPT="" G REPORTX
S DINUM=BGPIEN
K DIC S X=BGPBD,DIC(0)="L",DIC="^BGPGPDCR(",DLAYGO=90561.09,DIADD=1,DIC("DR")=".02////"_BGPED_";.03////"_BGPPBD_";.04////"_BGPPED_";.05////"_BGPBBD_";.06////"_BGPBED_";.07////"_$G(BGPPER)_";.08////"_$G(BGPQTR)
S DIC("DR")=DIC("DR")_";.09////"_$P(^AUTTLOC(DUZ(2),0),U,10)_";.11////"_$E($P(^AUTTLOC(DUZ(2),0),U,10),1,4)_";.12////"_BGPRTYPE_";.13////"_DT_";.14////"_BGPBEN_";.15////"_$P($G(^AUTTLOC(DUZ(2),1)),U,3)
S DIC("DR")=DIC("DR")_";.17///"_$P(^BGPSITE(DUZ(2),0),U,6)_";.18///"_$S($G(BGPTAXI):$P(^ATXAX(BGPTAXI,0),U),1:"")_";.19///"_$P(^BGPSITE(DUZ(2),0),U,13)
D ^DIC K DIC,DA,DR,DIADD,DLAYGO I Y=-1 W !!,"UNABLE TO CREATE REPORT FILE ENTRY - NOTIFY SITE MANAGER!" S BGPQUIT=1 G REPORTX
S BGPRPT=+Y
K DIC S X=BGPBD,DIC(0)="L",DIC="^BGPGPDPR(",DLAYGO=90561.1,DIADD=1,DIC("DR")=".02////"_BGPED_";.03////"_BGPPBD_";.04////"_BGPPED_";.05////"_BGPBBD_";.06////"_BGPBED_";.07////"_$G(BGPPER)_";.08////"_$G(BGPQTR)
S DIC("DR")=DIC("DR")_";.09////"_$P(^AUTTLOC(DUZ(2),0),U,10)_";.11////"_$E($P(^AUTTLOC(DUZ(2),0),U,10),1,4)_";.12////"_BGPRTYPE_";.13////"_DT_";.14////"_BGPBEN_";.15////"_$P($G(^AUTTLOC(DUZ(2),1)),U,3)
S DIC("DR")=DIC("DR")_";.17///"_$P(^BGPSITE(DUZ(2),0),U,6)_";.18///"_$S($G(BGPTAXI):$P(^ATXAX(BGPTAXI,0),U),1:"")_";.19///"_$P(^BGPSITE(DUZ(2),0),U,13)
S DINUM=BGPRPT D ^DIC K DIC,DA,DR,DIADD,DLAYGO,DINUM I Y=-1 W !!,"UNABLE TO CREATE REPORT FILE ENTRY - NOTIFY SITE MANAGER!" S BGPQUIT=1 G REPORTX
S BGPRPTP=+Y
K DIC S X=BGPBD,DIC(0)="L",DIC="^BGPGPDBR(",DLAYGO=90561.11,DIADD=1,DIC("DR")=".02////"_BGPED_";.03////"_BGPPBD_";.04////"_BGPPED_";.05////"_BGPBBD_";.06////"_BGPBED_";.07////"_$G(BGPPER)_";.08////"_$G(BGPQTR)
S DIC("DR")=DIC("DR")_";.09////"_$P(^AUTTLOC(DUZ(2),0),U,10)_";.11////"_$E($P(^AUTTLOC(DUZ(2),0),U,10),1,4)_";.12////"_BGPRTYPE_";.13////"_DT_";.14////"_BGPBEN_";.15////"_$P($G(^AUTTLOC(DUZ(2),1)),U,3)
S DIC("DR")=DIC("DR")_";.17///"_$P(^BGPSITE(DUZ(2),0),U,6)_";.18///"_$S($G(BGPTAXI):$P(^ATXAX(BGPTAXI,0),U),1:"")_";.19///"_$P(^BGPSITE(DUZ(2),0),U,13)
S DINUM=BGPRPT D ^DIC K DIC,DA,DR,DIADD,DLAYGO I Y=-1 W !!,"UNABLE TO CREATE REPORT FILE ENTRY - NOTIFY SITE MANAGER!" S BGPQUIT=1 G REPORTX
S BGPRPTB=+Y
;add communities to 28 multiple
K ^BGPGPDCR(BGPRPT,9999)
S C=0,X="" F S X=$O(BGPTAX(X)) Q:X="" S C=C+1 S ^BGPGPDCR(BGPRPT,9999,C,0)=X,^BGPGPDCR(BGPRPT,9999,"B",X,C)=""
S ^BGPGPDCR(BGPRPT,9999,0)="^90561.18999A^"_C_"^"_C
S ^BGPGPDCR(BGPRPT,1111,0)="^90561.091111^"_C_"^"_C
S ^BGPGPDCR(BGPRPT,99999,0)="^90561.189999A^0^0"
S ^BGPGPDPR(BGPRPT,99999,0)="^90561.139999A^0^0"
S ^BGPGPDBR(BGPRPT,99999,0)="^90561.149999A^0^0"
REPORTX ;
D ^XBFMK
K DIC,DIADD,DLAYGO,DR,DA,DD,X,Y,DINUM
L -^BGPGPDCR
L -^BGPGPDPR
L -^BGPGPDBR
Q
GETIEN ;EP -Get next ien available in all 3 files
S BGPF=90561.09 D ENT
S BGPF=90561.1 D ENT
S BGPF=90561.11 D ENT
S BGPIEN=$P(^BGPGPDCR(0),U,3)+1
S I $D(^BGPGPDPR(BGPIEN))!($D(^BGPGPDBR(BGPIEN))) S BGPIEN=BGPIEN+1 G S
Q
;
ENT ;
NEW GBL,NXT,CTR,XBHI,XBX,XBY,ANS
S GBL=^DIC(BGPF,0,"GL")
S GBL=GBL_"NXT)"
S (XBHI,NXT,CTR)=0
F L=0:0 S NXT=$O(@(GBL)) Q:NXT'=+NXT S XBHI=NXT,CTR=CTR+1 ;W:'(CTR#50) "."
S NXT="",XBX=$O(@(GBL)),XBX=^(0),XBY=$P(XBX,U,4),XBX=$P(XBX,U,3)
S NXT=0,$P(@(GBL),U,3)=XBHI,$P(^(0),U,4)=CTR
;
EOJ ;
KILL ANS,XBHI,XBX,XBY,CTR,DIC,FILE,GBL,L,NXT,BGPF
Q
;
BGP8PCUT ; IHS/CMI/LAB - ;
+1 ;;18.1;IHS CLINICAL REPORTING;;MAY 25, 2018;Build 66
+2 ;
+3 ;
+4 ;utility calls
+5 ;
STMP ;EP
+1 IF BGPTIME'=1
QUIT
+2 IF BGPLIST="P"
IF $PIECE(^AUPNPAT(DFN,0),U,14)'=BGPLPRV
QUIT
+3 XECUTE ^BGPIPCMR(BGPIC,2)
IF '$TEST
QUIT
+4 SET BGPLIST(BGPIC)=$GET(BGPLIST(BGPIC))+1
+5 SET ^XTMP("BGP8D",BGPJ,BGPH,"LIST",BGPIC,$SELECT($PIECE($GET(^AUPNPAT(DFN,11)),U,18)]"":$PIECE(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$PIECE(^DPT(DFN,0),U,2),BGPAGEB,DFN)=BGPVALUE
+6 QUIT
D(D) ;EP
+1 IF D=""
QUIT ""
+2 QUIT (1700+$EXTRACT(D,1,3))_$EXTRACT(D,4,5)_$EXTRACT(D,6,7)_$SELECT($PIECE(D,".",2)]"":$PIECE(D,".",2),1:"")
JRNL ;EP
+1 NEW (DT,U,ZTQUEUED)
SET %=$$NOJOURN^ZIBGCHAR("BGPGPDCR")
SET %=$$NOJOURN^ZIBGCHAR("BGPGPDPR")
SET %=$$NOJOURN^ZIBGCHAR("BGPGPDBR")
+2 QUIT
DATE(D) ;EP
+1 IF D=""
QUIT ""
+2 QUIT $EXTRACT(D,4,5)_"/"_$EXTRACT(D,6,7)_"/"_$EXTRACT(D,2,3)
+3 ;
REPORT ;EP - CREATE REPORT ENTRIES IN DATA FILES
+1 SET BGPRPT=""
+2 WRITE !!
+3 ;CREATE REPORT ENTRY IN FILEMAN FILE
+4 ;3 files must have the same ien
+5 LOCK +^BGPGPDCR:30
IF '$TEST
WRITE !!,"Unable to lock global, try later."
GOTO REPORTX
+6 LOCK +^BGPGPDPR:30
IF '$TEST
WRITE !!,"Unable to lock global, try later."
GOTO REPORTX
+7 LOCK +^BGPGPDBR:30
IF '$TEST
WRITE !!,"Unable to lock global, try later."
GOTO REPORTX
+8 DO GETIEN
+9 IF 'BGPIEN
WRITE !!,"Something wrong with control files, notify programmer!"
SET BGPRPT=""
GOTO REPORTX
+10 SET DINUM=BGPIEN
+11 KILL DIC
SET X=BGPBD
SET DIC(0)="L"
SET DIC="^BGPGPDCR("
SET DLAYGO=90561.09
SET DIADD=1
SET DIC("DR")=".02////"_BGPED_";.03////"_BGPPBD_";.04////"_BGPPED_";.05////"_BGPBBD_";.06////"_BGPBED_";.07////"_$GET(BGPPER)_";.08////"_$GET(BGPQTR)
+12 SET DIC("DR")=DIC("DR")_";.09////"_$PIECE(^AUTTLOC(DUZ(2),0),U,10)_";.11////"_$EXTRACT($PIECE(^AUTTLOC(DUZ(2),0),U,10),1,4)_";.12////"_BGPRTYPE_";.13////"_DT_";.14////"_BGPBEN_";.15////"_$PIECE($GET(^AUTTLOC(DUZ(2),1)),U,3)
+13 SET DIC("DR")=DIC("DR")_";.17///"_$PIECE(^BGPSITE(DUZ(2),0),U,6)_";.18///"_$SELECT($GET(BGPTAXI):$PIECE(^ATXAX(BGPTAXI,0),U),1:"")_";.19///"_$PIECE(^BGPSITE(DUZ(2),0),U,13)
+14 DO ^DIC
KILL DIC,DA,DR,DIADD,DLAYGO
IF Y=-1
WRITE !!,"UNABLE TO CREATE REPORT FILE ENTRY - NOTIFY SITE MANAGER!"
SET BGPQUIT=1
GOTO REPORTX
+15 SET BGPRPT=+Y
+16 KILL DIC
SET X=BGPBD
SET DIC(0)="L"
SET DIC="^BGPGPDPR("
SET DLAYGO=90561.1
SET DIADD=1
SET DIC("DR")=".02////"_BGPED_";.03////"_BGPPBD_";.04////"_BGPPED_";.05////"_BGPBBD_";.06////"_BGPBED_";.07////"_$GET(BGPPER)_";.08////"_$GET(BGPQTR)
+17 SET DIC("DR")=DIC("DR")_";.09////"_$PIECE(^AUTTLOC(DUZ(2),0),U,10)_";.11////"_$EXTRACT($PIECE(^AUTTLOC(DUZ(2),0),U,10),1,4)_";.12////"_BGPRTYPE_";.13////"_DT_";.14////"_BGPBEN_";.15////"_$PIECE($GET(^AUTTLOC(DUZ(2),1)),U,3)
+18 SET DIC("DR")=DIC("DR")_";.17///"_$PIECE(^BGPSITE(DUZ(2),0),U,6)_";.18///"_$SELECT($GET(BGPTAXI):$PIECE(^ATXAX(BGPTAXI,0),U),1:"")_";.19///"_$PIECE(^BGPSITE(DUZ(2),0),U,13)
+19 SET DINUM=BGPRPT
DO ^DIC
KILL DIC,DA,DR,DIADD,DLAYGO,DINUM
IF Y=-1
WRITE !!,"UNABLE TO CREATE REPORT FILE ENTRY - NOTIFY SITE MANAGER!"
SET BGPQUIT=1
GOTO REPORTX
+20 SET BGPRPTP=+Y
+21 KILL DIC
SET X=BGPBD
SET DIC(0)="L"
SET DIC="^BGPGPDBR("
SET DLAYGO=90561.11
SET DIADD=1
SET DIC("DR")=".02////"_BGPED_";.03////"_BGPPBD_";.04////"_BGPPED_";.05////"_BGPBBD_";.06////"_BGPBED_";.07////"_$GET(BGPPER)_";.08////"_$GET(BGPQTR)
+22 SET DIC("DR")=DIC("DR")_";.09////"_$PIECE(^AUTTLOC(DUZ(2),0),U,10)_";.11////"_$EXTRACT($PIECE(^AUTTLOC(DUZ(2),0),U,10),1,4)_";.12////"_BGPRTYPE_";.13////"_DT_";.14////"_BGPBEN_";.15////"_$PIECE($GET(^AUTTLOC(DUZ(2),1)),U,3)
+23 SET DIC("DR")=DIC("DR")_";.17///"_$PIECE(^BGPSITE(DUZ(2),0),U,6)_";.18///"_$SELECT($GET(BGPTAXI):$PIECE(^ATXAX(BGPTAXI,0),U),1:"")_";.19///"_$PIECE(^BGPSITE(DUZ(2),0),U,13)
+24 SET DINUM=BGPRPT
DO ^DIC
KILL DIC,DA,DR,DIADD,DLAYGO
IF Y=-1
WRITE !!,"UNABLE TO CREATE REPORT FILE ENTRY - NOTIFY SITE MANAGER!"
SET BGPQUIT=1
GOTO REPORTX
+25 SET BGPRPTB=+Y
+26 ;add communities to 28 multiple
+27 KILL ^BGPGPDCR(BGPRPT,9999)
+28 SET C=0
SET X=""
FOR
SET X=$ORDER(BGPTAX(X))
IF X=""
QUIT
SET C=C+1
SET ^BGPGPDCR(BGPRPT,9999,C,0)=X
SET ^BGPGPDCR(BGPRPT,9999,"B",X,C)=""
+29 SET ^BGPGPDCR(BGPRPT,9999,0)="^90561.18999A^"_C_"^"_C
+30 SET ^BGPGPDCR(BGPRPT,1111,0)="^90561.091111^"_C_"^"_C
+31 SET ^BGPGPDCR(BGPRPT,99999,0)="^90561.189999A^0^0"
+32 SET ^BGPGPDPR(BGPRPT,99999,0)="^90561.139999A^0^0"
+33 SET ^BGPGPDBR(BGPRPT,99999,0)="^90561.149999A^0^0"
REPORTX ;
+1 DO ^XBFMK
+2 KILL DIC,DIADD,DLAYGO,DR,DA,DD,X,Y,DINUM
+3 LOCK -^BGPGPDCR
+4 LOCK -^BGPGPDPR
+5 LOCK -^BGPGPDBR
+6 QUIT
GETIEN ;EP -Get next ien available in all 3 files
+1 SET BGPF=90561.09
DO ENT
+2 SET BGPF=90561.1
DO ENT
+3 SET BGPF=90561.11
DO ENT
+4 SET BGPIEN=$PIECE(^BGPGPDCR(0),U,3)+1
S IF $DATA(^BGPGPDPR(BGPIEN))!($DATA(^BGPGPDBR(BGPIEN)))
SET BGPIEN=BGPIEN+1
GOTO S
+1 QUIT
+2 ;
ENT ;
+1 NEW GBL,NXT,CTR,XBHI,XBX,XBY,ANS
+2 SET GBL=^DIC(BGPF,0,"GL")
+3 SET GBL=GBL_"NXT)"
+4 SET (XBHI,NXT,CTR)=0
+5 ;W:'(CTR#50) "."
FOR L=0:0
SET NXT=$ORDER(@(GBL))
IF NXT'=+NXT
QUIT
SET XBHI=NXT
SET CTR=CTR+1
+6 SET NXT=""
SET XBX=$ORDER(@(GBL))
SET XBX=^(0)
SET XBY=$PIECE(XBX,U,4)
SET XBX=$PIECE(XBX,U,3)
+7 SET NXT=0
SET $PIECE(@(GBL),U,3)=XBHI
SET $PIECE(^(0),U,4)=CTR
+8 ;
EOJ ;
+1 KILL ANS,XBHI,XBX,XBY,CTR,DIC,FILE,GBL,L,NXT,BGPF
+2 QUIT
+3 ;