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

DGICP.m

Go to the documentation of this file.
  1. DGICP ;AL/AAS/PLT KUM,WIOFO/PMK - LOOK UP ICD-10 PROCEDURE CODE ;04/15/2015 1:17 PM
  1. ;;5.3;Registration;**850,884**;Aug 13, 1993;Build 31
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ;This routine does not conform to Standard & Conventions routine naming
  1. ;conventions since package routine names of DG_I* (with the exceptions
  1. ;of Kernel, VA FileMan, and routines created to support the INIT
  1. ;process) should not be used. The SACC has granted an exemption for
  1. ;this routine.
  1. ;
  1. ;copied from ICDCODLK
  1. ;
  1. ; ICDDATE is EFFDATE variable that is passed in from Calling Routine
  1. ;
  1. EN ; Initialize variables
  1. W ! ;@IOF
  1. D LOOK
  1. G EXIT
  1. LOOK ; Look-up term
  1. N X
  1. W !! S X="" D ASK K DIC
  1. AGAIN ; Try again?
  1. Q
  1. ;
  1. ASK ; Get user input
  1. N DIR,DIRUT,DIROUT,ICDDATE,ICDDATE1,ICDT1,ICDX,DGXX
  1. Q:X="?BAD"!(X["^")
  1. I X["?" D K X,Y Q ; - added here for calls that bypass ^DGICDGT
  1. . N TAG,FORMAT
  1. . S TAG=$S(X["???":"P3^DGICDGT",X["??":"P2^DGICDGT",X["?":"P1^DGICDGT",1:"P1^DGICDGT")
  1. . D @TAG
  1. . Q
  1. S ICDDATE=$G(EFFDATE)
  1. I $G(ICDDATE)'="" S ICDDATE1=ICDDATE
  1. S ICDPRC=$G(X),ICDX=0
  1. S ICDPRC=$$TR(X)
  1. S ICDRES=1
  1. F ICDT1=1:1 Q:($L($G(ICDPRC))>6)!(ICDPRC["^")!(ICDRES=0) D
  1. . S ICDRES=$$PCSDIG^LEX10CS(ICDPRC,$G(ICDDATE1))
  1. . I ICDRES=1 D
  1. . . D LOAD
  1. . . D PRCDESCB
  1. . . D PRCDESC
  1. . . S X=$$SEL^DGICPL(.ICDS,5)
  1. . . I X'=-1 S ICDPRC=ICDPRC_$P(X,"^",1)
  1. . . S ICDX=1
  1. . . D GICDPRC
  1. . I ICDRES'=1 W !,ICDPRC_" IS NOT A VALID ICD PROCEDURE CODE" G EXIT
  1. I ICDPRC["^" G EXIT
  1. I $L($G(ICDPRC))=7 D
  1. . S ICDRES=$$PCSDIG^LEX10CS(ICDPRC,$G(ICDDATE1))
  1. . I ICDRES=1 D
  1. . . S ICDPDESC=LEXPCDAT("PCSDESC")
  1. . . S ICDPSTS=LEXPCDAT("STATUS")
  1. . . D PRCDESCB
  1. . . D PRCDESC
  1. . . W !," ",ICDPDESC
  1. . . S DGXX=+$$CODEN^ICDEX(ICDPRC,80.1)
  1. . . I '$P(ICDPSTS,"^",1) W " **CODE INACTIVE" I $P(ICDPSTS,"^",2)'="" S Y=$P(ICDPSTS,"^",2) D DD^%DT W " AS OF ",Y," **",!
  1. . I ICDRES'=1 D
  1. . . W !,ICDPRC_" IS NOT VALID"
  1. I $L($G(ICDPRC))>7 W !,ICDPRC_" IS NOT A VALID ICD PROCEDURE CODE"
  1. K X,Y
  1. S:$G(DGXX) (X,Y)=DGXX
  1. K ICDDATE1,ICDPRC,ICDRES,ICDPDESC,ICDPSTS,LEXPCDAT
  1. Q
  1. INPHLP ; Look-up help
  1. Q:X["^^" "^^" Q:X["^" "^"
  1. W !," Enter a ""free text"" term. Best results occur using one to "
  1. W !," three full or partial words without a suffix"
  1. W:$G(X)'["??" "."
  1. W:$G(X)["??" " (i.e., ""DIABETES"","
  1. W:$G(X)["??" !," ""DIAB MELL"",""DIAB MELL INSUL"")"
  1. W !," or "
  1. W !," Enter a classification code (ICD/CPT etc) to find the single "
  1. W !," term associated with the code."
  1. W:$G(X)["??" " Example, a lookup of code 239.0 "
  1. W:$G(X)["??" !," returns one and only one term, that is the preferred "
  1. W:$G(X)["??" !," term for the code 239.0, ""Neoplasm of unspecified nature "
  1. W:$G(X)["??" !," of digestive system"""
  1. W !," or "
  1. W !," Enter a classification code (ICD/CPT etc) followed by a plus"
  1. W !," sign (+) to retrieve all terms associated with the code."
  1. W:$G(X)["??" " Example,"
  1. W:$G(X)["??" !," a lookup of 239.0+ returns all terms that are linked to the "
  1. W:$G(X)["??" !," code 239.0."
  1. Q
  1. EXIT ; Clean up environment and quit
  1. K %,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,LEX,X,Y,ICDLEX
  1. Q
  1. X(ICDLEX) ; Evaluate X
  1. Q:$L($G(X)) 1 Q 0
  1. Y(ICDLEX) ; Evaluate Y
  1. Q:+($G(Y))>1 1 Q 0
  1. LOAD ; Load dummy data
  1. K ICDS
  1. S ICDLOAD1=1
  1. S PICDLOAD=""
  1. S ICDLOAD="" F S ICDLOAD=$O(LEXPCDAT("NEXLEV",ICDLOAD)) Q:ICDLOAD="" D
  1. . I ICDLOAD'=PICDLOAD D
  1. . . S ICDS(ICDLOAD1,0)=ICDLOAD
  1. . . S ICDS(ICDLOAD1,"LEX")=LEXPCDAT("NEXLEV",ICDLOAD,"DESC")
  1. . . S ICDLOAD1=ICDLOAD1+1
  1. . . S PICDLOAD=ICDLOAD
  1. K ICDLOAD1,PICDLOAD,ICDLOAD
  1. Q
  1. PRCDESC ; Display Descriptions of each character
  1. S ICDPRCT=ICDPRC,ICDPRCT1="",ICDX=0
  1. F ICDTEMP=1:1 Q:ICDPRCT="" D
  1. . S ICDC=$E(ICDPRCT,1,1)
  1. . S ICDRES=$$PCSDIG^LEX10CS(ICDPRCT1,$G(ICDDATE1))
  1. . I ICDRES'=1 D
  1. . . S ICDPRCT=""
  1. . I ICDRES=1 D
  1. . . S ICDLOAD="" F S ICDLOAD=$O(LEXPCDAT("NEXLEV",ICDLOAD)) Q:ICDLOAD=""!(ICDLOAD=ICDC)
  1. . . I ICDLOAD=ICDC W ICDC_" - "_LEXPCDAT("NEXLEV",ICDLOAD,"DESC") W !
  1. . . S ICDPRCT=$E(ICDPRCT,2,$L(ICDPRCT))
  1. . . S ICDPRCT1=ICDPRCT1_ICDC
  1. K ICDTEMP,ICDPRCT,ICDPRCT1,ICDC,ICDLOAD
  1. Q
  1. GICDPRC ; Get ICDPRC from User
  1. AA ; Read character by character
  1. W !
  1. I $G(ICDX)=1 D PRCDESC W !
  1. W "Press '*' to display available choices for next character or '^' to exit."
  1. W !,"ICD-10 Procedure code:"_ICDPRC
  1. I $L(ICDPRC)>6 G BB
  1. S ICDA=$$READ^XGF(1,300) S ICDA=$S($G(DTOUT):13,1:$A(ICDA))
  1. ; show choices on "*"
  1. I ICDA=42 G BB
  1. ; Exit when Enter and is full length else ignore
  1. I ICDA=13 G:$L(ICDPRC)>6 BB G AA
  1. ; If Backspace is entered, truncate last character and display the ICDPRC
  1. I ICDA=127 S ICDPRC=$E(ICDPRC,1,$L(ICDPRC)-1) S ICDX=1 G AA
  1. ; If ^ is entered, exit
  1. I ICDA=94 S ICDPRC=ICDPRC_$C(ICDA) G BB
  1. ;
  1. ; check for valid characters
  1. I ICDA<48!((ICDA>57)&(ICDA<65))!((ICDA>90)&(ICDA<97))!(ICDA>122) G AA
  1. ;
  1. ; Any character other than Enter or Backspace
  1. I ICDA'=127 D G:$L(ICDPRC)>6 BB G AA
  1. . S ICDPRC=ICDPRC_$$TR($C(ICDA))
  1. . S ICDX=1
  1. BB ;Exit
  1. W !
  1. K ICDA
  1. Q
  1. PRCDESCB ; Call Before PRCDESC
  1. W !,"ICD-10 Procedure code:"_ICDPRC
  1. W !
  1. Q
  1. ;
  1. TR(X) ;
  1. S X=$TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
  1. Q X