- TIUPFFIX ; SLC/JMH - Resolve Upload Filing Errors for PRF Notes ;7/29/05
- ;;1.0;TEXT INTEGRATION UTILITIES;**184**;Jun 20, 1997
- PFFIX ; PRF (Patient Record Flag) Note Filing Error Resolution Code - COPIED FROM TIUPNFIX
- 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 PFFIXX
- I '$D(^TIU(8925.4,+$G(TIUEVNT),0)) S SUCCESS="0^Upload Log event is missing or invalid." G PFFIXX
- S TIUBUF=$$BUFFER^TIUFIX2(TIUEVNT) I +TIUBUF'>0 S SUCCESS=TIUBUF G PFFIXX
- 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 PFFIXX
- ; -- 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)
- K ^TMP("TIUPRFUP",$J) ;in case MAKE didn't call post-file code
- ; -- If docmt filed successfully, set flag to stop - don't go
- ; on and try to resolve error by editing buffer and refiling.
- PFFIXX 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
- ;
- ;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 PRF Note
- ;are complete and consistent
- ;
- ; SUCCESS = 1 - Data are complete and consistent or
- ; = 0^Explanatory msg
- ; TIUTYPE = Docmt Def whose methods are being invoked. Users may
- ; select titles of type TIUTYPE. If not ALL titles of
- ; type TIUTYPE should be selectable, screen them out
- ; with BADTYPES.
- ; 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.
- K ^TMP("TIUPRFUP",$J)
- N DEFAULT,BADTYPES,ASK,TIURET
- ; -- 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
- I '$$CHEKPN^TIUCHLP(.TIU) K TIU Q
- ; -- 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:
- S BADTYPES="",ASK=0
- D GETTITLE^TIUFIX(.SUCCESS,TIUTYPE,.TIUFLDS,.TITLDA,BADTYPES,ASK)
- Q:TITLDA'>0
- S TIURET=$$SELECT^TIUPRF1(+TITLDA,DFN)
- I 'TIURET S SUCCESS="0^Patient Record Flag Action is Required." Q
- S ^TMP("TIUPRFUP",$J)=TIURET
- ; -- If consistent and complete, set SUCCESS=1:
- S SUCCESS=1
- GETX ;
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HTIUPFFIX 3707 printed Feb 19, 2025@00:09:39 Page 2
- TIUPFFIX ; SLC/JMH - Resolve Upload Filing Errors for PRF Notes ;7/29/05
- +1 ;;1.0;TEXT INTEGRATION UTILITIES;**184**;Jun 20, 1997
- PFFIX ; PRF (Patient Record Flag) Note Filing Error Resolution Code - COPIED FROM TIUPNFIX
- +1 NEW TIUFLDS,TIUBUF,SUCCESS,OLDTYPE,DFN,TITLDA,TIU
- +2 SET SUCCESS=0
- +3 IF '$DATA(^TIU(8925.1,+$GET(TIUTYPE),0))
- SET SUCCESS="0^Document type is missing or invalid."
- GOTO PFFIXX
- +4 IF '$DATA(^TIU(8925.4,+$GET(TIUEVNT),0))
- SET SUCCESS="0^Upload Log event is missing or invalid."
- GOTO PFFIXX
- +5 SET TIUBUF=$$BUFFER^TIUFIX2(TIUEVNT)
- IF +TIUBUF'>0
- SET SUCCESS=TIUBUF
- GOTO PFFIXX
- +6 ; Sets TIUPRM0 with hdr signal, etc
- IF '$DATA(TIUPRM0)
- DO SETPARM^TIULE
- +7 ; -- Load hdr data from buffer into array TIUFLDS:
- +8 DO LOADHDR^TIUFIX2(.TIUFLDS,TIUBUF,TIUPRM0,TIUTYPE)
- +9 ; -- Get from user all data needed to create a new document
- +10 ; of the given type; Cross-check user data for consistency.
- +11 SET OLDTYPE=TIUTYPE
- +12 DO GETCHECK(.SUCCESS,.TIUTYPE,.TIUFLDS,.DFN,.TITLDA,.TIU)
- +13 IF 'SUCCESS
- GOTO PFFIXX
- +14 ; -- Create new document; file all TIUFLDS nodes which have
- +15 ; not been killed, execute post-file code, etc.:
- +16 DO MAKE^TIUFIX1(.SUCCESS,TIUEVNT,TIUBUF,.TIUTYPE,.TIUFLDS,.DFN,.TITLDA,.TIU,TIUPRM0)
- +17 ;in case MAKE didn't call post-file code
- KILL ^TMP("TIUPRFUP",$JOB)
- +18 ; -- If docmt filed successfully, set flag to stop - don't go
- +19 ; on and try to resolve error by editing buffer and refiling.
- PFFIXX 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 ;Since a filing error occurred when filer could not locate
- +4 ;or create a TIU document using data from buffer, we ask the
- +5 ;user for all data needed to locate/create a document, and
- +6 ;use that data, instead of the buffer data, to locate/create
- +7 ;the document.
- +8 ;Data are acquired from the user is such a way as to guarantee
- +9 ;that all data necessary to go ahead and create a PRF Note
- +10 ;are complete and consistent
- +11 ;
- +12 ; SUCCESS = 1 - Data are complete and consistent or
- +13 ; = 0^Explanatory msg
- +14 ; TIUTYPE = Docmt Def whose methods are being invoked. Users may
- +15 ; select titles of type TIUTYPE. If not ALL titles of
- +16 ; type TIUTYPE should be selectable, screen them out
- +17 ; with BADTYPES.
- +18 ; TIUFLDS - array of fields to be filed later in FILE^TIUFIX1.
- +19 ; See warning in MAKE^TIUFIX1 concerning possible
- +20 ; need to kill nodes of TIUFLDS before calling MAKE.
- +21 ; DFN, TITLDA, TIU - Patient, Document title, Demographics
- +22 ; /visit array.
- +23 ; Must be gotten from user and passed back.
- +24 ; Used in GETRECNW to create docmt, in MERGTEXT
- +25 ; to create components.
- +26 KILL ^TMP("TIUPRFUP",$JOB)
- +27 NEW DEFAULT,BADTYPES,ASK,TIURET
- +28 ; -- Initialize SUCCESS to 0^Error msg:
- +29 SET SUCCESS="0^Patient, visit, and title are required."
- +30 ; -- Get patient and visit, and title:
- +31 SET DFN=+$$PATIENT^TIULA
- if DFN'>0
- QUIT
- +32 DO ENPN^TIUVSIT(.TIU,+DFN,1)
- +33 IF '$DATA(TIU)
- QUIT
- +34 IF '$$CHEKPN^TIUCHLP(.TIU)
- KILL TIU
- QUIT
- +35 ; -- 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:
- +36 SET BADTYPES=""
- SET ASK=0
- +37 DO GETTITLE^TIUFIX(.SUCCESS,TIUTYPE,.TIUFLDS,.TITLDA,BADTYPES,ASK)
- +38 if TITLDA'>0
- QUIT
- +39 SET TIURET=$$SELECT^TIUPRF1(+TITLDA,DFN)
- +40 IF 'TIURET
- SET SUCCESS="0^Patient Record Flag Action is Required."
- QUIT
- +41 SET ^TMP("TIUPRFUP",$JOB)=TIURET
- +42 ; -- If consistent and complete, set SUCCESS=1:
- +43 SET SUCCESS=1
- GETX ;
- +1 QUIT