DGPFCNR ;ALB/SCK - PRF CAT II TO CAT I REPORTING;27 JAN 2012
;;5.3;Registration;**849**;Aug 13, 1993;Build 28
;
; No direct entry
Q
;
EN(DGRSLT,DGXTMP) ; Main entry point
N DGLINE,DGSPACE,DGDBL
;
D SETUP
D BLDSUM(.DGRSLT,DGXTMP)
D BLDPROC(DGXTMP)
W !!?3,">> Results have been sent to the 'DGPF CLINICAL HR FLAG' mail group"
;
Q
;
SETUP ; Setup formatting variables for reports
;
I $G(DGXTMP)']"" S DGXTMP="^TMP(""DGPFL2N"",$J)"
S $P(DGLINE,"-",78)=""
S $P(DGSPACE," ",78)=""
S $P(DGDBL,"=",78)=""
Q
;
BLDPROC(DGXTMP) ; Build report of processed cat II to Cat I entries
N DGMSG,DGFOUND,DGCNT,DGNAME,DFN,DGPFASG,DGPFASGH,DGTEXT,DGPRE,DGSUBJ
;
K DGMSG
S DGMSG(10)=$S($G(DGRUN)="R":"Pre-scan results ",1:"Processing results ")_"from Local to National flag processing job"
S DGMSG(12)="Run date: "_$$FMTE^XLFDT($$NOW^XLFDT)
S DGMSG(14)="Started by: "_$$GET1^DIQ(200,DUZ,.01)
S DGMSG(17)=""
;
K DGFOUND
S DGMSG(19)="List of patients that "_$S($G(DGRUN)="R":"will have a",1:"had a")_" Cat 1 flag created"
S DGMSG(21)="Name"_$E(DGSPACE,1,32)_"Owning Site"
S DGMSG(25)=DGLINE
;S DGMSG(27)=""
;
S DGNAME="",DGCNT=30
F S DGNAME=$O(@DGXTMP@("COMPLETE",DGNAME)) Q:DGNAME']"" D
. S DFN=$P($G(@DGXTMP@("COMPLETE",DGNAME)),U,1)
. S DGPFASG=$P($G(@DGXTMP@("COMPLETE",DGNAME)),U,2)
. S DGPFASGH=$P($G(@DGXTMP@("COMPLETE",DGNAME)),U,3)
. S DGTEXT=DGNAME_" ("_$$LAST4(DFN)_")"
. S DGTAB=36-$L(DGTEXT)
. S DGMSG(DGCNT)=DGTEXT_$E(DGSPACE,1,DGTAB)_$$GET1^DIQ(26.13,DGPFASG,.04)
. ;_" "_DGPFASG_"^"_DGPFASGH
. S DGCNT=DGCNT+1,DGFOUND=1
;
I '$G(DGFOUND) D
. S DGNAME="",DGCNT=30
. F S DGNAME=$O(@DGXTMP@("PREPROC",DGNAME)) Q:DGNAME']"" D
.. N DGPFX
.. S DFN=$P($G(@DGXTMP@("PREPROC",DGNAME)),U,1)
.. S DGPFX=$P($G(@DGXTMP@("PREPROC",DGNAME)),U,2)
.. S DGTEXT=DGNAME_" ("_$$LAST4(DFN)_")"
.. S DGTAB=36-$L(DGTEXT)
.. S DGMSG(DGCNT)=DGTEXT_$E(DGSPACE,1,DGTAB)_$$GET1^DIQ(26.13,DGPFX,.04)
.. S DGCNT=DGCNT+1,DGFOUND=1,DGPRE=1
;
I '$G(DGFOUND) D
. S DGMSG(DGCNT)="No Cat II records to process were found",DGMSG(DGCNT+1)="",DGCNT=DGCNT+5
;
S DGSUBJ=$S($G(DGRUN)="R":"Pre-report ",$G(DGRUN)="P":"Processed ",1:"")_"National Flag Create "
D SENDMSG(.DGMSG,DGSUBJ)
Q
;
BLDSUM(DGRSLT,DGXTMP) ; Build summary report of cat II to cat I processing
N DGMSG,DGNAME,VA,DFN,DFN1,DGIEN,DGTAB,DGTEXT,DGSUBJ
;
TOP ;
S DGMSG(10)=$S($G(DGRUN)="R":"Pre-scan summary ",1:"Processing summary ")_"from Local to National flag processing job"
S DGMSG(12)="Run date: "_$$FMTE^XLFDT($$NOW^XLFDT)
S DGMSG(14)="Started by: "_$$GET1^DIQ(200,DUZ,.01)
S DGMSG(16)=DGLINE
S DGMSG(16.5)=""
S DGMSG(18)="Summary of PRF Processing:"
S DGMSG(22)=" Total active Cat II flag assignments: "_+$G(DGRSLT("TOTAL"))
S DGMSG(24)=" Cat I flags created: "_+$G(DGRSLT("NEW"))
S DGMSG(26)=" Potential errors Found: "_+$G(DGRSLT("ERR"))
S DGMSG(28)=" Cat II flags requiring manual action: "_+$G(DGRSLT("MANUAL"))
S DGMSG(30)=" Found active Cat I and Cat II flags: "_+$G(DGRSLT("DONE"))
S DGMSG(32)=" "
S DGMSG(34)=DGDBL
S DGMSG(38)=" "
S DGMSG(40)="Processing Results: "
S DGMSG(41)=" "
PRT1 ;
S DGNAME="",DGCNT=100
S DGMSG(DGCNT)="Invalid DFN's or Patient File errors"
S DGMSG(DGCNT+1)=DGLINE
S DGMSG(DGCNT+2)=""
S DGCNT=DGCNT+5
;
S DFN=0
F S DFN=$O(@DGXTMP@("DFN ERROR",DFN)) Q:'DFN D
. S DGMSG(DGCNT)=@DGXTMP@("DFN ERROR",DFN)
. S DGCNT=DGCNT+1,DGFOUND=1
I '$G(DGFOUND) S DGMSG(DGCNT)="No DFN errors were found",DGMSG(DGCNT+1)="",DGCNT=DGCNT+5
;
PRT2 ;
S DGMSG(DGCNT+3)="Patients with Local ICN (National ICN Required)"
S DGMSG(DGCNT+4)="Name"_$E(DGSPACE,1,32)_"Local ICN"
S DGMSG(DGCNT+5)=DGLINE
S DGMSG(DGCNT+6)=""
;
S DGNAME="",DGCNT=DGCNT+6
F S DGNAME=$O(@DGXTMP@("MPI ERROR",DGNAME)) Q:DGNAME']"" D
. S DFN1=$P($G(@DGXTMP@("MPI ERROR",DGNAME)),U,2)
. S DGNAME=DGNAME_" ("_$$LAST4(DFN1)_")"
. S DGTAB=36-$L(DGNAME)
. S DGMSG(DGCNT)=DGNAME_$E(DGSPACE,1,DGTAB)_$$GETICN^MPIF001(DFN1)
. S DGCNT=DGCNT+1
PRT3 ;
K DGFOUND
S DGMSG(DGCNT+1)=""
S DGMSG(DGCNT+3)="National Flag assigned and Local still active"
S DGMSG(DGCNT+4)="Name"_$E(DGSPACE,1,30)_"CMOR"_$E(DGSPACE,1,20)_"Owning Site"
S DGMSG(DGCNT+5)=DGLINE
S DGMSG(DGCNT+6)=""
;
S DGNAME="",DGCNT=DGCNT+6
F S DGNAME=$O(@DGXTMP@("FLGASGN",DGNAME)) Q:DGNAME']"" D
. S DFN1=$P($G(@DGXTMP@("FLGASGN",DGNAME)),U,2)
. S DGCMOR=$$HL7CMOR^MPIF001(DFN1,"^")
. S DGTEXT=DGNAME_" ("_$$LAST4(DFN1)_")"
. S DGTAB=34-$L(DGTEXT)
. S DGMSG(DGCNT)=DGTEXT_$E(DGSPACE,1,DGTAB)_$P(DGCMOR,U,2)
. S DGTAB=58-$L(DGMSG(DGCNT))
. S DGIEN=$P(@DGXTMP@("FLGASGN",DGNAME),U,3)
. S DGMSG(DGCNT)=DGMSG(DGCNT)_$E(DGSPACE,1,DGTAB)_$$GET1^DIQ(26.13,DGIEN,.04)
. ;S DGMSG(DGCNT+1)=" >"_$P(@DGXTMP@("FLGASGN",DGNAME),U)
. S DGCNT=DGCNT+2,DGFOUND=1
I '$G(DGFOUND) S DGMSG(DGCNT)="No Multiple PRF assignments were found",DGMSG(DGCNT+1)="",DGCNT=DGCNT+5
PRT4 ;
K DGFOUND
S DGMSG(DGCNT+1)=""
S DGMSG(DGCNT+3)="Patients flagged for manual processing"
S DGMSG(DGCNT+4)="Name"_$E(DGSPACE,1,32)_"CMOR"_$E(DGSPACE,1,12)_"Description"
S DGMSG(DGCNT+5)=DGLINE
S DGMSG(DGCNT+6)=""
;
S DGNAME="",DGCNT=DGCNT+6
F S DGNAME=$O(@DGXTMP@("MANUAL",DGNAME)) Q:DGNAME']"" D
. S DFN1=$P($G(@DGXTMP@("MANUAL",DGNAME)),U,2)
. S DGTEXT=DGNAME_" ("_$$LAST4(DFN1)_")"
. S DGTAB=36-$L(DGTEXT)
. S DGMSG(DGCNT)=DGTEXT_$E(DGSPACE,1,DGTAB)_$E($P($$HL7CMOR^MPIF001(DFN1,"^"),U,2),1,16)
. S DGMSG(DGCNT)=DGMSG(DGCNT)_" "_$P(@DGXTMP@("MANUAL",DGNAME),U,1)
. S DGCNT=DGCNT+1,DGFOUND=1
I '$G(DGFOUND) S DGMSG(DGCNT)="No records needing manual intervention found",DGMSG(DGCNT+1)="",DGCNT=DGCNT+5
PRT5 ;
K DGFOUND
S DGMSG(DGCNT+1)=""
S DGMSG(DGCNT+3)="Other Errors which may have prevented conversion"
S DGMSG(DGCNT+4)="Name"_$E(DGSPACE,1,32)_"Description"
S DGMSG(DGCNT+5)=DGLINE
S DGMSG(DGCNT+6)=""
;
S DGNAME="",DGCNT=DGCNT+6
F S DGNAME=$O(@DGXTMP@("ERROR",DGNAME)) Q:DGNAME']"" D
. S DFN1=$P($G(@DGXTMP@("ERROR",DGNAME)),U,2)
. S DGTEXT=DGNAME_" ("_$$LAST4(DFN1)_")"
. S DGTAB=36-$L(DGTEXT)
. S DGMSG(DGCNT)=DGTEXT_$E(DGSPACE,1,DGTAB)_$P(@DGXTMP@("ERROR",DGNAME),U,1)
. S DGCNT=DGCNT+1,DGFOUND=1
I '$G(DGFOUND) S DGMSG(DGCNT)="No other errors found",DGMSG(DGCNT+1)="",DGCNT=DGCNT+5
FIN ;
S DGSUBJ=$S($G(DGRUN)="R":"Pre-report ",$G(DGRUN)="P":"Processed ",1:"")_"National Flag Create "
D SENDMSG(.DGMSG,DGSUBJ)
Q
;
LAST4(DFN) ; Get the SSN last four
N VA
;
D PID^VADPT6
Q VA("BID")
;
SENDMSG(DGBODY,DGSUBJ) ; Send report to mail group
N XMTO,XMSUBJ,XMBODY,XMDUZ,XMINSTR
;
S XMSUBJ=$S($G(DGSUBJ)]"":DGSUBJ,1:"National Flag Create ")
S XMTO("G.DGPF CLINICAL HR FLAG REVIEW")=""
S XMSUBJ=XMSUBJ_$$FMTE^XLFDT($$NOW^XLFDT(),"2M")
S XMBODY="DGBODY"
S XMDUZ=DUZ
S XMINSTR("FLAGS")="P"
S XMINSTR("FROM")="HRMH PRF GENERATE JOB"
D SENDMSG^XMXAPI(XMDUZ,XMSUBJ,XMBODY,.XMTO,.XMINSTR)
Q
;
SNDERR(DGERR,DGPFIEN,DGASGN) ; Send error message notification
N XMTO,XMSUBJ,XMBODY,XMDUZ,DGMSG
;
S DGMSG(10)="The following error/issue occurred during"
S DGMSG(12)="the Local to National PRF processing:"
S DGMSG(14)=""
S DGMSG(16)=" "_$P(DGERR,U,2)
S DGMSG(18)=""
S DGMSG(20)=" Patient: "_$P(DGASGN("DFN"),U,2)
S DGMSG(22)=" PRF Assignment Entry: "_DGPFIEN
;
S XMTO("G.DGPF CLINICAL HR FLAG REVIEW")=""
S XMSUBJ="PRF L2N Processing Issue"_$$FMTE^XLFDT($$NOW^XLFDT(),"2M")
S XMBODY="DGMSG"
S XMDUZ=DUZ
D SENDMSG^XMXAPI(XMDUZ,XMSUBJ,XMBODY,.XMTO)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGPFCNR 7597 printed Dec 13, 2024@02:47:31 Page 2
DGPFCNR ;ALB/SCK - PRF CAT II TO CAT I REPORTING;27 JAN 2012
+1 ;;5.3;Registration;**849**;Aug 13, 1993;Build 28
+2 ;
+3 ; No direct entry
+4 QUIT
+5 ;
EN(DGRSLT,DGXTMP) ; Main entry point
+1 NEW DGLINE,DGSPACE,DGDBL
+2 ;
+3 DO SETUP
+4 DO BLDSUM(.DGRSLT,DGXTMP)
+5 DO BLDPROC(DGXTMP)
+6 WRITE !!?3,">> Results have been sent to the 'DGPF CLINICAL HR FLAG' mail group"
+7 ;
+8 QUIT
+9 ;
SETUP ; Setup formatting variables for reports
+1 ;
+2 IF $GET(DGXTMP)']""
SET DGXTMP="^TMP(""DGPFL2N"",$J)"
+3 SET $PIECE(DGLINE,"-",78)=""
+4 SET $PIECE(DGSPACE," ",78)=""
+5 SET $PIECE(DGDBL,"=",78)=""
+6 QUIT
+7 ;
BLDPROC(DGXTMP) ; Build report of processed cat II to Cat I entries
+1 NEW DGMSG,DGFOUND,DGCNT,DGNAME,DFN,DGPFASG,DGPFASGH,DGTEXT,DGPRE,DGSUBJ
+2 ;
+3 KILL DGMSG
+4 SET DGMSG(10)=$SELECT($GET(DGRUN)="R":"Pre-scan results ",1:"Processing results ")_"from Local to National flag processing job"
+5 SET DGMSG(12)="Run date: "_$$FMTE^XLFDT($$NOW^XLFDT)
+6 SET DGMSG(14)="Started by: "_$$GET1^DIQ(200,DUZ,.01)
+7 SET DGMSG(17)=""
+8 ;
+9 KILL DGFOUND
+10 SET DGMSG(19)="List of patients that "_$SELECT($GET(DGRUN)="R":"will have a",1:"had a")_" Cat 1 flag created"
+11 SET DGMSG(21)="Name"_$EXTRACT(DGSPACE,1,32)_"Owning Site"
+12 SET DGMSG(25)=DGLINE
+13 ;S DGMSG(27)=""
+14 ;
+15 SET DGNAME=""
SET DGCNT=30
+16 FOR
SET DGNAME=$ORDER(@DGXTMP@("COMPLETE",DGNAME))
if DGNAME']""
QUIT
Begin DoDot:1
+17 SET DFN=$PIECE($GET(@DGXTMP@("COMPLETE",DGNAME)),U,1)
+18 SET DGPFASG=$PIECE($GET(@DGXTMP@("COMPLETE",DGNAME)),U,2)
+19 SET DGPFASGH=$PIECE($GET(@DGXTMP@("COMPLETE",DGNAME)),U,3)
+20 SET DGTEXT=DGNAME_" ("_$$LAST4(DFN)_")"
+21 SET DGTAB=36-$LENGTH(DGTEXT)
+22 SET DGMSG(DGCNT)=DGTEXT_$EXTRACT(DGSPACE,1,DGTAB)_$$GET1^DIQ(26.13,DGPFASG,.04)
+23 ;_" "_DGPFASG_"^"_DGPFASGH
+24 SET DGCNT=DGCNT+1
SET DGFOUND=1
End DoDot:1
+25 ;
+26 IF '$GET(DGFOUND)
Begin DoDot:1
+27 SET DGNAME=""
SET DGCNT=30
+28 FOR
SET DGNAME=$ORDER(@DGXTMP@("PREPROC",DGNAME))
if DGNAME']""
QUIT
Begin DoDot:2
+29 NEW DGPFX
+30 SET DFN=$PIECE($GET(@DGXTMP@("PREPROC",DGNAME)),U,1)
+31 SET DGPFX=$PIECE($GET(@DGXTMP@("PREPROC",DGNAME)),U,2)
+32 SET DGTEXT=DGNAME_" ("_$$LAST4(DFN)_")"
+33 SET DGTAB=36-$LENGTH(DGTEXT)
+34 SET DGMSG(DGCNT)=DGTEXT_$EXTRACT(DGSPACE,1,DGTAB)_$$GET1^DIQ(26.13,DGPFX,.04)
+35 SET DGCNT=DGCNT+1
SET DGFOUND=1
SET DGPRE=1
End DoDot:2
End DoDot:1
+36 ;
+37 IF '$GET(DGFOUND)
Begin DoDot:1
+38 SET DGMSG(DGCNT)="No Cat II records to process were found"
SET DGMSG(DGCNT+1)=""
SET DGCNT=DGCNT+5
End DoDot:1
+39 ;
+40 SET DGSUBJ=$SELECT($GET(DGRUN)="R":"Pre-report ",$GET(DGRUN)="P":"Processed ",1:"")_"National Flag Create "
+41 DO SENDMSG(.DGMSG,DGSUBJ)
+42 QUIT
+43 ;
BLDSUM(DGRSLT,DGXTMP) ; Build summary report of cat II to cat I processing
+1 NEW DGMSG,DGNAME,VA,DFN,DFN1,DGIEN,DGTAB,DGTEXT,DGSUBJ
+2 ;
TOP ;
+1 SET DGMSG(10)=$SELECT($GET(DGRUN)="R":"Pre-scan summary ",1:"Processing summary ")_"from Local to National flag processing job"
+2 SET DGMSG(12)="Run date: "_$$FMTE^XLFDT($$NOW^XLFDT)
+3 SET DGMSG(14)="Started by: "_$$GET1^DIQ(200,DUZ,.01)
+4 SET DGMSG(16)=DGLINE
+5 SET DGMSG(16.5)=""
+6 SET DGMSG(18)="Summary of PRF Processing:"
+7 SET DGMSG(22)=" Total active Cat II flag assignments: "_+$GET(DGRSLT("TOTAL"))
+8 SET DGMSG(24)=" Cat I flags created: "_+$GET(DGRSLT("NEW"))
+9 SET DGMSG(26)=" Potential errors Found: "_+$GET(DGRSLT("ERR"))
+10 SET DGMSG(28)=" Cat II flags requiring manual action: "_+$GET(DGRSLT("MANUAL"))
+11 SET DGMSG(30)=" Found active Cat I and Cat II flags: "_+$GET(DGRSLT("DONE"))
+12 SET DGMSG(32)=" "
+13 SET DGMSG(34)=DGDBL
+14 SET DGMSG(38)=" "
+15 SET DGMSG(40)="Processing Results: "
+16 SET DGMSG(41)=" "
PRT1 ;
+1 SET DGNAME=""
SET DGCNT=100
+2 SET DGMSG(DGCNT)="Invalid DFN's or Patient File errors"
+3 SET DGMSG(DGCNT+1)=DGLINE
+4 SET DGMSG(DGCNT+2)=""
+5 SET DGCNT=DGCNT+5
+6 ;
+7 SET DFN=0
+8 FOR
SET DFN=$ORDER(@DGXTMP@("DFN ERROR",DFN))
if 'DFN
QUIT
Begin DoDot:1
+9 SET DGMSG(DGCNT)=@DGXTMP@("DFN ERROR",DFN)
+10 SET DGCNT=DGCNT+1
SET DGFOUND=1
End DoDot:1
+11 IF '$GET(DGFOUND)
SET DGMSG(DGCNT)="No DFN errors were found"
SET DGMSG(DGCNT+1)=""
SET DGCNT=DGCNT+5
+12 ;
PRT2 ;
+1 SET DGMSG(DGCNT+3)="Patients with Local ICN (National ICN Required)"
+2 SET DGMSG(DGCNT+4)="Name"_$EXTRACT(DGSPACE,1,32)_"Local ICN"
+3 SET DGMSG(DGCNT+5)=DGLINE
+4 SET DGMSG(DGCNT+6)=""
+5 ;
+6 SET DGNAME=""
SET DGCNT=DGCNT+6
+7 FOR
SET DGNAME=$ORDER(@DGXTMP@("MPI ERROR",DGNAME))
if DGNAME']""
QUIT
Begin DoDot:1
+8 SET DFN1=$PIECE($GET(@DGXTMP@("MPI ERROR",DGNAME)),U,2)
+9 SET DGNAME=DGNAME_" ("_$$LAST4(DFN1)_")"
+10 SET DGTAB=36-$LENGTH(DGNAME)
+11 SET DGMSG(DGCNT)=DGNAME_$EXTRACT(DGSPACE,1,DGTAB)_$$GETICN^MPIF001(DFN1)
+12 SET DGCNT=DGCNT+1
End DoDot:1
PRT3 ;
+1 KILL DGFOUND
+2 SET DGMSG(DGCNT+1)=""
+3 SET DGMSG(DGCNT+3)="National Flag assigned and Local still active"
+4 SET DGMSG(DGCNT+4)="Name"_$EXTRACT(DGSPACE,1,30)_"CMOR"_$EXTRACT(DGSPACE,1,20)_"Owning Site"
+5 SET DGMSG(DGCNT+5)=DGLINE
+6 SET DGMSG(DGCNT+6)=""
+7 ;
+8 SET DGNAME=""
SET DGCNT=DGCNT+6
+9 FOR
SET DGNAME=$ORDER(@DGXTMP@("FLGASGN",DGNAME))
if DGNAME']""
QUIT
Begin DoDot:1
+10 SET DFN1=$PIECE($GET(@DGXTMP@("FLGASGN",DGNAME)),U,2)
+11 SET DGCMOR=$$HL7CMOR^MPIF001(DFN1,"^")
+12 SET DGTEXT=DGNAME_" ("_$$LAST4(DFN1)_")"
+13 SET DGTAB=34-$LENGTH(DGTEXT)
+14 SET DGMSG(DGCNT)=DGTEXT_$EXTRACT(DGSPACE,1,DGTAB)_$PIECE(DGCMOR,U,2)
+15 SET DGTAB=58-$LENGTH(DGMSG(DGCNT))
+16 SET DGIEN=$PIECE(@DGXTMP@("FLGASGN",DGNAME),U,3)
+17 SET DGMSG(DGCNT)=DGMSG(DGCNT)_$EXTRACT(DGSPACE,1,DGTAB)_$$GET1^DIQ(26.13,DGIEN,.04)
+18 ;S DGMSG(DGCNT+1)=" >"_$P(@DGXTMP@("FLGASGN",DGNAME),U)
+19 SET DGCNT=DGCNT+2
SET DGFOUND=1
End DoDot:1
+20 IF '$GET(DGFOUND)
SET DGMSG(DGCNT)="No Multiple PRF assignments were found"
SET DGMSG(DGCNT+1)=""
SET DGCNT=DGCNT+5
PRT4 ;
+1 KILL DGFOUND
+2 SET DGMSG(DGCNT+1)=""
+3 SET DGMSG(DGCNT+3)="Patients flagged for manual processing"
+4 SET DGMSG(DGCNT+4)="Name"_$EXTRACT(DGSPACE,1,32)_"CMOR"_$EXTRACT(DGSPACE,1,12)_"Description"
+5 SET DGMSG(DGCNT+5)=DGLINE
+6 SET DGMSG(DGCNT+6)=""
+7 ;
+8 SET DGNAME=""
SET DGCNT=DGCNT+6
+9 FOR
SET DGNAME=$ORDER(@DGXTMP@("MANUAL",DGNAME))
if DGNAME']""
QUIT
Begin DoDot:1
+10 SET DFN1=$PIECE($GET(@DGXTMP@("MANUAL",DGNAME)),U,2)
+11 SET DGTEXT=DGNAME_" ("_$$LAST4(DFN1)_")"
+12 SET DGTAB=36-$LENGTH(DGTEXT)
+13 SET DGMSG(DGCNT)=DGTEXT_$EXTRACT(DGSPACE,1,DGTAB)_$EXTRACT($PIECE($$HL7CMOR^MPIF001(DFN1,"^"),U,2),1,16)
+14 SET DGMSG(DGCNT)=DGMSG(DGCNT)_" "_$PIECE(@DGXTMP@("MANUAL",DGNAME),U,1)
+15 SET DGCNT=DGCNT+1
SET DGFOUND=1
End DoDot:1
+16 IF '$GET(DGFOUND)
SET DGMSG(DGCNT)="No records needing manual intervention found"
SET DGMSG(DGCNT+1)=""
SET DGCNT=DGCNT+5
PRT5 ;
+1 KILL DGFOUND
+2 SET DGMSG(DGCNT+1)=""
+3 SET DGMSG(DGCNT+3)="Other Errors which may have prevented conversion"
+4 SET DGMSG(DGCNT+4)="Name"_$EXTRACT(DGSPACE,1,32)_"Description"
+5 SET DGMSG(DGCNT+5)=DGLINE
+6 SET DGMSG(DGCNT+6)=""
+7 ;
+8 SET DGNAME=""
SET DGCNT=DGCNT+6
+9 FOR
SET DGNAME=$ORDER(@DGXTMP@("ERROR",DGNAME))
if DGNAME']""
QUIT
Begin DoDot:1
+10 SET DFN1=$PIECE($GET(@DGXTMP@("ERROR",DGNAME)),U,2)
+11 SET DGTEXT=DGNAME_" ("_$$LAST4(DFN1)_")"
+12 SET DGTAB=36-$LENGTH(DGTEXT)
+13 SET DGMSG(DGCNT)=DGTEXT_$EXTRACT(DGSPACE,1,DGTAB)_$PIECE(@DGXTMP@("ERROR",DGNAME),U,1)
+14 SET DGCNT=DGCNT+1
SET DGFOUND=1
End DoDot:1
+15 IF '$GET(DGFOUND)
SET DGMSG(DGCNT)="No other errors found"
SET DGMSG(DGCNT+1)=""
SET DGCNT=DGCNT+5
FIN ;
+1 SET DGSUBJ=$SELECT($GET(DGRUN)="R":"Pre-report ",$GET(DGRUN)="P":"Processed ",1:"")_"National Flag Create "
+2 DO SENDMSG(.DGMSG,DGSUBJ)
+3 QUIT
+4 ;
LAST4(DFN) ; Get the SSN last four
+1 NEW VA
+2 ;
+3 DO PID^VADPT6
+4 QUIT VA("BID")
+5 ;
SENDMSG(DGBODY,DGSUBJ) ; Send report to mail group
+1 NEW XMTO,XMSUBJ,XMBODY,XMDUZ,XMINSTR
+2 ;
+3 SET XMSUBJ=$SELECT($GET(DGSUBJ)]"":DGSUBJ,1:"National Flag Create ")
+4 SET XMTO("G.DGPF CLINICAL HR FLAG REVIEW")=""
+5 SET XMSUBJ=XMSUBJ_$$FMTE^XLFDT($$NOW^XLFDT(),"2M")
+6 SET XMBODY="DGBODY"
+7 SET XMDUZ=DUZ
+8 SET XMINSTR("FLAGS")="P"
+9 SET XMINSTR("FROM")="HRMH PRF GENERATE JOB"
+10 DO SENDMSG^XMXAPI(XMDUZ,XMSUBJ,XMBODY,.XMTO,.XMINSTR)
+11 QUIT
+12 ;
SNDERR(DGERR,DGPFIEN,DGASGN) ; Send error message notification
+1 NEW XMTO,XMSUBJ,XMBODY,XMDUZ,DGMSG
+2 ;
+3 SET DGMSG(10)="The following error/issue occurred during"
+4 SET DGMSG(12)="the Local to National PRF processing:"
+5 SET DGMSG(14)=""
+6 SET DGMSG(16)=" "_$PIECE(DGERR,U,2)
+7 SET DGMSG(18)=""
+8 SET DGMSG(20)=" Patient: "_$PIECE(DGASGN("DFN"),U,2)
+9 SET DGMSG(22)=" PRF Assignment Entry: "_DGPFIEN
+10 ;
+11 SET XMTO("G.DGPF CLINICAL HR FLAG REVIEW")=""
+12 SET XMSUBJ="PRF L2N Processing Issue"_$$FMTE^XLFDT($$NOW^XLFDT(),"2M")
+13 SET XMBODY="DGMSG"
+14 SET XMDUZ=DUZ
+15 DO SENDMSG^XMXAPI(XMDUZ,XMSUBJ,XMBODY,.XMTO)
+16 QUIT