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

ADEGRL5.m

Go to the documentation of this file.
ADEGRL5 ; IHS/HQT/MJL - DENTAL ENTRY PART 7 ;  [ 03/24/1999   9:04 AM ]
 ;;6.0;ADE;**13**;APRIL 1999
 ;------->INITIALIZE
 S ADEDENT=$P(Y(0),U,2)
S3 ;
 S ADEDIC("S")="" ;Remove this variable when you get a chance ***
 ;IHS/SET/HMW 3-26-2003 **13** Removed following line since CDT-4 codes apply to
 ; both PRIMARY and PERMANENT teeth
 ;I ADEDENT["DECID"!(ADEDENT["PRIM") S ADEDIC("S")="I $P(^ADEOPS(Y,0),U)[""DECID"""
 W !,"OPSITE: "
 S ADEDEF=$S($D(ADEV(ADECOD)):ADEV(ADECOD),1:"")
 I ADEDEF]"" S ADEDEF=$$OPDFLT(ADEDEF)
 W:ADEDEF]"" ADEDEF_" // "
 R ADEOP:DTIME S:('$T)!(ADEOP="^") ADEOP=""
 I ADEOP="",ADEDEF]"" Q
 I ADEOP=""!(ADEOP["@"),ADEDEF="" K ADEV(ADECOD),ADEDES(ADECOD) Q
 I ADEOP["@",ADEDEF'["," K ADEV(ADECOD),ADEDES(ADECOD) Q
 I ADEOP["?" S XQH="ADE-DVIS-OPSITE1" D EN^XQH K XQH D LIST^ADEGRL3 W !,"ADA Code: ",ADECOD W:ADECON !,"FEE: ",$P(ADEV(ADECOD),U,3) G S3
 I ADEOP["@" S ADEDEL=$P(ADEOP,"@",2) D OPDEL G:$P(ADEV(ADECOD),U,2)="" S3 Q
 K ADEADD I ADEOP["+" S ADEOP=$P(ADEOP,"+",2),ADEADD=1
PARSE ;
 S ADEOP=$$SPLIT(ADEOP),ADESFC=$P(ADEOP,U,2),ADEOP=$P(ADEOP,U)
 F J=1:1:$L(ADEOP,",") S ADEPC=$P(ADEOP,",",J) D VEROP Q:$D(ADENOOP)  S $P(ADEOP,",",J)=+Y
 I $D(ADENOOP) K ADENOOP W *7,ADEPC," ??" K ADEOP,ADESFC,ADEADD G S3
 I $$DUPE^ADEGRL5C(ADEOP) W *7," --DUPE OPSITES NOT ALLOWED" K ADEOP,ADESFC,ADEADD G S3
 F J=1:1:$L(ADEOP,",") S ADEPC=$P(ADESFC,",",J) I '$$VERSFC(ADEPC) W *7,"  '",ADEPC,"' IS NOT A VALID SURFACE" K ADEOP,ADESFC,ADEADD G S3
 I $D(ADEADD),$D(ADEV(ADECOD)) D
 . S ADEV(ADECOD)=$$ADDOP(ADEOP,ADESFC,ADEV(ADECOD))
 E  S $P(ADEV(ADECOD),U)=$L(ADEOP,","),$P(ADEV(ADECOD),U,2)=ADEOP,$P(ADEV(ADECOD),U,4)=ADESFC
 K ADEOP,ADESFC,ADEADD
 Q
 ;
 ;***SUBROUTINES***
 ;
 ;
VEROP ;B FHL 9/9/98
 K DIC S Y=-1,X=ADEPC,DIC="^ADEOPS("
 I ADEDIC("S")]"" S DIC(0)="Z",D="C",DIC("S")=ADEDIC("S") D MIX^DIC1 G:Y>0 VQ
 I X?1.2N1"D" S DIC(0)="Z",D="C" D MIX^DIC1 G:Y>0 VQ ;IHS/HMW **2,12**
 I Y=-1 K Y S DIC(0)="OXZ" S:ADEDIC("S")'="" DIC("S")=ADEDIC("S") D ^DIC
 I Y=-1 K Y S DIC(0)="EQZ" S:ADEDIC("S")'="" DIC("S")=ADEDIC("S") W !!,ADEPC D ^DIC
 I Y=-1 S ADENOOP=1 K DIC Q
VQ K DIC
 Q
 ;
OPDEL G:ADEDEL'="" OPD1
 D LIST^ADEGRL3 K K S $P(K,"-",35)="Delete Opsite",$P(K,"-",66)="" W !,K K K
 W !!,?2,ADECOD,?13,"DELETE WHICH OPSITE: " R ADEDEL:DTIME
 I '$T W " ??",*7 Q
 Q:ADEDEL=""
OPD1 S ADEPC=ADEDEL D VEROP I $D(ADENOOP) K ADENOOP,ADEDEL Q
 S ADEDEL=+Y
 S ADEV(ADECOD)=$$DELOP^ADEGRL5C(ADEDEL,ADEV(ADECOD))
 Q
 ;
 ;***FUNCTIONS***
 ;
SPLIT(ADEOP) ;Splits Opsites and Surfaces from user input string
 N ADECNT,ADEJ,ADEPC,ADESFC
 S ADESFC="",ADECNT=0
 F ADEJ=1:1:$L(ADEOP,",") S ADEPC=$P(ADEOP,",",ADEJ) I ADEPC["/" S ADECNT=ADECNT+1,$P(ADESFC,",",ADECNT)=$P(ADEPC,"/",2)
 S ADECNT=1
 F ADEJ=1:1:$L(ADEOP,",") S:$P(ADEOP,",",ADEJ)["/" ADECNT=ADECNT+1 S:$P(ADEOP,",",ADEJ)'["/" $P(ADEOP,",",ADEJ)=$P(ADEOP,",",ADEJ)_"/"_$P(ADESFC,",",ADECNT)
 S ADESFC=""
 F ADEJ=1:1:$L(ADEOP,",") S ADEPC=$P(ADEOP,",",ADEJ),$P(ADEOP,",",ADEJ)=$P(ADEPC,"/"),$P(ADESFC,",",ADEJ)=$P(ADEPC,"/",2)
 Q ADEOP_"^"_ADESFC
 ;
OPDFLT(ADEDEF) ;Creates default user input string from ADEV(ADECOD)
 N ADEOPS,ADESFC,ADEJ,ADEPC,ADEOPC
 S ADEOPS=$P(ADEDEF,U,2)
 S ADESFC=$P(ADEDEF,U,4)
 F ADEJ=1:1:$P(ADEDEF,U) D
 . I $D(ADEPLET),$P(^ADEOPS($P(ADEOPS,",",ADEJ),0),U,4)]"" S $P(ADEOPS,",",ADEJ)=$P(^ADEOPS($P(ADEOPS,",",ADEJ),0),U,4) Q
 . S $P(ADEOPS,",",ADEJ)=^ADEOPS($P(ADEOPS,",",ADEJ),88)
 S ADEOPC=0
 F ADEJ=$P(ADEDEF,U):-1:1 S ADEPC=$P(ADESFC,",",ADEJ) S:ADEOPC'=ADEPC ADEOPC=ADEPC,$P(ADEOPS,",",ADEJ)=$P(ADEOPS,",",ADEJ)_"/"_ADEOPC
 Q ADEOPS
 K ADEOPS ;*NE
 ;
VERSFC(ADEX) ;Verify surface codes - Returns 1 if valid, 0 if not valid
 ;Need to add additional parameter for ADA CODE
 N ADEY,ADEP,ADEI
 S ADEY=1
 I $L(ADEX)>6 Q 0
 I (ADEX["B")&(ADEX["F") Q 0
 I (ADEX["I")&(ADEX["O") Q 0
 F ADEI=1:1:$L(ADEX) S ADEP=$E(ADEX,ADEI) I '((ADEP="M")!(ADEP="O")!(ADEP="D")!(ADEP="F")!(ADEP="L")!(ADEP="B")!(ADEP="I"))!($F(ADEX,ADEP,$F(ADEX,ADEP)))>0 S ADEY=0 Q
 Q ADEY
 K ADEP ;*NE
 ;
ADDOP(ADEOP,ADESFC,ADEVTMP) ;EP - Search for same opsite in existing ADEV(ADECOD).
 ;If found, delete it. Then add opsite ADEOP and surface ADESFC
 N ADEJ,ADEPC,ADEK,ADEPC2
 ;S ADEVTMP=ADEV(ADECOD)
 I ADEVTMP]"" F ADEJ=1:1:$L(ADEOP,",") S ADEPC=$P(ADEOP,",",ADEJ) D ADD1
 I ADEVTMP]"" S $P(ADEVTMP,U)=$P(ADEVTMP,U)+$L(ADEOP,","),$P(ADEVTMP,U,2)=$P(ADEVTMP,U,2)_","_ADEOP,$P(ADEVTMP,U,4)=$P(ADEVTMP,U,4)_","_ADESFC
 I ADEVTMP="" S $P(ADEVTMP,U)=$L(ADEOP,","),$P(ADEVTMP,U,2)=ADEOP,$P(ADEVTMP,U,4)=ADESFC
 Q ADEVTMP
 K ADEPC2,ADEVTMP ;*NE
ADD1 F ADEK=1:1:$P(ADEVTMP,U) S ADEPC2=$P($P(ADEVTMP,U,2),",",ADEK) I ADEPC=ADEPC2 S ADEVTMP=$$DELOP^ADEGRL5C(ADEPC2,ADEVTMP)
 Q