AUM41011 ;TASSC/MFD - SCB UPDATE 10/31/2003 [ 11/20/2003 3:32 PM ]
;;04.1;TABLE MAINTENANCE;**1**;OCT 13,2003
;
START ;EP -- MAIN EP
N DA,DIC,DIE,DINUM,DLAYGO,DR,@($P($T(SVARS),";",3))
D GREET
D DASH,SUNEW
D DASH,SUMOD
D DASH,LOCNEW
D DASH,LOCMOD
D DASH,LOCINACT
D DASH,COMMNEW
D DASH,COMMMOD
D DASH,TRIBEMOD
D DASH,EXAMNEW
D DASH,CLINNEW
D DASH,PCLASNEW
;D DASH,EDUCNEW
D DASH,HFNEW
Q
GREET ;----- GREETING/INTRO TEXT
D RSLT($J("",5)_$P($T(UPDATE^AUM4101A),";",3))
F L="GREET","INTROE","INTROI" D
. F %=1:1 D RSLT($P($T(@L+%^AUM4101),";",3)) Q:$P($T(@L+%+1^AUM4101),";",3)="###"
Q
;
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
;
E(L) ;-----
Q $P($P($T(@L^AUM4101A),";",3),":",1)
;
IEN(X,%,Y) ;
;----- UPDATE AREA, SERVICE UNIT, COUNTY
S Y=$O(@(X_"""C"",%,0)")) I Y Q +Y
I 'Y S Y=$$VAL^AUM4101M(X,%)
I Y D S:Y<0 Y=""
. N %,@($P($T(SVARS),";",3))
. S L=Y
. I X["AREA" D Q
. . N X
. . D RSLT("(Add Missing Area)")
. . D ADDAREA
. . D RSLT("(END Add Missing Area)")
. I X["SU" D Q
. . N X
. . D RSLT("(Add Missing SU)")
. . D ADDSU
. . D RSLT("(END Add Missing SU)")
. I X["CTY" D Q
. . N X
. . D RSLT("(Add Missing County)")
. . D ADDCNTY
. . D RSLT("(END Add Missing County)")
;
D:'Y RSLT($J("",5)_$$M(0)_$P(@(X_"0)"),U)_" DOES NOT EXIST => "_%)
Q +Y
;
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
;
RSLT(%) ; EP- INCREMENTS/UPDATES ^TMP("AUM4101,$J) called here and AUM4101
; global used to generate the email message sent by
; post-install routine
S ^(0)=$G(^TMP("AUM4101",$J,0))+1,^(^(0))=% D MES(%)
Q
;
MES(%) ;--- 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
;
ADDAREA ;--- NEW AREA
; PROGRAMMER NOTE: This s/r is required for every patch.
S L=$P(L,";;",2),A=$P(L,U),N=$P(L,U,2),R=$P(L,U,3),C=$P(L,U,4),L=$$LJ^XLFSTR(A,6)_$$LJ^XLFSTR(N,30)_$$LJ^XLFSTR(R,15)_C
I $D(^AUTTAREA("B",N)) D RSLT($J("",5)_$$M(1)_"NAME EXISTS => "_N) Q
I $D(^AUTTAREA("C",A)) D RSLT($J("",5)_$$M(1)_"CODE EXISTS => "_A) Q
S DLAYGO=9999999.21
S DIC="^AUTTAREA("
S X=N
S DIC("DR")=".02///"_A_";.03///"_R_";.04///"_C
D FILE
D @$S(Y>0:"ADDOK",1:"ADDFAIL")
Q
;
ADDCNTY ;--- NEW COUNTY
; PROGRAMMER NOTE: This s/r is required for every patch.
S L=$P(L,";;",2),S=$P(L,U),C=$P(L,U,2),N=$P(L,U,3),A=$P(L,U,4),L=S_" "_C_" "_N_$J("",30-$L(N))_A
I $D(^AUTTCTY("C",S_C)) D RSLT($J("",5)_$$M(1)_"CODE EXISTS => "_S_C) Q
S P("S")=$$IEN("^DIC(5,",S)
Q:'P("S")
S DIC="^AUTTCTY("
S X=N
S DIC("DR")=".02////"_P("S")_";.03///"_C_";.06///"_A
D FILE
D @$S(Y>0:"ADDOK",1:"ADDFAIL")
Q
;
ADDSU ;
; PROGRAMMER NOTE: This s/r is required for every patch.
S L=$P(L,";;",2),A=$P(L,U),S=$P(L,U,2),N=$P(L,U,3),L=$$LJ^XLFSTR(A,6)_$$LJ^XLFSTR(S,6)_N
I $D(^AUTTSU("C",A_S)) D RSLT($J("",5)_$$M(1)_"ASU EXISTS => "_A_S) Q
S P=$$IEN("^AUTTAREA(",A)
Q:'P
S DLAYGO=9999999.22
S DIC="^AUTTSU("
S X=N
S DIC("DR")=".02////"_P_";.03///"_S
D FILE
D @$S(Y>0:"ADDOK",1:"ADDFAIL")
Q
;
SUNEW ;--- ADD NEW SU
D RSLT($$E("SUNEW"))
D RSLT($J("",13)_$$LJ^XLFSTR("AREA",6)_$$LJ^XLFSTR("S.U.",6)_"NAME")
D RSLT($J("",13)_$$LJ^XLFSTR("----",6)_$$LJ^XLFSTR("----",6)_"----")
F T=1:1 S L=$T(SUNEW+T^AUM4101A) Q:$P(L,";",3)="END" D ADDSU
Q
;
SUMOD ;--- MOD SU
D RSLT($$E("SUMOD"))
D RSLT($J("",15)_"AA SU NAME")
D RSLT($J("",15)_"-- -- ----")
F T=1:2 S L=$T(SUMOD+T^AUM4101A) Q:$P(L,";",3)="END" S L("TO")=$T(SUMOD+T+1^AUM4101A) D
. S L=$P(L,U,2,99),A=$P(L,U),S=$P(L,U,2),N=$P(L,U,3)
. S P=$O(^AUTTSU("C",A_S,0))
. S L=$P(L("TO"),U,2,99),A=$P(L,U),S=$P(L,U,2),N=$P(L,U,3)
. I 'P S P=$O(^AUTTSU("C",A_S,0)) I 'P S L=";;"_L D ADDSU Q
. S L=A_" "_S_" "_N
. S P("A")=$$IEN("^AUTTAREA(",A)
. Q:'P("A")
. S DIE="^AUTTSU(",DA=P,DR=".01///"_N_";.02////"_P("A")_";.03///"_S
. D DIE
. I $D(Y) D RSLT($J("",5)_$$E(0)_" : EDIT SERVICE UNIT FAILED => "_L) Q
. D MODOK
Q
;
LOCNEW ;--- ADD NEW LOCATION
D RSLT($$E("LOCNEW"))
D RSLT($$RJ^XLFSTR("AA SU FA NAME",26)_$$RJ^XLFSTR("PSEUDO",34))
D RSLT($$RJ^XLFSTR("-- -- -- ----",26)_$$RJ^XLFSTR("------",34))
F T=1:1 S L=$T(LOCNEW+T^AUM4101A) Q:$P(L,";",3)="END" D ADDLOC
Q
ADDLOC ;
S L=$P(L,";;",2),A=$P(L,U),S=$P(L,U,2),F=$P(L,U,3),N=$P(L,U,4),P=$P(L,U,5)
S L=A_" "_S_" "_F_" "_N_$J("",32-$L(N))_P
S %=A_S_F,%=$O(^AUTTLOC("C",%,0))
I % D RSLT($J("",5)_$$M(1)_"ASUFAC EXISTS => "_A_S_F) D Q
. I $P($G(^AUTTLOC(%,0)),U,21) S DIE="^AUTTLOC(",DA=%,DR=".27///@;.28////"_DT D DIE D:$D(Y) RSLT($J("",5)_$$M(0)_"DELETE INACTIVE DATE FAILED => "_L) D:'$D(Y) RSLT($J("",5)_"INACTIVE DATE DELETED => "_L)
. S %=$O(^AUTTLOC("C",A_S_F,0)),%=$P(^AUTTLOC(%,0),U)
. I %,$D(^DIC(4,%,0)),N'=$P(^DIC(4,%,0),U) S DIE="^DIC(4,",DA=%,DR=".01///"_N D DIE D:$D(Y) RSLT($J("",5)_$$M(0)_"EDIT INSTITUTION FAILED => "_L) D:'$D(Y) RSLT($J("",5)_"INSTITUTION NAME UPDATED => "_L)
. S %=$O(^AUTTLOC("C",A_S_F,0))
. I P'=$P($G(^AUTTLOC(%,1)),U,2) S DIE="^AUTTLOC(",DA=%,DR=".28////"_DT_";.31///"_P D DIE D:$D(Y) RSLT($J("",5)_$$M(0)_"EDIT PSEUDO PREFIX FAILED => "_L) D:'$D(Y) RSLT($J("",5)_"PSEUDO PREFIX UPDATED => "_L)
.Q
S P("A")=$$IEN("^AUTTAREA(",A)
Q:'P("A")
S P("S")=$$IEN("^AUTTSU(",A_S)
Q:'P("S")
F DINUM=+$P(^DIC(4,0),U,3):1 Q:'$D(^DIC(4,DINUM))&('$D(^AUTTLOC(DINUM))) I DINUM>99999 D RSLT($J("",5)_$$M(0)_"DINUM FOR LOC/INSTITUTION TOO BIG. NOTIFY ISC.") Q
Q:DINUM>99999
S DLAYGO=4,DIC="^DIC(4,",X=N
D FILE
K DINUM,DLAYGO
I Y<0 D RSLT($J("",5)_$$M(0)_"^DIC(4 ADD FAILED => "_L) Q
NEW AUMAD
S AUMAD=0
F S AUMAD=$O(^DD(4,.01,1,AUMAD)) Q:'AUMAD I $P(^(AUMAD,0),U,2)="AD",$E(^(1),1)="I" Q
; If AD xref on 4 is active, edit LOCATION and Quit.
I AUMAD D Q
. S DA=+Y,DIE="^AUTTLOC(",DR=".04////"_P("A")_";.05////"_P("S")_";.07///"_F_";.28////"_DT_";.31///"_P
. D DIE
. I '$D(Y) D ADDOK Q
. D RSLT($J("",5)_$$M(0)_"EDIT LOCATION FAILED => "_L)
.Q
S DINUM=+Y,DLAYGO=9999999.06,DIC="^AUTTLOC(",X=DINUM,DIC("DR")=".04////"_P("A")_";.05////"_P("S")_";.07///"_F_";.28////"_DT_";.31///"_P
D FILE,@$S(Y>0:"ADDOK",1:"ADDFAIL")
KILL DINUM,DLAYGO
Q
;
LOCMOD ;--- MOD LOCATION
D RSLT($$E("LOCMOD"))
D RSLT($$RJ^XLFSTR("AA SU FA NAME",28)_$$RJ^XLFSTR("PSEUDO",34))
D RSLT($$RJ^XLFSTR("-- -- -- ----",28)_$$RJ^XLFSTR("------",34))
F T=1:2 S L=$T(LOCMOD+T^AUM4101A) Q:$P(L,";",3)="END" S L("TO")=$T(LOCMOD+T+1^AUM4101A) D
. S L=$P(L,U,2,99),A=$P(L,U),S=$P(L,U,2),F=$P(L,U,3)
. S P=$O(^AUTTLOC("C",A_S_F,0))
. S L=$P(L("TO"),U,2,99),A=$P(L,U),S=$P(L,U,2),F=$P(L,U,3),N=$P(L,U,4)
. I 'P S P=$O(^AUTTLOC("C",A_S_F,0)) I 'P S L=";;"_L D ADDLOC Q
. S L=A_" "_S_" "_F_" "_N_$J("",32-$L(N))_$P(L("TO"),U,6)
. S P("A")=$$IEN("^AUTTAREA(",A)
. Q:'P("A")
. S P("S")=$$IEN("^AUTTSU(",A_S)
. Q:'P("S")
. S DIE="^AUTTLOC(",DA=P,DR=".04////"_P("A")_";.05////"_P("S")_";.07///"_F_";.28////"_DT_";.31///"_$P(L("TO"),U,6)
. D DIE
. I $D(Y) D RSLT($J("",5)_$$M(0)_"EDIT LOCATION FAILED => "_L) Q
. S DIE="^DIC(4,",DA=$P(^AUTTLOC(P,0),U),DR=".01///"_N
. D DIE
. I $D(Y) D RSLT($J("",5)_$$M(0)_"EDIT INSTITUTION FAILED => "_L) Q
. D MODOK
.Q
;
D DASH
D RSLT("Checking Location Code changes to determine export status.")
D RSLT("Patient data is not exported if the only change is to the Location NAME.")
D RSLT("Location Code changes must be rolled up into the national data repository...")
D DASH,RSLT($$LOCMOD^AUMXPORT("AUM4101A")_" patients marked for export because of the Location Code changes.")
Q
;
LOCINACT ;--- INACTIVATE LOCATION
D RSLT("Inactivated Location Codes")
F T=1:1 S L=$T(LOCINACT+T^AUM4101A) Q:$P(L,";",3)="END" D
. S L=$P(L,";;",2),A=$P(L,U),S=$P(L,U,2),F=$P(L,U,3),N=$P(L,U,4),P=$P(L,U,5)
. S L=A_" "_S_" "_F_" "_N_" "_P
. S %=A_S_F,%=$O(^AUTTLOC("C",%,0))
. I '% D RSLT($J("",5)_"ASUFAC "_A_S_F_" not found (OK).") Q
. S DIE="^AUTTLOC(",DA=%,DR=".27////"_DT
. D DIE
. I $D(Y) D RSLT($J("",5)_$$E(0)_"EDIT INACTIVE DATE FAILED => "_L) I 1
. E D RSLT($J("",5)_"INACTIVATED => "_L)
.Q
Q
;
COMMNEW ;--- ADD COMMUNITY
D RSLT($$E("COMMNEW"))
D RSLT($$RJ^XLFSTR("ST CT COM NAME",27)_$$RJ^XLFSTR("AA SU",33))
D RSLT($$RJ^XLFSTR("-- -- --- ----",27)_$$RJ^XLFSTR("-- --",33))
F T=1:1 S L=$T(COMMNEW+T^AUM4101A) Q:$P(L,";",3)="END" D ADDCOMM
Q
ADDCOMM ;
S L=$P(L,";;",2),S=$P(L,U),O=$P(L,U,2),C=$P(L,U,3),N=$P(L,U,4),A=$P(L,U,5),V=$P(L,U,6),L=S_" "_O_" "_C_" "_N_$J("",32-$L(N))_A_" "_V
I $D(^AUTTCOM("C",S_O_C)) D RSLT($J("",5)_$$M(1)_"STCTYCOM CODE EXISTS => "_S_O_C) Q
S P("O")=$$IEN("^AUTTCTY(",S_O)
Q:'P("O")
S P("A")=$$IEN("^AUTTAREA(",A)
Q:'P("A")
S P("V")=$$IEN("^AUTTSU(",A_V)
Q:'P("V")
S DLAYGO=9999999.05,DIC="^AUTTCOM(",X=N,DIC("DR")=".02////"_P("O")_";.05////"_P("V")_";.06////"_P("A")_";.07///"_C
D FILE
D @$S(Y>0:"ADDOK",1:"ADDFAIL")
Q
;
COMMMOD ;--- MOD COMMUNITY
D RSLT($$E("COMMMOD"))
D RSLT($J("",15)_"ST CT COM NAME"_$J("",28)_"AA SU")
D RSLT($J("",15)_"-- -- --- ----"_$J("",28)_"-- --")
F T=1:2 S L=$T(COMMMOD+T^AUM4101A) Q:$P(L,";",3)="END" S L("TO")=$T(COMMMOD+T+1^AUM4101A) D
. S L=$P(L,U,2,99),S=$P(L,U),O=$P(L,U,2),C=$P(L,U,3)
. S P=$O(^AUTTCOM("C",S_O_C,0))
. S L=$P(L("TO"),U,2,99),S=$P(L,U),O=$P(L,U,2),C=$P(L,U,3),N=$P(L,U,4),A=$P(L,U,5),V=$P(L,U,6)
. I 'P S P=$O(^AUTTCOM("C",S_O_C,0)) I 'P S L=";;"_L D ADDCOMM Q
. S L=S_" "_O_" "_C_" "_N_$J("",32-$L(N))_A_" "_V
. S P("O")=$$IEN("^AUTTCTY(",S_O)
. Q:'P("O")
. S P("A")=$$IEN("^AUTTAREA(",A)
. Q:'P("A")
. S P("V")=$$IEN("^AUTTSU(",A_V)
. Q:'P("V")
. S DIE="^AUTTCOM(",DA=P,DR=".01///"_N_";.02////"_P("O")_";.05////"_P("V")_";.06////"_P("A")_";.07///"_C
. D DIE
. I $D(Y) D RSLT($J("",5)_$$M(0)_"CHANGE FAILED => "_L) Q
. D MODOK
.Q
D DASH
D RSLT("Checking Community Code changes to determine export status.")
D RSLT("Patient data is not exported if the only change is to the Commnuity NAME.")
D RSLT("Commnity Code changes must be rolled up into the national data repository...")
D DASH,RSLT($$COMMMOD^AUMXPORT("AUM4101A")_" patients marked for export because of the Community Code changes.")
Q
;
CLINNEW ;--- ADD NEW CLINIC
D RSLT($$E("CLINNEW"))
D RSLT($J("",11)_"CODE NAME"_$J("",28)_"ABRV. PRI.CARE 1A WL RPT")
D RSLT($J("",11)_"---- ----"_$J("",28)_"----- -------- ---------")
F T=1:1 S L=$T(CLINNEW+T^AUM4101A) Q:$P(L,";",3)="END" D ADDCLIN
KILL DLAYGO
Q
;
ADDCLIN ;
S L=$P(L,";;",2),C=$P(L,U),N=$P(L,U,2),A=$P(L,U,3),P=$P(L,U,4),R=$P(L,U,5),L=C_" "_N_$J("",(32-$L(N)))_$$LJ^XLFSTR(A,8)_$$LJ^XLFSTR(P,11)_R
I $D(^DIC(40.7,"C",C)) D RSLT($J("",5)_$$M(1)_"CLINIC CODE EXISTS => "_C),RSLT("") Q
S DLAYGO=40.7,DIC="^DIC(40.7,",X=N,DIC("DR")="1///"_C_";999999901///"_A_";90000.01///"_R
I $L(P) S DIC("DR")=DIC("DR")_";999999902///"_P
D FILE,ADDFAIL:Y<0,ADDOK:Y>0
Q
;
TRIBEMOD ;--- MOD TRIBE
; C=CODE, O=OLD, N=NAME, P=IEN
N @$P($T(SVARS),";",3)
D RSLT($$E("TRIBEMOD"))
D RSLT($$RJ^XLFSTR("CODE OLD NAME",28))
D RSLT($$RJ^XLFSTR("---- --- ----",28))
F T=1:2 S L=$T(TRIBEMOD+T^AUM4101A) Q:$P(L,";",3)="END" S L("TO")=$T(TRIBEMOD+T+1^AUM4101A) D
. S L=$P(L,U,2,99),C=$P(L,U),O=$P(L,U,2),N=$P(L,U,3)
. S P=$O(^AUTTTRI("C",C,0))
. S L=$P(L("TO"),U,2,99),C=$P(L,U),O=$P(L,U,2),N=$P(L,U,3)
. I 'P S P=$O(^AUTTTRI("C",C,0))
. I 'P S L=";;"_L D ADDTRIBE Q
. S L=C_" "_O_" "_N
. S DIE="^AUTTTRI("
. S DA=P
. S DR=".01///"_N_";.02///"_C_";.04///"_O
. D DIE
. I $D(Y) D RSLT($J("",5)_$$M(0)_"EDIT TRIBE FAILED => "_L) Q
. D MODOK
Q
ADDTRIBE ;
S L=$P(L,";;",2),C=$P(L,U),O=$P(L,U,2),N=$P(L,U,3)
S L=" "_$$LJ^XLFSTR(C,5)_$$LJ^XLFSTR(O,4)_N
S %=$O(^AUTTTRI("C",C,0))
I % D RSLT($J("",5)_$$M(1)_"TRIBE EXISTS => "_N) Q
S DLAYGO=9999999.03
S DIC="^AUTTTRI("
S X=N
S DIC("DR")=".02///"_C_";.04///"_O
D FILE
D @$S(Y>0:"ADDOK",1:"ADDFAIL")
Q
;
EXAMNEW ;--- NEW EXAM
N @$P($T(SVARS),";",3)
D RSLT($$E("EXAMNEW"))
D RSLT($J("",13)_"NAME")
D RSLT($J("",13)_"----")
F T=1:1 S L=$T(EXAMNEW+T^AUM4101A) Q:$P(L,";",3)="END" D ADDEXAM
Q
ADDEXAM ;
S L=$P(L,";;",2),N=$P(L,U),C=$P(L,U,2),L=N
;I $D(^AUTTEXAM("B",N)) D RSLT($J("",5)_$$M(1)_"EXAM NAME EXISTS => "_N) Q
I $D(^AUTTEXAM("C",C)) D RSLT($J("",5)_$$M(1)_"EXAM CODE EXISTS => "_C_" "_N) Q
S DLAYGO=9999999.15,DIC="^AUTTEXAM(",X=N
S DIC("DR")=".02///"_C
D FILE
D @$S(Y>0:"ADDOK",1:"ADDFAIL")
K DLAYGO
Q
;
EDUCNEW ;--- NEW PATIENT ED- P&F
D RSLT($$E("EDUCNEW"))
D RSLT($J("",13)_"NAME")
D RSLT($J("",13)_"----")
F T=1:1 S L=$T(EDUCNEW+T^AUM4101A) Q:$P(L,";",3)="END" D ADDEDUC
Q
ADDEDUC ;--- ADD THE NEW PATIENT EDUCATION
S L=$P(L,";;",2),N=$P(L,U),M=$P(L,U,2),C=$P(L,U,3),L=N
I $D(^AUTTEDPF("B",N)) D RSLT($J("",5)_$$M(1)_"PT ED NAME EXISTS => "_N) Q
S DLAYGO=9999999.98,DIC="^AUTTEDPF(",X=N
S DIC("DR")=".02///"_M_";.03///"_C
D FILE
D @$S(Y>0:"ADDOK",1:"ADDFAIL")
Q
;
HFNEW ;--- NEW HEALTH FACTORS
D RSLT($$E("HFNEW"))
D RSLT($J("",13)_"NAME")
D RSLT($J("",13)_"----")
F T=1:1 S L=$T(HFNEW+T^AUM4101A) Q:$P(L,";",3)="END" D ADDHF
Q
ADDHF ;
S L=$P(L,";;",2),N=$P(L,U),O=$P(L,U,2),C=$P(L,U,3),S=$P(L,U,4),L=N_" "_O_" "_C_" "_S
I $D(^AUTTHF("B",N)) D RSLT($J("",5)_$$M(1)_"HEALTH FACTOR EXISTS => "_N),RSLT("") Q
S DLAYGO=9999999.64,DIC="^AUTTHF(",X=N,DIC("DR")=".03///"_O_";.1///"_C_";.14///"_S
D FILE
D @$S(Y>0:"ADDOK",1:"ADDFAIL")
Q
;
PCLASNEW ;--- NEW PROV CLASS
S E=$$E("PCLASNEW")
D RSLT(E)
D RSLT($J("",11)_"CODE NAME"_$J("",28)_"ABRV.")
D RSLT($J("",11)_"---- ----"_$J("",28)_"-----")
F T=1:1 S L=$T(PCLASNEW+T^AUM4101A) Q:$P(L,";",3)="END" D ADDPCLAS
Q
ADDPCLAS ;
S L=$P(L,";;",2),C=$P(L,U),N=$P(L,U,2),A=$P(L,U,3),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
D FILE
D @$S(Y>0:"ADDOK",1:"ADDFAIL")
Q
;
SVARS ;;A,C,E,F,L,M,N,O,P,R,S,T,V;Single-character work variables
Q
AUM41011 ;TASSC/MFD - SCB UPDATE 10/31/2003 [ 11/20/2003 3:32 PM ]
+1 ;;04.1;TABLE MAINTENANCE;**1**;OCT 13,2003
+2 ;
START ;EP -- MAIN EP
+1 NEW DA,DIC,DIE,DINUM,DLAYGO,DR,@($PIECE($TEXT(SVARS),";",3))
+2 DO GREET
+3 DO DASH
DO SUNEW
+4 DO DASH
DO SUMOD
+5 DO DASH
DO LOCNEW
+6 DO DASH
DO LOCMOD
+7 DO DASH
DO LOCINACT
+8 DO DASH
DO COMMNEW
+9 DO DASH
DO COMMMOD
+10 DO DASH
DO TRIBEMOD
+11 DO DASH
DO EXAMNEW
+12 DO DASH
DO CLINNEW
+13 DO DASH
DO PCLASNEW
+14 ;D DASH,EDUCNEW
+15 DO DASH
DO HFNEW
+16 QUIT
GREET ;----- GREETING/INTRO TEXT
+1 DO RSLT($JUSTIFY("",5)_$PIECE($TEXT(UPDATE^AUM4101A),";",3))
+2 FOR L="GREET","INTROE","INTROI"
Begin DoDot:1
+3 FOR %=1:1
DO RSLT($PIECE($TEXT(@L+%^AUM4101),";",3))
IF $PIECE($TEXT(@L+%+1^AUM4101),";",3)="###"
QUIT
End DoDot:1
+4 QUIT
+5 ;
ADDOK ;----- "ADDED" MESSAGE
+1 DO RSLT($JUSTIFY("",5)_"Added : "_L)
+2 QUIT
+3 ;
ADDFAIL ;----- "FAILED" MESSAGE
+1 DO RSLT($JUSTIFY("",5)_$$M(0)_"ADD FAILED => "_L)
+2 QUIT
+3 ;
DASH ;----- PRT DASH LINE
+1 DO RSLT("")
+2 DO RSLT($$REPEAT^XLFSTR("-",$SELECT($GET(IOM):IOM-10,1:70)))
+3 DO RSLT("")
+4 QUIT
+5 ;
DIE ;----- DIE EDIT
+1 NEW @($PIECE($TEXT(SVARS),";",3))
+2 LOCK +(@(DIE_DA_")")):10
+3 IF '$TEST
DO RSLT($JUSTIFY("",5)_$$M(0)_"Entry '"_DIE_DA_"' IS LOCKED. NOTIFY PROGRAMMER.")
SET Y=1
QUIT
+4 DO ^DIE
+5 LOCK -(@(DIE_DA_")"))
+6 QUIT
+7 ;
E(L) ;-----
+1 QUIT $PIECE($PIECE($TEXT(@L^AUM4101A),";",3),":",1)
+2 ;
IEN(X,%,Y) ;
+1 ;----- UPDATE AREA, SERVICE UNIT, COUNTY
+2 SET Y=$ORDER(@(X_"""C"",%,0)"))
IF Y
QUIT +Y
+3 IF 'Y
SET Y=$$VAL^AUM4101M(X,%)
+4 IF Y
Begin DoDot:1
+5 NEW %,@($PIECE($TEXT(SVARS),";",3))
+6 SET L=Y
+7 IF X["AREA"
Begin DoDot:2
+8 NEW X
+9 DO RSLT("(Add Missing Area)")
+10 DO ADDAREA
+11 DO RSLT("(END Add Missing Area)")
End DoDot:2
QUIT
+12 IF X["SU"
Begin DoDot:2
+13 NEW X
+14 DO RSLT("(Add Missing SU)")
+15 DO ADDSU
+16 DO RSLT("(END Add Missing SU)")
End DoDot:2
QUIT
+17 IF X["CTY"
Begin DoDot:2
+18 NEW X
+19 DO RSLT("(Add Missing County)")
+20 DO ADDCNTY
+21 DO RSLT("(END Add Missing County)")
End DoDot:2
QUIT
End DoDot:1
IF Y<0
SET Y=""
+22 ;
+23 IF 'Y
DO RSLT($JUSTIFY("",5)_$$M(0)_$PIECE(@(X_"0)"),U)_" DOES NOT EXIST => "_%)
+24 QUIT +Y
+25 ;
DIK ;--- KILL ENTRY
+1 NEW @($PIECE($TEXT(SVARS),";",3)),DIK
+2 DO ^DIK
+3 QUIT
+4 ;
FILE ;--- FILE NEW ENTRY
+1 NEW @($PIECE($TEXT(SVARS),";",3))
+2 KILL DD,DO
+3 SET DIC(0)="L"
+4 DO FILE^DICN
+5 KILL DIC,DLAYGO
+6 QUIT
+7 ;
M(%) ;--- ERROR MESSAGE
+1 QUIT $SELECT(%=0:"ERROR : ",%=1:"NOT ADDED : ",1:"")
+2 ;
MODOK ;--- IF MOD OK
+1 DO RSLT($JUSTIFY("",5)_"Changed : "_L)
+2 QUIT
+3 ;
RSLT(%) ; EP- INCREMENTS/UPDATES ^TMP("AUM4101,$J) called here and AUM4101
+1 ; global used to generate the email message sent by
+2 ; post-install routine
+3 SET ^(0)=$GET(^TMP("AUM4101",$JOB,0))+1
SET ^(^(0))=%
DO MES(%)
+4 QUIT
+5 ;
MES(%) ;--- ISSUE MESSAGES DURING INSTALL
+1 NEW @($PIECE($TEXT(SVARS),";",3))
+2 DO MES^XPDUTL(%)
+3 QUIT
+4 ;
IXDIC(DIC,DIC0,D,X,DLAYGO) ;
+1 ;--- CALL TO FILEMAN IX^DIC
+2 NEW @($PIECE($TEXT(SVARS),";",3))
+3 SET DIC(0)=DIC0
+4 KILL DIC0
+5 IF '$GET(DLAYGO)
KILL DLAYGO
+6 DO IX^DIC
+7 QUIT Y
+8 ;
ADDAREA ;--- NEW AREA
+1 ; PROGRAMMER NOTE: This s/r is required for every patch.
+2 SET L=$PIECE(L,";;",2)
SET A=$PIECE(L,U)
SET N=$PIECE(L,U,2)
SET R=$PIECE(L,U,3)
SET C=$PIECE(L,U,4)
SET L=$$LJ^XLFSTR(A,6)_$$LJ^XLFSTR(N,30)_$$LJ^XLFSTR(R,15)_C
+3 IF $DATA(^AUTTAREA("B",N))
DO RSLT($JUSTIFY("",5)_$$M(1)_"NAME EXISTS => "_N)
QUIT
+4 IF $DATA(^AUTTAREA("C",A))
DO RSLT($JUSTIFY("",5)_$$M(1)_"CODE EXISTS => "_A)
QUIT
+5 SET DLAYGO=9999999.21
+6 SET DIC="^AUTTAREA("
+7 SET X=N
+8 SET DIC("DR")=".02///"_A_";.03///"_R_";.04///"_C
+9 DO FILE
+10 DO @$SELECT(Y>0:"ADDOK",1:"ADDFAIL")
+11 QUIT
+12 ;
ADDCNTY ;--- NEW COUNTY
+1 ; PROGRAMMER NOTE: This s/r is required for every patch.
+2 SET L=$PIECE(L,";;",2)
SET S=$PIECE(L,U)
SET C=$PIECE(L,U,2)
SET N=$PIECE(L,U,3)
SET A=$PIECE(L,U,4)
SET L=S_" "_C_" "_N_$JUSTIFY("",30-$LENGTH(N))_A
+3 IF $DATA(^AUTTCTY("C",S_C))
DO RSLT($JUSTIFY("",5)_$$M(1)_"CODE EXISTS => "_S_C)
QUIT
+4 SET P("S")=$$IEN("^DIC(5,",S)
+5 IF 'P("S")
QUIT
+6 SET DIC="^AUTTCTY("
+7 SET X=N
+8 SET DIC("DR")=".02////"_P("S")_";.03///"_C_";.06///"_A
+9 DO FILE
+10 DO @$SELECT(Y>0:"ADDOK",1:"ADDFAIL")
+11 QUIT
+12 ;
ADDSU ;
+1 ; PROGRAMMER NOTE: This s/r is required for every patch.
+2 SET L=$PIECE(L,";;",2)
SET A=$PIECE(L,U)
SET S=$PIECE(L,U,2)
SET N=$PIECE(L,U,3)
SET L=$$LJ^XLFSTR(A,6)_$$LJ^XLFSTR(S,6)_N
+3 IF $DATA(^AUTTSU("C",A_S))
DO RSLT($JUSTIFY("",5)_$$M(1)_"ASU EXISTS => "_A_S)
QUIT
+4 SET P=$$IEN("^AUTTAREA(",A)
+5 IF 'P
QUIT
+6 SET DLAYGO=9999999.22
+7 SET DIC="^AUTTSU("
+8 SET X=N
+9 SET DIC("DR")=".02////"_P_";.03///"_S
+10 DO FILE
+11 DO @$SELECT(Y>0:"ADDOK",1:"ADDFAIL")
+12 QUIT
+13 ;
SUNEW ;--- ADD NEW SU
+1 DO RSLT($$E("SUNEW"))
+2 DO RSLT($JUSTIFY("",13)_$$LJ^XLFSTR("AREA",6)_$$LJ^XLFSTR("S.U.",6)_"NAME")
+3 DO RSLT($JUSTIFY("",13)_$$LJ^XLFSTR("----",6)_$$LJ^XLFSTR("----",6)_"----")
+4 FOR T=1:1
SET L=$TEXT(SUNEW+T^AUM4101A)
IF $PIECE(L,";",3)="END"
QUIT
DO ADDSU
+5 QUIT
+6 ;
SUMOD ;--- MOD SU
+1 DO RSLT($$E("SUMOD"))
+2 DO RSLT($JUSTIFY("",15)_"AA SU NAME")
+3 DO RSLT($JUSTIFY("",15)_"-- -- ----")
+4 FOR T=1:2
SET L=$TEXT(SUMOD+T^AUM4101A)
IF $PIECE(L,";",3)="END"
QUIT
SET L("TO")=$TEXT(SUMOD+T+1^AUM4101A)
Begin DoDot:1
+5 SET L=$PIECE(L,U,2,99)
SET A=$PIECE(L,U)
SET S=$PIECE(L,U,2)
SET N=$PIECE(L,U,3)
+6 SET P=$ORDER(^AUTTSU("C",A_S,0))
+7 SET L=$PIECE(L("TO"),U,2,99)
SET A=$PIECE(L,U)
SET S=$PIECE(L,U,2)
SET N=$PIECE(L,U,3)
+8 IF 'P
SET P=$ORDER(^AUTTSU("C",A_S,0))
IF 'P
SET L=";;"_L
DO ADDSU
QUIT
+9 SET L=A_" "_S_" "_N
+10 SET P("A")=$$IEN("^AUTTAREA(",A)
+11 IF 'P("A")
QUIT
+12 SET DIE="^AUTTSU("
SET DA=P
SET DR=".01///"_N_";.02////"_P("A")_";.03///"_S
+13 DO DIE
+14 IF $DATA(Y)
DO RSLT($JUSTIFY("",5)_$$E(0)_" : EDIT SERVICE UNIT FAILED => "_L)
QUIT
+15 DO MODOK
End DoDot:1
+16 QUIT
+17 ;
LOCNEW ;--- ADD NEW LOCATION
+1 DO RSLT($$E("LOCNEW"))
+2 DO RSLT($$RJ^XLFSTR("AA SU FA NAME",26)_$$RJ^XLFSTR("PSEUDO",34))
+3 DO RSLT($$RJ^XLFSTR("-- -- -- ----",26)_$$RJ^XLFSTR("------",34))
+4 FOR T=1:1
SET L=$TEXT(LOCNEW+T^AUM4101A)
IF $PIECE(L,";",3)="END"
QUIT
DO ADDLOC
+5 QUIT
ADDLOC ;
+1 SET L=$PIECE(L,";;",2)
SET A=$PIECE(L,U)
SET S=$PIECE(L,U,2)
SET F=$PIECE(L,U,3)
SET N=$PIECE(L,U,4)
SET P=$PIECE(L,U,5)
+2 SET L=A_" "_S_" "_F_" "_N_$JUSTIFY("",32-$LENGTH(N))_P
+3 SET %=A_S_F
SET %=$ORDER(^AUTTLOC("C",%,0))
+4 IF %
DO RSLT($JUSTIFY("",5)_$$M(1)_"ASUFAC EXISTS => "_A_S_F)
Begin DoDot:1
+5 IF $PIECE($GET(^AUTTLOC(%,0)),U,21)
SET DIE="^AUTTLOC("
SET DA=%
SET DR=".27///@;.28////"_DT
DO DIE
IF $DATA(Y)
DO RSLT($JUSTIFY("",5)_$$M(0)_"DELETE INACTIVE DATE FAILED => "_L)
IF '$DATA(Y)
DO RSLT($JUSTIFY("",5)_"INACTIVE DATE DELETED => "_L)
+6 SET %=$ORDER(^AUTTLOC("C",A_S_F,0))
SET %=$PIECE(^AUTTLOC(%,0),U)
+7 IF %
IF $DATA(^DIC(4,%,0))
IF N'=$PIECE(^DIC(4,%,0),U)
SET DIE="^DIC(4,"
SET DA=%
SET DR=".01///"_N
DO DIE
IF $DATA(Y)
DO RSLT($JUSTIFY("",5)_$$M(0)_"EDIT INSTITUTION FAILED => "_L)
IF '$DATA(Y)
DO RSLT($JUSTIFY("",5)_"INSTITUTION NAME UPDATED => "_L)
+8 SET %=$ORDER(^AUTTLOC("C",A_S_F,0))
+9 IF P'=$PIECE($GET(^AUTTLOC(%,1)),U,2)
SET DIE="^AUTTLOC("
SET DA=%
SET DR=".28////"_DT_";.31///"_P
DO DIE
IF $DATA(Y)
DO RSLT($JUSTIFY("",5)_$$M(0)_"EDIT PSEUDO PREFIX FAILED => "_L)
IF '$DATA(Y)
DO RSLT($JUSTIFY("",5)_"PSEUDO PREFIX UPDATED => "_L)
+10 QUIT
End DoDot:1
QUIT
+11 SET P("A")=$$IEN("^AUTTAREA(",A)
+12 IF 'P("A")
QUIT
+13 SET P("S")=$$IEN("^AUTTSU(",A_S)
+14 IF 'P("S")
QUIT
+15 FOR DINUM=+$PIECE(^DIC(4,0),U,3):1
IF '$DATA(^DIC(4,DINUM))&('$DATA(^AUTTLOC(DINUM)))
QUIT
IF DINUM>99999
DO RSLT($JUSTIFY("",5)_$$M(0)_"DINUM FOR LOC/INSTITUTION TOO BIG. NOTIFY ISC.")
QUIT
+16 IF DINUM>99999
QUIT
+17 SET DLAYGO=4
SET DIC="^DIC(4,"
SET X=N
+18 DO FILE
+19 KILL DINUM,DLAYGO
+20 IF Y<0
DO RSLT($JUSTIFY("",5)_$$M(0)_"^DIC(4 ADD FAILED => "_L)
QUIT
+21 NEW AUMAD
+22 SET AUMAD=0
+23 FOR
SET AUMAD=$ORDER(^DD(4,.01,1,AUMAD))
IF 'AUMAD
QUIT
IF $PIECE(^(AUMAD,0),U,2)="AD"
IF $EXTRACT(^(1),1)="I"
QUIT
+24 ; If AD xref on 4 is active, edit LOCATION and Quit.
+25 IF AUMAD
Begin DoDot:1
+26 SET DA=+Y
SET DIE="^AUTTLOC("
SET DR=".04////"_P("A")_";.05////"_P("S")_";.07///"_F_";.28////"_DT_";.31///"_P
+27 DO DIE
+28 IF '$DATA(Y)
DO ADDOK
QUIT
+29 DO RSLT($JUSTIFY("",5)_$$M(0)_"EDIT LOCATION FAILED => "_L)
+30 QUIT
End DoDot:1
QUIT
+31 SET DINUM=+Y
SET DLAYGO=9999999.06
SET DIC="^AUTTLOC("
SET X=DINUM
SET DIC("DR")=".04////"_P("A")_";.05////"_P("S")_";.07///"_F_";.28////"_DT_";.31///"_P
+32 DO FILE
DO @$SELECT(Y>0:"ADDOK",1:"ADDFAIL")
+33 KILL DINUM,DLAYGO
+34 QUIT
+35 ;
LOCMOD ;--- MOD LOCATION
+1 DO RSLT($$E("LOCMOD"))
+2 DO RSLT($$RJ^XLFSTR("AA SU FA NAME",28)_$$RJ^XLFSTR("PSEUDO",34))
+3 DO RSLT($$RJ^XLFSTR("-- -- -- ----",28)_$$RJ^XLFSTR("------",34))
+4 FOR T=1:2
SET L=$TEXT(LOCMOD+T^AUM4101A)
IF $PIECE(L,";",3)="END"
QUIT
SET L("TO")=$TEXT(LOCMOD+T+1^AUM4101A)
Begin DoDot:1
+5 SET L=$PIECE(L,U,2,99)
SET A=$PIECE(L,U)
SET S=$PIECE(L,U,2)
SET F=$PIECE(L,U,3)
+6 SET P=$ORDER(^AUTTLOC("C",A_S_F,0))
+7 SET L=$PIECE(L("TO"),U,2,99)
SET A=$PIECE(L,U)
SET S=$PIECE(L,U,2)
SET F=$PIECE(L,U,3)
SET N=$PIECE(L,U,4)
+8 IF 'P
SET P=$ORDER(^AUTTLOC("C",A_S_F,0))
IF 'P
SET L=";;"_L
DO ADDLOC
QUIT
+9 SET L=A_" "_S_" "_F_" "_N_$JUSTIFY("",32-$LENGTH(N))_$PIECE(L("TO"),U,6)
+10 SET P("A")=$$IEN("^AUTTAREA(",A)
+11 IF 'P("A")
QUIT
+12 SET P("S")=$$IEN("^AUTTSU(",A_S)
+13 IF 'P("S")
QUIT
+14 SET DIE="^AUTTLOC("
SET DA=P
SET DR=".04////"_P("A")_";.05////"_P("S")_";.07///"_F_";.28////"_DT_";.31///"_$PIECE(L("TO"),U,6)
+15 DO DIE
+16 IF $DATA(Y)
DO RSLT($JUSTIFY("",5)_$$M(0)_"EDIT LOCATION FAILED => "_L)
QUIT
+17 SET DIE="^DIC(4,"
SET DA=$PIECE(^AUTTLOC(P,0),U)
SET DR=".01///"_N
+18 DO DIE
+19 IF $DATA(Y)
DO RSLT($JUSTIFY("",5)_$$M(0)_"EDIT INSTITUTION FAILED => "_L)
QUIT
+20 DO MODOK
+21 QUIT
End DoDot:1
+22 ;
+23 DO DASH
+24 DO RSLT("Checking Location Code changes to determine export status.")
+25 DO RSLT("Patient data is not exported if the only change is to the Location NAME.")
+26 DO RSLT("Location Code changes must be rolled up into the national data repository...")
+27 DO DASH
DO RSLT($$LOCMOD^AUMXPORT("AUM4101A")_" patients marked for export because of the Location Code changes.")
+28 QUIT
+29 ;
LOCINACT ;--- INACTIVATE LOCATION
+1 DO RSLT("Inactivated Location Codes")
+2 FOR T=1:1
SET L=$TEXT(LOCINACT+T^AUM4101A)
IF $PIECE(L,";",3)="END"
QUIT
Begin DoDot:1
+3 SET L=$PIECE(L,";;",2)
SET A=$PIECE(L,U)
SET S=$PIECE(L,U,2)
SET F=$PIECE(L,U,3)
SET N=$PIECE(L,U,4)
SET P=$PIECE(L,U,5)
+4 SET L=A_" "_S_" "_F_" "_N_" "_P
+5 SET %=A_S_F
SET %=$ORDER(^AUTTLOC("C",%,0))
+6 IF '%
DO RSLT($JUSTIFY("",5)_"ASUFAC "_A_S_F_" not found (OK).")
QUIT
+7 SET DIE="^AUTTLOC("
SET DA=%
SET DR=".27////"_DT
+8 DO DIE
+9 IF $DATA(Y)
DO RSLT($JUSTIFY("",5)_$$E(0)_"EDIT INACTIVE DATE FAILED => "_L)
IF 1
+10 IF '$TEST
DO RSLT($JUSTIFY("",5)_"INACTIVATED => "_L)
+11 QUIT
End DoDot:1
+12 QUIT
+13 ;
COMMNEW ;--- ADD COMMUNITY
+1 DO RSLT($$E("COMMNEW"))
+2 DO RSLT($$RJ^XLFSTR("ST CT COM NAME",27)_$$RJ^XLFSTR("AA SU",33))
+3 DO RSLT($$RJ^XLFSTR("-- -- --- ----",27)_$$RJ^XLFSTR("-- --",33))
+4 FOR T=1:1
SET L=$TEXT(COMMNEW+T^AUM4101A)
IF $PIECE(L,";",3)="END"
QUIT
DO ADDCOMM
+5 QUIT
ADDCOMM ;
+1 SET L=$PIECE(L,";;",2)
SET S=$PIECE(L,U)
SET O=$PIECE(L,U,2)
SET C=$PIECE(L,U,3)
SET N=$PIECE(L,U,4)
SET A=$PIECE(L,U,5)
SET V=$PIECE(L,U,6)
SET L=S_" "_O_" "_C_" "_N_$JUSTIFY("",32-$LENGTH(N))_A_" "_V
+2 IF $DATA(^AUTTCOM("C",S_O_C))
DO RSLT($JUSTIFY("",5)_$$M(1)_"STCTYCOM CODE EXISTS => "_S_O_C)
QUIT
+3 SET P("O")=$$IEN("^AUTTCTY(",S_O)
+4 IF 'P("O")
QUIT
+5 SET P("A")=$$IEN("^AUTTAREA(",A)
+6 IF 'P("A")
QUIT
+7 SET P("V")=$$IEN("^AUTTSU(",A_V)
+8 IF 'P("V")
QUIT
+9 SET DLAYGO=9999999.05
SET DIC="^AUTTCOM("
SET X=N
SET DIC("DR")=".02////"_P("O")_";.05////"_P("V")_";.06////"_P("A")_";.07///"_C
+10 DO FILE
+11 DO @$SELECT(Y>0:"ADDOK",1:"ADDFAIL")
+12 QUIT
+13 ;
COMMMOD ;--- MOD COMMUNITY
+1 DO RSLT($$E("COMMMOD"))
+2 DO RSLT($JUSTIFY("",15)_"ST CT COM NAME"_$JUSTIFY("",28)_"AA SU")
+3 DO RSLT($JUSTIFY("",15)_"-- -- --- ----"_$JUSTIFY("",28)_"-- --")
+4 FOR T=1:2
SET L=$TEXT(COMMMOD+T^AUM4101A)
IF $PIECE(L,";",3)="END"
QUIT
SET L("TO")=$TEXT(COMMMOD+T+1^AUM4101A)
Begin DoDot:1
+5 SET L=$PIECE(L,U,2,99)
SET S=$PIECE(L,U)
SET O=$PIECE(L,U,2)
SET C=$PIECE(L,U,3)
+6 SET P=$ORDER(^AUTTCOM("C",S_O_C,0))
+7 SET L=$PIECE(L("TO"),U,2,99)
SET S=$PIECE(L,U)
SET O=$PIECE(L,U,2)
SET C=$PIECE(L,U,3)
SET N=$PIECE(L,U,4)
SET A=$PIECE(L,U,5)
SET V=$PIECE(L,U,6)
+8 IF 'P
SET P=$ORDER(^AUTTCOM("C",S_O_C,0))
IF 'P
SET L=";;"_L
DO ADDCOMM
QUIT
+9 SET L=S_" "_O_" "_C_" "_N_$JUSTIFY("",32-$LENGTH(N))_A_" "_V
+10 SET P("O")=$$IEN("^AUTTCTY(",S_O)
+11 IF 'P("O")
QUIT
+12 SET P("A")=$$IEN("^AUTTAREA(",A)
+13 IF 'P("A")
QUIT
+14 SET P("V")=$$IEN("^AUTTSU(",A_V)
+15 IF 'P("V")
QUIT
+16 SET DIE="^AUTTCOM("
SET DA=P
SET DR=".01///"_N_";.02////"_P("O")_";.05////"_P("V")_";.06////"_P("A")_";.07///"_C
+17 DO DIE
+18 IF $DATA(Y)
DO RSLT($JUSTIFY("",5)_$$M(0)_"CHANGE FAILED => "_L)
QUIT
+19 DO MODOK
+20 QUIT
End DoDot:1
+21 DO DASH
+22 DO RSLT("Checking Community Code changes to determine export status.")
+23 DO RSLT("Patient data is not exported if the only change is to the Commnuity NAME.")
+24 DO RSLT("Commnity Code changes must be rolled up into the national data repository...")
+25 DO DASH
DO RSLT($$COMMMOD^AUMXPORT("AUM4101A")_" patients marked for export because of the Community Code changes.")
+26 QUIT
+27 ;
CLINNEW ;--- ADD NEW CLINIC
+1 DO RSLT($$E("CLINNEW"))
+2 DO RSLT($JUSTIFY("",11)_"CODE NAME"_$JUSTIFY("",28)_"ABRV. PRI.CARE 1A WL RPT")
+3 DO RSLT($JUSTIFY("",11)_"---- ----"_$JUSTIFY("",28)_"----- -------- ---------")
+4 FOR T=1:1
SET L=$TEXT(CLINNEW+T^AUM4101A)
IF $PIECE(L,";",3)="END"
QUIT
DO ADDCLIN
+5 KILL DLAYGO
+6 QUIT
+7 ;
ADDCLIN ;
+1 SET L=$PIECE(L,";;",2)
SET C=$PIECE(L,U)
SET N=$PIECE(L,U,2)
SET A=$PIECE(L,U,3)
SET P=$PIECE(L,U,4)
SET R=$PIECE(L,U,5)
SET L=C_" "_N_$JUSTIFY("",(32-$LENGTH(N)))_$$LJ^XLFSTR(A,8)_$$LJ^XLFSTR(P,11)_R
+2 IF $DATA(^DIC(40.7,"C",C))
DO RSLT($JUSTIFY("",5)_$$M(1)_"CLINIC CODE EXISTS => "_C)
DO RSLT("")
QUIT
+3 SET DLAYGO=40.7
SET DIC="^DIC(40.7,"
SET X=N
SET DIC("DR")="1///"_C_";999999901///"_A_";90000.01///"_R
+4 IF $LENGTH(P)
SET DIC("DR")=DIC("DR")_";999999902///"_P
+5 DO FILE
IF Y<0
DO ADDFAIL
IF Y>0
DO ADDOK
+6 QUIT
+7 ;
TRIBEMOD ;--- MOD TRIBE
+1 ; C=CODE, O=OLD, N=NAME, P=IEN
+2 NEW @$PIECE($TEXT(SVARS),";",3)
+3 DO RSLT($$E("TRIBEMOD"))
+4 DO RSLT($$RJ^XLFSTR("CODE OLD NAME",28))
+5 DO RSLT($$RJ^XLFSTR("---- --- ----",28))
+6 FOR T=1:2
SET L=$TEXT(TRIBEMOD+T^AUM4101A)
IF $PIECE(L,";",3)="END"
QUIT
SET L("TO")=$TEXT(TRIBEMOD+T+1^AUM4101A)
Begin DoDot:1
+7 SET L=$PIECE(L,U,2,99)
SET C=$PIECE(L,U)
SET O=$PIECE(L,U,2)
SET N=$PIECE(L,U,3)
+8 SET P=$ORDER(^AUTTTRI("C",C,0))
+9 SET L=$PIECE(L("TO"),U,2,99)
SET C=$PIECE(L,U)
SET O=$PIECE(L,U,2)
SET N=$PIECE(L,U,3)
+10 IF 'P
SET P=$ORDER(^AUTTTRI("C",C,0))
+11 IF 'P
SET L=";;"_L
DO ADDTRIBE
QUIT
+12 SET L=C_" "_O_" "_N
+13 SET DIE="^AUTTTRI("
+14 SET DA=P
+15 SET DR=".01///"_N_";.02///"_C_";.04///"_O
+16 DO DIE
+17 IF $DATA(Y)
DO RSLT($JUSTIFY("",5)_$$M(0)_"EDIT TRIBE FAILED => "_L)
QUIT
+18 DO MODOK
End DoDot:1
+19 QUIT
ADDTRIBE ;
+1 SET L=$PIECE(L,";;",2)
SET C=$PIECE(L,U)
SET O=$PIECE(L,U,2)
SET N=$PIECE(L,U,3)
+2 SET L=" "_$$LJ^XLFSTR(C,5)_$$LJ^XLFSTR(O,4)_N
+3 SET %=$ORDER(^AUTTTRI("C",C,0))
+4 IF %
DO RSLT($JUSTIFY("",5)_$$M(1)_"TRIBE EXISTS => "_N)
QUIT
+5 SET DLAYGO=9999999.03
+6 SET DIC="^AUTTTRI("
+7 SET X=N
+8 SET DIC("DR")=".02///"_C_";.04///"_O
+9 DO FILE
+10 DO @$SELECT(Y>0:"ADDOK",1:"ADDFAIL")
+11 QUIT
+12 ;
EXAMNEW ;--- NEW EXAM
+1 NEW @$PIECE($TEXT(SVARS),";",3)
+2 DO RSLT($$E("EXAMNEW"))
+3 DO RSLT($JUSTIFY("",13)_"NAME")
+4 DO RSLT($JUSTIFY("",13)_"----")
+5 FOR T=1:1
SET L=$TEXT(EXAMNEW+T^AUM4101A)
IF $PIECE(L,";",3)="END"
QUIT
DO ADDEXAM
+6 QUIT
ADDEXAM ;
+1 SET L=$PIECE(L,";;",2)
SET N=$PIECE(L,U)
SET C=$PIECE(L,U,2)
SET L=N
+2 ;I $D(^AUTTEXAM("B",N)) D RSLT($J("",5)_$$M(1)_"EXAM NAME EXISTS => "_N) Q
+3 IF $DATA(^AUTTEXAM("C",C))
DO RSLT($JUSTIFY("",5)_$$M(1)_"EXAM CODE EXISTS => "_C_" "_N)
QUIT
+4 SET DLAYGO=9999999.15
SET DIC="^AUTTEXAM("
SET X=N
+5 SET DIC("DR")=".02///"_C
+6 DO FILE
+7 DO @$SELECT(Y>0:"ADDOK",1:"ADDFAIL")
+8 KILL DLAYGO
+9 QUIT
+10 ;
EDUCNEW ;--- NEW PATIENT ED- P&F
+1 DO RSLT($$E("EDUCNEW"))
+2 DO RSLT($JUSTIFY("",13)_"NAME")
+3 DO RSLT($JUSTIFY("",13)_"----")
+4 FOR T=1:1
SET L=$TEXT(EDUCNEW+T^AUM4101A)
IF $PIECE(L,";",3)="END"
QUIT
DO ADDEDUC
+5 QUIT
ADDEDUC ;--- ADD THE NEW PATIENT EDUCATION
+1 SET L=$PIECE(L,";;",2)
SET N=$PIECE(L,U)
SET M=$PIECE(L,U,2)
SET C=$PIECE(L,U,3)
SET L=N
+2 IF $DATA(^AUTTEDPF("B",N))
DO RSLT($JUSTIFY("",5)_$$M(1)_"PT ED NAME EXISTS => "_N)
QUIT
+3 SET DLAYGO=9999999.98
SET DIC="^AUTTEDPF("
SET X=N
+4 SET DIC("DR")=".02///"_M_";.03///"_C
+5 DO FILE
+6 DO @$SELECT(Y>0:"ADDOK",1:"ADDFAIL")
+7 QUIT
+8 ;
HFNEW ;--- NEW HEALTH FACTORS
+1 DO RSLT($$E("HFNEW"))
+2 DO RSLT($JUSTIFY("",13)_"NAME")
+3 DO RSLT($JUSTIFY("",13)_"----")
+4 FOR T=1:1
SET L=$TEXT(HFNEW+T^AUM4101A)
IF $PIECE(L,";",3)="END"
QUIT
DO ADDHF
+5 QUIT
ADDHF ;
+1 SET L=$PIECE(L,";;",2)
SET N=$PIECE(L,U)
SET O=$PIECE(L,U,2)
SET C=$PIECE(L,U,3)
SET S=$PIECE(L,U,4)
SET L=N_" "_O_" "_C_" "_S
+2 IF $DATA(^AUTTHF("B",N))
DO RSLT($JUSTIFY("",5)_$$M(1)_"HEALTH FACTOR EXISTS => "_N)
DO RSLT("")
QUIT
+3 SET DLAYGO=9999999.64
SET DIC="^AUTTHF("
SET X=N
SET DIC("DR")=".03///"_O_";.1///"_C_";.14///"_S
+4 DO FILE
+5 DO @$SELECT(Y>0:"ADDOK",1:"ADDFAIL")
+6 QUIT
+7 ;
PCLASNEW ;--- NEW PROV CLASS
+1 SET E=$$E("PCLASNEW")
+2 DO RSLT(E)
+3 DO RSLT($JUSTIFY("",11)_"CODE NAME"_$JUSTIFY("",28)_"ABRV.")
+4 DO RSLT($JUSTIFY("",11)_"---- ----"_$JUSTIFY("",28)_"-----")
+5 FOR T=1:1
SET L=$TEXT(PCLASNEW+T^AUM4101A)
IF $PIECE(L,";",3)="END"
QUIT
DO ADDPCLAS
+6 QUIT
ADDPCLAS ;
+1 SET L=$PIECE(L,";;",2)
SET C=$PIECE(L,U)
SET N=$PIECE(L,U,2)
SET A=$PIECE(L,U,3)
SET L=C_" "_N_$JUSTIFY("",(32-$LENGTH(N)))_A
+2 IF $DATA(^DIC(7,"D",C))
DO RSLT($JUSTIFY("",5)_$$M(1)_"PROVIDER CODE EXISTS => "_C)
DO RSLT("")
QUIT
+3 SET DLAYGO=7
SET DIC="^DIC(7,"
SET X=N
SET DIC("DR")="1///"_A_";9999999.01///"_C
+4 DO FILE
+5 DO @$SELECT(Y>0:"ADDOK",1:"ADDFAIL")
+6 QUIT
+7 ;
SVARS ;;A,C,E,F,L,M,N,O,P,R,S,T,V;Single-character work variables
+1 QUIT