| 1 | TIUPFFIX ; SLC/JMH - Resolve Upload Filing Errors for PRF Notes ;7/29/05
 | 
|---|
| 2 |  ;;1.0;TEXT INTEGRATION UTILITIES;**184**;Jun 20, 1997
 | 
|---|
| 3 | PFFIX ; PRF (Patient Record Flag) Note Filing Error Resolution Code - COPIED FROM TIUPNFIX
 | 
|---|
| 4 |  N TIUFLDS,TIUBUF,SUCCESS,OLDTYPE,DFN,TITLDA,TIU
 | 
|---|
| 5 |  S SUCCESS=0
 | 
|---|
| 6 |  I '$D(^TIU(8925.1,+$G(TIUTYPE),0)) S SUCCESS="0^Document type is missing or invalid." G PFFIXX
 | 
|---|
| 7 |  I '$D(^TIU(8925.4,+$G(TIUEVNT),0)) S SUCCESS="0^Upload Log event is missing or invalid." G PFFIXX
 | 
|---|
| 8 |  S TIUBUF=$$BUFFER^TIUFIX2(TIUEVNT) I +TIUBUF'>0 S SUCCESS=TIUBUF G PFFIXX
 | 
|---|
| 9 |  I '$D(TIUPRM0) D SETPARM^TIULE ; Sets TIUPRM0 with hdr signal, etc
 | 
|---|
| 10 |  ; -- Load hdr data from buffer into array TIUFLDS:
 | 
|---|
| 11 |  D LOADHDR^TIUFIX2(.TIUFLDS,TIUBUF,TIUPRM0,TIUTYPE)
 | 
|---|
| 12 |  ; -- Get from user all data needed to create a new document
 | 
|---|
| 13 |  ;    of the given type; Cross-check user data for consistency.
 | 
|---|
| 14 |  S OLDTYPE=TIUTYPE
 | 
|---|
| 15 |  D GETCHECK(.SUCCESS,.TIUTYPE,.TIUFLDS,.DFN,.TITLDA,.TIU)
 | 
|---|
| 16 |  I 'SUCCESS G PFFIXX
 | 
|---|
| 17 |  ; -- Create new document; file all TIUFLDS nodes which have
 | 
|---|
| 18 |  ;    not been killed, execute post-file code, etc.:
 | 
|---|
| 19 |  D MAKE^TIUFIX1(.SUCCESS,TIUEVNT,TIUBUF,.TIUTYPE,.TIUFLDS,.DFN,.TITLDA,.TIU,TIUPRM0)
 | 
|---|
| 20 |  K ^TMP("TIUPRFUP",$J) ;in case MAKE didn't call post-file code
 | 
|---|
| 21 |  ; -- If docmt filed successfully, set flag to stop - don't go
 | 
|---|
| 22 |  ;    on and try to resolve error by editing buffer and refiling. 
 | 
|---|
| 23 | PFFIXX I +SUCCESS S TIUDONE=1 Q
 | 
|---|
| 24 |  W !!,"Filing error could not be resolved."
 | 
|---|
| 25 |  I $P(SUCCESS,U,2)]"" W !,$P(SUCCESS,U,2)
 | 
|---|
| 26 |  W !,"If you wish to try a different approach, edit the buffered data directly",!,"and refile it, or simply exit and try again later.",!
 | 
|---|
| 27 |  Q
 | 
|---|
| 28 |  ;
 | 
|---|
| 29 | GETCHECK(SUCCESS,TIUTYPE,TIUFLDS,DFN,TITLDA,TIU) ; Get and
 | 
|---|
| 30 |  ;check data
 | 
|---|
| 31 |  ;
 | 
|---|
| 32 |  ;Since a filing error occurred when filer could not locate
 | 
|---|
| 33 |  ;or create a TIU document using data from buffer, we ask the
 | 
|---|
| 34 |  ;user for all data needed to locate/create a document, and
 | 
|---|
| 35 |  ;use that data, instead of the buffer data, to locate/create
 | 
|---|
| 36 |  ;the document.
 | 
|---|
| 37 |  ;Data are acquired from the user is such a way as to guarantee
 | 
|---|
| 38 |  ;that all data necessary to go ahead and create a PRF Note
 | 
|---|
| 39 |  ;are complete and consistent
 | 
|---|
| 40 |  ;
 | 
|---|
| 41 |  ; SUCCESS = 1 - Data are complete and consistent or
 | 
|---|
| 42 |  ;         = 0^Explanatory msg
 | 
|---|
| 43 |  ; TIUTYPE = Docmt Def whose methods are being invoked.  Users may
 | 
|---|
| 44 |  ;           select titles of type TIUTYPE.  If not ALL titles of
 | 
|---|
| 45 |  ;           type TIUTYPE should be selectable, screen them out
 | 
|---|
| 46 |  ;            with BADTYPES.
 | 
|---|
| 47 |  ; TIUFLDS     - array of fields to be filed later in FILE^TIUFIX1.
 | 
|---|
| 48 |  ;               See warning in MAKE^TIUFIX1 concerning possible
 | 
|---|
| 49 |  ;               need to kill nodes of TIUFLDS before calling MAKE.
 | 
|---|
| 50 |  ; DFN, TITLDA, TIU - Patient, Document title, Demographics
 | 
|---|
| 51 |  ;                    /visit array.
 | 
|---|
| 52 |  ;                    Must be gotten from user and passed back.
 | 
|---|
| 53 |  ;                    Used in GETRECNW to create docmt, in MERGTEXT
 | 
|---|
| 54 |  ;                    to create components.
 | 
|---|
| 55 |  K ^TMP("TIUPRFUP",$J)
 | 
|---|
| 56 |  N DEFAULT,BADTYPES,ASK,TIURET
 | 
|---|
| 57 |  ; -- Initialize SUCCESS to 0^Error msg:
 | 
|---|
| 58 |  S SUCCESS="0^Patient, visit, and title are required."
 | 
|---|
| 59 |  ; -- Get patient and visit, and title:
 | 
|---|
| 60 |  S DFN=+$$PATIENT^TIULA Q:DFN'>0
 | 
|---|
| 61 |  D ENPN^TIUVSIT(.TIU,+DFN,1)
 | 
|---|
| 62 |  I '$D(TIU) Q
 | 
|---|
| 63 |  I '$$CHEKPN^TIUCHLP(.TIU) K TIU Q
 | 
|---|
| 64 |  ; -- Don't screen out titles (we are already permitting only PRF titles and we don't need to further screen them; don't ask about changing type:
 | 
|---|
| 65 |  S BADTYPES="",ASK=0
 | 
|---|
| 66 |  D GETTITLE^TIUFIX(.SUCCESS,TIUTYPE,.TIUFLDS,.TITLDA,BADTYPES,ASK)
 | 
|---|
| 67 |  Q:TITLDA'>0
 | 
|---|
| 68 |  S TIURET=$$SELECT^TIUPRF1(+TITLDA,DFN)
 | 
|---|
| 69 |  I 'TIURET S SUCCESS="0^Patient Record Flag Action is Required." Q
 | 
|---|
| 70 |  S ^TMP("TIUPRFUP",$J)=TIURET
 | 
|---|
| 71 |  ; -- If consistent and complete, set SUCCESS=1: 
 | 
|---|
| 72 |  S SUCCESS=1
 | 
|---|
| 73 | GETX ;
 | 
|---|
| 74 |  Q
 | 
|---|