SCMCHLR2 ;ALB/KCL - PCMM HL7 Reject Processing - Build List Area; 10-JAN-2000
;;5.3;Scheduling;**210,272,297,458,505,1015**;AUG 13, 1993;Build 21
;
EN(SCARY,SCBEG,SCEND,SCEPS,SCSORTBY,SCCNT) ;
; Description: This entry point is used to build list area for
; PCMM Transmission Errors.
;
; The following variables are 'system wide variables' in the
; PCMM Transmission Error Processing List Manager application:
; Input:
; SCARY - Global array subscript
; SCBEG - Begin date for date range
; SCEND - End date for date range
; SCEPS - Error processing statuses
; 1 -> New
; 2 -> Checked
; 3 -> Both
; SCSORTBY - Sort by criteria
; N -> Patient Name
; D -> Date/Time Ack Received
; P -> Provider
; I -> Institution
;
; Output:
; SCCNT - Contains number of lines in the list, pass by reference
;
;Display FM wait msg
D WAIT^DICD
;
;Get PCMM HL7 Trans Log errors
D GET(SCARY,SCBEG,SCEND,SCEPS,SCSORTBY)
;
;Build list area for PCMM HL7 Trans Log errors
D BLDLIST^SCMCHLR3(SCSORTBY,SCEPS,.SCCNT)
;
;If no PCMM HL7 Trans Log errors, display msg in list area
I 'SCCNT D
.D SET^SCMCHLR3(SCARY,1,"",1,36,0,,,,.SCCNT)
.D SET^SCMCHLR3(SCARY,2,"No 'PCMM Transmission Errors' to display.",4,41,0,,,,.SCCNT)
Q
;
;
GET(SCARY,SCBEG,SCEND,SCEPS,SCSORTBY) ;
; Description: Get PCMM HL7 Transmission Log errors.
;
; Input:
; SCARY - Global array subscript
; SCBEG - Begin date for date range
; SCEND - End date for date range
; SCEPS - Error processing status
; SCSORTBY - Sort by criteria
;
; Output:
; PCMM transmission log error list sorted by:
;
; Patient Name: ^TMP("SCERRSRT",$J,<sort by>,<patient name>,<trans log IEN>,<err code ien>)
; OR,
; Date/Time Ack Rec'd: ^TMP("SCERRSRT",$J,<sort by>,<date/time ack rec'd>,<trans log IEN>,<err code ien>)
; OR,
; Provider: ^TMP("SCERRSRT",$J,<sort by>,<provider>,<trans log IEN>,<err code ien>)
; OR,
; INSTITUTION: ^TMP("SCERRSRT",$J,<sort by>,<institution>,<trans log IEN>,<err code ien>)
; (INSTITUTION SORT INTRO. IN SD*5.3*505)
;
N SCDFN,SCDTR,SCERIEN,SCTLIEN,SCSTAT,SCHLIEN,SCHLIEN1,SCHLIEN2
N SCHLIEN3,SCHLIEN4,SCHLIEN5,SCTP,SCTPOS,SCTPSS
;
;Loop thru PCMM HL7 Trans Log for selected date range
F SCDTR=SCBEG:0 S SCDTR=$O(^SCPT(404.471,"AST",SCDTR)) Q:'SCDTR!($P(SCDTR,".")>SCEND) D
.;loop thru status
.S SCSTAT=0
.F S SCSTAT=$O(^SCPT(404.471,"AST",SCDTR,SCSTAT)) Q:SCSTAT="" D
..;loop thru patients
..S SCDFN=0
..F S SCDFN=$O(^SCPT(404.471,"AST",SCDTR,SCSTAT,SCDFN)) Q:SCDFN="" D
...;loop through (#404.471) ien's
...S SCTLIEN=0
...F S SCTLIEN=$O(^SCPT(404.471,"AST",SCDTR,SCSTAT,SCDFN,SCTLIEN)) Q:'SCTLIEN D
....;loop thru ien's of error code mult. and setup sort array
....S SCERIEN=0
....F S SCERIEN=$O(^SCPT(404.471,SCTLIEN,"ERR",SCERIEN)) Q:'SCERIEN D SORT(SCSORTBY,SCDTR,SCDFN,SCEPS,SCTLIEN,SCERIEN)
;
Q
;
;
SORT(SCSORTBY,SCDTR,SCDFN,SCEPS,SCTLIEN,SCERIEN) ;
; Description: Used to set up sort array based on 'Sort Criteria' and
; 'Error Processing Status' for PCMM Transmission Errors list display.
;
; Input:
; SCSORTBY - Sort by criteria
; SCDTR - PCMM transmission log date/time ack received
; SCDFN - Patient IEN
; SCEPS - Error processing status
; SCTLIEN - PCMM transmission log IEN
; SCERIEN - IEN of record in Error Code (#404.47142) multiple
;
; Output: None
;
N SCTLOG
;
;If sort by criteria is 'Date/Time Ack Received'
I SCSORTBY="D" D
.;get data from PCMM HL7 Trans Log
.I $$GETLOG^SCMCHLA(SCTLIEN,SCERIEN,.SCTLOG) D
..;if Error Proc Status matches selected Error Proc Status
..I (SCEPS=$G(SCTLOG("ERR","EPS"))!(SCEPS>2)) D
...;setup ^tmp array sorted by date/time ack rec'd
...S ^TMP("SCERRSRT",$J,SCSORTBY,SCDTR,SCTLIEN,SCERIEN)=""
;
;If sort by criteria is 'Provider'
I SCSORTBY="P" D
.N SCPTR,SCPROV,SCHL
.;get data from PCMM HL7 Trans Log
.I $$GETLOG^SCMCHLA(SCTLIEN,SCERIEN,.SCTLOG) D
..;if Error Proc Status matches selected Error Proc Status
..I (SCEPS=$G(SCTLOG("ERR","EPS"))!(SCEPS>2)) D
...;get data from PCMM HL7 ID file
...I $$GETHL7ID^SCMCHLA2($G(SCTLOG("ERR","ZPCID")),.SCHL) D
....;get provider from POSITION ASSIGNMENT HISTORY file
....S SCPTR=$P($G(SCHL("HL7ID")),"-",2) ; pointer to PCMM HL7 ID file
....I $G(SCTLOG("WORK")) S SCPROV=$$PROV^SCMCHLP(SCTLOG("WORK"))
....I '$G(SCTLOG("WORK")) S SCPROV=$P($G(^SCTM(404.52,+SCPTR,0)),"^",3)
....;setup ^tmp array sorted by provider
....S ^TMP("SCERRSRT",$J,SCSORTBY,$S($G(SCPROV)'="":$$EXTERNAL^DILFD(404.52,.03,,SCPROV),1:"ZZZUNKNOWN"),SCTLIEN,SCERIEN)=""
;
;If sort by criteria is 'Patient' (default)
I SCSORTBY="N" D
.;get data from PCMM HL7 Trans Log
.I $$GETLOG^SCMCHLA(SCTLIEN,SCERIEN,.SCTLOG) D
..;if Error Proc Status matches selected Error Proc Status
..I (SCEPS=$G(SCTLOG("ERR","EPS"))!(SCEPS>2)) D
...;setup ^tmp array sorted by patient
...I SCDFN="W" I $G(SCTLOG("WORK"))="" S SCDFN=""
...S ^TMP("SCERRSRT",$J,SCSORTBY,$S($P($G(^DPT(+SCDFN,0)),U)'="":$P(^(0),U),SCDFN="W":"Workload Message",1:"UNKNOWN"),SCTLIEN,SCERIEN)=""
;
;If sort by criteria is 'Institution" SD*5.3*505
I SCSORTBY="I" D
.;get data from PCMM HL7 Trans Log
.I $$GETLOG^SCMCHLA(SCTLIEN,SCERIEN,.SCTLOG) D
..I (SCEPS=$G(SCTLOG("ERR","EPS"))!(SCEPS>2)) D
...;setup ^tmp array sorted by institution
...S SCHLIEN=0
...F S SCHLIEN=$O(^SCPT(404.471,SCTLIEN,"ZPC",SCHLIEN)) Q:SCHLIEN="" D
....S SCHLIEN1=$G(^SCPT(404.471,SCTLIEN,"ZPC",SCHLIEN,0)) Q:SCHLIEN<1 D
.....S SCHLIEN2=$P(SCHLIEN1,U,2),SCHLIEN3=+$G(^SCPT(404.49,SCHLIEN2,0))
.....S SCHLIEN4=$G(^SCPT(404.43,SCHLIEN3,0)) Q:SCHLIEN4="" D
......S SCHLIEN5=$G(^SCPT(404.42,+SCHLIEN4,0)) Q:SCHLIEN5="" D
.......S SCTPOS=$P(SCHLIEN4,U,2),SCTPSS=$G(^SCTM(404.57,+SCTPOS,0))
.......S SCTP=$P(SCTPSS,U,2),SCY=$G(^SCTM(404.51,+SCTP,0)),SCINT=$P(SCY,U,7)
.......S SCINNAM=$$GET1^DIQ(4,+SCINT_",",99)
.......S ^TMP("SCERRSRT",$J,SCSORTBY,$S($G(SCINNAM)'="":SCINNAM,1:"UNK"),SCTLIEN,SCERIEN)=""
.......K SCTP,SCTPOS,SCTPSS,SCTP,SCY,SCINNAM,SCINT
Q
SCMCHLR2 ;ALB/KCL - PCMM HL7 Reject Processing - Build List Area; 10-JAN-2000
+1 ;;5.3;Scheduling;**210,272,297,458,505,1015**;AUG 13, 1993;Build 21
+2 ;
EN(SCARY,SCBEG,SCEND,SCEPS,SCSORTBY,SCCNT) ;
+1 ; Description: This entry point is used to build list area for
+2 ; PCMM Transmission Errors.
+3 ;
+4 ; The following variables are 'system wide variables' in the
+5 ; PCMM Transmission Error Processing List Manager application:
+6 ; Input:
+7 ; SCARY - Global array subscript
+8 ; SCBEG - Begin date for date range
+9 ; SCEND - End date for date range
+10 ; SCEPS - Error processing statuses
+11 ; 1 -> New
+12 ; 2 -> Checked
+13 ; 3 -> Both
+14 ; SCSORTBY - Sort by criteria
+15 ; N -> Patient Name
+16 ; D -> Date/Time Ack Received
+17 ; P -> Provider
+18 ; I -> Institution
+19 ;
+20 ; Output:
+21 ; SCCNT - Contains number of lines in the list, pass by reference
+22 ;
+23 ;Display FM wait msg
+24 DO WAIT^DICD
+25 ;
+26 ;Get PCMM HL7 Trans Log errors
+27 DO GET(SCARY,SCBEG,SCEND,SCEPS,SCSORTBY)
+28 ;
+29 ;Build list area for PCMM HL7 Trans Log errors
+30 DO BLDLIST^SCMCHLR3(SCSORTBY,SCEPS,.SCCNT)
+31 ;
+32 ;If no PCMM HL7 Trans Log errors, display msg in list area
+33 IF 'SCCNT
Begin DoDot:1
+34 DO SET^SCMCHLR3(SCARY,1,"",1,36,0,,,,.SCCNT)
+35 DO SET^SCMCHLR3(SCARY,2,"No 'PCMM Transmission Errors' to display.",4,41,0,,,,.SCCNT)
End DoDot:1
+36 QUIT
+37 ;
+38 ;
GET(SCARY,SCBEG,SCEND,SCEPS,SCSORTBY) ;
+1 ; Description: Get PCMM HL7 Transmission Log errors.
+2 ;
+3 ; Input:
+4 ; SCARY - Global array subscript
+5 ; SCBEG - Begin date for date range
+6 ; SCEND - End date for date range
+7 ; SCEPS - Error processing status
+8 ; SCSORTBY - Sort by criteria
+9 ;
+10 ; Output:
+11 ; PCMM transmission log error list sorted by:
+12 ;
+13 ; Patient Name: ^TMP("SCERRSRT",$J,<sort by>,<patient name>,<trans log IEN>,<err code ien>)
+14 ; OR,
+15 ; Date/Time Ack Rec'd: ^TMP("SCERRSRT",$J,<sort by>,<date/time ack rec'd>,<trans log IEN>,<err code ien>)
+16 ; OR,
+17 ; Provider: ^TMP("SCERRSRT",$J,<sort by>,<provider>,<trans log IEN>,<err code ien>)
+18 ; OR,
+19 ; INSTITUTION: ^TMP("SCERRSRT",$J,<sort by>,<institution>,<trans log IEN>,<err code ien>)
+20 ; (INSTITUTION SORT INTRO. IN SD*5.3*505)
+21 ;
+22 NEW SCDFN,SCDTR,SCERIEN,SCTLIEN,SCSTAT,SCHLIEN,SCHLIEN1,SCHLIEN2
+23 NEW SCHLIEN3,SCHLIEN4,SCHLIEN5,SCTP,SCTPOS,SCTPSS
+24 ;
+25 ;Loop thru PCMM HL7 Trans Log for selected date range
+26 FOR SCDTR=SCBEG:0
SET SCDTR=$ORDER(^SCPT(404.471,"AST",SCDTR))
IF 'SCDTR!($PIECE(SCDTR,".")>SCEND)
QUIT
Begin DoDot:1
+27 ;loop thru status
+28 SET SCSTAT=0
+29 FOR
SET SCSTAT=$ORDER(^SCPT(404.471,"AST",SCDTR,SCSTAT))
IF SCSTAT=""
QUIT
Begin DoDot:2
+30 ;loop thru patients
+31 SET SCDFN=0
+32 FOR
SET SCDFN=$ORDER(^SCPT(404.471,"AST",SCDTR,SCSTAT,SCDFN))
IF SCDFN=""
QUIT
Begin DoDot:3
+33 ;loop through (#404.471) ien's
+34 SET SCTLIEN=0
+35 FOR
SET SCTLIEN=$ORDER(^SCPT(404.471,"AST",SCDTR,SCSTAT,SCDFN,SCTLIEN))
IF 'SCTLIEN
QUIT
Begin DoDot:4
+36 ;loop thru ien's of error code mult. and setup sort array
+37 SET SCERIEN=0
+38 FOR
SET SCERIEN=$ORDER(^SCPT(404.471,SCTLIEN,"ERR",SCERIEN))
IF 'SCERIEN
QUIT
DO SORT(SCSORTBY,SCDTR,SCDFN,SCEPS,SCTLIEN,SCERIEN)
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+39 ;
+40 QUIT
+41 ;
+42 ;
SORT(SCSORTBY,SCDTR,SCDFN,SCEPS,SCTLIEN,SCERIEN) ;
+1 ; Description: Used to set up sort array based on 'Sort Criteria' and
+2 ; 'Error Processing Status' for PCMM Transmission Errors list display.
+3 ;
+4 ; Input:
+5 ; SCSORTBY - Sort by criteria
+6 ; SCDTR - PCMM transmission log date/time ack received
+7 ; SCDFN - Patient IEN
+8 ; SCEPS - Error processing status
+9 ; SCTLIEN - PCMM transmission log IEN
+10 ; SCERIEN - IEN of record in Error Code (#404.47142) multiple
+11 ;
+12 ; Output: None
+13 ;
+14 NEW SCTLOG
+15 ;
+16 ;If sort by criteria is 'Date/Time Ack Received'
+17 IF SCSORTBY="D"
Begin DoDot:1
+18 ;get data from PCMM HL7 Trans Log
+19 IF $$GETLOG^SCMCHLA(SCTLIEN,SCERIEN,.SCTLOG)
Begin DoDot:2
+20 ;if Error Proc Status matches selected Error Proc Status
+21 IF (SCEPS=$GET(SCTLOG("ERR","EPS"))!(SCEPS>2))
Begin DoDot:3
+22 ;setup ^tmp array sorted by date/time ack rec'd
+23 SET ^TMP("SCERRSRT",$JOB,SCSORTBY,SCDTR,SCTLIEN,SCERIEN)=""
End DoDot:3
End DoDot:2
End DoDot:1
+24 ;
+25 ;If sort by criteria is 'Provider'
+26 IF SCSORTBY="P"
Begin DoDot:1
+27 NEW SCPTR,SCPROV,SCHL
+28 ;get data from PCMM HL7 Trans Log
+29 IF $$GETLOG^SCMCHLA(SCTLIEN,SCERIEN,.SCTLOG)
Begin DoDot:2
+30 ;if Error Proc Status matches selected Error Proc Status
+31 IF (SCEPS=$GET(SCTLOG("ERR","EPS"))!(SCEPS>2))
Begin DoDot:3
+32 ;get data from PCMM HL7 ID file
+33 IF $$GETHL7ID">GETHL7ID^SCMCHLA2($GET(SCTLOG("ERR","ZPCID")),.SCHL)
Begin DoDot:4
+34 ;get provider from POSITION ASSIGNMENT HISTORY file
+35 ; pointer to PCMM HL7 ID file
SET SCPTR=$PIECE($GET(SCHL("HL7ID")),"-",2)
+36 IF $GET(SCTLOG("WORK"))
SET SCPROV=$$PROV^SCMCHLP(SCTLOG("WORK"))
+37 IF '$GET(SCTLOG("WORK"))
SET SCPROV=$PIECE($GET(^SCTM(404.52,+SCPTR,0)),"^",3)
+38 ;setup ^tmp array sorted by provider
+39 SET ^TMP("SCERRSRT",$JOB,SCSORTBY,$SELECT($GET(SCPROV)'="":$$EXTERNAL^DILFD(404.52,.03,,SCPROV),1:"ZZZUNKNOWN"),SCTLIEN,SCERIEN)=""
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+40 ;
+41 ;If sort by criteria is 'Patient' (default)
+42 IF SCSORTBY="N"
Begin DoDot:1
+43 ;get data from PCMM HL7 Trans Log
+44 IF $$GETLOG^SCMCHLA(SCTLIEN,SCERIEN,.SCTLOG)
Begin DoDot:2
+45 ;if Error Proc Status matches selected Error Proc Status
+46 IF (SCEPS=$GET(SCTLOG("ERR","EPS"))!(SCEPS>2))
Begin DoDot:3
+47 ;setup ^tmp array sorted by patient
+48 IF SCDFN="W"
IF $GET(SCTLOG("WORK"))=""
SET SCDFN=""
+49 SET ^TMP("SCERRSRT",$JOB,SCSORTBY,$SELECT($PIECE($GET(^DPT(+SCDFN,0)),U)'="":$PIECE(^(0),U),SCDFN="W":"Workload Message",1:"UNKNOWN"),SCTLIEN,SCERIEN)=""
End DoDot:3
End DoDot:2
End DoDot:1
+50 ;
+51 ;If sort by criteria is 'Institution" SD*5.3*505
+52 IF SCSORTBY="I"
Begin DoDot:1
+53 ;get data from PCMM HL7 Trans Log
+54 IF $$GETLOG^SCMCHLA(SCTLIEN,SCERIEN,.SCTLOG)
Begin DoDot:2
+55 IF (SCEPS=$GET(SCTLOG("ERR","EPS"))!(SCEPS>2))
Begin DoDot:3
+56 ;setup ^tmp array sorted by institution
+57 SET SCHLIEN=0
+58 FOR
SET SCHLIEN=$ORDER(^SCPT(404.471,SCTLIEN,"ZPC",SCHLIEN))
IF SCHLIEN=""
QUIT
Begin DoDot:4
+59 SET SCHLIEN1=$GET(^SCPT(404.471,SCTLIEN,"ZPC",SCHLIEN,0))
IF SCHLIEN<1
QUIT
Begin DoDot:5
+60 SET SCHLIEN2=$PIECE(SCHLIEN1,U,2)
SET SCHLIEN3=+$GET(^SCPT(404.49,SCHLIEN2,0))
+61 SET SCHLIEN4=$GET(^SCPT(404.43,SCHLIEN3,0))
IF SCHLIEN4=""
QUIT
Begin DoDot:6
+62 SET SCHLIEN5=$GET(^SCPT(404.42,+SCHLIEN4,0))
IF SCHLIEN5=""
QUIT
Begin DoDot:7
+63 SET SCTPOS=$PIECE(SCHLIEN4,U,2)
SET SCTPSS=$GET(^SCTM(404.57,+SCTPOS,0))
+64 SET SCTP=$PIECE(SCTPSS,U,2)
SET SCY=$GET(^SCTM(404.51,+SCTP,0))
SET SCINT=$PIECE(SCY,U,7)
+65 SET SCINNAM=$$GET1^DIQ(4,+SCINT_",",99)
+66 SET ^TMP("SCERRSRT",$JOB,SCSORTBY,$SELECT($GET(SCINNAM)'="":SCINNAM,1:"UNK"),SCTLIEN,SCERIEN)=""
+67 KILL SCTP,SCTPOS,SCTPSS,SCTP,SCY,SCINNAM,SCINT
End DoDot:7
End DoDot:6
End DoDot:5
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+68 QUIT