source: FOIAVistA/trunk/r/SURGERY-SR/SROCD0.m@ 1713

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

initial load of FOIAVistA 6/30/08 version

File size: 8.2 KB
Line 
1SROCD0 ;BIR/ADM - CASE CODING INPUT/EDIT ;08/01/05
2 ;;3.0; Surgery ;**142,152,159**;24 Jun 93;Build 4
3 ;;
4 ; Reference to CL^SDCO21 supported by DBIA #406
5 ;;
6PRDX ; edit Principal Postop Diagnosis
7 N SRDUP,SRDXY,SRI,SROLD,ENVARR,SCEC,SRNEW,SRNUM S SCEC=$$SCEC()
8 S (SROLD,X)=$P(^SRO(136,SRTN,0),"^",3),SRDIAG="NOT ENTERED" I 'X D PDXEN Q
9 I X S Y=$$ICDDX^ICDCODE(X,$P($G(^SRF(SRTN,0)),"^",9)),SRNUM=$P(Y,U,2),SRDES=$P(Y,U,4),SRDIAG=SRNUM_" "_SRDES
10 W !,"Principal Postop Diagnosis:",!!,?5,"ICD9 Code: "_SRDIAG D:SCEC
11 .D GETS^DIQ(136,SRTN_",",".04:.11","E","ENVARR")
12 .I $D(ENVARR(136,SRTN_",",.04,"E")) D
13 ..N SRCOLSPN S SRCOLSPN=13 W !
14 ..I $D(SRCL(3)) W ?SRCOLSPN,"SC:",$E(ENVARR(136,SRTN_",",.04,"E")) S SRCOLSPN=SRCOLSPN+8
15 ..I $D(SRCL(7)) W ?SRCOLSPN,"CV:",$E(ENVARR(136,SRTN_",",.1,"E")) S SRCOLSPN=SRCOLSPN+8
16 ..I $D(SRCL(1)) W ?SRCOLSPN,"AO:",$E(ENVARR(136,SRTN_",",.05,"E")) S SRCOLSPN=SRCOLSPN+8
17 ..I $D(SRCL(2)) W ?SRCOLSPN,"IR:",$E(ENVARR(136,SRTN_",",.06,"E")) S SRCOLSPN=SRCOLSPN+8
18 ..I $D(SRCL(4)) W ?SRCOLSPN,"SWAC:",$E(ENVARR(136,SRTN_",",.07,"E")) S SRCOLSPN=SRCOLSPN+8
19 ..I $D(SRCL(8)) W ?SRCOLSPN,"SHAD:",$E(ENVARR(136,SRTN_",",.11,"E")) S SRCOLSPN=SRCOLSPN+8
20 ..I $D(SRCL(5)) W ?SRCOLSPN,"MST:",$E(ENVARR(136,SRTN_",",.08,"E")) S SRCOLSPN=SRCOLSPN+8
21 ..I $D(SRCL(6)) W ?SRCOLSPN,"H&N:",$E(ENVARR(136,SRTN_",",.09,"E")) S SRCOLSPN=SRCOLSPN+8
22 K DIR S DIR(0)="SO^1:Update Principal Postop Diagnosis Code;2:Update Service Connected/Environmental Indicators only"
23 S DIR("A")="Enter selection (1 or 2)",DIR("B")=1 D ^DIR I $D(DTOUT)!$D(DUOUT)!'Y Q
24 S SRDXY=Y I SRDXY=1 D PDXEN Q
25 I SRDXY=2 D PSCEI
26 Q
27PRESS W ! K DIR S DIR("A")="Press Enter/Return key to continue ",DIR(0)="FOA" D ^DIR K DIR
28 Q
29PDXEN W ! K DA,DIR S DIR("A")="Principal Postop Diagnosis Code",DIR(0)="136,.03",DIR("B")=$G(SRNUM) D ^DIR K DIR I $D(DTOUT)!$D(DUOUT) Q
30 S SRNEW=+Y I X="@" W !!," Deletion of the Principal Postop Diagnosis Code is not allowed! ??" G PDXEN
31 I X="" W !,"This is a required entry." G PDXEN
32 S (SRDUP,SRI)=0 I SRNEW=SROLD Q
33 I SRNEW,SRNEW'=SROLD F S SRI=$O(SRADIAG(SRI)) Q:'SRI I SRADIAG(SRI)=SRNEW S SRDUP=1 Q
34 I SRDUP D DUP,HDR^SROCD G PDXEN
35 K DR,DIE,DA S DIE=136,DA=SRTN,DR=".03////"_SRNEW D ^DIE K DR,DIE I $D(Y) Q
36 I SRNEW'=SROLD S X=SROLD D PRINASOD^SROCDX2
37 D REMIND
38PSCEI I $P(^SRO(136,SRTN,0),"^",3) D
39 .I SCEC D SCEI^SROCD3 K SRCL Q
40 .W !!," >>> No SC/EI information required for this patient. <<<" D PRESS
41 Q
42POTH W !,"Other Procedures:",!
43 N SRSHT,SRNEW,SROLD,SRPOTH,CNT,OTHER,SROPY K SRSEL S CNT=1,OTH=0 F S OTH=$O(^SRO(136,SRTN,3,OTH)) Q:'OTH!(SRSOUT) D
44 .S X=$P($G(^SRO(136,SRTN,3,OTH,0)),U),CPT1=""
45 .I X S CPT1=X,Y=$$CPT^ICPTCOD(X,$P($G(^SRF(SRTN,0)),"^",9)),SRCPT=$P(Y,U,2),SRSHT=$P(Y,U,3),Y=SRCPT,SRDA=OTH D SSOTH^SROCPT0 S SRCPT=Y,CPT=SRCPT_" "_SRSHT
46 .W !,CNT_". CPT Code: "_CPT
47 .S SRSEL(CNT)=OTH_"^CPT Code: "_CPT_"^"_CPT1_"^"_SRCPT
48 .D OTHADXD^SROCDX1
49 .S CNT=CNT+1
50 W !,CNT_". Enter NEW Other Procedure Code",! K DIR S DIR("A")="Enter selection",DIR(0)="NO^1:"_CNT D ^DIR I $D(DTOUT)!$D(DUOUT) S SRSOUT=1 Q
51 I 'Y,$$ADCHK D DELWRN^SROCDX2,PRESS Q
52 Q:'Y S (OTHCNT,SRDA)=Y W !! I SRDA<CNT D G PH
53 .D HDR^SROCD,OTHCPTD^SROCDX,OTHADX^SROCDX1
54 .K DIR S DIR(0)="SO^1:Update Other Procedure CPT Code;2:Update Associated Diagnoses"
55 .S DIR("A")="Enter selection (1 or 2)",DIR("B")=1 D ^DIR I $D(DTOUT)!$D(DUOUT)!'Y Q
56 .S SROPY=Y I SROPY=1 D OPEN Q
57 .I SROPY=2 D OASS
58 S SRDUP=0 K DIR S DIR("A")="Enter new OTHER PROCEDURE CPT code",DIR(0)="136.03,.01" D ^DIR K DIR S SRNEW=+Y I $D(DTOUT)!$D(DUOUT)!(Y="") G PH
59 S SRX=0 F S SRX=$O(^SRO(136,SRTN,3,SRX)) Q:'SRX I $P($G(^SRO(136,SRTN,3,SRX,0)),U)=SRNEW S SRDUP=1 Q
60 K DD,DO S SRDICN=1,DIC="^SRO(136,SRTN,3,",X=SRNEW,DIC(0)="L" D FILE^DICN K DIC,DD,DO,SRDICN I +Y<0 Q
61 K DA S (SRPOTH,DA)=+Y,DA(1)=SRTN D OPROC^SROMOD0 K DA
62 S SRDA=CNT,OTHER=SRNEW D COTHADX^SROCDX
63PH D HDR^SROCD D POTH
64 Q
65OPEN N SRDIRED W ! S SROLD=$P(SRSEL(SRDA),U,3),SRDIE=1,SRDIRED=0 K DA,DIE,DIR,DR
66 S DA=$P(SRSEL(SRDA),U),DA(1)=SRTN,DIE="^SRO(136,SRTN,3,",DR=".01T" D ^DIE K DIE,DR,SRDIE Q:$D(Y)
67 I 'SRDIRED K DA Q
68 D OPROC^SROMOD0
69 S X=$P($G(^SRO(136,SRTN,3,$P(SRSEL(SRDA),U),0)),"^") I SROLD'=X D SADXO^SROCDX2 K DA
70OASS S SRPOTH=$P(SRSEL(SRDA),U) D COTHADX^SROCDX
71 Q
72DUP K DIR S DIR("A",1)="",DIR("A",2)="This code has already been selected. Please try again.",DIR("A",3)="",DIR("A")="Press the ENTER key to continue",DIR(0)="FO" D ^DIR K DIR
73 Q
74DOTH W !,"Other Postop Diagnosis:",!
75 N CNT,SRDUP,SRI,SRJ,SRNEW,SRX,SCEC,ENVARR,SRNUM S SCEC=$$SCEC()
76 K SRSEL S CNT=1,OTH=0 F S OTH=$O(^SRO(136,SRTN,4,OTH)) Q:'OTH!(SRSOUT) D
77 .S (SRX,X)=$P(^SRO(136,SRTN,4,OTH,0),U),SRDIAG="NOT ENTERED"
78 .I X S Y=$$ICDDX^ICDCODE(X,$P($G(^SRF(SRTN,0)),"^",9)),SRNUM=$P(Y,U,2),SRDES=$P(Y,U,4),SRDIAG=SRNUM_" "_SRDES
79 .W !,CNT_". ICD9 Code: "_SRDIAG S SRSEL(CNT)=OTH_"^ICD9 Code: "_SRDIAG_"^"_SRNUM_"^"_SRX
80 .D:SCEC OIND
81 .S CNT=CNT+1 I 'SCEC W !
82 W !,CNT_". Enter NEW Other Postop Diagnosis Code",! K DIR S DIR("A")="Enter selection",DIR(0)="NO^1:"_CNT D ^DIR I $D(DTOUT)!$D(DUOUT) S SRSOUT=1 Q
83 Q:'Y S SRDA=Y W !! I SRDA<CNT D G DH
84 .D HDR^SROCD W !,"Other Postop Diagnosis:",!!,SRDA_". "_$P(SRSEL(SRDA),U,2) I SCEC S OTH=$P(SRSEL(SRDA),"^") D OIND
85 .K DIR S DIR(0)="SO^1:Update Other Postop Diagnosis Code;2:Update Service Connected/Environmental Indicators only"
86 .S DIR("A")="Enter selection (1 or 2)",DIR("B")=1 D ^DIR I $D(DTOUT)!$D(DUOUT)!'Y Q
87 .S SRDXY=Y D:SRDXY=1 ODXEN D:SRDXY=2 OSCEI Q
88 K DIR,SRCL S DIR("A")="Enter new OTHER POSTOP DIAGNOSIS Code",DIR(0)="136.04,.01" D ^DIR K DIR S SRNEW=+Y I $D(DTOUT)!$D(DUOUT)!(Y="") G DH
89 S (SRDUP,SRI)=0 F S SRI=$O(SRADIAG(SRI)) Q:'SRI I SRADIAG(SRI)=SRNEW S SRDUP=1 Q
90 I SRDUP D DUP G DH
91 S:'$D(DA(1)) DA(1)=SRTN
92 K DD,DO S DIC="^SRO(136,SRTN,4,",X=SRNEW,DIC(0)="L" D FILE^DICN K DA,DD,DIC,DO,DR
93 D REMIND
94DH D PASSDIAG^SROCDX1,ASSDIAG^SROCDX1,HDR^SROCD,DOTH
95 Q
96ODXEN W ! K DIR S SROLD=$P(SRSEL(SRDA),U,4),DIR(0)="136.04,.01",DIR("B")=$P(SRSEL(SRDA),U,3),DIR("A")="Other Postop Diagnosis Code"
97 D ^DIR K DIR S SRNEW=+Y I $D(DTOUT)!$D(DUOUT) Q
98 I X="@" S SRSOUT=0 D I SRSOUT S SRSOUT=0 Q
99 .K DIR S DIR("A")="SURE YOU WANT TO DELETE THE ENTIRE OTHER POSTOP DIAGNOSIS CODE",DIR(0)="YO",DIR("B")="NO"
100 .D ^DIR K DIR I $D(DTOUT)!$D(DUOUT)!'Y S SRSOUT=1 Q
101 .K DA,DIE,DR S DA=$P(SRSEL(SRDA),U),DA(1)=SRTN,DIE="^SRO(136,SRTN,4,",DR=".01///@" D ^DIE
102 .S X=$P(SRSEL(SRDA),U,4) D DELASOC^SROCDX2 K DA,DIE,DR,SRSEL(SRDA)
103 .D REMIND S SRSOUT=1
104 S (SRDUP,SRI)=0 F S SRI=$O(SRADIAG(SRI)) Q:'SRI I SRADIAG(SRI)=SRNEW,SROLD'=SRNEW S SRDUP=1 Q
105 I SRDUP D DUP Q
106 I SRNEW=SROLD Q
107 I SRNEW,SRNEW'=SROLD K DA,DIE,DIR S DA=$P(SRSEL(SRDA),U),DA(1)=SRTN,DIE="^SRO(136,SRTN,4,",DR=".01////"_SRNEW D ^DIE
108 S X=$P(SRSEL(SRDA),U,4) D DELASOC^SROCDX2 K DA,DIE,DR
109 D REMIND
110OSCEI I '$D(SRCL) W !!," >>> No SC/EI information required for this patient. <<<" D PRESS Q
111 D OSCEI^SROCD
112 Q
113SCEC() N SRSDATE,DFN,SCEC S SRSDATE=$S($D(SRTN):$P(^SRF(SRTN,0),U,9),1:DT)
114 S DFN=$P(^SRF(SRTN,0),U) D CL^SDCO21(DFN,SRSDATE,,.SRCL)
115 S SCEC=$S($D(SRCL):1,1:0)
116 Q SCEC
117ADCHK() ; check for other procedures with no associated diagnosis
118 N SRADX,SROTH,SRQ S (SRADX,SROTH,SRQ)=0
119 F S SROTH=$O(^SRO(136,SRTN,3,SROTH)) Q:'SROTH I '$O(^SRO(136,SRTN,3,SROTH,2,0)) S SRADX=1 Q
120 Q SRADX
121REMIND ; display reminder to update procedure/diagnosis associations
122 K DIR W ! S DIR("A",1)="Please review and update procedure associations for this diagnosis."
123 S DIR("A",2)="",DIR("A")="Press Enter/Return key to continue ",DIR(0)="FOA" D ^DIR K DIR
124 Q
125OIND D GETS^DIQ(136.04,OTH_","_SRTN_",",".02:.09","E","ENVARR")
126 I $D(ENVARR(136.04,OTH_","_SRTN_",",.02,"E")) D
127 .N SRCOLSPN S SRCOLSPN=13 W !
128 .I $D(SRCL(3)) W ?SRCOLSPN,"SC:",$E(ENVARR(136.04,OTH_","_SRTN_",",.02,"E")) S SRCOLSPN=SRCOLSPN+8
129 .I $D(SRCL(7)) W ?SRCOLSPN,"CV:",$E(ENVARR(136.04,OTH_","_SRTN_",",.08,"E")) S SRCOLSPN=SRCOLSPN+8
130 .I $D(SRCL(1)) W ?SRCOLSPN,"AO:",$E(ENVARR(136.04,OTH_","_SRTN_",",.03,"E")) S SRCOLSPN=SRCOLSPN+8
131 .I $D(SRCL(2)) W ?SRCOLSPN,"IR:",$E(ENVARR(136.04,OTH_","_SRTN_",",.04,"E")) S SRCOLSPN=SRCOLSPN+8
132 .I $D(SRCL(4)) W ?SRCOLSPN,"SWAC:",$E(ENVARR(136.04,OTH_","_SRTN_",",.07,"E")) S SRCOLSPN=SRCOLSPN+8
133 .I $D(SRCL(8)) W ?SRCOLSPN,"SHAD:",$E(ENVARR(136.04,OTH_","_SRTN_",",.09,"E")) S SRCOLSPN=SRCOLSPN+8
134 .I $D(SRCL(5)) W ?SRCOLSPN,"MST:",$E(ENVARR(136.04,OTH_","_SRTN_",",.05,"E")) S SRCOLSPN=SRCOLSPN+8
135 .I $D(SRCL(6)) W ?SRCOLSPN,"H&N:",$E(ENVARR(136.04,OTH_","_SRTN_",",.06,"E")) S SRCOLSPN=SRCOLSPN+8
136 Q
Note: See TracBrowser for help on using the repository browser.