source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUCNFIX.m@ 1003

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

initial load of WorldVistAEHR

File size: 4.8 KB
Line 
1TIUCNFIX ; SLC/MAM - Resolve Upload Filing Errors for Consults ;05/06/02
2 ;;1.0;TEXT INTEGRATION UTILITIES;**131**;Jun 20, 1997
3CNFIX ; Consults 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 ;Modeled on PNFIX^TIUPNFIX, with optional change to PN added
9 ;
10 N TIUFLDS,TIUBUF,SUCCESS,OLDTYPE,DFN,TITLDA,TIU
11 S SUCCESS=0
12 I '$D(^TIU(8925.1,+$G(TIUTYPE),0)) S SUCCESS="0^Document type is missing or invalid." G CNFIXX
13 I '$D(^TIU(8925.4,+$G(TIUEVNT),0)) S SUCCESS="0^Upload Log event is missing or invalid." G CNFIXX
14 S TIUBUF=$$BUFFER^TIUFIX2(TIUEVNT) I +TIUBUF'>0 S SUCCESS=TIUBUF G CNFIXX
15 I '$D(TIUPRM0) D SETPARM^TIULE ; Sets TIUPRM0 with hdr signal, etc
16 ; -- Load hdr data from buffer into array TIUFLDS:
17 D LOADHDR^TIUFIX2(.TIUFLDS,TIUBUF,TIUPRM0,TIUTYPE)
18 ; -- Get from user all data needed to create a new document
19 ; of the given type. Cross-check user data for consistency.
20 S OLDTYPE=TIUTYPE
21 D GETCHECK(.SUCCESS,.TIUTYPE,.TIUFLDS,.DFN,.TITLDA,.TIU)
22 ; -- If all is NOT in order to create a consult,
23 ; and type is still consults, exit w/o creating docmt:
24 I 'SUCCESS,TIUTYPE=OLDTYPE G CNFIXX
25 ; -- If user chose to create a progress note instead
26 ; of a consult, kill REQUESTING PACKAGE node of array
27 ; and get progress note title:
28 I TIUTYPE'=OLDTYPE D G:'SUCCESS CNFIXX
29 . K TIUFLDS(1405)
30 . ; -- Get progress notes title
31 . ; (Screen out consult titles)
32 . ; (Don't ASK if user wants to change to PN;
33 . ; user is already changing to PN):
34 . S BADTYPES=+$$CLASS^TIUCNSLT,ASK=0
35 . W !!," OK, changing document to a progress note..."
36 . D GETTITLE^TIUFIX(.SUCCESS,.TIUTYPE,.TIUFLDS,.TITLDA,BADTYPES,ASK)
37 ; -- If all is in order to create a consult,
38 ; or if type has changed to progress note,
39 ; then continue and create consult/progress note,
40 ; file fields remaining in TIUFLDS, execute post-file code, etc.:
41 D MAKE^TIUFIX1(.SUCCESS,TIUEVNT,TIUBUF,.TIUTYPE,.TIUFLDS,.DFN,.TITLDA,.TIU,TIUPRM0)
42 ; -- If docmt filed successfully, set flag to stop - don't go
43 ; on and try to resolve error by editing buffer and refiling.
44CNFIXX I +SUCCESS S TIUDONE=1
45 ; -- If error successfully resolved, and type changed,
46 ; update type in event log entry:
47 I $G(TIUDONE),TIUTYPE'=OLDTYPE D
48 . N DIE,DR,DA,TYPE
49 . S TYPE="PROGRESS NOTES"
50 . S DIE=8925.4,DR=".03////"_TYPE,DA=+TIUEVNT
51 . D ^DIE
52 Q:$G(TIUDONE)
53 W !!,"Filing error could not be resolved."
54 I $P(SUCCESS,U,2)]"" W !,$P(SUCCESS,U,2)
55 W !,"If you wish to try a different approach, edit the buffered data directly",!,"and refile it, or simply exit and try again later.",!
56 Q
57 ;
58GETCHECK(SUCCESS,TIUTYPE,TIUFLDS,DFN,TITLDA,TIU) ; Get and check data
59 ; Get from user: Patient, Visit, Document Title, Consult
60 ;Request Number. Check that data are consistent. Reset Request
61 ;Number into array TIUFLDS. Ask user if they want to change
62 ;document type to Progress Note.
63 ;Modeled on GETCHECK^TIUPNFIX, with optional change to PN added
64 ; -- Get patient and visit
65PAT S DFN=+$$PATIENT^TIULA
66 N TIUCNNBR,CHANGEPT,ASK,BADTYPES
67 S SUCCESS="0^Patient and Visit are Required."
68 Q:DFN'>0
69 D ENPN^TIUVSIT(.TIU,+DFN,1)
70 I '$D(TIU) Q
71 I '$$CHEKPN^TIUCHLP(.TIU) K TIU Q
72 ; -- Get title
73 ; (No need to limit title beyond
74 ; making sure it has type TIUTYPE.)
75 ; (ASK if user wants to change to PN):
76 S BADTYPES="",ASK=1
77 D GETTITLE^TIUFIX(.SUCCESS,.TIUTYPE,.TIUFLDS,.TITLDA,BADTYPES,ASK)
78 ; -- If user didn't select title or wants to change to
79 ; Progress Note, quit:
80 I TITLDA'>0 Q
81 I TIUTYPE=3 Q
82 ; -- Get consult request:
83 D GETCNSLT(.SUCCESS,.TIUTYPE,.TIUFLDS,.CHANGEPT,.TIUCNNBR)
84 I $G(CHANGEPT) G PAT
85 I TIUCNNBR'>0 Q
86 ; -- We now have a valid request number, consistent with DFN.
87 ; Transform Consult Request # into form C.# and reset
88 ; request node:
89 S TIUCNNBR=$P(TIUCNNBR,";") ; was #;GMR(123,
90 S TIUFLDS(1405)=$$TRNSFRM^TIUPEFIX(TIUTYPE,1405,TIUCNNBR)
91 S SUCCESS=1
92 Q
93 ;
94GETCNSLT(SUCCESS,TIUTYPE,TIUFLDS,CHANGEPT,TIUCNNBR) ; Get consult
95 ;request from user
96 N CLINPROC,TIUOVR,DOCNUM,Y
97 S SUCCESS="0^Consult Request is Required."
98 S CLINPROC=0,TIUOVR=1,DOCNUM=0 ;Don't have a docmt yet
99 S TIUCNNBR=$$GETCNSLT^TIUCNSLT(DFN,CLINPROC,DOCNUM,TIUOVR)
100 ; -- Pt has no requests:
101 I +TIUCNNBR=-1 D Q
102 . W !!,"This patient has no consult requests; please make sure you have the"
103 . W !,"correct patient."
104 . S Y=$$READ^TIUU("YO"," Want to change the patient","YES")
105 . I Y S CHANGEPT=1 Q
106 . I $D(DIRUT) Q
107 . ; -- Ask user if want to change to PN:
108 . S Y=$$ASKCHNG^TIUFIX(2,.TIUTYPE)
109 ; -- User did not select request:
110 I +TIUCNNBR=0 D
111 . W !!,"To upload into a consult title, you must select a request."
112 . S Y=$$ASKCHNG^TIUFIX(2,.TIUTYPE)
113 Q
114 ;
Note: See TracBrowser for help on using the repository browser.