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

DGRUDD01.m

Go to the documentation of this file.
  1. DGRUDD01 ;ALB/SCK - Data Dictionary Utilities MDS COTS update ;8-10-99
  1. ;;5.3;Registration;**190,1015**;Aug 13, 1993;Build 21
  1. ;
  1. ADGRU(DFN) ; ADGRU* cross reference for Patient File (#2)
  1. ;
  1. ; Input : DFN - Pointer to entry in PATIENT File (#2)
  1. ;
  1. ; Output : None
  1. ;
  1. ; Note: The ADGRU* cross references are used to remember that changes
  1. ; were made to the PATIENT File(#2) outside of the Registration
  1. ; Process. Execution of this cross reference will mark an entry
  1. ; in the ADT/HL7 PIVOT file (#391.71) and mark it as requiring
  1. ; transmission on an HL7 ADT-A08 message.
  1. ;
  1. ; Execution of this cross reference can be prevented by setting
  1. ; the local variable DGRUGA08 equal to 1
  1. ;
  1. ; This cross reference is intended for notifing the Resident
  1. ; Assessment Instrument COTS database of a demographic change
  1. ; to a patients data.
  1. ;
  1. ; Check Input
  1. I +$G(DFN),$D(^DPT(DFN,0))
  1. E Q
  1. ;
  1. N VARPTR,PIVOTNUM,DGRU,VAFHDT,VAROOT
  1. ;
  1. ; Check for flag
  1. Q:$G(DGRUGA08)
  1. ; Test for HL7 ADT on/off parameter
  1. Q:'$P($$SEND^VAFHUTL(),"^",2)
  1. ; Test for Inpatient status on TODAY, if patient is not an inpatient today
  1. ; then quit any further processing.
  1. S VAROOT="DGRU",VAFHDT=$$DT^XLFDT
  1. D INP^VADPT
  1. ; check admission date and ward location for inpatient status
  1. I '(+DGRU(1)),'(+DGRU(4)) Q
  1. ; check for ward flagged as RAI/MDS ward.
  1. Q:'$$CHKWARD^DGRUUTL(+DGRU(4))
  1. ; All checks passed
  1. ; Check for change to SSN. If the SSN has changed, then we need to process
  1. ; the SSN change differently through the RAI MONITOR file rather than using
  1. ; the pivot file.
  1. ;
  1. N DGOK
  1. S DGSNOLD=$P($G(D),"^",9)
  1. S DGSNNEW=$P($G(DV),"^",9)
  1. I +DGSNNEW>0&(+DGSNOLD>0) D Q:$G(DGOK)
  1. . I DGSNOLD'=DGSNNEW D Q
  1. .. N DGX S DGX=$O(^DGRU(46.11,"B",DGSNNEW,0))
  1. .. Q:$G(DGX)>0
  1. .. N FDA
  1. .. S FDA(1,46.11,"+1,",.01)=DGSNNEW
  1. .. S FDA(1,46.11,"+1,",.02)=DGSNOLD
  1. .. S FDA(1,46.11,"+1,",.03)=2
  1. .. S FDA(1,46.11,"+1,",.04)=DFN
  1. .. D UPDATE^DIE("E","FDA(1)")
  1. .. S DGOK=1
  1. ;
  1. ; Create entry in pivot file
  1. D PVT4A08(DFN)
  1. ;
  1. I PIVOTNUM<0 Q
  1. D XMITFLAG^VAFCDD01(0,PIVOTNUM)
  1. ;
  1. Q
  1. ;
  1. PVT4A08(DFN) ; Create an entry in the ADT/HL7 PIVOT file for a patient demographic
  1. ; update event and mark it for transmission
  1. ;
  1. ; Input : DFN - pointer to entry in PATIENT File (#2)
  1. ;
  1. ; Output : None
  1. ;
  1. ; Check input
  1. I +$G(DFN),$D(^DPT(DFN,0))
  1. E Q
  1. ;
  1. S VARPTR=DFN_";DPT("
  1. ;
  1. S PIVOTNUM=+$$PIVNW^VAFHPIVT(DFN,$P(DT,"."),6,VARPTR)
  1. Q:(PIVOTNUM<0)
  1. ;
  1. ; Mark entry as requires transmission
  1. I $G(DGRUGA08),$P($$SEND^VAFHUTL(),"^",2) D XMITFLAG^VAFCDD01(0,PIVOTNUM)
  1. ; Mark entry as transmitted field YES
  1. ;I $G(DGRUGA08),$$SEND^VAFHUTL() S SETFLAG^VAFCDD01(0,PIVOTNUM)
  1. Q