- VAFCMG01 ;ALB/JRP,LTL-DEMOGRAPHIC MERGE SCREEN ;18-OCT-1996
- ;;5.3;Registration;**149**;Aug 13, 1993
- ;
- ;NOTE: This routine contains line tags used to implement a
- ; List Manager user interface
- ;
- EN(VAFCDFN,VAFCARR,VAFCFROM,VAFCEVDT) ;Main entry point
- ; - calls List Manager interface
- ;
- ;Input : VAFCDFN - Pointer to entry in PATIENT file (#2) to merge
- ; data into
- ; VAFCARR - Array contain data to merge (full global reference)
- ; Defaults to ^TMP("VAFC-MERGE-FROM",$J)
- ; VAFCARR() should be set as follows:
- ; VAFCARR(File,Field) = Value
- ; Where File = File number Value is from
- ; Field = Field number Value is from
- ; Value = Info to merge
- ; Notes: Dates must be in FileMan format
- ; : Special considerations for Value
- ; "@" - Displays <DELETE> and deletes
- ; local value if merged
- ; "^text" - Displays text and ignores
- ; field if merged
- ; NULL - Displays <UNSPECIFIED> and
- ; ignores field if merged
- ; Doesn't exist - Displays <UNSPECIFIED>
- ; and ignores field
- ; if merged
- ; VAFCFROM - Text denoting where merge data came from (1-35)
- ; Example: ALBANY VAMC
- ; Example: CIRN
- ; Defaults to local facility name
- ; VAFCEVDT - Date/time merge data was instantiated (FileMan)
- ; Example: Date/time data changed at remote site
- ; Defaults to current date/time
- ;Output : -21 - User exited via '^^' and differences exits
- ; -20 - User exited via '^^' and no differences
- ; -11 - User exited via '^' and differences exits
- ; -10 - User exited via '^' and no differences
- ; -1 - Error occurred / bad input
- ; 0 - User quit and no differences
- ; 1 - User quit and differences exist
- ; 10 - User done and no differences
- ; 11 - User done and differences exist
- ; 20 - User rejected data and no differences
- ; 21 - User rejected data and differences exist
- ;
- ;Notes : File 2 is the only file currently supported (i.e. multiples
- ; are not supported)
- ; : The following fields are the only fields currently supported
- ; .01, .02, .03, .05, .08, .09, .111, .1112, .112, .113
- ; .114, .115, .117, .131, .132, .211, .219, .2403, .301
- ; .302, .31115, .323, .351, 391, 1901
- ;
- ;Check input
- S VAFCDFN=+$G(VAFCDFN)
- Q:('VAFCDFN) -1
- Q:('$D(^DPT(VAFCDFN))) -1
- S VAFCARR=$G(VAFCARR)
- S:(VAFCARR="") VAFCARR="^TMP(""VAFC-MERGE-FROM"","_$J_")"
- Q:('$O(@VAFCARR@(2,0))) -1
- S VAFCEVDT=+$G(VAFCEVDT)
- S:('VAFCEVDT) VAFCEVDT=$$NOW^VAFCMGU0(1)
- S VAFCFROM=$G(VAFCFROM)
- S:(VAFCFROM="") VAFCFROM=$P($$SITE^VASITE(),"^",2)
- S VAFCFROM=$E(VAFCFROM,1,35)
- ;Declare variables
- N VAFCDONE,VAFCDIFF,VAFCRJCT,VAFCEXIT,FRSTDGT,LASTDGT,OUTPUT
- ;Initialize 'Done' flag
- S VAFCDONE=0
- ;Initialize 'Differences' flag
- S VAFCDIFF=0
- ;Initialize 'Reject' flag
- S VAFCRJCT=0
- ;Initialize 'Exit' flag
- S VAFCEXIT=0
- ;Call List Manager interface
- D EN^VALM("VAFC EXCPT MERGE SCREEN")
- ;Determine last digit of output
- ;No differences
- S LASTDGT=0
- ;Differences exist
- S:(VAFCDIFF) LASTDGT=1
- ;Determine first digit of output
- ;User quit
- S FRSTDGT=0
- ;User done
- S:(VAFCDONE) FRSTDGT=1
- ;User rejected data
- S:(VAFCRJCT) FRSTDGT=2
- ;User aborted via up arrow
- S:(VAFCEXIT) FRSTDGT=0-VAFCEXIT
- ;Combine digits of output
- S OUTPUT=FRSTDGT_LASTDGT
- ;Done
- Q OUTPUT
- ;
- ;
- ;Input : VAFCDFN - Pointer to entry in PATIENT file (#2) data is
- ; being merged into
- ; VAFCFROM - Text denoting where merge data came from
- ; VAFCEVDT - Date/time merge data was instantiated (FileMan)
- ; All variables set by List Manager interface
- ;Output : Header to use for List Manager interface
- ;Notes : Existance/validity of input variables is assumed
- ;
- ;Declare variables
- N DATA,LINE,IENS,PATDATA,ERRDATA
- ;Get patient info needed to build header
- D GETDATA^VAFCMGU0(VAFCDFN,1,"PATDATA","ERRDATA")
- ;Build patient portion of header
- S IENS=VAFCDFN_","
- ;Add name
- S DATA=$G(PATDATA(2,IENS,.01))
- S:(DATA="") DATA="PATIENT NAME NOT ON FILE"
- S LINE=DATA
- ;Add last four of SSN
- S DATA=$E($G(PATDATA(2,IENS,.09)),6,10)
- S:(DATA="") DATA="????"
- S DATA=" ("_DATA_")"
- S LINE=LINE_DATA
- ;Add date of birth
- S DATA=$G(PATDATA(2,IENS,.03))
- I (DATA'="") D
- .S DATA=$$EX2INDT^VAFCMGU0(DATA)
- .S DATA=$$IN2EXDT^VAFCMGU0($P(DATA,".",1))
- S:(DATA="") DATA="UNKNOWN"
- S DATA="DOB: "_DATA
- S LINE=$$INSERT^VAFCMGU0(DATA,LINE,44)
- ;Add date of death
- S DATA=$G(PATDATA(2,IENS,.351))
- I (DATA'="") D
- .S DATA=$$EX2INDT^VAFCMGU0(DATA)
- .S DATA=$$IN2EXDT^VAFCMGU0($P(DATA,".",1))
- S:(DATA="") DATA="N/A"
- S DATA="DOD: "_DATA
- S LINE=$$INSERT^VAFCMGU0(DATA,LINE,63)
- S VALMHDR(1)=LINE
- ;Build remote portion of header
- ;Add where data came from
- ;S LINE="Data From: "_VAFCFROM
- ;Last local edit, check for audit
- S (DATA,LINE)="" D:$O(^DIA(2,"B",VAFCDFN,0))
- .S DATA=$P($G(^DIA(2,0)),U,3)+1
- .S DATA=$O(^DIA(2,"B",VAFCDFN,DATA),-1)
- .S DATA=$$FMTE^XLFDT($P($G(^DIA(2,DATA,0)),U,2),"2P")
- ;if no audit, check pivot file
- D:DATA']""&($O(^VAT(391.71,"C",VAFCDFN,0)))
- .S DATA=$P($G(^VAT(391.71,0)),U,3)+1
- .S DATA=$O(^VAT(391.71,"C",VAFCDFN,DATA),-1)
- .S DATA=$$FMTE^XLFDT($P($G(^VAT(391.71,DATA,0)),U),"2P")
- S DATA="Last Local Edit: "_$S(DATA]"":DATA,1:"Unknown")
- S LINE=$$INSERT^VAFCMGU0(DATA,LINE,0)
- ;Add event date/time
- S DATA=$E(VAFCFROM,1,28)_" Event Date: "_$$IN2EXDT^VAFCMGU0($P(VAFCEVDT,".",1))
- S LINE=$$INSERT^VAFCMGU0(DATA,LINE,40)
- S VALMHDR(2)=LINE
- ;Done
- Q
- ;
- INITSCRN ;Entry point to build screen
- ;
- ;Input : VAFCDFN - Pointer to entry in PATIENT file (#2) to merge
- ; data into
- ; VAFCARR - Array contain data to merge (full global reference)
- ; VAFCARR() should be set as follows:
- ; VAFCARR(File,Field) = Value
- ; Where File = File number Value is from
- ; Field = Field number Value is from
- ; Value = Info to merge
- ; Notes: Dates must be in FileMan format
- ; : Special considerations for Value
- ; "@" - Displays <DELETE> and deletes
- ; local value if merged
- ; "^text" - Displays text and ignores
- ; field if merged
- ; NULL - Displays <UNSPECIFIED> and
- ; ignores field if merged
- ; Doesn't exist - Displays <UNSPECIFIED>
- ; and ignores field
- ; if merged
- ; VAFCFROM - Text denoting where merge data came from (1-35)
- ; VAFCEVDT - Date/time merge data was instantiated (FileMan)
- ; All variables set by List Manager Interface
- ;Output : Display area and variables required List Manager interface
- ; Display
- ; VALMAR(Line,0) = Line of text in display
- ; Indexes
- ; VALMAR("IDX",Line,Entry) = ""
- ; VALMAR("E2F",Entry,N) = File^Field
- ; N => Allows for multiple fields per entry (starts with 1)
- ; VALMAR("E2G",Entry) = Group entry is contained in
- ; VALMAR("GRP",Group) = First line of group in display
- ; Note: The E2F and E2G indexes are only set if the data
- ; to merge does not match the local data
- ;Notes : Existance/validity of input variables is assumed
- ;
- ;Declare variables
- D CHGCAP^VALM("VAFLOCAL",$P($$SITE^VASITE(),U,2))
- D CHGCAP^VALM("REMOTE",$G(VAFCFROM))
- N VAFCDOTS
- S VAFCDOTS=1
- ;Initialize global locations
- K @VALMAR,^TMP("VAFC-UNDO")
- ;Build entire display
- S VALMCNT=1
- D BLDALL^VAFCMGB
- ;No differences found
- S:('$D(@VALMAR@("E2F"))) VALMSG="** No differences found **"
- ;Done
- S VALMCNT=VALMCNT-1
- S VALMBG=1
- Q
- ;
- CLEANUP ;Entry point to clean up
- ;
- ;Input : All variables set by List Manager interface
- ;Output : None
- ;
- ;Up arrow out ?
- I (Y=-1) D
- .;Single up arrow
- .S VAFCEXIT=1
- .;Double up arrow
- .S:($E(X,1,2)="^^") VAFCEXIT=2
- ;Differences exist ?
- S:($D(@VALMAR@("E2F"))) VAFCDIFF=1
- ;Clean up global locations used
- K @VALMAR,^TMP("VAFC-UNDO")
- ;Switch to full screen
- D FULL^VALM1
- ;Done
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAFCMG01 9201 printed Feb 19, 2025@00:27:47 Page 2
- VAFCMG01 ;ALB/JRP,LTL-DEMOGRAPHIC MERGE SCREEN ;18-OCT-1996
- +1 ;;5.3;Registration;**149**;Aug 13, 1993
- +2 ;
- +3 ;NOTE: This routine contains line tags used to implement a
- +4 ; List Manager user interface
- +5 ;
- EN(VAFCDFN,VAFCARR,VAFCFROM,VAFCEVDT) ;Main entry point
- +1 ; - calls List Manager interface
- +2 ;
- +3 ;Input : VAFCDFN - Pointer to entry in PATIENT file (#2) to merge
- +4 ; data into
- +5 ; VAFCARR - Array contain data to merge (full global reference)
- +6 ; Defaults to ^TMP("VAFC-MERGE-FROM",$J)
- +7 ; VAFCARR() should be set as follows:
- +8 ; VAFCARR(File,Field) = Value
- +9 ; Where File = File number Value is from
- +10 ; Field = Field number Value is from
- +11 ; Value = Info to merge
- +12 ; Notes: Dates must be in FileMan format
- +13 ; : Special considerations for Value
- +14 ; "@" - Displays <DELETE> and deletes
- +15 ; local value if merged
- +16 ; "^text" - Displays text and ignores
- +17 ; field if merged
- +18 ; NULL - Displays <UNSPECIFIED> and
- +19 ; ignores field if merged
- +20 ; Doesn't exist - Displays <UNSPECIFIED>
- +21 ; and ignores field
- +22 ; if merged
- +23 ; VAFCFROM - Text denoting where merge data came from (1-35)
- +24 ; Example: ALBANY VAMC
- +25 ; Example: CIRN
- +26 ; Defaults to local facility name
- +27 ; VAFCEVDT - Date/time merge data was instantiated (FileMan)
- +28 ; Example: Date/time data changed at remote site
- +29 ; Defaults to current date/time
- +30 ;Output : -21 - User exited via '^^' and differences exits
- +31 ; -20 - User exited via '^^' and no differences
- +32 ; -11 - User exited via '^' and differences exits
- +33 ; -10 - User exited via '^' and no differences
- +34 ; -1 - Error occurred / bad input
- +35 ; 0 - User quit and no differences
- +36 ; 1 - User quit and differences exist
- +37 ; 10 - User done and no differences
- +38 ; 11 - User done and differences exist
- +39 ; 20 - User rejected data and no differences
- +40 ; 21 - User rejected data and differences exist
- +41 ;
- +42 ;Notes : File 2 is the only file currently supported (i.e. multiples
- +43 ; are not supported)
- +44 ; : The following fields are the only fields currently supported
- +45 ; .01, .02, .03, .05, .08, .09, .111, .1112, .112, .113
- +46 ; .114, .115, .117, .131, .132, .211, .219, .2403, .301
- +47 ; .302, .31115, .323, .351, 391, 1901
- +48 ;
- +49 ;Check input
- +50 SET VAFCDFN=+$GET(VAFCDFN)
- +51 if ('VAFCDFN)
- QUIT -1
- +52 if ('$DATA(^DPT(VAFCDFN)))
- QUIT -1
- +53 SET VAFCARR=$GET(VAFCARR)
- +54 if (VAFCARR="")
- SET VAFCARR="^TMP(""VAFC-MERGE-FROM"","_$JOB_")"
- +55 if ('$ORDER(@VAFCARR@(2,0)))
- QUIT -1
- +56 SET VAFCEVDT=+$GET(VAFCEVDT)
- +57 if ('VAFCEVDT)
- SET VAFCEVDT=$$NOW^VAFCMGU0(1)
- +58 SET VAFCFROM=$GET(VAFCFROM)
- +59 if (VAFCFROM="")
- SET VAFCFROM=$PIECE($$SITE^VASITE(),"^",2)
- +60 SET VAFCFROM=$EXTRACT(VAFCFROM,1,35)
- +61 ;Declare variables
- +62 NEW VAFCDONE,VAFCDIFF,VAFCRJCT,VAFCEXIT,FRSTDGT,LASTDGT,OUTPUT
- +63 ;Initialize 'Done' flag
- +64 SET VAFCDONE=0
- +65 ;Initialize 'Differences' flag
- +66 SET VAFCDIFF=0
- +67 ;Initialize 'Reject' flag
- +68 SET VAFCRJCT=0
- +69 ;Initialize 'Exit' flag
- +70 SET VAFCEXIT=0
- +71 ;Call List Manager interface
- +72 DO EN^VALM("VAFC EXCPT MERGE SCREEN")
- +73 ;Determine last digit of output
- +74 ;No differences
- +75 SET LASTDGT=0
- +76 ;Differences exist
- +77 if (VAFCDIFF)
- SET LASTDGT=1
- +78 ;Determine first digit of output
- +79 ;User quit
- +80 SET FRSTDGT=0
- +81 ;User done
- +82 if (VAFCDONE)
- SET FRSTDGT=1
- +83 ;User rejected data
- +84 if (VAFCRJCT)
- SET FRSTDGT=2
- +85 ;User aborted via up arrow
- +86 if (VAFCEXIT)
- SET FRSTDGT=0-VAFCEXIT
- +87 ;Combine digits of output
- +88 SET OUTPUT=FRSTDGT_LASTDGT
- +89 ;Done
- +90 QUIT OUTPUT
- +91 ;
- +1 ;
- +2 ;Input : VAFCDFN - Pointer to entry in PATIENT file (#2) data is
- +3 ; being merged into
- +4 ; VAFCFROM - Text denoting where merge data came from
- +5 ; VAFCEVDT - Date/time merge data was instantiated (FileMan)
- +6 ; All variables set by List Manager interface
- +7 ;Output : Header to use for List Manager interface
- +8 ;Notes : Existance/validity of input variables is assumed
- +9 ;
- +10 ;Declare variables
- +11 NEW DATA,LINE,IENS,PATDATA,ERRDATA
- +12 ;Get patient info needed to build header
- +13 DO GETDATA^VAFCMGU0(VAFCDFN,1,"PATDATA","ERRDATA")
- +14 ;Build patient portion of header
- +15 SET IENS=VAFCDFN_","
- +16 ;Add name
- +17 SET DATA=$GET(PATDATA(2,IENS,.01))
- +18 if (DATA="")
- SET DATA="PATIENT NAME NOT ON FILE"
- +19 SET LINE=DATA
- +20 ;Add last four of SSN
- +21 SET DATA=$EXTRACT($GET(PATDATA(2,IENS,.09)),6,10)
- +22 if (DATA="")
- SET DATA="????"
- +23 SET DATA=" ("_DATA_")"
- +24 SET LINE=LINE_DATA
- +25 ;Add date of birth
- +26 SET DATA=$GET(PATDATA(2,IENS,.03))
- +27 IF (DATA'="")
- Begin DoDot:1
- +28 SET DATA=$$EX2INDT^VAFCMGU0(DATA)
- +29 SET DATA=$$IN2EXDT^VAFCMGU0($PIECE(DATA,".",1))
- End DoDot:1
- +30 if (DATA="")
- SET DATA="UNKNOWN"
- +31 SET DATA="DOB: "_DATA
- +32 SET LINE=$$INSERT^VAFCMGU0(DATA,LINE,44)
- +33 ;Add date of death
- +34 SET DATA=$GET(PATDATA(2,IENS,.351))
- +35 IF (DATA'="")
- Begin DoDot:1
- +36 SET DATA=$$EX2INDT^VAFCMGU0(DATA)
- +37 SET DATA=$$IN2EXDT^VAFCMGU0($PIECE(DATA,".",1))
- End DoDot:1
- +38 if (DATA="")
- SET DATA="N/A"
- +39 SET DATA="DOD: "_DATA
- +40 SET LINE=$$INSERT^VAFCMGU0(DATA,LINE,63)
- +41 SET VALMHDR(1)=LINE
- +42 ;Build remote portion of header
- +43 ;Add where data came from
- +44 ;S LINE="Data From: "_VAFCFROM
- +45 ;Last local edit, check for audit
- +46 SET (DATA,LINE)=""
- if $ORDER(^DIA(2,"B",VAFCDFN,0))
- Begin DoDot:1
- +47 SET DATA=$PIECE($GET(^DIA(2,0)),U,3)+1
- +48 SET DATA=$ORDER(^DIA(2,"B",VAFCDFN,DATA),-1)
- +49 SET DATA=$$FMTE^XLFDT($PIECE($GET(^DIA(2,DATA,0)),U,2),"2P")
- End DoDot:1
- +50 ;if no audit, check pivot file
- +51 if DATA']""&($ORDER(^VAT(391.71,"C",VAFCDFN,0)))
- Begin DoDot:1
- +52 SET DATA=$PIECE($GET(^VAT(391.71,0)),U,3)+1
- +53 SET DATA=$ORDER(^VAT(391.71,"C",VAFCDFN,DATA),-1)
- +54 SET DATA=$$FMTE^XLFDT($PIECE($GET(^VAT(391.71,DATA,0)),U),"2P")
- End DoDot:1
- +55 SET DATA="Last Local Edit: "_$SELECT(DATA]"":DATA,1:"Unknown")
- +56 SET LINE=$$INSERT^VAFCMGU0(DATA,LINE,0)
- +57 ;Add event date/time
- +58 SET DATA=$EXTRACT(VAFCFROM,1,28)_" Event Date: "_$$IN2EXDT^VAFCMGU0($PIECE(VAFCEVDT,".",1))
- +59 SET LINE=$$INSERT^VAFCMGU0(DATA,LINE,40)
- +60 SET VALMHDR(2)=LINE
- +61 ;Done
- +62 QUIT
- +63 ;
- INITSCRN ;Entry point to build screen
- +1 ;
- +2 ;Input : VAFCDFN - Pointer to entry in PATIENT file (#2) to merge
- +3 ; data into
- +4 ; VAFCARR - Array contain data to merge (full global reference)
- +5 ; VAFCARR() should be set as follows:
- +6 ; VAFCARR(File,Field) = Value
- +7 ; Where File = File number Value is from
- +8 ; Field = Field number Value is from
- +9 ; Value = Info to merge
- +10 ; Notes: Dates must be in FileMan format
- +11 ; : Special considerations for Value
- +12 ; "@" - Displays <DELETE> and deletes
- +13 ; local value if merged
- +14 ; "^text" - Displays text and ignores
- +15 ; field if merged
- +16 ; NULL - Displays <UNSPECIFIED> and
- +17 ; ignores field if merged
- +18 ; Doesn't exist - Displays <UNSPECIFIED>
- +19 ; and ignores field
- +20 ; if merged
- +21 ; VAFCFROM - Text denoting where merge data came from (1-35)
- +22 ; VAFCEVDT - Date/time merge data was instantiated (FileMan)
- +23 ; All variables set by List Manager Interface
- +24 ;Output : Display area and variables required List Manager interface
- +25 ; Display
- +26 ; VALMAR(Line,0) = Line of text in display
- +27 ; Indexes
- +28 ; VALMAR("IDX",Line,Entry) = ""
- +29 ; VALMAR("E2F",Entry,N) = File^Field
- +30 ; N => Allows for multiple fields per entry (starts with 1)
- +31 ; VALMAR("E2G",Entry) = Group entry is contained in
- +32 ; VALMAR("GRP",Group) = First line of group in display
- +33 ; Note: The E2F and E2G indexes are only set if the data
- +34 ; to merge does not match the local data
- +35 ;Notes : Existance/validity of input variables is assumed
- +36 ;
- +37 ;Declare variables
- +38 DO CHGCAP^VALM("VAFLOCAL",$PIECE($$SITE^VASITE(),U,2))
- +39 DO CHGCAP^VALM("REMOTE",$GET(VAFCFROM))
- +40 NEW VAFCDOTS
- +41 SET VAFCDOTS=1
- +42 ;Initialize global locations
- +43 KILL @VALMAR,^TMP("VAFC-UNDO")
- +44 ;Build entire display
- +45 SET VALMCNT=1
- +46 DO BLDALL^VAFCMGB
- +47 ;No differences found
- +48 if ('$DATA(@VALMAR@("E2F")))
- SET VALMSG="** No differences found **"
- +49 ;Done
- +50 SET VALMCNT=VALMCNT-1
- +51 SET VALMBG=1
- +52 QUIT
- +53 ;
- CLEANUP ;Entry point to clean up
- +1 ;
- +2 ;Input : All variables set by List Manager interface
- +3 ;Output : None
- +4 ;
- +5 ;Up arrow out ?
- +6 IF (Y=-1)
- Begin DoDot:1
- +7 ;Single up arrow
- +8 SET VAFCEXIT=1
- +9 ;Double up arrow
- +10 if ($EXTRACT(X,1,2)="^^")
- SET VAFCEXIT=2
- End DoDot:1
- +11 ;Differences exist ?
- +12 if ($DATA(@VALMAR@("E2F")))
- SET VAFCDIFF=1
- +13 ;Clean up global locations used
- +14 KILL @VALMAR,^TMP("VAFC-UNDO")
- +15 ;Switch to full screen
- +16 DO FULL^VALM1
- +17 ;Done
- +18 QUIT