BARRSL1 ; IHS/SD/LSL - Selective Report Parameters-PART 2 ; 12/19/2008
;;1.8;IHS ACCOUNTS RECEIVABLE;**6,10,16,19,20,23,24**;OCT 26,2005;Build 69
; IHS/SD/TMM 7/20/10 1.8*19 Add Group Plan to A/R Statistical report.
; When selecting A/R STATISTICAL REPORT by Billing Entity prompt
; user for Group Plans to include in report data.
; FIXPMS10019 #1 - TSR report, Add Adjustment inclusion
; parameter: "Sent To Collections"
; Resolve UNDEFINED error <UNDEFINED>S4+12^DICL2
; Add STATUS CHANGE as Selection Type for TSR report
;
; IHS/SD/POTT 12/12 ADDED SELECTION OF CODING DX VERSION ICD-9 / ICD-10 - BAR1.8*23
; IHS/SD/POTT 03/13 ADDED NEW VA billing - BAR1.8*23
; IHS/SD/POTT 06/13 FIXED FLAWS IN SELECTING ICD9/10 DX - BAR1.8*23
; IHS/SD/POTT 07/13 DO NOT ALLOW SELECT ICD10 WHEN INFRASTRUCTURE NOT PRESENT - BAR1.8*23
; IHS/SD/POTT HEAT150941 02/09/14 Allow ALL DX9/10 - BAR1.8*24
; if no DX selected: show ALL DX of ALL available coding systems
; fixed escape from report after pressing ^ in DX prompts
; ;;;IHS/SD/POTT ICD-10 SANDBOX TESTING: FIXED ERR MESSAGE Low Diagnosis is Greater than the High IF DXLO=DXHI - BAR1.8*??
; IHS/SD/POTT BETA FIXED RETURN TO SELECT INCLUSION PARAMETERS: BAR1.8*24
;
Q
; ******
;
TRANTYP ; EP
D TRANTYP^BARRSL4 ;ASK FOR TRANSACTION TYPE
Q
;
LOC ; EP
; Select Location inclusion parameters
W !
K DIC,BARY("LOC")
S DIC="^BAR(90052.05,DUZ(2),"
S DIC(0)="ZAEMQ"
S DIC("A")="Select Visit LOCATION: "
D ^DIC
K DIC
Q:$D(DTOUT)!($D(DUOUT))
Q:+Y<1
S BARY("LOC")=+Y
S BARY("LOC","NM")=Y(0,0)
Q
; **************
TYP ; EP
; Select BILLING ENTITY Inclusion Parameter
; May not specify both billing entity and a/r account
K DIR,BARY("TYP"),BARY("ACCT"),BARY("PAT"),BARY("ALL"),BARY("ITYP")
; - BAR1.8*23 UPDATED DISPATCH TABLE
S DIR(0)="SO^1:MEDICARE"
S DIR(0)=DIR(0)_";2:MEDICAID"
S DIR(0)=DIR(0)_";3:PRIVATE INSURANCE"
S DIR(0)=DIR(0)_";4:NON-BENEFICIARY PATIENTS"
S DIR(0)=DIR(0)_";5:BENEFICIARY PATIENTS"
S DIR(0)=DIR(0)_";6:SPECIFIC A/R ACCOUNT"
S DIR(0)=DIR(0)_";7:SPECIFIC PATIENT"
S DIR(0)=DIR(0)_";8:WORKMEN'S COMP"
S DIR(0)=DIR(0)_";9:PRIVATE + WORKMEN'S COMP"
S DIR(0)=DIR(0)_";10:CHIP"
S DIR(0)=DIR(0)_";11:VETERANS ADMINISTRATION"
S DIR(0)=DIR(0)_";12:OTHER"
S DIR("A")="Select TYPE of BILLING ENTITY to Display"
S DIR("?")="Enter TYPE of BILLING ENTITY to display, or press <return> for ALL"
D ^DIR
K DIR
I $D(DUOUT)!($D(DTOUT)) Q
Q:Y<1
S BARY("TYP")=U_Y_U
S BARY("TYP","NM")=Y(0)
G ACCT:Y=6,PAT:Y=7
;P.OTT UPDATED DISPATCH TABLE BAR1.8*23
S:Y=1 BARY("TYP")="^R^MH^MD^MC^MMC^"
S:Y=2 BARY("TYP")="^D^K^FPL^"
S:Y=3 BARY("TYP")="^H^M^P^F^"
S:Y=4 BARY("TYP")="^N^"
S:Y=5 BARY("TYP")="^I^"
S:Y=8 BARY("TYP")="^W^"
S:Y=9 BARY("TYP")="^H^M^P^F^W^"
S:Y=10 BARY("TYP")="^K^"
S:Y=11 BARY("TYP")="^V^"
S:Y=12 BARY("TYP")="^W^C^N^I^T^G^SEP^TSI^"
Q
; ***********
ACCT ;
; Specific insurer of billing entity parameter
K DIC
K BARY("TYP"),BARY("ACCT")
S DIC="^BARAC(DUZ(2),"
S DIC(0)="ZQEAM"
D ^DIC
K DIC
Q:$D(DTOUT)!($D(DUOUT))
Q:+Y<0
S BARY("ACCT")=+Y
S BARY("ACCT","NM")=Y(0,0)
I $G(BAR("OPT"))="STA" F BARGRPI=1:1 D GETGRP Q:+Y<0
Q
; *******
GETGRP ; Prompt for Group # ;New Tag... M819*ADD*TMM*20100720
W !
K DIC
S DIC="^AUTNEGRP("
S DIC("A")="ENTER IN THE GROUP NUMBER YOU WISH TO REPORT: "
S DIC(0)="AEQMZ"
D ^DIC
I Y'>0 Q
S BARY("GRP PLAN")=$G(BARGRPI)
S BARY("GRP PLAN",+Y)=Y(0,0) ;Y=Group Plan, Y(0,0)=Group Plan Name
;END 1.8*19
Q
;
PAT ;
; Specific patient of billing entity parameter
K BARY("TYP"),BARY("PAT")
S DIC="^AUPNPAT("
S DIC(0)="ZQEAM"
D ^DIC
K DIC
Q:$D(DTOUT)!($D(DUOUT))
K AUPNLK("ALL")
Q:+Y<0
S BARY("PAT")=+Y
S BARY("PAT","NM")=Y(0,0)
Q
; **********
ALL ; EP
; Select ALLOWANCE CATEGORY Inclusion Parameter BAR1.8*23
K DIR,BARY("TYP"),BARY("ACCT"),BARY("PAT"),BARY("ALL"),BARY("ITYP")
S DIR(0)="SO^1:MEDICARE (INS TYPES R MD MH MC MMC)" ;JULY 2003
S DIR(0)=DIR(0)_";2:MEDICAID (INS TYPES D K FPL)"
S DIR(0)=DIR(0)_";3:PRIVATE INSURANCE (INS TYPES P H F M)"
S DIR(0)=DIR(0)_";4:VETERANS (INS TYPES V)"
S DIR(0)=DIR(0)_";5:OTHER (INS TYPES W C N I G T SEP TSI)"
S DIR("A")="Select TYPE of ALLOWANCE CATEGORY to Display"
S DIR("?")="Enter TYPE of ALLOWANCE CATEGORY to display, or press <return> for ALL"
D ^DIR
K DIR
I $D(DUOUT)!($D(DTOUT)) S BARDONE3=1 Q
I Y<1 S BARDONE3=1 Q
S BARY("ALL")=Y
S BARY("ALL","NM")=Y(0)
Q
; *******************
DT ; EP
; Select Date inclusion parameter
D DT^BARRSL4
Q
; **************************
PRV ; EP
; Select Provider Inclusion Parameter
D PRV^BARRSL4
Q
; *******************************
AR ; EP
; Select A/R Clerk Inclusion Parameter
D AR^BARRSL4
Q
; ******************
BATCH ; EP
; Select Collection Batch Inclusion Parameter
D BATCH^BARRSL4
Q
; *******
ITEM ; EP
; Select Collection Batch Item Inclusion Parameter
D ITEM^BARRSL4
Q
; *************
RTYP ; EP
; Select Report Type Inclusion Parameter
D RTYP^BARRSL4
Q
; *********************
DSVC ; EP Select One Discharge Service
D DSVC^BARRSL4
Q
; ******************** BAR1.8*23
ASKICD() ;
D ASKICD^BARRSL4()
Q Y
CLNUPDX ;CLEAN UP DX
D CLNUPDX^BARRSL4
Q
DX ; EP
S BARQ=0 ;^
K BARY("DX9")
K BARY("DX10")
K BARY("DX-ICDVER")
DXCODE ;
;S BARICDV=$$ASKICD() I BARICDV="^" D QUIT ;OLD CODE BAR1.8*24
;FIXED RETURN TO SELECT INCLUSION PARAMETERS
S BARICDV=$$ASKICD() I BARICDV="^" S DUOUT=0,DIRUT=0 D QUIT ;NEW CODE BAR1.8*24
. D CLNUPDX
I Y="B"!(Y=10) I $T(+1^ICDEX)="" D G DXCODE
. W !!!,"NOTE: SOME OF THE ICD-10 INFRASTRUCTURE UTILITIES ARE MISSING."
. W !,"THIS REPORT CANNOT CURRENTLY PROVIDE ANY DATA BASED ON ICD-10 DX CODES"
. Q
S BARY("DX-ICDVER")=BARICDV
I BARY("DX-ICDVER")=9 D I $G(BARQ) Q
. D DX9 I $G(BARQ) Q
. D DXADD(9) I $G(BARQ) Q
I BARY("DX-ICDVER")=10 D I $G(BARQ) Q
. D DX10 I $G(BARQ) Q
. D DXADD(10) I $G(BARQ) Q
I BARY("DX-ICDVER")="B" D I $G(BARQ) Q
. D DX9 I $G(BARQ) Q
. D DXADD(9) I $G(BARQ) Q
. D DX10 I $G(BARQ) Q
. D DXADD(10) I $G(BARQ) Q
I BARY("DX-ICDVER")=9!(BARY("DX-ICDVER")="B") I '$D(BARY("DX9")) D
. K BARY("DX9")
. S BARY("DX9")="ALL" ;- BAR1.8*24
. S BARY("DX9_ALL")="ALL"
I BARY("DX-ICDVER")=10!(BARY("DX-ICDVER")="B") I '$D(BARY("DX10")) D
. K BARY("DX10")
. S BARY("DX10")="ALL" ;- BAR1.8*24
. S BARY("DX10_ALL")="ALL"
W !!
D SHOWDX
S DIR("A")="Are you OK with this selection"
S DIR("B")="YES"
S DIR(0)="Y"
D ^DIR
K DIR
I Y'=1 D G DX
. W !,"OK, make a new DX selection"
Q
;
DX9 ;<-------
;
DXLOW9 ;
K BARY("DX9")
K DIR,DIC,DA
W !!
W "Entry of Diagnosis Range ICD-9",!
W "=============================="
S DIR(0)="PO^80:ZAEMQ"
S DIR("A")="Low ICD-9 Code (from) "
I $$HAVICD10() S DIR("S")="I $P($G(^ICD9(Y,1)),U)=1" ;
D ^DIR
I $G(DUOUT) S BARQ=1 Q ;3/25
I +Y<1 Q ;ENTER: GO FOR INDIVIDUAL DX
S BARY("DX9",1)=$P(Y,U,2)
;
DXHI9 ;
S DIR(0)="PO^80:ZAEMQ"
S DIR("A")="High ICD-9 Code (to) "
I $$HAVICD10() S DIR("S")="I $P($G(^ICD9(Y,1)),U)=1"
D ^DIR
I $G(DUOUT) S BARQ=1 Q
I $D(BARY("DX9",1)) I +Y<1 G DXLOW9 ;IF LO DEFINED, ENTER
I +Y<1 Q ;ENTER
S BARY("DX9",2)=$P(Y,U,2)
I BARY("DX9",1)=BARY("DX9",2) QUIT ; - BAR1.8*24
I BARY("DX9",1)>BARY("DX9",2)!('+BARY("DX9",1)&($E(BARY("DX9",1),2,9)>$E(BARY("DX9",2),2,9))) D G DXLOW9
. W !!,*7,"INPUT ERROR: Low Diagnosis is Greater than the High, TRY AGAIN!",!!
Q
; **********************
DXADD(BARICD) ;
NEW BARDXTYP
S BARDXTYP="DX"_BARICD
K BARY(BARDXTYP,3)
F D ADDDX(BARICD) Q:$G(BARQ) Q:Y<0
K BARY(BARDXTYP,4)
W !!
Q
ADDDX(BARICD) ;ADD ONE OR MORE SINGLE DG INTO BARY("DX9",3 or BARY("DX10",3
K DIR,DIC,DA,BARDX
N BARDXTYP
S BARDXTYP="DX"_BARICD
I $O(BARY(BARDXTYP,3,""))]"" D LIST(BARICD)
W !!
W "Entry of Diagnosis Code ICD-",BARICD,!
W "=============================="
S DIR(0)="PO^80:ZAEMQ"
S DIR("A")="Individual ICD-"_BARICD_" Code"
I BARICD=9 I $$HAVICD10() S DIR("S")="I $P($G(^ICD9(Y,1)),U)=1"
I BARICD=10 I $$HAVICD10() S DIR("S")="I $P($G(^ICD9(Y,1)),U)=30"
D ^DIR
I $G(DUOUT) S BARQ=1 Q ;3/25
;I $D(DIRUT) Q
I +Y<1 Q
S BARDX=$P(Y,U,2)
I BARDX="" S BARQ1=1 Q
I $D(BARY(BARDXTYP,3,BARDX)) D Q
. W !," Removed from selection."
. K BARY(BARDXTYP,3,BARDX)
S BARY(BARDXTYP,3,BARDX)="" W !," Added to selection." Q
Q
CONTDX(BARICD) ;
QUIT
K DIR,DIC,DA
N BARDXTYP,BARDX1
S BARDXTYP="DX"_BARICD
S Y=0 K DIRUT
S DIR("A")="DX-"_BARICD_" code which begins "
S DIR(0)="FUO^3:30"
S DIR("?")="Enter partial DX"_BARICD_" code (begins with)"
I BARICD=9 S DIR("?")=DIR("?")_" in form NNN."
I BARICD=9 S DIR("?")=DIR("?")_"in form ANN (A=A...Z N=1...0)."
D ^DIR
I Y="" S Y=-1 Q
S BARDX1=Y
D LIST^BARRSLDX(BARDX1,0)
I 'BARCNT W " no matching DXs found" Q
I $D(BARY(BARDXTYP,4,BARDX1)) D Q
. I '$$ASKREM() Q
. K BARY(BARDXTYP,4,BARDX1)
. W !,BARDX1, " removed from selection."
W " (",BARCNT," matching DXs found) "
S BARY(BARDXTYP,4,BARDX1)="" W !,BARDX1," added to selection." Q
Q
DX10 ;
;
DXLOW10 ;
K BARY("DX10")
K DIR,DIC,DA
W !!
W "Entry of Diagnosis Range ICD-10",!
W "==============================="
S DIR(0)="PO^80:ZAEMQ"
S DIR("A")="Low ICD-10 Code (from) "
S DIR("S")="I $P($G(^ICD9(Y,1)),U)=30"
D ^DIR
I $G(DUOUT) S BARQ=1 Q ;3/25
I +Y<1 Q ;ENTER: GO FOR INDIVIDUAL DX
S BARY("DX10",1)=$P(Y,U,2)
;
DXHI10 ;
S DIR(0)="PO^80:ZAEMQ" ;
S DIR("A")="High ICD-10 Code (to) "
S DIR("S")="I $P($G(^ICD9(Y,1)),U)=30"
D ^DIR
I $G(DUOUT) S BARQ=1 Q ;
;if DX10LOW defined, and DX10HI was enterer nil; retrurn to DX10LOW entry
I $G(BARY("DX10",1))]"" I +Y<1 G DXLOW10
I +Y<1 Q ;ENTER
S BARY("DX10",2)=$P(Y,U,2)
;;;I BARY("DX10",2)=BARY("DX10",1) Q ; - BAR1.8*??
I '(BARY("DX10",2)]]BARY("DX10",1)) D G DXLOW10
. W !!,*7,"INPUT ERROR: Low Diagnosis is Greater than the High, TRY AGAIN!",!!
Q
; **********************
DXADINFO(BARX,BARY) ;
QUIT ;
LIST(BARICD) ;
N BAR1,BAR2,BAR3,BAR4
W !!?5,"Currently selected diagnoses: "
N BARDXTYP
S BARDXTYP="DX"_BARICD
S BAR1="" F S BAR1=$O(BARY(BARDXTYP,3,BAR1)) Q:BAR1="" W ! D DXINFO(BAR1) ;
S BAR1="" F S BAR1=$O(BARY(BARDXTYP,4,BAR1)) Q:BAR1="" W !,"code begins ",BAR1
Q
LBL ; EP
; Ask for large balance
K DIR
S DIR(0)="NAO^50:10000000:2"
S DIR("A")="Large Balance: "
S:$D(BARY("LBL")) DIR("B")=BARY("LBL")
D ^DIR
K DIR
I $D(DUOUT)!(Y="") Q
S BARY("LBL")=+Y
Q
; ******************
SBL ; EP
; Ask for small balance
K DIR
S DIR(0)="NAO^0:99:2"
S DIR("A")="Small Balance: "
S:$D(BARY("SBL")) DIR("B")=BARY("SBL")
D ^DIR
K DIR
I $D(DUOUT)!(Y="") Q
S BARY("SBL")=+Y
Q
; ****************
ITYP ; EP
; Ask for Insurer Type
K DIR,BARY("ITYP"),BARY("ACCT"),BARY("PAT"),BARY("ALL"),BARY("TYP")
K BARY("COLPT")
;PRIV
S DIR(0)="SO^H:HMO"
S DIR(0)=DIR(0)_";M:MEDICARE SUPPL."
S DIR(0)=DIR(0)_";P:PRIVATE INSURANCE"
S DIR(0)=DIR(0)_";F:FRATERNAL ORGANIZATION"
;OTHER
S DIR(0)=DIR(0)_";T:THIRD PARTY LIABILITY"
S DIR(0)=DIR(0)_";W:WORKMEN'S COMP"
S DIR(0)=DIR(0)_";C:CHAMPUS"
S DIR(0)=DIR(0)_";N:NON-BENEFICIARY (NON-INDIAN)"
S DIR(0)=DIR(0)_";I:INDIAN PATIENT"
S DIR(0)=DIR(0)_";G:GUARANTOR"
S DIR(0)=DIR(0)_";SEP:STATE EXCHANGE PLAN"
S DIR(0)=DIR(0)_";TSI:TRIBAL SELF INSURED"
;MEDICAID
S DIR(0)=DIR(0)_";D:MEDICAID FI"
S DIR(0)=DIR(0)_";K:CHIP (KIDSCARE)"
S DIR(0)=DIR(0)_";FPL:FPL 133 PERCENT"
;MEDICARE
S DIR(0)=DIR(0)_";R:MEDICARE FI"
S DIR(0)=DIR(0)_";MD:MEDICARE PART D"
S DIR(0)=DIR(0)_";MC:MEDICARE PART C"
S DIR(0)=DIR(0)_";MH:MEDICARE HMO"
S DIR(0)=DIR(0)_";MMC:MEDICARE MANAGED CARE"
;VETERANS
S DIR(0)=DIR(0)_";V:VETERANS ADMINISTRATION"
;-------END OF TABLE
S DIR("A")="Select INSURER TYPE to Display"
S DIR("?")="Enter TYPE of INSURER to display, or press <return> for ALL"
D ^DIR
K DIR
I $D(DUOUT)!($D(DTOUT))!($D(DIRUT)) Q
S BARY("ITYP")=Y
S BARY("ITYP","NM")=Y(0)
Q
; *****************
COLPT ; EP
; Select Collection Point and Date ranges
K BARY("COLPT"),BARY("ITYP")
S DIC="^BAR(90051.02,DUZ(2),"
S DIC(0)="ZQEAM"
D ^DIC
K DIC
Q:$D(DTOUT)!($D(DUOUT))
Q:+Y<0
S BARY("COLPT")=+Y
S BARY("COLPT","NM")=Y(0,0)
Q
;start new code bar*1.8*20 REQ10
DATASRC ;EP
;Select Data Source
S DIR(0)="SO^1:ELECTRONIC;2:MANUAL;3:BOTH"
S DIR("A")="Select DATA SOURCE to Display"
I $D(BARY("DATA SRC")) S DIR("B")=BARY("DATA SRC")
D ^DIR
K DIR
I $D(DUOUT)!($D(DTOUT))!($D(DIRUT)) Q
S BARY("DATA SRC")=Y(0)
Q
;end new code REQ10
SHOWDX ; - BAR1.8*23 LIST SELECTED DXs
NEW BAR1,BAR2,BAR3,BARTMP1
I $G(BARY("DX9"))="ALL" W !,"Display all ICD-9 Diagnosis"
I $G(BARY("DX10"))="ALL" W !,"Display all ICD-10 Diagnosis"
F BAR1="DX9","DX10" D
. F BAR2=1,2,3 I $D(BARY(BAR1,BAR2)) D
. . W !,"ICD"_$E(BAR1,3,4) ;
. . I BAR2<3 D Q
. . . I BAR2=1 W " FROM "
. . . I BAR2=2 W " TO "
. . . S BARDX=BARY(BAR1,BAR2)
. . . D DXINFO(BARDX) ;
. . W " "
. . S BARDX="" F S BARDX=$O(BARY(BAR1,BAR2,BARDX)) Q:BARDX="" D DXINFO(BARDX) W !
. S BAR2=4 I $D(BARY(BAR1,BAR2)) D
. . W !,BAR1
. . W " begins"
. . S BARDX="" F S BARDX=$O(BARY(BAR1,BAR2,BARDX)) Q:BARDX="" W ?12," ",BARDX W !
Q
DXINFO(BARDX) ;
NEW BAR2,BAR3,BAR4
S BAR4=""
W ?12," ",BARDX
I $$HAVICD10() D ;
. S BAR2=BARDX_" "
. S BAR3=$O(^ICD9("AB",BAR2,""))
. I BAR3]"" S BAR4=$P($G(^ICD9(BAR3,67,1,0)),U,2)
E D
. S BAR2=BARDX
. S BAR3=$O(^ICD9("AB",BAR2,""))
. I BAR3]"" S BAR4=$P($G(^ICD9(BAR3,0)),U,3)
W ?20,BAR4 ;CODE - TEXT
;ICD9 - OLD GLOBAL VERSION: ^ICD9(2,0)="100.89^^LEPTOSPIRAL INFECT NEC^^1^^^^"
;ICD10 - NDE GLOBAL VERSION ^ICD9("AB","307.1 ",1361) =
; ^ICD9(1361,67,1,0)="2781001^ANOREXIA NERVOSA"
Q
ASKREM() ;
K DIR
S DIR("A")="DX already selected. Do you want to remove it from selection (Y/N): "
S DIR("B")="NO"
S DIR(0)="YOA"
D ^DIR
K DIR
I Y>0 Q 1
Q 0
HAVICD10() ;RETURNS 1 IF ICD10 INSTALLED
Q $T(+1^ICDEX)]""
;---------------------------EOR-------------------
;SHOW(X) ;
I 'X Q
W !,"Y=",Y," X=",X," DTOUT: ",$G(DTOUT)," DUOUT: ",$G(DUOUT)," DIRUT: ",$G(DIRUT)," DIROUT: ",$D(DIROUT)," $g(barq)=",$G(BARQ)
;S DUOUT=0,DIRUT=0
Q
BARRSL1 ; IHS/SD/LSL - Selective Report Parameters-PART 2 ; 12/19/2008
+1 ;;1.8;IHS ACCOUNTS RECEIVABLE;**6,10,16,19,20,23,24**;OCT 26,2005;Build 69
+2 ; IHS/SD/TMM 7/20/10 1.8*19 Add Group Plan to A/R Statistical report.
+3 ; When selecting A/R STATISTICAL REPORT by Billing Entity prompt
+4 ; user for Group Plans to include in report data.
+5 ; FIXPMS10019 #1 - TSR report, Add Adjustment inclusion
+6 ; parameter: "Sent To Collections"
+7 ; Resolve UNDEFINED error <UNDEFINED>S4+12^DICL2
+8 ; Add STATUS CHANGE as Selection Type for TSR report
+9 ;
+10 ; IHS/SD/POTT 12/12 ADDED SELECTION OF CODING DX VERSION ICD-9 / ICD-10 - BAR1.8*23
+11 ; IHS/SD/POTT 03/13 ADDED NEW VA billing - BAR1.8*23
+12 ; IHS/SD/POTT 06/13 FIXED FLAWS IN SELECTING ICD9/10 DX - BAR1.8*23
+13 ; IHS/SD/POTT 07/13 DO NOT ALLOW SELECT ICD10 WHEN INFRASTRUCTURE NOT PRESENT - BAR1.8*23
+14 ; IHS/SD/POTT HEAT150941 02/09/14 Allow ALL DX9/10 - BAR1.8*24
+15 ; if no DX selected: show ALL DX of ALL available coding systems
+16 ; fixed escape from report after pressing ^ in DX prompts
+17 ; ;;;IHS/SD/POTT ICD-10 SANDBOX TESTING: FIXED ERR MESSAGE Low Diagnosis is Greater than the High IF DXLO=DXHI - BAR1.8*??
+18 ; IHS/SD/POTT BETA FIXED RETURN TO SELECT INCLUSION PARAMETERS: BAR1.8*24
+19 ;
+20 QUIT
+21 ; ******
+22 ;
TRANTYP ; EP
+1 ;ASK FOR TRANSACTION TYPE
DO TRANTYP^BARRSL4
+2 QUIT
+3 ;
LOC ; EP
+1 ; Select Location inclusion parameters
+2 WRITE !
+3 KILL DIC,BARY("LOC")
+4 SET DIC="^BAR(90052.05,DUZ(2),"
+5 SET DIC(0)="ZAEMQ"
+6 SET DIC("A")="Select Visit LOCATION: "
+7 DO ^DIC
+8 KILL DIC
+9 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+10 IF +Y<1
QUIT
+11 SET BARY("LOC")=+Y
+12 SET BARY("LOC","NM")=Y(0,0)
+13 QUIT
+14 ; **************
TYP ; EP
+1 ; Select BILLING ENTITY Inclusion Parameter
+2 ; May not specify both billing entity and a/r account
+3 KILL DIR,BARY("TYP"),BARY("ACCT"),BARY("PAT"),BARY("ALL"),BARY("ITYP")
+4 ; - BAR1.8*23 UPDATED DISPATCH TABLE
+5 SET DIR(0)="SO^1:MEDICARE"
+6 SET DIR(0)=DIR(0)_";2:MEDICAID"
+7 SET DIR(0)=DIR(0)_";3:PRIVATE INSURANCE"
+8 SET DIR(0)=DIR(0)_";4:NON-BENEFICIARY PATIENTS"
+9 SET DIR(0)=DIR(0)_";5:BENEFICIARY PATIENTS"
+10 SET DIR(0)=DIR(0)_";6:SPECIFIC A/R ACCOUNT"
+11 SET DIR(0)=DIR(0)_";7:SPECIFIC PATIENT"
+12 SET DIR(0)=DIR(0)_";8:WORKMEN'S COMP"
+13 SET DIR(0)=DIR(0)_";9:PRIVATE + WORKMEN'S COMP"
+14 SET DIR(0)=DIR(0)_";10:CHIP"
+15 SET DIR(0)=DIR(0)_";11:VETERANS ADMINISTRATION"
+16 SET DIR(0)=DIR(0)_";12:OTHER"
+17 SET DIR("A")="Select TYPE of BILLING ENTITY to Display"
+18 SET DIR("?")="Enter TYPE of BILLING ENTITY to display, or press <return> for ALL"
+19 DO ^DIR
+20 KILL DIR
+21 IF $DATA(DUOUT)!($DATA(DTOUT))
QUIT
+22 IF Y<1
QUIT
+23 SET BARY("TYP")=U_Y_U
+24 SET BARY("TYP","NM")=Y(0)
+25 IF Y=6
GOTO ACCT
IF Y=7
GOTO PAT
+26 ;P.OTT UPDATED DISPATCH TABLE BAR1.8*23
+27 IF Y=1
SET BARY("TYP")="^R^MH^MD^MC^MMC^"
+28 IF Y=2
SET BARY("TYP")="^D^K^FPL^"
+29 IF Y=3
SET BARY("TYP")="^H^M^P^F^"
+30 IF Y=4
SET BARY("TYP")="^N^"
+31 IF Y=5
SET BARY("TYP")="^I^"
+32 IF Y=8
SET BARY("TYP")="^W^"
+33 IF Y=9
SET BARY("TYP")="^H^M^P^F^W^"
+34 IF Y=10
SET BARY("TYP")="^K^"
+35 IF Y=11
SET BARY("TYP")="^V^"
+36 IF Y=12
SET BARY("TYP")="^W^C^N^I^T^G^SEP^TSI^"
+37 QUIT
+38 ; ***********
ACCT ;
+1 ; Specific insurer of billing entity parameter
+2 KILL DIC
+3 KILL BARY("TYP"),BARY("ACCT")
+4 SET DIC="^BARAC(DUZ(2),"
+5 SET DIC(0)="ZQEAM"
+6 DO ^DIC
+7 KILL DIC
+8 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+9 IF +Y<0
QUIT
+10 SET BARY("ACCT")=+Y
+11 SET BARY("ACCT","NM")=Y(0,0)
+12 IF $GET(BAR("OPT"))="STA"
FOR BARGRPI=1:1
DO GETGRP
IF +Y<0
QUIT
+13 QUIT
+14 ; *******
GETGRP ; Prompt for Group # ;New Tag... M819*ADD*TMM*20100720
+1 WRITE !
+2 KILL DIC
+3 SET DIC="^AUTNEGRP("
+4 SET DIC("A")="ENTER IN THE GROUP NUMBER YOU WISH TO REPORT: "
+5 SET DIC(0)="AEQMZ"
+6 DO ^DIC
+7 IF Y'>0
QUIT
+8 SET BARY("GRP PLAN")=$GET(BARGRPI)
+9 ;Y=Group Plan, Y(0,0)=Group Plan Name
SET BARY("GRP PLAN",+Y)=Y(0,0)
+10 ;END 1.8*19
+11 QUIT
+12 ;
PAT ;
+1 ; Specific patient of billing entity parameter
+2 KILL BARY("TYP"),BARY("PAT")
+3 SET DIC="^AUPNPAT("
+4 SET DIC(0)="ZQEAM"
+5 DO ^DIC
+6 KILL DIC
+7 IF $DATA(DTOUT)!($DATA(DUOUT))
QUIT
+8 KILL AUPNLK("ALL")
+9 IF +Y<0
QUIT
+10 SET BARY("PAT")=+Y
+11 SET BARY("PAT","NM")=Y(0,0)
+12 QUIT
+13 ; **********
ALL ; EP
+1 ; Select ALLOWANCE CATEGORY Inclusion Parameter BAR1.8*23
+2 KILL DIR,BARY("TYP"),BARY("ACCT"),BARY("PAT"),BARY("ALL"),BARY("ITYP")
+3 ;JULY 2003
SET DIR(0)="SO^1:MEDICARE (INS TYPES R MD MH MC MMC)"
+4 SET DIR(0)=DIR(0)_";2:MEDICAID (INS TYPES D K FPL)"
+5 SET DIR(0)=DIR(0)_";3:PRIVATE INSURANCE (INS TYPES P H F M)"
+6 SET DIR(0)=DIR(0)_";4:VETERANS (INS TYPES V)"
+7 SET DIR(0)=DIR(0)_";5:OTHER (INS TYPES W C N I G T SEP TSI)"
+8 SET DIR("A")="Select TYPE of ALLOWANCE CATEGORY to Display"
+9 SET DIR("?")="Enter TYPE of ALLOWANCE CATEGORY to display, or press <return> for ALL"
+10 DO ^DIR
+11 KILL DIR
+12 IF $DATA(DUOUT)!($DATA(DTOUT))
SET BARDONE3=1
QUIT
+13 IF Y<1
SET BARDONE3=1
QUIT
+14 SET BARY("ALL")=Y
+15 SET BARY("ALL","NM")=Y(0)
+16 QUIT
+17 ; *******************
DT ; EP
+1 ; Select Date inclusion parameter
+2 DO DT^BARRSL4
+3 QUIT
+4 ; **************************
PRV ; EP
+1 ; Select Provider Inclusion Parameter
+2 DO PRV^BARRSL4
+3 QUIT
+4 ; *******************************
AR ; EP
+1 ; Select A/R Clerk Inclusion Parameter
+2 DO AR^BARRSL4
+3 QUIT
+4 ; ******************
BATCH ; EP
+1 ; Select Collection Batch Inclusion Parameter
+2 DO BATCH^BARRSL4
+3 QUIT
+4 ; *******
ITEM ; EP
+1 ; Select Collection Batch Item Inclusion Parameter
+2 DO ITEM^BARRSL4
+3 QUIT
+4 ; *************
RTYP ; EP
+1 ; Select Report Type Inclusion Parameter
+2 DO RTYP^BARRSL4
+3 QUIT
+4 ; *********************
DSVC ; EP Select One Discharge Service
+1 DO DSVC^BARRSL4
+2 QUIT
+3 ; ******************** BAR1.8*23
ASKICD() ;
+1 DO ASKICD^BARRSL4()
+2 QUIT Y
CLNUPDX ;CLEAN UP DX
+1 DO CLNUPDX^BARRSL4
+2 QUIT
DX ; EP
+1 ;^
SET BARQ=0
+2 KILL BARY("DX9")
+3 KILL BARY("DX10")
+4 KILL BARY("DX-ICDVER")
DXCODE ;
+1 ;S BARICDV=$$ASKICD() I BARICDV="^" D QUIT ;OLD CODE BAR1.8*24
+2 ;FIXED RETURN TO SELECT INCLUSION PARAMETERS
+3 ;NEW CODE BAR1.8*24
SET BARICDV=$$ASKICD()
IF BARICDV="^"
SET DUOUT=0
SET DIRUT=0
Begin DoDot:1
+4 DO CLNUPDX
End DoDot:1
QUIT
+5 IF Y="B"!(Y=10)
IF $TEXT(+1^ICDEX)=""
Begin DoDot:1
+6 WRITE !!!,"NOTE: SOME OF THE ICD-10 INFRASTRUCTURE UTILITIES ARE MISSING."
+7 WRITE !,"THIS REPORT CANNOT CURRENTLY PROVIDE ANY DATA BASED ON ICD-10 DX CODES"
+8 QUIT
End DoDot:1
GOTO DXCODE
+9 SET BARY("DX-ICDVER")=BARICDV
+10 IF BARY("DX-ICDVER")=9
Begin DoDot:1
+11 DO DX9
IF $GET(BARQ)
QUIT
+12 DO DXADD(9)
IF $GET(BARQ)
QUIT
End DoDot:1
IF $GET(BARQ)
QUIT
+13 IF BARY("DX-ICDVER")=10
Begin DoDot:1
+14 DO DX10
IF $GET(BARQ)
QUIT
+15 DO DXADD(10)
IF $GET(BARQ)
QUIT
End DoDot:1
IF $GET(BARQ)
QUIT
+16 IF BARY("DX-ICDVER")="B"
Begin DoDot:1
+17 DO DX9
IF $GET(BARQ)
QUIT
+18 DO DXADD(9)
IF $GET(BARQ)
QUIT
+19 DO DX10
IF $GET(BARQ)
QUIT
+20 DO DXADD(10)
IF $GET(BARQ)
QUIT
End DoDot:1
IF $GET(BARQ)
QUIT
+21 IF BARY("DX-ICDVER")=9!(BARY("DX-ICDVER")="B")
IF '$DATA(BARY("DX9"))
Begin DoDot:1
+22 KILL BARY("DX9")
+23 ;- BAR1.8*24
SET BARY("DX9")="ALL"
+24 SET BARY("DX9_ALL")="ALL"
End DoDot:1
+25 IF BARY("DX-ICDVER")=10!(BARY("DX-ICDVER")="B")
IF '$DATA(BARY("DX10"))
Begin DoDot:1
+26 KILL BARY("DX10")
+27 ;- BAR1.8*24
SET BARY("DX10")="ALL"
+28 SET BARY("DX10_ALL")="ALL"
End DoDot:1
+29 WRITE !!
+30 DO SHOWDX
+31 SET DIR("A")="Are you OK with this selection"
+32 SET DIR("B")="YES"
+33 SET DIR(0)="Y"
+34 DO ^DIR
+35 KILL DIR
+36 IF Y'=1
Begin DoDot:1
+37 WRITE !,"OK, make a new DX selection"
End DoDot:1
GOTO DX
+38 QUIT
+39 ;
DX9 ;<-------
+1 ;
DXLOW9 ;
+1 KILL BARY("DX9")
+2 KILL DIR,DIC,DA
+3 WRITE !!
+4 WRITE "Entry of Diagnosis Range ICD-9",!
+5 WRITE "=============================="
+6 SET DIR(0)="PO^80:ZAEMQ"
+7 SET DIR("A")="Low ICD-9 Code (from) "
+8 ;
IF $$HAVICD10()
SET DIR("S")="I $P($G(^ICD9(Y,1)),U)=1"
+9 DO ^DIR
+10 ;3/25
IF $GET(DUOUT)
SET BARQ=1
QUIT
+11 ;ENTER: GO FOR INDIVIDUAL DX
IF +Y<1
QUIT
+12 SET BARY("DX9",1)=$PIECE(Y,U,2)
+13 ;
DXHI9 ;
+1 SET DIR(0)="PO^80:ZAEMQ"
+2 SET DIR("A")="High ICD-9 Code (to) "
+3 IF $$HAVICD10()
SET DIR("S")="I $P($G(^ICD9(Y,1)),U)=1"
+4 DO ^DIR
+5 IF $GET(DUOUT)
SET BARQ=1
QUIT
+6 ;IF LO DEFINED, ENTER
IF $DATA(BARY("DX9",1))
IF +Y<1
GOTO DXLOW9
+7 ;ENTER
IF +Y<1
QUIT
+8 SET BARY("DX9",2)=$PIECE(Y,U,2)
+9 ; - BAR1.8*24
IF BARY("DX9",1)=BARY("DX9",2)
QUIT
+10 IF BARY("DX9",1)>BARY("DX9",2)!('+BARY("DX9",1)&($EXTRACT(BARY("DX9",1),2,9)>$EXTRACT(BARY("DX9",2),2,9)))
Begin DoDot:1
+11 WRITE !!,*7,"INPUT ERROR: Low Diagnosis is Greater than the High, TRY AGAIN!",!!
End DoDot:1
GOTO DXLOW9
+12 QUIT
+13 ; **********************
DXADD(BARICD) ;
+1 NEW BARDXTYP
+2 SET BARDXTYP="DX"_BARICD
+3 KILL BARY(BARDXTYP,3)
+4 FOR
DO ADDDX(BARICD)
IF $GET(BARQ)
QUIT
IF Y<0
QUIT
+5 KILL BARY(BARDXTYP,4)
+6 WRITE !!
+7 QUIT
ADDDX(BARICD) ;ADD ONE OR MORE SINGLE DG INTO BARY("DX9",3 or BARY("DX10",3
+1 KILL DIR,DIC,DA,BARDX
+2 NEW BARDXTYP
+3 SET BARDXTYP="DX"_BARICD
+4 IF $ORDER(BARY(BARDXTYP,3,""))]""
DO LIST(BARICD)
+5 WRITE !!
+6 WRITE "Entry of Diagnosis Code ICD-",BARICD,!
+7 WRITE "=============================="
+8 SET DIR(0)="PO^80:ZAEMQ"
+9 SET DIR("A")="Individual ICD-"_BARICD_" Code"
+10 IF BARICD=9
IF $$HAVICD10()
SET DIR("S")="I $P($G(^ICD9(Y,1)),U)=1"
+11 IF BARICD=10
IF $$HAVICD10()
SET DIR("S")="I $P($G(^ICD9(Y,1)),U)=30"
+12 DO ^DIR
+13 ;3/25
IF $GET(DUOUT)
SET BARQ=1
QUIT
+14 ;I $D(DIRUT) Q
+15 IF +Y<1
QUIT
+16 SET BARDX=$PIECE(Y,U,2)
+17 IF BARDX=""
SET BARQ1=1
QUIT
+18 IF $DATA(BARY(BARDXTYP,3,BARDX))
Begin DoDot:1
+19 WRITE !," Removed from selection."
+20 KILL BARY(BARDXTYP,3,BARDX)
End DoDot:1
QUIT
+21 SET BARY(BARDXTYP,3,BARDX)=""
WRITE !," Added to selection."
QUIT
+22 QUIT
CONTDX(BARICD) ;
+1 QUIT
+2 KILL DIR,DIC,DA
+3 NEW BARDXTYP,BARDX1
+4 SET BARDXTYP="DX"_BARICD
+5 SET Y=0
KILL DIRUT
+6 SET DIR("A")="DX-"_BARICD_" code which begins "
+7 SET DIR(0)="FUO^3:30"
+8 SET DIR("?")="Enter partial DX"_BARICD_" code (begins with)"
+9 IF BARICD=9
SET DIR("?")=DIR("?")_" in form NNN."
+10 IF BARICD=9
SET DIR("?")=DIR("?")_"in form ANN (A=A...Z N=1...0)."
+11 DO ^DIR
+12 IF Y=""
SET Y=-1
QUIT
+13 SET BARDX1=Y
+14 DO LIST^BARRSLDX(BARDX1,0)
+15 IF 'BARCNT
WRITE " no matching DXs found"
QUIT
+16 IF $DATA(BARY(BARDXTYP,4,BARDX1))
Begin DoDot:1
+17 IF '$$ASKREM()
QUIT
+18 KILL BARY(BARDXTYP,4,BARDX1)
+19 WRITE !,BARDX1,