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

TIUPUTSX.m

Go to the documentation of this file.
  1. TIUPUTSX ; SLC/MAM - Uploading Op Reports to SURGERY file #130 ;11/15/01
  1. ;;1.0;TEXT INTEGRATION UTILITIES;**129**;Jun 20, 1997
  1. ; External References in TIUPUTSX:
  1. ; DBIA 3477 ^SRF
  1. LOOKUP ; Upload Lookup Method for Document Definition Operative Report
  1. ; -- Requires lookup variables TIUSRCN, TIUSSN, & TIUODT --
  1. ;These contain the transcribed data needed by the Lookup Method
  1. ;to look up the desired target record in the SURGERY file, and to
  1. ;check that the record is consistent with at least one other item
  1. ;of transcribed data.
  1. ;Lookup variables must be listed in the Op Report Upload Header
  1. ;Definition. They are set to their corresponding transcribed values
  1. ;in GETREC^TIUPUTC1.
  1. ; -- Sets Y= SURGERY record CASE NUMBER (the .001 field in the SURGERY
  1. ; file, #130) --
  1. N DFN,TIUSR0
  1. ; -- If lookup variable values are invalid or missing from
  1. ; transcription, set Y = -1 and quit --
  1. I $S('$D(TIUSSN):1,$G(TIUSRCN)']"":1,$G(TIUSSN)?4N:1,$G(TIUSSN)']"":1,$G(TIUODT)'>0:1,1:0) S Y=-1 G LOOKUPX
  1. I TIUSSN?3N1P2N1P4N.E S TIUSSN=$TR(TIUSSN,"-/","")
  1. I TIUSSN["?" S Y=-1 G LOOKUPX
  1. ; -- Kill unwanted field nodes of header caption array --
  1. ;After this lookup (in STUFREC^TIUPUTC), the software uses array
  1. ;TIUHDR to try to file transcribed data for ALL captions which
  1. ;specify field numbers in the Upload Header Definition. Since some
  1. ;of these transcribed data may not be accurate, it is important NOT to
  1. ;file them unless they are intended for filing. (They may be included
  1. ;in the transcription for administrative purposes, or to help
  1. ;look up the correct target record, but NOT BE INTENDED for filing.)
  1. ;Since one can't know what captions sites may mistakenly have
  1. ;attributed field numbers to, it may be best to save out any nodes
  1. ;that are intended for filing, kill the whole array, and then
  1. ;replace the saved nodes. For Op Reports, NO fields are intended for
  1. ;filing (except the text field, of course), so we kill ALL nodes
  1. ;of TIUHDR.
  1. K TIUHDR
  1. ; -- Get the 0-node of the SURGERY record which corresponds to
  1. ; the transcribed CASE NUMBER --
  1. S TIUSR0=$G(^SRF(TIUSRCN,0))
  1. ; -- Get the patient that corresponds to transcribed SSN --
  1. S DFN=+$$PATIENT^TIULA(TIUSSN)
  1. ; -- Confirm that the patient from the SURGERY record matches
  1. ; the patient from the transcribed SSN --
  1. I +TIUSR0'=DFN S Y=-1 G LOOKUPX
  1. ; -- Confirm that the transcribed OPERATION DATE matches the OPERATION
  1. ;DATE from the SURGERY record --
  1. I $$IDATE^TIULC(TIUODT)'=$P($P(TIUSR0,U,9),".") S Y=-1 G LOOKUPX
  1. ; -- If the data are consistent, set Y = transcribed CASE NUMBER,
  1. ;(the .001 field in the SURGERY file) --
  1. S Y=TIUSRCN
  1. LOOKUPX Q
  1. FIX ; Filing Error Resolution Code for Docmt Def Operative Report
  1. ; -- Called by MRT Review Filing Events option (FILERR^TIURE)
  1. ; if BUFDA exists; otherwise called from an alert
  1. ; (DISPLAY^TIUPEVNT). Warning: XQADATA may be left around
  1. ; from a PREVIOUS alert, so don't use it's existence to
  1. ; determine how this was called. --
  1. ;
  1. N TIUOK,TIUOUT,X,Y,SURGDA,RETRY,DIC,DWPK,TIUBUF,TIUERRDA
  1. N ECHO,TIUSR0
  1. ; -- Inquire to SURGERY file and let user select the correct
  1. ; target record --
  1. F D Q:+$G(TIUOUT)!$G(TIUOK)
  1. . N DIC,X,Y,DA,DIQ
  1. . W ! S DIC=130,DIC(0)="AEMNQ"
  1. . S DIC("A")="Select Patient or Surgery Case Number: "
  1. . D ^DIC I +Y'>0 S TIUOUT=1 W !,"OK, you can try again later" Q
  1. . ; -- Show user the selected record in its entirety and get
  1. . ; user's confirmation --
  1. . S (DA,SURGDA)=+Y,DIQ(0)="R" ; Show case number
  1. . W ! D EN^DIQ
  1. . S TIUOK=$$READ^TIUU("Y","... Is this the correct Surgery record","YES","^D RECDHELP^TIUPUTSX")
  1. . I $D(DIRUT) S TIUOUT=1 W !,"OK, you can try again later"
  1. ; -- Quit if user has not selected and confirmed a record --
  1. I '$G(TIUOK) G FIXEXIT
  1. ; -- Present user with correct header data corresponding to
  1. ; selected record --
  1. W !!,"To file the transcribed Surgeon's Dictation into the Surgery record you have"
  1. W !,"just selected, you will need to correct the upload data in its temporary"
  1. W !,"storage place, and then try again to file it."
  1. S TIUSR0=$G(^SRF(SURGDA,0))
  1. ; -- Force $$NAME,SSN^TIULO to reinitialize pt demographics --
  1. N VADM,VA,VAERR
  1. W !!,"The stored upload header data for ",$$NAME^TIULS($$NAME^TIULO(+TIUSR0),"LAST,FIRST MI")
  1. W !,"should be corrected to read:"
  1. W !!,"PATIENT SSN:",?20,$$SSN^TIULO(+TIUSR0)
  1. W !,"CASE NUMBER:",?20,SURGDA
  1. W !,"OPERATION DATE:",?20,$$DATE^TIULS($P($P(TIUSR0,U,9),".")),!
  1. ; -- Note: We did NOT present the patient name in the data (above)
  1. ; that should be corrected. The patient name tends to be ambiguous
  1. ; and is not used in the Lookup Method, so we don't wish to imply
  1. ; that it IS used --
  1. I '$$READ^TIUU("EA","Press RETURN to continue...") W !,"OK, you can try again later" G FIXEXIT
  1. ; -- Get 8925.2 Buffer IFN and 8925.4 Upload Log Event IFN from
  1. ; calling routine TIURE or TIUPEVNT --
  1. I +$G(BUFDA) S TIUBUF=+BUFDA,TIUERRDA=+$G(ERRDA)
  1. I '$G(BUFDA),+$G(XQADATA) S TIUBUF=+$G(XQADATA),TIUERRDA=+$P(XQADATA,";",3)
  1. I '$G(TIUBUF)!'$G(TIUERRDA) W !,"Can't find stored upload record; see IRM" H 5 G FIXEXIT
  1. I '$G(TIUERRDA) S TIUERRDA=0
  1. ; -- Let user correct the header data in the TIU UPLOAD BUFFER file
  1. ; entry, and then try (again) to file it in the SURGERY file --
  1. W !!,"You may now correct the stored upload data."
  1. S DIC="^TIU(8925.2,"_+TIUBUF_",""TEXT"",",DWPK=1 D EN^DIWE
  1. S RETRY=$$READ^TIUU("YO","Are you ready to file this data in the Surgery file","YES","^D FILEHELP^TIUPUTSX")
  1. ; -- Delete current filing error alert, mark the current error
  1. ; resolved in the TIU UPLOAD LOG file, and try to file the data
  1. ; from the corrected TIU UPLOAD BUFFER file entry into
  1. ; the SURGERY file. (If data fails to file again, a NEW alert is
  1. ; generated during that process.) --
  1. I 'RETRY W !,"OK, you can try again later." G FIXEXIT
  1. S ECHO=1 ; Will write "Filing Record//Resolving Error..."
  1. D ALERTDEL^TIUPEVNT(TIUBUF),RESOLVE^TIUPEVNT(TIUERRDA,ECHO),FILE^TIUUPLD(TIUBUF)
  1. I $G(BUFDA),'$G(TIUDONE) W !,"Old error marked resolved; new error created. New error may take several more",!,"seconds to file, and may not be within current date/time range.",! H 5 ; Feedback for MRT option
  1. FIXEXIT ;
  1. ; -- Set variables to go to exit for DISPLAY^TIUPEVNT
  1. ; or FILERR^TIURE immediately upon return from this resolve
  1. ; code. (Everything they do after executing the resolve code
  1. ; has been incorporated INTO THIS CODE.)
  1. K EVNTDA S TIUDONE=1
  1. Q
  1. ;
  1. RECDHELP ;Help for correct record prompt
  1. W !,"Is this the Surgery record you wish to upload the transcribed data into?"
  1. W !,"If not, answer NO and select a different record, or enter '^' to come back",!,"and resolve the filing error later."
  1. Q
  1. FILEHELP ;Help for retrying the upload filer prompt
  1. W !,"If you are sure that you have identified the correct Surgery record, and have"
  1. W !,"corrected the stored header data accordingly, then answer YES to try again"
  1. W !,"to upload the data into the Surgery record."
  1. W !,"If you answer NO, the corrected data will remain in temporary storage,"
  1. W !,"the filing error alert will remain in place, and you can attempt to resolve"
  1. W !,"the alert later."
  1. Q