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

ECRRPT1.m

Go to the documentation of this file.
  1. ECRRPT1 ;ALB/JAM-Event Capture Report RPC Broker ;Sep 22, 2020@17:05:23
  1. ;;2.0;EVENT CAPTURE;**25,32,33,61,78,72,90,95,100,107,112,119,139,145,152**;8 May 96;Build 19
  1. ;
  1. ;119 Updated comments for reports to include (E)xport as a value for ECPTYP
  1. ECRPRSN ;Procedure Reason Report for RPC Call
  1. ; Variables passed in
  1. ; ECSD - Start Date or Report
  1. ; ECED - End Date or Report
  1. ; ECL0..n - Location to report (1,some or ALL)
  1. ; ECD0..n - DSS Unit to report (1,some or ALL)
  1. ; ECRY0..n - Procedure reason (some or ALL)
  1. ; ECPTYP - Where to send output (P)rinter, (D)evice or screen
  1. ; or (E)xport
  1. ;
  1. ; Variable return
  1. ; ^TMP($J,"ECRPT",n)=report output or to print device.
  1. N ECV,ECI,ECLOC,ECDSSU,ECDN,ECDATE,ECUN,ECNT,ECKEY,ECX,ECLINK,ECZ
  1. N ECROU,ECSAVE,ECDESC,ECW,DIC,X,Y,I,LIEN,ECJ
  1. S ECV="ECL0^ECD0^ECSD^ECED^ECRY0" D REQCHK^ECRRPT(ECV) I ECERR Q ;112
  1. D I '$D(ECLOC) S ^TMP("ECMSG",$J)="1^Invalid Location." Q
  1. . D LOCARRY^ECRUTL I ECL0="ALL" Q ;112
  1. . K ECLOC F I=0:1 S LIEN=$G(@("ECL"_I)) Q:'+LIEN I $D(ECLOC1(LIEN)) S ECLOC(I+1)=LIEN_"^"_ECLOC1(LIEN) ;112
  1. D I '$D(ECDSSU) S ^TMP("ECMSG",$J)="1^Invalid DSS Unit." Q
  1. . I ECD0="ALL" D Q
  1. . . I '$D(ECDUZ) Q
  1. . . S ECKEY=$S($D(^XUSEC("ECALLU",ECDUZ)):1,1:0) D ALLU^ECRUTL
  1. . S (ECI,ECNT)=0 F ECI=0:1 S ECX="ECD"_ECI Q:'$D(@ECX) D
  1. . . K DIC S DIC=724,DIC(0)="QNZX",X=@ECX D ^DIC I Y<0 Q ;145
  1. . . S ECNT=ECNT+1,ECDSSU(ECNT)=Y
  1. S ECX=0 D
  1. .I ECRY0="ALL" D PXREAS Q
  1. .N TLOC,TDSS,ECY
  1. .S ECI=0 F S ECI=$O(ECLOC(ECI)) Q:'ECI S TLOC(+ECLOC(ECI))=""
  1. .S ECI=0 F S ECI=$O(ECDSSU(ECI)) Q:'ECI S TDSS(+ECDSSU(ECI))=""
  1. .S ECI=0 F ECI=0:1 S ECZ="ECRY"_ECI Q:'$D(@ECZ) D
  1. ..S ECW=0 F S ECW=$O(^ECL("B",@ECZ,ECW)) Q:'ECW D
  1. ...S ECY=$P($G(^ECL(ECW,0)),U,2) Q:ECY="" S ECJ=$P($G(^ECJ(ECY,0)),U)
  1. ...Q:ECJ="" Q:'$D(TLOC($P(ECJ,"-"))) Q:'$D(TDSS($P(ECJ,"-",2)))
  1. ...S ECLINK(ECW)=$P($G(^ECL(ECW,0)),U)
  1. D DATECHK^ECRRPT(.ECSD,.ECED) S ECSD=ECSD-.0001,ECED=ECED+.9999
  1. I ECPTYP="P" D Q
  1. . S ECV="ECSD^ECED^ECPTYP",ECROU="STRPT^ECRPRSN2"
  1. . S (ECSAVE("ECLOC("),ECSAVE("ECDSSU("),ECSAVE("ECLINK("))=""
  1. . S ECDESC="EC Procedure Reason Report"
  1. . D QUEUE^ECRRPT
  1. D STRPT^ECRPRSN2 ;112
  1. Q
  1. PXREAS ;Procedure reason link
  1. N ECZ,ECX,ECY,ECV
  1. S ECX=0 F S ECX=$O(ECLOC(ECX)) Q:'ECX S ECY=0 D
  1. . F S ECY=$O(ECDSSU(ECY)) Q:'ECY S ECV=+ECLOC(ECX)_"-"_+ECDSSU(ECY) D
  1. . . S ECZ=ECV_"-0-0"
  1. . . F S ECZ=$O(^ECJ("B",ECZ)) Q:('ECZ)!($P(ECZ,"-",1,2)'=ECV) D
  1. . . . S ECW=$O(^ECJ("B",ECZ,"")) Q:ECW="" D REALNK
  1. Q
  1. REALNK ;Reason link
  1. N XX,YY,ZZ
  1. S XX=0 F S XX=$O(^ECL("AD",ECW,XX)) Q:'XX S YY=0 D
  1. . F S YY=$O(^ECL("AD",ECW,XX,YY)) Q:'YY D
  1. . . Q:$G(^ECL(YY,0))="" S ECLINK(YY)=XX
  1. Q
  1. ECRPERS ;Inactive Person Class Report for RPC Call
  1. ; Variables passed in
  1. ; ECSD - Start Date or Report
  1. ; ECED - End Date or Report
  1. ; ECSORT - Sort by Patient (P) or Provider (R)
  1. ; ECPTYP - Where to send output (P)rinter, (D)evice or screen
  1. ; or (E)xport
  1. ;
  1. ; Variable return
  1. ; ^TMP($J,"ECRPT",n)=report output or to print device.
  1. N ECV,ECDATE,ECBEGIN,ECEND,ECROU,ECDESC
  1. S ECV="ECSD^ECED^ECSORT" D REQCHK^ECRRPT(ECV) I ECERR Q
  1. D DATECHK^ECRRPT(.ECSD,.ECED)
  1. S ECBEGIN=ECSD-.0001,ECEND=ECED+.9999
  1. I ECPTYP="P" D Q
  1. . S ECV="ECBEGIN^ECEND^ECSORT",ECROU="START^ECRPCLS"
  1. . S ECDESC="EC Invalid Provider Report"
  1. . D QUEUE^ECRRPT
  1. D START^ECRPCLS
  1. Q
  1. ECDSS1 ;National/Local Procedure Reports for RPC Call
  1. ; Variables passed in
  1. ; ECRTN - Procedure Report (A-active or I-inactive)
  1. ; ECPTYP - Where to send output (P)rinter, (D)evice or screen
  1. ; or (E)xport
  1. ; If ECRTN=A, also
  1. ; ECRN - Preferred Report (N-ational, L-ocal or Both)
  1. ; ECRD - Sort Method (P-rocedure Name, N-ational Number)
  1. ;
  1. ; Variable return
  1. ; ^TMP($J,"ECRPT",n)=report output or to print device.
  1. N ECV,ECDESC,ECROU,DQTIME
  1. S ECV=$S($G(ECRTN)="A":"ECRTN^ECRN^ECRD",1:"ECRTN")
  1. D REQCHK^ECRRPT(ECV) I ECERR Q
  1. S DQTIME=ECQDT
  1. I $G(ECPTYP)="E" D @$S(ECRTN="I":"LISTI^ECDSS1",1:"PRT^ECDSS1") Q ;119
  1. I ECPTYP="P" D Q
  1. . S ECV="ECRTN^ECRN^ECRD",ECROU=$S(ECRTN="I":"LISTI",1:"PRT")_"^ECDSS1"
  1. . S ECDESC="Event Capture National Procedure Report",ECDIP=1
  1. . ;S ECSAVE("IO*")=""
  1. .D QUEDIP D @$S(ECRTN="I":"LISTI^ECDSS1",1:"PRT^ECDSS1")
  1. D CLOSE^%ZISH(ECDIRY_ECFILER)
  1. S %ZIS("HFSNAME")=ECDIRY_ECFILER,%ZIS("HFSMODE")="W",IOP="HFS"_";132" ;145 Add right margin width
  1. D @$S(ECRTN="I":"LISTI^ECDSS1",1:"PRT^ECDSS1")
  1. Q
  1. ECDSS3 ;Category Reports for RPC Call
  1. ; Variables passed in
  1. ; ECRTN - Category Procedure Report
  1. ; (A-active, I-inactive or B-oth)
  1. ; ECPTYP - Where to send output (P)rinter, (D)evice or screen
  1. ; or (E)xport
  1. ;
  1. ; Variable return
  1. ; ^TMP($J,"ECRPT",n)=report output or to print device.
  1. N ECV,ECDIP,DQTIME
  1. S ECV="ECRTN" D REQCHK^ECRRPT(ECV) I ECERR Q
  1. S DQTIME=ECQDT
  1. I $G(ECPTYP)="E" D PRINT^ECDSS3 Q ;119
  1. I ECPTYP="P" D Q
  1. . S ECV="ECRTN",ECROU="PRINT^ECDSS3"
  1. . S ECDESC="Event Capture Category Reports"
  1. . D QUEDIP D PRINT^ECDSS3
  1. D CLOSE^%ZISH(ECDIRY_ECFILER)
  1. S %ZIS("HFSNAME")=ECDIRY_ECFILER,%ZIS("HFSMODE")="W",IOP="HFS"_";132" ;145 Add right margin width
  1. D PRINT^ECDSS3
  1. Q
  1. QUEDIP ;Queue when using DIP
  1. N DIC,X,Y
  1. D I Y=-1 S ECERR=1 Q
  1. . S DIC(0)="MN",X=ECDEV,DIC="^%ZIS(1," D ^DIC
  1. . S:+Y>0 IOP="Q;"_$P(Y,U,2)
  1. . S Y=ECQDT X ^DD("DD") S DQTIME=Y
  1. Q
  1. ECSUM ;Print Category and Procedure Summary (Report) for RPC Call
  1. ; Variables passed in
  1. ; ECL - Location to report (1 or ALL)
  1. ; ECD0...n - DSS Unit to report (ECD0, first unit, ECD1, second
  1. ; unit, etc.)
  1. ; ECC - Category (defaults to ALL, even if sent) (optional)
  1. ; ECRTN - Event Code Screen (Active, Inactive or Both)
  1. ; ECPTYP - Where to send output (P)rinter, (D)evice or screen
  1. ; or (E)xport
  1. ;
  1. ; Variable return
  1. ; ^TMP($J,"ECRPT",n)=report output or to print device.
  1. N ECV,ECDN,ECCN,ECROU,ECSAVE,ECDESC,ECLOC,ECS,ECJLP,ECSN,ECALL,DIC,X,Y
  1. N ECSCN,ECUNITS,ECNUM ;139
  1. S (ECJLP,ECALL)=0,ECV="ECL^ECD0^ECRTN" D REQCHK^ECRRPT(ECV) I ECERR Q ;139
  1. D I '$D(ECLOC) S ^TMP("ECMSG",$J)="1^Invalid Location." Q
  1. . D LOCARRY^ECRUTL I ECL="ALL" Q
  1. . K ECLOC I $D(ECLOC1(ECL)) S ECLOC(1)=ECL_"^"_ECLOC1(ECL)
  1. S ECSCN=ECRTN,ECD="ALL",ECALL=1 ;139
  1. F ECNUM=0:1 Q:'$D(@("ECD"_ECNUM)) S ECUNITS(@("ECD"_ECNUM))="" K @("ECD"_ECNUM) ;139 Convert DSS units to array of units
  1. I ECALL D PXRUN Q
  1. PXRUN I ECPTYP="P" D Q
  1. . S ECV="ECALL^ECSCN",ECROU="START^ECSUM"
  1. . S ECSAVE("ECLOC(")=""
  1. . S ECSAVE("ECUNITS(")="" ;139 Save units for queued report
  1. . I 'ECALL S ECV=ECV_"^ECD^ECC^ECSN^ECDN^ECJLP^ECCN^ECSCN"
  1. . S ECDESC="EC Print Category and Procedure Summary"
  1. . D QUEUE^ECRRPT
  1. U IO D START^ECSUM
  1. Q
  1. ECNTPCE ;ECS Records Failing Transmission to PCE
  1. ; Variables passed in
  1. ; ECSD - Start Date or Report
  1. ; ECED - End Date or Report
  1. ; ECPTYP - Where to send output (P)rinter, (D)evice or screen
  1. ; or (E)xport
  1. ; ECL0..n - Location to report (1,some or ALL)
  1. ; ECD0..n - DSS unit to report (1,some or ALL)
  1. ; Variable return
  1. ; ^TMP($J,"ECRPT",n)=report output or to print device.
  1. N ECV,ECDATE,ECROU,ECDESC
  1. N ECLOC,ECLOC1,ECDSSU,LIEN,ECNT,ECI,ECKEY,ECX,I,X,Y ; 152
  1. S ECV="ECSD^ECED^ECL0^ECD0" D REQCHK^ECRRPT(ECV) I ECERR Q ;152 - Added Location and DSS Units
  1. ;*** 152 Starts ***
  1. D I '$D(ECLOC) S ^TMP("ECMSG",$J)="1^Invalid Location." Q
  1. . D LOCARRY^ECRUTL I ECL0="ALL" Q ;112
  1. . K ECLOC F I=0:1 S LIEN=$G(@("ECL"_I)) Q:'+LIEN I $D(ECLOC1(LIEN)) S ECLOC(I+1)=LIEN_"^"_ECLOC1(LIEN)
  1. D I '$D(ECDSSU) S ^TMP("ECMSG",$J)="1^Invalid DSS Unit." Q
  1. . I ECD0="ALL" D Q
  1. . . I '$D(ECDUZ) Q
  1. . . S ECKEY=$S($D(^XUSEC("ECALLU",ECDUZ)):1,1:0) D ALLU^ECRUTL
  1. . S (ECI,ECNT)=0 F ECI=0:1 S ECX="ECD"_ECI Q:'$D(@ECX) D
  1. . . K DIC S DIC=724,DIC(0)="QNZX",X=@ECX D ^DIC I Y<0 Q
  1. . . S ECNT=ECNT+1,ECDSSU(ECNT)=Y
  1. ;*** 152 Ends ***
  1. D DATECHK^ECRRPT(.ECSD,.ECED)
  1. S ECSD=ECSD-.0001,ECED=ECED+.9999
  1. I ECPTYP="P" D Q
  1. . S ECV="ECSD^ECED^ECDATE^ECL0^ECD0",ECROU="START^ECNTPCE" ;152 - Added Location and DSS Units
  1. . S (ECSAVE("ECLOC("),ECSAVE("ECDSSU("))="" ;152
  1. . S ECDESC="ECS Records Failing Transmission to PCE Report"
  1. . D QUEUE^ECRRPT
  1. D START^ECNTPCE
  1. Q
  1. ECSCPT ;Event Code Screens with CPT Codes
  1. ; Variables passed in
  1. ; ECL - Location to report (1 or ALL)
  1. ; ECD - DSS Unit to report (1 or ALL), If ECD'="ALL" then ECC
  1. ; ECC - Category (1 or ALL) (optional)
  1. ; ECCPT - CPT Codes to Display (Active, Inactive or Both)
  1. ; ECPTYP - Where to send output (P)rinter, (D)evice or screen
  1. ; or (E)xport
  1. ;
  1. ; Variable return
  1. ; ^TMP($J,"ECRPT",n)=report output or to print device.
  1. N ECV,ECDN,ECCN,ECROU,ECSAVE,ECDESC,ECLOC,ECS,ECJLP,ECALL,DIC,X,Y
  1. S (ECJLP,ECALL)=0,ECV="ECL^ECD^ECCPT" D REQCHK^ECRRPT(ECV) I ECERR Q
  1. D I '$D(ECLOC) S ^TMP("ECMSG",$J)="1^Invalid Location." Q
  1. . I ECL="ALL" D LOCARRY^ECRUTL Q
  1. . S DIC=4,DIC(0)="QNZX",X=ECL D ^DIC Q:Y<0 S ECLOC(1)=+Y_U_$P(Y,U,2)
  1. D I ECERR S ^TMP("ECMSG",$J)="1^Invalid DSS Unit." Q
  1. . I ECD="ALL" S ECALL=1 Q
  1. . K DIC S DIC=724,DIC(0)="QNZX",X=ECD D ^DIC I Y<0 S ECERR=1 Q ;145
  1. . S ECDN=$P(Y,U,2)_$S($P($G(^ECD(+ECD,0)),"^",6):" **Inactive**",1:"")
  1. . S ECJLP=+$P(^ECD(ECD,0),"^",11)
  1. . I 'ECJLP S ECC=0,ECCN="None"
  1. I ECALL D CPTRUN Q
  1. S ECV="ECC" D REQCHK^ECRRPT(ECV) I ECERR Q
  1. D I ECERR S ^TMP("ECMSG",$J)="1^Invalid Category." Q
  1. . I (ECC="ALL")!(ECC=0) Q
  1. . K DIC S DIC=726,DIC(0)="QNMZX",X=ECC D ^DIC I Y<0 S ECERR=1 Q
  1. . S ECCN=$P(Y,U,2)
  1. CPTRUN I ECPTYP="P" D Q
  1. . S ECV="ECALL^ECCPT",ECROU="START^ECSCPT"
  1. . S ECSAVE("ECLOC(")=""
  1. . I 'ECALL S ECV=ECV_"^ECD^ECC^ECDN^ECJLP^ECCN"
  1. . S ECDESC="Event Code Screens with CPT Codes"
  1. . D QUEUE^ECRRPT
  1. U IO D START^ECSCPT
  1. Q
  1. ECINCPT ;National/Local Procedure Codes with Inactive CPT Reports for RPC Call
  1. ; Variables passed in
  1. ; ECPTYP - Where to send output (P)rinter, (D)evice or screen
  1. ; or (E)xport
  1. ; 152 - Adding the next three variables
  1. ; ECRN - Preferred Report (N-ational, L-ocal or Both)
  1. ; ECSM - Sort Method (P-rocedure Name, N-ational Number,C-PT Code,D-Inactive Date)
  1. ; ECSORT - Sort Order "A"scending, "D"escending
  1. ;
  1. ; Variable return
  1. ; ^TMP($J,"ECRPT",n)=report output or to print device.
  1. N ECV,ECL,ECDESC,ECROU,DQTIME,ECPG
  1. S ECV="ECRN^ECSM^ECSORT" D REQCHK^ECRRPT(ECV) I ECERR Q ;152
  1. S ECPG=1
  1. I ECPTYP="P" D Q
  1. . S ECV="ECRN^ECSM^ECSORT",ECROU="START^ECINCPT" ;152 ,ECV="ECL",ECL=""
  1. . S ECDESC="National/Local Procedure Codes with Inactive CPT"
  1. . D QUEUE^ECRRPT
  1. U IO D START^ECINCPT
  1. Q
  1. ECGTP ;ECS Generic Table Printer
  1. ; Variables passed in
  1. ; ECOBHNDL - Handle to generic table print obj
  1. ; ECPTYP - Where to send output (P)rinter, (D)evice or screen
  1. ;
  1. ; Variable return
  1. ; ^TMP($J,"ECRPT",n)=report output or to print device.
  1. N ECV,ECROU,ECDESC
  1. S ECV="ECOBHNDL" D REQCHK^ECRRPT(ECV) I ECERR Q
  1. I ECPTYP="P" D Q
  1. . S ECV="ECOBHNDL",ECROU="START^ECGTP"
  1. . S ECDESC="ECS Generic Table Printer"
  1. . D QUEUE^ECRRPT
  1. D START^ECGTP
  1. Q
  1. ECSTPCD ;DSS Units with Associated Stop Code Error REPORT
  1. ; EC*2*107 - added to GUI reports
  1. ; Variables passed in
  1. ; ECPTYP - Where to send output (P)rinter, (D)evice or screen
  1. ; or (E)xport
  1. ;
  1. ; Variable return
  1. ; ^TMP($J,"ECRPT",n)=report output or to print device.
  1. N ECV,ECL,ECDESC,ECROU,DQTIME,ECPG
  1. S ECPG=1
  1. I ECPTYP="P" D Q
  1. . S ECROU="STRTGUI^ECUNTRPT",ECV="ECL",ECL=""
  1. . S ECDESC="DSS Units with Associated Stop Code Error"
  1. . D QUEUE^ECRRPT
  1. U IO D STRTGUI^ECUNTRPT
  1. Q