source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUEDIT.m@ 1753

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

initial load of WorldVistAEHR

File size: 7.3 KB
RevLine 
[613]1TIUEDIT ; SLC/JER - Enter/Edit a Document ; 6/11/2002
2 ;;1.0;TEXT INTEGRATION UTILITIES;**1,7,22,52,100,109,112**;Jun 20, 1997
3 ; Moved LOADDFLT, BOIL, CANXEC, REPLACE, INSMULT to TIUEDI4
4 ; Moved DIE, TEXTEDIT from TIUEDIT to TIUEDI4
5 ; Separated out modules SETTL, GETVST, ASKOK
6 ; Moved SETTL, GETVST, ASKOK from TIUEDIT to TIUEDI4
7 ; Changed call to GETREC^TIUEDI1 to call GETRECNW^TIUEDI3
8MAIN(TIUCLASS,SUCCESS,DFN,TIUTITLE,EVNTFLAG,NOSAVE,TIUNDA,TIUSNGL,TIUCHNG) ; Create new document(s)
9 ; May branch off to edit existing docmt instead of creating new one.
10 ; Call with: [TIUCLASS] --> pointer to file (8925) corresponding to
11 ; the class (e.g., Progress Notes=3)
12 ; from which to select a title
13 ; [by ref] [SUCCESS] --> Boolean flag returned as IFN when a
14 ; record is created, or 0 when record
15 ; creation fails
16 ; [DFN] --> IEN in patient file (#2)
17 ; [TIUTITLE] --> Pointer or NAME or PTR^NAME of the
18 ; TITLE from file 8925.1 to be used as
19 ; the default.
20 ; [EVNTFLAG] --> Boolean flag for visit prompt (0 to
21 ; prompt, 1 to force event type visit)
22 ; [NOSAVE] --> Boolean flag to suppress saving the data
23 ; (e.g., when testing new Boilerplates
24 ; using DDEF action TRY, etc.).
25 ; [by ref] [TIUNDA] --> array of form: TIUNDA(IFN)="".
26 ; Used in SHOW NOTES ACROSS PATIENTS.
27 ; See TIURC, which sets TIUONCE.
28 ; Also used in TIUEDIM, for mult pts.
29 ; [TIUSNGL] --> Boolean flag to create only ONE note
30 ; regardless of multiple pt preference.
31 ; [by ref] [TIUCHNG] --> If received, passes back TIUCHNG array,
32 ; which collects info across records about
33 ; actions taken. Used in feedback
34 ; msgs to user.
35 ; Other variables:
36 ; sets [TIUTYP] --> array with form similar to that of XQORNOD:
37 ; TIUTYP = title IFN
38 ; TIUTYP(1) = 1^title IFN^title name,
39 ; where 1 for us is just a positive #
40 ; sets [TIUBY] --> used in some input templates to BYpass fields.
41 ; Called by:
42 ; Outpt Pharmacy, Consults, ...
43 N TIUASK,TIUOUT,TIUREL,TIUCHK,TIUDA,TIUEDIT,TIUY,TIUTYP,TIUDPRM
44 N TIUDFLT,TIUPREF,TIULMETH,TIUVMETH,DIRUT,DUOUT,DTOUT,TIUPRM0
45 N TIUPRM1,TIUPRM3,TIUENTRY,TIUEXIT,TIUBY,TIUPNAME,TIUST
46 S EVNTFLAG=+$G(EVNTFLAG,0)
47 ; --Get user's division parameters, preferences: --
48 I '$D(TIUPRM0) D SETPARM^TIULE
49 S TIUPREF=$$PERSPRF^TIULE(DUZ)
50 ; -- multiple pts; not in OERR, not TRYing DDEF, not single docmt: --
51 I $P(TIUPREF,U,6)="M",(+$G(ORVP)'>0),(+$G(NOSAVE)'>0),'+$G(TIUSNGL) D MAIN^TIUEDIM(TIUCLASS,.TIUOUT,.TIUNDA,.TIUCHNG) Q
52 ; -- Loop: Create docmt --
53 F D Q:+$G(ORVP)!+$G(TIUOUT)!+$G(NOSAVE)!+$G(TIUSNGL)
54 . N TIU,TIUCMMTX,TIUBY,TIUEDIT,TIUNEW,TIUTYP,VADM,VAIN,CANEDIT
55 . ; -- User specifies basic info for new docmt --
56 . ; -- Get patient --
57 . I +$G(ORVP) S DFN=+$G(ORVP)
58 . I +$G(DFN)'>0 D I +DFN'>0 S TIUOUT=1 Q
59 . . S DFN=+$$PATIENT^TIULA
60 . ; -- [For progress notes, show available notes]: --
61 . S TIUCLASS=$G(TIUCLASS,38)
62 . 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
63 . I +$G(DIROUT)!+$G(DUOUT)!+$G(DTOUT) S TIUOUT=1 Q
64 . ; -- Set title array TIUTYP (use TIUTITLE or ask user) --
65 . D SETTL^TIUEDI4(.TIUTYP,TIUCLASS,$G(TIUTITLE)) I +$G(TIUTYP)'>0 S TIUOUT=1 Q
66 . ; --- Re-direct SURGICAL REPORTS ---
67 . I +$$ISA^TIULX(TIUTYP,+$$CLASS^TIUSROI("SURGICAL REPORTS")) D ENTEROP^TIUSROI(DFN,TIUTYP) Q
68 . ; -- Get doc parameters for title, X entry action --
69 . D DOCPRM^TIULC1(TIUTYP,.TIUDPRM)
70 . S TIUENTRY=$$GETENTRY^TIUEDI2(+TIUTYP)
71 . I $L(TIUENTRY) X TIUENTRY
72 . Q:+$G(TIUOUT) ; If ENTRY ACTION sets TIUOUT=1 Abort entry
73 . ; -- Set visit array TIU --
74 . D GETVST^TIUEDI4(DFN,TIUTYP,.TIU,EVNTFLAG)
75 . I '$D(TIU("VSTR")) K DFN,TIUTYP Q
76 . ; -- Ask OK --
77 . D ASKOK^TIUEDI4(TIUTYP,.TIU,.TIUBY,.TIUASK) I '$D(TIU("VSTR")) K DFN,TIUTYP Q
78 . ; -- If user OK'd basic info, go on to get text, etc.: --
79 . I $D(TIU),+$G(TIUASK) D
80 . . ; -- Get record DA --
81 . . ; DA is either: new stub record, ready for edit, or
82 . . ; existing record, for edit, or
83 . . ; existing record, for addendum
84 . . N DA
85 . . S DA=$$GETRECNW^TIUEDI3(DFN,.TIU,TIUTYP(1),.TIUNEW,.TIUDPRM,1,DUZ,.CANEDIT)
86 . . I +DA'>0 W !,"Unable to enter/edit." Q
87 . . ; -- [Addend DA and Quit] --
88 . . ; If record not new & user can't edit it, let user
89 . . ; write addendum and quit:
90 . . I 'TIUNEW,'CANEDIT D Q
91 . . . D ADDENDUM^TIUADD(DA,"",.TIUCHNG,1)
92 . . N TIUQUIT,TIUADD,TIUTDA
93 . . ; -- Edit new or existing DA --
94 . . D DIE^TIUEDI4(DA,.TIUQUIT)
95 . . Q:+$G(TIUQUIT)=2 ; DA doesn't exist (e.g. uparrowed w/ bad record)
96 . . ;If (CP) and (Timeout or Not Select Consult) and (Consult Associated), Quit before EMPTYDOC check
97 . . I +$$ISA^TIULX(TIUTYP,+$$CLASS^TIUCP),+$G(TIUQUIT)=1,+$P($G(^TIU(8925,+DA,14)),U,5)>0 Q
98 . . I $$EMPTYDOC^TIULF(DA) D DELETE(DA,0) S:$G(VALMAR)="^TMP(""TIUVIEW"",$J)" VALMBCK="Q" S:'+$G(TIUNEW) TIUCHNG("DELETE")=1 H:'+$G(TIUNEW) 2 Q
99 . . Q:+$G(TIUQUIT)
100 . . S:+DA SUCCESS=+DA
101 . . I +$G(TIUONCE) S TIUNDA(+$G(DA))="" ; See TIURC, Across Patients
102 . . ; -- Misc after-edit-stuff for DA --
103 . . ; -- Mark to ask workload at signature;
104 . . ; (STOP for Stop codes for stand-alone visits): --
105 . . I +$G(TIU("STOP")),(+$P($G(TIUDPRM(0)),U,14)'=1) D DEFER^TIUVSIT(DA,TIU("STOP")) I 1 ;piece 14 = suppress DX/CPT on entry
106 . . E D QUE^TIUPXAP1 ; Post workload now in background
107 . . S TIUCMMTX=$$COMMIT^TIULC1(+$P(TIUTYP(1),U,2))
108 . . I TIUCMMTX]"" X TIUCMMTX
109 . . D RELEASE^TIUT(DA)
110 . . D VERIFY^TIUT(DA)
111 . . ; -- Get signature for DA
112 . . D EDSIG^TIURS(DA)
113 . . ; - execute EXIT ACTION -
114 . . S TIUEXIT=$$GETEXIT^TIUEDI2(+$P(TIUTYP(1),U,2))
115 . . I $L(TIUEXIT) S TIUTDA=DA X TIUEXIT S DA=TIUTDA
116 . . ; -- [Prompt to add ID stub] --
117 . . ; I +$P($G(TIUDPRM(0)),U,20) D ADDSTUB^TIUGEDIT(DA)
118 . . ; -- [Prompt to print DA] --
119 . . I +$P($G(TIUDPRM(0)),U,8) D PRINT^TIUEPRNT(DA)
120 . K DFN ; Free patient
121 . S TIUPNAME=$$PNAME^TIULC1(TIUCLASS)
122 . I $$UP^XLFSTR($E(TIUPNAME,$L(TIUPNAME)))="S" S TIUPNAME=$E(TIUPNAME,1,$L(TIUPNAME)-1)
123 . ; -- [loop again] --
124 . I '+$G(NOSAVE),'+$G(ORVP),'+$G(TIUSNGL) W !!,"You may enter another ",TIUPNAME,". Press RETURN to exit.",!
125 Q
126 ;
127DELETE(TIUDA,PROMPT,MSG,HUSH) ; Delete record
128 N DIDEL,DIE,DR,TIUD0,TIUVSIT,TIUVKILL,TIUDELX,TIUTYPE
129 S TIUD0=$G(^TIU(8925,+TIUDA,0)),TIUVSIT=$P(TIUD0,U,3),TIUTYPE=+TIUD0
130 I +$G(PROMPT),'+$$READ^TIUU("YO",MSG,"NO") W !,"Nothing Deleted." Q
131 K ^TIU(8925,"ASAVE",DUZ,TIUDA)
132 D DELIRT^TIUDIRT(TIUDA)
133 ; If a DELETE Action exists for the document definition, execute it
134 S TIUDELX=$$DELETE^TIULC1(TIUTYPE)
135 I TIUDELX]"" X TIUDELX
136 S DA=TIUDA,(DIDEL,DIE)=8925,DR=".01///@"
137 D ^DIE W:'+$G(HUSH) !,"<NOTHING ENTERED. "
138 I '+$G(HUSH) W:+TIUD0 $$PNAME^TIULC1(+TIUD0)," DELETED>"
139 D DELCOMP^TIUEDI1(TIUDA),DELAUDIT^TIUEDI1(TIUDA)
140 K ^TIU(8925,"ASAVE",DUZ,TIUDA) ; Remove Save Flag
141 D ALERTDEL^TIUALRT(TIUDA),ADDENDEL^TIUALRT(TIUDA)
142 ; I +TIUVSIT S TIUVKILL=$$DELVFILE^PXAPI("ALL",TIUVSIT,"","TEXT INTEGRATION UTILITIES")
143 Q
144 ;
Note: See TracBrowser for help on using the repository browser.