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

TIUEDIM.m

Go to the documentation of this file.
  1. TIUEDIM ; SLC/JER - Enter/Edit Multiple Document ;01-Aug-2011 11:26;MGH
  1. ;;1.0;TEXT INTEGRATION UTILITIES;**7,41,52,100,109,112,1009**;Jun 20, 1997;Build 22
  1. ; 2/2: Update DIE from TIUEDIT to TIUEDI4
  1. ;IHS/ITSC/LJF 02/26/2003 added call to stuff V Note file
  1. ; added call to edit PCC visit
  1. ; 12/11/2003 review previous notes works for all notes
  1. MAIN(TIUCLASS,TIUOUT,TIUNDA,TIUCHNG) ; Control Branching
  1. N TIUREL,TIUCHK,TIUDA,TIUEDIT,TIUY,TIUNEW,TIUTYP,TIUPAT
  1. N TIUI,DTOUT S TIUDFLT=""
  1. K DIROUT
  1. ; --- Get one or more patients ---
  1. I '$L($T(PATIENT^ORU1)) Q
  1. D PATIENT^ORU1(.TIUPAT) I +TIUPAT'>0 S TIUOUT=1 Q
  1. S TIUI=0 F S TIUI=+$O(TIUPAT(TIUI)) Q:+TIUI'>0!+$G(TIUOUT) D
  1. . N DFN,DUOUT,TIUDPRM,TIU,TIULMETH,TIUVMETH,VAIN,VADM,TIUDA,TIUEDIT
  1. . N TIUENTRY,TIUCMMTX,TIUVSUPP,CANEDIT
  1. . S TIUVSUPP=0
  1. . S DFN=+$G(TIUPAT(TIUI)) Q:+DFN'>0
  1. . W !!,"For Patient ",$P(TIUPAT(TIUI),U,2)
  1. . S TIUCLASS=$G(TIUCLASS,38)
  1. . ;
  1. . ;I TIUCLASS=3,$S(+$$ISA^USRLM(DUZ,"TRANSCRIPTIONIST"):0,1:1),(+$G(NOSAVE)'>0) D EXSTNOTE^TIUEDI2(DFN) D:$G(VALMAR)="^TMP(""OR"",$J,""CURRENT"")" FULL^VALM1
  1. . I $S(+$$ISA^USRLM(DUZ,"TRANSCRIPTIONIST"):0,1:1),(+$G(NOSAVE)'>0) D EXSTNOTE^TIUEDI2(DFN) D:$G(VALMAR)="^TMP(""OR"",$J,""CURRENT"")" FULL^VALM1
  1. . I +$G(DIROUT)!+$G(DUOUT)!+$G(DTOUT) S TIUOUT=1 Q
  1. . ; -- Set title array TIUTYP (use TIUTITLE or ask user) --
  1. . D SETTL^TIUEDI4(.TIUTYP,TIUCLASS,$G(TIUTITLE)) I +$G(TIUTYP)'>0 S TIUOUT=1 Q
  1. . ; --- Re-direct surgical reports ---
  1. . I +$$ISA^TIULX(TIUTYP,+$$CLASS^TIUSROI("SURGICAL REPORTS")) D ENTEROP^TIUSROI(DFN,TIUTYP) Q
  1. . ; -- Get doc parameters for title, X entry action --
  1. . D DOCPRM^TIULC1(TIUTYP,.TIUDPRM)
  1. . S TIUENTRY=$$GETENTRY^TIUEDI2(+TIUTYP)
  1. . I $L(TIUENTRY) X TIUENTRY
  1. . Q:+$G(TIUOUT) ; If ENTRY ACTION sets TIUOUT=1 Abort Entry
  1. . ; -- Set visit array TIU --
  1. . ; NOTE: EVNTFLAG is set in TIUEDIT, prior to calling this routine
  1. . D GETVST^TIUEDI4(DFN,TIUTYP,.TIU,EVNTFLAG)
  1. . I $S($G(TIUQUIT):1,'$D(TIU("VSTR")):1,1:0) Q
  1. . ; -- Ask OK --
  1. . S TIUVMETH=$$GETVMETH^TIUEDI1(TIUTYP)
  1. . I '$L(TIUVMETH) D S TIUOUT=1 Q
  1. . . W !,$C(7),"No Validation Method defined for "
  1. . . W $$PNAME^TIULC1(TIUTYP),".",!,"Please contact IRM..."
  1. . X TIUVMETH
  1. . I $S($D(DIROUT):1,$D(DTOUT):1,1:0) S TIUQUIT=1 Q
  1. . ;
  1. . ;I $D(DUOUT) Q ;IHS/ITSC/LJF 02/26/2003 original
  1. . I $S('$D(TIU("VISIT")):1,$D(DUOUT):1,1:0) D Q ;IHS/ITSC/LJF 02/26/2003 if no visit or ^
  1. . . W !,$C(7),"Visit required to continue." H 2 ;IHS/ITSC/LJF 02/26/2003 give explanation for quitting
  1. . D VEDIT^BTIUED("") ;IHS/ITSC/LJF 02/26/2003 added call to edit PCC visit
  1. . ;
  1. . ; -- If user OK'd basic info, go on to get text, etc.: --
  1. . I $D(TIU),+$G(TIUASK) D
  1. . . ; -- Get record DA --
  1. . . ; DA is either: new stub record, ready for edit, or
  1. . . ; existing record, for edit, or
  1. . . ; existing record, for addendum
  1. . . N DA
  1. . . S DA=$$GETRECNW^TIUEDI3(DFN,.TIU,TIUTYP(1),.TIUNEW,.TIUDPRM,1,DUZ,.CANEDIT)
  1. . . I +DA'>0 W !,"Unable to enter/edit." Q
  1. . . ; -- [Addend DA and Quit] --
  1. . . ; If record not new & user can't edit it, user said
  1. . . ; in GETRECNW they wanted to addend, so let user write
  1. . . ; addendum and quit:
  1. . . I 'TIUNEW,'CANEDIT D ADDENDUM^TIUADD(DA,"",.TIUCHNG,1) Q
  1. . . N TIUQUIT,TIUADD,TIUTDA
  1. . . ; -- Edit new or existing DA --
  1. . . D DIE^TIUEDI4(DA,.TIUQUIT)
  1. . . Q:+$G(TIUQUIT)=2 ; DA doesn't exist (e.g. uparrowed w/ bad record)
  1. . . ;If (CP) and (Timeout or Not Select Consult) and (Consult Associated), Quit before EMPTYDOC check
  1. . . I +$$ISA^TIULX(TIUTYP,+$$CLASS^TIUCP),+$G(TIUQUIT)=1,+$P($G(^TIU(8925,+DA,14)),U,5)>0 Q
  1. . . I $$EMPTYDOC^TIULF(DA) D DELETE^TIUEDIT(DA,0) S:$G(VALMAR)="^TMP(""TIUVIEW"",$J)" VALMBCK="Q" S:'+$G(TIUNEW) TIUCHNG("DELETE")=1 H:'+$G(TIUNEW) 2 Q
  1. . . Q:+$G(TIUQUIT)
  1. . . S:+DA SUCCESS=+DA
  1. . . I +$G(TIUONCE) S TIUNDA(+$G(DA))="" ; See TIURC, Across Patients
  1. . . ; -- Misc after-edit-stuff for DA --
  1. . . ; -- Mark to ask workload at signature;
  1. . . ; (STOP for Stop codes for stand-alone visits): --
  1. . . I +$G(TIU("STOP")),(+$P($G(TIUDPRM(0)),U,14)'=1) D DEFER^TIUVSIT(DA,TIU("STOP")) I 1
  1. . . E D QUE^TIUPXAP1 ; Post workload now in background
  1. . . S TIUCMMTX=$$COMMIT^TIULC1(+$P(TIUTYP(1),U,2))
  1. . . I TIUCMMTX]"" X TIUCMMTX
  1. . . ;
  1. . . ; -- Link PN to VNote file --
  1. . . D VNOTE^BTIUPCC(DA,TIU("VISIT"),DFN,"ADD") ;IHS/ITSC/LJF 02/26/2003
  1. . . ;
  1. . . D RELEASE^TIUT(DA)
  1. . . D VERIFY^TIUT(DA)
  1. . . ; -- Get signature for DA
  1. . . D EDSIG^TIURS(DA)
  1. . . ; - execute EXIT ACTION -
  1. . . S TIUEXIT=$$GETEXIT^TIUEDI2(+$P(TIUTYP(1),U,2))
  1. . . I $L(TIUEXIT) S TIUTDA=DA X TIUEXIT S DA=TIUTDA
  1. . . ; -- [Prompt to print DA] --
  1. . . I +$P($G(TIUDPRM(0)),U,8) D PRINT^TIUEPRNT(DA)
  1. Q