- TIUPNCV4 ;SLC/DJP ;2/26/98 13:30
- ;;1.0;TEXT INTEGRATION UTILITIES;**9**;Jun 20, 1997
- ;
- ENTRY ;Entry point to set-up conversion
- N DIC,TIUQUEUE
- I $G(DUZ)'>0 W !!,"DUZ must be defined as an active user!",! Q
- S TIU("DUZ")=DUZ
- D INTRO^TIUPNCV5 I $G(TIU("QUIT")) K TIU Q
- I $P($G(^TIU(8925.97,1,0)),U,3) W !!,"Conversion has been completed.",! K TIU Q
- W ! S DIR(0)="Y",DIR("A")="Are you sure everything is okay"
- S DIR("B")="NO",DIR("?")="^D HELP1^TIUPNCV4" D ^DIR Q:$D(DIRUT)!(Y=0)
- S TIUQUEUE=$$READ^TIUU("Y","Would you like to QUEUE this Process","NO")
- I +TIUQUEUE D PNDEVICE Q
- W !!?9,$C(7),"Progress Notes Conversion Running in Foreground",!
- D DRIVER^TIUPNCV
- Q
- ;
- PNDEVICE ;Permits site to queue conversion
- N %,ZTDTH,ZTDESC,ZTIO,ZTSAVE,ZTSK,ZTRTN
- S ZTSAVE("TIU*")="",ZTSAVE("GMRP*")=""
- S:'$D(ZTDESC) ZTDESC="TIU PN CONVERSION"
- S ZTRTN="DRIVER^TIUPNCV",ZTIO="" D ^%ZTLOAD
- W !,$S($D(ZTSK):"Request Queued!",1:"Request Cancelled."),!
- D ^%ZISC
- Q
- ;
- REPORT ;sends bulletin to initiator of conversion
- I '$D(TIUUSER) S TIUUSER=DUZ
- S XMY(TIUUSER)=""
- S XMB="TIU PRN CONVERSION "_$S(GMRPCTR:"ERRORS",1:"CLEAN")
- S XMDUZ="TIU PROGRESS NOTE CONVERSION"
- S XMB(1)=TIUSTRT,XMB(2)=TIUEND,XMB(3)=TIUCTR
- I ERRCTR S XMB(4)=ERRCTR,XMTEXT="^GMR(121,""ERROR"","
- D ^XMB,KILL^XM K TIUEND,TIUSTRT,ERRCTR
- Q
- ;
- RESTART ;Permit restarting of conversion from last successfully processed note.
- W !
- K DIR W @IOF
- W !!?10,"****** RESTART PROGRESS NOTE/TIU CONVERSION ******",!!
- S GMRPST1=$P($G(^TIU(8925.97,1,0)),U,5)
- I GMRPST1'>0 W !?5,"Conversion has NOT been previously run",!?5,"Please use the CONVERT PROGRESS NOTE option." K GMRPST1 Q
- K DIR S DIR(0)="Y",DIR("A")="Do you wish to restart the conversion"
- S DIR("B")="YES",DIR("?")="^D HELP2^TIUPNCV4" D ^DIR Q:$D(DIRUT)!(Y=0)
- W !!?5,"A mail message documenting discrepancies encountered during "
- W !,?5,"processing will be sent to you.",!
- S TIU("DUZ")=DUZ
- D MAIL^TIUPNCV5
- S GMRPST=(GMRPST1+1)
- W !!,"Restarting Progress Note Conversion at Record #"_GMRPST_"...",!
- S $P(^TIU(8925.97,1,0),U,3)=""
- S GMRPST=(GMRPST-1),RESTARTD=$$NOW^XLFDT
- S ^GMR(121,"RESTART",GMRPST)=RESTARTD ;Records restart date/time
- S ZTDESC="RESTART PN CONVERSION"
- D PNDEVICE
- Q
- ;
- INDY ;Converts individual Progress Notes based on IEN in ^GMR(121
- S TIUFPRIV=1
- W @IOF W !!?18,"***** INDIVIDUAL RECORD CONVERSION *****",!
- ;
- ENINDY ;Entry of IEN
- K DIR S DIR(0)="NO^1:9999999"
- S DIR("A")="Enter IEN of Note to be converted"
- S DIR("?")="^D HELP4^TIUPNCV4" D ^DIR I $D(DIRUT) K DIR Q
- I '$D(^GMR(121,Y)) W !,"Entry ",Y," not found in file 121",$C(7) G ENINDY
- I +$P($G(^GMR(121,Y,1)),U,3)&($P($G(^GMR(121,Y,5)),U)=1) S TIUECS=$$ASKCOS^TIUPNCVU Q:'TIUECS ;If signed and uncosigned need to ask for expected cosigner, quit if none entered.
- ;
- EMERG ;Emergency entrance - must pass "Y" and "EMER"
- S GMRPIFN=Y,TIU("INDY")=1,GMRPCTR=0,TIUCTR=0
- I $D(^GMR(121,"CNV",GMRPIFN)) W !?5,"Progress Note IEN "_GMRPIFN_" was converted in a prior session.",! K GMRPIFN,TIU("INDY") G ENINDY:'$D(EMER)
- S NEWNODE=1 W:'$D(EMER) !!?5,"Now converting Progress Note "_GMRPIFN_"...",!
- D MAIN^TIUPNCV8
- I '$D(^GMR(121,"CNV",GMRPIFN)),$D(^GMR(121,"ERROR",GMRPIFN)) D G KILINDY
- . W !!,"*****Progress Note "_GMRPIFN_" NOT converted*****",!
- . W ^GMR(121,"ERROR",GMRPIFN),!
- W:'$D(EMER) !,"Progress Note "_GMRPIFN_" successfully converted",!
- ;
- KILINDY ;Cleans up the debris
- K GMRPIFN,TIU("INDY"),DIR,NEWNODE,BADREC,TIUCTR
- I $D(EMER) Q
- G ENINDY
- ;
- HELP1 ;Help for are you sure prompt
- W !!,"Enter Yes if you're ready to start the conversion."
- W !,"Press return or enter NO to stop this process."
- Q
- HELP2 ;Help for RESTART prompt
- W !!?5,"Enter YES to re-start/re-queue the conversion."
- W !?5,"Press <ret> or enter NO to stop this option."
- Q
- ;
- HELP3 ;Help for IEN prompt
- W !!?5,"The default is the next expected Internal File Number (IEN)"
- W " for a note."
- W !?5,"If another starting point is required, enter the IEN for that"
- W " note."
- W !?5,"Enter ""^"" to stop option without processing."
- Q
- ;
- HELP4 ;Help for INDY prompt
- W !!?5,"Enter the Internal Entry Number (IEN) of the single Progress"
- W !?5,"you wish to convert to TIU.",!
- Q
- ;
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HTIUPNCV4 4271 printed Feb 19, 2025@00:09:47 Page 2
- TIUPNCV4 ;SLC/DJP ;2/26/98 13:30
- +1 ;;1.0;TEXT INTEGRATION UTILITIES;**9**;Jun 20, 1997
- +2 ;
- ENTRY ;Entry point to set-up conversion
- +1 NEW DIC,TIUQUEUE
- +2 IF $GET(DUZ)'>0
- WRITE !!,"DUZ must be defined as an active user!",!
- QUIT
- +3 SET TIU("DUZ")=DUZ
- +4 DO INTRO^TIUPNCV5
- IF $GET(TIU("QUIT"))
- KILL TIU
- QUIT
- +5 IF $PIECE($GET(^TIU(8925.97,1,0)),U,3)
- WRITE !!,"Conversion has been completed.",!
- KILL TIU
- QUIT
- +6 WRITE !
- SET DIR(0)="Y"
- SET DIR("A")="Are you sure everything is okay"
- +7 SET DIR("B")="NO"
- SET DIR("?")="^D HELP1^TIUPNCV4"
- DO ^DIR
- if $DATA(DIRUT)!(Y=0)
- QUIT
- +8 SET TIUQUEUE=$$READ^TIUU("Y","Would you like to QUEUE this Process","NO")
- +9 IF +TIUQUEUE
- DO PNDEVICE
- QUIT
- +10 WRITE !!?9,$CHAR(7),"Progress Notes Conversion Running in Foreground",!
- +11 DO DRIVER^TIUPNCV
- +12 QUIT
- +13 ;
- PNDEVICE ;Permits site to queue conversion
- +1 NEW %,ZTDTH,ZTDESC,ZTIO,ZTSAVE,ZTSK,ZTRTN
- +2 SET ZTSAVE("TIU*")=""
- SET ZTSAVE("GMRP*")=""
- +3 if '$DATA(ZTDESC)
- SET ZTDESC="TIU PN CONVERSION"
- +4 SET ZTRTN="DRIVER^TIUPNCV"
- SET ZTIO=""
- DO ^%ZTLOAD
- +5 WRITE !,$SELECT($DATA(ZTSK):"Request Queued!",1:"Request Cancelled."),!
- +6 DO ^%ZISC
- +7 QUIT
- +8 ;
- REPORT ;sends bulletin to initiator of conversion
- +1 IF '$DATA(TIUUSER)
- SET TIUUSER=DUZ
- +2 SET XMY(TIUUSER)=""
- +3 SET XMB="TIU PRN CONVERSION "_$SELECT(GMRPCTR:"ERRORS",1:"CLEAN")
- +4 SET XMDUZ="TIU PROGRESS NOTE CONVERSION"
- +5 SET XMB(1)=TIUSTRT
- SET XMB(2)=TIUEND
- SET XMB(3)=TIUCTR
- +6 IF ERRCTR
- SET XMB(4)=ERRCTR
- SET XMTEXT="^GMR(121,""ERROR"","
- +7 DO ^XMB
- DO KILL^XM
- KILL TIUEND,TIUSTRT,ERRCTR
- +8 QUIT
- +9 ;
- RESTART ;Permit restarting of conversion from last successfully processed note.
- +1 WRITE !
- +2 KILL DIR
- WRITE @IOF
- +3 WRITE !!?10,"****** RESTART PROGRESS NOTE/TIU CONVERSION ******",!!
- +4 SET GMRPST1=$PIECE($GET(^TIU(8925.97,1,0)),U,5)
- +5 IF GMRPST1'>0
- WRITE !?5,"Conversion has NOT been previously run",!?5,"Please use the CONVERT PROGRESS NOTE option."
- KILL GMRPST1
- QUIT
- +6 KILL DIR
- SET DIR(0)="Y"
- SET DIR("A")="Do you wish to restart the conversion"
- +7 SET DIR("B")="YES"
- SET DIR("?")="^D HELP2^TIUPNCV4"
- DO ^DIR
- if $DATA(DIRUT)!(Y=0)
- QUIT
- +8 WRITE !!?5,"A mail message documenting discrepancies encountered during "
- +9 WRITE !,?5,"processing will be sent to you.",!
- +10 SET TIU("DUZ")=DUZ
- +11 DO MAIL^TIUPNCV5
- +12 SET GMRPST=(GMRPST1+1)
- +13 WRITE !!,"Restarting Progress Note Conversion at Record #"_GMRPST_"...",!
- +14 SET $PIECE(^TIU(8925.97,1,0),U,3)=""
- +15 SET GMRPST=(GMRPST-1)
- SET RESTARTD=$$NOW^XLFDT
- +16 ;Records restart date/time
- SET ^GMR(121,"RESTART",GMRPST)=RESTARTD
- +17 SET ZTDESC="RESTART PN CONVERSION"
- +18 DO PNDEVICE
- +19 QUIT
- +20 ;
- INDY ;Converts individual Progress Notes based on IEN in ^GMR(121
- +1 SET TIUFPRIV=1
- +2 WRITE @IOF
- WRITE !!?18,"***** INDIVIDUAL RECORD CONVERSION *****",!
- +3 ;
- ENINDY ;Entry of IEN
- +1 KILL DIR
- SET DIR(0)="NO^1:9999999"
- +2 SET DIR("A")="Enter IEN of Note to be converted"
- +3 SET DIR("?")="^D HELP4^TIUPNCV4"
- DO ^DIR
- IF $DATA(DIRUT)
- KILL DIR
- QUIT
- +4 IF '$DATA(^GMR(121,Y))
- WRITE !,"Entry ",Y," not found in file 121",$CHAR(7)
- GOTO ENINDY
- +5 ;If signed and uncosigned need to ask for expected cosigner, quit if none entered.
- IF +$PIECE($GET(^GMR(121,Y,1)),U,3)&($PIECE($GET(^GMR(121,Y,5)),U)=1)
- SET TIUECS=$$ASKCOS^TIUPNCVU
- if 'TIUECS
- QUIT
- +6 ;
- EMERG ;Emergency entrance - must pass "Y" and "EMER"
- +1 SET GMRPIFN=Y
- SET TIU("INDY")=1
- SET GMRPCTR=0
- SET TIUCTR=0
- +2 IF $DATA(^GMR(121,"CNV",GMRPIFN))
- WRITE !?5,"Progress Note IEN "_GMRPIFN_" was converted in a prior session.",!
- KILL GMRPIFN,TIU("INDY")
- if '$DATA(EMER)
- GOTO ENINDY
- +3 SET NEWNODE=1
- if '$DATA(EMER)
- WRITE !!?5,"Now converting Progress Note "_GMRPIFN_"...",!
- +4 DO MAIN^TIUPNCV8
- +5 IF '$DATA(^GMR(121,"CNV",GMRPIFN))
- IF $DATA(^GMR(121,"ERROR",GMRPIFN))
- Begin DoDot:1
- +6 WRITE !!,"*****Progress Note "_GMRPIFN_" NOT converted*****",!
- +7 WRITE ^GMR(121,"ERROR",GMRPIFN),!
- End DoDot:1
- GOTO KILINDY
- +8 if '$DATA(EMER)
- WRITE !,"Progress Note "_GMRPIFN_" successfully converted",!
- +9 ;
- KILINDY ;Cleans up the debris
- +1 KILL GMRPIFN,TIU("INDY"),DIR,NEWNODE,BADREC,TIUCTR
- +2 IF $DATA(EMER)
- QUIT
- +3 GOTO ENINDY
- +4 ;
- HELP1 ;Help for are you sure prompt
- +1 WRITE !!,"Enter Yes if you're ready to start the conversion."
- +2 WRITE !,"Press return or enter NO to stop this process."
- +3 QUIT
- HELP2 ;Help for RESTART prompt
- +1 WRITE !!?5,"Enter YES to re-start/re-queue the conversion."
- +2 WRITE !?5,"Press <ret> or enter NO to stop this option."
- +3 QUIT
- +4 ;
- HELP3 ;Help for IEN prompt
- +1 WRITE !!?5,"The default is the next expected Internal File Number (IEN)"
- +2 WRITE " for a note."
- +3 WRITE !?5,"If another starting point is required, enter the IEN for that"
- +4 WRITE " note."
- +5 WRITE !?5,"Enter ""^"" to stop option without processing."
- +6 QUIT
- +7 ;
- HELP4 ;Help for INDY prompt
- +1 WRITE !!?5,"Enter the Internal Entry Number (IEN) of the single Progress"
- +2 WRITE !?5,"you wish to convert to TIU.",!
- +3 QUIT
- +4 ;