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

ADECD4.m

Go to the documentation of this file.
ADECD4 ; IHS/SET/HMW - ADA CODE TABLE UPDATE (CDT4) ;  
 ;;6.0;ADE;**12**;MAR 25, 1999
 S U="^"
 D ADA
 D ^ADECD44 ;ADA CODE EDIT GROUPS
 D ^ADECD45 ;DENTAL EDITS
 Q
 ;
ADA ;
 ;
 S ADEFILE=9999999.31,ADEWPFLD=1101,ADEIENST="?+1,",ADECNT=0,ADEDONE=0,ADEMOD=0
 ;Copy ^AUTTADA to ^ADEOCD4 to backup ADA Codes before the update
 I '$D(^ADEOCD4) S %X="^AUTTADA(",%Y="^ADEOCD4(" D %XY^%RCR K %X,%Y
 S DIK="^AUTTADA(" D IXALL^DIK K DIK
 ;Update ADA codes with CDT4 Update
 F ADERN=1:1:3 D ADA1(ADERN) Q:ADEDONE
 D ADAUPD
 ;Deactivated Codes
 D NOW^%DTC S ADETDT=X
 F ADEADA="0501","2110","2120","2130","2131","2336","2337","2380","2381","2382","2385" D DEACT(ADEADA)
 F ADEADA="2386","2387","2388","4220","6519","6520","6530","6543","6544","7110","7120" D DEACT(ADEADA)
 F ADEADA="7130","7420","7430","7431","7480" D DEACT(ADEADA)
 D KILL
 Q
 ;
DEACT(ADEADA) ;Deactivate Code
 S DIC=ADEFILE,DIC(0)="X",X=ADEADA
 D ^DIC
 I Y>0 D
 . S DIE=ADEFILE,DA=+Y,DR=".08////"_ADETDT
 . D ^DIE
 . Q
 Q
 ;
ADA1(ADERN) ;
 S ADERTN="ADECD4"_ADERN
 F ADERLN=4:1 S X=$T(+ADERLN^@ADERTN) Q:X=""  D  Q:ADEDONE
 .S X=$P(X,";",3,$L(X,";")) Q:X=""
 .S ADEID=$P(X,U) I ADEID="***END***" S ADEDONE=1 Q
 .I ADEID="CODE" D:ADECNT ADAUPD S ADECODE=$P(X,U,2),ADEDESC=$P(X,U,3),ADECNT=ADECNT+1,ADEUSE=0,ADETXT=0,(ADELEV,ADESYN,ADEMNE,ADENOP)=""
 .I ADEID="SVC" D  Q
 . . S ADELEV=$P(X,U,2),ADEMIN=$P(X,U,3),ADEICD9=$P(X,U,4)
 . . Q:ADEICD9=""
 . . S ADEICD9=+$O(^ICD9("AB",ADEICD9,0))
 . . S:'+ADEICD9 ADEICD9=""
 . . Q
 .I ADEID="SYN" S ADESYN=$P(X,U,2) Q
 .I ADEID="MNE" S ADEMNE=$P(X,U,2) Q
 .I ADEID="NOP" S ADENOP="n" Q
 .I ADEID="USE" S ADEUSE=1 Q
 .I ADEUSE S ADETXT=ADETXT+1,ADETEXT(ADETXT)=X Q
 I X="",ADERLN=4,$T(+ADERLN^@ADERTN)="" S ADEDONE=1
 Q
 ;
ADAUPD ;
 S ADEMOD=0,ADEIENST="?+1,"
 I $D(^AUTTADA("B",ADECODE)) S ADEIENST=+$O(^AUTTADA("B",ADECODE,0))_",",ADEMOD=1
 S ADEFDA(ADEFILE,ADEIENST,.01)=ADECODE,ADEFDA(ADEFILE,ADEIENST,.02)=ADEDESC
 S:ADEICD9'="" ADEFDA(ADEFILE,ADEIENST,.03)=ADEICD9
 S:ADEMIN'="" ADEFDA(ADEFILE,ADEIENST,.04)=ADEMIN
 S:ADELEV'="" ADEFDA(ADEFILE,ADEIENST,.05)=ADELEV
 S:ADESYN'="" ADEFDA(ADEFILE,ADEIENST,.06)=ADESYN
 S:ADENOP'="" ADEFDA(ADEFILE,ADEIENST,.09)=ADENOP
 S:ADEMNE'="" ADEFDA(ADEFILE,ADEIENST,8801)=ADEMNE
 S ADEFDA(ADEFILE,ADEIENST,.08)="@" ;Inactivation date
 D UPDATE
 Q
 ;
UPDATE ;
 I ADEMOD=0 D
 . D UPDATE^DIE(,"ADEFDA","ADEIEN","ADEEMSG")
 . K ADEFDA,ADEEMSG
 I ADEMOD=1 D
 . D FILE^DIE(,"ADEFDA","ADEEMSG")
 . S ADEIEN(1)=+ADEIENST
 . K ADEFDA,ADEEMSG
 I ADETXT,ADETXT>1!(ADETEXT(1)'="") D WP^DIE(ADEFILE,ADEIEN(1)_",",ADEWPFLD,,"ADETEXT","ADEEMSG")
 K ADETEXT,ADEEMSG,ADEIEN
 Q
KILL ;
 K ADEADA,ADECNT,ADECODE,ADEDESC,ADEDONE,ADEFDA,ADEFILE,ADEICD9,ADEID,ADEIENST,ADELEV,ADEMIN,ADEMNE,ADEMOD,ADERLN,ADERN,ADERTN,ADESYN,ADETDT,ADETEXT,ADETXT,ADEUSE,ADEWPFLD,ADENOP,DA,DIC,DIE,DR,X
 Q