DGMHVUTL ;ALB/JCH - Patient MHV Enrollment/Registration - Utilities ;09/12/14 11:30am
;;5.3;Registration;**903**;August 13, 1993;Build 82
;
; Submitted to OSEHRA 04/02/2015 by HP
; All entry points authored by James Harris 2014-2015
;
Q
QUESUC(DFN,DGMHVOUT) ; If last action entered by clerk was one of the Socialization actions
; from MHV SOCIALIZATION ACTIONS (#390.02) file entries for which "SELECTABLE LOCATIONS"
; includes SOCIALIZATION, display/prompt the "were you successful" message/question
;
N DGSUPTXT
S DGSUPTXT=$$ENQACHK(DFN)
I DGSUPTXT]"" D Q
.Q:$P($G(^DPT(DFN,2)),"^")
.N NXT,MARX,DIR,DGTXTCNT S DIR(0)="YA",DIR("A",1)=" Please read the following to the patient:"
.S DIR("?")=" Enter the patient's response to the question"
.D TXT^DGMHV(DGSUPTXT,55) S DGTXTCNT=0,NXT=3 F S DGTXTCNT=$O(MARX(DGTXTCNT)) Q:'DGTXTCNT D
..I '$O(MARX(DGTXTCNT)) S DIR("A")=" "_MARX(DGTXTCNT)_""""_" (Y/N): " Q
..S DIR("A",NXT)=" """_MARX(DGTXTCNT),NXT=$G(NXT)+1
.W ! D ^DIR S DGMHVOUT=$S(Y=1:"R",Y=0:"A",1:"")
.I $G(DGMHVOUT)="R" N DIE,DA S DIE="^DPT(",DA=DFN,DR="537027////1;537030////"_$$NOW^XLFDT D ^DIE
.H .5
K DIR
Q
;
DSPENR(DFN,DGMHVFIN) ; Display patient's MHV Enrollment/Registration information
; This is the MHV Registration pseudo-screen display; allow entry of 1 to edit the fields as a group, in sequence.
N ACTION,ACTIONE,REASON,REASONE,MHVOK,MHVOKND,MHVEN,MHVEN,MHVAU,MHVMSG,DGRSNTXT
N X,Y,IORVON,IORVOFF,DIR,DIRUT,DGRSNCNT,DGRSPNS,DGSCHTR,DGDIR
;
D HEADER(DFN)
K MHVOK N DIC,DA,DR S DIQ(0)="I",DIC=2,DA=DFN,DR="537027:537040" D GETS^DIQ(DIC,DFN,DR,"I","MHVOK")
S MHVEN=$G(MHVOK(2,DFN_",",537027,"I")),MHVAU=$G(MHVOK(2,DFN_",",537028,"I")),MHVMSG=$G(MHVOK(2,DFN_",",537029,"I"))
S X="IORVON;IORVOFF" D ENDR^%ZISS
W !!!,"[1] Registered: ",$S(MHVEN=0:"NO",MHVEN=1:"YES",1:"UNANSWERED") I MHVEN=1!(MHVEN=0) D
.N ENRDT S ENRDT=$$ENDATE(DFN) I ENRDT&(MHVEN=1) W ?44,"Confirmed: "_ENRDT
I MHVEN=0 S REASON=$G(MHVOK(2,DFN_",",537036,"I")) I REASON W !?12,"Reason: " S REASONE=$$LKUPRSN^DGMHVAC(REASON) D
.N DGRSNTXT S DGRSNTXT=$$LKUPRTXT^DGMHVAC(DFN,2.1) I (REASONE="Other")&($L(DGRSNTXT)>1) S REASONE=REASONE_" - "_DGRSNTXT
.N MARX,I,LINE D TXT^DGMHV(REASONE,58) F I=1:1:$O(MARX(""),-1) S LINE=$G(MARX(I)) D
..I I=1 W LINE S DGRSNCNT=1 Q
..W !?20,LINE
;
W !!
I ",1,"[(","_$G(MHVEN)_",") S DGDIR(2)=";2:Authentication" W "[2]"
W ?7,"Authenticated: ",$S(MHVAU=0:"NO",MHVAU=1:"YES",MHVAU=2:"ACTION/IN PROGRESS",1:"UNANSWERED") D
.I MHVAU!(MHVAU=0) N AUTHDT S AUTHDT=$$AUTHDATE(DFN) I AUTHDT&(MHVAU=1) W ?44,"Confirmed: "_AUTHDT
I MHVAU=0,'$G(DGRSNCNT) S REASON=$G(MHVOK(2,DFN_",",537037,"I")) I REASON W !?12,"Reason: " S REASONE=$$LKUPRSN^DGMHVAC(REASON) D
.N DGRSNTXT S DGRSNTXT=$$LKUPRTXT^DGMHVAC(DFN,2.2) I (REASONE="Other")&($L(DGRSNTXT)>1) S REASONE=REASONE_" - "_DGRSNTXT
.N MARX,I,LINE D TXT^DGMHV(REASONE,58) F I=1:1:$O(MARX(""),-1) S LINE=$G(MARX(I)) D
..I I=1 W LINE S DGRSNCNT=1 Q
..W !?21,LINE
I MHVAU=2 N ACTIEN S ACTIEN="" F S ACTIEN=$O(^DPT(DFN,4,"B",ACTIEN)) Q:ACTIEN="" D
.N ACTTXT,LI S ACTTXT=$P($G(^DGMHV(390.02,+ACTIEN,3,1,0)),"^") I ACTTXT]"" D
..N TXTND S TXTND=1 F S TXTND=$O(^DGMHV(390.02,ACTIEN,3,TXTND)) Q:'TXTND S ACTTXT=ACTTXT_" "_^DGMHV(390.02,ACTIEN,3,TXTND,0)
..Q:$L(ACTTXT)<2 N MARX,INOD,LINE D TXT^DGMHV(ACTTXT,48) F INOD=1:1:$O(MARX(""),-1) S LINE=$G(MARX(INOD)) D
...I INOD=1 W !?14,"Action: ",LINE S DGRSNCNT=1 Q
...W !?22,LINE
;
W !!
I ",1,"[(","_$G(MHVAU)_",") S DGDIR(3)=";3:Secure Messaging" W "[3]"
W ?4,"Secure Messaging: ",$S(MHVMSG=0:"NO",MHVMSG=1:"YES",MHVMSG=2:"ACTION/IN PROGRESS",1:"UNANSWERED") D
.I MHVMSG!(MHVMSG=0) N MSGDT S MSGDT=$$MSGDATE(DFN) I MSGDT&(MHVMSG=1) W ?44,"Confirmed: "_MSGDT
I MHVMSG=0,'$G(DGRSNCNT) S REASON=$G(MHVOK(2,DFN_",",537038,"I")) I REASON W !?12,"Reason: " S REASONE=$$LKUPRSN^DGMHVAC(REASON) D
.N DGRSNTXT S DGRSNTXT=$$LKUPRTXT^DGMHVAC(DFN,2.3) I REASONE="Other"&($L(DGRSNTXT)>1) S REASONE=REASONE_" - "_DGRSNTXT
.N MARX,I,LINE D TXT^DGMHV(REASONE,60) F I=1:1:$O(MARX(""),-1) S LINE=$G(MARX(I)) D
..I I=1 W LINE S DGRSNCNT=1 Q
..W !?20,LINE
I MHVMSG=2 N ACTIEN S ACTIEN="" F S ACTIEN=$O(^DPT(DFN,3,"B",ACTIEN)) Q:ACTIEN="" D
.N ACTTXT,LI S ACTTXT=$P($G(^DGMHV(390.02,+ACTIEN,3,1,0)),"^") I ACTTXT]"" D
..N TXTND S TXTND=1 F S TXTND=$O(^DGMHV(390.02,ACTIEN,3,TXTND)) Q:'TXTND S ACTTXT=ACTTXT_" "_^DGMHV(390.02,ACTIEN,3,TXTND,0)
..Q:$L(ACTTXT)<2 N MARX,INOD,LINE D TXT^DGMHV(ACTTXT,48) F INOD=1:1:$O(MARX(""),-1) S LINE=$G(MARX(INOD)) D
...I INOD=1 W !?14,"Action: ",LINE S DGRSNCNT=1 Q
...W !?22,LINE
W !!!!!!!
K DIRUT S DGMHVFIN=0
K DGABB
S DGSCHTR=$$SELFLDS(DFN)
N DGDONE F Q:$G(DGDONE) D
.N DIR S DIR("A")="Select a Registration step, or RETURN to continue: "
.S DIR(0)="SAO^1:Registration"_$G(DGDIR(2))_$G(DGDIR(3))
.D ^DIR S DGRSPNS=Y I DGSCHTR[(","_DGRSPNS_",") S DGDONE=1 Q
.I DGRSPNS=""!(DGRSPNS="^") S DGRSPNS="" S DGDONE=1 Q
.W !," Not a valid response",!
S DGMHVFIN=$S(DGSCHTR[(","_DGRSPNS_",")=1:0,1:1)
Q DGRSPNS
;
ENQACHK(DFN) ; Return followup question in DGSUPTXT if last action taken for patient DFN was one of the socialization actions
N DGSUP1,DGSUP2,DGSUP3,DGACT,DIR
S DGMHVOUT=$G(DGMHVOUT)
; Get MHV SOCIALIZATION ACTIONS (#390.02) file entries for which "SELECTABLE LOCATIONS"
; includes SOCIALIZATION
; NOTE: If there are adjustments to the values in files 390.02 this API may need to be updated
D GETACTS^DGMHV(.DGACT,"S")
S DGSUP1="Were you successful in creating your My HealtheVet account?"
S DGSUP2=$P(DGSUP1,"?")_" during your last visit?"
S DGSUP3="Were you able to create a My HealtheVet account from the Registration instructions we gave you last time?"
S DGSUPTXT=$S($$LASTACHK^DGMHVAC(DFN,$G(DGACT(1)))!$$LASTACHK^DGMHVAC(DFN,$G(DGACT(2))):DGSUP2,$$LASTACHK^DGMHVAC(DFN,$G(DGACT(3)))!$$LASTACHK^DGMHVAC(DFN,$G(DGACT(5))):DGSUP1,$$LASTACHK^DGMHVAC(DFN,$G(DGACT(4))):DGSUP3,1:"")
Q DGSUPTXT
;
GETLACT(DFN,DGLACTS) ; Get most recent MHV actions entered by clerk for patient DFN
; Input: DFN - Patient IEN
; Output: DGLACTS - Array of MHV actions
;
N DGOT,LASTCNT,ACTCNT,X,X1,Y,LASTDT,LASTACT,LASTIEN,ACTCNT,FNDACT,LIENOK S (LASTACT,LASTIEN,DGLACTS,LASTCNT)=""
S LASTDT="" F LASTCNT=1:1 S LASTDT=$O(^DPT(DFN,1,"B",LASTDT),-1) Q:'LASTDT!($G(DGOT)>4) D
.F S LASTIEN=$O(^DPT(DFN,1,"B",LASTDT,LASTIEN)) Q:'LASTIEN D
..Q:'$O(^DPT(DFN,1,LASTIEN,1,0)) S ACTCNT("DT",LASTIEN)=LASTDT,FNDACT=1,LIENOK=LASTIEN,DGOT=$G(DGOT)+1
Q:'$G(LIENOK)
S LIENOK="" F S LIENOK=$O(ACTCNT("DT",LIENOK)) Q:'LIENOK N LASTDT S LASTDT=$G(ACTCNT("DT",LIENOK)) D
.S ACTCNT=0 F S ACTCNT=$O(^DPT(DFN,1,LIENOK,1,ACTCNT)) Q:'ACTCNT S ACTCNT(LASTDT,ACTCNT)=^DPT(DFN,1,LIENOK,1,ACTCNT,0) D
..N ACTTXT,ACTIEN S ACTIEN=+$G(ACTCNT(LASTDT,ACTCNT)) S ACTTXT=$G(^DGMHV(390.02,ACTIEN,3,1,0)) I ACTTXT]"" D
...N TXTND S TXTND=1 F S TXTND=$O(^DGMHV(390.02,ACTIEN,3,TXTND)) Q:'TXTND S ACTTXT=ACTTXT_" "_^DGMHV(390.02,ACTIEN,3,TXTND,0)
...S ACTCNT(LASTDT,ACTCNT,"IEN")=ACTCNT(LASTDT,ACTCNT)
...N MARX D TXT^DGMHV(ACTTXT,60) M ACTCNT(LASTDT,ACTCNT,"TXT")=MARX
S LASTDT=$O(ACTCNT(0)) I $O(ACTCNT(0)) M DGLACTS=ACTCNT
Q
;
ACTSCRN(ACTIEN,LOCLIST) ; Check on code/functional locations at which MHV actions are selectable
; Accepts an ACTION (#390.02) file IEN, returns array LOCLIST(LOC) where LOC is a location at which the action is selectable
;
Q:'$G(ACTIEN) K LOCLIST S LOCLIST=""
N ACTLOCN Q:'$D(^DGMHV(390.02,+ACTIEN,1))
S ACTLOCN=0 F S ACTLOCN=$O(^DGMHV(390.02,ACTIEN,1,ACTLOCN)) Q:'ACTLOCN D
.S LOCLIST=$G(^DGMHV(390.02,ACTIEN,1,ACTLOCN,0)) I LOCLIST S LOCLIST=$P($G(^DGMHV(390.04,LOCLIST,0)),"^") I LOCLIST]"" S LOCLIST(LOCLIST)=""
Q
;
N DGPTINFO,DGSCST,DGNMSSN K ^UTILITY("DIQ1",$J)
N DIC,DA,DR S DIQ(0)="E",DIC=2,DA=DFN,DR=".01;391" D EN^DIQ1 M DGPTINFO(DFN)=^UTILITY("DIQ1",$J,2,DFN)
D CLEAR^DGMHV
W !!?20,"MY HEALTHEVET REGISTRATION STATUS"
S DGNMSSN=$$SSNNM^DGRPU(DFN)
W !!,DGNMSSN,?60,$G(DGPTINFO(DFN,391,"E"))
W !,"================================================================================"
K ^UTILITY("DIQ1",$J)
Q
;
SELFLDS(DFN) ; Get selectable Enrollment/Registration fields based on values of other fields
;
N MHVEN,MHVAU,MHVMSG,MHVFLDS,DGFLDSEL
N DIC,DA,DR
S DIQ(0)="I",DIC=2,DA=DFN,DR="537027:537040" D GETS^DIQ(DIC,DFN,DR,"I","MHVFLDS")
S MHVEN=$G(MHVFLDS(2,DFN_",",537027,"I")),MHVAU=$G(MHVFLDS(2,DFN_",",537028,"I")),MHVMSG=$G(MHVFLDS(2,DFN_",",537029,"I"))
N DGFLDSEL S DGFLDSEL=1
I $S(",0,1,"[(","_$G(MHVEN)_","):1,1:0) S DGFLDSEL=DGFLDSEL_",2"
I $S(",0,1,"[(","_$G(MHVAU)_","):1,1:0) S DGFLDSEL=DGFLDSEL_",3"
S DGFLDSEL=","_DGFLDSEL_","
Q DGFLDSEL
;
ENTRYFLD(DFN,DGUNONLY) ; Get first non-firmly answered field either unanswered or action in progress
;
N MHVEN,MHVAU,MHVMSG,MHVFLDS,DGFLDSEL
N DIC,DA,DR
S DIQ(0)="I",DIC=2,DA=DFN,DR="537027:537040" D GETS^DIQ(DIC,DFN,DR,"I","MHVFLDS")
S MHVEN=$G(MHVFLDS(2,DFN_",",537027,"I")),MHVAU=$G(MHVFLDS(2,DFN_",",537028,"I")),MHVMSG=$G(MHVFLDS(2,DFN_",",537029,"I"))
N DGFLDSEL S DGFLDSEL=""
I '$G(DGUNONLY) D
.I MHVMSG=""!(MHVMSG=2) S DGFLDSEL=3
.I MHVAU=""!(MHVAU=2) S DGFLDSEL=2
.I MHVEN="" S DGFLDSEL=1
I $G(DGUNONLY) D
.I MHVAU=2!(MHVMSG=2) Q
.I MHVMSG="" S DGFLDSEL=3
.I MHVAU="" S DGFLDSEL=2
.I MHVEN="" S DGFLDSEL=1
Q DGFLDSEL
;
GETEN(DFN) ; Get value of MHV Registered
;
N MHVEN,MHVAU,MHVMSG,MHVFLDS,DGFLDSEL
N DIC,DA,DR
S DIQ(0)="I",DIC=2,DA=DFN,DR="537027" D GETS^DIQ(DIC,DFN,DR,"I","MHVFLDS")
S MHVEN=$G(MHVFLDS(2,DFN_",",537027,"I"))
Q MHVEN
;
GETAUTH(DFN) ; Get value of MHV Authenticated
;
N MHVEN,MHVAU,MHVMSG,MHVFLDS,DGFLDSEL
N DIC,DA,DR
S DIQ(0)="I",DIC=2,DA=DFN,DR="537028" D GETS^DIQ(DIC,DFN,DR,"I","MHVFLDS")
S MHVAU=$G(MHVFLDS(2,DFN_",",537028,"I"))
Q MHVAU
;
GETMSG(DFN) ; Get value of MHV Secure Messaging
;
N MHVEN,MHVAU,MHVMSG,MHVFLDS,DGFLDSEL
N DIC,DA,DR
S DIQ(0)="I",DIC=2,DA=DFN,DR="537029" D GETS^DIQ(DIC,DFN,DR,"I","MHVFLDS")
S MHVMSG=$G(MHVFLDS(2,DFN_",",537029,"I"))
Q MHVMSG
;
CANTXT(DGMSG,CLEAR,CONT,DGTXTW) ; Display canned text to read to patient
Q:$G(DGMSG)']""
N DGINDEN,TMPCAN,NEXT,CANTXT,MARX,I S CANTXT=""
F I=0:1 S TMPCAN=$T(@(DGMSG_"+"_I)) Q:TMPCAN'[";" S CANTXT=CANTXT_$P(TMPCAN,";",2)
Q:CANTXT=""
I $G(CLEAR) D CLEAR^DGMHV
W !,"Please read the following to the patient",!
S DGTXTW=$S($G(DGTXTW):DGTXTW,1:60)
D TXT^DGMHV(.CANTXT,DGTXTW)
S DGINDEN=(80-DGTXTW)/2
S NEXT=0 F S NEXT=$O(MARX(NEXT)) Q:'NEXT D
.W !?DGINDEN,MARX(NEXT)
I $G(CONT) W !! D CONT^DGMHV
Q
;
UP ;"Upgrade to a Premium My HealtheVet account to view parts of your VA health record and
; use Secure Messaging. This requires one-time in-person identity verification (show
; government issued photo ID). Read and sign VA Release of Information form (10-5345a-MHV).
; Present a government issued photo ID required. (Instructions for optional online
; Authentication process are also available)"
Q
SMSG ;"With Secure Messaging, Veterans can communicate online with VA health care teams about health, medication questions, request prescription renewals, and/or appointments."
Q
AUTH ;"With a Premium My HealtheVet account, patients can view VA appointments, lab results, access portions of their VA medical record and use Secure Messaging"
Q
MHVPCHK(DFN) ; Consistency checker MHV update
; Don't trigger update if MHV REGISTERED has not been answered, and Registration socialization action is pending
N DGMHVOUT,DGMHVQ,DGMHVACT,DP,DG,DK,DH,DM,DQ,DR,DL,X,Y,DC,DE,DIC,DIE,DIIENS,DIFLD,DIETMP,DW,D,D0,DG,DI,DIEL,DU,DV,DIR
S DGMHVOUT=0,DGMHVQ=0
S DGMHVACT=$$ENQACHK^DGMHVUTL(DFN) Q:(DGMHVACT]"")&'$G(^DPT(DFN,2))
S DGMHVACT=$$ENTRYFLD^DGMHVUTL(DFN)
D MAIN^DGMHVAC(DFN,DGMHVACT)
S:'$$MHVOK^DGMHVAC(DFN) FILERR(315)=""
Q
;
GETFLDS(DFN,FLDARRAY) ; Get MHV Registration status field and date values, place in array formatted for merging with historical action display
N DGEN,DGAUTH,DGMSG,DGENDT,DGAUDT,DGMSGDT
S DGEN=$$GETEN(DFN),DGAUTH=$$GETAUTH(DFN),DGMSG=$$GETMSG(DFN)
S DGENDT=$$ENDATE(DFN,1),DGAUDT=$$AUTHDATE(DFN,1),DGMSGDT=$$MSGDATE(DFN,1)
I DGENDT&($G(DGEN)=1) S FLDARRAY(DGENDT,1)="",FLDARRAY(DGENDT,1,"TXT")=1 D
.S FLDARRAY(DGENDT,1,"TXT",1)="My HealtheVet Registration "_$S(DGEN=1:"confirmed.",1:"")
I DGAUDT&($G(DGAUTH)=1) S FLDARRAY(DGAUDT,1)="",FLDARRAY(DGAUDT,1,"TXT")=1 D
.S FLDARRAY(DGAUDT,1,"TXT",1)="My HealtheVet Authenticated/Premium Upgrade "_$S(DGAUTH=1:"confirmed.",1:"")
I DGMSGDT&($G(DGMSG)=1) S FLDARRAY(DGMSGDT,1)="",FLDARRAY(DGMSGDT,1,"TXT")=1 D
.S FLDARRAY(DGMSGDT,1,"TXT",1)="My HealtheVet Secure Messaging "_$S(DGMSG=1:"confirmed.",1:"")
Q
CONSTAT(DFN,DGFLDNO) ; Write condensed patient MHV status
N DGEN,DGAUTH,DGMSG,DGMHVFLD
N DGENDT,DGAUTHDT,DGMSGDT
N DIQ,DIC,DA,DR,DGDTPC,DGTIMPC
S DGEN=$$GETEN(DFN)
S DGAUTH=$$GETAUTH(DFN)
S DGMSG=$$GETMSG(DFN)
N DGDASH S $P(DGDASH,"-",78)="-"
I $G(DGFLDNO(1))!$G(DGFLDNO(2))!$G(DGFLDNO(3)) W !?10,"MHV Registration Progress" ;,?40,"Status" D
W !,DGDASH
I $G(DGFLDNO(1)) W !,$$ENDATE(DFN),?10,"[Step 1 of 3] My HealtheVet Registration: ",?56,$S(DGEN=1:"COMPLETED",DGEN=2:"ACTION PENDING",DGEN=0:"REFUSED",1:"UNANSWERED")
I $G(DGFLDNO(2)) W !,$$AUTHDATE(DFN),?10,"[Step 2 of 3] Authentication Upgrade:",?56,$S(DGAUTH=1:"COMPLETED: ",DGAUTH=2:"ACTION PENDING",DGAUTH=0:"REFUSED",1:"UNANSWERED")
I $G(DGFLDNO(3)) W !,$$MSGDATE(DFN),?10,"[Step 3 of 3] Secure Messaging Verification:",?56,$S(DGMSG=1:" COMPLETED: "_$$MSGDATE(DFN),DGMSG=2:"ACTION PENDING",DGMSG=0:"REFUSED:",1:"UNANSWERED")
Q
ENDATE(DFN,INTERNAL) ; Most recent date mhv Registration was updated
N DGENDT,DGDTPC,DGTIMPC,DIQ,DIC,DA,DR,DGDTPC,DGTIMPC,MHVFLD
S DIQ(0)="I",DIC=2,DA=DFN,DR="537030" D GETS^DIQ(DIC,DFN,DR,"I","MHVFLD")
S DGENDT=$G(MHVFLD(2,DFN_",",537030,"I")) I $G(INTERNAL) Q DGENDT
I DGENDT S DGENDT=$$FMTE^XLFDT(DGENDT,2)
S $P(DGENDT,"@",2)=$P($P(DGENDT,"@",2),":",1,2)
S DGENDT=$P(DGENDT,"@")
Q DGENDT
AUTHDATE(DFN,INTERNAL) ; Most recent date mhv authentication was updated
N DGAUTHDT,DGDTPC,DGTIMPC,DIQ,DIC,DA,DR,DGDTPC,DGTIMPC,MHVFLD
S DIQ(0)="I",DIC=2,DA=DFN,DR="537031" D GETS^DIQ(DIC,DFN,DR,"I","MHVFLD")
S DGAUTHDT=$G(MHVFLD(2,DFN_",",537031,"I")) I $G(INTERNAL) Q DGAUTHDT
I DGAUTHDT S DGAUTHDT=$$FMTE^XLFDT(DGAUTHDT,2)
S $P(DGAUTHDT,"@",2)=$P($P(DGAUTHDT,"@",2),":",1,2)
S DGAUTHDT=$P(DGAUTHDT,"@")
Q DGAUTHDT
MSGDATE(DFN,INTERNAL) ; Most recent date mhv secure messaging was updated
N DGMSGDT,DGDTPC,DGTIMPC,DIQ,DIC,DA,DR,DGDTPC,DGTIMPC,MHVFLD
S DIQ(0)="I",DIC=2,DA=DFN,DR="537032" D GETS^DIQ(DIC,DFN,DR,"I","MHVFLD")
S DGMSGDT=$G(MHVFLD(2,DFN_",",537032,"I")) I $G(INTERNAL) Q DGMSGDT
I DGMSGDT S DGMSGDT=$$FMTE^XLFDT(DGMSGDT,2)
S $P(DGMSGDT,"@",2)=$P($P(DGMSGDT,"@",2),":",1,2)
S DGMSGDT=$P(DGMSGDT,"@")
Q DGMSGDT
MHVENABL() ; Get value of "Enable MyHealtheVet Prompts?" from MAS Parameter (#43) file
; This API is checked to determine if the MyHealtheVet functionality is enable or not.
N DIQ,DIC,DA,DR,MHVFLDS
S DIQ(0)="I",DIC=43,DA=1,DR="1100.07" D GETS^DIQ(DIC,DA,DR,"I","MHVFLDS")
Q +$G(MHVFLDS(43,DA_",",1100.07,"I"))
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGMHVUTL 15350 printed Dec 13, 2024@02:44:16 Page 2
DGMHVUTL ;ALB/JCH - Patient MHV Enrollment/Registration - Utilities ;09/12/14 11:30am
+1 ;;5.3;Registration;**903**;August 13, 1993;Build 82
+2 ;
+3 ; Submitted to OSEHRA 04/02/2015 by HP
+4 ; All entry points authored by James Harris 2014-2015
+5 ;
+6 QUIT
QUESUC(DFN,DGMHVOUT) ; If last action entered by clerk was one of the Socialization actions
+1 ; from MHV SOCIALIZATION ACTIONS (#390.02) file entries for which "SELECTABLE LOCATIONS"
+2 ; includes SOCIALIZATION, display/prompt the "were you successful" message/question
+3 ;
+4 NEW DGSUPTXT
+5 SET DGSUPTXT=$$ENQACHK(DFN)
+6 IF DGSUPTXT]""
Begin DoDot:1
+7 if $PIECE($GET(^DPT(DFN,2)),"^")
QUIT
+8 NEW NXT,MARX,DIR,DGTXTCNT
SET DIR(0)="YA"
SET DIR("A",1)=" Please read the following to the patient:"
+9 SET DIR("?")=" Enter the patient's response to the question"
+10 DO TXT^DGMHV(DGSUPTXT,55)
SET DGTXTCNT=0
SET NXT=3
FOR
SET DGTXTCNT=$ORDER(MARX(DGTXTCNT))
if 'DGTXTCNT
QUIT
Begin DoDot:2
+11 IF '$ORDER(MARX(DGTXTCNT))
SET DIR("A")=" "_MARX(DGTXTCNT)_""""_" (Y/N): "
QUIT
+12 SET DIR("A",NXT)=" """_MARX(DGTXTCNT)
SET NXT=$GET(NXT)+1
End DoDot:2
+13 WRITE !
DO ^DIR
SET DGMHVOUT=$SELECT(Y=1:"R",Y=0:"A",1:"")
+14 IF $GET(DGMHVOUT)="R"
NEW DIE,DA
SET DIE="^DPT("
SET DA=DFN
SET DR="537027////1;537030////"_$$NOW^XLFDT
DO ^DIE
+15 HANG .5
End DoDot:1
QUIT
+16 KILL DIR
+17 QUIT
+18 ;
DSPENR(DFN,DGMHVFIN) ; Display patient's MHV Enrollment/Registration information
+1 ; This is the MHV Registration pseudo-screen display; allow entry of 1 to edit the fields as a group, in sequence.
+2 NEW ACTION,ACTIONE,REASON,REASONE,MHVOK,MHVOKND,MHVEN,MHVEN,MHVAU,MHVMSG,DGRSNTXT
+3 NEW X,Y,IORVON,IORVOFF,DIR,DIRUT,DGRSNCNT,DGRSPNS,DGSCHTR,DGDIR
+4 ;
+5 DO HEADER(DFN)
+6 KILL MHVOK
NEW DIC,DA,DR
SET DIQ(0)="I"
SET DIC=2
SET DA=DFN
SET DR="537027:537040"
DO GETS^DIQ(DIC,DFN,DR,"I","MHVOK")
+7 SET MHVEN=$GET(MHVOK(2,DFN_",",537027,"I"))
SET MHVAU=$GET(MHVOK(2,DFN_",",537028,"I"))
SET MHVMSG=$GET(MHVOK(2,DFN_",",537029,"I"))
+8 SET X="IORVON;IORVOFF"
DO ENDR^%ZISS
+9 WRITE !!!,"[1] Registered: ",$SELECT(MHVEN=0:"NO",MHVEN=1:"YES",1:"UNANSWERED")
IF MHVEN=1!(MHVEN=0)
Begin DoDot:1
+10 NEW ENRDT
SET ENRDT=$$ENDATE(DFN)
IF ENRDT&(MHVEN=1)
WRITE ?44,"Confirmed: "_ENRDT
End DoDot:1
+11 IF MHVEN=0
SET REASON=$GET(MHVOK(2,DFN_",",537036,"I"))
IF REASON
WRITE !?12,"Reason: "
SET REASONE=$$LKUPRSN^DGMHVAC(REASON)
Begin DoDot:1
+12 NEW DGRSNTXT
SET DGRSNTXT=$$LKUPRTXT^DGMHVAC(DFN,2.1)
IF (REASONE="Other")&($LENGTH(DGRSNTXT)>1)
SET REASONE=REASONE_" - "_DGRSNTXT
+13 NEW MARX,I,LINE
DO TXT^DGMHV(REASONE,58)
FOR I=1:1:$ORDER(MARX(""),-1)
SET LINE=$GET(MARX(I))
Begin DoDot:2
+14 IF I=1
WRITE LINE
SET DGRSNCNT=1
QUIT
+15 WRITE !?20,LINE
End DoDot:2
End DoDot:1
+16 ;
+17 WRITE !!
+18 IF ",1,"[(","_$GET(MHVEN)_",")
SET DGDIR(2)=";2:Authentication"
WRITE "[2]"
+19 WRITE ?7,"Authenticated: ",$SELECT(MHVAU=0:"NO",MHVAU=1:"YES",MHVAU=2:"ACTION/IN PROGRESS",1:"UNANSWERED")
Begin DoDot:1
+20 IF MHVAU!(MHVAU=0)
NEW AUTHDT
SET AUTHDT=$$AUTHDATE(DFN)
IF AUTHDT&(MHVAU=1)
WRITE ?44,"Confirmed: "_AUTHDT
End DoDot:1
+21 IF MHVAU=0
IF '$GET(DGRSNCNT)
SET REASON=$GET(MHVOK(2,DFN_",",537037,"I"))
IF REASON
WRITE !?12,"Reason: "
SET REASONE=$$LKUPRSN^DGMHVAC(REASON)
Begin DoDot:1
+22 NEW DGRSNTXT
SET DGRSNTXT=$$LKUPRTXT^DGMHVAC(DFN,2.2)
IF (REASONE="Other")&($LENGTH(DGRSNTXT)>1)
SET REASONE=REASONE_" - "_DGRSNTXT
+23 NEW MARX,I,LINE
DO TXT^DGMHV(REASONE,58)
FOR I=1:1:$ORDER(MARX(""),-1)
SET LINE=$GET(MARX(I))
Begin DoDot:2
+24 IF I=1
WRITE LINE
SET DGRSNCNT=1
QUIT
+25 WRITE !?21,LINE
End DoDot:2
End DoDot:1
+26 IF MHVAU=2
NEW ACTIEN
SET ACTIEN=""
FOR
SET ACTIEN=$ORDER(^DPT(DFN,4,"B",ACTIEN))
if ACTIEN=""
QUIT
Begin DoDot:1
+27 NEW ACTTXT,LI
SET ACTTXT=$PIECE($GET(^DGMHV(390.02,+ACTIEN,3,1,0)),"^")
IF ACTTXT]""
Begin DoDot:2
+28 NEW TXTND
SET TXTND=1
FOR
SET TXTND=$ORDER(^DGMHV(390.02,ACTIEN,3,TXTND))
if 'TXTND
QUIT
SET ACTTXT=ACTTXT_" "_^DGMHV(390.02,ACTIEN,3,TXTND,0)
+29 if $LENGTH(ACTTXT)<2
QUIT
NEW MARX,INOD,LINE
DO TXT^DGMHV(ACTTXT,48)
FOR INOD=1:1:$ORDER(MARX(""),-1)
SET LINE=$GET(MARX(INOD))
Begin DoDot:3
+30 IF INOD=1
WRITE !?14,"Action: ",LINE
SET DGRSNCNT=1
QUIT
+31 WRITE !?22,LINE
End DoDot:3
End DoDot:2
End DoDot:1
+32 ;
+33 WRITE !!
+34 IF ",1,"[(","_$GET(MHVAU)_",")
SET DGDIR(3)=";3:Secure Messaging"
WRITE "[3]"
+35 WRITE ?4,"Secure Messaging: ",$SELECT(MHVMSG=0:"NO",MHVMSG=1:"YES",MHVMSG=2:"ACTION/IN PROGRESS",1:"UNANSWERED")
Begin DoDot:1
+36 IF MHVMSG!(MHVMSG=0)
NEW MSGDT
SET MSGDT=$$MSGDATE(DFN)
IF MSGDT&(MHVMSG=1)
WRITE ?44,"Confirmed: "_MSGDT
End DoDot:1
+37 IF MHVMSG=0
IF '$GET(DGRSNCNT)
SET REASON=$GET(MHVOK(2,DFN_",",537038,"I"))
IF REASON
WRITE !?12,"Reason: "
SET REASONE=$$LKUPRSN^DGMHVAC(REASON)
Begin DoDot:1
+38 NEW DGRSNTXT
SET DGRSNTXT=$$LKUPRTXT^DGMHVAC(DFN,2.3)
IF REASONE="Other"&($LENGTH(DGRSNTXT)>1)
SET REASONE=REASONE_" - "_DGRSNTXT
+39 NEW MARX,I,LINE
DO TXT^DGMHV(REASONE,60)
FOR I=1:1:$ORDER(MARX(""),-1)
SET LINE=$GET(MARX(I))
Begin DoDot:2
+40 IF I=1
WRITE LINE
SET DGRSNCNT=1
QUIT
+41 WRITE !?20,LINE
End DoDot:2
End DoDot:1
+42 IF MHVMSG=2
NEW ACTIEN
SET ACTIEN=""
FOR
SET ACTIEN=$ORDER(^DPT(DFN,3,"B",ACTIEN))
if ACTIEN=""
QUIT
Begin DoDot:1
+43 NEW ACTTXT,LI
SET ACTTXT=$PIECE($GET(^DGMHV(390.02,+ACTIEN,3,1,0)),"^")
IF ACTTXT]""
Begin DoDot:2
+44 NEW TXTND
SET TXTND=1
FOR
SET TXTND=$ORDER(^DGMHV(390.02,ACTIEN,3,TXTND))
if 'TXTND
QUIT
SET ACTTXT=ACTTXT_" "_^DGMHV(390.02,ACTIEN,3,TXTND,0)
+45 if $LENGTH(ACTTXT)<2
QUIT
NEW MARX,INOD,LINE
DO TXT^DGMHV(ACTTXT,48)
FOR INOD=1:1:$ORDER(MARX(""),-1)
SET LINE=$GET(MARX(INOD))
Begin DoDot:3
+46 IF INOD=1
WRITE !?14,"Action: ",LINE
SET DGRSNCNT=1
QUIT
+47 WRITE !?22,LINE
End DoDot:3
End DoDot:2
End DoDot:1
+48 WRITE !!!!!!!
+49 KILL DIRUT
SET DGMHVFIN=0
+50 KILL DGABB
+51 SET DGSCHTR=$$SELFLDS(DFN)
+52 NEW DGDONE
FOR
if $GET(DGDONE)
QUIT
Begin DoDot:1
+53 NEW DIR
SET DIR("A")="Select a Registration step, or RETURN to continue: "
+54 SET DIR(0)="SAO^1:Registration"_$GET(DGDIR(2))_$GET(DGDIR(3))
+55 DO ^DIR
SET DGRSPNS=Y
IF DGSCHTR[(","_DGRSPNS_",")
SET DGDONE=1
QUIT
+56 IF DGRSPNS=""!(DGRSPNS="^")
SET DGRSPNS=""
SET DGDONE=1
QUIT
+57 WRITE !," Not a valid response",!
End DoDot:1
+58 SET DGMHVFIN=$SELECT(DGSCHTR[(","_DGRSPNS_",")=1:0,1:1)
+59 QUIT DGRSPNS
+60 ;
ENQACHK(DFN) ; Return followup question in DGSUPTXT if last action taken for patient DFN was one of the socialization actions
+1 NEW DGSUP1,DGSUP2,DGSUP3,DGACT,DIR
+2 SET DGMHVOUT=$GET(DGMHVOUT)
+3 ; Get MHV SOCIALIZATION ACTIONS (#390.02) file entries for which "SELECTABLE LOCATIONS"
+4 ; includes SOCIALIZATION
+5 ; NOTE: If there are adjustments to the values in files 390.02 this API may need to be updated
+6 DO GETACTS^DGMHV(.DGACT,"S")
+7 SET DGSUP1="Were you successful in creating your My HealtheVet account?"
+8 SET DGSUP2=$PIECE(DGSUP1,"?")_" during your last visit?"
+9 SET DGSUP3="Were you able to create a My HealtheVet account from the Registration instructions we gave you last time?"
+10 SET DGSUPTXT=$SELECT($$LASTACHK^DGMHVAC(DFN,$GET(DGACT(1)))!$$LASTACHK^DGMHVAC(DFN,$GET(DGACT(2))):DGSUP2,$$LASTACHK^DGMHVAC(DFN,$GET(DGACT(3)))!$$LASTACHK^DGMHVAC(DFN,$GET(DGACT(5))):DGSUP1,$$LASTACHK^DGMHVAC(DFN,$GET(DGACT(4))):DGSUP3,1:"")
+11 QUIT DGSUPTXT
+12 ;
GETLACT(DFN,DGLACTS) ; Get most recent MHV actions entered by clerk for patient DFN
+1 ; Input: DFN - Patient IEN
+2 ; Output: DGLACTS - Array of MHV actions
+3 ;
+4 NEW DGOT,LASTCNT,ACTCNT,X,X1,Y,LASTDT,LASTACT,LASTIEN,ACTCNT,FNDACT,LIENOK
SET (LASTACT,LASTIEN,DGLACTS,LASTCNT)=""
+5 SET LASTDT=""
FOR LASTCNT=1:1
SET LASTDT=$ORDER(^DPT(DFN,1,"B",LASTDT),-1)
if 'LASTDT!($GET(DGOT)>4)
QUIT
Begin DoDot:1
+6 FOR
SET LASTIEN=$ORDER(^DPT(DFN,1,"B",LASTDT,LASTIEN))
if 'LASTIEN
QUIT
Begin DoDot:2
+7 if '$ORDER(^DPT(DFN,1,LASTIEN,1,0))
QUIT
SET ACTCNT("DT",LASTIEN)=LASTDT
SET FNDACT=1
SET LIENOK=LASTIEN
SET DGOT=$GET(DGOT)+1
End DoDot:2
End DoDot:1
+8 if '$GET(LIENOK)
QUIT
+9 SET LIENOK=""
FOR
SET LIENOK=$ORDER(ACTCNT("DT",LIENOK))
if 'LIENOK
QUIT
NEW LASTDT
SET LASTDT=$GET(ACTCNT("DT",LIENOK))
Begin DoDot:1
+10 SET ACTCNT=0
FOR
SET ACTCNT=$ORDER(^DPT(DFN,1,LIENOK,1,ACTCNT))
if 'ACTCNT
QUIT
SET ACTCNT(LASTDT,ACTCNT)=^DPT(DFN,1,LIENOK,1,ACTCNT,0)
Begin DoDot:2
+11 NEW ACTTXT,ACTIEN
SET ACTIEN=+$GET(ACTCNT(LASTDT,ACTCNT))
SET ACTTXT=$GET(^DGMHV(390.02,ACTIEN,3,1,0))
IF ACTTXT]""
Begin DoDot:3
+12 NEW TXTND
SET TXTND=1
FOR
SET TXTND=$ORDER(^DGMHV(390.02,ACTIEN,3,TXTND))
if 'TXTND
QUIT
SET ACTTXT=ACTTXT_" "_^DGMHV(390.02,ACTIEN,3,TXTND,0)
+13 SET ACTCNT(LASTDT,ACTCNT,"IEN")=ACTCNT(LASTDT,ACTCNT)
+14 NEW MARX
DO TXT^DGMHV(ACTTXT,60)
MERGE ACTCNT(LASTDT,ACTCNT,"TXT")=MARX
End DoDot:3
End DoDot:2
End DoDot:1
+15 SET LASTDT=$ORDER(ACTCNT(0))
IF $ORDER(ACTCNT(0))
MERGE DGLACTS=ACTCNT
+16 QUIT
+17 ;
ACTSCRN(ACTIEN,LOCLIST) ; Check on code/functional locations at which MHV actions are selectable
+1 ; Accepts an ACTION (#390.02) file IEN, returns array LOCLIST(LOC) where LOC is a location at which the action is selectable
+2 ;
+3 if '$GET(ACTIEN)
QUIT
KILL LOCLIST
SET LOCLIST=""
+4 NEW ACTLOCN
if '$DATA(^DGMHV(390.02,+ACTIEN,1))
QUIT
+5 SET ACTLOCN=0
FOR
SET ACTLOCN=$ORDER(^DGMHV(390.02,ACTIEN,1,ACTLOCN))
if 'ACTLOCN
QUIT
Begin DoDot:1
+6 SET LOCLIST=$GET(^DGMHV(390.02,ACTIEN,1,ACTLOCN,0))
IF LOCLIST
SET LOCLIST=$PIECE($GET(^DGMHV(390.04,LOCLIST,0)),"^")
IF LOCLIST]""
SET LOCLIST(LOCLIST)=""
End DoDot:1
+7 QUIT
+8 ;
+1 NEW DGPTINFO,DGSCST,DGNMSSN
KILL ^UTILITY("DIQ1",$JOB)
+2 NEW DIC,DA,DR
SET DIQ(0)="E"
SET DIC=2
SET DA=DFN
SET DR=".01;391"
DO EN^DIQ1
MERGE DGPTINFO(DFN)=^UTILITY("DIQ1",$JOB,2,DFN)
+3 DO CLEAR^DGMHV
+4 WRITE !!?20,"MY HEALTHEVET REGISTRATION STATUS"
+5 SET DGNMSSN=$$SSNNM^DGRPU(DFN)
+6 WRITE !!,DGNMSSN,?60,$GET(DGPTINFO(DFN,391,"E"))
+7 WRITE !,"================================================================================"
+8 KILL ^UTILITY("DIQ1",$JOB)
+9 QUIT
+10 ;
SELFLDS(DFN) ; Get selectable Enrollment/Registration fields based on values of other fields
+1 ;
+2 NEW MHVEN,MHVAU,MHVMSG,MHVFLDS,DGFLDSEL
+3 NEW DIC,DA,DR
+4 SET DIQ(0)="I"
SET DIC=2
SET DA=DFN
SET DR="537027:537040"
DO GETS^DIQ(DIC,DFN,DR,"I","MHVFLDS")
+5 SET MHVEN=$GET(MHVFLDS(2,DFN_",",537027,"I"))
SET MHVAU=$GET(MHVFLDS(2,DFN_",",537028,"I"))
SET MHVMSG=$GET(MHVFLDS(2,DFN_",",537029,"I"))
+6 NEW DGFLDSEL
SET DGFLDSEL=1
+7 IF $SELECT(",0,1,"[(","_$GET(MHVEN)_","):1,1:0)
SET DGFLDSEL=DGFLDSEL_",2"
+8 IF $SELECT(",0,1,"[(","_$GET(MHVAU)_","):1,1:0)
SET DGFLDSEL=DGFLDSEL_",3"
+9 SET DGFLDSEL=","_DGFLDSEL_","
+10 QUIT DGFLDSEL
+11 ;
ENTRYFLD(DFN,DGUNONLY) ; Get first non-firmly answered field either unanswered or action in progress
+1 ;
+2 NEW MHVEN,MHVAU,MHVMSG,MHVFLDS,DGFLDSEL
+3 NEW DIC,DA,DR
+4 SET DIQ(0)="I"
SET DIC=2
SET DA=DFN
SET DR="537027:537040"
DO GETS^DIQ(DIC,DFN,DR,"I","MHVFLDS")
+5 SET MHVEN=$GET(MHVFLDS(2,DFN_",",537027,"I"))
SET MHVAU=$GET(MHVFLDS(2,DFN_",",537028,"I"))
SET MHVMSG=$GET(MHVFLDS(2,DFN_",",537029,"I"))
+6 NEW DGFLDSEL
SET DGFLDSEL=""
+7 IF '$GET(DGUNONLY)
Begin DoDot:1
+8 IF MHVMSG=""!(MHVMSG=2)
SET DGFLDSEL=3
+9 IF MHVAU=""!(MHVAU=2)
SET DGFLDSEL=2
+10 IF MHVEN=""
SET DGFLDSEL=1
End DoDot:1
+11 IF $GET(DGUNONLY)
Begin DoDot:1
+12 IF MHVAU=2!(MHVMSG=2)
QUIT
+13 IF MHVMSG=""
SET DGFLDSEL=3
+14 IF MHVAU=""
SET DGFLDSEL=2
+15 IF MHVEN=""
SET DGFLDSEL=1
End DoDot:1
+16 QUIT DGFLDSEL
+17 ;
GETEN(DFN) ; Get value of MHV Registered
+1 ;
+2 NEW MHVEN,MHVAU,MHVMSG,MHVFLDS,DGFLDSEL
+3 NEW DIC,DA,DR
+4 SET DIQ(0)="I"
SET DIC=2
SET DA=DFN
SET DR="537027"
DO GETS^DIQ(DIC,DFN,DR,"I","MHVFLDS")
+5 SET MHVEN=$GET(MHVFLDS(2,DFN_",",537027,"I"))
+6 QUIT MHVEN
+7 ;
GETAUTH(DFN) ; Get value of MHV Authenticated
+1 ;
+2 NEW MHVEN,MHVAU,MHVMSG,MHVFLDS,DGFLDSEL
+3 NEW DIC,DA,DR
+4 SET DIQ(0)="I"
SET DIC=2
SET DA=DFN
SET DR="537028"
DO GETS^DIQ(DIC,DFN,DR,"I","MHVFLDS")
+5 SET MHVAU=$GET(MHVFLDS(2,DFN_",",537028,"I"))
+6 QUIT MHVAU
+7 ;
GETMSG(DFN) ; Get value of MHV Secure Messaging
+1 ;
+2 NEW MHVEN,MHVAU,MHVMSG,MHVFLDS,DGFLDSEL
+3 NEW DIC,DA,DR
+4 SET DIQ(0)="I"
SET DIC=2
SET DA=DFN
SET DR="537029"
DO GETS^DIQ(DIC,DFN,DR,"I","MHVFLDS")
+5 SET MHVMSG=$GET(MHVFLDS(2,DFN_",",537029,"I"))
+6 QUIT MHVMSG
+7 ;
CANTXT(DGMSG,CLEAR,CONT,DGTXTW) ; Display canned text to read to patient
+1 if $GET(DGMSG)']""
QUIT
+2 NEW DGINDEN,TMPCAN,NEXT,CANTXT,MARX,I
SET CANTXT=""
+3 FOR I=0:1
SET TMPCAN=$TEXT(@(DGMSG_"+"_I))
if TMPCAN'[";"
QUIT
SET CANTXT=CANTXT_$PIECE(TMPCAN,";",2)
+4 if CANTXT=""
QUIT
+5 IF $GET(CLEAR)
DO CLEAR^DGMHV
+6 WRITE !,"Please read the following to the patient",!
+7 SET DGTXTW=$SELECT($GET(DGTXTW):DGTXTW,1:60)
+8 DO TXT^DGMHV(.CANTXT,DGTXTW)
+9 SET DGINDEN=(80-DGTXTW)/2
+10 SET NEXT=0
FOR
SET NEXT=$ORDER(MARX(NEXT))
if 'NEXT
QUIT
Begin DoDot:1
+11 WRITE !?DGINDEN,MARX(NEXT)
End DoDot:1
+12 IF $GET(CONT)
WRITE !!
DO CONT^DGMHV
+13 QUIT
+14 ;
UP ;"Upgrade to a Premium My HealtheVet account to view parts of your VA health record and
+1 ; use Secure Messaging. This requires one-time in-person identity verification (show
+2 ; government issued photo ID). Read and sign VA Release of Information form (10-5345a-MHV).
+3 ; Present a government issued photo ID required. (Instructions for optional online
+4 ; Authentication process are also available)"
+5 QUIT
SMSG ;"With Secure Messaging, Veterans can communicate online with VA health care teams about health, medication questions, request prescription renewals, and/or appointments."
+1 QUIT
AUTH ;"With a Premium My HealtheVet account, patients can view VA appointments, lab results, access portions of their VA medical record and use Secure Messaging"
+1 QUIT
MHVPCHK(DFN) ; Consistency checker MHV update
+1 ; Don't trigger update if MHV REGISTERED has not been answered, and Registration socialization action is pending
+2 NEW DGMHVOUT,DGMHVQ,DGMHVACT,DP,DG,DK,DH,DM,DQ,DR,DL,X,Y,DC,DE,DIC,DIE,DIIENS,DIFLD,DIETMP,DW,D,D0,DG,DI,DIEL,DU,DV,DIR
+3 SET DGMHVOUT=0
SET DGMHVQ=0
+4 SET DGMHVACT=$$ENQACHK^DGMHVUTL(DFN)
if (DGMHVACT]"")&'$GET(^DPT(DFN,2))
QUIT
+5 SET DGMHVACT=$$ENTRYFLD^DGMHVUTL(DFN)
+6 DO MAIN^DGMHVAC(DFN,DGMHVACT)
+7 if '$$MHVOK^DGMHVAC(DFN)
SET FILERR(315)=""
+8 QUIT
+9 ;
GETFLDS(DFN,FLDARRAY) ; Get MHV Registration status field and date values, place in array formatted for merging with historical action display
+1 NEW DGEN,DGAUTH,DGMSG,DGENDT,DGAUDT,DGMSGDT
+2 SET DGEN=$$GETEN(DFN)
SET DGAUTH=$$GETAUTH(DFN)
SET DGMSG=$$GETMSG(DFN)
+3 SET DGENDT=$$ENDATE(DFN,1)
SET DGAUDT=$$AUTHDATE(DFN,1)
SET DGMSGDT=$$MSGDATE(DFN,1)
+4 IF DGENDT&($GET(DGEN)=1)
SET FLDARRAY(DGENDT,1)=""
SET FLDARRAY(DGENDT,1,"TXT")=1
Begin DoDot:1
+5 SET FLDARRAY(DGENDT,1,"TXT",1)="My HealtheVet Registration "_$SELECT(DGEN=1:"confirmed.",1:"")
End DoDot:1
+6 IF DGAUDT&($GET(DGAUTH)=1)
SET FLDARRAY(DGAUDT,1)=""
SET FLDARRAY(DGAUDT,1,"TXT")=1
Begin DoDot:1
+7 SET FLDARRAY(DGAUDT,1,"TXT",1)="My HealtheVet Authenticated/Premium Upgrade "_$SELECT(DGAUTH=1:"confirmed.",1:"")
End DoDot:1
+8 IF DGMSGDT&($GET(DGMSG)=1)
SET FLDARRAY(DGMSGDT,1)=""
SET FLDARRAY(DGMSGDT,1,"TXT")=1
Begin DoDot:1
+9 SET FLDARRAY(DGMSGDT,1,"TXT",1)="My HealtheVet Secure Messaging "_$SELECT(DGMSG=1:"confirmed.",1:"")
End DoDot:1
+10 QUIT
CONSTAT(DFN,DGFLDNO) ; Write condensed patient MHV status
+1 NEW DGEN,DGAUTH,DGMSG,DGMHVFLD
+2 NEW DGENDT,DGAUTHDT,DGMSGDT
+3 NEW DIQ,DIC,DA,DR,DGDTPC,DGTIMPC
+4 SET DGEN=$$GETEN(DFN)
+5 SET DGAUTH=$$GETAUTH(DFN)
+6 SET DGMSG=$$GETMSG(DFN)
+7 NEW DGDASH
SET $PIECE(DGDASH,"-",78)="-"
+8 ;,?40,"Status" D
IF $GET(DGFLDNO(1))!$GET(DGFLDNO(2))!$GET(DGFLDNO(3))
WRITE !?10,"MHV Registration Progress"
+9 WRITE !,DGDASH
+10 IF $GET(DGFLDNO(1))
WRITE !,$$ENDATE(DFN),?10,"[Step 1 of 3] My HealtheVet Registration: ",?56,$SELECT(DGEN=1:"COMPLETED",DGEN=2:"ACTION PENDING",DGEN=0:"REFUSED",1:"UNANSWERED")
+11 IF $GET(DGFLDNO(2))
WRITE !,$$AUTHDATE(DFN),?10,"[Step 2 of 3] Authentication Upgrade:",?56,$SELECT(DGAUTH=1:"COMPLETED: ",DGAUTH=2:"ACTION PENDING",DGAUTH=0:"REFUSED",1:"UNANSWERED")
+12 IF $GET(DGFLDNO(3))
WRITE !,$$MSGDATE(DFN),?10,"[Step 3 of 3] Secure Messaging Verification:",?56,$SELECT(DGMSG=1:" COMPLETED: "_$$MSGDATE(DFN),DGMSG=2:"ACTION PENDING",DGMSG=0:"REFUSED:",1:"UNANSWERED")
+13 QUIT
ENDATE(DFN,INTERNAL) ; Most recent date mhv Registration was updated
+1 NEW DGENDT,DGDTPC,DGTIMPC,DIQ,DIC,DA,DR,DGDTPC,DGTIMPC,MHVFLD
+2 SET DIQ(0)="I"
SET DIC=2
SET DA=DFN
SET DR="537030"
DO GETS^DIQ(DIC,DFN,DR,"I","MHVFLD")
+3 SET DGENDT=$GET(MHVFLD(2,DFN_",",537030,"I"))
IF $GET(INTERNAL)
QUIT DGENDT
+4 IF DGENDT
SET DGENDT=$$FMTE^XLFDT(DGENDT,2)
+5 SET $PIECE(DGENDT,"@",2)=$PIECE($PIECE(DGENDT,"@",2),":",1,2)
+6 SET DGENDT=$PIECE(DGENDT,"@")
+7 QUIT DGENDT
AUTHDATE(DFN,INTERNAL) ; Most recent date mhv authentication was updated
+1 NEW DGAUTHDT,DGDTPC,DGTIMPC,DIQ,DIC,DA,DR,DGDTPC,DGTIMPC,MHVFLD
+2 SET DIQ(0)="I"
SET DIC=2
SET DA=DFN
SET DR="537031"
DO GETS^DIQ(DIC,DFN,DR,"I","MHVFLD")
+3 SET DGAUTHDT=$GET(MHVFLD(2,DFN_",",537031,"I"))
IF $GET(INTERNAL)
QUIT DGAUTHDT
+4 IF DGAUTHDT
SET DGAUTHDT=$$FMTE^XLFDT(DGAUTHDT,2)
+5 SET $PIECE(DGAUTHDT,"@",2)=$PIECE($PIECE(DGAUTHDT,"@",2),":",1,2)
+6 SET DGAUTHDT=$PIECE(DGAUTHDT,"@")
+7 QUIT DGAUTHDT
MSGDATE(DFN,INTERNAL) ; Most recent date mhv secure messaging was updated
+1 NEW DGMSGDT,DGDTPC,DGTIMPC,DIQ,DIC,DA,DR,DGDTPC,DGTIMPC,MHVFLD
+2 SET DIQ(0)="I"
SET DIC=2
SET DA=DFN
SET DR="537032"
DO GETS^DIQ(DIC,DFN,DR,"I","MHVFLD")
+3 SET DGMSGDT=$GET(MHVFLD(2,DFN_",",537032,"I"))
IF $GET(INTERNAL)
QUIT DGMSGDT
+4 IF DGMSGDT
SET DGMSGDT=$$FMTE^XLFDT(DGMSGDT,2)
+5 SET $PIECE(DGMSGDT,"@",2)=$PIECE($PIECE(DGMSGDT,"@",2),":",1,2)
+6 SET DGMSGDT=$PIECE(DGMSGDT,"@")
+7 QUIT DGMSGDT
MHVENABL() ; Get value of "Enable MyHealtheVet Prompts?" from MAS Parameter (#43) file
+1 ; This API is checked to determine if the MyHealtheVet functionality is enable or not.
+2 NEW DIQ,DIC,DA,DR,MHVFLDS
+3 SET DIQ(0)="I"
SET DIC=43
SET DA=1
SET DR="1100.07"
DO GETS^DIQ(DIC,DA,DR,"I","MHVFLDS")
+4 QUIT +$GET(MHVFLDS(43,DA_",",1100.07,"I"))