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

VAFCMGA.m

Go to the documentation of this file.
  1. VAFCMGA ;ALB/JRP,LTL-DEMOGRAPHIC MERGE SCREEN ACTIONS ;31-OCT-96
  1. ;;5.3;Registration;**149,477,479**;Aug 13, 1993
  1. ;
  1. ;NOTE: The VAFCMGA* routines contain line tags used to implement
  1. ; the actions of a List Manager user interface. All line
  1. ; tags assume that the following variables and arrays are
  1. ; defined.
  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 cam from (1-35)
  1. ; VAFCEVDT - Date/time merge data was instantiated (FileMan)
  1. ; All variables set by List Manager Interface
  1. ; 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. ;
  1. MRGALL ;Merge all differences
  1. ;
  1. ;Input : See above note on input variables
  1. ;Output : VALMAR() array will be rebuilt accordingly
  1. ;
  1. ;Declare variables
  1. N VAFCDOTS,ENTRY,REBUILD,FILE,FIELD,VALUE,REPEAT
  1. N TMP,IENS,FDAROOT,MSGROOT,QUOTE
  1. S FDAROOT="^TMP(""VAFC-MERGE-UPLOAD"","_$J_",""FDA"")"
  1. S MSGROOT="^TMP(""VAFC-MERGE-UPLOAD"","_$J_",""MSG"")"
  1. S QUOTE=$C(34)
  1. S IENS=VAFCDFN_","
  1. K @FDAROOT,@MSGROOT
  1. ;Build array of differences to merge
  1. N DGNOFDEL S DGNOFDEL=1 ;**477 stop NOK Name x-ref from firing.
  1. NEW EASZIPLK S EASZIPLK=1 ;**477 zipcode lookup for GMT
  1. S ENTRY=""
  1. F S ENTRY=$O(@VALMAR@("E2F",ENTRY)) Q:(ENTRY="") D
  1. .;Remember which group(s) to rebuild
  1. .S TMP=$G(@VALMAR@("E2G",ENTRY))
  1. .S:(TMP'="") REBUILD(TMP)=""
  1. .;Loop through list of fields contained in the entry
  1. .S REPEAT=""
  1. .F S REPEAT=$O(@VALMAR@("E2F",ENTRY,REPEAT)) Q:(REPEAT="") D
  1. ..S TMP=$G(@VALMAR@("E2F",ENTRY,REPEAT))
  1. ..S FILE=+$P(TMP,"^",1)
  1. ..S FIELD=+$P(TMP,"^",2)
  1. ..;Get remote value
  1. ..S VALUE=$G(@VAFCARR@(FILE,FIELD))
  1. ..;Screen for ignore conditions
  1. ..I $P(VALUE,U,3) S VALMSG=$S($G(VALMSG)]"":VALMSG_","_ENTRY,1:"Can't merge unresolved item(s) "_ENTRY) Q
  1. ..S VALUE=$P(VALUE,U)
  1. ..Q:(VALUE="")
  1. ..;Convert "@" to @
  1. ..S:(VALUE=(QUOTE_"@"_QUOTE)) VALUE="@"
  1. ..;Move data into upload array
  1. ..;I $S(ENTRY=6:0,ENTRY=7:0,ENTRY=9:0,1:1) S @FDAROOT@(FILE,IENS,FIELD)=VALUE ;let zipcode populate city, state and county for merge all ;**477 for GMT ;**479 address removed
  1. .. S @FDAROOT@(FILE,IENS,FIELD)=VALUE ;**479 address removed - allow merge
  1. ..;Prepare for undo
  1. ..S ^TMP("VAFC-UNDO",$J,"FDA",FILE,IENS,FIELD)=$$GET1^DIQ(FILE,IENS,FIELD)
  1. ;Merge differences
  1. I (+$O(@FDAROOT@(0))) D FILE^DIE("E",FDAROOT,MSGROOT)
  1. ;Rebuild required portion of display
  1. S VAFCDOTS=1
  1. S ENTRY=""
  1. F S ENTRY=$O(REBUILD(ENTRY)) Q:(ENTRY="") D RBLDGRP^VAFCMGB(ENTRY)
  1. ;No more differences
  1. S:('$D(@VALMAR@("E2F"))) VALMSG="** No differences found **"
  1. ;Done - refresh List Manager display
  1. S VALMBCK="R"
  1. Q
  1. MRGSLCT ;Merge user selected differences
  1. ;
  1. ;Input : See above note on input variables
  1. ;Output : Modified areas of VALMAR() array will be rebuilt accordingly
  1. ;
  1. ;Declare variables
  1. N VAFCDOTS,ENTRY,REBUILD,VALMY,FILE,FIELD,REPEAT
  1. N TMP,IENS,FDAROOT,MSGROOT,QUOTE,UNDO
  1. S QUOTE=$C(34)
  1. S FDAROOT="^TMP(""VAFC-MERGE-UPLOAD"","_$J_",""FDA"")"
  1. S MSGROOT="^TMP(""VAFC-MERGE-UPLOAD"","_$J_",""MSG"")"
  1. S IENS=VAFCDFN_","
  1. K @FDAROOT,@MSGROOT
  1. ;Prompt user for entries to merge
  1. D EN^VALM2($G(XQORNOD(0)),"O")
  1. ;Build array of data selected for merging
  1. N DGNOFDEL S DGNOFDEL=1 ;**477 stop NOK Name x-ref from firing.
  1. NEW EASZIPLK S EASZIPLK=1 ;**477 zipcode lookup for GMT
  1. ;I $D(VALMY(8)) F ENTRY=6,7,9 I '$D(VALMY(ENTRY)) S VALMY(ENTRY)="",UNDO(ENTRY)="" ;prepare to undo city, state and county if zip selected ;**477 for GMT ;**479 address removed
  1. S ENTRY=""
  1. F S ENTRY=$O(VALMY(ENTRY)) Q:(ENTRY="") D
  1. .;Remember which group(s) to rebuild
  1. .S TMP=$G(@VALMAR@("E2G",ENTRY))
  1. .S:(TMP'="") REBUILD(TMP)=""
  1. .;Loop through list of fields contained in the entry
  1. .S REPEAT=""
  1. .F S REPEAT=$O(@VALMAR@("E2F",ENTRY,REPEAT)) Q:(REPEAT="") D
  1. ..S TMP=$G(@VALMAR@("E2F",ENTRY,REPEAT))
  1. ..S FILE=+$P(TMP,"^",1)
  1. ..S FIELD=+$P(TMP,"^",2)
  1. ..;Get remote value
  1. ..S VALUE=$G(@VAFCARR@(FILE,FIELD))
  1. ..;Screen for ignore conditions
  1. ..I $P(VALUE,U,3) S VALMSG=$S($G(VALMSG)]"":VALMSG_","_ENTRY,1:"Can't merge unresolved item(s) "_ENTRY) Q
  1. ..S VALUE=$P(VALUE,U)
  1. ..Q:(VALUE="")
  1. ..;Convert "@" to @
  1. ..S:(VALUE=(QUOTE_"@"_QUOTE)) VALUE="@"
  1. ..;Move data into upload array
  1. ..I '$D(UNDO(ENTRY)) S @FDAROOT@(FILE,IENS,FIELD)=VALUE ;**477 for GMT
  1. ..;Prepare for undo
  1. ..S ^TMP("VAFC-UNDO",$J,"FDA",FILE,IENS,FIELD)=$$GET1^DIQ(FILE,IENS,FIELD)
  1. ;Merge selected data BUT don't transmit until merge completed or rejected
  1. I (+$O(@FDAROOT@(0))) S VAFCA08=1 D FILE^DIE("E",FDAROOT,MSGROOT) K VAFCA08
  1. ;Rebuild required portion of display
  1. S VAFCDOTS=1
  1. S ENTRY=""
  1. F S ENTRY=$O(REBUILD(ENTRY)) Q:(ENTRY="") D RBLDGRP^VAFCMGB(ENTRY)
  1. ;No more differences
  1. S:('$D(@VALMAR@("E2F"))) VALMSG="** No differences found **"
  1. ;Done - refresh List Manager display
  1. K @FDAROOT,@MSGROOT
  1. S VALMBCK="R"
  1. Q
  1. ;
  1. COMPLETE ;Merge process completed ;**477 always prompt for merge, add verbage
  1. ;
  1. ;Input : See above note on input variables
  1. ;Output : VAFCDONE will be set to '1'
  1. ;
  1. ;Declare variables
  1. N DIR,X,Y
  1. S VAFCDONE=1
  1. D FULL^VALM1 ;switch to full screen
  1. I ($D(@VALMAR@("E2F"))) D ;check for differences
  1. .S DIR("A",7)=" ** Differences still exist between local and remote data **" ;check for differences
  1. .S DIR("A",8)=" "
  1. ;Make sure user is really done with merge process
  1. S DIR(0)="YA"
  1. S DIR("A",1)=" "
  1. S DIR("A",2)="NOTE: Since your site is the CMOR, you are considered to be the"
  1. S DIR("A",3)=" authoritative source. By completing the merge, you confirm that"
  1. S DIR("A",4)=" your facility's NAME, SEX, DOB, SSN and MOTHER'S MAIDEN NAME are"
  1. S DIR("A",5)=" accurate for broadcast to all facilities sharing this patient."
  1. S DIR("A",6)=" "
  1. S DIR("A")="Are you ready to complete the merge process? (Yes/No) : "
  1. S DIR("B")="YES"
  1. D ^DIR
  1. S VAFCDONE=+Y
  1. ;User not done
  1. I ('VAFCDONE) S VALMBCK="R" Q
  1. ; Create an entry in the ADT/HL7 PIVOT file (#391.71) and
  1. ; mark it as requiring transmission of an HL7 ADT-A08 message
  1. D AVAFC^VAFCDD01(VAFCDFN)
  1. ;Done - quit List Manager interface
  1. S VALMBCK="Q"
  1. Q
  1. ;
  1. REJECT ;Reject/ignore differences ;**477 add verbage
  1. ;
  1. ;Input : See above note on input variables
  1. ;Output : VAFCRJCT will be set to '1'
  1. ;
  1. ;Declare variables
  1. N DIR,X,Y
  1. S VAFCRJCT=1
  1. ;Switch to full screen
  1. D FULL^VALM1
  1. ;Make sure user really wants to reject differences
  1. S DIR(0)="YA"
  1. S DIR("A",1)=" "
  1. S DIR("A",2)="NOTE: Since your site is the CMOR, you are considered to be the"
  1. S DIR("A",3)=" authoritative source. By rejecting the remote data, you confirm"
  1. S DIR("A",4)=" that your facility's NAME, SEX, DOB, SSN and MOTHER'S MAIDEN NAME"
  1. S DIR("A",5)=" are accurate for broadcast to all facilities sharing this patient."
  1. S DIR("A",6)=" "
  1. S DIR("A")="Are you sure you want to reject the remote data? (Yes/No) : "
  1. S DIR("B")="YES"
  1. D ^DIR
  1. S VAFCRJCT=+Y
  1. ;Don't reject
  1. I ('VAFCRJCT) S VALMBCK="R" Q
  1. ; Create an entry in the ADT/HL7 PIVOT file (#391.71) and
  1. ; mark it as requiring transmission of an HL7 ADT-A08 message
  1. D AVAFC^VAFCDD01(VAFCDFN)
  1. ;Done - quit List Manager interface
  1. S VALMBCK="Q"
  1. Q
  1. HI ;Hinq Inquiry
  1. S DFN=VAFCDFN
  1. D HINQ^DG10 S VALMBCK=""
  1. ;D EN^DVBHQZ4 S VALMBCK=""
  1. ;S VALMSG="Hinq request has "_$S($D(^DVB(395.5,DFN,0))&("PNEA"[$P($G(^DVB(395.5,DFN,0)),U,4)):"",1:"NOT ")_"been made for this patient."
  1. HIQ Q
  1. PA ;Patient Audit
  1. Q ;**477 - no longer in use replaced by remote audit protcols
  1. I '$O(^DIA(2,"B",VAFCDFN,0)) S VALMSG="This patient has no audit data available.",VALMBCK="" G PAQ
  1. N IEN S DFN=VAFCDFN,QFLG=1 D FULL^VALM1 D:$T(ASK2^RGMTAUD)]"" ASK2^RGMTAUD S VALMBCK="R"
  1. PAQ Q