Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: TIUPFFIX

TIUPFFIX.m

Go to the documentation of this file.
  1. TIUPFFIX ; SLC/JMH - Resolve Upload Filing Errors for PRF Notes ;7/29/05
  1. ;;1.0;TEXT INTEGRATION UTILITIES;**184**;Jun 20, 1997
  1. PFFIX ; PRF (Patient Record Flag) Note Filing Error Resolution Code - COPIED FROM TIUPNFIX
  1. N TIUFLDS,TIUBUF,SUCCESS,OLDTYPE,DFN,TITLDA,TIU
  1. S SUCCESS=0
  1. I '$D(^TIU(8925.1,+$G(TIUTYPE),0)) S SUCCESS="0^Document type is missing or invalid." G PFFIXX
  1. I '$D(^TIU(8925.4,+$G(TIUEVNT),0)) S SUCCESS="0^Upload Log event is missing or invalid." G PFFIXX
  1. S TIUBUF=$$BUFFER^TIUFIX2(TIUEVNT) I +TIUBUF'>0 S SUCCESS=TIUBUF G PFFIXX
  1. I '$D(TIUPRM0) D SETPARM^TIULE ; Sets TIUPRM0 with hdr signal, etc
  1. ; -- Load hdr data from buffer into array TIUFLDS:
  1. D LOADHDR^TIUFIX2(.TIUFLDS,TIUBUF,TIUPRM0,TIUTYPE)
  1. ; -- Get from user all data needed to create a new document
  1. ; of the given type; Cross-check user data for consistency.
  1. S OLDTYPE=TIUTYPE
  1. D GETCHECK(.SUCCESS,.TIUTYPE,.TIUFLDS,.DFN,.TITLDA,.TIU)
  1. I 'SUCCESS G PFFIXX
  1. ; -- Create new document; file all TIUFLDS nodes which have
  1. ; not been killed, execute post-file code, etc.:
  1. D MAKE^TIUFIX1(.SUCCESS,TIUEVNT,TIUBUF,.TIUTYPE,.TIUFLDS,.DFN,.TITLDA,.TIU,TIUPRM0)
  1. K ^TMP("TIUPRFUP",$J) ;in case MAKE didn't call post-file code
  1. ; -- If docmt filed successfully, set flag to stop - don't go
  1. ; on and try to resolve error by editing buffer and refiling.
  1. PFFIXX I +SUCCESS S TIUDONE=1 Q
  1. W !!,"Filing error could not be resolved."
  1. I $P(SUCCESS,U,2)]"" W !,$P(SUCCESS,U,2)
  1. W !,"If you wish to try a different approach, edit the buffered data directly",!,"and refile it, or simply exit and try again later.",!
  1. Q
  1. ;
  1. GETCHECK(SUCCESS,TIUTYPE,TIUFLDS,DFN,TITLDA,TIU) ; Get and
  1. ;check data
  1. ;
  1. ;Since a filing error occurred when filer could not locate
  1. ;or create a TIU document using data from buffer, we ask the
  1. ;user for all data needed to locate/create a document, and
  1. ;use that data, instead of the buffer data, to locate/create
  1. ;the document.
  1. ;Data are acquired from the user is such a way as to guarantee
  1. ;that all data necessary to go ahead and create a PRF Note
  1. ;are complete and consistent
  1. ;
  1. ; SUCCESS = 1 - Data are complete and consistent or
  1. ; = 0^Explanatory msg
  1. ; TIUTYPE = Docmt Def whose methods are being invoked. Users may
  1. ; select titles of type TIUTYPE. If not ALL titles of
  1. ; type TIUTYPE should be selectable, screen them out
  1. ; with BADTYPES.
  1. ; TIUFLDS - array of fields to be filed later in FILE^TIUFIX1.
  1. ; See warning in MAKE^TIUFIX1 concerning possible
  1. ; need to kill nodes of TIUFLDS before calling MAKE.
  1. ; DFN, TITLDA, TIU - Patient, Document title, Demographics
  1. ; /visit array.
  1. ; Must be gotten from user and passed back.
  1. ; Used in GETRECNW to create docmt, in MERGTEXT
  1. ; to create components.
  1. K ^TMP("TIUPRFUP",$J)
  1. N DEFAULT,BADTYPES,ASK,TIURET
  1. ; -- Initialize SUCCESS to 0^Error msg:
  1. S SUCCESS="0^Patient, visit, and title are required."
  1. ; -- Get patient and visit, and title:
  1. S DFN=+$$PATIENT^TIULA Q:DFN'>0
  1. D ENPN^TIUVSIT(.TIU,+DFN,1)
  1. I '$D(TIU) Q
  1. I '$$CHEKPN^TIUCHLP(.TIU) K TIU Q
  1. ; -- 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:
  1. S BADTYPES="",ASK=0
  1. D GETTITLE^TIUFIX(.SUCCESS,TIUTYPE,.TIUFLDS,.TITLDA,BADTYPES,ASK)
  1. Q:TITLDA'>0
  1. S TIURET=$$SELECT^TIUPRF1(+TITLDA,DFN)
  1. I 'TIURET S SUCCESS="0^Patient Record Flag Action is Required." Q
  1. S ^TMP("TIUPRFUP",$J)=TIURET
  1. ; -- If consistent and complete, set SUCCESS=1:
  1. S SUCCESS=1
  1. GETX ;
  1. Q