TIUPXAPM ;SLC/RMO - CPT Modifier API(s) ;03/06/03@1500
;;1.0;TEXT INTEGRATION UTILITIES;**82,161**;Jun 20, 1997
;
;Pass in encounter date for CSV **161**
MOD(CPT,TIUI,TIUVDT) ;Select CPT Modifiers for CPT Code
; Input -- CPT CPT Selection Array
; TIUI Item Number in CPT Selection Array
; TIUVDT Encounter Date
; Output -- CPT CPT Selection Array
N CPTIEN,I,MOD,MODATA,MODCNT
S CPTIEN=+CPT(TIUI)
;
;Check if there are any selectable CPT Modifiers for the CPT Code
;Current date passed to ICPTCOD, changed to encounter date for CSV **161**
I +$$CODM^ICPTCOD(CPTIEN,,"",TIUVDT)'>0 G MODQ
;
;Set CPT Modifier Selection Array for pre-selected CPT Modifiers
S (I,MODCNT)=0
F S I=$O(CPT(TIUI,"MOD",I)) Q:'I D
. S MODCNT=MODCNT+1
. S MOD(+$G(CPT(TIUI,"MOD",MODCNT)))=""
;
;Display pre-selected CPT Modifiers
D DISMOD(.CPT,TIUI,1)
;
;Ask CPT Modifiers
S MODCNT=$S($G(MODCNT):MODCNT,1:0)
;Pass encounter date to ASKMOD for CSV **161**
F Q:'$$ASKMOD(CPTIEN,.MOD,MODCNT,.MODATA,TIUVDT) D
. S MOD(+MODATA)=""
. S MODCNT=MODCNT+1
. S CPT(TIUI,"MOD",MODCNT)=MODATA
. S MODATA=""
MODQ Q
;
;Pass in encounter date for CSV **161**
ASKMOD(CPTIEN,MOD,MODCNT,MODATA,TIUVDT) ;Ask CPT Modifier
; Input -- CPTIEN CPT file (#81) IEN
; MOD CPT Modifier Selection Array
; MODCNT Number of Modifiers Selected
; TIUVDT Encounter Date
; Output -- 1=Successful and 0=Failure
; MODATA Modifier Data from Modifier file (#81.3)
; 1st Piece=IEN
; 2nd Piece=Modifier field (#.01)
; 3rd Piece=Name field (#.02)
N DIR,DTOUT,DUOUT,Y
S DIR(0)="PAO^81.3:AEMQZ^K:'$$CHKMOD^TIUPXAPM(.MOD,+Y) X"
S DIR("A")="Select "_$S($G(MODCNT):"another ",1:"")_"CPT MODIFIER: "
;Pass encounter date to ICPTMOD for CSV **161**
S DIR("S")="I +$$MODP^ICPTMOD(CPTIEN,+Y,""I"",TIUVDT)>0"
D ^DIR
I Y>0 S MODATA=+Y_U_$P(Y(0),U,1,2)
Q $S($G(MODATA)="":0,1:1)
;
CHKMOD(MOD,MODIEN) ;Check Selected CPT Modifier
; Input -- MOD CPT Modifier Selection Array
; MODIEN Modifier file (#81.3) IEN
; Output -- 1=Successful and 0=Failure
N Y
S Y=1
;Check if CPT Modifier has already been selected
I $D(MOD(MODIEN)) D EN^DDIOL("This CPT Modifier has already been selected.","","!?5") S Y=0
Q +$G(Y)
;
DISMOD(CPT,TIUI,TIUSELF) ;Display Selected CPT Modifiers
; Input -- CPT CPT Selection Array
; TIUI Item Number in CPT Selection Array
; TIUSELF Selection Process Flag (Optional)
; 1=Selection Process
; Output -- None
N CAP,MODATA,MODCNT,TC
;
;Set caption and format parameter
I $G(TIUSELF) D
. S CAP="Current CPT Modifiers:",TC=0
ELSE D
. S CAP="CPT Modifier(s):",TC=8
S MODCNT=0
F S MODCNT=$O(CPT(TIUI,"MOD",MODCNT)) Q:'MODCNT D
. S MODATA=$G(CPT(TIUI,"MOD",MODCNT))
. W:MODCNT=1 !,?TC,CAP
. W !?12,"-",$P(MODATA,U,2),?19,$P(MODATA,U,3)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HTIUPXAPM 3045 printed Dec 13, 2024@02:44:48 Page 2
TIUPXAPM ;SLC/RMO - CPT Modifier API(s) ;03/06/03@1500
+1 ;;1.0;TEXT INTEGRATION UTILITIES;**82,161**;Jun 20, 1997
+2 ;
+3 ;Pass in encounter date for CSV **161**
MOD(CPT,TIUI,TIUVDT) ;Select CPT Modifiers for CPT Code
+1 ; Input -- CPT CPT Selection Array
+2 ; TIUI Item Number in CPT Selection Array
+3 ; TIUVDT Encounter Date
+4 ; Output -- CPT CPT Selection Array
+5 NEW CPTIEN,I,MOD,MODATA,MODCNT
+6 SET CPTIEN=+CPT(TIUI)
+7 ;
+8 ;Check if there are any selectable CPT Modifiers for the CPT Code
+9 ;Current date passed to ICPTCOD, changed to encounter date for CSV **161**
+10 IF +$$CODM^ICPTCOD(CPTIEN,,"",TIUVDT)'>0
GOTO MODQ
+11 ;
+12 ;Set CPT Modifier Selection Array for pre-selected CPT Modifiers
+13 SET (I,MODCNT)=0
+14 FOR
SET I=$ORDER(CPT(TIUI,"MOD",I))
if 'I
QUIT
Begin DoDot:1
+15 SET MODCNT=MODCNT+1
+16 SET MOD(+$GET(CPT(TIUI,"MOD",MODCNT)))=""
End DoDot:1
+17 ;
+18 ;Display pre-selected CPT Modifiers
+19 DO DISMOD(.CPT,TIUI,1)
+20 ;
+21 ;Ask CPT Modifiers
+22 SET MODCNT=$SELECT($GET(MODCNT):MODCNT,1:0)
+23 ;Pass encounter date to ASKMOD for CSV **161**
+24 FOR
if '$$ASKMOD(CPTIEN,.MOD,MODCNT,.MODATA,TIUVDT)
QUIT
Begin DoDot:1
+25 SET MOD(+MODATA)=""
+26 SET MODCNT=MODCNT+1
+27 SET CPT(TIUI,"MOD",MODCNT)=MODATA
+28 SET MODATA=""
End DoDot:1
MODQ QUIT
+1 ;
+2 ;Pass in encounter date for CSV **161**
ASKMOD(CPTIEN,MOD,MODCNT,MODATA,TIUVDT) ;Ask CPT Modifier
+1 ; Input -- CPTIEN CPT file (#81) IEN
+2 ; MOD CPT Modifier Selection Array
+3 ; MODCNT Number of Modifiers Selected
+4 ; TIUVDT Encounter Date
+5 ; Output -- 1=Successful and 0=Failure
+6 ; MODATA Modifier Data from Modifier file (#81.3)
+7 ; 1st Piece=IEN
+8 ; 2nd Piece=Modifier field (#.01)
+9 ; 3rd Piece=Name field (#.02)
+10 NEW DIR,DTOUT,DUOUT,Y
+11 SET DIR(0)="PAO^81.3:AEMQZ^K:'$$CHKMOD^TIUPXAPM(.MOD,+Y) X"
+12 SET DIR("A")="Select "_$SELECT($GET(MODCNT):"another ",1:"")_"CPT MODIFIER: "
+13 ;Pass encounter date to ICPTMOD for CSV **161**
+14 SET DIR("S")="I +$$MODP^ICPTMOD(CPTIEN,+Y,""I"",TIUVDT)>0"
+15 DO ^DIR
+16 IF Y>0
SET MODATA=+Y_U_$PIECE(Y(0),U,1,2)
+17 QUIT $SELECT($GET(MODATA)="":0,1:1)
+18 ;
CHKMOD(MOD,MODIEN) ;Check Selected CPT Modifier
+1 ; Input -- MOD CPT Modifier Selection Array
+2 ; MODIEN Modifier file (#81.3) IEN
+3 ; Output -- 1=Successful and 0=Failure
+4 NEW Y
+5 SET Y=1
+6 ;Check if CPT Modifier has already been selected
+7 IF $DATA(MOD(MODIEN))
DO EN^DDIOL("This CPT Modifier has already been selected.","","!?5")
SET Y=0
+8 QUIT +$GET(Y)
+9 ;
DISMOD(CPT,TIUI,TIUSELF) ;Display Selected CPT Modifiers
+1 ; Input -- CPT CPT Selection Array
+2 ; TIUI Item Number in CPT Selection Array
+3 ; TIUSELF Selection Process Flag (Optional)
+4 ; 1=Selection Process
+5 ; Output -- None
+6 NEW CAP,MODATA,MODCNT,TC
+7 ;
+8 ;Set caption and format parameter
+9 IF $GET(TIUSELF)
Begin DoDot:1
+10 SET CAP="Current CPT Modifiers:"
SET TC=0
End DoDot:1
+11 IF '$TEST
Begin DoDot:1
+12 SET CAP="CPT Modifier(s):"
SET TC=8
End DoDot:1
+13 SET MODCNT=0
+14 FOR
SET MODCNT=$ORDER(CPT(TIUI,"MOD",MODCNT))
if 'MODCNT
QUIT
Begin DoDot:1
+15 SET MODATA=$GET(CPT(TIUI,"MOD",MODCNT))
+16 if MODCNT=1
WRITE !,?TC,CAP
+17 WRITE !?12,"-",$PIECE(MODATA,U,2),?19,$PIECE(MODATA,U,3)
End DoDot:1
+18 QUIT