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

AUMUPD4.m

Go to the documentation of this file.
AUMUPD4 ;IHS/OIT/NKD - SCB UPDATE  05/23/2012 ;
 ;;12.0;TABLE MAINTENANCE;**3**;SEP 27,2011;Build 1
 ;
ADDOK ;----- "ADDED" MESSAGE
 D RSLT($J("",5)_"ADDED       : "_L)
 Q
 ;
ADDFAIL ;----- "FAILED" MESSAGE
 D RSLT($J("",5)_$$M(0)_"ADD FAILED => "_L)
 Q
 ;
DASH ;----- PRT DASH LINE
 D RSLT("")
 D RSLT($$REPEAT^XLFSTR("-",$S($G(IOM):IOM-10,1:70)))
 D RSLT("")
 Q
 ;
DIE ;----- DIE EDIT
 N @($P($T(SVARS),";",3))
 L +(@(DIE_DA_")")):10
 E  D RSLT($J("",5)_$$M(0)_"Entry '"_DIE_DA_"' IS LOCKED.  NOTIFY PROGRAMMER.") S Y=1 Q
 D ^DIE
 L -(@(DIE_DA_")"))
 Q
 ;
DIK ;--- KILL ENTRY
 N @($P($T(SVARS),";",3)),DIK
 D ^DIK
 Q
 ;
FILE ;--- FILE NEW ENTRY
 N @($P($T(SVARS),";",3))
 K DD,DO
 S DIC(0)="L"
 D FILE^DICN
 K DIC,DLAYGO
 Q
 ;
M(%) ;--- ERROR MESSAGE
 Q $S(%=0:"ERROR : ",%=1:"NOT ADDED : ",1:"")
 ;
MODOK ;--- IF MOD OK 
 D RSLT($J("",5)_"CHANGED     : "_L)
 Q
 ;
INAOK ;--- IF INACTIVATE OK 
 D RSLT($J("",5)_"INACTIVATED : "_L)
 Q
 ;
DINAOK ;--- IF DUPLICATE INACTIVATE OK 
 D RSLT($J("",2)_"LOCAL DUPLICATE INACTIVATED : "_L)
 Q
 ;
RSLT(%) ;--- ISSUE MESSAGES DURING INSTALL
 N @($P($T(SVARS),";",3))
 D MES^XPDUTL(%)
 Q
 ;
IXDIC(DIC,DIC0,D,X,DLAYGO)   ;
 ;--- CALL TO FILEMAN IX^DIC
 N @($P($T(SVARS),";",3))
 S DIC(0)=DIC0
 K DIC0
 I '$G(DLAYGO) K DLAYGO
 D IX^DIC
 Q Y
 ;
PCLASALL ;EP --- PROVIDER TABLE UPDATE
 N C,CI,A,S,I,II,L,N,NI,AUMI,AUMII
 S C=$O(^DIC(7,"D","")),A="" ;TRAVERSE THE D INDEX (CODE)
 F  Q:$L(C)<1  D
 .S I=$O(^DIC(7,"D",C,"")) ;STORE THE IEN
 .;ITERATE THROUGH MASTER RETRIEVING CODES
 .F  Q:$L(I)<1  D
 ..N S
 ..;IF THE LOCAL CODE MATCHES, UPDATE THE LOCAL ENTRY AND REMOVE FROM THE MASTER
 ..F AUMII=1:1:$P(AUMPRV(0),"^",4) I $D(AUMPRV(AUMII,0)) S CI=$P(AUMPRV(AUMII,0),"^",1) Q:$D(S)  D
 ...I CI=C D RSLT("SERVICES RENDERED BY (PROVIDER) CODE CHANGES"),PCLASDIE S S="" K AUMPRV(AUMII,0)
 ..I '$D(S) S A=A_I_"^" ;IF NOT FOUND IN THE MASTER, STORE IEN IN LOCAL VARIABLE
 ..S I=$O(^DIC(7,"D",C,I)) ;ITERATE TO THE NEXT IEN WITH THIS CODE
 .S C=$O(^DIC(7,"D",C)) ;TRAVERSE TO THE NEXT CODE
 ;ITERATE THROUGH THE STORED IENs
 F AUMI=1:1 S I=$P(A,"^",AUMI) Q:$L(I)<1  D
 .N S
 .S N=$P(^DIC(7,I,0),"^",1) ;STORE THE NAME
 .;ITERATE THROUGH MASTER RETRIEVING NAMES
 .F AUMII=1:1:$P(AUMPRV(0),"^",4) I $D(AUMPRV(AUMII,0)) S NI=$P(AUMPRV(AUMII,0),"^",2) Q:$D(S)  D
 ..;IF THE LOCAL NAME MATCHES, UPDATE THE LOCAL ENTRY AND REMOVE FROM THE MASTER
 ..I NI=N D RSLT("SERVICES RENDERED BY (PROVIDER) NAME CHANGES"),PCLASDIE S S="" K AUMPRV(AUMII,0)
 .;IF NOT FOUND, INACTIVATE LOCAL ENTRY
 .I '$D(S)  D
 ..D RSLT("SERVICES RENDERED BY (PROVIDER) INACTIVATE")
 ..S L=$P(^DIC(7,I,9999999),"^",1)_" "_N_" "_$P(^DIC(7,I,9999999),"^",2)
 ..S DIE="^DIC(7,",DA=I,DR="9999999.06///"_DT D ^DIE
 ..I $D(Y) D RSLT($J("",5)_$$M(0)_"INACTIVATE PROVIDER CODE FAILED => "_L) Q
 ..D RSLT($J("",5)_"INACTIVATED : "_L)
 ;ITERATE THROUGH REMAINING MASTER ENTRIES AND ADD
 F AUMI=1:1:$P(AUMPRV(0),"^",4) I $D(AUMPRV(AUMI,0))  D
 .D RSLT("SERVICES RENDERED BY (PROVIDER) ADD")
 .S C=$P(AUMPRV(AUMI,0),"^",1),N=$P(AUMPRV(AUMI,0),"^",2),A=$P(AUMPRV(AUMI,0),"^",3),P=$P(AUMPRV(AUMI,0),"^",4),R=$P(AUMPRV(AUMI,0),"^",5)
 .S L=C_" "_N_$J("",(32-$L(N)))_A
 .I $D(^DIC(7,"D",C)) D RSLT($J("",5)_$$M(1)_"PROVIDER CODE EXISTS => "_C),RSLT("") Q
 .S DLAYGO=7,DIC="^DIC(7,",X=N,DIC("DR")="1///"_A_";9999999.01///"_C_";9999999.03///"_P_";9999999.05///"_R
 .D FILE
 .D @$S(Y>0:"ADDOK",1:"ADDFAIL")
 .K AUMPRV(AUMI,0)
 Q
PCLASDIE ;
 N C,N,A,P,R,L,DIE,DA,DR
 S C=$P(AUMPRV(AUMII,0),"^",1),N=$P(AUMPRV(AUMII,0),"^",2),A=$P(AUMPRV(AUMII,0),"^",3),P=$P(AUMPRV(AUMII,0),"^",4),R=$P(AUMPRV(AUMII,0),"^",5)
 S L=C_" "_N_" "_A
 S DIE="^DIC(7,",DA=I,DR=".01///"_N_";1///"_A_";9999999.01///"_C_";9999999.03///"_P_";9999999.05///"_R
 I $L($P(AUMPRV(AUMII,0),"^",6))>0 S DR=DR_";9999999.06///"_$P(AUMPRV(AUMII,0),"^",6)
 D ^DIE
 I $D(Y) D RSLT($J("",5)_$$M(0)_"EDIT PROVIDER CODE FAILED => "_L) Q
 D MODOK
 Q
EDTMOD ;EP - update education topics
 N AUMACT,AUMNAM,AUMMNE,AUMMJT,AUMOUTC,AUMSTD,AUMRES,FDA,NEWIEN,ERR,I,AUMCHG,AUMD0,AUMCNT,AUMIEN
 I '$D(EDTC) D RSLT("PATIENT EDUCATION TOPICS") S EDTC=""
 S AUMCHG=0,U="^",AUMIEN="",AUMACT=$P(L,U,1)
 S AUMNAM=$$CLEAN($P(L,U,2)),AUMMNE=$$CLEAN($P(L,U,3)),AUMMJT=$$CLEAN($P(L,U,4)),AUMOUTC=$P(L,U,5),AUMSTD=$P(L,U,6)
 S L=AUMMNE_$J("",13-$L(AUMMNE))_AUMNAM_$J("",51-$L(AUMNAM))_AUMMJT
 K AUMRES
 D FIND^DIC(9999999.09,"","@;.01;1;.06","PX",AUMNAM,,"B",,,"AUMRES")
 S AUMCNT=$P($G(AUMRES("DILIST",0)),"^",1)
 I AUMCNT=0 S AUMIEN="" ; No matches found, create new
 I AUMCNT=1 S AUMIEN=$P($G(AUMRES("DILIST",1,0)),"^",1) ; One match found, store IEN
 I AUMCNT>1 S AUMIEN=$P($G(AUMRES("DILIST",$P($G(AUMRES("DILIST",0)),"^",1),0)),"^",1)
 I 'AUMIEN  D
 . K AUMRES
 . D FIND^DIC(9999999.09,"","@;.01;1;.06","PX",AUMMNE,,"C","I ($P(^(0),U,3)'=1),($P(^(0),U)=$$UP^XLFSTR($P(^(0),U)))",,"AUMRES") ;
 . S AUMCNT=$P($G(AUMRES("DILIST",0)),"^",1)
 . I AUMCNT=0 S AUMIEN="" ; No matches found, create new
 . I AUMCNT=1 S AUMIEN=$P($G(AUMRES("DILIST",1,0)),"^",1) ; One match found, store IEN
 . I AUMCNT>1 S AUMIEN=$P($G(AUMRES("DILIST",$P($G(AUMRES("DILIST",0)),"^",1),0)),"^",1)
 ;
 I 'AUMIEN,$L(AUMACT)>0 D  Q
 . D RSLT($J("",5)_"INACTIVATE TOPIC FAILED : TOPIC DOES NOT EXIST => "_L)
 I 'AUMIEN D
 . K FDA,NEWIEN,ERR
 . S FDA(9999999.09,"+1,",.01)=AUMNAM ; Name (.01)
 . S FDA(9999999.09,"+1,",1)=AUMMNE ; Mnemonic (1)
 . D UPDATE^DIE(,"FDA","NEWIEN","ERR")
 . I $D(ERR) D ADDFAIL Q
 . S AUMIEN=NEWIEN(1),AUMCHG=1
 Q:'AUMIEN
 S AUMD0=$G(^AUTTEDT(AUMIEN,0))
 ;
 K FDA
 S FDA(9999999.09,AUMIEN_",",.01)=AUMNAM ; Name (.01)
 S FDA(9999999.09,AUMIEN_",",1)=AUMMNE ; Mnemonic (1)
 S FDA(9999999.09,AUMIEN_",",.06)=AUMMJT ; Major Topic (.06)
 S FDA(9999999.09,AUMIEN_",",.03)=$S($L(AUMACT)>0:1,1:"@") ; Inactive Flag (.03)
 D UPDATE^DIE(,"FDA",)
 I AUMD0'=$G(^AUTTEDT(AUMIEN,0)) S AUMCHG=1
 ;
 ; Outcome (1101) WP
 D TEXT(.AUMOUTC) ; convert string to WP array
 D WP^DIE(9999999.09,AUMIEN_",",1101,,"AUMOUTC")
 ;
 ; Standards (1102) WP
 D TEXT(.AUMSTD) ; convert string to WP array
 D WP^DIE(9999999.09,AUMIEN_",",1102,,"AUMSTD")
 ;
 I AUMCHG D @$S($D(NEWIEN):"ADDOK",$L(AUMACT)>0:"INAOK",1:"MODOK")
 ;
 K AUMRES,FDA
 D FIND^DIC(9999999.09,"","@;.01;1;.06","PX",AUMNAM,,"B","I ($P(^(0),U,3)'=1),(Y'=AUMIEN)",,"AUMRES")
 S AUMCNT=$P($G(AUMRES("DILIST",0)),"^",1)
 I AUMCNT>0 D RSLT("DUPLICATE NAMES FOUND FOR : "_AUMMNE_$J("",13-$L(AUMMNE))_AUMNAM)
 F I=1:1:AUMCNT  D
 . N L
 . S L=$P(AUMRES("DILIST",I,0),"^",3)_$J("",13-$L($P(AUMRES("DILIST",I,0),"^",3)))_$P(AUMRES("DILIST",I,0),"^",2)
 . S FDA(9999999.09,$P(AUMRES("DILIST",I,0),"^",1)_",",.03)="1" ; Inactive Flag (.03)
 . D DINAOK
 I AUMCNT D UPDATE^DIE(,"FDA",)
 ;
 K AUMRES,FDA
 D FIND^DIC(9999999.09,"","@;.01;1;.06","PX",AUMMNE,,"C","I ($P(^(0),U,3)'=1),(Y'=AUMIEN)",,"AUMRES")
 S AUMCNT=$P($G(AUMRES("DILIST",0)),"^",1)
 I AUMCNT>0 D RSLT("DUPLICATE MNEMONICS FOUND FOR : "_AUMMNE_$J("",13-$L(AUMMNE))_AUMNAM)
 F I=1:1:AUMCNT  D
 . N L
 . S L=$P(AUMRES("DILIST",I,0),"^",3)_$J("",13-$L($P(AUMRES("DILIST",I,0),"^",3)))_$P(AUMRES("DILIST",I,0),"^",2)
 . S FDA(9999999.09,$P(AUMRES("DILIST",I,0),"^",1)_",",.03)="1" ; Inactive Flag (.03)
 . D DINAOK
 I AUMCNT D UPDATE^DIE(,"FDA",)
 ;
 Q
MJTMOD ;EP - update major education topics
 N AUMNAM,AUMMNE,AUMRES,FDA,NEWIEN,ERR,AUMCHG,AUMD0,AUMCNT,AUMIEN
 I '$D(MJTC) D RSLT("PATIENT EDUCATION MAJOR TOPICS") S MJTC=""
 S AUMCHG=0,U="^",AUMIEN=""
 S AUMNAM=$$CLEAN($P(L,U,1)),AUMMNE=$$CLEAN($E($P(L,U,2),1,4))
 S L=AUMMNE_$J("",7-$L(AUMMNE))_AUMNAM
 K AUMRES
 D FIND^DIC(99999.91,"","@;.01;.02","PX",AUMMNE,,"B",,,"AUMRES")
 S AUMCNT=$P($G(AUMRES("DILIST",0)),"^",1)
 I AUMCNT=0 S AUMIEN="" ; No matches found, create new
 I AUMCNT=1 S AUMIEN=$P($G(AUMRES("DILIST",1,0)),"^",1) ; One match found, store IEN
 I AUMCNT>1 S AUMIEN=$P($G(AUMRES("DILIST",$P($G(AUMRES("DILIST",0)),"^",1),0)),"^",1)
 I 'AUMIEN D
 . K FDA,NEWIEN,ERR
 . S FDA(99999.91,"+1,",.01)=AUMNAM ; Name (.01)
 . S FDA(99999.91,"+1,",.02)=AUMMNE ; Abbreviation (.02)
 . D UPDATE^DIE(,"FDA","NEWIEN","ERR")
 . I $D(ERR) D ADDFAIL Q
 . S AUMIEN=NEWIEN(1),AUMCHG=1
 Q:'AUMIEN
 S AUMD0=$G(^AUTTEDMT(AUMIEN,0))
 ;
 K FDA
 S FDA(99999.91,AUMIEN_",",.01)=AUMNAM ; Name (.01)
 S FDA(99999.91,AUMIEN_",",.02)=AUMMNE ; Abbreviation (.02)
 D UPDATE^DIE(,"FDA",)
 I AUMD0'=$G(^AUTTEDMT(AUMIEN,0)) S AUMCHG=1
 ;
 I AUMCHG D @$S($D(NEWIEN):"ADDOK",1:"MODOK")
 Q
CLEAN(X) ;
 N CNT,AUMSTR
 S AUMSTR=X
 S CNT=0 F  S CNT=$F(X," -") Q:'CNT  S $E(X,CNT-2,CNT-1)="-"
 S CNT=0 F  S CNT=$F(X,"- ") Q:'CNT  S $E(X,CNT-2,CNT-1)="-"
 S CNT=0 F  S CNT=$F(X,"  ") Q:'CNT  S $E(X,CNT-2,CNT-1)=" "
 I $E(X,1)=" " S X=$E(X,2,$L(X))
 I $E(X,$L(X))=" " S X=$E(X,1,$L(X)-1)
 Q X
TEXT(X) ;
 N AUMSTR,I,J
 S AUMSTR=X,I=1,J=1
 K X
 F I=1:1:$L(AUMSTR,"|")  D
 . Q:$L($P(AUMSTR,"|",I))=0
 . S X(J)=$P(AUMSTR,"|",I),J=J+1
 Q
SVARS ;;A,C,E,F,L,M,N,O,P,R,S,T,V;Single-character work variables
 Q
PKLST ;EP - Check to see what EHR pick lists might be affected
 D RSLT("DISPLAYING EHR PICKLISTS CONTAINING INACTIVE EDUCATION TOPICS")
 N PKNAM,PK1,PK2,PK3,PXEDT,AUMDSP
 S PKNAM="",PK1=0
 F  S PK1=$O(^BGOEDTPR(PK1)) Q:PK1'?1N.N  D
 .S AUMDSP=1
 .S PK2="" F  S PK2=$O(^BGOEDTPR(PK1,PK2)) Q:PK2'?1N.N  D
 ..S:PK2=0 PKNAM=$P(^BGOEDTPR(PK1,PK2),U,1)
 ..S PK3=0 F  S PK3=$O(^BGOEDTPR(PK1,PK2,PK3)) Q:PK3'?1N.N  D
 ...S PXEDT=$P($G(^BGOEDTPR(PK1,PK2,PK3,0)),U,1)
 ...Q:PXEDT=""
 ...Q:$P($G(^AUTTEDT(PXEDT,0)),U,3)'=1
 ...N AUMMNE,AUMNAM,AUMINA
 ...S AUMMNE=$P(^AUTTEDT(PXEDT,0),"^",2),AUMNAM=$P(^AUTTEDT(PXEDT,0),"^",1),AUMINA=$$FMTE^XLFDT($P(^AUTTEDT(PXEDT,0),"^",5))
 ...I AUMDSP D RSLT(""),RSLT("INACTIVE TOPIC(S) FOUND IN EHR PICKLIST: "_$P(^BGOEDTPR(PK1,0),"^",1)) S AUMDSP=0
 ...D RSLT($J("",4)_AUMMNE_$J("",13-$L(AUMMNE))_"'"_AUMNAM_"'"_$J("",51-$L(AUMNAM))_AUMINA)
 ...Q
 ..Q
 .Q
 Q