TIUP146P ; SLC/JAK,RMO - Post-Install for TIU*1*146 Cont.;9/9/02@13:15:47
;;1.0;TEXT INTEGRATION UTILITIES;**146**;Jun 20, 1997
PRINT ; -- Device Selection
W !!,"This routine will print the results of the search routine in patch"
W !,"TIU*1*146 which identifies documents pointing to a different"
W !,"patient's visit in the TIU DOCUMENT file (#8925)."
W !!,*7,"This report requires a column width of 132.",!
S %ZIS="Q" D ^%ZIS I POP K POP G PRINTQ
I $D(IO("Q")) K IO("Q") D Q
. S ZTRTN="LIST^TIUP146P"
. S ZTDESC="TIU*1*146 - PRINT SEARCH RESULTS"
. D ^%ZTLOAD W !,$S($D(ZTSK):"Request queued",1:"Request Cancelled!")
. K ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,%ZIS
. D HOME^%ZIS
U IO D LIST,^%ZISC
PRINTQ Q
;
LIST ; -- Entry point to generate list
N TIUDA,TIUOUT,TIUVSIT S TIUOUT=0
I $D(ZTQUEUED) S ZTREQ="@"
D HDR
I +$O(^XTMP("TIUP146","EX",0))'>0 W !?4,"No records in list." G LISTQ
S TIUDA=0
F S TIUDA=$O(^XTMP("TIUP146","EX",TIUDA)) Q:'TIUDA!(TIUOUT) S TIUVSIT=+$G(^(TIUDA)) D LISTONE(TIUDA,TIUVSIT)
LISTQ Q
;
LISTONE(TIUDA,TIUVSIT) ;Entry point to list one record
; Input -- TIUDA TIU Document file (#8925) IEN
; TIUVSIT Visit file (#9000010) IEN
; Output -- None
N DFN,TIUD0,TIUHL,VADM,VAIP,VAIN,VA
I $Y>(IOSL-4) D ASK G LISTONEQ:TIUOUT D HDR
S TIUD0=$G(^TIU(8925,+TIUDA,0))
S TIUHL=$P($G(^TIU(8925,+TIUDA,12)),U,11)
S DFN=+$P(TIUD0,U,2)
I DFN>0 D OERR^VADPT
W !,TIUDA
W ?12,$E($$UPPER^TIULS($P($G(^TIU(8925.6,+$P(TIUD0,U,5),0)),U)),1,5)
W ?19,$S(DFN>0:$E($G(VADM(1)),1,20)_" ("_$G(VA("BID"))_")",1:"")
W ?48,$E($P($G(^TIU(8925.1,+TIUD0,0)),U,1),1,10)
W ?60,$$DATE^TIULS(+$P($G(^TIU(8925,+TIUDA,13)),U,1),"MM/DD/CCYY HR:MIN")
W ?78,$E($$GET1^DIQ(44,+TIUHL,.01,"E"),1,15)
I TIUVSIT>0 D
. N DA,DIC,DIQ,DR,TIUVISIT
. S DIC="^AUPNVSIT(",DIQ="TIUVISIT",DIQ(0)="E",DA=+TIUVSIT
. S DR=".01" D EN^DIQ1
. W ?95,$G(TIUVISIT(9000010,DA,.01,"E"))
. W ?118,TIUVSIT
LISTONEQ Q
;
ASK ; -- End of Page
I IO=IO(0),$E(IOST)="C" D
. W ! N DIR,X,Y S DIR(0)="E"
. D ^DIR I $D(DUOUT)!$D(DTOUT) S TIUOUT=1
Q
;
HDR ; -- Header for report
N LNE,TIUNOW
D NOW^%DTC S Y=% X ^DD("DD") S TIUNOW=Y
W @IOF,"TIU*1*146 TIU DOCUMENTS LINKED TO A DIFFERENT PATIENT'S VISIT - Printed: ",TIUNOW
W !,"Document #",?12,"Status",?19,"Patient in Document",?48,"Title",?60,"Reference Date",?78,"Visit Location",?95,"Incorrect Visit Date &",?118,"Visit #"
W ! S LNE="",$P(LNE,"-",(IOM-1))="" W LNE
Q
;
MAIL ;Send completion message to user who initiated post-install
N XMSUB,XMTEXT,XMDUZ,XMY,XMZ,XMMG
N TIUTXT
S XMDUZ="PATCH TIU*1*146 TIU DOCUMENT SEARCH RESULTS",XMY(.5)=""
S:$G(DUZ) XMY(DUZ)=""
S XMY("G.PATIENT SAFETY NOTIFICATIONS")=""
S TIUTXT(1)="TIU Documents linked to different patient's visit."
S TIUTXT(2)=""
S TIUTXT(3)="Task Started: "_$$FMTE^XLFDT($G(^XTMP("TIUP146","T0")))
S TIUTXT(4)="Task Ended: "_$$FMTE^XLFDT($G(^XTMP("TIUP146","T1")))
S TIUTXT(5)=""
;
S TIUTXT(6)="Number of entries linked to Different Patient's Visit: "_+$G(^XTMP("TIUP146","CNT","EX"))
S TIUTXT(7)=""
S TIUTXT(8)="TOTAL Number of entries processed: "_+$G(^XTMP("TIUP146","CNT","TOT"))
S TIUTXT(9)=""
I $G(^XTMP("TIUP146","STOP")) D
. S TIUTXT(10)="Task STOPPED: "_$$FMTE^XLFDT($G(^XTMP("TIUP146","STOP")))_"."
ELSE D
. S TIUTXT(10)="Task COMPLETED successfully."
. S TIUTXT(11)=""
. S TIUTXT(12)="To print a detailed listing of the results invoke D PRINT^TIUP146P."
S XMTEXT="TIUTXT(",XMSUB="TIU*1*146 TIU Documents Linked to Different Patient's Visit"
D ^XMD
Q
TIUP146P ; SLC/JAK,RMO - Post-Install for TIU*1*146 Cont.;9/9/02@13:15:47
+1 ;;1.0;TEXT INTEGRATION UTILITIES;**146**;Jun 20, 1997
PRINT ; -- Device Selection
+1 WRITE !!,"This routine will print the results of the search routine in patch"
+2 WRITE !,"TIU*1*146 which identifies documents pointing to a different"
+3 WRITE !,"patient's visit in the TIU DOCUMENT file (#8925)."
+4 WRITE !!,*7,"This report requires a column width of 132.",!
+5 SET %ZIS="Q"
DO ^%ZIS
IF POP
KILL POP
GOTO PRINTQ
+6 IF $DATA(IO("Q"))
KILL IO("Q")
Begin DoDot:1
+7 SET ZTRTN="LIST^TIUP146P"
+8 SET ZTDESC="TIU*1*146 - PRINT SEARCH RESULTS"
+9 DO ^%ZTLOAD
WRITE !,$SELECT($DATA(ZTSK):"Request queued",1:"Request Cancelled!")
+10 KILL ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,%ZIS
+11 DO HOME^%ZIS
End DoDot:1
QUIT
+12 USE IO
DO LIST
DO ^%ZISC
PRINTQ QUIT
+1 ;
LIST ; -- Entry point to generate list
+1 NEW TIUDA,TIUOUT,TIUVSIT
SET TIUOUT=0
+2 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+3 DO HDR
+4 IF +$ORDER(^XTMP("TIUP146","EX",0))'>0
WRITE !?4,"No records in list."
GOTO LISTQ
+5 SET TIUDA=0
+6 FOR
SET TIUDA=$ORDER(^XTMP("TIUP146","EX",TIUDA))
IF 'TIUDA!(TIUOUT)
QUIT
SET TIUVSIT=+$GET(^(TIUDA))
DO LISTONE(TIUDA,TIUVSIT)
LISTQ QUIT
+1 ;
LISTONE(TIUDA,TIUVSIT) ;Entry point to list one record
+1 ; Input -- TIUDA TIU Document file (#8925) IEN
+2 ; TIUVSIT Visit file (#9000010) IEN
+3 ; Output -- None
+4 NEW DFN,TIUD0,TIUHL,VADM,VAIP,VAIN,VA
+5 IF $Y>(IOSL-4)
DO ASK
IF TIUOUT
GOTO LISTONEQ
DO HDR
+6 SET TIUD0=$GET(^TIU(8925,+TIUDA,0))
+7 SET TIUHL=$PIECE($GET(^TIU(8925,+TIUDA,12)),U,11)
+8 SET DFN=+$PIECE(TIUD0,U,2)
+9 IF DFN>0
DO OERR^VADPT
+10 WRITE !,TIUDA
+11 WRITE ?12,$EXTRACT($$UPPER^TIULS($PIECE($GET(^TIU(8925.6,+$PIECE(TIUD0,U,5),0)),U)),1,5)
+12 WRITE ?19,$SELECT(DFN>0:$EXTRACT($GET(VADM(1)),1,20)_" ("_$GET(VA("BID"))_")",1:"")
+13 WRITE ?48,$EXTRACT($PIECE($GET(^TIU(8925.1,+TIUD0,0)),U,1),1,10)
+14 WRITE ?60,$$DATE^TIULS(+$PIECE($GET(^TIU(8925,+TIUDA,13)),U,1),"MM/DD/CCYY HR:MIN")
+15 WRITE ?78,$EXTRACT($$GET1^DIQ(44,+TIUHL,.01,"E"),1,15)
+16 IF TIUVSIT>0
Begin DoDot:1
+17 NEW DA,DIC,DIQ,DR,TIUVISIT
+18 SET DIC="^AUPNVSIT("
SET DIQ="TIUVISIT"
SET DIQ(0)="E"
SET DA=+TIUVSIT
+19 SET DR=".01"
DO EN^DIQ1
+20 WRITE ?95,$GET(TIUVISIT(9000010,DA,.01,"E"))
+21 WRITE ?118,TIUVSIT
End DoDot:1
LISTONEQ QUIT
+1 ;
ASK ; -- End of Page
+1 IF IO=IO(0)
IF $EXTRACT(IOST)="C"
Begin DoDot:1
+2 WRITE !
NEW DIR,X,Y
SET DIR(0)="E"
+3 DO ^DIR
IF $DATA(DUOUT)!$DATA(DTOUT)
SET TIUOUT=1
End DoDot:1
+4 QUIT
+5 ;
HDR ; -- Header for report
+1 NEW LNE,TIUNOW
+2 DO NOW^%DTC
SET Y=%
XECUTE ^DD("DD")
SET TIUNOW=Y
+3 WRITE @IOF,"TIU*1*146 TIU DOCUMENTS LINKED TO A DIFFERENT PATIENT'S VISIT - Printed: ",TIUNOW
+4 WRITE !,"Document #",?12,"Status",?19,"Patient in Document",?48,"Title",?60,"Reference Date",?78,"Visit Location",?95,"Incorrect Visit Date &",?118,"Visit #"
+5 WRITE !
SET LNE=""
SET $PIECE(LNE,"-",(IOM-1))=""
WRITE LNE
+6 QUIT
+7 ;
MAIL ;Send completion message to user who initiated post-install
+1 NEW XMSUB,XMTEXT,XMDUZ,XMY,XMZ,XMMG
+2 NEW TIUTXT
+3 SET XMDUZ="PATCH TIU*1*146 TIU DOCUMENT SEARCH RESULTS"
SET XMY(.5)=""
+4 IF $GET(DUZ)
SET XMY(DUZ)=""
+5 SET XMY("G.PATIENT SAFETY NOTIFICATIONS")=""
+6 SET TIUTXT(1)="TIU Documents linked to different patient's visit."
+7 SET TIUTXT(2)=""
+8 SET TIUTXT(3)="Task Started: "_$$FMTE^XLFDT($GET(^XTMP("TIUP146","T0")))
+9 SET TIUTXT(4)="Task Ended: "_$$FMTE^XLFDT($GET(^XTMP("TIUP146","T1")))
+10 SET TIUTXT(5)=""
+11 ;
+12 SET TIUTXT(6)="Number of entries linked to Different Patient's Visit: "_+$GET(^XTMP("TIUP146","CNT","EX"))
+13 SET TIUTXT(7)=""
+14 SET TIUTXT(8)="TOTAL Number of entries processed: "_+$GET(^XTMP("TIUP146","CNT","TOT"))
+15 SET TIUTXT(9)=""
+16 IF $GET(^XTMP("TIUP146","STOP"))
Begin DoDot:1
+17 SET TIUTXT(10)="Task STOPPED: "_$$FMTE^XLFDT($GET(^XTMP("TIUP146","STOP")))_"."
End DoDot:1
+18 IF '$TEST
Begin DoDot:1
+19 SET TIUTXT(10)="Task COMPLETED successfully."
+20 SET TIUTXT(11)=""
+21 SET TIUTXT(12)="To print a detailed listing of the results invoke D PRINT^TIUP146P."
End DoDot:1
+22 SET XMTEXT="TIUTXT("
SET XMSUB="TIU*1*146 TIU Documents Linked to Different Patient's Visit"
+23 DO ^XMD
+24 QUIT