- TIUDCT ;BPOIFO/JLTP/EL - Dictation of Progress Notes ;04/11/2016
- ;;1.0;TEXT INTEGRATION UTILITIES;**297**;JUN 20, 1997;Build 40
- ;
- DICTATE(TIUDA) ; Check document for TO BE DICTATED
- ; Called from TIULP
- N CNT,EMSG,TBD,TIUI,TIUINST,TIUOK,TIUQUIT,X
- S (EMSG,TBD,TIUINST,TIUOK,X)=""
- S (CNT,TIUI,TIUQUIT)=0
- S TBD="BEGIN-DICTATION"
- I '$D(^TIU(8925,TIUDA)) D Q TIUOK
- . S EMSG="TIU Document File entry (#"_TIUDA_") does not exist."
- . S TIUOK="0^"_EMSG
- F S TIUI=$O(^TIU(8925,TIUDA,"TEXT",TIUI)) Q:'TIUI!(TIUQUIT)!(CNT) D
- . I $$UP^XLFSTR($G(^TIU(8925,TIUDA,"TEXT",TIUI,0)))[TBD S (TIUOK,TIUQUIT)=1
- . S CNT=CNT+1
- Q:'TIUOK "" ; TO BE DICTATED not found on first line of document.
- ;
- S X=+$G(DUZ(2)),TIUINST=+$O(^TIU(8925.99,"B",X,0))
- ; Check to See Whether Dictation Control is Enabled
- S TIUOK=+$P($G(^TIU(8925.99,+TIUINST,0)),U,23)
- Q:'TIUOK "" ; Dictation Control Is Disabled
- I '$D(^XUSEC("TIUDCT",DUZ)) D Q TIUOK ; User doesn't have access
- . S EMSG="You are not a holder of the TIUDCT security key."
- . S TIUOK="0^"_EMSG
- I '$D(^TIU(8925.99,TIUINST,6)) D Q TIUOK ; Dictation Instruction Setup
- . S EMSG="The Dictation Instruction in TIU Parameters File has not been setup."
- . S TIUOK="0^"_EMSG
- Q TIUOK
- ;
- UPDATE(TIUDA) ; Update progress note with dictation instructions
- ; Called from TIULP
- N EMSG,FDA,I,TIUERR,TIUINST,TIUL5,TIUOK,X
- S (EMSG,I,TIUINST,TIUL5,TIUOK,X)=""
- S TIUOK=1
- ;
- S TIUL5=$$TIUL5(TIUDA),X=+$G(DUZ(2))
- S TIUINST=+$O(^TIU(8925.99,"B",X,0)) Q:'TIUINST 0
- K ^TMP("TIUDCT",$J)
- S I=0
- F S I=$O(^TIU(8925.99,TIUINST,6,I)) Q:$G(I)="" D
- . S X=$G(^TIU(8925.99,TIUINST,6,I,0))
- . S ^TMP("TIUDCT",$J,I)=$$FILL(X)
- D WP^DIE(8925,TIUDA_",",2,"K","^TMP(""TIUDCT"",$J)","TIUERR")
- K ^TMP("TIUDCT")
- I $D(TIUERR) D Q TIUOK
- . S EMSG="Error during replacing NOTE entry (#"_$G(TIUDA)_") with Dictation Instruction."
- . S TIUOK="0^"_EMSG
- ;
- ; Set status to "undictated"
- S FDA(8925,TIUDA_",",.05)=1
- D FILE^DIE("K","FDA","TIUERR")
- I $D(TIUERR) D Q TIUOK
- . S EMSG="Error during updating STATUS in TIU Document File entry (#"_$G(TIUDA)_")."
- . S TIUOK="0^"_EMSG
- ;
- D ALERTDEL^TIUALRT(TIUDA)
- S TIUOK=1
- Q TIUOK
- ;
- TIUL5(X) ; Only last five digits of record # as document number
- N L,Z
- S Z="00000",L=$L(X),X=$S(L<5:$E(Z,1,5-L)_X,L=5:X,1:$E(X,L-4,L))
- Q X
- ;
- FILL(X) ; Fill in local variables
- N VAR
- F Q:X'["|" S VAR=$P(X,"|",2) D S X=$P(X,"|")_VAR_$P(X,"|",3,255)
- . I $L($G(VAR)) D
- . . I $G(@VAR)'="" S VAR=$G(@VAR)
- . . E S VAR="("_VAR_" is not defined)"
- Q X
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HTIUDCT 2565 printed Feb 19, 2025@00:06:05 Page 2
- TIUDCT ;BPOIFO/JLTP/EL - Dictation of Progress Notes ;04/11/2016
- +1 ;;1.0;TEXT INTEGRATION UTILITIES;**297**;JUN 20, 1997;Build 40
- +2 ;
- DICTATE(TIUDA) ; Check document for TO BE DICTATED
- +1 ; Called from TIULP
- +2 NEW CNT,EMSG,TBD,TIUI,TIUINST,TIUOK,TIUQUIT,X
- +3 SET (EMSG,TBD,TIUINST,TIUOK,X)=""
- +4 SET (CNT,TIUI,TIUQUIT)=0
- +5 SET TBD="BEGIN-DICTATION"
- +6 IF '$DATA(^TIU(8925,TIUDA))
- Begin DoDot:1
- +7 SET EMSG="TIU Document File entry (#"_TIUDA_") does not exist."
- +8 SET TIUOK="0^"_EMSG
- End DoDot:1
- QUIT TIUOK
- +9 FOR
- SET TIUI=$ORDER(^TIU(8925,TIUDA,"TEXT",TIUI))
- if 'TIUI!(TIUQUIT)!(CNT)
- QUIT
- Begin DoDot:1
- +10 IF $$UP^XLFSTR($GET(^TIU(8925,TIUDA,"TEXT",TIUI,0)))[TBD
- SET (TIUOK,TIUQUIT)=1
- +11 SET CNT=CNT+1
- End DoDot:1
- +12 ; TO BE DICTATED not found on first line of document.
- if 'TIUOK
- QUIT ""
- +13 ;
- +14 SET X=+$GET(DUZ(2))
- SET TIUINST=+$ORDER(^TIU(8925.99,"B",X,0))
- +15 ; Check to See Whether Dictation Control is Enabled
- +16 SET TIUOK=+$PIECE($GET(^TIU(8925.99,+TIUINST,0)),U,23)
- +17 ; Dictation Control Is Disabled
- if 'TIUOK
- QUIT ""
- +18 ; User doesn't have access
- IF '$DATA(^XUSEC("TIUDCT",DUZ))
- Begin DoDot:1
- +19 SET EMSG="You are not a holder of the TIUDCT security key."
- +20 SET TIUOK="0^"_EMSG
- End DoDot:1
- QUIT TIUOK
- +21 ; Dictation Instruction Setup
- IF '$DATA(^TIU(8925.99,TIUINST,6))
- Begin DoDot:1
- +22 SET EMSG="The Dictation Instruction in TIU Parameters File has not been setup."
- +23 SET TIUOK="0^"_EMSG
- End DoDot:1
- QUIT TIUOK
- +24 QUIT TIUOK
- +25 ;
- UPDATE(TIUDA) ; Update progress note with dictation instructions
- +1 ; Called from TIULP
- +2 NEW EMSG,FDA,I,TIUERR,TIUINST,TIUL5,TIUOK,X
- +3 SET (EMSG,I,TIUINST,TIUL5,TIUOK,X)=""
- +4 SET TIUOK=1
- +5 ;
- +6 SET TIUL5=$$TIUL5(TIUDA)
- SET X=+$GET(DUZ(2))
- +7 SET TIUINST=+$ORDER(^TIU(8925.99,"B",X,0))
- if 'TIUINST
- QUIT 0
- +8 KILL ^TMP("TIUDCT",$JOB)
- +9 SET I=0
- +10 FOR
- SET I=$ORDER(^TIU(8925.99,TIUINST,6,I))
- if $GET(I)=""
- QUIT
- Begin DoDot:1
- +11 SET X=$GET(^TIU(8925.99,TIUINST,6,I,0))
- +12 SET ^TMP("TIUDCT",$JOB,I)=$$FILL(X)
- End DoDot:1
- +13 DO WP^DIE(8925,TIUDA_",",2,"K","^TMP(""TIUDCT"",$J)","TIUERR")
- +14 KILL ^TMP("TIUDCT")
- +15 IF $DATA(TIUERR)
- Begin DoDot:1
- +16 SET EMSG="Error during replacing NOTE entry (#"_$GET(TIUDA)_") with Dictation Instruction."
- +17 SET TIUOK="0^"_EMSG
- End DoDot:1
- QUIT TIUOK
- +18 ;
- +19 ; Set status to "undictated"
- +20 SET FDA(8925,TIUDA_",",.05)=1
- +21 DO FILE^DIE("K","FDA","TIUERR")
- +22 IF $DATA(TIUERR)
- Begin DoDot:1
- +23 SET EMSG="Error during updating STATUS in TIU Document File entry (#"_$GET(TIUDA)_")."
- +24 SET TIUOK="0^"_EMSG
- End DoDot:1
- QUIT TIUOK
- +25 ;
- +26 DO ALERTDEL^TIUALRT(TIUDA)
- +27 SET TIUOK=1
- +28 QUIT TIUOK
- +29 ;
- TIUL5(X) ; Only last five digits of record # as document number
- +1 NEW L,Z
- +2 SET Z="00000"
- SET L=$LENGTH(X)
- SET X=$SELECT(L<5:$EXTRACT(Z,1,5-L)_X,L=5:X,1:$EXTRACT(X,L-4,L))
- +3 QUIT X
- +4 ;
- FILL(X) ; Fill in local variables
- +1 NEW VAR
- +2 FOR
- if X'["|"
- QUIT
- SET VAR=$PIECE(X,"|",2)
- Begin DoDot:1
- +3 IF $LENGTH($GET(VAR))
- Begin DoDot:2
- +4 IF $GET(@VAR)'=""
- SET VAR=$GET(@VAR)
- +5 IF '$TEST
- SET VAR="("_VAR_" is not defined)"
- End DoDot:2
- End DoDot:1
- SET X=$PIECE(X,"|")_VAR_$PIECE(X,"|",3,255)
- +6 QUIT X