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