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

DG10.m

Go to the documentation of this file.
  1. DG10 ;ALB/MRL,DAK,AEG,PHH,TMK,ASMR/JD-LOAD/EDIT PATIENT DATA ; 09/30/15 @ 08:34
  1. ;;5.3;Registration;**32,109,139,149,182,326,513,425,574,642,658,773,864,921,993,1040**;Aug 13, 1993;Build 15
  1. ;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. ;Done for eHMP project: DG*5.3*921
  1. ;Added logic to trigger unsolicited updates for demographics that are not otherwise triggered
  1. ;by the TRIGGER x-ref. New code: Tags T, T59, and T60 and any references to those tags thereof.
  1. START ;
  1. D LO^DGUTL
  1. I $G(DGPRFLG)=1,$G(DGPLOC)=1 D G Q:$G(DGRPOUT),A1
  1. .; D EN^DGRPD,REG^IVMCQ($G(DFN))
  1. . D EN^DGRPD
  1. . Q:$G(DGRPOUT)
  1. . D REG^IVMCQ($G(DFN))
  1. . D HINQ
  1. ;
  1. ; DG*5.3*993; Remove the DLAYGO variable and the "L" from DIC(0) since adding records to the PATIENT file is not allowed in DG LOAD PATIENT DATA
  1. A ;W !! K VET,DIE,DIC,CARD S DIC=2,DLAYGO=2,DIC(0)="ALEQM" K DIC("S") D ^DIC G Q:Y<0 S (DFN,DA)=+Y,DGNEW=$P(Y,"^",3) K DLAYGO
  1. ; DG*5.3*1040 - NEW variable DGTMOT and initialize to 0 to track timeout in address and DGADDRE to track the return value of $$ADD^DGADDUTL
  1. N DGADDRE,DGTMOT S DGTMOT=0,DGADDRE=""
  1. W !! K VET,DIE,DIC,CARD S DIC=2,DIC(0)="AEQM" K DIC("S") D ^DIC G Q:Y<0 S (DFN,DA)=+Y,DGNEW=$P(Y,"^",3) K DLAYGO
  1. ;DG*5.3*921 Invoke eHMP demographic change checking
  1. I DGNEW']"" D T59(DFN,"BEFORE") ;Get a snapshot of the demographics before changes
  1. N Y D PAUSE I DGNEW D NEW^DGRP S DA=DFN,VET=$S($D(^DPT(DFN,"VET")):^("VET")'="Y",1:0)
  1. ;
  1. ;MPI QUERY
  1. ;check to see if CIRN PD/MPI is installed
  1. N X S X="MPIFAPI" X ^%ZOSF("TEST") G:'$T SKIP
  1. K MPIFRTN
  1. D MPIQ^MPIFAPI(DFN)
  1. K MPIFRTN
  1. ;
  1. N DGNOIVMUPD
  1. S DGNOIVMUPD=1 ; Set flag to prevent MT Event Driver from updating converted IVM test
  1. I +$G(DGNEW) D
  1. . ; query CMOR for Patient Record Flag Assignments if NEW patient and
  1. . ; display results
  1. . I $$PRFQRY^DGPFAPI(DFN) D DISPPRF^DGPFAPI(DFN)
  1. . I $$EN^DGPFMPI(DFN)
  1. ;
  1. SKIP ;
  1. ;DG*5.3*921 Invoke eHMP demographic change checking (via D T)
  1. S DGELVER=0 D EN^DGRPD I $D(DGRPOUT) K DGRPOUT D T G A
  1. D HINQ,REG^IVMCQ($G(DFN)) G A1
  1. ;
  1. HINQ ;
  1. S Y=$S($D(^DG(43,1,0)):^(0),1:0) I $P(Y,U,27) S X="DVBHQZ4" X ^%ZOSF("TEST") I $T D
  1. .N DGROUT
  1. .S DGROUT=X
  1. .I $G(DFN) D
  1. ..N X,Y,DGRP
  1. ..F X=.3,.32 S DGRP(X)=$G(^DPT(DFN,X))
  1. ..W !," Money Verified: " S Y=$P(DGRP(.3),"^",6) X:Y]"" ^DD("DD") W $S(Y]"":Y,1:"NOT VERIFIED")
  1. ..W ?40," Service Verified: " S Y=$P(DGRP(.32),"^",2) X:Y]"" ^DD("DD") W $S(Y]"":Y,1:"NOT VERIFIED")
  1. .D @("EN^"_DGROUT) K Y Q ;from dgdem0
  1. Q
  1. ;
  1. ; SDIEMM is used as a flag by AMBCARE Incomplete Encounter Management
  1. ; to bypass the embossing routines when calling load/edit from IEMM
  1. ;
  1. ; DG*5.3*1040 - If variable DGADDRE=-1, branch to RPOUT due to timeout; if DGRPOUT=1, branch to RPOUT as well
  1. A1 D G:$G(DGADDRE)=-1 RPOUT G H:'%,CK:%'=1 S DGRPV=0 D EN1^DGRP G:+$G(DGRPOUT) RPOUT D MT(DFN),CP G Q:$G(DGPRFLG)=1 G Q:$G(SDIEMM) G Q:'$D(DA),EMBOS
  1. .W !,"Do you want to ",$S(DGNEW:"enter",1:"edit")," Patient Data"
  1. .S %=1 D YN^DICN
  1. .I +$G(DGNEW) Q
  1. .S DGADDRE=$$ADD^DGADDUTL($G(DFN)) ; DG*5.3*1040 - Store the return value in DGADDRE
  1. ;
  1. H W !?5,"Enter 'YES' to enter/edit registration data or 'NO' to continue without",!?5,"editing."
  1. G A1
  1. ;
  1. ; DG*5.3*1040 - Only do if there wasn't a timeout so branch to RPOUT
  1. CK S DGEDCN=1 G:+$G(DGRPOUT) RPOUT D ^DGRPC,MT(DFN),CP
  1. G Q:$G(DGPRFLG)=1 G Q:$G(SDIEMM)
  1. I $G(DGER)[55 K DIR S DIR(0)="Y",DIR("A")="Do you wish to return to Screen #9 to enter missing Income Data? " D ^DIR K DIR
  1. ;G:Y ^DGRP9
  1. ;
  1. EMBOS ;W ! D EMBOS^DGQEMA G A
  1. ;DG*5.3*921 Invoke eHMP demographic change checking
  1. D T
  1. G A
  1. ;
  1. ;
  1. ; DG*5.3*1040 - Clean variable DGTMOT
  1. Q K X,Y,Z,DIC,DGELVER,DGNEW,DGRPV,DGTMOT,VET Q
  1. ;
  1. MT(DFN) ; Check if user requires a means test. Ask user if they want to proceedif
  1. ; one is required
  1. I '$D(SDIEMM) DO
  1. .N DGREQF,DIV
  1. .D EN^DGMTR
  1. .I DGREQF D EDT^DGMTU(DFN,DT):$P($$MTS^DGMTU(DFN),U,2)="R"
  1. .Q
  1. I $D(SDIEMM) DO
  1. .N DGMTI
  1. .S DGMTI=$$LST^DGMTU(DFN,SCINF("ENCOUNTER"),1)
  1. .I $P(DGMTI,U,4)="R" D I 1
  1. ..S DGMT0=$G(^DGMT(408.31,+DGMTI,0)),DGMTDT=$P(DGMT0,"^")
  1. ..I '$$OKTOCONT(DGMTDT) Q
  1. ..S DGMTI=+DGMTI,DGMTYPT=1,DGMTACT="COM",DGMTROU="COM^DGMTEO" D EN^DGMTSC
  1. .E D WARNING
  1. .Q
  1. Q
  1. ;
  1. WARNING ;
  1. ;prints a warning to the screen about means test
  1. ;
  1. W !!,"A means test for this encounter date was not found and may be required!"
  1. W !,"Further investigation will be needed."
  1. W !
  1. D PAUSE
  1. Q
  1. ;
  1. PAUSE ;
  1. N DIR
  1. S DIR(0)="FAO",DIR("A")="Press ENTER to continue " D ^DIR
  1. Q
  1. ;
  1. OKTOCONT(Y) ;
  1. ;
  1. N DIR
  1. W !!,"Patient Requires a means Test"
  1. X ^DD("DD")
  1. W !,"Primary Means Test Required from '",Y,"'",!
  1. ;
  1. I $D(SDIEMM),'$D(^XUSEC("SCENI MEANS TEST EDIT",DUZ)) DO G OKQ
  1. .W !,$C(7),"You do not have the appropriate IEMM Security Key. Contact your supervisor.",!
  1. .D PAUSE
  1. .S Y=0
  1. ;
  1. S DIR("A")="Do you wish to proceed with the means test at this time"
  1. S DIR("B")="YES"
  1. S DIR(0)="Y"
  1. D ^DIR
  1. OKQ Q $S(Y=1:1,1:0)
  1. ;
  1. CP ;If not (autoexempt or MTested) & no CP test this year then
  1. ;prompt for add/edit cp test
  1. N DIV,DGIB,DGIBDT,DGX,X,DIRUT,DTOUT
  1. G:'$P($G(^DG(43,1,0)),U,41) QTCP ;USE CP FLAG
  1. S DGIBDT=$S($D(DFN1):9999999-DFN1,1:DT)
  1. D EN^DGMTCOR
  1. I +$G(DGNOCOPF) S DGMTCOR=0
  1. I DGMTCOR D THRESH^DGMTCOU1(DGIBDT) D EDT^DGMTCOU(DFN,DT)
  1. K DGNOCOPF
  1. QTCP Q
  1. ;
  1. T ;
  1. ;DG*5.3*921- Check to ensure all demographic changes are passed to eHMP 10/2/15
  1. ;If we are editing demographics for an existing patient, get a snapshot after
  1. ;the changes and compare the before and after snapshots. If there are ANY changes
  1. ;invoke the unsolicited update protocol.
  1. I DGNEW']"" D
  1. .N DGFIELD,DGFILE,DGDA
  1. .D T59(DFN,"AFTER")
  1. .I $$T60("BEFORE","AFTER",.DGFIELD) S DGFILE=2,DGDA=DFN D:$L($T(DG^HMPEVNT)) DG^HMPEVNT
  1. Q
  1. ;
  1. T59(A,B) ;Get all the demographics that are supposed to trigger an unsolicited update
  1. ;DG*5.3*921
  1. ;A = DFN
  1. ;B = Return array
  1. N FLDS,INS
  1. S FLDS=".01;.02;.03;.05;.08;.09;.351;.361;.364;.111;.1112;.112;.113;.114;.115;.131;.132;.134;"
  1. S FLDS=FLDS_".211;.212;.213;.214;.216;.217;.218;.219;.301;.302;1901;.32102;.32103;.32201;.5295;"
  1. S FLDS=FLDS_".133;.1211;.1212;.1213;.1214;.1215;.1216;.331;.332;.333;.334;.335;.336;.337;"
  1. S FLDS=FLDS_".338;.339;.33011;.215;.21011;.3731;"
  1. D GETS^DIQ(2,A_",",FLDS,,B)
  1. Q
  1. ;
  1. T60(A,B,C) ;Compare the before and after arrays to see if any of the considerd demographics
  1. ;were changed
  1. ;DG*5.3*921
  1. ;A = "before" changes array
  1. ;B = "after" changes array
  1. ;Both A and B are of the form: A(2,DFN_",",Field#)=Field value. E.g. A(2,"3,",.114)="LOS ANGELES"
  1. ;C = the first field that was changed (e.g. .111 for street address line 1).
  1. ; This is an output parameter.
  1. ;Returns true (1) if any change is detected. Quits at the FIRST find.
  1. ; false (null) if there are no changes.
  1. N F,X,Y,Z
  1. S (C,F,Z)=""
  1. F S Z=$O(@A@(Z)) Q:$G(F)!(Z'=+Z) D
  1. .S Y=""
  1. .F S Y=$O(@A@(Z,Y)) Q:$G(F)!(Y']"") D
  1. ..S X=""
  1. ..F S X=$O(@A@(Z,Y,X)) Q:$G(F)!(X'=+X) D
  1. ...I @A@(Z,Y,X)'=$G(@B@(Z,Y,X)) S F=1,C=X Q
  1. Q F
  1. ; DG*5.3*1040 - Entry point to quit and go to next select patient prompt
  1. RPOUT ; Entry point if user timeout out
  1. S DGRPOUT=""
  1. G A