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

VAFCMG01.m

Go to the documentation of this file.
  1. VAFCMG01 ;ALB/JRP,LTL-DEMOGRAPHIC MERGE SCREEN ;18-OCT-1996
  1. ;;5.3;Registration;**149**;Aug 13, 1993
  1. ;
  1. ;NOTE: This routine contains line tags used to implement a
  1. ; List Manager user interface
  1. ;
  1. EN(VAFCDFN,VAFCARR,VAFCFROM,VAFCEVDT) ;Main entry point
  1. ; - calls List Manager interface
  1. ;
  1. ;Input : VAFCDFN - Pointer to entry in PATIENT file (#2) to merge
  1. ; data into
  1. ; VAFCARR - Array contain data to merge (full global reference)
  1. ; Defaults to ^TMP("VAFC-MERGE-FROM",$J)
  1. ; VAFCARR() should be set as follows:
  1. ; VAFCARR(File,Field) = Value
  1. ; Where File = File number Value is from
  1. ; Field = Field number Value is from
  1. ; Value = Info to merge
  1. ; Notes: Dates must be in FileMan format
  1. ; : Special considerations for Value
  1. ; "@" - Displays <DELETE> and deletes
  1. ; local value if merged
  1. ; "^text" - Displays text and ignores
  1. ; field if merged
  1. ; NULL - Displays <UNSPECIFIED> and
  1. ; ignores field if merged
  1. ; Doesn't exist - Displays <UNSPECIFIED>
  1. ; and ignores field
  1. ; if merged
  1. ; VAFCFROM - Text denoting where merge data came from (1-35)
  1. ; Example: ALBANY VAMC
  1. ; Example: CIRN
  1. ; Defaults to local facility name
  1. ; VAFCEVDT - Date/time merge data was instantiated (FileMan)
  1. ; Example: Date/time data changed at remote site
  1. ; Defaults to current date/time
  1. ;Output : -21 - User exited via '^^' and differences exits
  1. ; -20 - User exited via '^^' and no differences
  1. ; -11 - User exited via '^' and differences exits
  1. ; -10 - User exited via '^' and no differences
  1. ; -1 - Error occurred / bad input
  1. ; 0 - User quit and no differences
  1. ; 1 - User quit and differences exist
  1. ; 10 - User done and no differences
  1. ; 11 - User done and differences exist
  1. ; 20 - User rejected data and no differences
  1. ; 21 - User rejected data and differences exist
  1. ;
  1. ;Notes : File 2 is the only file currently supported (i.e. multiples
  1. ; are not supported)
  1. ; : The following fields are the only fields currently supported
  1. ; .01, .02, .03, .05, .08, .09, .111, .1112, .112, .113
  1. ; .114, .115, .117, .131, .132, .211, .219, .2403, .301
  1. ; .302, .31115, .323, .351, 391, 1901
  1. ;
  1. ;Check input
  1. S VAFCDFN=+$G(VAFCDFN)
  1. Q:('VAFCDFN) -1
  1. Q:('$D(^DPT(VAFCDFN))) -1
  1. S VAFCARR=$G(VAFCARR)
  1. S:(VAFCARR="") VAFCARR="^TMP(""VAFC-MERGE-FROM"","_$J_")"
  1. Q:('$O(@VAFCARR@(2,0))) -1
  1. S VAFCEVDT=+$G(VAFCEVDT)
  1. S:('VAFCEVDT) VAFCEVDT=$$NOW^VAFCMGU0(1)
  1. S VAFCFROM=$G(VAFCFROM)
  1. S:(VAFCFROM="") VAFCFROM=$P($$SITE^VASITE(),"^",2)
  1. S VAFCFROM=$E(VAFCFROM,1,35)
  1. ;Declare variables
  1. N VAFCDONE,VAFCDIFF,VAFCRJCT,VAFCEXIT,FRSTDGT,LASTDGT,OUTPUT
  1. ;Initialize 'Done' flag
  1. S VAFCDONE=0
  1. ;Initialize 'Differences' flag
  1. S VAFCDIFF=0
  1. ;Initialize 'Reject' flag
  1. S VAFCRJCT=0
  1. ;Initialize 'Exit' flag
  1. S VAFCEXIT=0
  1. ;Call List Manager interface
  1. D EN^VALM("VAFC EXCPT MERGE SCREEN")
  1. ;Determine last digit of output
  1. ;No differences
  1. S LASTDGT=0
  1. ;Differences exist
  1. S:(VAFCDIFF) LASTDGT=1
  1. ;Determine first digit of output
  1. ;User quit
  1. S FRSTDGT=0
  1. ;User done
  1. S:(VAFCDONE) FRSTDGT=1
  1. ;User rejected data
  1. S:(VAFCRJCT) FRSTDGT=2
  1. ;User aborted via up arrow
  1. S:(VAFCEXIT) FRSTDGT=0-VAFCEXIT
  1. ;Combine digits of output
  1. S OUTPUT=FRSTDGT_LASTDGT
  1. ;Done
  1. Q OUTPUT
  1. ;
  1. ;
  1. ;Input : VAFCDFN - Pointer to entry in PATIENT file (#2) data is
  1. ; being merged into
  1. ; VAFCFROM - Text denoting where merge data came from
  1. ; VAFCEVDT - Date/time merge data was instantiated (FileMan)
  1. ; All variables set by List Manager interface
  1. ;Output : Header to use for List Manager interface
  1. ;Notes : Existance/validity of input variables is assumed
  1. ;
  1. ;Declare variables
  1. N DATA,LINE,IENS,PATDATA,ERRDATA
  1. ;Get patient info needed to build header
  1. D GETDATA^VAFCMGU0(VAFCDFN,1,"PATDATA","ERRDATA")
  1. ;Build patient portion of header
  1. S IENS=VAFCDFN_","
  1. ;Add name
  1. S DATA=$G(PATDATA(2,IENS,.01))
  1. S:(DATA="") DATA="PATIENT NAME NOT ON FILE"
  1. S LINE=DATA
  1. ;Add last four of SSN
  1. S DATA=$E($G(PATDATA(2,IENS,.09)),6,10)
  1. S:(DATA="") DATA="????"
  1. S DATA=" ("_DATA_")"
  1. S LINE=LINE_DATA
  1. ;Add date of birth
  1. S DATA=$G(PATDATA(2,IENS,.03))
  1. I (DATA'="") D
  1. .S DATA=$$EX2INDT^VAFCMGU0(DATA)
  1. .S DATA=$$IN2EXDT^VAFCMGU0($P(DATA,".",1))
  1. S:(DATA="") DATA="UNKNOWN"
  1. S DATA="DOB: "_DATA
  1. S LINE=$$INSERT^VAFCMGU0(DATA,LINE,44)
  1. ;Add date of death
  1. S DATA=$G(PATDATA(2,IENS,.351))
  1. I (DATA'="") D
  1. .S DATA=$$EX2INDT^VAFCMGU0(DATA)
  1. .S DATA=$$IN2EXDT^VAFCMGU0($P(DATA,".",1))
  1. S:(DATA="") DATA="N/A"
  1. S DATA="DOD: "_DATA
  1. S LINE=$$INSERT^VAFCMGU0(DATA,LINE,63)
  1. S VALMHDR(1)=LINE
  1. ;Build remote portion of header
  1. ;Add where data came from
  1. ;S LINE="Data From: "_VAFCFROM
  1. ;Last local edit, check for audit
  1. S (DATA,LINE)="" D:$O(^DIA(2,"B",VAFCDFN,0))
  1. .S DATA=$P($G(^DIA(2,0)),U,3)+1
  1. .S DATA=$O(^DIA(2,"B",VAFCDFN,DATA),-1)
  1. .S DATA=$$FMTE^XLFDT($P($G(^DIA(2,DATA,0)),U,2),"2P")
  1. ;if no audit, check pivot file
  1. D:DATA']""&($O(^VAT(391.71,"C",VAFCDFN,0)))
  1. .S DATA=$P($G(^VAT(391.71,0)),U,3)+1
  1. .S DATA=$O(^VAT(391.71,"C",VAFCDFN,DATA),-1)
  1. .S DATA=$$FMTE^XLFDT($P($G(^VAT(391.71,DATA,0)),U),"2P")
  1. S DATA="Last Local Edit: "_$S(DATA]"":DATA,1:"Unknown")
  1. S LINE=$$INSERT^VAFCMGU0(DATA,LINE,0)
  1. ;Add event date/time
  1. S DATA=$E(VAFCFROM,1,28)_" Event Date: "_$$IN2EXDT^VAFCMGU0($P(VAFCEVDT,".",1))
  1. S LINE=$$INSERT^VAFCMGU0(DATA,LINE,40)
  1. S VALMHDR(2)=LINE
  1. ;Done
  1. Q
  1. ;
  1. INITSCRN ;Entry point to build screen
  1. ;
  1. ;Input : VAFCDFN - Pointer to entry in PATIENT file (#2) to merge
  1. ; data into
  1. ; VAFCARR - Array contain data to merge (full global reference)
  1. ; VAFCARR() should be set as follows:
  1. ; VAFCARR(File,Field) = Value
  1. ; Where File = File number Value is from
  1. ; Field = Field number Value is from
  1. ; Value = Info to merge
  1. ; Notes: Dates must be in FileMan format
  1. ; : Special considerations for Value
  1. ; "@" - Displays <DELETE> and deletes
  1. ; local value if merged
  1. ; "^text" - Displays text and ignores
  1. ; field if merged
  1. ; NULL - Displays <UNSPECIFIED> and
  1. ; ignores field if merged
  1. ; Doesn't exist - Displays <UNSPECIFIED>
  1. ; and ignores field
  1. ; if merged
  1. ; VAFCFROM - Text denoting where merge data came from (1-35)
  1. ; VAFCEVDT - Date/time merge data was instantiated (FileMan)
  1. ; All variables set by List Manager Interface
  1. ;Output : Display area and variables required List Manager interface
  1. ; Display
  1. ; VALMAR(Line,0) = Line of text in display
  1. ; Indexes
  1. ; VALMAR("IDX",Line,Entry) = ""
  1. ; VALMAR("E2F",Entry,N) = File^Field
  1. ; N => Allows for multiple fields per entry (starts with 1)
  1. ; VALMAR("E2G",Entry) = Group entry is contained in
  1. ; VALMAR("GRP",Group) = First line of group in display
  1. ; Note: The E2F and E2G indexes are only set if the data
  1. ; to merge does not match the local data
  1. ;Notes : Existance/validity of input variables is assumed
  1. ;
  1. ;Declare variables
  1. D CHGCAP^VALM("VAFLOCAL",$P($$SITE^VASITE(),U,2))
  1. D CHGCAP^VALM("REMOTE",$G(VAFCFROM))
  1. N VAFCDOTS
  1. S VAFCDOTS=1
  1. ;Initialize global locations
  1. K @VALMAR,^TMP("VAFC-UNDO")
  1. ;Build entire display
  1. S VALMCNT=1
  1. D BLDALL^VAFCMGB
  1. ;No differences found
  1. S:('$D(@VALMAR@("E2F"))) VALMSG="** No differences found **"
  1. ;Done
  1. S VALMCNT=VALMCNT-1
  1. S VALMBG=1
  1. Q
  1. ;
  1. CLEANUP ;Entry point to clean up
  1. ;
  1. ;Input : All variables set by List Manager interface
  1. ;Output : None
  1. ;
  1. ;Up arrow out ?
  1. I (Y=-1) D
  1. .;Single up arrow
  1. .S VAFCEXIT=1
  1. .;Double up arrow
  1. .S:($E(X,1,2)="^^") VAFCEXIT=2
  1. ;Differences exist ?
  1. S:($D(@VALMAR@("E2F"))) VAFCDIFF=1
  1. ;Clean up global locations used
  1. K @VALMAR,^TMP("VAFC-UNDO")
  1. ;Switch to full screen
  1. D FULL^VALM1
  1. ;Done
  1. Q