source: WorldVistAEHR/trunk/r/SURGERY-SR/SROMOD0.m@ 1211

Last change on this file since 1211 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 6.8 KB
RevLine 
[613]1SROMOD0 ;BIR/ADM - CPT MODIFIER INPUT ;08/01/05
2 ;;3.0; Surgery ;**142**;24 Jun 93
3 Q
4DISPLAY ; display name with modifier
5 N SRY,SRDA,SRDATE S SRDATE=DT
6 S SRDA=$S($G(SRTN):SRTN,$D(DA(1)):DA(1),$D(DA):DA,1:"")
7 I $G(SRDA) S SRDATE=$P($G(^SRF(SRDA,0)),"^",9)
8 S SRY=$$MOD^ICPTMOD(Y,"I",SRDATE) Q:$P(SRY,"^")=-1
9 S Y=$P(SRY,"^",2)_" "_$P(SRY,"^",3)
10 Q
11SCR27() ; screen for acceptable CPT code/modifier pair for principal procedure
12 N SRCODE,SRDA,SRCMOD,SROK,SRSDATE,SRZ D PCHK K SRM
13 Q SROK
14PCHK ; return value of modifier if acceptable for principal procedure
15 N SRSDATE S SRSDATE=DT
16 S SROK=0,SRCODE="",SRDA=$S($G(SRTN):SRTN,$D(DA(1)):DA(1),$D(DA):DA,1:""),SRM=$S($D(SRM):SRM,1:+Y)
17 I SRDA S SRSDATE=$P(^SRF(SRDA,0),"^",9),SRCODE=$P($G(^SRO(136,SRDA,0)),"^",2)
18 I 'SRCODE Q
19 S SRZ=$P($$MODP^ICPTMOD(SRCODE,SRM,"I",SRSDATE),"^") I SRZ>0 S SROK=SRZ
20 Q
21OTH() ; screen for acceptable CPT code/modifier pair for other procedure
22 N SRCODE,SRDA,SRCMOD,SROK,SROTH,SRSDATE,SRZ D OCHK K SRM
23 Q SROK
24OCHK ; return value of modifier if acceptable for other procedure
25 N SRSDATE S SRSDATE=DT
26 S SROK=0,SRCODE="",SRDA=$S($G(SRTN):SRTN,$D(DA(2)):DA(2),$D(DA(1)):DA(1),$D(D0):D0,1:""),SROTH=$S($D(DA):DA,$D(D1):D1,1:""),SRM=$S($D(SRM):SRM,1:+Y)
27 I SRDA&SROTH S SRSDATE=$P(^SRF(SRDA,0),"^",9),SRCODE=$P($G(^SRO(136,SRDA,3,SROTH,0)),"^")
28 I 'SRCODE Q
29 S SRZ=$P($$MODP^ICPTMOD(SRCODE,SRM,"I",SRSDATE),"^") I SRZ>0 S SROK=SRZ
30 Q
31PRIN ; enter CPT modifiers for principal CPT code
32 Q:$E($G(IOST),1,2)'="C-"!($G(DIK)'="")
33 N SRCODE,SRDA,SRDEF,SRIEN,SRJ,SRQ,SRSDATE,SRSEL,SRSOUT,SRX,SRY,Z
34 S (SRQ,SRSOUT)=0,SRDA=DA,SRCODE=$P(^SRO(136,SRDA,0),"^",2),SRIEN=$O(^SRO(136,SRDA,1,"AAA"),-1)
35 I SRIEN S SRX=$P(^SRO(136,SRDA,1,SRIEN,0),"^"),SRCMOD=$P($$MOD^ICPTMOD(SRX,"I"),"^",2)
36 K DIR F D K SRM,SRCMOD Q:SRSOUT S SRQ=0
37 .S DIR("A")=" Modifier: ",DIR(0)="136.01,.01AO" S:$G(SRCMOD)'="" DIR("B")=SRCMOD D:$O(^SRO(136,SRDA,1,0)) QUES
38 .D ^DIR K DIR S DA=SRDA I $D(DTOUT)!$D(DUOUT)!(X="") S SRSOUT=1 Q
39 .I +Y S SRJ=0 F S SRJ=$O(^SRO(136,SRDA,1,SRJ)) Q:'SRJ I $P(^SRO(136,SRDA,1,SRJ,0),"^")=+Y N DIR D Q
40 ..S SRSEL=Y(0),DIR(0)="136.01,.01AO",DIR("A")=" Modifier: ",DIR("B")=$P(Y(0),"^")
41 ..D ^DIR S DA=SRDA I $D(DTOUT)!$D(DUOUT)!(X="") S SRSOUT=1 Q
42 ..I +Y S SRK=0 F S SRK=$O(^SRO(136,SRDA,1,SRK)) Q:'SRK I $P(^SRO(136,SRDA,1,SRK,0),"^")=+Y S SRQ=1 Q
43 ..Q:SRQ I +Y S $P(^SRO(136,SRDA,1,SRJ,0),"^")=+Y,SRQ=1 Q
44 ..I X="@" S SRY(136.01,SRJ_","_SRDA_",",.01)="@" D FILE^DIE("","SRY"),EN^DDIOL(" ... Modifier deleted","","?20") S SRQ=1
45 .Q:SRQ!SRSOUT
46 .I +Y S SRY(136.01,"+1,"_DA_",",.01)=+Y D UPDATE^DIE("","SRY") Q
47 .I X="@",$D(SRCMOD) S SRY(136.01,SRIEN_","_SRDA_",",.01)="@" D FILE^DIE("","SRY"),EN^DDIOL(" ... Modifier deleted","","?20")
48 Q
49OPROC ; enter CPT modifiers for other CPT code
50 N SRCODE,SRDA,SRDEF,SRIEN,SRJ,SRQ,SRSDATE,SRSEL,SRSOUT,SRX,SRY,Z S (SRQ,SRSOUT)=0,SRCODE=X N X I $D(SRCMOD) D OHYPH
51 S SRDA=DA,SRDA(1)=DA(1),SRIEN=$O(^SRO(136,SRDA(1),3,SRDA,1,"A"),-1) I SRIEN S SRX=$P(^SRO(136,SRDA(1),3,SRDA,1,SRIEN,0),"^"),SRCMOD=$P($$MOD^ICPTMOD(SRX,"I"),"^",2)
52 K DIR F D K SRM,SRCMOD Q:SRSOUT S SRQ=0
53 .S DIR("A")=" Modifier: ",DIR(0)="136.31,.01AO" S:$G(SRCMOD)'="" DIR("B")=SRCMOD D:$O(^SRO(136,SRDA(1),3,SRDA,1,0)) QUES1
54 .D ^DIR K DIR S DA=SRDA,DA(1)=SRDA(1) I $D(DTOUT)!$D(DUOUT)!(X="") S SRSOUT=1 Q
55 .I +Y S SRJ=0 F S SRJ=$O(^SRO(136,SRDA(1),3,SRDA,1,SRJ)) Q:'SRJ I $P(^SRO(136,SRDA(1),3,SRDA,1,SRJ,0),"^")=+Y N DIR D Q
56 ..S SRSEL=Y(0),DIR(0)="136.31,.01AO",DIR("A")=" Modifier: ",DIR("B")=$P(Y(0),"^")
57 ..D ^DIR S DA=SRDA I $D(DTOUT)!$D(DUOUT)!(X="") S SRSOUT=1 Q
58 ..I +Y S SRK=0 F S SRK=$O(^SRO(136,SRDA(1),3,SRDA,1,SRK)) Q:'SRK I $P(^SRO(136,SRDA(1),3,SRDA,1,SRK,0),"^")=+Y S Y="" Q
59 ..I X="@" S SRY(136.31,SRJ_","_SRDA_","_SRDA(1)_",",.01)="@" D FILE^DIE("","SRY"),EN^DDIOL(" ... Modifier deleted","","?20") S SRQ=1
60 .Q:SRQ!SRSOUT
61 .I +Y S SRY(136.31,"+1,"_DA_","_DA(1)_",",.01)=+Y D UPDATE^DIE("","SRY") Q
62 .I X="@",$D(SRCMOD) S SRY(136.31,SRIEN_","_SRDA_",",SRDA(1)_",",.01)="@" D FILE^DIE("","SRY"),EN^DDIOL(" ... Modifier deleted","","?20")
63 Q
64KOMOD ; delete other CPT modifiers when CPT code is edited
65 I $D(SRDIRED) S SRDIRED=1 Q:'$D(DA)
66 N SRCODE,SRDA,SRJ,SRY S SRDA=$G(DA),SRDA(1)=$G(DA(1)) Q:'SRDA!'SRDA(1)
67 S SRCODE=X,SRJ=0 F S SRJ=$O(^SRO(136,SRDA(1),3,SRDA,1,SRJ)) Q:'SRJ D
68 .S SRY(136.31,SRJ_","_SRDA_","_SRDA(1)_",",.01)="@" D FILE^DIE("","SRY")
69 S X=SRCODE
70 Q
71PHYPH ; called from input transform to process hyphenated modifier list
72 Q:$E($G(IOST),1,2)'="C-"!($G(DIK)'="")
73 N SRSDATE,SRDA,SRDUP,SRJ,SRLIST,SRM,SRN,SROK,SRY,SRZ S SRCODE=X D KPMOD S X=SRCODE Q:'$D(SRCMOD)
74 S SRLIST=SRCMOD,SRSDATE=DT,SRDA=$S($G(SRTN):SRTN,$D(DA(1)):DA(1),$D(DA):DA,1:"")
75 S:SRDA SRSDATE=$P(^SRF(SRDA,0),"^",9)
76 F SRN=1:1 S SRCMOD=$P(SRLIST,",",SRN) Q:SRCMOD="" D
77 .S (SRDUP,SROK)=0
78 .S SRM=$P($$MOD^ICPTMOD(SRCMOD),"^") K:SRM<0 SRM I $D(SRM) D K SRM
79 ..S SROK=0,SRM=$S($D(SRM):SRM,1:+Y)
80 ..S SRZ=$P($$MODP^ICPTMOD(SRCODE,SRM,"I",SRSDATE),"^") I SRZ>0 S SROK=SRZ
81 .I 'SROK&($E($G(IOST),1,2)="C-") D EN^DDIOL("CPT Modifier '"_SRCMOD_"' is not acceptable with this CPT code.","","!") K SRCMOD Q
82 .S SRJ=0 F S SRJ=$O(^SRO(136,SRDA,1,SRJ)) Q:'SRJ I $P(^SRO(136,SRDA,1,SRJ,0),"^")=SROK S SRDUP=1 Q
83 .I 'SRDUP S SRY(136.01,"+1,"_DA_",",.01)=SROK D UPDATE^DIE("","SRY")
84 S X=SRCODE
85 Q
86KPMOD ; delete principal CPT modifiers when CPT code is edited
87 N SRDA,SRJ,SRY
88 S SRDA=DA,SRJ=0 F S SRJ=$O(^SRO(136,SRDA,1,SRJ)) Q:'SRJ D
89 .S SRY(136.01,SRJ_","_SRDA_",",.01)="@" D FILE^DIE("","SRY")
90 Q
91OHYPH ; input CPT hyphenated modifier for other procedure
92 N SRCODE,SRDA,SRDUP,SRLIST,SRN,SROK,SROTH,SRY S SRLIST=SRCMOD
93 F SRN=1:1 S SRCMOD=$P(SRLIST,",",SRN) Q:SRCMOD="" D
94 .S (SRDUP,SROK)=0
95 .S SRM=$P($$MOD^ICPTMOD(SRCMOD),"^") K:SRM<0 SRM I $D(SRM) D OCHK K SRM
96 .I 'SROK D EN^DDIOL("CPT Modifier '"_SRCMOD_"' is not acceptable with this CPT code.","","!") K SRCMOD Q
97 .S SRJ=0 F S SRJ=$O(^SRO(136,SRDA,3,SROTH,1,SRJ)) Q:'SRJ I $P(^SRO(136,SRDA,3,SROTH,1,SRJ,0),"^")=SROK S SRDUP=1 Q
98 .I 'SRDUP S SRY(136.31,"+1,"_DA_","_DA(1)_",",.01)=SROK D UPDATE^DIE("","SRY")
99 Q
100QUES N SRI,SRMD,SRX,SRY,SRZ S DIR("?",1)=" Answer with PRIN PROCEDURE CPT MODIFIER",DIR("?",2)="Choose from:"
101 S SRI=0,SRCT=3 F S SRI=$O(^SRO(136,SRDA,1,SRI)) Q:'SRI S SRMD=$P(^SRO(136,SRDA,1,SRI,0),"^") D
102 .S SRX=$$MOD^ICPTMOD(SRMD,"I",$P($G(^SRF(SRDA,0)),"^",9)),SRY=$P(SRX,"^",2),SRZ=$P(SRX,"^",3)
103 .S DIR("?",SRCT)=" "_SRY_" "_SRZ,SRCT=SRCT+1
104 S DIR("?",SRCT)="",DIR("?")=" You may enter a new PRIN PROCEDURE CPT MODIFIER, if you wish."
105 Q
106QUES1 N SRI,SRMD,SRX,SRY,SRZ S DIR("?",1)=" Answer with OTHER PROCEDURE CPT MODIFIER",DIR("?",2)="Choose from:"
107 S SRI=0,SRCT=3 F S SRI=$O(^SRO(136,SRDA(1),3,SRDA,1,SRI)) Q:'SRI S SRMD=$P(^SRO(136,SRDA(1),3,SRDA,1,SRI,0),"^") D
108 .S SRX=$$MOD^ICPTMOD(SRMD,"I",$P($G(^SRF(SRDA,0)),"^",9)),SRY=$P(SRX,"^",2),SRZ=$P(SRX,"^",3)
109 .S DIR("?",SRCT)=" "_SRY_" "_SRZ,SRCT=SRCT+1
110 S DIR("?",SRCT)="",DIR("?")=" You may enter a new OTHER PROCEDURE CPT MODIFIER, if you wish."
111 Q
112
Note: See TracBrowser for help on using the repository browser.