DGRPCF ;ALB/MRL,BAJ,TDM,DJE,ARF,RN - CONSISTENCY OF PATIENT DATA (FILE/EDIT) ;Sep 28, 2017 5:35PM
;;5.3;Registration;**250,653,786,754,867,935,1014,1027**;Aug 13, 1993;Build 70
;
; file new inconsistencies or update file entries for patient
;
; DGCT = count of inconsistencies found (passed in from checker)
; DGCT1= count of inconsistencies which can't be edited because
; user does not hold appropriate key
; DGCT2= count of already filed inconsistencies
; DGCT3= count of inconsistencies which are uneditable through
; checker options
; DGCTZ7= count of inconsistencies found that will prevent Z07
; Supported ICRs
; #3356 - XQY0 ; Kernel Variable
;
;
EN I '$D(DGCT) G KVAR^DGRPCE
; DG*5.3*653 BAJ modified to delete only inconsistencies numbered 99 or less
N DGADD S DGADD=0 ;786 corrects problem with incorrect header
;I 'DGCT,$O(^DGIN(38.5,DFN,"I",""),-1)>99 D DELETE G KVAR^DGRPCE
I 'DGCT D DELETE G KVAR^DGRPCE
S DGEDCN=+$G(DGEDCN),DGRPOUT=+$G(DGRPOUT),DGCON=1 D:DGEDCN START^DGRPC I 'DGCT D ^DGRPCF1,TIMEQ^DGRPC G KVAR^DGRPCE
S:'$D(^DGIN(38.5,DFN,0)) ^(0)=DFN_"^"_DT_"^"_$S(('$D(DUZ)#2):"",1:DUZ),DGADD=1 S X=$P(^(0),"^",4),^DGIN(38.5,DFN,0)=$P(^(0),"^",1,3)_"^"_DT_"^"_$S(('$D(DUZ)#2):"",1:DUZ)_"^"_$P(^(0),"^",6) K ^DGIN(38.5,"AC",9999999-X,DFN)
S ^DGIN(38.5,"B",DFN,DFN)="",^DGIN(38.5,"AC",9999999-DT,DFN)="",^DGIN(38.5,0)=$P(^DGIN(38.5,0),"^",1,2)_"^"_DFN_"^"_($P(^(0),"^",4)+DGADD) ;786 corrected for incorrect header
I $D(^DGIN(38.5,DFN,"I")) D DELETE
S DGD2=0 F DGD=1:1 S DGD1=$P(DGER,",",DGD) Q:DGD1="" I $D(^DGIN(38.6,DGD1,0)) S DGD2=DGD1 S ^DGIN(38.5,DFN,"I",DGD1,0)=DGD1
S ^DGIN(38.5,DFN,"I",0)="^38.51PA^"_DGD2_"^"_DGCT I DGCT,DGEDCN G DIS
G KVAR^DGRPCE
;
;DJE DG*5.3*935 - Add Member ID To Vista Registration Banner - RM#879322 (added SSNNM call)
;ARF DG*5.3*1014 - Create two line banner with preferred name and patient type added
;DIS D TIME^DGRPC S DGRPE=$S($D(DGRPE):DGRPE+1,1:0) D KEY S IOP="HOME" D ^%ZIS K IOP W @IOF,! D DEM^VADPT W $$SSNNM^DGRPU(DFN),?65,$P(VADM(3),"^",2) S X="",$P(X,"=",79)="" W !,X
DIS D TIME^DGRPC S DGRPE=$S($D(DGRPE):DGRPE+1,1:0) D KEY S IOP="HOME" D ^%ZIS K IOP W @IOF,!
N DGPTYPE,DGSSNSTR,DGPREFNM,DGX,DGMEMID ;DG*5.3*1014 begin
S DGSSNSTR=$$SSNNM^DGRPU(DFN)
S DGMEMID=$E($P($P(DGSSNSTR,";",2)," ",2),1,40)
S DGPTYPE=$$GET1^DIQ(391,$$GET1^DIQ(2,DFN_",",391,"I")_",",.01)
S:DGPTYPE="" DGPTYPE="PATIENT TYPE UNKNOWN"
S DGPREFNM=$S($$GET1^DIQ(2,DFN,.2405)'="":" ("_$$GET1^DIQ(2,DFN,.2405)_")",1:"")
D DEM^VADPT
W VADM(1) W:DGPREFNM'="" DGPREFNM W " "_$P(VADM(3),"^",2)
W ! W:DGMEMID'="" DGMEMID_" " W $P(VADM(2),U,2)," ",DGPTYPE
S DGX="",$P(DGX,"=",79)="" W !,DGX ;DG*5.3*1014 end
S (C,DGCT1,DGCT2,DGCT3,DGCTZ7)=0,DGEDIT="0000000011111110011111113333222223313333332222220030000" F I=1:1 S J=$P(DGER,",",I) Q:J="" I $D(^DGIN(38.6,J,0)) S X2=$P(^(0),"^",1) D WRIT
I DGCT1!DGCT3 W ! D NOEDIT
I DGCTZ7 W !!,"Inconsistencies followed by [+] will prevent a Z07"
S DGINC55=$S(DGER'[55:0,($G(DGRPVV(9))'["0"):0,1:1)
EDIT G:DGRPOUT BUL I DGCT1+DGCT3'=DGCT W !!,"DO YOU WANT TO UPDATE THESE INCONSISTENCIES NOW" S %=1 D YN^DICN I %=1 D G ^DGRPC
. S DGINC55=$S(DGER'[55:0,($G(DGRPVV(9))'["0"):0,1:1)
. L +^DPT(DFN):3 E W *7,!!,"Patient is being edited. Try again later." S DGEDCN=0 Q
. D ^DGRPCE
. L -^DPT(DFN)
. S DGEDCN=1
;DG*5.3*1027 Code to not display missing income - get flag
N DGVET,DGOOVET,DGINCOM S DGINCOM=0,DGVET=$$VET^DGENPTA(DFN),DGOOVET=$G(^TMP($J,"DGOLDVET",DFN))
I DGOOVET'="",$P($G(XQY0),"^",1)="DG REGISTER PATIENT",'$$FINDCUR^DGENA(DFN),DGVET'=DGOOVET D
. I DGVET=0 S DGINCOM=1
;DG*5.3*1027; If flag set, display missing income
I 'DGINCOM,$S(($G(DGRETURN)>10):0,$G(DGINC55):1,1:0) D
.N DIR
.S DIR(0)="Y",DIR("A")="Do you wish to return to Screen #9 to enter missing Income Data? ",DIR("B")="YES" D ^DIR
.S:Y>0 DGRPV=0
.S:Y>0 DGRETURN=$G(DGRETURN)+1
I $S($G(Y)'>0:0,(DGRETURN>11):0,1:1) D ^DGRPV G ^DGRP9
I DGCT1+DGCT3'=DGCT,'% W !!?4,"YES - To correct inconsistencies to unrestricted fields immediately.",!?4,"NO - To abort this process immediately." G EDIT
I DGER[313 D
. N DIR
. S DIR(0)="Y",DIR("A")="Do you wish to return to Screen #15 to enter Sponsor information? ",DIR("B")="YES" D ^DIR
. S:Y>0 DGRPV=0
. S:Y>0 DGRETURN=$G(DGRETURN)+1
I $G(Y)>0&(DGER[313) D ^DGRPV G ^DGRP15
BUL K DGRETURN,X,Y D ^DGRPCB G KVAR^DGRPCE
;
WRIT ;S C=C+1 W:(C#2) ! S X1=$S((C#2):0,1:40) W ?X1,$E(J_" ",1,3),"- ",X2 I DGKEY(+$E(DGEDIT,J)) W "*" S DGCT1=DGCT1+1
S C=C+1 W:(C#2) ! S X1=$S((C#2):0,1:40) W ?X1,$E(J_" ",1,3),"- "
W X2 I DGKEY(+$E(DGEDIT,J))!(J=407) W "*" S DGCT1=DGCT1+1
I "^17^55^313^314^"[("^"_+J_"^") W "**" S DGCT3=DGCT3+1
I +$P(DGRPCOLD,",",2),DGRPCOLD'[(","_J_",") S DGCT2=DGCT2+1
I $P($G(^DGIN(38.6,J,0)),"^",6) W "+" S DGCTZ7=DGCTZ7+1
Q
KEY S X=$S(('$D(DUZ)#2):1,'$D(^XUSEC("DG ELIGIBILITY",DUZ)):1,1:0) F I=.3,.32,.361 S DGP(I)=$S($D(^DPT(DFN,I)):^(I),1:"")
F I=0:1:4 S DGKEY(I)=""
I $P(DGP(.361),"^",1)="V",X S DGKEY(1)=1
I $P(DGP(.3),"^",6)]"",X S DGKEY(2)=1
I $P(DGP(.32),"^",2)]"",X S DGKEY(3)=1
S:'X DGKEY(4)=1 K DGP Q
;
DELETE ; Delete all Registration inconsistencies from INCONSISTENT DATA file (#38.5).
;
;
N RULE,DIK,DA
;
S RULE=0,DA=""
S DIK="^DGIN(38.5,"_DFN_","_"""I"""_","
;F S RULE=$O(^DGIN(38.5,DFN,"I",RULE)) Q:RULE="" Q:RULE>99 S DA=RULE D ^DIK
F S RULE=$O(^DGIN(38.5,DFN,"I",RULE)) Q:RULE="" D
. I RULE>99,OVER99'[(","_RULE_",") Q
. S DA=RULE D ^DIK
Q
;
NOEDIT ; write explanation of non-editable items
I DGCT1 W !,"You will not be able to edit inconsistencies followed by an asterisk [*]",!,"as you do not hold the appropriate ""DG ELIGIBILITY"" security key."
I DGCT3 W !,"Inconsistencies followed by two (2) asterisks [**] must be corrected by",!,"using the appropriate MAS menu option(s)."
I DGCT1+DGCT3'=DGCT W !!,"All items not followed by an asterisk can be edited at this time. If these",!,"items are not corrected at this time, a bulletin will be sent to the",!,"appropriate hospital personnel."
;;QUIT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGRPCF 6153 printed Oct 16, 2024@18:56:33 Page 2
DGRPCF ;ALB/MRL,BAJ,TDM,DJE,ARF,RN - CONSISTENCY OF PATIENT DATA (FILE/EDIT) ;Sep 28, 2017 5:35PM
+1 ;;5.3;Registration;**250,653,786,754,867,935,1014,1027**;Aug 13, 1993;Build 70
+2 ;
+3 ; file new inconsistencies or update file entries for patient
+4 ;
+5 ; DGCT = count of inconsistencies found (passed in from checker)
+6 ; DGCT1= count of inconsistencies which can't be edited because
+7 ; user does not hold appropriate key
+8 ; DGCT2= count of already filed inconsistencies
+9 ; DGCT3= count of inconsistencies which are uneditable through
+10 ; checker options
+11 ; DGCTZ7= count of inconsistencies found that will prevent Z07
+12 ; Supported ICRs
+13 ; #3356 - XQY0 ; Kernel Variable
+14 ;
+15 ;
EN IF '$DATA(DGCT)
GOTO KVAR^DGRPCE
+1 ; DG*5.3*653 BAJ modified to delete only inconsistencies numbered 99 or less
+2 ;786 corrects problem with incorrect header
NEW DGADD
SET DGADD=0
+3 ;I 'DGCT,$O(^DGIN(38.5,DFN,"I",""),-1)>99 D DELETE G KVAR^DGRPCE
+4 IF 'DGCT
DO DELETE
GOTO KVAR^DGRPCE
+5 SET DGEDCN=+$GET(DGEDCN)
SET DGRPOUT=+$GET(DGRPOUT)
SET DGCON=1
if DGEDCN
DO START^DGRPC
IF 'DGCT
DO ^DGRPCF1
DO TIMEQ^DGRPC
GOTO KVAR^DGRPCE
+6 if '$DATA(^DGIN(38.5,DFN,0))
SET ^(0)=DFN_"^"_DT_"^"_$SELECT(('$DATA(DUZ)#2):"",1:DUZ)
SET DGADD=1
SET X=$PIECE(^(0),"^",4)
SET ^DGIN(38.5,DFN,0)=$PIECE(^(0),"^",1,3)_"^"_DT_"^"_$SELECT(('$DATA(DUZ)#2):"",1:DUZ)_"^"_$PIECE(^(0),"^",6)
KILL ^DGIN(38.5,"AC",9999999-X,DFN)
+7 ;786 corrected for incorrect header
SET ^DGIN(38.5,"B",DFN,DFN)=""
SET ^DGIN(38.5,"AC",9999999-DT,DFN)=""
SET ^DGIN(38.5,0)=$PIECE(^DGIN(38.5,0),"^",1,2)_"^"_DFN_"^"_($PIECE(^(0),"^",4)+DGADD)
+8 IF $DATA(^DGIN(38.5,DFN,"I"))
DO DELETE
+9 SET DGD2=0
FOR DGD=1:1
SET DGD1=$PIECE(DGER,",",DGD)
if DGD1=""
QUIT
IF $DATA(^DGIN(38.6,DGD1,0))
SET DGD2=DGD1
SET ^DGIN(38.5,DFN,"I",DGD1,0)=DGD1
+10 SET ^DGIN(38.5,DFN,"I",0)="^38.51PA^"_DGD2_"^"_DGCT
IF DGCT
IF DGEDCN
GOTO DIS
+11 GOTO KVAR^DGRPCE
+12 ;
+13 ;DJE DG*5.3*935 - Add Member ID To Vista Registration Banner - RM#879322 (added SSNNM call)
+14 ;ARF DG*5.3*1014 - Create two line banner with preferred name and patient type added
+15 ;DIS D TIME^DGRPC S DGRPE=$S($D(DGRPE):DGRPE+1,1:0) D KEY S IOP="HOME" D ^%ZIS K IOP W @IOF,! D DEM^VADPT W $$SSNNM^DGRPU(DFN),?65,$P(VADM(3),"^",2) S X="",$P(X,"=",79)="" W !,X
DIS DO TIME^DGRPC
SET DGRPE=$SELECT($DATA(DGRPE):DGRPE+1,1:0)
DO KEY
SET IOP="HOME"
DO ^%ZIS
KILL IOP
WRITE @IOF,!
+1 ;DG*5.3*1014 begin
NEW DGPTYPE,DGSSNSTR,DGPREFNM,DGX,DGMEMID
+2 SET DGSSNSTR=$$SSNNM^DGRPU(DFN)
+3 SET DGMEMID=$EXTRACT($PIECE($PIECE(DGSSNSTR,";",2)," ",2),1,40)
+4 SET DGPTYPE=$$GET1^DIQ(391,$$GET1^DIQ(2,DFN_",",391,"I")_",",.01)
+5 if DGPTYPE=""
SET DGPTYPE="PATIENT TYPE UNKNOWN"
+6 SET DGPREFNM=$SELECT($$GET1^DIQ(2,DFN,.2405)'="":" ("_$$GET1^DIQ(2,DFN,.2405)_")",1:"")
+7 DO DEM^VADPT
+8 WRITE VADM(1)
if DGPREFNM'=""
WRITE DGPREFNM
WRITE " "_$PIECE(VADM(3),"^",2)
+9 WRITE !
if DGMEMID'=""
WRITE DGMEMID_" "
WRITE $PIECE(VADM(2),U,2)," ",DGPTYPE
+10 ;DG*5.3*1014 end
SET DGX=""
SET $PIECE(DGX,"=",79)=""
WRITE !,DGX
+11 SET (C,DGCT1,DGCT2,DGCT3,DGCTZ7)=0
SET DGEDIT="0000000011111110011111113333222223313333332222220030000"
FOR I=1:1
SET J=$PIECE(DGER,",",I)
if J=""
QUIT
IF $DATA(^DGIN(38.6,J,0))
SET X2=$PIECE(^(0),"^",1)
DO WRIT
+12 IF DGCT1!DGCT3
WRITE !
DO NOEDIT
+13 IF DGCTZ7
WRITE !!,"Inconsistencies followed by [+] will prevent a Z07"
+14 SET DGINC55=$SELECT(DGER'[55:0,($GET(DGRPVV(9))'["0"):0,1:1)
EDIT if DGRPOUT
GOTO BUL
IF DGCT1+DGCT3'=DGCT
WRITE !!,"DO YOU WANT TO UPDATE THESE INCONSISTENCIES NOW"
SET %=1
DO YN^DICN
IF %=1
Begin DoDot:1
+1 SET DGINC55=$SELECT(DGER'[55:0,($GET(DGRPVV(9))'["0"):0,1:1)
+2 LOCK +^DPT(DFN):3
IF '$TEST
WRITE *7,!!,"Patient is being edited. Try again later."
SET DGEDCN=0
QUIT
+3 DO ^DGRPCE
+4 LOCK -^DPT(DFN)
+5 SET DGEDCN=1
End DoDot:1
GOTO ^DGRPC
+6 ;DG*5.3*1027 Code to not display missing income - get flag
+7 NEW DGVET,DGOOVET,DGINCOM
SET DGINCOM=0
SET DGVET=$$VET^DGENPTA(DFN)
SET DGOOVET=$GET(^TMP($JOB,"DGOLDVET",DFN))
+8 IF DGOOVET'=""
IF $PIECE($GET(XQY0),"^",1)="DG REGISTER PATIENT"
IF '$$FINDCUR^DGENA(DFN)
IF DGVET'=DGOOVET
Begin DoDot:1
+9 IF DGVET=0
SET DGINCOM=1
End DoDot:1
+10 ;DG*5.3*1027; If flag set, display missing income
+11 IF 'DGINCOM
IF $SELECT(($GET(DGRETURN)>10):0,$GET(DGINC55):1,1:0)
Begin DoDot:1
+12 NEW DIR
+13 SET DIR(0)="Y"
SET DIR("A")="Do you wish to return to Screen #9 to enter missing Income Data? "
SET DIR("B")="YES"
DO ^DIR
+14 if Y>0
SET DGRPV=0
+15 if Y>0
SET DGRETURN=$GET(DGRETURN)+1
End DoDot:1
+16 IF $SELECT($GET(Y)'>0:0,(DGRETURN>11):0,1:1)
DO ^DGRPV
GOTO ^DGRP9
+17 IF DGCT1+DGCT3'=DGCT
IF '%
WRITE !!?4,"YES - To correct inconsistencies to unrestricted fields immediately.",!?4,"NO - To abort this process immediately."
GOTO EDIT
+18 IF DGER[313
Begin DoDot:1
+19 NEW DIR
+20 SET DIR(0)="Y"
SET DIR("A")="Do you wish to return to Screen #15 to enter Sponsor information? "
SET DIR("B")="YES"
DO ^DIR
+21 if Y>0
SET DGRPV=0
+22 if Y>0
SET DGRETURN=$GET(DGRETURN)+1
End DoDot:1
+23 IF $GET(Y)>0&(DGER[313)
DO ^DGRPV
GOTO ^DGRP15
BUL KILL DGRETURN,X,Y
DO ^DGRPCB
GOTO KVAR^DGRPCE
+1 ;
WRIT ;S C=C+1 W:(C#2) ! S X1=$S((C#2):0,1:40) W ?X1,$E(J_" ",1,3),"- ",X2 I DGKEY(+$E(DGEDIT,J)) W "*" S DGCT1=DGCT1+1
+1 SET C=C+1
if (C#2)
WRITE !
SET X1=$SELECT((C#2):0,1:40)
WRITE ?X1,$EXTRACT(J_" ",1,3),"- "
+2 WRITE X2
IF DGKEY(+$EXTRACT(DGEDIT,J))!(J=407)
WRITE "*"
SET DGCT1=DGCT1+1
+3 IF "^17^55^313^314^"[("^"_+J_"^")
WRITE "**"
SET DGCT3=DGCT3+1
+4 IF +$PIECE(DGRPCOLD,",",2)
IF DGRPCOLD'[(","_J_",")
SET DGCT2=DGCT2+1
+5 IF $PIECE($GET(^DGIN(38.6,J,0)),"^",6)
WRITE "+"
SET DGCTZ7=DGCTZ7+1
+6 QUIT
KEY SET X=$SELECT(('$DATA(DUZ)#2):1,'$DATA(^XUSEC("DG ELIGIBILITY",DUZ)):1,1:0)
FOR I=.3,.32,.361
SET DGP(I)=$SELECT($DATA(^DPT(DFN,I)):^(I),1:"")
+1 FOR I=0:1:4
SET DGKEY(I)=""
+2 IF $PIECE(DGP(.361),"^",1)="V"
IF X
SET DGKEY(1)=1
+3 IF $PIECE(DGP(.3),"^",6)]""
IF X
SET DGKEY(2)=1
+4 IF $PIECE(DGP(.32),"^",2)]""
IF X
SET DGKEY(3)=1
+5 if 'X
SET DGKEY(4)=1
KILL DGP
QUIT
+6 ;
DELETE ; Delete all Registration inconsistencies from INCONSISTENT DATA file (#38.5).
+1 ;
+2 ;
+3 NEW RULE,DIK,DA
+4 ;
+5 SET RULE=0
SET DA=""
+6 SET DIK="^DGIN(38.5,"_DFN_","_"""I"""_","
+7 ;F S RULE=$O(^DGIN(38.5,DFN,"I",RULE)) Q:RULE="" Q:RULE>99 S DA=RULE D ^DIK
+8 FOR
SET RULE=$ORDER(^DGIN(38.5,DFN,"I",RULE))
if RULE=""
QUIT
Begin DoDot:1
+9 IF RULE>99
IF OVER99'[(","_RULE_",")
QUIT
+10 SET DA=RULE
DO ^DIK
End DoDot:1
+11 QUIT
+12 ;
NOEDIT ; write explanation of non-editable items
+1 IF DGCT1
WRITE !,"You will not be able to edit inconsistencies followed by an asterisk [*]",!,"as you do not hold the appropriate ""DG ELIGIBILITY"" security key."
+2 IF DGCT3
WRITE !,"Inconsistencies followed by two (2) asterisks [**] must be corrected by",!,"using the appropriate MAS menu option(s)."
+3 IF DGCT1+DGCT3'=DGCT
WRITE !!,"All items not followed by an asterisk can be edited at this time. If these",!,"items are not corrected at this time, a bulletin will be sent to the",!,"appropriate hospital personnel."
+4 ;;QUIT