LREPIRS2 ;DALOI/CKA - EPI-PRINT LOCAL REPORT/SPREADSHEET ; 5/14/03
;;5.2;LAB SERVICE;**281**;Sep 27, 1994
; Reference to $$SITE^VASITE supported by IA #10112
; Reference to X ^DD("DD") supported by IA #10017
W !?5,"Print Local Report/Spreadsheet Option"
RORS ;REPORT OR SPREADSHEET
S DIR(0)="SO^1:REPORT;2:SPREADSHEET"
S DIR("A")="Which one do you wish to print"
D ^DIR
G:$D(DIRUT) EXIT
S LRREP=Y
K DIR,DIRUT
CHOOSE ;CHOOSE RPT OR SPSHT TO PRINT
S LRLRDTX=1,LRY=1,LRNODE="LREPI"_$S(LRREP=1:"LOCALREP",1:"LOCALSPSHT"),LRNODE1=LRNODE
F S LRNODE=$O(^XTMP(LRNODE)) Q:LRNODE=""!(LRNODE'[LRNODE1) S LRLRDTX=$E(LRNODE,$S(LRREP=1:14,1:16),$S(LRREP=1:28,1:30)) D
.Q:LRLRDTX=""
.I '$D(^XTMP("LREPI"_$S(LRREP=1:"LOCALREP",1:"LOCALSPSHT")_LRLRDTX,"DONE")) Q
.S Y=LRLRDTX X ^DD("DD") S LRLRDT(LRLRDTX)=Y,LRLRDT(LRY)=LRLRDTX
.S LRTITLE=$G(^XTMP("LREPI"_$S(LRREP=1:"LOCALREP",1:"LOCALSPSHT")_LRLRDTX,"TITLE"))
.W !,LRY," ",LRLRDT(LRLRDTX)," ",LRTITLE
.S LRY=LRY+1
S LRY=LRY-1
I LRY=0,'$D(LRTITLE) W !,"No "_$S(LRREP=1:"report ",1:"spreadsheet ")_"is ready for printing." G RORS
S DIR(0)="NO^1:"_LRY
S DIR("A")="Choose the number for the "_$S(LRREP=1:"report",LRREP=2:"spreadsheet")_" you wish to print"
D ^DIR
G:$D(DIRUT) RORS
S LRY=Y,LRLRDT=LRLRDT(LRY)
K DIR,DIRUT
I LRREP=2 D D:'$D(LREND) PRIV D:'$D(LREND) READY D:'$D(LREND) SPSHT G EXIT
.W !!
.W !?5,"This option will print the selected fields."
.W !?5,"You will need to capture this printout in a text document."
.W !?5,"Using a text editor, remove any extraneous lines from the beginning"
.W !?5,"and the end of the file so that only the data to be imported remains."
.W !?5,"Save the edited file. Use this file in the import function of"
.W !?5,"your spreadsheet program."
I LRREP=1 D:'$D(LREND) PRIV D:'$D(LREND) REP G EXIT
W !!
EXIT ;
D ^%ZISC
K D0,LRAUTO,LRBEG,LRDT,LREND,LRRNDT,LREPI,LRRPE,LRRPS,ZTSAVE
K ZTRTN,ZTIO,ZTDESC,ZTDTH,ZTSK,X,Y,X1,%DT,POP,%ZIS
K LRLC,LRHDG,LRQUIT,LRHDGLC,LRPAGE,LRY,LRLRDT,LRDTHDG,LRLRDTX,LRNODE,LRNODE1,LRTITLE
K DIR,DTOUT,DUOUT,DIRUT,I,J,LRMSGLIN,LRREP,LRSPSHT,MSG,MSGLIN
Q
;
SPSHT ;
S %ZIS="Q" D ^%ZIS Q:POP I '$D(IO("Q")) U IO D PRTSP Q
S ZTRTN="PRTSP^LREPIRS2",ZTSAVE("LR*")="",ZTDESC="PRINT EPI LOCAL SPREADSHEET",ZTREQ="@" D ^%ZTLOAD
I $D(ZTSK)[0 W !!?5,"Report Cancelled."
E W !!?5,"The Task has been queued",!,"Task #",$G(ZTSK) H 5
D HOME^%ZIS G EXIT
Q
PRTSP S MSG=0,LRSPSHT="",LRLC=0,LRPAGE=1,LRQUIT=0
F S MSG=$O(^XTMP("LREPILOCALSPSHT"_LRLRDT,MSG)) Q:'MSG S LRMSGLIN=^(MSG) D Q:LRQUIT
.W !,LRMSGLIN
.I $Y>(IOSL-6) D NPG
K MSGLIN,LRSEG
Q
READY ;
K DIR S DIR(0)="Y",DIR("A")="Ready to Capture"
D ^DIR S:$D(DIRUT) LREND=1
S:'Y LREND=1
Q
PRIV ;PRIVACY MESSAGE
W !!!,"This report will contain Confidential Information."
K DIR S DIR(0)="Y",DIR("A")="Do you wish to continue/proceed"
S DIR("B")="NO"
D ^DIR S:$D(DIRUT) LREND=1
S:'Y LREND=1
Q
REP ;
S %ZIS="Q" D ^%ZIS Q:POP I '$D(IO("Q")) U IO D PRT Q
S ZTRTN="PRT^LREPIRS2",ZTSAVE("LR*")="",ZTDESC="PRINT EPI LOCAL REPORT" D ^%ZTLOAD,HOME^%ZIS G EXIT
Q
PRT ;Print report
S MSG=0,LRLC=0,LRPAGE=1,LRQUIT=0
W !,"***THIS REPORT CONTAINS CONFIDENTIAL INFORMATION.***"
D HDG
F S MSG=$O(^XTMP("LREPILOCALREP"_LRLRDT,MSG)) Q:'MSG S LRMSGLIN=^(MSG) D Q:LRQUIT
.W !,LRMSGLIN
.S LRLC=LRLC+1
.I $Y>(IOSL-6) D NPG
K MSGLIN,LRSEG
Q
PAUSE ;
Q:$G(LREND)
K DIR S DIR(0)="E" D ^DIR
S:($D(DTOUT))!($D(DUOUT)) LRQUIT=1
Q
NPG ;NEW PAGE
D:$E(IOST,1,2)="C-" PAUSE
Q:$G(LRQUIT)
W @IOF
D HDG
Q
HDG ;
S LRHDGLC=""
F S LRHDGLC=$O(^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)) Q:LRHDGLC="" D
.S LRHDG=^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)
.W !,LRHDG
.I LRHDGLC=0 W " PAGE ",LRPAGE
.S LRLC=LRLC+1
S LRPAGE=LRPAGE+1
Q
SAVHDG ;SAVE HEADING WHEN GENERATE REPORT
;called from LREPIRS1
S Y=DT X ^DD("DD")
S SITE=$$SITE^VASITE
S ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=" EMERGING PATHOGENS LOCAL REPORT "_Y
S LRHDGLC=LRHDGLC+1
S ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=" FROM STATION "_$P(SITE,U,3)_" "_$P(SITE,U,2)
S LRHDGLC=LRHDGLC+1
S LRDTHDG=^TMP("HLS",$J,1)
S Y=$$CDT^LREPIRP2($P($P($P(LRDTHDG,HLFS,3),LRCS,2)," ",4))
S MSG=Y
S Y=$$CDT^LREPIRP2($P($P($P(LRDTHDG,HLFS,3),LRCS,2)," ",6))
S ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=" PROCESSING PERIOD FROM "_MSG_" THROUGH "_Y
S LRHDGLC=LRHDGLC+1
S ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)="Reported Local Pathogens:"
S LRI=0
F S LRI=$O(LREPI(LRI)) Q:LRI="" D
.S ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=^(LRHDGLC)_$P(^LAB(69.5,LRI,0),U)_" " I $L(^(LRHDGLC))>60 D
..S LRHDGLC=LRHDGLC+1
..S:'($D(^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC))) ^(LRHDGLC)=$P(^LAB(69.5,LRI,0),U)_" "
..E S ^(LRHDGLC)=^(LRHDGLC)_" "_$P(^LAB(69.5,LRI,0),U)
S LRHDGLC=LRHDGLC+1
S ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=" ",LRHDGLC=LRHDGLC+1
S LRHDG=""
I $D(LRSEG("PID",1)) S LRHDG="Set Id"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("PID",2)) S LRHDG=LRHDG_"SSN"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("PID",3)) S LRHDG=LRHDG_"MPI"_$S(LRREP=1:$E(LRSP,1,13),1:"|")
I $D(LRSEG("PID",4)) S LRHDG=LRHDG_"Patient Name"_$S(LRREP=1:$E(LRSP,1,19),1:"|")
I $D(LRSEG("PID",5)) S LRHDG=LRHDG_"Birth Date"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("PID",6)) S LRHDG=LRHDG_"Sex"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("PID",7)) S LRHDG=LRHDG_"Race"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("PID",8)) S LRHDG=LRHDG_"Homeless"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("PID",9)) S LRHDG=LRHDG_"State"_$S(LRREP=1:$E(LRSP,1,11),1:"|")
I $D(LRSEG("PID",10)) S LRHDG=LRHDG_"Zip"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("PID",11)) S LRHDG=LRHDG_"County"_$S(LRREP=1:$E(LRSP,1,25),1:"|")
I $D(LRSEG("PID",12)) S LRHDG=LRHDG_"Ethnicity"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("PID",13)) S LRHDG=LRHDG_"POS"_$S(LRREP=1:" ",1:"|")
I LRHDG]"" S ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=LRHDG S LRHDG="" S LRHDGLC=LRHDGLC+1
I $D(LRSEG("PV1",1)) S LRHDG=LRHDG_"Set Id"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("PV1",2)) S LRHDG=LRHDG_"Patient Class"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("PV1",3)) S LRHDG=LRHDG_"Hospital Location"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("PV1",4)) S LRHDG=LRHDG_"Discharge Disposition"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("PV1",5)) S LRHDG=LRHDG_"Facility"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("PV1",6)) S LRHDG=LRHDG_"Admit Date/Time"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("PV1",7)) S LRHDG=LRHDG_"Discharge Date/Time"_$S(LRREP=1:" ",1:"|")
I LRHDG]"" S ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=LRHDG S LRHDG="" S LRHDGLC=LRHDGLC+1
I $D(LRSEG("DG1",1)) S LRHDG=LRHDG_"Set Id"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("DG1",2)) S LRHDG=LRHDG_"Diagnosis Code"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("DG1",3)) S LRHDG=LRHDG_"Diagnosis"_$S(LRREP=1:$E(LRSP,1,31),1:"|")
I $D(LRSEG("DG1",4)) S LRHDG=LRHDG_"Admission Date"_$S(LRREP=1:" ",1:"|")
I LRHDG]"" S ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=LRHDG S LRHDG="" S LRHDGLC=LRHDGLC+1
I $D(LRSEG("NTE",1)) S LRHDG=LRHDG_"Set ID"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("NTE",2)) S LRHDG=LRHDG_"Comment"_$S(LRREP=1:" ",1:"|")
I LRHDG]"" S ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=LRHDG S LRHDG="" S LRHDGLC=LRHDGLC+1
I $D(LRSEG("OBR",1)) S LRHDG=LRHDG_"Set ID"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("OBR",2)) S LRHDG=LRHDG_"Test Name"_$S(LRREP=1:$E(LRSP,1,12),1:"|")
I $D(LRSEG("OBR",3)) S LRHDG=LRHDG_"Accession Date"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("OBR",4)) S LRHDG=LRHDG_"Specimen"_$S(LRREP=1:$E(LRSP,1,13),1:"|")
I $D(LRSEG("OBR",5)) S LRHDG=LRHDG_"Accession Number"_$S(LRREP=1:" ",1:"|")
I LRHDG]"" S ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=LRHDG_$S(LRREP=1:" ",1:"|")_"OBR SUBID" S LRHDG="" S LRHDGLC=LRHDGLC+1
I $D(LRSEG("OBX",1)) S LRHDG=LRHDG_"Set Id"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("OBX",2)) S LRHDG=LRHDG_"Value Type"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("OBX",3)) S LRHDG=LRHDG_"Test Name"_$S(LRREP=1:$E(LRSP,1,22),1:"|")
I $D(LRSEG("OBX",4)) S LRHDG=LRHDG_"LOINC Code"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("OBX",5)) S LRHDG=LRHDG_"LOINC Name"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("OBX",6)) S LRHDG=LRHDG_"Test Result"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("OBX",7)) S LRHDG=LRHDG_"Units"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("OBX",8)) S LRHDG=LRHDG_"Flags and Interp"_$S(LRREP=1:" ",1:"|")
I $D(LRSEG("OBX",9)) S LRHDG=LRHDG_"Verified Date/Time"_$S(LRREP=1:" ",1:"|")
I LRHDG]"" S ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=LRHDG_$S(LRREP=1:" ",1:"|")_"OBX SUBID" S LRHDG="" S LRHDGLC=LRHDGLC+1
Q
DELETE ;Delete a report or spreadsheet
W !?5,"Delete a Local Report/Spreadsheet Option"
DRORS ;REPORT OR SPREADSHEET
S DIR(0)="SO^1:REPORT;2:SPREADSHEET"
S DIR("A")="Which one do you wish to delete"
D ^DIR
G:$D(DIRUT) EXIT
S LRREP=Y
K DIR,DIRUT
DCHOOSE ;CHOOSE WHICH REPORT/SPREADSHEET TO DELETE
S LRLRDTX=1,LRY=1,LRNODE="LREPI"_$S(LRREP=1:"LOCALREP",1:"LOCALSPSHT"),LRNODE1=LRNODE
F S LRNODE=$O(^XTMP(LRNODE)) Q:LRNODE=""!(LRNODE'[LRNODE1) S LRLRDTX=$E(LRNODE,$S(LRREP=1:14,1:16),$S(LRREP=1:28,1:30)) D
.Q:LRLRDTX=""
.I '$D(^XTMP("LREPI"_$S(LRREP=1:"LOCALREP",1:"LOCALSPSHT")_LRLRDTX,"DONE")) Q
.S Y=LRLRDTX X ^DD("DD") S LRLRDT(LRLRDTX)=Y,LRLRDT(LRY)=LRLRDTX
.S LRTITLE=$G(^XTMP("LREPI"_$S(LRREP=1:"LOCALREP",1:"LOCALSPSHT")_LRLRDTX,"TITLE"))
.W !,LRY," ",LRLRDT(LRLRDTX)," ",LRTITLE
.S LRY=LRY+1
S LRY=LRY-1
I LRY=0,'$D(LRTITLE) W !,"No "_$S(LRREP=1:"report ",1:"spreadsheet ")_"is ready for printing." G RORS
S DIR(0)="NO^1:"_LRY
S DIR("A")="Choose the number for the "_$S(LRREP=1:"report",LRREP=2:"spreadsheet")_" you wish to delete"
D ^DIR
G:$D(DIRUT) RORS
S LRY=Y,LRLRDT=LRLRDT(LRY)
K DIR,DIRUT
S LRY=Y
F I=1:1 Q:$P(LRY,",",I)="" S LRLRDT=LRLRDT($P(LRY,",",I)) D
.I LRREP=2 K ^XTMP("LREPILOCALSPSHT"_LRLRDT) W !,"Spreadsheet deleted."
.I LRREP=1 K ^XTMP("LREPILOCALREP"_LRLRDT) W !,"Report deleted."
G EXIT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLREPIRS2 9995 printed Dec 13, 2024@02:14:34 Page 2
LREPIRS2 ;DALOI/CKA - EPI-PRINT LOCAL REPORT/SPREADSHEET ; 5/14/03
+1 ;;5.2;LAB SERVICE;**281**;Sep 27, 1994
+2 ; Reference to $$SITE^VASITE supported by IA #10112
+3 ; Reference to X ^DD("DD") supported by IA #10017
+4 WRITE !?5,"Print Local Report/Spreadsheet Option"
RORS ;REPORT OR SPREADSHEET
+1 SET DIR(0)="SO^1:REPORT;2:SPREADSHEET"
+2 SET DIR("A")="Which one do you wish to print"
+3 DO ^DIR
+4 if $DATA(DIRUT)
GOTO EXIT
+5 SET LRREP=Y
+6 KILL DIR,DIRUT
CHOOSE ;CHOOSE RPT OR SPSHT TO PRINT
+1 SET LRLRDTX=1
SET LRY=1
SET LRNODE="LREPI"_$SELECT(LRREP=1:"LOCALREP",1:"LOCALSPSHT")
SET LRNODE1=LRNODE
+2 FOR
SET LRNODE=$ORDER(^XTMP(LRNODE))
if LRNODE=""!(LRNODE'[LRNODE1)
QUIT
SET LRLRDTX=$EXTRACT(LRNODE,$SELECT(LRREP=1:14,1:16),$SELECT(LRREP=1:28,1:30))
Begin DoDot:1
+3 if LRLRDTX=""
QUIT
+4 IF '$DATA(^XTMP("LREPI"_$SELECT(LRREP=1:"LOCALREP",1:"LOCALSPSHT")_LRLRDTX,"DONE"))
QUIT
+5 SET Y=LRLRDTX
XECUTE ^DD("DD")
SET LRLRDT(LRLRDTX)=Y
SET LRLRDT(LRY)=LRLRDTX
+6 SET LRTITLE=$GET(^XTMP("LREPI"_$SELECT(LRREP=1:"LOCALREP",1:"LOCALSPSHT")_LRLRDTX,"TITLE"))
+7 WRITE !,LRY," ",LRLRDT(LRLRDTX)," ",LRTITLE
+8 SET LRY=LRY+1
End DoDot:1
+9 SET LRY=LRY-1
+10 IF LRY=0
IF '$DATA(LRTITLE)
WRITE !,"No "_$SELECT(LRREP=1:"report ",1:"spreadsheet ")_"is ready for printing."
GOTO RORS
+11 SET DIR(0)="NO^1:"_LRY
+12 SET DIR("A")="Choose the number for the "_$SELECT(LRREP=1:"report",LRREP=2:"spreadsheet")_" you wish to print"
+13 DO ^DIR
+14 if $DATA(DIRUT)
GOTO RORS
+15 SET LRY=Y
SET LRLRDT=LRLRDT(LRY)
+16 KILL DIR,DIRUT
+17 IF LRREP=2
Begin DoDot:1
+18 WRITE !!
+19 WRITE !?5,"This option will print the selected fields."
+20 WRITE !?5,"You will need to capture this printout in a text document."
+21 WRITE !?5,"Using a text editor, remove any extraneous lines from the beginning"
+22 WRITE !?5,"and the end of the file so that only the data to be imported remains."
+23 WRITE !?5,"Save the edited file. Use this file in the import function of"
+24 WRITE !?5,"your spreadsheet program."
End DoDot:1
if '$DATA(LREND)
DO PRIV
if '$DATA(LREND)
DO READY
if '$DATA(LREND)
DO SPSHT
GOTO EXIT
+25 IF LRREP=1
if '$DATA(LREND)
DO PRIV
if '$DATA(LREND)
DO REP
GOTO EXIT
+26 WRITE !!
EXIT ;
+1 DO ^%ZISC
+2 KILL D0,LRAUTO,LRBEG,LRDT,LREND,LRRNDT,LREPI,LRRPE,LRRPS,ZTSAVE
+3 KILL ZTRTN,ZTIO,ZTDESC,ZTDTH,ZTSK,X,Y,X1,%DT,POP,%ZIS
+4 KILL LRLC,LRHDG,LRQUIT,LRHDGLC,LRPAGE,LRY,LRLRDT,LRDTHDG,LRLRDTX,LRNODE,LRNODE1,LRTITLE
+5 KILL DIR,DTOUT,DUOUT,DIRUT,I,J,LRMSGLIN,LRREP,LRSPSHT,MSG,MSGLIN
+6 QUIT
+7 ;
SPSHT ;
+1 SET %ZIS="Q"
DO ^%ZIS
if POP
QUIT
IF '$DATA(IO("Q"))
USE IO
DO PRTSP
QUIT
+2 SET ZTRTN="PRTSP^LREPIRS2"
SET ZTSAVE("LR*")=""
SET ZTDESC="PRINT EPI LOCAL SPREADSHEET"
SET ZTREQ="@"
DO ^%ZTLOAD
+3 IF $DATA(ZTSK)[0
WRITE !!?5,"Report Cancelled."
+4 IF '$TEST
WRITE !!?5,"The Task has been queued",!,"Task #",$GET(ZTSK)
HANG 5
+5 DO HOME^%ZIS
GOTO EXIT
+6 QUIT
PRTSP SET MSG=0
SET LRSPSHT=""
SET LRLC=0
SET LRPAGE=1
SET LRQUIT=0
+1 FOR
SET MSG=$ORDER(^XTMP("LREPILOCALSPSHT"_LRLRDT,MSG))
if 'MSG
QUIT
SET LRMSGLIN=^(MSG)
Begin DoDot:1
+2 WRITE !,LRMSGLIN
+3 IF $Y>(IOSL-6)
DO NPG
End DoDot:1
if LRQUIT
QUIT
+4 KILL MSGLIN,LRSEG
+5 QUIT
READY ;
+1 KILL DIR
SET DIR(0)="Y"
SET DIR("A")="Ready to Capture"
+2 DO ^DIR
if $DATA(DIRUT)
SET LREND=1
+3 if 'Y
SET LREND=1
+4 QUIT
PRIV ;PRIVACY MESSAGE
+1 WRITE !!!,"This report will contain Confidential Information."
+2 KILL DIR
SET DIR(0)="Y"
SET DIR("A")="Do you wish to continue/proceed"
+3 SET DIR("B")="NO"
+4 DO ^DIR
if $DATA(DIRUT)
SET LREND=1
+5 if 'Y
SET LREND=1
+6 QUIT
REP ;
+1 SET %ZIS="Q"
DO ^%ZIS
if POP
QUIT
IF '$DATA(IO("Q"))
USE IO
DO PRT
QUIT
+2 SET ZTRTN="PRT^LREPIRS2"
SET ZTSAVE("LR*")=""
SET ZTDESC="PRINT EPI LOCAL REPORT"
DO ^%ZTLOAD
DO HOME^%ZIS
GOTO EXIT
+3 QUIT
PRT ;Print report
+1 SET MSG=0
SET LRLC=0
SET LRPAGE=1
SET LRQUIT=0
+2 WRITE !,"***THIS REPORT CONTAINS CONFIDENTIAL INFORMATION.***"
+3 DO HDG
+4 FOR
SET MSG=$ORDER(^XTMP("LREPILOCALREP"_LRLRDT,MSG))
if 'MSG
QUIT
SET LRMSGLIN=^(MSG)
Begin DoDot:1
+5 WRITE !,LRMSGLIN
+6 SET LRLC=LRLC+1
+7 IF $Y>(IOSL-6)
DO NPG
End DoDot:1
if LRQUIT
QUIT
+8 KILL MSGLIN,LRSEG
+9 QUIT
PAUSE ;
+1 if $GET(LREND)
QUIT
+2 KILL DIR
SET DIR(0)="E"
DO ^DIR
+3 if ($DATA(DTOUT))!($DATA(DUOUT))
SET LRQUIT=1
+4 QUIT
NPG ;NEW PAGE
+1 if $EXTRACT(IOST,1,2)="C-"
DO PAUSE
+2 if $GET(LRQUIT)
QUIT
+3 WRITE @IOF
+4 DO HDG
+5 QUIT
HDG ;
+1 SET LRHDGLC=""
+2 FOR
SET LRHDGLC=$ORDER(^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC))
if LRHDGLC=""
QUIT
Begin DoDot:1
+3 SET LRHDG=^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)
+4 WRITE !,LRHDG
+5 IF LRHDGLC=0
WRITE " PAGE ",LRPAGE
+6 SET LRLC=LRLC+1
End DoDot:1
+7 SET LRPAGE=LRPAGE+1
+8 QUIT
SAVHDG ;SAVE HEADING WHEN GENERATE REPORT
+1 ;called from LREPIRS1
+2 SET Y=DT
XECUTE ^DD("DD")
+3 SET SITE=$$SITE^VASITE
+4 SET ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=" EMERGING PATHOGENS LOCAL REPORT "_Y
+5 SET LRHDGLC=LRHDGLC+1
+6 SET ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=" FROM STATION "_$PIECE(SITE,U,3)_" "_$PIECE(SITE,U,2)
+7 SET LRHDGLC=LRHDGLC+1
+8 SET LRDTHDG=^TMP("HLS",$JOB,1)
+9 SET Y=$$CDT^LREPIRP2($PIECE($PIECE($PIECE(LRDTHDG,HLFS,3),LRCS,2)," ",4))
+10 SET MSG=Y
+11 SET Y=$$CDT^LREPIRP2($PIECE($PIECE($PIECE(LRDTHDG,HLFS,3),LRCS,2)," ",6))
+12 SET ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=" PROCESSING PERIOD FROM "_MSG_" THROUGH "_Y
+13 SET LRHDGLC=LRHDGLC+1
+14 SET ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)="Reported Local Pathogens:"
+15 SET LRI=0
+16 FOR
SET LRI=$ORDER(LREPI(LRI))
if LRI=""
QUIT
Begin DoDot:1
+17 SET ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=^(LRHDGLC)_$PIECE(^LAB(69.5,LRI,0),U)_" "
IF $LENGTH(^(LRHDGLC))>60
Begin DoDot:2
+18 SET LRHDGLC=LRHDGLC+1
+19 if '($DATA(^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)))
SET ^(LRHDGLC)=$PIECE(^LAB(69.5,LRI,0),U)_" "
+20 IF '$TEST
SET ^(LRHDGLC)=^(LRHDGLC)_" "_$PIECE(^LAB(69.5,LRI,0),U)
End DoDot:2
End DoDot:1
+21 SET LRHDGLC=LRHDGLC+1
+22 SET ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=" "
SET LRHDGLC=LRHDGLC+1
+23 SET LRHDG=""
+24 IF $DATA(LRSEG("PID",1))
SET LRHDG="Set Id"_$SELECT(LRREP=1:" ",1:"|")
+25 IF $DATA(LRSEG("PID",2))
SET LRHDG=LRHDG_"SSN"_$SELECT(LRREP=1:" ",1:"|")
+26 IF $DATA(LRSEG("PID",3))
SET LRHDG=LRHDG_"MPI"_$SELECT(LRREP=1:$EXTRACT(LRSP,1,13),1:"|")
+27 IF $DATA(LRSEG("PID",4))
SET LRHDG=LRHDG_"Patient Name"_$SELECT(LRREP=1:$EXTRACT(LRSP,1,19),1:"|")
+28 IF $DATA(LRSEG("PID",5))
SET LRHDG=LRHDG_"Birth Date"_$SELECT(LRREP=1:" ",1:"|")
+29 IF $DATA(LRSEG("PID",6))
SET LRHDG=LRHDG_"Sex"_$SELECT(LRREP=1:" ",1:"|")
+30 IF $DATA(LRSEG("PID",7))
SET LRHDG=LRHDG_"Race"_$SELECT(LRREP=1:" ",1:"|")
+31 IF $DATA(LRSEG("PID",8))
SET LRHDG=LRHDG_"Homeless"_$SELECT(LRREP=1:" ",1:"|")
+32 IF $DATA(LRSEG("PID",9))
SET LRHDG=LRHDG_"State"_$SELECT(LRREP=1:$EXTRACT(LRSP,1,11),1:"|")
+33 IF $DATA(LRSEG("PID",10))
SET LRHDG=LRHDG_"Zip"_$SELECT(LRREP=1:" ",1:"|")
+34 IF $DATA(LRSEG("PID",11))
SET LRHDG=LRHDG_"County"_$SELECT(LRREP=1:$EXTRACT(LRSP,1,25),1:"|")
+35 IF $DATA(LRSEG("PID",12))
SET LRHDG=LRHDG_"Ethnicity"_$SELECT(LRREP=1:" ",1:"|")
+36 IF $DATA(LRSEG("PID",13))
SET LRHDG=LRHDG_"POS"_$SELECT(LRREP=1:" ",1:"|")
+37 IF LRHDG]""
SET ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=LRHDG
SET LRHDG=""
SET LRHDGLC=LRHDGLC+1
+38 IF $DATA(LRSEG("PV1",1))
SET LRHDG=LRHDG_"Set Id"_$SELECT(LRREP=1:" ",1:"|")
+39 IF $DATA(LRSEG("PV1",2))
SET LRHDG=LRHDG_"Patient Class"_$SELECT(LRREP=1:" ",1:"|")
+40 IF $DATA(LRSEG("PV1",3))
SET LRHDG=LRHDG_"Hospital Location"_$SELECT(LRREP=1:" ",1:"|")
+41 IF $DATA(LRSEG("PV1",4))
SET LRHDG=LRHDG_"Discharge Disposition"_$SELECT(LRREP=1:" ",1:"|")
+42 IF $DATA(LRSEG("PV1",5))
SET LRHDG=LRHDG_"Facility"_$SELECT(LRREP=1:" ",1:"|")
+43 IF $DATA(LRSEG("PV1",6))
SET LRHDG=LRHDG_"Admit Date/Time"_$SELECT(LRREP=1:" ",1:"|")
+44 IF $DATA(LRSEG("PV1",7))
SET LRHDG=LRHDG_"Discharge Date/Time"_$SELECT(LRREP=1:" ",1:"|")
+45 IF LRHDG]""
SET ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=LRHDG
SET LRHDG=""
SET LRHDGLC=LRHDGLC+1
+46 IF $DATA(LRSEG("DG1",1))
SET LRHDG=LRHDG_"Set Id"_$SELECT(LRREP=1:" ",1:"|")
+47 IF $DATA(LRSEG("DG1",2))
SET LRHDG=LRHDG_"Diagnosis Code"_$SELECT(LRREP=1:" ",1:"|")
+48 IF $DATA(LRSEG("DG1",3))
SET LRHDG=LRHDG_"Diagnosis"_$SELECT(LRREP=1:$EXTRACT(LRSP,1,31),1:"|")
+49 IF $DATA(LRSEG("DG1",4))
SET LRHDG=LRHDG_"Admission Date"_$SELECT(LRREP=1:" ",1:"|")
+50 IF LRHDG]""
SET ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=LRHDG
SET LRHDG=""
SET LRHDGLC=LRHDGLC+1
+51 IF $DATA(LRSEG("NTE",1))
SET LRHDG=LRHDG_"Set ID"_$SELECT(LRREP=1:" ",1:"|")
+52 IF $DATA(LRSEG("NTE",2))
SET LRHDG=LRHDG_"Comment"_$SELECT(LRREP=1:" ",1:"|")
+53 IF LRHDG]""
SET ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=LRHDG
SET LRHDG=""
SET LRHDGLC=LRHDGLC+1
+54 IF $DATA(LRSEG("OBR",1))
SET LRHDG=LRHDG_"Set ID"_$SELECT(LRREP=1:" ",1:"|")
+55 IF $DATA(LRSEG("OBR",2))
SET LRHDG=LRHDG_"Test Name"_$SELECT(LRREP=1:$EXTRACT(LRSP,1,12),1:"|")
+56 IF $DATA(LRSEG("OBR",3))
SET LRHDG=LRHDG_"Accession Date"_$SELECT(LRREP=1:" ",1:"|")
+57 IF $DATA(LRSEG("OBR",4))
SET LRHDG=LRHDG_"Specimen"_$SELECT(LRREP=1:$EXTRACT(LRSP,1,13),1:"|")
+58 IF $DATA(LRSEG("OBR",5))
SET LRHDG=LRHDG_"Accession Number"_$SELECT(LRREP=1:" ",1:"|")
+59 IF LRHDG]""
SET ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=LRHDG_$SELECT(LRREP=1:" ",1:"|")_"OBR SUBID"
SET LRHDG=""
SET LRHDGLC=LRHDGLC+1
+60 IF $DATA(LRSEG("OBX",1))
SET LRHDG=LRHDG_"Set Id"_$SELECT(LRREP=1:" ",1:"|")
+61 IF $DATA(LRSEG("OBX",2))
SET LRHDG=LRHDG_"Value Type"_$SELECT(LRREP=1:" ",1:"|")
+62 IF $DATA(LRSEG("OBX",3))
SET LRHDG=LRHDG_"Test Name"_$SELECT(LRREP=1:$EXTRACT(LRSP,1,22),1:"|")
+63 IF $DATA(LRSEG("OBX",4))
SET LRHDG=LRHDG_"LOINC Code"_$SELECT(LRREP=1:" ",1:"|")
+64 IF $DATA(LRSEG("OBX",5))
SET LRHDG=LRHDG_"LOINC Name"_$SELECT(LRREP=1:" ",1:"|")
+65 IF $DATA(LRSEG("OBX",6))
SET LRHDG=LRHDG_"Test Result"_$SELECT(LRREP=1:" ",1:"|")
+66 IF $DATA(LRSEG("OBX",7))
SET LRHDG=LRHDG_"Units"_$SELECT(LRREP=1:" ",1:"|")
+67 IF $DATA(LRSEG("OBX",8))
SET LRHDG=LRHDG_"Flags and Interp"_$SELECT(LRREP=1:" ",1:"|")
+68 IF $DATA(LRSEG("OBX",9))
SET LRHDG=LRHDG_"Verified Date/Time"_$SELECT(LRREP=1:" ",1:"|")
+69 IF LRHDG]""
SET ^XTMP("LREPILOCALREP"_LRLRDT,"HDG",LRHDGLC)=LRHDG_$SELECT(LRREP=1:" ",1:"|")_"OBX SUBID"
SET LRHDG=""
SET LRHDGLC=LRHDGLC+1
+70 QUIT
DELETE ;Delete a report or spreadsheet
+1 WRITE !?5,"Delete a Local Report/Spreadsheet Option"
DRORS ;REPORT OR SPREADSHEET
+1 SET DIR(0)="SO^1:REPORT;2:SPREADSHEET"
+2 SET DIR("A")="Which one do you wish to delete"
+3 DO ^DIR
+4 if $DATA(DIRUT)
GOTO EXIT
+5 SET LRREP=Y
+6 KILL DIR,DIRUT
DCHOOSE ;CHOOSE WHICH REPORT/SPREADSHEET TO DELETE
+1 SET LRLRDTX=1
SET LRY=1
SET LRNODE="LREPI"_$SELECT(LRREP=1:"LOCALREP",1:"LOCALSPSHT")
SET LRNODE1=LRNODE
+2 FOR
SET LRNODE=$ORDER(^XTMP(LRNODE))
if LRNODE=""!(LRNODE'[LRNODE1)
QUIT
SET LRLRDTX=$EXTRACT(LRNODE,$SELECT(LRREP=1:14,1:16),$SELECT(LRREP=1:28,1:30))
Begin DoDot:1
+3 if LRLRDTX=""
QUIT
+4 IF '$DATA(^XTMP("LREPI"_$SELECT(LRREP=1:"LOCALREP",1:"LOCALSPSHT")_LRLRDTX,"DONE"))
QUIT
+5 SET Y=LRLRDTX
XECUTE ^DD("DD")
SET LRLRDT(LRLRDTX)=Y
SET LRLRDT(LRY)=LRLRDTX
+6 SET LRTITLE=$GET(^XTMP("LREPI"_$SELECT(LRREP=1:"LOCALREP",1:"LOCALSPSHT")_LRLRDTX,"TITLE"))
+7 WRITE !,LRY," ",LRLRDT(LRLRDTX)," ",LRTITLE
+8 SET LRY=LRY+1
End DoDot:1
+9 SET LRY=LRY-1
+10 IF LRY=0
IF '$DATA(LRTITLE)
WRITE !,"No "_$SELECT(LRREP=1:"report ",1:"spreadsheet ")_"is ready for printing."
GOTO RORS
+11 SET DIR(0)="NO^1:"_LRY
+12 SET DIR("A")="Choose the number for the "_$SELECT(LRREP=1:"report",LRREP=2:"spreadsheet")_" you wish to delete"
+13 DO ^DIR
+14 if $DATA(DIRUT)
GOTO RORS
+15 SET LRY=Y
SET LRLRDT=LRLRDT(LRY)
+16 KILL DIR,DIRUT
+17 SET LRY=Y
+18 FOR I=1:1
if $PIECE(LRY,",",I)=""
QUIT
SET LRLRDT=LRLRDT($PIECE(LRY,",",I))
Begin DoDot:1
+19 IF LRREP=2
KILL ^XTMP("LREPILOCALSPSHT"_LRLRDT)
WRITE !,"Spreadsheet deleted."
+20 IF LRREP=1
KILL ^XTMP("LREPILOCALREP"_LRLRDT)
WRITE !,"Report deleted."
End DoDot:1
+21 GOTO EXIT