Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: TIUDCT

TIUDCT.m

Go to the documentation of this file.
  1. TIUDCT ;BPOIFO/JLTP/EL - Dictation of Progress Notes ;04/11/2016
  1. ;;1.0;TEXT INTEGRATION UTILITIES;**297**;JUN 20, 1997;Build 40
  1. ;
  1. DICTATE(TIUDA) ; Check document for TO BE DICTATED
  1. ; Called from TIULP
  1. N CNT,EMSG,TBD,TIUI,TIUINST,TIUOK,TIUQUIT,X
  1. S (EMSG,TBD,TIUINST,TIUOK,X)=""
  1. S (CNT,TIUI,TIUQUIT)=0
  1. S TBD="BEGIN-DICTATION"
  1. I '$D(^TIU(8925,TIUDA)) D Q TIUOK
  1. . S EMSG="TIU Document File entry (#"_TIUDA_") does not exist."
  1. . S TIUOK="0^"_EMSG
  1. F S TIUI=$O(^TIU(8925,TIUDA,"TEXT",TIUI)) Q:'TIUI!(TIUQUIT)!(CNT) D
  1. . I $$UP^XLFSTR($G(^TIU(8925,TIUDA,"TEXT",TIUI,0)))[TBD S (TIUOK,TIUQUIT)=1
  1. . S CNT=CNT+1
  1. Q:'TIUOK "" ; TO BE DICTATED not found on first line of document.
  1. ;
  1. S X=+$G(DUZ(2)),TIUINST=+$O(^TIU(8925.99,"B",X,0))
  1. ; Check to See Whether Dictation Control is Enabled
  1. S TIUOK=+$P($G(^TIU(8925.99,+TIUINST,0)),U,23)
  1. Q:'TIUOK "" ; Dictation Control Is Disabled
  1. I '$D(^XUSEC("TIUDCT",DUZ)) D Q TIUOK ; User doesn't have access
  1. . S EMSG="You are not a holder of the TIUDCT security key."
  1. . S TIUOK="0^"_EMSG
  1. I '$D(^TIU(8925.99,TIUINST,6)) D Q TIUOK ; Dictation Instruction Setup
  1. . S EMSG="The Dictation Instruction in TIU Parameters File has not been setup."
  1. . S TIUOK="0^"_EMSG
  1. Q TIUOK
  1. ;
  1. UPDATE(TIUDA) ; Update progress note with dictation instructions
  1. ; Called from TIULP
  1. N EMSG,FDA,I,TIUERR,TIUINST,TIUL5,TIUOK,X
  1. S (EMSG,I,TIUINST,TIUL5,TIUOK,X)=""
  1. S TIUOK=1
  1. ;
  1. S TIUL5=$$TIUL5(TIUDA),X=+$G(DUZ(2))
  1. S TIUINST=+$O(^TIU(8925.99,"B",X,0)) Q:'TIUINST 0
  1. K ^TMP("TIUDCT",$J)
  1. S I=0
  1. F S I=$O(^TIU(8925.99,TIUINST,6,I)) Q:$G(I)="" D
  1. . S X=$G(^TIU(8925.99,TIUINST,6,I,0))
  1. . S ^TMP("TIUDCT",$J,I)=$$FILL(X)
  1. D WP^DIE(8925,TIUDA_",",2,"K","^TMP(""TIUDCT"",$J)","TIUERR")
  1. K ^TMP("TIUDCT")
  1. I $D(TIUERR) D Q TIUOK
  1. . S EMSG="Error during replacing NOTE entry (#"_$G(TIUDA)_") with Dictation Instruction."
  1. . S TIUOK="0^"_EMSG
  1. ;
  1. ; Set status to "undictated"
  1. S FDA(8925,TIUDA_",",.05)=1
  1. D FILE^DIE("K","FDA","TIUERR")
  1. I $D(TIUERR) D Q TIUOK
  1. . S EMSG="Error during updating STATUS in TIU Document File entry (#"_$G(TIUDA)_")."
  1. . S TIUOK="0^"_EMSG
  1. ;
  1. D ALERTDEL^TIUALRT(TIUDA)
  1. S TIUOK=1
  1. Q TIUOK
  1. ;
  1. TIUL5(X) ; Only last five digits of record # as document number
  1. N L,Z
  1. 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))
  1. Q X
  1. ;
  1. FILL(X) ; Fill in local variables
  1. N VAR
  1. F Q:X'["|" S VAR=$P(X,"|",2) D S X=$P(X,"|")_VAR_$P(X,"|",3,255)
  1. . I $L($G(VAR)) D
  1. . . I $G(@VAR)'="" S VAR=$G(@VAR)
  1. . . E S VAR="("_VAR_" is not defined)"
  1. Q X