ECBEP1B ;BIR/MAM,JPW-Batch Entry by Procedure (cont'd) ;30 Apr 96
;;2.0; EVENT CAPTURE ;**1,4,5,10,13,17,18,42,47,54,72,76**;8 May 96;Build 6
CHK ; check unit for valid categories
K ECC,ECCN,ECHOICE,ECEC,ECSTOP
S (COUNT,EC1)=0
D CATS^ECHECK1 S ECONE=""
I '$D(ECC(1)) S ECC=0,ECCN="None",ECONE=0 G P
I '$D(ECC(2)) S ECC=+ECC(1),ECCN=$P(ECC(1),"^",2),ECONE=1 G P
CATS ; select category
S X="",CNT=0
LIST D HDRP^ECBEN2U S JJ=0 W !,"Categories within "_ECDN_": ",!
S EC1=0
F S CNT=$O(ECC(CNT)) Q:'CNT!$D(ECHOICE) D:($Y+5>IOSL) SELC Q:$D(ECHOICE) I X="" W !,CNT_".",?5,$P(ECC(CNT),"^",2)
I '$D(ECSTOP),$D(ECHOICE) S ECONE=2 G P
PICK W !!,"Select Number: " R X:DTIME I '$T!("^"[X) S ECOUT=1 Q
I X="" S ECOUT=2 Q
I '$D(ECC(X)) W !!,"Select the number corresponding to the category, or ^ to quit.",!!,"Press <RET> to continue " R X:DTIME S CNT=CNT-5,X="" G LIST
S ECHOICE=1,ECC=$P(ECC(X),"^"),ECCN=$P(ECC(X),"^",2),ECONE=2
P ;check for valid procedures
D PROS^ECHECK1
I '$O(^TMP("ECPRO",$J,0)) D Q:ECOUT
.W !!,"Within the ",ECLN," location there are no procedures defined",!
.W "for the DSS Unit ",ECDN,". Please select another DSS Unit.",!!
.W "Press <RET> to continue " R X:DTIME S ECOUT=2 Q
D HDRP^ECBEN2U
P1 ;
I '$D(^TMP("ECPRO",$J,2)) S CNT=1,ECONE=ECONE_"^1" D SETP W !,"Procedure: " D G CHKP
. W $S(ECCPT="":"",1:ECPTCD_" ")_$E(ECPN,1,50)
. W $S(SYN'["NOT DEFINED":" ["_SYN_"]",1:"")_" (#"_NATN_")",!
P2 ;ask mul proc
S ECX="",(ECPCNT,CNT,OK)=0,EC1=1 K ECHOICE,ECSTOP
S DIR("?")="^D PROS^ECBEP1B"
S ECX=$$GETPRO^ECDSUTIL
I +$G(ECX)=-1,(COUNT=0) S ECOUT=2 D KILLV^ECDSUTIL Q
I +$G(ECX)=-1,COUNT G FILE
I +$G(ECX)=1 D SRCHTM^ECDSUTIL(ECX)
S ECPCNT=+$G(ECPCNT)
I ECPCNT=-1!(ECPCNT=-2) D G P2
.; Don't display spacebar/return error msg since only 1 procedure
. D ERRMSG^ECDSUTIL
. D KILLV^ECDSUTIL
I ECPCNT>0 D G CHKP
. S CNT=ECPCNT
. D SETP
. S OK=1,ECONE=ECONE_"^2"
. D KILLV^ECDSUTIL
I 'ECPCNT,$D(ECPNAME) S CNT=$$PRLST^ECDSUTIL
I CNT=-1 D MSG^ECBEN2U,KILLV^ECDSUTIL Q
I CNT>0 D G CHKP
. D SETP
. S OK=1,ECONE=ECONE_"^2"
. D KILLV^ECDSUTIL
Q
;
PROS ;
S X="",CNT=0 K ECHOICE
LISTP D HDRP^ECBEN2U S JJ=1 W !,"Available Procedures within "_ECDN_": ",!
W ?72,"National",!,?5,"Procedure Name",?40,"Synonym",?72,"Number",!
S EC1=1
F S CNT=$O(^TMP("ECPRO",$J,CNT)) Q:'CNT!$D(ECHOICE) D:($Y+5>IOSL) SELC Q:$D(ECHOICE) I X="" W !,CNT_".",?5,$E($P(^TMP("ECPRO",$J,CNT),"^",4),1,30),?38,$E($P(^(CNT),"^",3),1,30),?72,$P(^(CNT),"^",5)
I X="" D
.W !!?5,"Select by number, CPT or national code, procedure name, or synonym.",!?5,"Synonym must be preceded by the & character (example: &TESTSYN).",!
.W ?2,"** Modifier(s) can be appended to a CPT code (ex: CPT code-mod1,mod2,mod3) **",!
Q
;
CHKP ;
;Ask CPT procedure modifiers
I ECCPT'="" D K ECMODF,ECMODS
. S ECMODS=$G(ECMODS)
. S ECMODF=$$ASKMOD^ECUTL(ECCPT,ECMODS,ECDT,.ECMOD,.ECERR)
I $G(ECERR) S ECOUT=2 K ECERR,ECMOD D KILLV^ECDSUTIL Q
;
;- Ask procedure reason
I $G(ECP)]"" S ECSCR=+$O(^ECJ("AP",+ECL,+ECD,+ECC,ECP,0))
K ECPRPTR
I ECSCR>0,($P($G(^ECJ(ECSCR,"PRO")),"^",5)=1),(+$O(^ECL("AD",ECSCR,0))) D
. S ECPRPTR=0
. S DIC="^ECL(",DIC(0)="QEAM"
. S DIC("A")="Procedure Reason: ",DIC("S")="I $P(^(0),U,2)=ECSCR"
. D ^DIC K DIC
. I +Y>0 S ECPRPTR=+Y
K ECSCR W !
;
I $G(ECCN)]"" W !,"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)
;- Display procedure reason
I +$G(ECPRPTR) S ECPRSL=$P($G(^ECL(+ECPRPTR,0)),"^") W !,"Procedure Reason: ",$P($G(^ECR(+ECPRSL,0)),"^")
D DSP1442^ECPRVMUT(.ECPRVARY)
W !
W !!,"Is this information correct ? YES// " R ECYN:DTIME I '$T!(ECYN="^") Q
S ECYN=$E(ECYN) S:ECYN="" ECYN="Y"
I "YyNn"'[ECYN W !!,"Enter <RET> if the information listed above is correct and should be",!,"entered for the patients selected. Enter NO to re-enter the information",!,"for this procedure.",!
I "YyNn"'[ECYN W !!,"Press <RET> to continue " R X:DTIME G CHKP
I "Nn"[ECYN,$P(ECONE,"^")<2,$P(ECONE,"^",2)<2 S ECOUT=2 Q
I "Nn"[ECYN K ECHOICE,ECCN,ECP,ECPN,ECMOD,ECONE,^TMP("ECPRO",$J) G CHK
;
;- File procedure reason in local array ECEC (used in ECBEPF)
S COUNT=COUNT+1,ECEC(COUNT)=ECC_"^"_ECP_"^^^^^^^"_ECCPT_"^"_EC4_"^"_ECID_$S(+$G(ECPRPTR):"^"_ECPRPTR,1:"")
;- File CPT modifiers in local array ECEC
I ECCPT'="",$O(ECMOD(ECCPT,""))'="" D
. M ECEC(COUNT,"MOD")=ECMOD(ECCPT)
FILE ;file proc
I '$D(ECEC(1)) W !!,"No procedures have been selected for filing. Please re-enter the ",!,"information for the procedures, or ^ to exit.",!!,"Press <RET> to continue" R X:DTIME S:X="^" ECOUT=1 K ECTEMP,^TMP("ECPRO",$J) G P
D ^ECBEP2A Q:ECOUT K ECA,ECCN,ECEC,ECHOICE,ECJLP,ECP,ECPN,ECPT,ECO,ECON,ECV,NATN,NODE,SYN,^TMP("ECPRO",$J),ECDX,ECDXN,ECINP,ECCPT,ECSC,ECIR,ECZEC,ECAO,ECVST,ECPTSTAT,ECMST,ECHNC,ECCV,ECSHAD,ECMOD,ECPTCD G CHK
END Q
SETP ;set proc
S ECP=$P(^TMP("ECPRO",$J,CNT),"^"),ECPN=$P(^(CNT),"^",4),SYN=$P(^(CNT),"^",3),NATN=$P(^(CNT),"^",5),VOL=$P(^(CNT),"^",6)
S ECCPT=$S(ECP["EC":$P($G(^EC(725,+ECP,0)),"^",5),1:+ECP)
S ECPTCD="" I ECCPT'="" D
. S ECPTCD=$$CPT^ICPTCOD(ECCPT,ECDT) I +ECPTCD>0 S ECPTCD=$P(ECPTCD,U,2)
W " "_$S(ECCPT="":"",1:ECPTCD_" ")_$E(ECPN,1,50)
W $S(SYN'["NOT DEFINED":" ["_SYN_"]",1:"")_" (#"_NATN_")",!
S EC4=$P(^TMP("ECPRO",$J,CNT),"^",2),EC4=$P($G(^ECJ(+EC4,"PRO")),"^",4)
S EC4N=$S($P($G(^SC(+EC4,0)),"^")]"":$P(^(0),"^"),1:"NO ASSOCIATED CLINIC"),ECID=$P($G(^SC(+EC4,0)),"^",7)
Q
SELC ; select category
W !!,$S(EC1:"Press",1:"Select Number, or press")_" <RET> to continue listing "_$S(EC1:"procedures",1:"categories")_" or '^' to stop: " R X:DTIME I '$T!(X="^") S (ECSTOP,ECHOICE)=1 Q
I X="" W @IOF,!,$S(EC1:"Available Procedures",1:"Categories")_" within ",ECDN," : ",! Q
I 'EC1,'$D(ECC(X)) D MSG1^ECBEN2U S ECOUT=2 Q
I EC1,'$D(^TMP("ECPRO",$J,X)) D MSG1^ECBEN2U S ECOUT=2 Q
S ECHOICE=1
I 'EC1 S ECC=$P(ECC(X),"^"),ECCN=$P(ECC(X),"^",2) Q
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HECBEP1B 6255 printed Dec 13, 2024@01:56:57 Page 2
ECBEP1B ;BIR/MAM,JPW-Batch Entry by Procedure (cont'd) ;30 Apr 96
+1 ;;2.0; EVENT CAPTURE ;**1,4,5,10,13,17,18,42,47,54,72,76**;8 May 96;Build 6
CHK ; check unit for valid categories
+1 KILL ECC,ECCN,ECHOICE,ECEC,ECSTOP
+2 SET (COUNT,EC1)=0
+3 DO CATS^ECHECK1
SET ECONE=""
+4 IF '$DATA(ECC(1))
SET ECC=0
SET ECCN="None"
SET ECONE=0
GOTO P
+5 IF '$DATA(ECC(2))
SET ECC=+ECC(1)
SET ECCN=$PIECE(ECC(1),"^",2)
SET ECONE=1
GOTO P
CATS ; select category
+1 SET X=""
SET CNT=0
LIST DO HDRP^ECBEN2U
SET JJ=0
WRITE !,"Categories within "_ECDN_": ",!
+1 SET EC1=0
+2 FOR
SET CNT=$ORDER(ECC(CNT))
if 'CNT!$DATA(ECHOICE)
QUIT
if ($Y+5>IOSL)
DO SELC
if $DATA(ECHOICE)
QUIT
IF X=""
WRITE !,CNT_".",?5,$PIECE(ECC(CNT),"^",2)
+3 IF '$DATA(ECSTOP)
IF $DATA(ECHOICE)
SET ECONE=2
GOTO P
PICK WRITE !!,"Select Number: "
READ X:DTIME
IF '$TEST!("^"[X)
SET ECOUT=1
QUIT
+1 IF X=""
SET ECOUT=2
QUIT
+2 IF '$DATA(ECC(X))
WRITE !!,"Select the number corresponding to the category, or ^ to quit.",!!,"Press <RET> to continue "
READ X:DTIME
SET CNT=CNT-5
SET X=""
GOTO LIST
+3 SET ECHOICE=1
SET ECC=$PIECE(ECC(X),"^")
SET ECCN=$PIECE(ECC(X),"^",2)
SET ECONE=2
P ;check for valid procedures
+1 DO PROS^ECHECK1
+2 IF '$ORDER(^TMP("ECPRO",$JOB,0))
Begin DoDot:1
+3 WRITE !!,"Within the ",ECLN," location there are no procedures defined",!
+4 WRITE "for the DSS Unit ",ECDN,". Please select another DSS Unit.",!!
+5 WRITE "Press <RET> to continue "
READ X:DTIME
SET ECOUT=2
QUIT
End DoDot:1
if ECOUT
QUIT
+6 DO HDRP^ECBEN2U
P1 ;
+1 IF '$DATA(^TMP("ECPRO",$JOB,2))
SET CNT=1
SET ECONE=ECONE_"^1"
DO SETP
WRITE !,"Procedure: "
Begin DoDot:1
+2 WRITE $SELECT(ECCPT="":"",1:ECPTCD_" ")_$EXTRACT(ECPN,1,50)
+3 WRITE $SELECT(SYN'["NOT DEFINED":" ["_SYN_"]",1:"")_" (#"_NATN_")",!
End DoDot:1
GOTO CHKP
P2 ;ask mul proc
+1 SET ECX=""
SET (ECPCNT,CNT,OK)=0
SET EC1=1
KILL ECHOICE,ECSTOP
+2 SET DIR("?")="^D PROS^ECBEP1B"
+3 SET ECX=$$GETPRO^ECDSUTIL
+4 IF +$GET(ECX)=-1
IF (COUNT=0)
SET ECOUT=2
DO KILLV^ECDSUTIL
QUIT
+5 IF +$GET(ECX)=-1
IF COUNT
GOTO FILE
+6 IF +$GET(ECX)=1
DO SRCHTM^ECDSUTIL(ECX)
+7 SET ECPCNT=+$GET(ECPCNT)
+8 IF ECPCNT=-1!(ECPCNT=-2)
Begin DoDot:1
+9 ; Don't display spacebar/return error msg since only 1 procedure
+10 DO ERRMSG^ECDSUTIL
+11 DO KILLV^ECDSUTIL
End DoDot:1
GOTO P2
+12 IF ECPCNT>0
Begin DoDot:1
+13 SET CNT=ECPCNT
+14 DO SETP
+15 SET OK=1
SET ECONE=ECONE_"^2"
+16 DO KILLV^ECDSUTIL
End DoDot:1
GOTO CHKP
+17 IF 'ECPCNT
IF $DATA(ECPNAME)
SET CNT=$$PRLST^ECDSUTIL
+18 IF CNT=-1
DO MSG^ECBEN2U
DO KILLV^ECDSUTIL
QUIT
+19 IF CNT>0
Begin DoDot:1
+20 DO SETP
+21 SET OK=1
SET ECONE=ECONE_"^2"
+22 DO KILLV^ECDSUTIL
End DoDot:1
GOTO CHKP
+23 QUIT
+24 ;
PROS ;
+1 SET X=""
SET CNT=0
KILL ECHOICE
LISTP DO HDRP^ECBEN2U
SET JJ=1
WRITE !,"Available Procedures within "_ECDN_": ",!
+1 WRITE ?72,"National",!,?5,"Procedure Name",?40,"Synonym",?72,"Number",!
+2 SET EC1=1
+3 FOR
SET CNT=$ORDER(^TMP("ECPRO",$JOB,CNT))
if 'CNT!$DATA(ECHOICE)
QUIT
if ($Y+5>IOSL)
DO SELC
if $DATA(ECHOICE)
QUIT
IF X=""
WRITE !,CNT_".",?5,$EXTRACT($PIECE(^TMP("ECPRO",$JOB,CNT),"^",4),1,30),?38,$EXTRACT($PIECE(^(CNT),"^",3),1,30),?72,$PIECE(^(CNT),"^",5)
+4 IF X=""
Begin DoDot:1
+5 WRITE !!?5,"Select by number, CPT or national code, procedure name, or synonym.",!?5,"Synonym must be preceded by the & character (example: &TESTSYN).",!
+6 WRITE ?2,"** Modifier(s) can be appended to a CPT code (ex: CPT code-mod1,mod2,mod3) **",!
End DoDot:1
+7 QUIT
+8 ;
CHKP ;
+1 ;Ask CPT procedure modifiers
+2 IF ECCPT'=""
Begin DoDot:1
+3 SET ECMODS=$GET(ECMODS)
+4 SET ECMODF=$$ASKMOD^ECUTL(ECCPT,ECMODS,ECDT,.ECMOD,.ECERR)
End DoDot:1
KILL ECMODF,ECMODS
+5 IF $GET(ECERR)
SET ECOUT=2
KILL ECERR,ECMOD
DO KILLV^ECDSUTIL
QUIT
+6 ;
+7 ;- Ask procedure reason
+8 IF $GET(ECP)]""
SET ECSCR=+$ORDER(^ECJ("AP",+ECL,+ECD,+ECC,ECP,0))
+9 KILL ECPRPTR
+10 IF ECSCR>0
IF ($PIECE($GET(^ECJ(ECSCR,"PRO")),"^",5)=1)
IF (+$ORDER(^ECL("AD",ECSCR,0)))
Begin DoDot:1
+11 SET ECPRPTR=0
+12 SET DIC="^ECL("
SET DIC(0)="QEAM"
+13 SET DIC("A")="Procedure Reason: "
SET DIC("S")="I $P(^(0),U,2)=ECSCR"
+14 DO ^DIC
KILL DIC
+15 IF +Y>0
SET ECPRPTR=+Y
End DoDot:1
+16 KILL ECSCR
WRITE !
+17 ;
+18 IF $GET(ECCN)]""
WRITE !,"Category: ",ECCN
+19 WRITE !,"Procedure: ",$SELECT(ECCPT="":"",1:ECPTCD_" ")_$EXTRACT(ECPN,1,50)
+20 WRITE $SELECT(SYN'["NOT DEFINED":" ["_SYN_"]",1:"")_" (#"_NATN_")"
+21 ;
+22 ;- Display CPT procedure Modifiers
+23 IF ECCPT'=""
NEW MOD
SET MOD=""
FOR
SET MOD=$ORDER(ECMOD(ECCPT,MOD))
if MOD=""
QUIT
Begin DoDot:1
+24 WRITE !?1,"Modifier: "," - ",MOD," ",$EXTRACT($PIECE(ECMOD(ECCPT,MOD),U),1,55)
End DoDot:1
+25 ;- Display procedure reason
+26 IF +$GET(ECPRPTR)
SET ECPRSL=$PIECE($GET(^ECL(+ECPRPTR,0)),"^")
WRITE !,"Procedure Reason: ",$PIECE($GET(^ECR(+ECPRSL,0)),"^")
+27 DO DSP1442^ECPRVMUT(.ECPRVARY)
+28 WRITE !
+29 WRITE !!,"Is this information correct ? YES// "
READ ECYN:DTIME
IF '$TEST!(ECYN="^")
QUIT
+30 SET ECYN=$EXTRACT(ECYN)
if ECYN=""
SET ECYN="Y"
+31 IF "YyNn"'[ECYN
WRITE !!,"Enter <RET> if the information listed above is correct and should be",!,"entered for the patients selected. Enter NO to re-enter the information",!,"for this procedure.",!
+32 IF "YyNn"'[ECYN
WRITE !!,"Press <RET> to continue "
READ X:DTIME
GOTO CHKP
+33 IF "Nn"[ECYN
IF $PIECE(ECONE,"^")<2
IF $PIECE(ECONE,"^",2)<2
SET ECOUT=2
QUIT
+34 IF "Nn"[ECYN
KILL ECHOICE,ECCN,ECP,ECPN,ECMOD,ECONE,^TMP("ECPRO",$JOB)
GOTO CHK
+35 ;
+36 ;- File procedure reason in local array ECEC (used in ECBEPF)
+37 SET COUNT=COUNT+1
SET ECEC(COUNT)=ECC_"^"_ECP_"^^^^^^^"_ECCPT_"^"_EC4_"^"_ECID_$SELECT(+$GET(ECPRPTR):"^"_ECPRPTR,1:"")
+38 ;- File CPT modifiers in local array ECEC
+39 IF ECCPT'=""
IF $ORDER(ECMOD(ECCPT,""))'=""
Begin DoDot:1
+40 MERGE ECEC(COUNT,"MOD")=ECMOD(ECCPT)
End DoDot:1
FILE ;file proc
+1 IF '$DATA(ECEC(1))
WRITE !!,"No procedures have been selected for filing. Please re-enter the ",!,"information for the procedures, or ^ to exit.",!!,"Press <RET> to continue"
READ X:DTIME
if X="^"
SET ECOUT=1
KILL ECTEMP,^TMP("ECPRO",$JOB)
GOTO P
+2 DO ^ECBEP2A
if ECOUT
QUIT
KILL ECA,ECCN,ECEC,ECHOICE,ECJLP,ECP,ECPN,ECPT,ECO,ECON,ECV,NATN,NODE,SYN,^TMP("ECPRO",$JOB),ECDX,ECDXN,ECINP,ECCPT,ECSC,ECIR,ECZEC,ECAO,ECVST,ECPTSTAT,ECMST,ECHNC,ECCV,ECSHAD,ECMOD,ECPTCD
GOTO CHK
END QUIT
SETP ;set proc
+1 SET ECP=$PIECE(^TMP("ECPRO",$JOB,CNT),"^")
SET ECPN=$PIECE(^(CNT),"^",4)
SET SYN=$PIECE(^(CNT),"^",3)
SET NATN=$PIECE(^(CNT),"^",5)
SET VOL=$PIECE(^(CNT),"^",6)
+2 SET ECCPT=$SELECT(ECP["EC":$PIECE($GET(^EC(725,+ECP,0)),"^",5),1:+ECP)
+3 SET ECPTCD=""
IF ECCPT'=""
Begin DoDot:1
+4 SET ECPTCD=$$CPT^ICPTCOD(ECCPT,ECDT)
IF +ECPTCD>0
SET ECPTCD=$PIECE(ECPTCD,U,2)
End DoDot:1
+5 WRITE " "_$SELECT(ECCPT="":"",1:ECPTCD_" ")_$EXTRACT(ECPN,1,50)
+6 WRITE $SELECT(SYN'["NOT DEFINED":" ["_SYN_"]",1:"")_" (#"_NATN_")",!
+7 SET EC4=$PIECE(^TMP("ECPRO",$JOB,CNT),"^",2)
SET EC4=$PIECE($GET(^ECJ(+EC4,"PRO")),"^",4)
+8 SET EC4N=$SELECT($PIECE($GET(^SC(+EC4,0)),"^")]"":$PIECE(^(0),"^"),1:"NO ASSOCIATED CLINIC")
SET ECID=$PIECE($GET(^SC(+EC4,0)),"^",7)
+9 QUIT
SELC ; select category
+1 WRITE !!,$SELECT(EC1:"Press",1:"Select Number, or press")_" <RET> to continue listing "_$SELECT(EC1:"procedures",1:"categories")_" or '^' to stop: "
READ X:DTIME
IF '$TEST!(X="^")
SET (ECSTOP,ECHOICE)=1
QUIT
+2 IF X=""
WRITE @IOF,!,$SELECT(EC1:"Available Procedures",1:"Categories")_" within ",ECDN," : ",!
QUIT
+3 IF 'EC1
IF '$DATA(ECC(X))
DO MSG1^ECBEN2U
SET ECOUT=2
QUIT
+4 IF EC1
IF '$DATA(^TMP("ECPRO",$JOB,X))
DO MSG1^ECBEN2U
SET ECOUT=2
QUIT
+5 SET ECHOICE=1
+6 IF 'EC1
SET ECC=$PIECE(ECC(X),"^")
SET ECCN=$PIECE(ECC(X),"^",2)
QUIT
+7 QUIT