| 1 | TIUP146P ; SLC/JAK,RMO - Post-Install for TIU*1*146 Cont.;9/9/02@13:15:47
 | 
|---|
| 2 |  ;;1.0;TEXT INTEGRATION UTILITIES;**146**;Jun 20, 1997
 | 
|---|
| 3 | PRINT ; -- Device Selection
 | 
|---|
| 4 |  W !!,"This routine will print the results of the search routine in patch"
 | 
|---|
| 5 |  W !,"TIU*1*146 which identifies documents pointing to a different"
 | 
|---|
| 6 |  W !,"patient's visit in the TIU DOCUMENT file (#8925)."
 | 
|---|
| 7 |  W !!,*7,"This report requires a column width of 132.",!
 | 
|---|
| 8 |  S %ZIS="Q" D ^%ZIS I POP K POP G PRINTQ
 | 
|---|
| 9 |  I $D(IO("Q")) K IO("Q") D  Q
 | 
|---|
| 10 |  . S ZTRTN="LIST^TIUP146P"
 | 
|---|
| 11 |  . S ZTDESC="TIU*1*146 - PRINT SEARCH RESULTS"
 | 
|---|
| 12 |  . D ^%ZTLOAD W !,$S($D(ZTSK):"Request queued",1:"Request Cancelled!")
 | 
|---|
| 13 |  . K ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,%ZIS
 | 
|---|
| 14 |  . D HOME^%ZIS
 | 
|---|
| 15 |  U IO D LIST,^%ZISC
 | 
|---|
| 16 | PRINTQ Q
 | 
|---|
| 17 |  ;
 | 
|---|
| 18 | LIST ; -- Entry point to generate list
 | 
|---|
| 19 |  N TIUDA,TIUOUT,TIUVSIT S TIUOUT=0
 | 
|---|
| 20 |  I $D(ZTQUEUED) S ZTREQ="@"
 | 
|---|
| 21 |  D HDR
 | 
|---|
| 22 |  I +$O(^XTMP("TIUP146","EX",0))'>0 W !?4,"No records in list." G LISTQ
 | 
|---|
| 23 |  S TIUDA=0
 | 
|---|
| 24 |  F  S TIUDA=$O(^XTMP("TIUP146","EX",TIUDA)) Q:'TIUDA!(TIUOUT)  S TIUVSIT=+$G(^(TIUDA)) D LISTONE(TIUDA,TIUVSIT)
 | 
|---|
| 25 | LISTQ Q
 | 
|---|
| 26 |  ;
 | 
|---|
| 27 | LISTONE(TIUDA,TIUVSIT) ;Entry point to list one record
 | 
|---|
| 28 |  ; Input  -- TIUDA    TIU Document file (#8925) IEN
 | 
|---|
| 29 |  ;           TIUVSIT  Visit file (#9000010) IEN
 | 
|---|
| 30 |  ; Output -- None
 | 
|---|
| 31 |  N DFN,TIUD0,TIUHL,VADM,VAIP,VAIN,VA
 | 
|---|
| 32 |  I $Y>(IOSL-4) D ASK G LISTONEQ:TIUOUT  D HDR
 | 
|---|
| 33 |  S TIUD0=$G(^TIU(8925,+TIUDA,0))
 | 
|---|
| 34 |  S TIUHL=$P($G(^TIU(8925,+TIUDA,12)),U,11)
 | 
|---|
| 35 |  S DFN=+$P(TIUD0,U,2)
 | 
|---|
| 36 |  I DFN>0 D OERR^VADPT
 | 
|---|
| 37 |  W !,TIUDA
 | 
|---|
| 38 |  W ?12,$E($$UPPER^TIULS($P($G(^TIU(8925.6,+$P(TIUD0,U,5),0)),U)),1,5)
 | 
|---|
| 39 |  W ?19,$S(DFN>0:$E($G(VADM(1)),1,20)_" ("_$G(VA("BID"))_")",1:"")
 | 
|---|
| 40 |  W ?48,$E($P($G(^TIU(8925.1,+TIUD0,0)),U,1),1,10)
 | 
|---|
| 41 |  W ?60,$$DATE^TIULS(+$P($G(^TIU(8925,+TIUDA,13)),U,1),"MM/DD/CCYY HR:MIN")
 | 
|---|
| 42 |  W ?78,$E($$GET1^DIQ(44,+TIUHL,.01,"E"),1,15)
 | 
|---|
| 43 |  I TIUVSIT>0 D
 | 
|---|
| 44 |  . N DA,DIC,DIQ,DR,TIUVISIT
 | 
|---|
| 45 |  . S DIC="^AUPNVSIT(",DIQ="TIUVISIT",DIQ(0)="E",DA=+TIUVSIT
 | 
|---|
| 46 |  . S DR=".01" D EN^DIQ1
 | 
|---|
| 47 |  . W ?95,$G(TIUVISIT(9000010,DA,.01,"E"))
 | 
|---|
| 48 |  . W ?118,TIUVSIT
 | 
|---|
| 49 | LISTONEQ Q
 | 
|---|
| 50 |  ;
 | 
|---|
| 51 | ASK ; -- End of Page
 | 
|---|
| 52 |  I IO=IO(0),$E(IOST)="C" D
 | 
|---|
| 53 |  . W ! N DIR,X,Y S DIR(0)="E"
 | 
|---|
| 54 |  . D ^DIR I $D(DUOUT)!$D(DTOUT) S TIUOUT=1
 | 
|---|
| 55 |  Q
 | 
|---|
| 56 |  ;
 | 
|---|
| 57 | HDR ; -- Header for report
 | 
|---|
| 58 |  N LNE,TIUNOW
 | 
|---|
| 59 |  D NOW^%DTC S Y=% X ^DD("DD") S TIUNOW=Y
 | 
|---|
| 60 |  W @IOF,"TIU*1*146 TIU DOCUMENTS LINKED TO A DIFFERENT PATIENT'S VISIT - Printed: ",TIUNOW
 | 
|---|
| 61 |  W !,"Document #",?12,"Status",?19,"Patient in Document",?48,"Title",?60,"Reference Date",?78,"Visit Location",?95,"Incorrect Visit Date &",?118,"Visit #"
 | 
|---|
| 62 |  W ! S LNE="",$P(LNE,"-",(IOM-1))="" W LNE
 | 
|---|
| 63 |  Q
 | 
|---|
| 64 |  ;
 | 
|---|
| 65 | MAIL ;Send completion message to user who initiated post-install
 | 
|---|
| 66 |  N XMSUB,XMTEXT,XMDUZ,XMY,XMZ,XMMG
 | 
|---|
| 67 |  N TIUTXT
 | 
|---|
| 68 |  S XMDUZ="PATCH TIU*1*146 TIU DOCUMENT SEARCH RESULTS",XMY(.5)=""
 | 
|---|
| 69 |  S:$G(DUZ) XMY(DUZ)=""
 | 
|---|
| 70 |  S XMY("G.PATIENT SAFETY NOTIFICATIONS")=""
 | 
|---|
| 71 |  S TIUTXT(1)="TIU Documents linked to different patient's visit."
 | 
|---|
| 72 |  S TIUTXT(2)=""
 | 
|---|
| 73 |  S TIUTXT(3)="Task Started: "_$$FMTE^XLFDT($G(^XTMP("TIUP146","T0")))
 | 
|---|
| 74 |  S TIUTXT(4)="Task   Ended: "_$$FMTE^XLFDT($G(^XTMP("TIUP146","T1")))
 | 
|---|
| 75 |  S TIUTXT(5)=""
 | 
|---|
| 76 |  ;
 | 
|---|
| 77 |  S TIUTXT(6)="Number of entries linked to Different Patient's Visit: "_+$G(^XTMP("TIUP146","CNT","EX"))
 | 
|---|
| 78 |  S TIUTXT(7)=""
 | 
|---|
| 79 |  S TIUTXT(8)="TOTAL Number of entries processed: "_+$G(^XTMP("TIUP146","CNT","TOT"))
 | 
|---|
| 80 |  S TIUTXT(9)=""
 | 
|---|
| 81 |  I $G(^XTMP("TIUP146","STOP")) D
 | 
|---|
| 82 |  . S TIUTXT(10)="Task STOPPED: "_$$FMTE^XLFDT($G(^XTMP("TIUP146","STOP")))_"."
 | 
|---|
| 83 |  ELSE  D
 | 
|---|
| 84 |  . S TIUTXT(10)="Task COMPLETED successfully."
 | 
|---|
| 85 |  . S TIUTXT(11)=""
 | 
|---|
| 86 |  . S TIUTXT(12)="To print a detailed listing of the results invoke D PRINT^TIUP146P."
 | 
|---|
| 87 |  S XMTEXT="TIUTXT(",XMSUB="TIU*1*146 TIU Documents Linked to Different Patient's Visit"
 | 
|---|
| 88 |  D ^XMD
 | 
|---|
| 89 |  Q
 | 
|---|