RGMTHLP ;BIR/CML-MPI/PD HL7 MESSAGE STATUS REPORT ;12/12/00
;;1.0;CLINICAL INFO RESOURCE NETWORK;**21**;30 Apr 99
S QFLG=1
CHK ;
I '$D(^XTMP("RGMT","HL")) D G QUIT
.W !!,$C(7),"The option ""Compile MPI/PD HL7 Data"" must have"
.W !,"run to completion before this report can be printed!"
I '$D(^XTMP("RGMT","HL","@@@@","STOPPED")) D G QUIT
.W !!,$C(7),"The option ""Compile MPI/PD HL7 Data"" is currently running."
.W !,"This report cannot be generated until the compile has run to completion."
.W !!,"Please try again later.",!
W @IOF
I $D(^XTMP("RGMT","HL","@@@@","RANGE")) D
.W !!,"Data has been compiled for ",^XTMP("RGMT","HL","@@@@","RANGE"),"."
.W !,"Use the ""Compile MPI/PD HL7 Data"" option if this range is not sufficient."
;
REP ;Ask for type of report
K DIR,DIRUT,DTOUT,DUOUT
W !!
S DIR(0)="SAM^D:Detailed;S:Summary;"
S DIR("A")="Select TYPE of Report - (D)etailed or (S)ummary: "
D ^DIR K DIR G:$D(DIRUT) QUIT
G:Y="D" ^RGMTHLPD
;
BEGIN ; Produce SUMMARY Report
W !!,"This option allows you to print information found during the ""Compile MPI/PD"
W !,"HL7 Data"" compilation. The report is sorted by RELATED EVENT PROTOCOL, date,"
W !,"transmission type, and status. The total number of messages for each date,"
W !,"transmission type, and status are displayed."
;
ASK1 ;Ask for Date Range
W !!,"Enter date range for data to be included in report."
K DIR,DIRUT,DTOUT,DUOUT
S DIR(0)="DAO^:DT:EPX",DIR("A")="Beginning Date for Report: "
D ^DIR K DIR G:$D(DIRUT) QUIT S RGBDT=Y
S DIR(0)="DAO^"_RGBDT_":DT:EPX"
S DIR("A")="Ending Date for Report: "
D ^DIR K DIR G:$D(DIRUT) QUIT S RGEDT=Y
;
DEV ;
W !!,"The right margin for this report is 80.",!!
S ZTSAVE("RGBDT")="",ZTSAVE("RGEDT")=""
D EN^XUTMDEVQ("START^RGMTHLP","MPI/PD - Print HL7 Message Status (SUMMARY)") I 'POP Q
W !,"NO DEVICE SELECTED OR REPORT PRINTED!!"
G QUIT
;
START ;Print report
S (PG,QFLG)=0,U="^",$P(LN,"-",81)="",SITE=$P($$SITE^VASITE(),U,2)
S PRGBDT=$$FMTE^XLFDT(RGBDT),PRGEDT=$$FMTE^XLFDT(RGEDT)
D NOW^%DTC S HDT=$$FMTE^XLFDT($E(%,1,12))
D HDR
S STOPDT=RGEDT_".9"
S REPNM="@@@@"
F S REPNM=$O(^XTMP("RGMT","HL",REPNM)) Q:REPNM="" Q:QFLG D
.D:$Y+3>IOSL HDR Q:QFLG
.W !!,REPNM,":" D
..S RGDT=RGBDT-.1
..F S RGDT=$O(^XTMP("RGMT","HL",REPNM,RGDT)) Q:'RGDT Q:RGDT>STOPDT Q:QFLG D
...D:$Y+4>IOSL HDR Q:QFLG
...W !!?4,$$FMTE^XLFDT(RGDT) D
....S TYPE="",TYPECNT=0
....F S TYPE=$O(^XTMP("RGMT","HL",REPNM,RGDT,TYPE)) Q:TYPE="" Q:QFLG D
.....S TYPECNT=TYPECNT+1
.....W:TYPE="O"&(TYPECNT>1) !
.....W ?25,$S(TYPE="O":"OUTGOING",1:"INCOMING") S TOTCNT=0 D
......S STATCNT=0,STAT=""
......F S STAT=$O(^XTMP("RGMT","HL",REPNM,RGDT,TYPE,STAT)) Q:STAT="" Q:QFLG D
.......W:STATCNT>0 !
.......S STATCNT=STATCNT+1
.......W ?41,STAT S CNT=0 D W ?69,$J(CNT,6) S TOTCNT=TOTCNT+CNT
........S IEN=0
........F S IEN=$O(^XTMP("RGMT","HL",REPNM,RGDT,TYPE,STAT,IEN)) Q:'IEN Q:QFLG S CNT=CNT+1
......I STATCNT>1 W !?69,"-------",!?59,"TOTAL",?69,$J(TOTCNT,6),!
;
QUIT ;
I $E(IOST)="C"&('QFLG) S DIR(0)="E" D D ^DIR K DIR
.S SS=22-$Y F JJ=1:1:SS W !
K %,CNT,HDT,IEN,IEN0,JJ,LN,MSGID,PG,PRGBDT,PRGEDT,QFLG,REP,REPNM,RGBDT
K RGDT,RGEDT,SITE,SS,STAT,STATCNT,STATNM,STOPDT,TOTCNT,TYPE,TYPECNT,X,Y,ZTSK
W:$E(IOST)'="C" @IOF D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
Q
;
HDR ;HEADER
I $E(IOST)="C" S SS=22-$Y F JJ=1:1:SS W !
I $E(IOST)="C",PG>0 S DIR(0)="E" W ! D ^DIR K DIR I 'Y S QFLG=1 Q
S PG=PG+1 W:$Y!($E(IOST)="C") @IOF
W !,"MPI/PD HL7 MESSAGE STATUS REPORT - SUMMARY (",PRGBDT," to ",PRGEDT,")"
W ?72,"Page: ",PG,!,"Printed at ",SITE," on ",HDT
W !!,"RELATED EVENT PROTOCOL",!?23,"TRANSMISSION",!?4,"DATE",?27,"TYPE"
W ?41,"STATUS",?69,"TOTAL",!,LN
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRGMTHLP 3790 printed Dec 13, 2024@01:42:23 Page 2
RGMTHLP ;BIR/CML-MPI/PD HL7 MESSAGE STATUS REPORT ;12/12/00
+1 ;;1.0;CLINICAL INFO RESOURCE NETWORK;**21**;30 Apr 99
+2 SET QFLG=1
CHK ;
+1 IF '$DATA(^XTMP("RGMT","HL"))
Begin DoDot:1
+2 WRITE !!,$CHAR(7),"The option ""Compile MPI/PD HL7 Data"" must have"
+3 WRITE !,"run to completion before this report can be printed!"
End DoDot:1
GOTO QUIT
+4 IF '$DATA(^XTMP("RGMT","HL","@@@@","STOPPED"))
Begin DoDot:1
+5 WRITE !!,$CHAR(7),"The option ""Compile MPI/PD HL7 Data"" is currently running."
+6 WRITE !,"This report cannot be generated until the compile has run to completion."
+7 WRITE !!,"Please try again later.",!
End DoDot:1
GOTO QUIT
+8 WRITE @IOF
+9 IF $DATA(^XTMP("RGMT","HL","@@@@","RANGE"))
Begin DoDot:1
+10 WRITE !!,"Data has been compiled for ",^XTMP("RGMT","HL","@@@@","RANGE"),"."
+11 WRITE !,"Use the ""Compile MPI/PD HL7 Data"" option if this range is not sufficient."
End DoDot:1
+12 ;
REP ;Ask for type of report
+1 KILL DIR,DIRUT,DTOUT,DUOUT
+2 WRITE !!
+3 SET DIR(0)="SAM^D:Detailed;S:Summary;"
+4 SET DIR("A")="Select TYPE of Report - (D)etailed or (S)ummary: "
+5 DO ^DIR
KILL DIR
if $DATA(DIRUT)
GOTO QUIT
+6 if Y="D"
GOTO ^RGMTHLPD
+7 ;
BEGIN ; Produce SUMMARY Report
+1 WRITE !!,"This option allows you to print information found during the ""Compile MPI/PD"
+2 WRITE !,"HL7 Data"" compilation. The report is sorted by RELATED EVENT PROTOCOL, date,"
+3 WRITE !,"transmission type, and status. The total number of messages for each date,"
+4 WRITE !,"transmission type, and status are displayed."
+5 ;
ASK1 ;Ask for Date Range
+1 WRITE !!,"Enter date range for data to be included in report."
+2 KILL DIR,DIRUT,DTOUT,DUOUT
+3 SET DIR(0)="DAO^:DT:EPX"
SET DIR("A")="Beginning Date for Report: "
+4 DO ^DIR
KILL DIR
if $DATA(DIRUT)
GOTO QUIT
SET RGBDT=Y
+5 SET DIR(0)="DAO^"_RGBDT_":DT:EPX"
+6 SET DIR("A")="Ending Date for Report: "
+7 DO ^DIR
KILL DIR
if $DATA(DIRUT)
GOTO QUIT
SET RGEDT=Y
+8 ;
DEV ;
+1 WRITE !!,"The right margin for this report is 80.",!!
+2 SET ZTSAVE("RGBDT")=""
SET ZTSAVE("RGEDT")=""
+3 DO EN^XUTMDEVQ("START^RGMTHLP","MPI/PD - Print HL7 Message Status (SUMMARY)")
IF 'POP
QUIT
+4 WRITE !,"NO DEVICE SELECTED OR REPORT PRINTED!!"
+5 GOTO QUIT
+6 ;
START ;Print report
+1 SET (PG,QFLG)=0
SET U="^"
SET $PIECE(LN,"-",81)=""
SET SITE=$PIECE($$SITE^VASITE(),U,2)
+2 SET PRGBDT=$$FMTE^XLFDT(RGBDT)
SET PRGEDT=$$FMTE^XLFDT(RGEDT)
+3 DO NOW^%DTC
SET HDT=$$FMTE^XLFDT($EXTRACT(%,1,12))
+4 DO HDR
+5 SET STOPDT=RGEDT_".9"
+6 SET REPNM="@@@@"
+7 FOR
SET REPNM=$ORDER(^XTMP("RGMT","HL",REPNM))
if REPNM=""
QUIT
if QFLG
QUIT
Begin DoDot:1
+8 if $Y+3>IOSL
DO HDR
if QFLG
QUIT
+9 WRITE !!,REPNM,":"
Begin DoDot:2
+10 SET RGDT=RGBDT-.1
+11 FOR
SET RGDT=$ORDER(^XTMP("RGMT","HL",REPNM,RGDT))
if 'RGDT
QUIT
if RGDT>STOPDT
QUIT
if QFLG
QUIT
Begin DoDot:3
+12 if $Y+4>IOSL
DO HDR
if QFLG
QUIT
+13 WRITE !!?4,$$FMTE^XLFDT(RGDT)
Begin DoDot:4
+14 SET TYPE=""
SET TYPECNT=0
+15 FOR
SET TYPE=$ORDER(^XTMP("RGMT","HL",REPNM,RGDT,TYPE))
if TYPE=""
QUIT
if QFLG
QUIT
Begin DoDot:5
+16 SET TYPECNT=TYPECNT+1
+17 if TYPE="O"&(TYPECNT>1)
WRITE !
+18 WRITE ?25,$SELECT(TYPE="O":"OUTGOING",1:"INCOMING")
SET TOTCNT=0
Begin DoDot:6
+19 SET STATCNT=0
SET STAT=""
+20 FOR
SET STAT=$ORDER(^XTMP("RGMT","HL",REPNM,RGDT,TYPE,STAT))
if STAT=""
QUIT
if QFLG
QUIT
Begin DoDot:7
+21 if STATCNT>0
WRITE !
+22 SET STATCNT=STATCNT+1
+23 WRITE ?41,STAT
SET CNT=0
Begin DoDot:8
+24 SET IEN=0
+25 FOR
SET IEN=$ORDER(^XTMP("RGMT","HL",REPNM,RGDT,TYPE,STAT,IEN))
if 'IEN
QUIT
if QFLG
QUIT
SET CNT=CNT+1
End DoDot:8
WRITE ?69,$JUSTIFY(CNT,6)
SET TOTCNT=TOTCNT+CNT
End DoDot:7
+26 IF STATCNT>1
WRITE !?69,"-------",!?59,"TOTAL",?69,$JUSTIFY(TOTCNT,6),!
End DoDot:6
End DoDot:5
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+27 ;
QUIT ;
+1 IF $EXTRACT(IOST)="C"&('QFLG)
SET DIR(0)="E"
Begin DoDot:1
+2 SET SS=22-$Y
FOR JJ=1:1:SS
WRITE !
End DoDot:1
DO ^DIR
KILL DIR
+3 KILL %,CNT,HDT,IEN,IEN0,JJ,LN,MSGID,PG,PRGBDT,PRGEDT,QFLG,REP,REPNM,RGBDT
+4 KILL RGDT,RGEDT,SITE,SS,STAT,STATCNT,STATNM,STOPDT,TOTCNT,TYPE,TYPECNT,X,Y,ZTSK
+5 if $EXTRACT(IOST)'="C"
WRITE @IOF
DO ^%ZISC
if $DATA(ZTQUEUED)
SET ZTREQ="@"
+6 QUIT
+7 ;
HDR ;HEADER
+1 IF $EXTRACT(IOST)="C"
SET SS=22-$Y
FOR JJ=1:1:SS
WRITE !
+2 IF $EXTRACT(IOST)="C"
IF PG>0
SET DIR(0)="E"
WRITE !
DO ^DIR
KILL DIR
IF 'Y
SET QFLG=1
QUIT
+3 SET PG=PG+1
if $Y!($EXTRACT(IOST)="C")
WRITE @IOF
+4 WRITE !,"MPI/PD HL7 MESSAGE STATUS REPORT - SUMMARY (",PRGBDT," to ",PRGEDT,")"
+5 WRITE ?72,"Page: ",PG,!,"Printed at ",SITE," on ",HDT
+6 WRITE !!,"RELATED EVENT PROTOCOL",!?23,"TRANSMISSION",!?4,"DATE",?27,"TYPE"
+7 WRITE ?41,"STATUS",?69,"TOTAL",!,LN
+8 QUIT