source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUEDIM.m@ 1078

Last change on this file since 1078 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.8 KB
Line 
1TIUEDIM ; SLC/JER - Enter/Edit Multiple Document ; 6/14/2002
2 ;;1.0;TEXT INTEGRATION UTILITIES;**7,41,52,100,109,112**;Jun 20, 1997
3 ; 2/2: Update DIE from TIUEDIT to TIUEDI4
4MAIN(TIUCLASS,TIUOUT,TIUNDA,TIUCHNG) ; Control Branching
5 N TIUREL,TIUCHK,TIUDA,TIUEDIT,TIUY,TIUNEW,TIUTYP,TIUPAT
6 N TIUI,DTOUT S TIUDFLT=""
7 K DIROUT
8 ; --- Get one or more patients ---
9 I '$L($T(PATIENT^ORU1)) Q
10 D PATIENT^ORU1(.TIUPAT) I +TIUPAT'>0 S TIUOUT=1 Q
11 S TIUI=0 F S TIUI=+$O(TIUPAT(TIUI)) Q:+TIUI'>0!+$G(TIUOUT) D
12 . N DFN,DUOUT,TIUDPRM,TIU,TIULMETH,TIUVMETH,VAIN,VADM,TIUDA,TIUEDIT
13 . N TIUENTRY,TIUCMMTX,TIUVSUPP,CANEDIT
14 . S TIUVSUPP=0
15 . S DFN=+$G(TIUPAT(TIUI)) Q:+DFN'>0
16 . W !!,"For Patient ",$P(TIUPAT(TIUI),U,2)
17 . S TIUCLASS=$G(TIUCLASS,38)
18 . 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
19 . I +$G(DIROUT)!+$G(DUOUT)!+$G(DTOUT) S TIUOUT=1 Q
20 . ; -- Set title array TIUTYP (use TIUTITLE or ask user) --
21 . D SETTL^TIUEDI4(.TIUTYP,TIUCLASS,$G(TIUTITLE)) I +$G(TIUTYP)'>0 S TIUOUT=1 Q
22 . ; --- Re-direct surgical reports ---
23 . I +$$ISA^TIULX(TIUTYP,+$$CLASS^TIUSROI("SURGICAL REPORTS")) D ENTEROP^TIUSROI(DFN,TIUTYP) Q
24 . ; -- Get doc parameters for title, X entry action --
25 . D DOCPRM^TIULC1(TIUTYP,.TIUDPRM)
26 . S TIUENTRY=$$GETENTRY^TIUEDI2(+TIUTYP)
27 . I $L(TIUENTRY) X TIUENTRY
28 . Q:+$G(TIUOUT) ; If ENTRY ACTION sets TIUOUT=1 Abort Entry
29 . ; -- Set visit array TIU --
30 . ; NOTE: EVNTFLAG is set in TIUEDIT, prior to calling this routine
31 . D GETVST^TIUEDI4(DFN,TIUTYP,.TIU,EVNTFLAG)
32 . I $S($G(TIUQUIT):1,'$D(TIU("VSTR")):1,1:0) Q
33 . ; -- Ask OK --
34 . S TIUVMETH=$$GETVMETH^TIUEDI1(TIUTYP)
35 . I '$L(TIUVMETH) D S TIUOUT=1 Q
36 . . W !,$C(7),"No Validation Method defined for "
37 . . W $$PNAME^TIULC1(TIUTYP),".",!,"Please contact IRM..."
38 . X TIUVMETH
39 . I $S($D(DIROUT):1,$D(DTOUT):1,1:0) S TIUQUIT=1 Q
40 . I $D(DUOUT) Q
41 . ; -- If user OK'd basic info, go on to get text, etc.: --
42 . I $D(TIU),+$G(TIUASK) D
43 . . ; -- Get record DA --
44 . . ; DA is either: new stub record, ready for edit, or
45 . . ; existing record, for edit, or
46 . . ; existing record, for addendum
47 . . N DA
48 . . S DA=$$GETRECNW^TIUEDI3(DFN,.TIU,TIUTYP(1),.TIUNEW,.TIUDPRM,1,DUZ,.CANEDIT)
49 . . I +DA'>0 W !,"Unable to enter/edit." Q
50 . . ; -- [Addend DA and Quit] --
51 . . ; If record not new & user can't edit it, user said
52 . . ; in GETRECNW they wanted to addend, so let user write
53 . . ; addendum and quit:
54 . . I 'TIUNEW,'CANEDIT D ADDENDUM^TIUADD(DA,"",.TIUCHNG,1) Q
55 . . N TIUQUIT,TIUADD,TIUTDA
56 . . ; -- Edit new or existing DA --
57 . . D DIE^TIUEDI4(DA,.TIUQUIT)
58 . . Q:+$G(TIUQUIT)=2 ; DA doesn't exist (e.g. uparrowed w/ bad record)
59 . . ;If (CP) and (Timeout or Not Select Consult) and (Consult Associated), Quit before EMPTYDOC check
60 . . I +$$ISA^TIULX(TIUTYP,+$$CLASS^TIUCP),+$G(TIUQUIT)=1,+$P($G(^TIU(8925,+DA,14)),U,5)>0 Q
61 . . 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
62 . . Q:+$G(TIUQUIT)
63 . . S:+DA SUCCESS=+DA
64 . . I +$G(TIUONCE) S TIUNDA(+$G(DA))="" ; See TIURC, Across Patients
65 . . ; -- Misc after-edit-stuff for DA --
66 . . ; -- Mark to ask workload at signature;
67 . . ; (STOP for Stop codes for stand-alone visits): --
68 . . I +$G(TIU("STOP")),(+$P($G(TIUDPRM(0)),U,14)'=1) D DEFER^TIUVSIT(DA,TIU("STOP")) I 1
69 . . E D QUE^TIUPXAP1 ; Post workload now in background
70 . . S TIUCMMTX=$$COMMIT^TIULC1(+$P(TIUTYP(1),U,2))
71 . . I TIUCMMTX]"" X TIUCMMTX
72 . . D RELEASE^TIUT(DA)
73 . . D VERIFY^TIUT(DA)
74 . . ; -- Get signature for DA
75 . . D EDSIG^TIURS(DA)
76 . . ; - execute EXIT ACTION -
77 . . S TIUEXIT=$$GETEXIT^TIUEDI2(+$P(TIUTYP(1),U,2))
78 . . I $L(TIUEXIT) S TIUTDA=DA X TIUEXIT S DA=TIUTDA
79 . . ; -- [Prompt to print DA] --
80 . . I +$P($G(TIUDPRM(0)),U,8) D PRINT^TIUEPRNT(DA)
81 Q
Note: See TracBrowser for help on using the repository browser.