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

TIUPNFIX.m

Go to the documentation of this file.
  1. TIUPNFIX ; SLC/MAM - Resolve Upload Filing Errors for Progress Notes ;05/06/02
  1. ;;1.0;TEXT INTEGRATION UTILITIES;**131**;Jun 20, 1997
  1. PNFIX ; Progress Note Filing Error Resolution Code
  1. ; Requires: TIUEVNT - 8925.4 Upload Log Event IEN
  1. ; Requires: TIUTYPE - IEN of Docmt Def whose Filing Error
  1. ; Resolution Code is being invoked.
  1. ; Taken from alert or filing error.
  1. ;
  1. ; NOTE: Module PNFIX is written as Filing Error Resolution Code
  1. ;for uploading Progress Notes into TIU, replacing the old Filing
  1. ;Error Resolution Code, GETPN^TIUCHLP.
  1. ;It has been rewritten to take advantage of new generic upload
  1. ;modules such as MAKE^TIUFIX1. In its use of these new modules,
  1. ;it may serve as a model for uploading other types of documents
  1. ;such as Consults or Operative Reports into TIU. See also TIUCNFIX.
  1. ;All code which is specific to Progress Notes is included
  1. ;in module GETCHECK, before MAKE^TIUFIX1 is called.
  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 PNFIXX
  1. I '$D(^TIU(8925.4,+$G(TIUEVNT),0)) S SUCCESS="0^Upload Log event is missing or invalid." G PNFIXX
  1. S TIUBUF=$$BUFFER^TIUFIX2(TIUEVNT) I +TIUBUF'>0 S SUCCESS=TIUBUF G PNFIXX
  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 PNFIXX
  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. ; -- If docmt filed successfully, set flag to stop - don't go
  1. ; on and try to resolve error by editing buffer and refiling.
  1. PNFIXX 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. ;This is written for Progress Notes (PN), but may also serve
  1. ;as a model for the use of new generic modules such as
  1. ;MAKE^TIUFIX1 in uploading other types of documents such
  1. ;as Consults or Operative Reports. See also TIUCNFIX.
  1. ;The new generic modules accommodate only documents which
  1. ;are uploaded into the TIU DOCUMENT file.
  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 Progress 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.
  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. N DEFAULT,BADTYPES,ASK
  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. ; -- TIU*1*131 - cf GETPN^TIUCHLP: Before 131, if user
  1. ; up-arrowed at OK?, code continued.
  1. I '$$CHEKPN^TIUCHLP(.TIU) K TIU Q
  1. ; -- Screen out consult titles; don't ask about changing type:
  1. S BADTYPES=+$$CLASS^TIUCNSLT,ASK=0
  1. D GETTITLE^TIUFIX(.SUCCESS,TIUTYPE,.TIUFLDS,.TITLDA,BADTYPES,ASK)
  1. Q:TITLDA'>0
  1. ; -- If consistent and complete, set SUCCESS=1:
  1. S SUCCESS=1
  1. GETX ;
  1. Q