| 1 | TIUPNCV7 ;SLC/DJP ;PNs ==> TIU cnv rtns ;5-7-97
 | 
|---|
| 2 |  ;;1.0;TEXT INTEGRATION UTILITIES;**3**;Jun 20, 1997
 | 
|---|
| 3 |  ;
 | 
|---|
| 4 | HELP10 ;Help text for GMRP IEN prompt
 | 
|---|
| 5 |  W !!?5,"Enter the Internal Entry Number (IEN)) of the last progress"
 | 
|---|
| 6 |  W !?5,"note you want to convert.  By entering an IEN, you can run"
 | 
|---|
| 7 |  W !?5,"this conversion while users continue to use the Progress Note"
 | 
|---|
| 8 |  W !?5,"options."
 | 
|---|
| 9 |  W !!?5,"To complete the conversion, use the RESTART option."
 | 
|---|
| 10 |  Q
 | 
|---|
| 11 |  ;
 | 
|---|
| 12 | FIX ;Will back records out of ^TIU(8925
 | 
|---|
| 13 |  ;TIU("HERE") must be set to the starting IEN 
 | 
|---|
| 14 |  S DIK="^TIU(8925,",CTR=0
 | 
|---|
| 15 |  S BK=TIU("HERE") F  S BK=$O(^TIU(8925,BK)) Q:'BK  D
 | 
|---|
| 16 |  . Q:$P(^TIU(8925,BK,13),U,3)'="C"
 | 
|---|
| 17 |  . S DA=BK D ^DIK S CTR=CTR+1
 | 
|---|
| 18 |  W !!,"COMPLETED... "_CTR_" RECORDS DELETED."
 | 
|---|
| 19 |  Q
 | 
|---|
| 20 |  ;
 | 
|---|
| 21 | PNHALT ;Options allows site to stop conversion
 | 
|---|
| 22 |  W !!?12,"****** REQUEST TO HALT CONVERSION ******",!
 | 
|---|
| 23 |  I '$P($G(^TIU(8925.97,1,0)),U,5)
 | 
|---|
| 24 |  I  W !!?5,"The Progress Note Conversion is not currently running.",! Q
 | 
|---|
| 25 |  I $P(^TIU(8925.97,1,2),U,3)>0
 | 
|---|
| 26 |  I  W !!?5,"Progress Note Conversion has been stopped."
 | 
|---|
| 27 |  I  W !?5,"Use the RESTART option to begin again.",! Q
 | 
|---|
| 28 |  W !! K DIR S DIR(0)="Y"
 | 
|---|
| 29 |  S DIR("A")="Do you want to HALT the Progress Note Conversion"
 | 
|---|
| 30 |  S DIR("B")="NO",DIR("?")="^D HALTHELP^TIUPNCV7" D ^DIR K DIR
 | 
|---|
| 31 |  I $D(DIRUT)!(Y=0) W !!?5,"Okay.  Conversion will continue to run.",! Q
 | 
|---|
| 32 |  S $P(^TIU(8925.97,1,2),U,3)=1
 | 
|---|
| 33 |  W !!?15,"!!!!!!!!  CONVERSION STOPPED !!!!!!!!",!
 | 
|---|
| 34 |  S TIUPNLST=$P(^TIU(8925.97,1,0),U,5)
 | 
|---|
| 35 |  W !?5,"Last Progress Note record processed is: ^GMR(121,"_TIUPNLST
 | 
|---|
| 36 |  K TIUPNLST
 | 
|---|
| 37 |  Q
 | 
|---|
| 38 |  ;
 | 
|---|
| 39 | HALTHELP ;Help Prompt for Halt action
 | 
|---|
| 40 |  W !!?5,"Answering ""YES"" to this question will stop the Progress Note"
 | 
|---|
| 41 |  W !?5,"Conversion before completion. ""NO"" will allow the conversion"
 | 
|---|
| 42 |  W !?5,"to continue.",!
 | 
|---|
| 43 |  Q
 | 
|---|
| 44 |  ;
 | 
|---|
| 45 | MONITOR ;Monitor progress notes conversion
 | 
|---|
| 46 |  ;
 | 
|---|
| 47 |  W !!?12,"****** MONITORING PROGRESS NOTE CONVERSION ******",!
 | 
|---|
| 48 |  I $P($G(^TIU(8925.97,1,0)),U,3)>0 D  Q
 | 
|---|
| 49 |  . W !?5,"This conversion has been run..."
 | 
|---|
| 50 |  . W !?5,"This option is only for use during the running of the Progress"
 | 
|---|
| 51 |  . W !?5,"Notes conversion from ^GMR(121 to ^TIU(8925."
 | 
|---|
| 52 |  . H 5 Q
 | 
|---|
| 53 |  ; 
 | 
|---|
| 54 | AGAIN ;Redisplay monitor information
 | 
|---|
| 55 |  N NODE,START,CURRENT,STIME,CNTR,ERRORS,TIME,ETIME,NTIME,BYE,PERMIN
 | 
|---|
| 56 |  N PERHR,MIN,NUM,LEFT,ESECS
 | 
|---|
| 57 |  D SETVAR
 | 
|---|
| 58 |  D DISPLAY
 | 
|---|
| 59 |  D RETURN Q:$D(BYE)
 | 
|---|
| 60 |  W @IOF W !!?12,"****  MONITORING PROGRESS NOTE CONVERSION  ****",!
 | 
|---|
| 61 |  G AGAIN
 | 
|---|
| 62 |  Q
 | 
|---|
| 63 |  ;
 | 
|---|
| 64 | SETVAR ;Using File ^TIU(8925.97, to set and compute variables
 | 
|---|
| 65 |  S NODE=^TIU(8925.97,1,0)
 | 
|---|
| 66 |  S START=$P(NODE,U,4),CURRENT=$P(NODE,U,5),STIME=$P(NODE,U,2)
 | 
|---|
| 67 |  S CNTR=$P(NODE,U,6),ERRORS=$P(NODE,U,7) S:ERRORS'>0 ERRORS=0
 | 
|---|
| 68 |  S TIME=$$FMTE^XLFDT(STIME,"1P")
 | 
|---|
| 69 |  S NTIME=$$NOW^XLFDT
 | 
|---|
| 70 |  S ETIME=$$FMDIFF^XLFDT(NTIME,STIME,3)
 | 
|---|
| 71 |  S ESECS=$$FMDIFF^XLFDT(NTIME,STIME,2)
 | 
|---|
| 72 |  S MIN=ESECS/60
 | 
|---|
| 73 |  S PERMIN=CNTR/+$S(MIN>0:MIN,1:1),PERHR=PERMIN*60
 | 
|---|
| 74 |  S NUM=$P(^GMR(121,0),U,4)-$P(^TIU(8925,0),U,4)
 | 
|---|
| 75 |  S LEFT=NUM/PERHR,DAYS=LEFT/24
 | 
|---|
| 76 |  S REMAIN1=$P(^GMR(121,0),U,4)-CURRENT ;in file
 | 
|---|
| 77 |  Q
 | 
|---|
| 78 |  ;
 | 
|---|
| 79 | DISPLAY ;Displays known information
 | 
|---|
| 80 |  W !?5,"  Conversion began:  ",TIME
 | 
|---|
| 81 |  W !?5,"   Starting record:  ",START
 | 
|---|
| 82 |  W !?5," Processing record:  ",CURRENT
 | 
|---|
| 83 |  W !?5," Records processed:  ",CNTR
 | 
|---|
| 84 |  W !?5,"Current # of error:  ",ERRORS
 | 
|---|
| 85 |  W !?5,"      Elapsed time:  ",ETIME
 | 
|---|
| 86 |  W !?5,"    Notes per hour:  ",$P(PERHR,".")
 | 
|---|
| 87 |  I LEFT>24 W !?5,"         Days left:  ",$E(DAYS,1,5)
 | 
|---|
| 88 |  E  W !?5,"        Hours left:  ",$E(LEFT,1,5)
 | 
|---|
| 89 |  W !!?2,"Notes left to convert:  ",REMAIN1
 | 
|---|
| 90 |  W !!
 | 
|---|
| 91 |  Q
 | 
|---|
| 92 |  ; 
 | 
|---|
| 93 | RETURN ;Issues RETURN prompt
 | 
|---|
| 94 |  N DIR,Y
 | 
|---|
| 95 |  F TIULN=1:1:(IOSL-$Y-4) W !
 | 
|---|
| 96 |  S DIR(0)="E" D ^DIR I $D(DIRUT) S BYE=1 Q
 | 
|---|
| 97 |  Q
 | 
|---|
| 98 |  ;
 | 
|---|