ECBEP2A ;BIR/MAM,JPW-Batch Enter by Procedure (cont'd) ;1 May 96
;;2.0; EVENT CAPTURE ;**4,5,10,13,17,18,23,33,41,42,54,72,76**;8 May 96;Build 6
EN ;entry pt
D HDR
S CNT=0
PATS ; get patients
W ! Q:ECOUT=1 K ECADD
K DIC,DUOUT S DIC=2,DIC(0)="QEAMZ",DIC("A")=$S($D(ECPT):"Select Next Patient: ",1:"Select Patient: ")
D ^DIC K DIC S OK=0
I $D(DUOUT)!($D(DTOUT)) S ECOUT=1 Q
I Y<0,CNT=0 S ECOUT=2 Q
I Y<0 D G:ECOUT'=2 PATS I ECOUT=2 D KILL Q
.D LIST Q:ECOUT Q:'$O(ECPT(0)) Q:$G(ECADD)="A"
.S ECTWO=0 K ECHOICE D ^ECBEP2B S ECOUT=2
I $O(ECPT(0)) S JJ="" F S JJ=$O(ECPT(JJ)) Q:'JJ!(OK=1) I +$G(ECPT(JJ))=+Y S OK=1 W !!,"Patient already selected. Please select another patient.",!
I OK=1 G PATS
N YY,ECUP D I $G(ECUP)="^" G PATS
. S YY=Y,DFN=+Y D 2^VADPT S Y=YY I +VADM(6) D
. . W !!,"WARNING ",VADM(7),!!
. . R "Press Return to Continue or ^ to Deselect: ",ECUP:DTIME
S CNT=CNT+1,CNT1=CNT,ECPT(CNT)=+Y_"^"_$P(Y,"^",2) D ASK
G PATS
;
LIST ; list patients
K ECADD
W @IOF,!,"Patients Selected for Batch Entry: ",! F I=0:0 S I=$O(ECPT(I)) Q:'I W:I#2 ! W:I#2=0 ?40 W I_". "_$P(ECPT(I),"^",2)
W !!,"Is this list correct ? YES// " R ECYN:DTIME I '$T!(ECYN="^") S ECOUT=1 Q
S ECYN=$E(ECYN) S:ECYN="" ECYN="Y" I "YyNn"'[ECYN W !!,"Enter <RET> if this list is complete, or NO to add or delete",!,"patients on the list.",!!,"Press <RET> to continue " R X:DTIME G LIST
I "Yy"[ECYN Q:$O(ECPT(0)) D NOBODY Q:ECOUT
ADD W !!,"Add or Delete Patients ? ADD// " R ECADD:DTIME I '$T!(ECADD="^") S ECOUT=1 Q
S ECADD=$E(ECADD) S:ECADD="" ECADD="A" I "AaDd"'[ECADD W !!,"Enter <RET> to make additions to the list, or D to delete a ",!,"patient from the list." K ECADD G ADD
Q:ECADD="A"
DEL ; delete patients from list
I '$D(ECPT(1)) D NOBODY Q:ECOUT G LIST
W !!,"Select Number: " R X:DTIME I '$T!(X="^") S ECOUT=1 Q
I X="" Q
I '$D(ECPT(X)) W !!,"Select the number corresponding to the patient that you would like",!,"to remove from the list.",!!,"Press <RET> to continue " R X:DTIME S ECMORE=1 D LIST Q:ECOUT G DEL
F I=X+1:1:CNT S ECPT(I-1)=ECPT(I)
K ECPT(CNT),I S CNT=CNT-1
W !!,"Patient deleted.",!!,"Press <RET> to continue " R X:DTIME
G LIST
Q
HDR ;
W @IOF,!,"Location: ",ECLN
W !,"DSS Unit: ",ECDN
I $G(ECCN)]"" W !,"Category: ",ECCN
W !,"Procedure: "_$S(ECCPT'="":ECPTCD_" ",1:"")_$E(ECPN,1,50)
W $S(SYN'["NOT DEFINED":" ["_SYN_"]",1:"")_" (#"_NATN_")"
;- Display CPT procedure Modifiers
I ECCPT'="" N MOD S MOD="" F S MOD=$O(ECMOD(ECCPT,MOD)) Q:MOD="" D
. W !?1,"Modifier: "," - ",MOD," ",$E($P(ECMOD(ECCPT,MOD),U),1,55)
W !,"Procedure Date: ",ECDATE
W ! D DSP1416^ECPRVMUT(.ECPRVARY)
W !
Q
;
NOBODY ;No patients selected
I $D(ECADD),ECADD="D" W !!,"You cannot delete patients when your patient list is empty."
I $G(ECADD)'="D" W !!,"You have selected no patients."
R !!,"Do you wish to quit? Y//",X:DTIME S X=$E(X) I '$T!(X="^") S ECOUT=1 Q
S:X="" X="Y" I "yY"[X S ECOUT=1 Q
I "nN"'[X W !,"Answer ""N"" to continue selection, or enter return to quit",! G NOBODY
Q
ADCAT ;add category/procedures for patients
;D ^ECBEN2A I ECOUT=1 Q
;W !!! K DIR,DIRUT,DA S DIR(0)="Y",DIR("A")="Do you want to enter another category and procedure for these patients" D ^DIR Q:$D(DIRUT)!'Y
Q
KILL ;kill arrays and variables
K ECSC,ECZEC,ECIR,ECDX,ECDXN,ECVST,ECINP,ECAO,ECPTSTAT,ECMST,ECHNC,ECCV
K ECA,ECHOICE,ECJLP,ECPT,ECO,ECON,ECV,ECDXS,ECDXIEN,ECSHAD
S ECOUT=0
Q
ASK ; ask ord sect & vol
W !!,"DSS Unit: "_ECDN,?50,"Category: "_ECCN,!
W "Procedure: "_$S(ECCPT="":"",1:ECPTCD_" ")_$E(ECPN,1,50)
W $S(SYN'["NOT DEFINED":" ["_SYN_"]",1:"")_" (#"_NATN_")",!
;- Display CPT procedure Modifiers
I ECCPT'="" N MOD S MOD="" F S MOD=$O(ECMOD(ECCPT,MOD)) Q:MOD="" D
. W ?1,"Modifier: "," - ",MOD," ",$E($P(ECMOD(ECCPT,MOD),U),1,55),!
W "Patient: ",$P(ECPT(CNT),"^",2),!
;
;- Determine inpatient/outpatient status
S ECPTSTAT=$$INOUTPT^ECUTL0(+$G(ECPT(CNT)),+$G(ECDT))
I ECPTSTAT="" D INOUTERR^ECUTL0 Q
;
;- Determine patient eligibility
I $$CHKDSS^ECUTL0(+$G(ECD),ECPTSTAT) D
. I $$MULTELG^ECUTL0(+$G(ECPT(CNT))) S ECELIG=+$$ELGLST^ECUTL0
. E S ECELIG=+$G(VAEL(1))
K VAEL
;
;- Display inpatient/outpatient status message
D DSPSTAT^ECUTL0(ECPTSTAT)
;
O ; ord sect
K DIC,DUOUT S DIC=723,DIC(0)="QEAMZ",DIC("A")="Ordering Section: "
D ^DIC K DIC I Y<0 D DELPT(.CNT) Q
S ECO=+Y,ECON=$P(Y,"^",2)
V ; vol
S:'VOL VOL=1
W !,"Volume: "_VOL_"//" R X:DTIME I '$T S ECOUT=1 Q
I X="^" D DELPT(.CNT) Q
S:X="" X=VOL I X'?1.2N!'X W !!,"Enter a whole number between 1 and 99." G V
S ECV=X
DIAG ;diagnosis, in/outpatient, visit
S (ECDX,ECDXN,ECINP,ECVST,ECSC,ECAO,ECIR,ECZEC,ECMST,ECHNC,ECCV)=""
S ECDFN=$P(ECPT(CNT),U),ECSHAD=""
I $P(ECPCE,"~",2)="N" G NODE
D PCEQST^ECBEN2U
I ECOUT D DELPT(.CNT) Q
NODE ;set node
;- Get associated clinic from event code screen and DSS ID if null
S:$G(EC4)="" EC4=$P($G(^ECJ(+$O(^ECJ("AP",+ECL,+ECD,+ECC,$G(ECP),0)),"PRO")),"^",4)
S EC4N=$S($P($G(^SC(+EC4,0)),"^")]"":$P(^(0),"^"),1:"NO ASSOCIATED CLINIC"),ECID=$P($G(^SC(+EC4,0)),"^",7)
S ECPT(CNT)=ECPT(CNT)_"^"_ECO_"^"_ECON_"^"_ECV_"^"_ECDX_"^"_$S(ECINP="":$G(ECPTSTAT),1:ECINP)_"^"_ECVST_"^"_ECSC_"^"_ECAO_"^"_ECIR_"^"_ECZEC_"^"_EC4_"^"_ECID_"^"_ECMST_"^"_ECHNC_"^"_ECCV_"^"_ECSHAD
I $D(ECDXS) M ECPT(CNT,"DXS")=ECDXS K ECDXS
S ECELPT(CNT)=$S($G(ECELIG):ECELIG,1:"") K ECPTSTAT
Q
;
DELPT(CNT) ;deselect patient due to missing required data
N DIR,Y
K ECPT(CNT) S CNT=CNT-1
W !,"Required data missing.",!,"Patient deselected...",!
S ECOUT=0
S DIR(0)="E",DIR("A")="Press RETURN to continue"
D ^DIR
W !
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HECBEP2A 5700 printed Dec 13, 2024@01:56:58 Page 2
ECBEP2A ;BIR/MAM,JPW-Batch Enter by Procedure (cont'd) ;1 May 96
+1 ;;2.0; EVENT CAPTURE ;**4,5,10,13,17,18,23,33,41,42,54,72,76**;8 May 96;Build 6
EN ;entry pt
+1 DO HDR
+2 SET CNT=0
PATS ; get patients
+1 WRITE !
if ECOUT=1
QUIT
KILL ECADD
+2 KILL DIC,DUOUT
SET DIC=2
SET DIC(0)="QEAMZ"
SET DIC("A")=$SELECT($DATA(ECPT):"Select Next Patient: ",1:"Select Patient: ")
+3 DO ^DIC
KILL DIC
SET OK=0
+4 IF $DATA(DUOUT)!($DATA(DTOUT))
SET ECOUT=1
QUIT
+5 IF Y<0
IF CNT=0
SET ECOUT=2
QUIT
+6 IF Y<0
Begin DoDot:1
+7 DO LIST
if ECOUT
QUIT
if '$ORDER(ECPT(0))
QUIT
if $GET(ECADD)="A"
QUIT
+8 SET ECTWO=0
KILL ECHOICE
DO ^ECBEP2B
SET ECOUT=2
End DoDot:1
if ECOUT'=2
GOTO PATS
IF ECOUT=2
DO KILL
QUIT
+9 IF $ORDER(ECPT(0))
SET JJ=""
FOR
SET JJ=$ORDER(ECPT(JJ))
if 'JJ!(OK=1)
QUIT
IF +$GET(ECPT(JJ))=+Y
SET OK=1
WRITE !!,"Patient already selected. Please select another patient.",!
+10 IF OK=1
GOTO PATS
+11 NEW YY,ECUP
Begin DoDot:1
+12 SET YY=Y
SET DFN=+Y
DO 2^VADPT
SET Y=YY
IF +VADM(6)
Begin DoDot:2
+13 WRITE !!,"WARNING ",VADM(7),!!
+14 READ "Press Return to Continue or ^ to Deselect: ",ECUP:DTIME
End DoDot:2
End DoDot:1
IF $GET(ECUP)="^"
GOTO PATS
+15 SET CNT=CNT+1
SET CNT1=CNT
SET ECPT(CNT)=+Y_"^"_$PIECE(Y,"^",2)
DO ASK
+16 GOTO PATS
+17 ;
LIST ; list patients
+1 KILL ECADD
+2 WRITE @IOF,!,"Patients Selected for Batch Entry: ",!
FOR I=0:0
SET I=$ORDER(ECPT(I))
if 'I
QUIT
if I#2
WRITE !
if I#2=0
WRITE ?40
WRITE I_". "_$PIECE(ECPT(I),"^",2)
+3 WRITE !!,"Is this list correct ? YES// "
READ ECYN:DTIME
IF '$TEST!(ECYN="^")
SET ECOUT=1
QUIT
+4 SET ECYN=$EXTRACT(ECYN)
if ECYN=""
SET ECYN="Y"
IF "YyNn"'[ECYN
WRITE !!,"Enter <RET> if this list is complete, or NO to add or delete",!,"patients on the list.",!!,"Press <RET> to continue "
READ X:DTIME
GOTO LIST
+5 IF "Yy"[ECYN
if $ORDER(ECPT(0))
QUIT
DO NOBODY
if ECOUT
QUIT
ADD WRITE !!,"Add or Delete Patients ? ADD// "
READ ECADD:DTIME
IF '$TEST!(ECADD="^")
SET ECOUT=1
QUIT
+1 SET ECADD=$EXTRACT(ECADD)
if ECADD=""
SET ECADD="A"
IF "AaDd"'[ECADD
WRITE !!,"Enter <RET> to make additions to the list, or D to delete a ",!,"patient from the list."
KILL ECADD
GOTO ADD
+2 if ECADD="A"
QUIT
DEL ; delete patients from list
+1 IF '$DATA(ECPT(1))
DO NOBODY
if ECOUT
QUIT
GOTO LIST
+2 WRITE !!,"Select Number: "
READ X:DTIME
IF '$TEST!(X="^")
SET ECOUT=1
QUIT
+3 IF X=""
QUIT
+4 IF '$DATA(ECPT(X))
WRITE !!,"Select the number corresponding to the patient that you would like",!,"to remove from the list.",!!,"Press <RET> to continue "
READ X:DTIME
SET ECMORE=1
DO LIST
if ECOUT
QUIT
GOTO DEL
+5 FOR I=X+1:1:CNT
SET ECPT(I-1)=ECPT(I)
+6 KILL ECPT(CNT),I
SET CNT=CNT-1
+7 WRITE !!,"Patient deleted.",!!,"Press <RET> to continue "
READ X:DTIME
+8 GOTO LIST
+9 QUIT
HDR ;
+1 WRITE @IOF,!,"Location: ",ECLN
+2 WRITE !,"DSS Unit: ",ECDN
+3 IF $GET(ECCN)]""
WRITE !,"Category: ",ECCN
+4 WRITE !,"Procedure: "_$SELECT(ECCPT'="":ECPTCD_" ",1:"")_$EXTRACT(ECPN,1,50)
+5 WRITE $SELECT(SYN'["NOT DEFINED":" ["_SYN_"]",1:"")_" (#"_NATN_")"
+6 ;- Display CPT procedure Modifiers
+7 IF ECCPT'=""
NEW MOD
SET MOD=""
FOR
SET MOD=$ORDER(ECMOD(ECCPT,MOD))
if MOD=""
QUIT
Begin DoDot:1
+8 WRITE !?1,"Modifier: "," - ",MOD," ",$EXTRACT($PIECE(ECMOD(ECCPT,MOD),U),1,55)
End DoDot:1
+9 WRITE !,"Procedure Date: ",ECDATE
+10 WRITE !
DO DSP1416^ECPRVMUT(.ECPRVARY)
+11 WRITE !
+12 QUIT
+13 ;
NOBODY ;No patients selected
+1 IF $DATA(ECADD)
IF ECADD="D"
WRITE !!,"You cannot delete patients when your patient list is empty."
+2 IF $GET(ECADD)'="D"
WRITE !!,"You have selected no patients."
+3 READ !!,"Do you wish to quit? Y//",X:DTIME
SET X=$EXTRACT(X)
IF '$TEST!(X="^")
SET ECOUT=1
QUIT
+4 if X=""
SET X="Y"
IF "yY"[X
SET ECOUT=1
QUIT
+5 IF "nN"'[X
WRITE !,"Answer ""N"" to continue selection, or enter return to quit",!
GOTO NOBODY
+6 QUIT
ADCAT ;add category/procedures for patients
+1 ;D ^ECBEN2A I ECOUT=1 Q
+2 ;W !!! K DIR,DIRUT,DA S DIR(0)="Y",DIR("A")="Do you want to enter another category and procedure for these patients" D ^DIR Q:$D(DIRUT)!'Y
+3 QUIT
KILL ;kill arrays and variables
+1 KILL ECSC,ECZEC,ECIR,ECDX,ECDXN,ECVST,ECINP,ECAO,ECPTSTAT,ECMST,ECHNC,ECCV
+2 KILL ECA,ECHOICE,ECJLP,ECPT,ECO,ECON,ECV,ECDXS,ECDXIEN,ECSHAD
+3 SET ECOUT=0
+4 QUIT
ASK ; ask ord sect & vol
+1 WRITE !!,"DSS Unit: "_ECDN,?50,"Category: "_ECCN,!
+2 WRITE "Procedure: "_$SELECT(ECCPT="":"",1:ECPTCD_" ")_$EXTRACT(ECPN,1,50)
+3 WRITE $SELECT(SYN'["NOT DEFINED":" ["_SYN_"]",1:"")_" (#"_NATN_")",!
+4 ;- Display CPT procedure Modifiers
+5 IF ECCPT'=""
NEW MOD
SET MOD=""
FOR
SET MOD=$ORDER(ECMOD(ECCPT,MOD))
if MOD=""
QUIT
Begin DoDot:1
+6 WRITE ?1,"Modifier: "," - ",MOD," ",$EXTRACT($PIECE(ECMOD(ECCPT,MOD),U),1,55),!
End DoDot:1
+7 WRITE "Patient: ",$PIECE(ECPT(CNT),"^",2),!
+8 ;
+9 ;- Determine inpatient/outpatient status
+10 SET ECPTSTAT=$$INOUTPT^ECUTL0(+$GET(ECPT(CNT)),+$GET(ECDT))
+11 IF ECPTSTAT=""
DO INOUTERR^ECUTL0
QUIT
+12 ;
+13 ;- Determine patient eligibility
+14 IF $$CHKDSS^ECUTL0(+$GET(ECD),ECPTSTAT)
Begin DoDot:1
+15 IF $$MULTELG^ECUTL0(+$GET(ECPT(CNT)))
SET ECELIG=+$$ELGLST^ECUTL0
+16 IF '$TEST
SET ECELIG=+$GET(VAEL(1))
End DoDot:1
+17 KILL VAEL
+18 ;
+19 ;- Display inpatient/outpatient status message
+20 DO DSPSTAT^ECUTL0(ECPTSTAT)
+21 ;
O ; ord sect
+1 KILL DIC,DUOUT
SET DIC=723
SET DIC(0)="QEAMZ"
SET DIC("A")="Ordering Section: "
+2 DO ^DIC
KILL DIC
IF Y<0
DO DELPT(.CNT)
QUIT
+3 SET ECO=+Y
SET ECON=$PIECE(Y,"^",2)
V ; vol
+1 if 'VOL
SET VOL=1
+2 WRITE !,"Volume: "_VOL_"//"
READ X:DTIME
IF '$TEST
SET ECOUT=1
QUIT
+3 IF X="^"
DO DELPT(.CNT)
QUIT
+4 if X=""
SET X=VOL
IF X'?1.2N!'X
WRITE !!,"Enter a whole number between 1 and 99."
GOTO V
+5 SET ECV=X
DIAG ;diagnosis, in/outpatient, visit
+1 SET (ECDX,ECDXN,ECINP,ECVST,ECSC,ECAO,ECIR,ECZEC,ECMST,ECHNC,ECCV)=""
+2 SET ECDFN=$PIECE(ECPT(CNT),U)
SET ECSHAD=""
+3 IF $PIECE(ECPCE,"~",2)="N"
GOTO NODE
+4 DO PCEQST^ECBEN2U
+5 IF ECOUT
DO DELPT(.CNT)
QUIT
NODE ;set node
+1 ;- Get associated clinic from event code screen and DSS ID if null
+2 if $GET(EC4)=""
SET EC4=$PIECE($GET(^ECJ(+$ORDER(^ECJ("AP",+ECL,+ECD,+ECC,$GET(ECP),0)),"PRO")),"^",4)
+3 SET EC4N=$SELECT($PIECE($GET(^SC(+EC4,0)),"^")]"":$PIECE(^(0),"^"),1:"NO ASSOCIATED CLINIC")
SET ECID=$PIECE($GET(^SC(+EC4,0)),"^",7)
+4 SET ECPT(CNT)=ECPT(CNT)_"^"_ECO_"^"_ECON_"^"_ECV_"^"_ECDX_"^"_$SELECT(ECINP="":$GET(ECPTSTAT),1:ECINP)_"^"_ECVST_"^"_ECSC_"^"_ECAO_"^"_ECIR_"^"_ECZEC_"^"_EC4_"^"_ECID_"^"_ECMST_"^"_ECHNC_"^"_ECCV_"^"_ECSHAD
+5 IF $DATA(ECDXS)
MERGE ECPT(CNT,"DXS")=ECDXS
KILL ECDXS
+6 SET ECELPT(CNT)=$SELECT($GET(ECELIG):ECELIG,1:"")
KILL ECPTSTAT
+7 QUIT
+8 ;
DELPT(CNT) ;deselect patient due to missing required data
+1 NEW DIR,Y
+2 KILL ECPT(CNT)
SET CNT=CNT-1
+3 WRITE !,"Required data missing.",!,"Patient deselected...",!
+4 SET ECOUT=0
+5 SET DIR(0)="E"
SET DIR("A")="Press RETURN to continue"
+6 DO ^DIR
+7 WRITE !
+8 QUIT