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

TIUCNFIX.m

Go to the documentation of this file.
  1. TIUCNFIX ; SLC/MAM - Resolve Upload Filing Errors for Consults ;05/06/02
  1. ;;1.0;TEXT INTEGRATION UTILITIES;**131**;Jun 20, 1997
  1. CNFIX ; Consults 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. ;Modeled on PNFIX^TIUPNFIX, with optional change to PN added
  1. ;
  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 CNFIXX
  1. I '$D(^TIU(8925.4,+$G(TIUEVNT),0)) S SUCCESS="0^Upload Log event is missing or invalid." G CNFIXX
  1. S TIUBUF=$$BUFFER^TIUFIX2(TIUEVNT) I +TIUBUF'>0 S SUCCESS=TIUBUF G CNFIXX
  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. ; -- If all is NOT in order to create a consult,
  1. ; and type is still consults, exit w/o creating docmt:
  1. I 'SUCCESS,TIUTYPE=OLDTYPE G CNFIXX
  1. ; -- If user chose to create a progress note instead
  1. ; of a consult, kill REQUESTING PACKAGE node of array
  1. ; and get progress note title:
  1. I TIUTYPE'=OLDTYPE D G:'SUCCESS CNFIXX
  1. . K TIUFLDS(1405)
  1. . ; -- Get progress notes title
  1. . ; (Screen out consult titles)
  1. . ; (Don't ASK if user wants to change to PN;
  1. . ; user is already changing to PN):
  1. . S BADTYPES=+$$CLASS^TIUCNSLT,ASK=0
  1. . W !!," OK, changing document to a progress note..."
  1. . D GETTITLE^TIUFIX(.SUCCESS,.TIUTYPE,.TIUFLDS,.TITLDA,BADTYPES,ASK)
  1. ; -- If all is in order to create a consult,
  1. ; or if type has changed to progress note,
  1. ; then continue and create consult/progress note,
  1. ; file fields remaining in TIUFLDS, 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. CNFIXX I +SUCCESS S TIUDONE=1
  1. ; -- If error successfully resolved, and type changed,
  1. ; update type in event log entry:
  1. I $G(TIUDONE),TIUTYPE'=OLDTYPE D
  1. . N DIE,DR,DA,TYPE
  1. . S TYPE="PROGRESS NOTES"
  1. . S DIE=8925.4,DR=".03////"_TYPE,DA=+TIUEVNT
  1. . D ^DIE
  1. Q:$G(TIUDONE)
  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 check data
  1. ; Get from user: Patient, Visit, Document Title, Consult
  1. ;Request Number. Check that data are consistent. Reset Request
  1. ;Number into array TIUFLDS. Ask user if they want to change
  1. ;document type to Progress Note.
  1. ;Modeled on GETCHECK^TIUPNFIX, with optional change to PN added
  1. ; -- Get patient and visit
  1. PAT S DFN=+$$PATIENT^TIULA
  1. N TIUCNNBR,CHANGEPT,ASK,BADTYPES
  1. S SUCCESS="0^Patient and Visit are Required."
  1. Q:DFN'>0
  1. D ENPN^TIUVSIT(.TIU,+DFN,1)
  1. I '$D(TIU) Q
  1. I '$$CHEKPN^TIUCHLP(.TIU) K TIU Q
  1. ; -- Get title
  1. ; (No need to limit title beyond
  1. ; making sure it has type TIUTYPE.)
  1. ; (ASK if user wants to change to PN):
  1. S BADTYPES="",ASK=1
  1. D GETTITLE^TIUFIX(.SUCCESS,.TIUTYPE,.TIUFLDS,.TITLDA,BADTYPES,ASK)
  1. ; -- If user didn't select title or wants to change to
  1. ; Progress Note, quit:
  1. I TITLDA'>0 Q
  1. I TIUTYPE=3 Q
  1. ; -- Get consult request:
  1. D GETCNSLT(.SUCCESS,.TIUTYPE,.TIUFLDS,.CHANGEPT,.TIUCNNBR)
  1. I $G(CHANGEPT) G PAT
  1. I TIUCNNBR'>0 Q
  1. ; -- We now have a valid request number, consistent with DFN.
  1. ; Transform Consult Request # into form C.# and reset
  1. ; request node:
  1. S TIUCNNBR=$P(TIUCNNBR,";") ; was #;GMR(123,
  1. S TIUFLDS(1405)=$$TRNSFRM^TIUPEFIX(TIUTYPE,1405,TIUCNNBR)
  1. S SUCCESS=1
  1. Q
  1. ;
  1. GETCNSLT(SUCCESS,TIUTYPE,TIUFLDS,CHANGEPT,TIUCNNBR) ; Get consult
  1. ;request from user
  1. N CLINPROC,TIUOVR,DOCNUM,Y
  1. S SUCCESS="0^Consult Request is Required."
  1. S CLINPROC=0,TIUOVR=1,DOCNUM=0 ;Don't have a docmt yet
  1. S TIUCNNBR=$$GETCNSLT^TIUCNSLT(DFN,CLINPROC,DOCNUM,TIUOVR)
  1. ; -- Pt has no requests:
  1. I +TIUCNNBR=-1 D Q
  1. . W !!,"This patient has no consult requests; please make sure you have the"
  1. . W !,"correct patient."
  1. . S Y=$$READ^TIUU("YO"," Want to change the patient","YES")
  1. . I Y S CHANGEPT=1 Q
  1. . I $D(DIRUT) Q
  1. . ; -- Ask user if want to change to PN:
  1. . S Y=$$ASKCHNG^TIUFIX(2,.TIUTYPE)
  1. ; -- User did not select request:
  1. I +TIUCNNBR=0 D
  1. . W !!,"To upload into a consult title, you must select a request."
  1. . S Y=$$ASKCHNG^TIUFIX(2,.TIUTYPE)
  1. Q
  1. ;