72 lines
3.4 KiB
Mathematica
72 lines
3.4 KiB
Mathematica
SROCPT0 ;BIR/ADM - CPT CODING UTILITY ;04/20/05
|
|
;;3.0; Surgery ;**142**;24 Jun 93
|
|
1 N SRCODE,SRDA,SRDATE,SRDES,SRI,SRX
|
|
S SRDATE=DT
|
|
S SRDA=$S($G(SRTN):SRTN,$D(DA(1)):DA(1),$D(DA):DA,1:"")
|
|
I $G(SRDA) S SRDATE=$P($G(^SRF(SRDA,0)),"^",9)
|
|
S SRDATE=$S($G(ICPTVDT):ICPTVDT,1:SRDATE)
|
|
S SRCODE=Y,SRX=$$CPTD^ICPTCOD(SRCODE,"SRDES",,SRDATE)
|
|
F SRI=1:1:SRX D:$TR(SRDES(SRI)," ")'="" EN^DDIOL(SRDES(SRI),"","!,?1")
|
|
Q
|
|
DISPLAY ; output principal CPT
|
|
I $D(Y),Y="" Q
|
|
N SRCODE,SRCPT,SRDA,SRDES,SRI,SRK,SRP,SRW,SRX,SRY,SRZ
|
|
S Y=$P($$CPT^ICPTCOD(Y),"^",2),SRDA=$S($D(SRTN):SRTN,1:"") Q:SRDA=""
|
|
I $D(QPQPQ)!$D(SRDIE) D SSPRIN Q
|
|
D DES I '$O(^SRO(136,SRDA,1,0)) Q
|
|
S SRCPT="Principal CPT Code: "_SRW D EN^DDIOL(SRCPT,"","!,?6")
|
|
S SRX="Modifiers: -"
|
|
S SRI=0 F S SRI=$O(^SRO(136,SRDA,1,SRI)) Q:'SRI D
|
|
.S SRZ=$P(^SRO(136,SRDA,1,SRI,0),"^"),SRY=$$MOD^ICPTMOD(SRZ,"I",$P($G(^SRF(SRDA,0)),"^",9)),SRX=SRX_$P(SRY,"^",2)_" "_$E($P(SRY,"^",3),1,57) D EN^DDIOL(SRX,"","!,?7") S SRX=" -"
|
|
W !
|
|
Q
|
|
OTHDISP ; output other procedure CPT
|
|
I $D(Y),Y="" Q
|
|
N SRCODE,SRCPT,SRDA,SRDES,SRI,SRK,SRP,SRW,SRX,SRY,SRZ
|
|
S Y=$P($$CPT^ICPTCOD(Y),"^",2),SRDA(1)=$S($D(SRTN):SRTN,1:""),SRDA=$S($D(DA):DA,1:"") Q:SRDA(1)=""!(SRDA="")
|
|
I $D(QPQPQ)!$D(SRDIE) D SSOTH Q
|
|
D DES I '$O(^SRO(136,SRDA(1),3,SRDA,1,0)) Q
|
|
S SRCPT="Other CPT Code: "_SRW D EN^DDIOL(SRCPT,"","!,?6")
|
|
S SRX="Modifiers: -"
|
|
S SRI=0 F S SRI=$O(^SRO(136,SRDA(1),3,SRDA,1,SRI)) Q:'SRI D
|
|
.S SRZ=$P(^SRO(136,SRDA(1),3,SRDA,1,SRI,0),"^"),SRY=$$MOD^ICPTMOD(SRZ,"I",$P($G(^SRF(SRDA(1),0)),"^",9)),SRX=SRX_$P(SRY,"^",2)_" "_$E($P(SRY,"^",3),1,57) D EN^DDIOL(SRX,"","!,?7") S SRX=" -"
|
|
Q
|
|
DES ; get short name and description
|
|
N X,Z,SRDAA,SRDD S (SRCODE,SRK)=Y,SRDAA=$S($D(SRTN):SRTN,$D(SRDA(1)):SRDA(1),$D(SRDA):SRDA,1:"")
|
|
S SRDD=DT I $G(SRDAA) S SRDD=$E($P(^SRF(SRDAA,0),"^",9),1,7)
|
|
S SRY=$$CPT^ICPTCOD(SRCODE,SRDD),SRK=$P(SRY,"^",2),SRW=SRK_" "_$P(SRY,"^",3)
|
|
S SRY=$$CPTD^ICPTCOD(SRCODE,"SRDES",,SRDD),SRK=SRK_" " F SRI=1:1:SRY D Q:$L(SRK_" "_X)>245 S SRK=SRK_" "_X
|
|
.S X=SRDES(SRI) F S Z=$F(X," ") Q:'Z S X=$E(X,1,Z-2)_$E(X,Z,255)
|
|
S Y=SRK
|
|
Q
|
|
ACTIV(SRTN,SRCODE) ; screen for active CPT codes
|
|
K ICPTVDT
|
|
N SROK,SRSDATE S SROK=1,SRSDATE=DT
|
|
I $G(SRTN) S SRSDATE=$E($P(^SRF(SRTN,0),"^",9),1,7)
|
|
S SROK=$P($$CPT^ICPTCOD(SRCODE,SRSDATE),"^",7),ICPTVDT=SRSDATE
|
|
Q SROK
|
|
IN ; check CPT input
|
|
N SRX,SRCPT K SRCMOD S SRX=X,SRCPT=$P(SRX,"-"),SRCMOD=$P(SRX,"-",2) I SRCMOD="" K SRCMOD
|
|
S X=SRCPT
|
|
Q
|
|
DUP ; check for duplicate other procedure CPT
|
|
N SRX,SRQ
|
|
S (SRQ,SRX)=0 F S SRX=$O(^SRO(136,SRTN,3,SRX)) Q:'SRX D Q:SRQ
|
|
.I $D(DA),SRX=DA S SRQ=1 Q
|
|
.I $P($G(^SRO(136,SRTN,3,SRX,0)),U)=X D EN^DDIOL("This code has already been selected. Please try again.","","!,?5") K X S SRQ=1 Q
|
|
Q
|
|
SSPRIN ; append CPT modifiers to principal CPT code
|
|
N SRCMOD,SRCOMMA,SRCPT,SRI,SRM,X I $O(^SRO(136,SRTN,1,0)) D
|
|
.S (SRCOMMA,SRI)=0,SRCMOD="",SRCPT=Y_"-" F S SRI=$O(^SRO(136,SRTN,1,SRI)) Q:'SRI D
|
|
..S SRM=$P(^SRO(136,SRTN,1,SRI,0),"^"),SRCMOD=$P($$MOD^ICPTMOD(SRM,"I"),"^",2)
|
|
..S SRCPT=SRCPT_$S(SRCOMMA:",",1:"")_SRCMOD,SRCOMMA=1
|
|
.S Y=SRCPT
|
|
Q
|
|
SSOTH ; append CPT modifiers to other CPT code
|
|
N SRCMOD,SRCOMMA,SRCPT,SRI,SRM,X I $O(^SRO(136,SRTN,3,SRDA,1,0)) D
|
|
.S (SRCOMMA,SRI)=0,SRCMOD="",SRCPT=Y_"-" F S SRI=$O(^SRO(136,SRTN,3,SRDA,1,SRI)) Q:'SRI D
|
|
..S SRM=$P(^SRO(136,SRTN,3,SRDA,1,SRI,0),"^"),SRCMOD=$P($$MOD^ICPTMOD(SRM,"I"),"^",2)
|
|
..S SRCPT=SRCPT_$S(SRCOMMA:",",1:"")_SRCMOD,SRCOMMA=1
|
|
.S Y=SRCPT
|
|
Q
|