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

ADE697A.m

Go to the documentation of this file.
ADE697A ; IHS/DIR/FHL - DENTAL TABLE UPDATES ;  [ 03/24/1999   8:35 AM ]
 ;;6.0;ADE;;APRIL 1999
 ;;This is the Post-Init routine
 ;Q
 ;
START ;EP
 ;
 NEW A,C,DIC,DIE,DLAYGO,DR,E,L,M,N,O,P,R,S,T
 K ^TMP("ADE697",$J)
 ;
 D DASH,RSLT($J("",15)_"IHS DENTAL TABLE UPDATES")
 D DASH,MOD,DASH,ADD,DASH,USE
 D DASH,OPSITE^ADE697B
 D DASH,GROUP^ADE697B,DASH,EDIT^ADE697B
 D DASH,COMPILE^ADE697C
 Q
 ;
ADDOK(L) ;EP
 D RSLT($J("",5)_"Added : "_L) Q
ADDFAIL(L) ;EP
 D RSLT($J("",5)_"Error: "_"Add Failed => "_L) Q
MODOK(L) ;EP
 D RSLT($J("",5)_"Changed : "_L) Q
RSLT(%) ;EP
 S ^TMP("ADE697",$J,0)=$G(^TMP("ADE697",$J,0))+1,^(^(0))=% W:'$D(ZTQUEUED) !,% Q
 W:'$D(ZTQUEUED) !,% Q
DASH D RSLT(""),RSLT($$REPEAT^XLFSTR("-",$S($G(IOM):IOM-10,1:70))),RSLT("") Q
DIE(DIE,DA,DR)     ;EP
 K Y
 LOCK +(@(DIE_DA_")")):10
 E  D RSLT($J("",5)_"ERROR: "_"Entry '"_DIE_DA_"' Is locked -- unable to edit.") Q "ERROR"
 D ^DIE
 LOCK -(@(DIE_DA_")"))
 Q "OK"
 ;
FILE(DIC,X,ADEDR,DLAYGO) ;EP
 K DD,DO
 S:ADEDR]"" DIC("DR")=ADEDR
 S DIC(0)="L"
 D FILE^DICN
 Q Y
 ;
ADD ;
 N T,L,ADEJ
 D RSLT("Add ADA Code")
 F ADEJ=1:1:2 S ADERTN="^ADE6A"_ADEJ D
 . F T=1:1 S ADELINE="S L=$T(ADAADD+T"_ADERTN_")" X ADELINE S L=$P(L,";",3) Q:L="END"  D ADAADD(L)
 . Q
 Q
 ;
ADAADD(L) ;
 N ADEJ,N,Y,ADEDR
 F ADEJ=2:1:11 S N(ADEJ-1)=$P(L,U,ADEJ)
 I $D(^AUTTADA("B",N(1))) D RSLT("NOT ADDED: ADA CODE EXISTS => "_N(1)) Q
 S %=$O(^ICD9("AB",N(3),0))
 I '% D RSLT("NOT ADDED: ICD DIAGNOSIS "_N(3)_" DOES NOT EXIST => "_N(1)) Q
 S ADEDR=".02///"_N(2)
 S:N(4)=0 N(4)=""
 F ADEJ=3:1:9 S ADEDR=ADEDR_";.0"_ADEJ_"///"_N(ADEJ)
 S ADEDR=ADEDR_";8801///"_N(10)
 S Y=$$FILE("^AUTTADA(",N(1),ADEDR,9999999.31)
 D ADDFAIL(N(1)):Y<0,ADDOK(N(1)):Y>0
 Q
 ;
USE ;EP
 N ADET,ADEC,ADEWP,ADECNT,ADECOD,ADERET,ADEDA,ADENEXT,ADERR
 D RSLT("Modify ADA CODE 'RECOMMENDED USE' WP Field")
 S ADECOD="",ADERR=""
 F ADET=1:1 S ADEC=$T(ADAUSE+ADET^ADE6U1) S ADEC=$P(ADEC,";",3) D  Q:ADEC="END"
 . S ADENEXT=$E(ADEC,1,4)
 . I (ADECOD'=ADENEXT) D
 . . I (ADECOD]"") D
 . . . I ADEDA D
 . . . . D WP^DIE(9999999.31,ADEDA_",",1101,"","ADEWP","ADERET")
 . . . . D RSLT($J("",5)_ADECOD_" 'USE' added")
 . . . K ADECNT,ADEWP
 . . Q:ADENEXT="END"
 . . S ADECOD=ADENEXT
 . . S ADEDA=$O(^AUTTADA("B",$E(ADECOD,1,4),0))
 . . I 'ADEDA&(ADERR'=ADECOD) D RSLT($J("",5)_"Code "_ADECOD_" Doesn't exist to add 'USE' field")
 . . S:'ADEDA ADERR=ADECOD
 . . S ADECNT=0
 . . Q
 . Q:ADENEXT="END"
 . S ADECNT=ADECNT+1
 . S ADEWP(ADECNT)=$P(ADEC,U,2)
 . Q
 Q
 ;
MOD ;
 N ADET,ADEFROM,ADETO,ADEJ,ADELINE,ADERTN
 D RSLT("ADA Code Changes")
 D CHECK
 F ADEJ=1:1:9 S ADERTN="^ADE6M"_ADEJ D
 . F ADET=1:2 S ADELINE="S ADEFROM=$T(ADAMOD+"_ADET_ADERTN_")" X ADELINE Q:$P(ADEFROM,";",3)="END"  S ADELINE="S ADETO=$T(ADAMOD+"_(ADET+1)_ADERTN_")" X ADELINE D ADAMOD(ADEFROM,ADETO)
 . Q
 Q
 ;
ADAMOD(ADEFROM,ADETO)        ;EP
 ;ADEFROM and ADETO are in the form:
 ;  CODE^DESC^DX^EST MIN^
 ;  LVL^SYN^EXC^INACT^NOOPSITE^MN
 ;
 N ADEJ,ADE,ADEDA,ADEDIE,ADEDR,ADEY
 F ADEJ=2:1:11 S ADE("FROM",ADEJ-1)=$P(ADEFROM,U,ADEJ),ADE("TO",ADEJ-1)=$P(ADETO,U,ADEJ)
 D RSLT($J("",15)_ADE("FROM",1)_"---->"_ADE("TO",1))
 S ADEDA=$O(^AUTTADA("B",ADE("FROM",1),0))
 ;FHL 09/09/98 I 'ADEDA B  S ADEDA=$O(^AUTTADA("B",ADE("TO",1),0))
 I 'ADEDA S ADEDA=$O(^AUTTADA("B",ADE("TO",1),0))
 I 'ADEDA D  Q
 . D RSLT(ADE("FROM",1)_" NOT PRESENT, "_ADE("TO",1)_" WILL BE ADDED.")
 . D ADAADD(U_$P(ADETO,U,2,11))
 . Q
 ; Modify ADA Code
 S ADEDIE="^AUTTADA("
 S ADEDR=".01////"_ADE("TO",1)
 F ADEJ=2:1:9 S ADEDR=ADEDR_";.0"_ADEJ_"///"_ADE("TO",ADEJ)
 S ADEDR=ADEDR_";8801///"_ADE("TO",10)
 S ADEY=$$DIE(ADEDIE,ADEDA,ADEDR)
 I ADEY["ERR" D RSLT("ERROR: EDIT ADA CODE FAILED => "_ADE("FROM",1)) Q
 Q
 ;
CHECK ;Check for exam code changes
 ;
 N ADEDA,ADE
 D CHK1,CHK2,CHK3
 Q
CHK1 S ADEDA=$O(^AUTTADA("B","0140",0))
 Q:'+ADEDA
 Q:'$D(^AUTTADA(ADEDA,0))
 Q:$P(^AUTTADA(ADEDA,0),U,2)'["SCREEN"
 S ADE("FROM")="FROM^0140^SCREENING ORAL EXAM^V72.2^1^0^SCREEN EXAM^^^n^"
 S ADE("TO")="TO^0114^SCREENING ORAL EXAM^V72.2^1^0^SCREEN EXAM^^^n^"
 D ADAMOD(ADE("FROM"),ADE("TO"))
 Q
 ;
CHK2 S ADEDA=$O(^AUTTADA("B","0130",0))
 Q:'+ADEDA
 Q:$D(^AUTTADA("B","0140"))
 S ADE("FROM")="FROM^0130^ORAL EXAMINATION, EMERGENCY^V72.2^5^1^EMERG. EXAM^^^n^EOE"
 S ADE("TO")="TO^0140^ORAL EXAMINATION, EMERGENCY^V72.2^5^1^EMERG. EXAM^^^n^EOE"
 D ADAMOD(ADE("FROM"),ADE("TO"))
 Q
 ;
CHK3 S ADEDA=$O(^AUTTADA("B","0110",0))
 Q:'+ADEDA
 Q:$D(^AUTTADA("B","0150"))
 S ADE("FROM")="FROM^0110^ORAL EXAMINATION, INITIAL^V72.2^15^3^ORAL EXAM INIT.^^^n^IOE"
 S ADE("TO")="TO^0150^ORAL EXAMINATION, INITIAL^V72.2^15^3^ORAL EXAM INIT.^^^n^IOE"
 D ADAMOD(ADE("FROM"),ADE("TO"))
 Q