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

AUMSCBA2.m

Go to the documentation of this file.
AUMSCBA2  ;IHS/OIT/NKD - SCB UPDATE - FULL TABLE UPDATE CONT. 03/12/2014 ;
 ;;15.0;TABLE MAINTENANCE;**3**;SEP 9,2014;Build 1
 ; 05/28/15 - CLINIC FULL UPDATE
 ;
 Q
STNM ; EP - STATION NUMBER - INSTITUTION FILE
 N AUMT,AUMGL,AUMTGL,AUMCNT,AUMCNT2,AUMP1,AUMP2,AUMP3
 S AUMT="STNM",AUMGL="^DIC(4,",AUMTGL="^TMP(""AUM"","_$J_",""ALL"",""STNM"""
 Q:'$D(@(AUMTGL_")"))
 ;
 I ($G(@(AUMTGL_",0)"))'=0) D
 . S AUMCNT=0 F  S AUMCNT=$O(@(AUMTGL_")")@(AUMCNT)) Q:AUMCNT']""  D
 . . S AUMP1=$P($G(@(AUMTGL_","_AUMCNT_")")),U,1)  ;NAME
 . . S AUMP2=$P($G(@(AUMTGL_","_AUMCNT_")")),U,2)  ;ASUFAC
 . . S AUMP3=$P($G(@(AUMTGL_","_AUMCNT_")")),U,3)  ;STNM
 . . ; DELETE FROM INCORRECT ENTRIES
 . . S AUMCNT2=0 F  S AUMCNT2=$O(^DIC(4,"D",AUMP3,AUMCNT2)) Q:'AUMCNT2  D
 . . . Q:($$GET1^DIQ(9999999.06,AUMCNT2,.0799,"I")=AUMP2)
 . . . S ^TMP("AUM",$J,"COUNT",AUMT)=$G(^TMP("AUM",$J,"COUNT",AUMT))+1
 . . . D ENTRY^AUMSCBD(AUMT,"DEL",$$GET1^DIQ(4,AUMCNT2,.01,"I")_U_$$GET1^DIQ(9999999.06,AUMCNT2,.0799,"I")_U_AUMP3,,)
 . . ; ADD TO CORRECT ENTRY
 . . D ENTRY^AUMSCBD(AUMT,"ADD",$G(@(AUMTGL_","_AUMCNT_")")),,1)
 ;
 K @(AUMTGL_")")
 Q
 ; IHS/OIT/NKD AUM*15.0*3 FULL CLINIC UPDATE
CLIN ; EP - CLINIC STOP FILE
 ; T=TAG,GL=GLOBAL,TGL=TEMP GLOBAL,L=LIST,CNT=COUNT,FL=FILE,INFL=INACTIVE FIELD
 N AUMT,AUMGL,AUMTGL,AUML,AUML2,AUML3,AUMCNT,AUMFL,AUMINFL
 S AUMT="CLIN",AUMGL="^DIC(40.7,",AUMTGL="^TMP(""AUM"","_$J_",""ALL"",""CLIN""",AUMFL=40.7,AUMINFL=2
 Q:'$D(@(AUMTGL_")"))
 D RSLT^AUMSCBD($$REPEAT^XLFSTR("-",20)),RSLT^AUMSCBD("CLINIC STOP FILE CLEANUP")
 D REINDX^AUMSCBA(AUMGL,"B^C")  ; RE-INDEX
 ;
 ; COMPOSITE SEARCH
 ; BUILD TEMP GLOBAL X-REF
 D BUILD^AUMSCBA(AUMTGL,"COMP","1^2")
 ; TEMP GLOBAL COUNT, MATCH TEMP TO LOCAL AND STORE REMAINING
 S AUMCNT=$G(@(AUMTGL_",0)")),AUML=$$MATCH^AUMSCBA(AUMT,AUMGL,AUMTGL,"C","COMP","1",,0)
 ; CHECK IF MATCHING HAS FINISHED (0 TEMP OR 0 LOCAL RECORDS REMAIN)
 I ($G(@(AUMTGL_",0)"))=0)!(AUML']"") D CLINEND(AUMT,AUMGL,AUMTGL,AUML) Q
 ;
 ; CODE SEARCH
 D BUILD^AUMSCBA(AUMTGL,"C","1")
 S AUMCNT=$G(@(AUMTGL_",0)")),AUML2=$$MATCH^AUMSCBA(AUMT,AUMGL,AUMTGL,"C","C",,.AUML,0)
 I ($G(@(AUMTGL_",0)"))=0)!(AUML2']"") D CLINEND(AUMT,AUMGL,AUMTGL,AUML2) Q
 ;
 ; NAME SEARCH
 D BUILD^AUMSCBA(AUMTGL,"B","2")
 S AUMCNT=$G(@(AUMTGL_",0)")),AUML3=$$MATCH^AUMSCBA(AUMT,AUMGL,AUMTGL,"B","B",,.AUML2,0)
 D CLINEND(AUMT,AUMGL,AUMTGL,AUML3)
 ;
 Q
CLINEND(AUMT,AUMGL,AUMTGL,AUML) ; END PROCESSING
 ; UPDATE REMAINING IN TEMP GLOBAL
 ; INACTIVATE LOCALS NOT MATCHED
 N CNT,CNT2,IEN,DAT
 ; TMP REMAINING
 I ($G(@(AUMTGL_",0)"))'=0) D
 . S CNT=0 F  S CNT=$O(@(AUMTGL_")")@(CNT)) Q:CNT']""  D
 . . ; ONCE TO ADD, THEN TO UPDATE/INACTIVATE
 . . I $P($G(@(AUMTGL_","_CNT_")")),U,7)]"" D ENTRY^AUMSCBD(AUMT,"ALL",$P($G(@(AUMTGL_","_CNT_")")),U,1,6),,2)
 . . D ENTRY^AUMSCBD(AUMT,"ALL",$G(@(AUMTGL_","_CNT_")")),,0)
 ; LOCAL REMAINING
 I (AUML]"") D
 . D RSLT^AUMSCBD(""),RSLT^AUMSCBD("Inactivating local duplicate/invalid entries")
 . D RSLT^AUMSCBD("       CODE NAME                                                      PC 1A INA")
 . D RSLT^AUMSCBD("       ==== ====                                                      == == ===")
 . F CNT=1:1:$L(AUML,U) S IEN=$P(AUML,U,CNT) D
 . . Q:'IEN
 . . S DAT=$$GET1^DIQ(40.7,IEN,1,"I")
 . . S $P(DAT,U,2)=$$GET1^DIQ(40.7,IEN,.01,"I")
 . . S $P(DAT,U,4)=$S($$GET1^DIQ(40.7,IEN,999999902,"I"):"Y",1:"N")
 . . S $P(DAT,U,5)=$S($$GET1^DIQ(40.7,IEN,90000.01,"I")="Y":"Y",1:"N")
 . . S $P(DAT,U,7)=$$DT^XLFDT+17000000
 . . D ENTRY^AUMSCBD(AUMT,"INA",DAT,IEN)
 ;
 K @(AUMTGL_")")
 ;
 Q