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