Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: SROCD0

SROCD0.m

Go to the documentation of this file.
SROCD0 ;BIR/ADM - CASE CODING INPUT/EDIT ;08/01/05
 ;;3.0;Surgery;**142,152,159,177**;24 Jun 93;Build 89
 ;;
 ; Reference to CL^SDCO21 supported by DBIA #406
 ;;
PRDX ; edit Principal Postop Diagnosis
 N SRDUP,SRDXY,SRI,SROLD,ENVARR,SCEC,SRNEW,SRNUM S SCEC=$$SCEC()
 S (SROLD,X)=$P(^SRO(136,SRTN,0),"^",3),SRDIAG="NOT ENTERED" I 'X D PDXEN Q
 I X S Y=$$ICD^SROICD(SRTN,X),SRNUM=$P(Y,U,2),SRDES=$P(Y,U,4),SRDIAG=SRNUM_"  "_SRDES
 W !,"Principal Postop Diagnosis:",!!,?5,"ICD"_$$ICD910^SROICD(SRTN)_" Code: "_SRDIAG D:SCEC
 .D GETS^DIQ(136,SRTN_",",".04:.11","E","ENVARR")
 .I $D(ENVARR(136,SRTN_",",.04,"E")) D
 ..N SRCOLSPN S SRCOLSPN=13 W !
 ..I $D(SRCL(3)) W ?SRCOLSPN,"SC:",$E(ENVARR(136,SRTN_",",.04,"E")) S SRCOLSPN=SRCOLSPN+8
 ..I $D(SRCL(7)) W ?SRCOLSPN,"CV:",$E(ENVARR(136,SRTN_",",.1,"E")) S SRCOLSPN=SRCOLSPN+8
 ..I $D(SRCL(1)) W ?SRCOLSPN,"AO:",$E(ENVARR(136,SRTN_",",.05,"E")) S SRCOLSPN=SRCOLSPN+8
 ..I $D(SRCL(2)) W ?SRCOLSPN,"IR:",$E(ENVARR(136,SRTN_",",.06,"E")) S SRCOLSPN=SRCOLSPN+8
 ..I $D(SRCL(4)) W ?SRCOLSPN,"SWAC:",$E(ENVARR(136,SRTN_",",.07,"E")) S SRCOLSPN=SRCOLSPN+8
 ..I $D(SRCL(8)) W ?SRCOLSPN,"SHAD:",$E(ENVARR(136,SRTN_",",.11,"E")) S SRCOLSPN=SRCOLSPN+8
 ..I $D(SRCL(5)) W ?SRCOLSPN,"MST:",$E(ENVARR(136,SRTN_",",.08,"E")) S SRCOLSPN=SRCOLSPN+8
 ..I $D(SRCL(6)) W ?SRCOLSPN,"H&N:",$E(ENVARR(136,SRTN_",",.09,"E")) S SRCOLSPN=SRCOLSPN+8
 K DIR S DIR(0)="SO^1:Update Principal Postop Diagnosis Code;2:Update Service Connected/Environmental Indicators only"
 S DIR("A")="Enter selection (1 or 2)",DIR("B")=1 D ^DIR I $D(DTOUT)!$D(DUOUT)!'Y Q
 S SRDXY=Y I SRDXY=1 D PDXEN Q
 I SRDXY=2 D PSCEI
 Q
PRESS W ! K DIR S DIR("A")="Press Enter/Return key to continue ",DIR(0)="FOA" D ^DIR K DIR
 Q
PDXEN ;
 ; JAS - 6/19/13 - Patch 177 - modifications to correct ^DIR incompatibility with ICD-10 Code Set Versioning Utility
 N X,Y,SRPRMT S SRPRMT="Principal Postop Diagnosis Code ",SRDEF=$P($G(SROICD),"-",1)
 D ICDSRCH^SROICD
 I $G(X)="^" K X Q
 I $G(X)="" W !,"This is a required entry." G PDXEN
 I $G(X)="@" W !!," Deletion of the Principal Postop Diagnosis Code is not allowed! ??" G PDXEN
 S SRNEW=+$G(Y)
 ; End 177
 S (SRDUP,SRI)=0 I SRNEW=SROLD Q
 I SRNEW,SRNEW'=SROLD F  S SRI=$O(SRADIAG(SRI)) Q:'SRI  I SRADIAG(SRI)=SRNEW S SRDUP=1 Q
 I SRDUP D DUP,HDR^SROCD G PDXEN
 K DR,DIE,DA S DIE=136,DA=SRTN,DR=".03////"_SRNEW D ^DIE K DR,DIE I $D(Y) Q
 I SRNEW'=SROLD S X=SROLD D PRINASOD^SROCDX2
 D REMIND
PSCEI I $P(^SRO(136,SRTN,0),"^",3) D
 .I SCEC D SCEI^SROCD3 K SRCL Q
 .W !!,"  >>>  No SC/EI information required for this patient.  <<<" D PRESS
 Q
POTH W !,"Other Procedures:",!
 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
 .S X=$P($G(^SRO(136,SRTN,3,OTH,0)),U),CPT1=""
 .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
 .W !,CNT_". CPT Code: "_CPT
 .S SRSEL(CNT)=OTH_"^CPT Code: "_CPT_"^"_CPT1_"^"_SRCPT
 .D OTHADXD^SROCDX1
 .S CNT=CNT+1
 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
 I 'Y,$$ADCHK D DELWRN^SROCDX2,PRESS Q
 Q:'Y  S (OTHCNT,SRDA)=Y W !! I SRDA<CNT D  G PH
 .D HDR^SROCD,OTHCPTD^SROCDX,OTHADX^SROCDX1
 .K DIR S DIR(0)="SO^1:Update Other Procedure CPT Code;2:Update Associated Diagnoses"
 .S DIR("A")="Enter selection (1 or 2)",DIR("B")=1 D ^DIR I $D(DTOUT)!$D(DUOUT)!'Y Q
 .S SROPY=Y I SROPY=1 D OPEN Q
 .I SROPY=2 D OASS
 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=+$G(Y) I $D(DTOUT)!$D(DUOUT)!($G(Y)="") G PH
 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
 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
 K DA S (SRPOTH,DA)=+Y,DA(1)=SRTN D OPROC^SROMOD0 K DA
 S SRDA=CNT,OTHER=SRNEW D COTHADX^SROCDX
PH D HDR^SROCD D POTH
 Q
OPEN N SRDIRED W ! S SROLD=$P(SRSEL(SRDA),U,3),SRDIE=1,SRDIRED=0 K DA,DIE,DIR,DR
 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)
 I 'SRDIRED K DA Q
 D OPROC^SROMOD0
 S X=$P($G(^SRO(136,SRTN,3,$P(SRSEL(SRDA),U),0)),"^") I SROLD'=X D SADXO^SROCDX2 K DA
OASS S SRPOTH=$P(SRSEL(SRDA),U) D COTHADX^SROCDX
 Q
DUP 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
 Q
DOTH W !,"Other Postop Diagnosis:",!
 N CNT,SRDUP,SRI,SRJ,SRNEW,SRSYS,SRSYS1,SRX,SCEC,ENVARR,SRNUM S SCEC=$$SCEC()
 K SRSEL S CNT=1,OTH=0 F  S OTH=$O(^SRO(136,SRTN,4,OTH)) Q:'OTH!(SRSOUT)  D
 .S (SRX,X)=$P(^SRO(136,SRTN,4,OTH,0),U),SRDIAG="NOT ENTERED"
 .S SRSYS=$$ICDSTR^SROICD(SRTN)
 .I X S Y=$$ICD^SROICD(SRTN,X),SRNUM=$P(Y,U,2),SRDES=$P(Y,U,4),SRDIAG=SRNUM_"  "_SRDES
 .S SRSYS1=$P(SRSYS,")",1),SRSYS1=$P(SRSYS1,"(",2) ;AAS
 .W !,CNT_". "_SRSYS1_" Code: "_SRDIAG S SRSEL(CNT)=OTH_"^"_SRSYS1_" Code: "_SRDIAG_"^"_SRNUM_"^"_SRX ;AAS
 .D:SCEC OIND
 .S CNT=CNT+1 I 'SCEC W !
 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
 Q:'Y  S SRDA=Y W !! I SRDA<CNT D  G DH
 .D HDR^SROCD W !,"Other Postop Diagnosis:",!!,SRDA_". "_$P(SRSEL(SRDA),U,2) I SCEC S OTH=$P(SRSEL(SRDA),"^") D OIND
 .K DIR S DIR(0)="SO^1:Update Other Postop Diagnosis Code;2:Update Service Connected/Environmental Indicators only"
 .S DIR("A")="Enter selection (1 or 2)",DIR("B")=1 D ^DIR I $D(DTOUT)!$D(DUOUT)!'Y Q
 .S SRDXY=Y D:SRDXY=1 ODXEN D:SRDXY=2 OSCEI Q
 ; JAS - 6/20/13 - Patch 177 - modifications to correct ^DIR incompatibility with ICD-10 Code Set Versioning Utility
 N X,Y,SRPRMT,SRDEF S SRPRMT="Enter new OTHER POSTOP DIAGNOSIS Code ",SRDEF=""
 D ICDSRCH^SROICD
 I $G(X)="^" K X G DH
 S SRNEW=+$G(Y) I $G(Y)="" G DH
 ; END 177
 S (SRDUP,SRI)=0 F  S SRI=$O(SRADIAG(SRI)) Q:'SRI  I SRADIAG(SRI)=SRNEW S SRDUP=1 Q
 I SRDUP D DUP G DH
 S:'$D(DA(1)) DA(1)=SRTN
 K DD,DO S DIC="^SRO(136,SRTN,4,",X=SRNEW,DIC(0)="L" D FILE^DICN K DA,DD,DIC,DO,DR
 D REMIND
DH D PASSDIAG^SROCDX1,ASSDIAG^SROCDX1,HDR^SROCD,DOTH
 Q
ODXEN ;
 ; JAS - 6/20/13 - Patch 177 - modifications to correct ^DIR incompatibility with ICD-10 Code Set Versioning Utility
 N X,Y,SRPRMT,SRDEF S SRPRMT="Enter new OTHER POSTOP DIAGNOSIS Code "
 S SROLD=$P(SRSEL(SRDA),U,4),SRDEF=$P($G(SRSEL(SRDA)),"^",3)
 D ICDSRCH^SROICD
 I $G(X)="^" K X Q
 S SRNEW=+$G(Y)
 ; END 177
 I X="@" S SRSOUT=0 D  I SRSOUT S SRSOUT=0 Q
 .K DIR S DIR("A")="SURE YOU WANT TO DELETE THE ENTIRE OTHER POSTOP DIAGNOSIS CODE",DIR(0)="YO",DIR("B")="NO"
 .D ^DIR K DIR I $D(DTOUT)!$D(DUOUT)!'Y S SRSOUT=1 Q
 .K DA,DIE,DR S DA=$P(SRSEL(SRDA),U),DA(1)=SRTN,DIE="^SRO(136,SRTN,4,",DR=".01///@" D ^DIE
 .S X=$P(SRSEL(SRDA),U,4) D DELASOC^SROCDX2 K DA,DIE,DR,SRSEL(SRDA)
 .D REMIND S SRSOUT=1
 S (SRDUP,SRI)=0 F  S SRI=$O(SRADIAG(SRI)) Q:'SRI  I SRADIAG(SRI)=SRNEW,SROLD'=SRNEW S SRDUP=1 Q
 I SRDUP D DUP Q
 I SRNEW=SROLD Q
 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
 S X=$P(SRSEL(SRDA),U,4) D DELASOC^SROCDX2 K DA,DIE,DR
 D REMIND
OSCEI I '$D(SRCL) W !!,"  >>>  No SC/EI information required for this patient.  <<<" D PRESS Q
 D OSCEI^SROCD
 Q
SCEC() N SRSDATE,DFN,SCEC S SRSDATE=$S($D(SRTN):$P(^SRF(SRTN,0),U,9),1:DT)
 S DFN=$P(^SRF(SRTN,0),U) D CL^SDCO21(DFN,SRSDATE,,.SRCL)
 S SCEC=$S($D(SRCL):1,1:0)
 Q SCEC
ADCHK() ; check for other procedures with no associated diagnosis
 N SRADX,SROTH,SRQ S (SRADX,SROTH,SRQ)=0
 F  S SROTH=$O(^SRO(136,SRTN,3,SROTH)) Q:'SROTH  I '$O(^SRO(136,SRTN,3,SROTH,2,0)) S SRADX=1 Q
 Q SRADX
REMIND ; display reminder to update procedure/diagnosis associations
 K DIR W ! S DIR("A",1)="Please review and update procedure associations for this diagnosis."
 S DIR("A",2)="",DIR("A")="Press Enter/Return key to continue ",DIR(0)="FOA" D ^DIR K DIR
 Q
OIND D GETS^DIQ(136.04,OTH_","_SRTN_",",".02:.09","E","ENVARR")
 I $D(ENVARR(136.04,OTH_","_SRTN_",",.02,"E")) D
 .N SRCOLSPN S SRCOLSPN=13 W !
 .I $D(SRCL(3)) W ?SRCOLSPN,"SC:",$E(ENVARR(136.04,OTH_","_SRTN_",",.02,"E")) S SRCOLSPN=SRCOLSPN+8
 .I $D(SRCL(7)) W ?SRCOLSPN,"CV:",$E(ENVARR(136.04,OTH_","_SRTN_",",.08,"E")) S SRCOLSPN=SRCOLSPN+8
 .I $D(SRCL(1)) W ?SRCOLSPN,"AO:",$E(ENVARR(136.04,OTH_","_SRTN_",",.03,"E")) S SRCOLSPN=SRCOLSPN+8
 .I $D(SRCL(2)) W ?SRCOLSPN,"IR:",$E(ENVARR(136.04,OTH_","_SRTN_",",.04,"E")) S SRCOLSPN=SRCOLSPN+8
 .I $D(SRCL(4)) W ?SRCOLSPN,"SWAC:",$E(ENVARR(136.04,OTH_","_SRTN_",",.07,"E")) S SRCOLSPN=SRCOLSPN+8
 .I $D(SRCL(8)) W ?SRCOLSPN,"SHAD:",$E(ENVARR(136.04,OTH_","_SRTN_",",.09,"E")) S SRCOLSPN=SRCOLSPN+8
 .I $D(SRCL(5)) W ?SRCOLSPN,"MST:",$E(ENVARR(136.04,OTH_","_SRTN_",",.05,"E")) S SRCOLSPN=SRCOLSPN+8
 .I $D(SRCL(6)) W ?SRCOLSPN,"H&N:",$E(ENVARR(136.04,OTH_","_SRTN_",",.06,"E")) S SRCOLSPN=SRCOLSPN+8
 Q