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

AICDKSCH.m

Go to the documentation of this file.
AICDKSCH ; IHS/OHPRD/ACC - "AND"ING INVERTED LIST SEARCH ;
 ;;3.51;IHS ICD/CPT lookup & grouper;;MAY 30, 1991
 ; AICDNWDS,AICDREF1,AICDREF4,AICDWORD() ARE PASSED IN AND
 ;  SHOULD NOT BE KILLED
 K ^UTILITY("AICDHITS",$J) S ^UTILITY("AICDHITS",$J)=0
 I $D(AICDHLIM) S AICDHLM1=AICDHLIM+1
 E  S AICDHLM1=0
 S AICDCMAX=AICDDFN(1) F AICDI=1:1:AICDNWDS S:AICDDFN(AICDI)<AICDCMAX AICDCMAX=AICDDFN(AICDI)
RESTRT ;
 S AICDI=0,AICDEMTY=0
SCLOOP ;
 S AICDI=AICDI+1
 G:AICDI>AICDNWDS!(AICDEMTY) ENDCHK
CMP S AICDLOW=AICDDFN(AICDI)<AICDCMAX,AICDHIGH=AICDDFN(AICDI)>AICDCMAX
 I AICDLOW D INCSTK:AICDPRTL(AICDI),INCONE:'AICDPRTL(AICDI) G:'AICDEMTY CMP
 I AICDHIGH S AICDCMAX=AICDDFN(AICDI),AICDI=0
 G SCLOOP
ENDCHK ;
 G:AICDEMTY EXIT
 D NOTCHK W:AICDASK "." D:'AICDELIM CHKSCRN
 I 'AICDELIM S ^UTILITY("AICDHITS",$J)=^UTILITY("AICDHITS",$J)+1,^UTILITY("AICDHITS",$J,^UTILITY("AICDHITS",$J))=AICDCMAX,AICDHLM1=AICDHLM1-1 G:AICDHLM1=0 STOP
 S AICDCMAX=AICDCMAX+1
 G RESTRT
STOP W !,"Too many terms meet your criteria; please refine your search.",! K ^UTILITY("AICDHITS",$J) S ^UTILITY("AICDHITS",$J)=0
EXIT K AICDEMTY,AICDHIGH,AICDLOW,AICDMDFN,AICDNUM,AICDCMAX,AICDHLM1
 K AICDPRTL,AICDWORD,AICDAWRD,AICDDFN,AICDADFN,AICDELIM
 K AICDWD,AICDD,AICDI,AICDJ,AICDQ
 Q
 ;
NOTCHK ; CHECK POSSIBLE HIT FOR ELIMINATION BY "NOT"
 S AICDELIM=0,AICDD=AICDCMAX
 S AICDJ="" F AICDQ=0:0 S AICDJ=$O(AICDAWRD(0,AICDJ)) Q:AICDJ=""  S AICDWD=AICDAWRD(0,AICDJ) I $D(@AICDREF4) S AICDELIM=1 Q
 Q
 ;
CHKSCRN ; CHECK SCREEN
 S Y=AICDCMAX I $D(@(AICDREF1_"Y,0)")) X:$D(DIC("S")) DIC("S") E  S AICDELIM=1
 Q
 ;
INCONE ; ADVANCE DFN FOR EXACT MATCH CASE
 S AICDD=AICDDFN(AICDI),AICDWD=AICDWORD(AICDI)
 S:AICDD<AICDCMAX AICDD=AICDCMAX-1
 F AICDQ=0:0 S AICDD=$O(@AICDREF4) Q:AICDD=""!(AICDD'<AICDCMAX)
 S AICDDFN(AICDI)=AICDD
 S:AICDD="" AICDEMTY=1
 Q
 ;
INCSTK ; ADVANCE COMPOSITE DFN FOR PARTIAL MATCH CASE
 S AICDJ=0
 F AICDQ=0:0 S AICDJ=$O(AICDAWRD(AICDI,AICDJ)) Q:AICDJ=""  D INC1 Q:AICDD'=""
 I AICDJ="" S (AICDD,AICDDFN(AICDI))="",AICDEMTY=1 Q
 S AICDMDFN=AICDD
 F AICDQ=0:0 S AICDJ=$O(AICDAWRD(AICDI,AICDJ)) Q:AICDJ=""  D INC1 S:AICDD'=""&(AICDD<AICDMDFN) AICDMDFN=AICDD
 S AICDDFN(AICDI)=AICDMDFN
 Q
INC1 ;
 S AICDD=AICDADFN(AICDI,AICDJ),AICDWD=AICDAWRD(AICDI,AICDJ)
 Q:AICDADFN(AICDI,AICDJ)'<AICDCMAX
 S AICDD=AICDCMAX-1
 F AICDQ=0:0 S AICDD=$O(@AICDREF4) Q:AICDD=""!(AICDD'<AICDCMAX)
 S:AICDD'="" AICDADFN(AICDI,AICDJ)=AICDD
 K:AICDD="" AICDAWRD(AICDI,AICDJ),AICDADFN(AICDI,AICDJ)
 Q