source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUPNFIX.m@ 1763

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

initial load of WorldVistAEHR

File size: 4.3 KB
Line 
1TIUPNFIX ; SLC/MAM - Resolve Upload Filing Errors for Progress Notes ;05/06/02
2 ;;1.0;TEXT INTEGRATION UTILITIES;**131**;Jun 20, 1997
3PNFIX ; Progress Note Filing Error Resolution Code
4 ; Requires: TIUEVNT - 8925.4 Upload Log Event IEN
5 ; Requires: TIUTYPE - IEN of Docmt Def whose Filing Error
6 ; Resolution Code is being invoked.
7 ; Taken from alert or filing error.
8 ;
9 ; NOTE: Module PNFIX is written as Filing Error Resolution Code
10 ;for uploading Progress Notes into TIU, replacing the old Filing
11 ;Error Resolution Code, GETPN^TIUCHLP.
12 ;It has been rewritten to take advantage of new generic upload
13 ;modules such as MAKE^TIUFIX1. In its use of these new modules,
14 ;it may serve as a model for uploading other types of documents
15 ;such as Consults or Operative Reports into TIU. See also TIUCNFIX.
16 ;All code which is specific to Progress Notes is included
17 ;in module GETCHECK, before MAKE^TIUFIX1 is called.
18 N TIUFLDS,TIUBUF,SUCCESS,OLDTYPE,DFN,TITLDA,TIU
19 S SUCCESS=0
20 I '$D(^TIU(8925.1,+$G(TIUTYPE),0)) S SUCCESS="0^Document type is missing or invalid." G PNFIXX
21 I '$D(^TIU(8925.4,+$G(TIUEVNT),0)) S SUCCESS="0^Upload Log event is missing or invalid." G PNFIXX
22 S TIUBUF=$$BUFFER^TIUFIX2(TIUEVNT) I +TIUBUF'>0 S SUCCESS=TIUBUF G PNFIXX
23 I '$D(TIUPRM0) D SETPARM^TIULE ; Sets TIUPRM0 with hdr signal, etc
24 ; -- Load hdr data from buffer into array TIUFLDS:
25 D LOADHDR^TIUFIX2(.TIUFLDS,TIUBUF,TIUPRM0,TIUTYPE)
26 ; -- Get from user all data needed to create a new document
27 ; of the given type; Cross-check user data for consistency.
28 S OLDTYPE=TIUTYPE
29 D GETCHECK(.SUCCESS,.TIUTYPE,.TIUFLDS,.DFN,.TITLDA,.TIU)
30 I 'SUCCESS G PNFIXX
31 ; -- Create new document; file all TIUFLDS nodes which have
32 ; not been killed, execute post-file code, etc.:
33 D MAKE^TIUFIX1(.SUCCESS,TIUEVNT,TIUBUF,.TIUTYPE,.TIUFLDS,.DFN,.TITLDA,.TIU,TIUPRM0)
34 ; -- If docmt filed successfully, set flag to stop - don't go
35 ; on and try to resolve error by editing buffer and refiling.
36PNFIXX I +SUCCESS S TIUDONE=1 Q
37 W !!,"Filing error could not be resolved."
38 I $P(SUCCESS,U,2)]"" W !,$P(SUCCESS,U,2)
39 W !,"If you wish to try a different approach, edit the buffered data directly",!,"and refile it, or simply exit and try again later.",!
40 Q
41 ;
42GETCHECK(SUCCESS,TIUTYPE,TIUFLDS,DFN,TITLDA,TIU) ; Get and
43 ;check data
44 ;
45 ;This is written for Progress Notes (PN), but may also serve
46 ;as a model for the use of new generic modules such as
47 ;MAKE^TIUFIX1 in uploading other types of documents such
48 ;as Consults or Operative Reports. See also TIUCNFIX.
49 ;The new generic modules accommodate only documents which
50 ;are uploaded into the TIU DOCUMENT file.
51 ;
52 ;Since a filing error occurred when filer could not locate
53 ;or create a TIU document using data from buffer, we ask the
54 ;user for all data needed to locate/create a document, and
55 ;use that data, instead of the buffer data, to locate/create
56 ;the document.
57 ;Data are acquired from the user is such a way as to guarantee
58 ;that all data necessary to go ahead and create a Progress Note
59 ;are complete and consistent
60 ;
61 ; SUCCESS = 1 - Data are complete and consistent or
62 ; = 0^Explanatory msg
63 ; TIUTYPE = Docmt Def whose methods are being invoked.
64 ; TIUFLDS - array of fields to be filed later in FILE^TIUFIX1.
65 ; See warning in MAKE^TIUFIX1 concerning possible
66 ; need to kill nodes of TIUFLDS before calling MAKE.
67 ; DFN, TITLDA, TIU - Patient, Document title, Demographics
68 ; /visit array.
69 ; Must be gotten from user and passed back.
70 ; Used in GETRECNW to create docmt, in MERGTEXT
71 ; to create components.
72 N DEFAULT,BADTYPES,ASK
73 ; -- Initialize SUCCESS to 0^Error msg:
74 S SUCCESS="0^Patient, visit, and title are required."
75 ; -- Get patient and visit, and title:
76 S DFN=+$$PATIENT^TIULA Q:DFN'>0
77 D ENPN^TIUVSIT(.TIU,+DFN,1)
78 I '$D(TIU) Q
79 ; -- TIU*1*131 - cf GETPN^TIUCHLP: Before 131, if user
80 ; up-arrowed at OK?, code continued.
81 I '$$CHEKPN^TIUCHLP(.TIU) K TIU Q
82 ; -- Screen out consult titles; don't ask about changing type:
83 S BADTYPES=+$$CLASS^TIUCNSLT,ASK=0
84 D GETTITLE^TIUFIX(.SUCCESS,TIUTYPE,.TIUFLDS,.TITLDA,BADTYPES,ASK)
85 Q:TITLDA'>0
86 ; -- If consistent and complete, set SUCCESS=1:
87 S SUCCESS=1
88GETX ;
89 Q
Note: See TracBrowser for help on using the repository browser.