DGRUDD01 ;ALB/SCK - Data Dictionary Utilities MDS COTS update ;8-10-99
;;5.3;Registration;**190**;Aug 13, 1993
;
ADGRU(DFN) ; ADGRU* cross reference for Patient File (#2)
;
; Input : DFN - Pointer to entry in PATIENT File (#2)
;
; Output : None
;
; Note: The ADGRU* cross references are used to remember that changes
; were made to the PATIENT File(#2) outside of the Registration
; Process. Execution of this cross reference will mark an entry
; in the ADT/HL7 PIVOT file (#391.71) and mark it as requiring
; transmission on an HL7 ADT-A08 message.
;
; Execution of this cross reference can be prevented by setting
; the local variable DGRUGA08 equal to 1
;
; This cross reference is intended for notifing the Resident
; Assessment Instrument COTS database of a demographic change
; to a patients data.
;
; Check Input
I +$G(DFN),$D(^DPT(DFN,0))
E Q
;
N VARPTR,PIVOTNUM,DGRU,VAFHDT,VAROOT
;
; Check for flag
Q:$G(DGRUGA08)
; Test for HL7 ADT on/off parameter
Q:'$P($$SEND^VAFHUTL(),"^",2)
; Test for Inpatient status on TODAY, if patient is not an inpatient today
; then quit any further processing.
S VAROOT="DGRU",VAFHDT=$$DT^XLFDT
D INP^VADPT
; check admission date and ward location for inpatient status
I '(+DGRU(1)),'(+DGRU(4)) Q
; check for ward flagged as RAI/MDS ward.
Q:'$$CHKWARD^DGRUUTL(+DGRU(4))
; All checks passed
; Check for change to SSN. If the SSN has changed, then we need to process
; the SSN change differently through the RAI MONITOR file rather than using
; the pivot file.
;
N DGOK
S DGSNOLD=$P($G(D),"^",9)
S DGSNNEW=$P($G(DV),"^",9)
I +DGSNNEW>0&(+DGSNOLD>0) D Q:$G(DGOK)
. I DGSNOLD'=DGSNNEW D Q
.. N DGX S DGX=$O(^DGRU(46.11,"B",DGSNNEW,0))
.. Q:$G(DGX)>0
.. N FDA
.. S FDA(1,46.11,"+1,",.01)=DGSNNEW
.. S FDA(1,46.11,"+1,",.02)=DGSNOLD
.. S FDA(1,46.11,"+1,",.03)=2
.. S FDA(1,46.11,"+1,",.04)=DFN
.. D UPDATE^DIE("E","FDA(1)")
.. S DGOK=1
;
; Create entry in pivot file
D PVT4A08(DFN)
;
I PIVOTNUM<0 Q
D XMITFLAG^VAFCDD01(0,PIVOTNUM)
;
Q
;
PVT4A08(DFN) ; Create an entry in the ADT/HL7 PIVOT file for a patient demographic
; update event and mark it for transmission
;
; Input : DFN - pointer to entry in PATIENT File (#2)
;
; Output : None
;
; Check input
I +$G(DFN),$D(^DPT(DFN,0))
E Q
;
S VARPTR=DFN_";DPT("
;
S PIVOTNUM=+$$PIVNW^VAFHPIVT(DFN,$P(DT,"."),6,VARPTR)
Q:(PIVOTNUM<0)
;
; Mark entry as requires transmission
I $G(DGRUGA08),$P($$SEND^VAFHUTL(),"^",2) D XMITFLAG^VAFCDD01(0,PIVOTNUM)
; Mark entry as transmitted field YES
;I $G(DGRUGA08),$$SEND^VAFHUTL() S SETFLAG^VAFCDD01(0,PIVOTNUM)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGRUDD01 2800 printed Oct 16, 2024@18:58:37 Page 2
DGRUDD01 ;ALB/SCK - Data Dictionary Utilities MDS COTS update ;8-10-99
+1 ;;5.3;Registration;**190**;Aug 13, 1993
+2 ;
ADGRU(DFN) ; ADGRU* cross reference for Patient File (#2)
+1 ;
+2 ; Input : DFN - Pointer to entry in PATIENT File (#2)
+3 ;
+4 ; Output : None
+5 ;
+6 ; Note: The ADGRU* cross references are used to remember that changes
+7 ; were made to the PATIENT File(#2) outside of the Registration
+8 ; Process. Execution of this cross reference will mark an entry
+9 ; in the ADT/HL7 PIVOT file (#391.71) and mark it as requiring
+10 ; transmission on an HL7 ADT-A08 message.
+11 ;
+12 ; Execution of this cross reference can be prevented by setting
+13 ; the local variable DGRUGA08 equal to 1
+14 ;
+15 ; This cross reference is intended for notifing the Resident
+16 ; Assessment Instrument COTS database of a demographic change
+17 ; to a patients data.
+18 ;
+19 ; Check Input
+20 IF +$GET(DFN)
IF $DATA(^DPT(DFN,0))
+21 IF '$TEST
QUIT
+22 ;
+23 NEW VARPTR,PIVOTNUM,DGRU,VAFHDT,VAROOT
+24 ;
+25 ; Check for flag
+26 if $GET(DGRUGA08)
QUIT
+27 ; Test for HL7 ADT on/off parameter
+28 if '$PIECE($$SEND^VAFHUTL(),"^",2)
QUIT
+29 ; Test for Inpatient status on TODAY, if patient is not an inpatient today
+30 ; then quit any further processing.
+31 SET VAROOT="DGRU"
SET VAFHDT=$$DT^XLFDT
+32 DO INP^VADPT
+33 ; check admission date and ward location for inpatient status
+34 IF '(+DGRU(1))
IF '(+DGRU(4))
QUIT
+35 ; check for ward flagged as RAI/MDS ward.
+36 if '$$CHKWARD^DGRUUTL(+DGRU(4))
QUIT
+37 ; All checks passed
+38 ; Check for change to SSN. If the SSN has changed, then we need to process
+39 ; the SSN change differently through the RAI MONITOR file rather than using
+40 ; the pivot file.
+41 ;
+42 NEW DGOK
+43 SET DGSNOLD=$PIECE($GET(D),"^",9)
+44 SET DGSNNEW=$PIECE($GET(DV),"^",9)
+45 IF +DGSNNEW>0&(+DGSNOLD>0)
Begin DoDot:1
+46 IF DGSNOLD'=DGSNNEW
Begin DoDot:2
+47 NEW DGX
SET DGX=$ORDER(^DGRU(46.11,"B",DGSNNEW,0))
+48 if $GET(DGX)>0
QUIT
+49 NEW FDA
+50 SET FDA(1,46.11,"+1,",.01)=DGSNNEW
+51 SET FDA(1,46.11,"+1,",.02)=DGSNOLD
+52 SET FDA(1,46.11,"+1,",.03)=2
+53 SET FDA(1,46.11,"+1,",.04)=DFN
+54 DO UPDATE^DIE("E","FDA(1)")
+55 SET DGOK=1
End DoDot:2
QUIT
End DoDot:1
if $GET(DGOK)
QUIT
+56 ;
+57 ; Create entry in pivot file
+58 DO PVT4A08(DFN)
+59 ;
+60 IF PIVOTNUM<0
QUIT
+61 DO XMITFLAG^VAFCDD01(0,PIVOTNUM)
+62 ;
+63 QUIT
+64 ;
PVT4A08(DFN) ; Create an entry in the ADT/HL7 PIVOT file for a patient demographic
+1 ; update event and mark it for transmission
+2 ;
+3 ; Input : DFN - pointer to entry in PATIENT File (#2)
+4 ;
+5 ; Output : None
+6 ;
+7 ; Check input
+8 IF +$GET(DFN)
IF $DATA(^DPT(DFN,0))
+9 IF '$TEST
QUIT
+10 ;
+11 SET VARPTR=DFN_";DPT("
+12 ;
+13 SET PIVOTNUM=+$$PIVNW^VAFHPIVT(DFN,$PIECE(DT,"."),6,VARPTR)
+14 if (PIVOTNUM<0)
QUIT
+15 ;
+16 ; Mark entry as requires transmission
+17 IF $GET(DGRUGA08)
IF $PIECE($$SEND^VAFHUTL(),"^",2)
DO XMITFLAG^VAFCDD01(0,PIVOTNUM)
+18 ; Mark entry as transmitted field YES
+19 ;I $G(DGRUGA08),$$SEND^VAFHUTL() S SETFLAG^VAFCDD01(0,PIVOTNUM)
+20 QUIT