PXCOMPACT1 ;ALB/BPA,CMC - Routine for COMPACT Act APIs;05/06/2024@12:01
;;1.0;PCE PATIENT CARE ENCOUNTER;**240**;Aug 12, 1996;Build 55
; *240* APIs for Episode of Care APIs (^PXCOMP(818))
;
Q
;
FILEMANERR(DFN,DATA,MSG) ;
N COUNT,ERR,FROM,NODE,NOW,PXEOCNUM,PXIEN,PXFIELD,PXFILE,PXVAL,SEQ,SUBJECT,TO,TXTCOUNT,TYP
S (ERR,FROM,NODE,NOW,PXEOCNUM,PXIEN,PXFIELD,PXFILE,PXVAL,SUBJECT,TO,TYP)="",(SEQ,TXTCOUNT)=0,COUNT=8
S NODE="PXCOMPERR",NOW=$$HTFM^XLFDT($H)
S SUBJECT="COMPACT ACT Issue filing Episode of Care entry"
S FROM="COMPACT Act new episode of care processing"
S TO("G.COMPACT ACT COORDINATORS")=""
S TO(DUZ)=""
K ^TMP(NODE,$J)
S ^TMP(NODE,$J,1,0)="This episode of care failed to file for this patient."
S ^TMP(NODE,$J,2,0)="Please enter a Service NOW ticket referencing this error "
S ^TMP(NODE,$J,3,0)="and contact your local COMPACT Act Coordinator"
S ^TMP(NODE,$J,4,0)=""
S ^TMP(NODE,$J,5,0)="Processed by: "_$$NAME^XUSER(DUZ)_" on "_$$FMTE^XLFDT(NOW)
I $G(DFN)'="" D
. S ^TMP(NODE,$J,6,0)="Patient ID: "_DFN
. S PXEOCNUM=$$GETEOC^PXCOMPACT(DFN) I PXEOCNUM="" S PXEOCNUM="(not valid)"
E D
. S ^TMP(NODE,$J,6,0)="Patient ID: Patient ID is null",PXEOCNUM="n/a"
S ^TMP(NODE,$J,7,0)="EoC number: "_PXEOCNUM
F S ERR=$O(MSG(ERR)) Q:ERR="" D
. F S SEQ=$O(MSG(ERR,SEQ)) Q:SEQ="" D
. . F S TYP=$O(MSG(ERR,SEQ,TYP)) Q:TYP="" D
. . . I TYP="TEXT" D
. . . . F S TXTCOUNT=$O(MSG(ERR,SEQ,TYP,TXTCOUNT)) Q:TXTCOUNT="" S ^TMP(NODE,$J,COUNT,0)="Error: "_$G(MSG(ERR,SEQ,TYP,TXTCOUNT)),COUNT=COUNT+1
;
F S PXFILE=$O(DATA(PXFILE)) Q:PXFILE="" D
. F S PXIEN=$O(DATA(PXFILE,PXIEN)) Q:PXIEN="" D
. . F S PXFIELD=$O(DATA(PXFILE,PXIEN,PXFIELD)) Q:PXFIELD="" D
. . . S PXVAL=$G(DATA(PXFILE,PXIEN,PXFIELD)),COUNT=COUNT+1
. . . S ^TMP(NODE,$J,COUNT,0)="Data entered - File: "_PXFILE_" IEN: "_PXIEN_" Field: "_PXFIELD_" Value: "_PXVAL
;
D SEND^PXMSG(NODE,SUBJECT,.TO,FROM)
K ^TMP(NODE,$J)
Q
;
COMPACTERR(PXERRMSG,DFN) ;
N FROM,NODE,NOW,PXEOCNUM,SUBJECT,TO
S PXEOCNUM=""
S NODE="PXCOMPERR",NOW=$$HTFM^XLFDT($H)
S SUBJECT="COMPACT Act Issue filing Episode of Care entry"
S FROM="COMPACT Act new episode of care processing"
S TO("G.COMPACT ACT COORDINATORS")=""
S TO(DUZ)=""
K ^TMP(NODE,$J)
S ^TMP(NODE,$J,1,0)="This episode of care failed to file for this patient."
S ^TMP(NODE,$J,2,0)="Please enter a Service NOW ticket referencing this error "
S ^TMP(NODE,$J,3,0)="and contact your local COMPACT Act Coordinator"
S ^TMP(NODE,$J,4,0)=""
S ^TMP(NODE,$J,5,0)="Processed by: "_$$NAME^XUSER(DUZ)_" on "_$$FMTE^XLFDT(NOW)
I $G(DFN)'="" D
. S ^TMP(NODE,$J,6,0)="Patient ID: "_DFN
. S PXEOCNUM=$$GETEOC^PXCOMPACT(DFN) I PXEOCNUM="" S PXEOCNUM="(not valid)"
E D
. S ^TMP(NODE,$J,6,0)="Patient ID: Patient ID is null",PXEOCNUM="n/a"
S ^TMP(NODE,$J,7,0)="EoC number: "_PXEOCNUM
S ^TMP(NODE,$J,8,0)="Error: "_PXERRMSG
D SEND^PXMSG(NODE,SUBJECT,.TO,FROM)
W !,"A MailMan message has been sent regarding a COMPACT Act error during processing and will need follow up."
W !!,"Error: "_$G(PXERRMSG)
K ^TMP(NODE,$J),FROM,NODE,SUBJECT,TO
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXCOMPACT1 3167 printed Nov 22, 2024@17:38:30 Page 2
PXCOMPACT1 ;ALB/BPA,CMC - Routine for COMPACT Act APIs;05/06/2024@12:01
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**240**;Aug 12, 1996;Build 55
+2 ; *240* APIs for Episode of Care APIs (^PXCOMP(818))
+3 ;
+4 QUIT
+5 ;
FILEMANERR(DFN,DATA,MSG) ;
+1 NEW COUNT,ERR,FROM,NODE,NOW,PXEOCNUM,PXIEN,PXFIELD,PXFILE,PXVAL,SEQ,SUBJECT,TO,TXTCOUNT,TYP
+2 SET (ERR,FROM,NODE,NOW,PXEOCNUM,PXIEN,PXFIELD,PXFILE,PXVAL,SUBJECT,TO,TYP)=""
SET (SEQ,TXTCOUNT)=0
SET COUNT=8
+3 SET NODE="PXCOMPERR"
SET NOW=$$HTFM^XLFDT($HOROLOG)
+4 SET SUBJECT="COMPACT ACT Issue filing Episode of Care entry"
+5 SET FROM="COMPACT Act new episode of care processing"
+6 SET TO("G.COMPACT ACT COORDINATORS")=""
+7 SET TO(DUZ)=""
+8 KILL ^TMP(NODE,$JOB)
+9 SET ^TMP(NODE,$JOB,1,0)="This episode of care failed to file for this patient."
+10 SET ^TMP(NODE,$JOB,2,0)="Please enter a Service NOW ticket referencing this error "
+11 SET ^TMP(NODE,$JOB,3,0)="and contact your local COMPACT Act Coordinator"
+12 SET ^TMP(NODE,$JOB,4,0)=""
+13 SET ^TMP(NODE,$JOB,5,0)="Processed by: "_$$NAME^XUSER(DUZ)_" on "_$$FMTE^XLFDT(NOW)
+14 IF $GET(DFN)'=""
Begin DoDot:1
+15 SET ^TMP(NODE,$JOB,6,0)="Patient ID: "_DFN
+16 SET PXEOCNUM=$$GETEOC^PXCOMPACT(DFN)
IF PXEOCNUM=""
SET PXEOCNUM="(not valid)"
End DoDot:1
+17 IF '$TEST
Begin DoDot:1
+18 SET ^TMP(NODE,$JOB,6,0)="Patient ID: Patient ID is null"
SET PXEOCNUM="n/a"
End DoDot:1
+19 SET ^TMP(NODE,$JOB,7,0)="EoC number: "_PXEOCNUM
+20 FOR
SET ERR=$ORDER(MSG(ERR))
if ERR=""
QUIT
Begin DoDot:1
+21 FOR
SET SEQ=$ORDER(MSG(ERR,SEQ))
if SEQ=""
QUIT
Begin DoDot:2
+22 FOR
SET TYP=$ORDER(MSG(ERR,SEQ,TYP))
if TYP=""
QUIT
Begin DoDot:3
+23 IF TYP="TEXT"
Begin DoDot:4
+24 FOR
SET TXTCOUNT=$ORDER(MSG(ERR,SEQ,TYP,TXTCOUNT))
if TXTCOUNT=""
QUIT
SET ^TMP(NODE,$JOB,COUNT,0)="Error: "_$GET(MSG(ERR,SEQ,TYP,TXTCOUNT))
SET COUNT=COUNT+1
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+25 ;
+26 FOR
SET PXFILE=$ORDER(DATA(PXFILE))
if PXFILE=""
QUIT
Begin DoDot:1
+27 FOR
SET PXIEN=$ORDER(DATA(PXFILE,PXIEN))
if PXIEN=""
QUIT
Begin DoDot:2
+28 FOR
SET PXFIELD=$ORDER(DATA(PXFILE,PXIEN,PXFIELD))
if PXFIELD=""
QUIT
Begin DoDot:3
+29 SET PXVAL=$GET(DATA(PXFILE,PXIEN,PXFIELD))
SET COUNT=COUNT+1
+30 SET ^TMP(NODE,$JOB,COUNT,0)="Data entered - File: "_PXFILE_" IEN: "_PXIEN_" Field: "_PXFIELD_" Value: "_PXVAL
End DoDot:3
End DoDot:2
End DoDot:1
+31 ;
+32 DO SEND^PXMSG(NODE,SUBJECT,.TO,FROM)
+33 KILL ^TMP(NODE,$JOB)
+34 QUIT
+35 ;
COMPACTERR(PXERRMSG,DFN) ;
+1 NEW FROM,NODE,NOW,PXEOCNUM,SUBJECT,TO
+2 SET PXEOCNUM=""
+3 SET NODE="PXCOMPERR"
SET NOW=$$HTFM^XLFDT($HOROLOG)
+4 SET SUBJECT="COMPACT Act Issue filing Episode of Care entry"
+5 SET FROM="COMPACT Act new episode of care processing"
+6 SET TO("G.COMPACT ACT COORDINATORS")=""
+7 SET TO(DUZ)=""
+8 KILL ^TMP(NODE,$JOB)
+9 SET ^TMP(NODE,$JOB,1,0)="This episode of care failed to file for this patient."
+10 SET ^TMP(NODE,$JOB,2,0)="Please enter a Service NOW ticket referencing this error "
+11 SET ^TMP(NODE,$JOB,3,0)="and contact your local COMPACT Act Coordinator"
+12 SET ^TMP(NODE,$JOB,4,0)=""
+13 SET ^TMP(NODE,$JOB,5,0)="Processed by: "_$$NAME^XUSER(DUZ)_" on "_$$FMTE^XLFDT(NOW)
+14 IF $GET(DFN)'=""
Begin DoDot:1
+15 SET ^TMP(NODE,$JOB,6,0)="Patient ID: "_DFN
+16 SET PXEOCNUM=$$GETEOC^PXCOMPACT(DFN)
IF PXEOCNUM=""
SET PXEOCNUM="(not valid)"
End DoDot:1
+17 IF '$TEST
Begin DoDot:1
+18 SET ^TMP(NODE,$JOB,6,0)="Patient ID: Patient ID is null"
SET PXEOCNUM="n/a"
End DoDot:1
+19 SET ^TMP(NODE,$JOB,7,0)="EoC number: "_PXEOCNUM
+20 SET ^TMP(NODE,$JOB,8,0)="Error: "_PXERRMSG
+21 DO SEND^PXMSG(NODE,SUBJECT,.TO,FROM)
+22 WRITE !,"A MailMan message has been sent regarding a COMPACT Act error during processing and will need follow up."
+23 WRITE !!,"Error: "_$GET(PXERRMSG)
+24 KILL ^TMP(NODE,$JOB),FROM,NODE,SUBJECT,TO
+25 QUIT