XUMVINPA ;MVI/DRI Master Veteran Index New Person Add API ;1/29/20 12:27
;;8.0;KERNEL;**711,724**;Jul 10, 1995;Build 2
;Per VA Directive 6402, this routine should not be modified.
;
;**711 - STORY 978382 (dri) new routine - new person add api
;
Q
;
ADDUSER(XUARR) ;Add a new user using minimum attributes for user identification of
; PPMS (Provider Profile Management System) PIE (Provider Integration Engine)
;
; This interface is available under a private Integration Agreement (#7062) in
; support of PPMS PIE only, and should not be used under any other circumstances.
;
; Input:
; XUARR("NAME") = NAME surname|first name|middle name|suffix|full .01 name
; XUARR("NPI") = NPI (National Provider Identifier)
;
; Return:
; Fail = "-1^Error Message"
; Success = IEN^#.01 NAME field^1 add of NEW PERSON (#200) file entry
; = IEN person already exists
; (Note: this routine will NOT set DUZ to the identified IEN)
;
; Example:
; S NEWDUZ=$$ADDUSER^XUMVINPA(.XUARR)
;
;
N XUDUZ,ERRMSG
;
I '$$CHKDGT^XUSNPI($G(XUARR("NPI"))) Q "-1^Invalid NPI" ;#41.99 - NPI
S XUDUZ=+$O(^VA(200,"ANPI",XUARR("NPI"),0)) ;does user already exist
I XUDUZ Q XUDUZ ;per chris, if person already exists, return duz regardless if active and don't udpate
;
I $P($G(XUARR("NAME")),"|",5)="" Q "-1^Subject NAME is required to add a new user" ;#.01 - NAME
;
S XUDUZ=$$ADDU($P(XUARR("NAME"),"|",5)) ;Put the name in the .01 field first, pass back all three pieces to identify an add
I +XUDUZ<1 Q "-1^Create of new user record failed"
;
S ERRMSG=$$UPDU(.XUARR,XUDUZ) ;then update the remaining fields, no checks if validation issues
;
Q XUDUZ ;duz of new person
;
ADDU(XUNAME) ;Add new name to the New Person File
N DD,DO,DIC,DA,X,Y
K ^TMP("DIERR",$J)
S DIC="^VA(200,",DIC(0)="F",X=XUNAME
; Get a LOCK. Block if can't get.
L +^VA(200,0):10 Q:'$T "-1^Addition of new users is blocked"
D FILE^DICN
L -^VA(200,0)
Q Y
;
UPDU(XUARR,XUDUZ) ;Update user in the New Person File with Enterprise View
N DIC,FDA,IEN,IENS,X,XUKEY,Y
K ^TMP("DIERR",$J)
S IENS=+XUDUZ_","
;
;**724 - STORY 1201071 (dri) populate additional new person fields
;by populating NPI in EFFECTIVE DATE (#42) multiple, the trigger automatically
;files AUTHORIZE RELEASE OF NPI (#41.97), NPI ENTRY STATUS (#41.98), and NPI (#41.99)
S FDA(200.042,"+1,"_IENS,.01)=$$NOW^XLFDT ;effective date/time
S FDA(200.042,"+1,"_IENS,.02)=1 ;status - active
S FDA(200.042,"+1,"_IENS,.03)=XUARR("NPI") ;NPI
;
D UPDATE^DIE(,"FDA") ;file data
;
;by populating KEY (#.01) in KEYS (#51) multiple, the trigger
;automatically files GIVEN BY (#1) and DATE GIVEN (#2)
F XUKEY="XUORES","PROVIDER" K DIC S DIC="^DIC(19.1,",DIC(0)="MZ",X=XUKEY D ^DIC Q:Y<0 D ;give user XUORES & PROVIDER keys
.I $D(^VA(200,XUDUZ,51,"B",+Y)) Q ;user already has key
.S (FDA(200.051,"+1,"_IENS,.01),IEN(1))=+Y ;key - pass IEN(1) since key is DINUM'd
.D UPDATE^DIE(,"FDA","IEN") ;file data
;
Q ""
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXUMVINPA 3097 printed Nov 22, 2024@17:21:27 Page 2
XUMVINPA ;MVI/DRI Master Veteran Index New Person Add API ;1/29/20 12:27
+1 ;;8.0;KERNEL;**711,724**;Jul 10, 1995;Build 2
+2 ;Per VA Directive 6402, this routine should not be modified.
+3 ;
+4 ;**711 - STORY 978382 (dri) new routine - new person add api
+5 ;
+6 QUIT
+7 ;
ADDUSER(XUARR) ;Add a new user using minimum attributes for user identification of
+1 ; PPMS (Provider Profile Management System) PIE (Provider Integration Engine)
+2 ;
+3 ; This interface is available under a private Integration Agreement (#7062) in
+4 ; support of PPMS PIE only, and should not be used under any other circumstances.
+5 ;
+6 ; Input:
+7 ; XUARR("NAME") = NAME surname|first name|middle name|suffix|full .01 name
+8 ; XUARR("NPI") = NPI (National Provider Identifier)
+9 ;
+10 ; Return:
+11 ; Fail = "-1^Error Message"
+12 ; Success = IEN^#.01 NAME field^1 add of NEW PERSON (#200) file entry
+13 ; = IEN person already exists
+14 ; (Note: this routine will NOT set DUZ to the identified IEN)
+15 ;
+16 ; Example:
+17 ; S NEWDUZ=$$ADDUSER^XUMVINPA(.XUARR)
+18 ;
+19 ;
+20 NEW XUDUZ,ERRMSG
+21 ;
+22 ;#41.99 - NPI
IF '$$CHKDGT^XUSNPI($GET(XUARR("NPI")))
QUIT "-1^Invalid NPI"
+23 ;does user already exist
SET XUDUZ=+$ORDER(^VA(200,"ANPI",XUARR("NPI"),0))
+24 ;per chris, if person already exists, return duz regardless if active and don't udpate
IF XUDUZ
QUIT XUDUZ
+25 ;
+26 ;#.01 - NAME
IF $PIECE($GET(XUARR("NAME")),"|",5)=""
QUIT "-1^Subject NAME is required to add a new user"
+27 ;
+28 ;Put the name in the .01 field first, pass back all three pieces to identify an add
SET XUDUZ=$$ADDU($PIECE(XUARR("NAME"),"|",5))
+29 IF +XUDUZ<1
QUIT "-1^Create of new user record failed"
+30 ;
+31 ;then update the remaining fields, no checks if validation issues
SET ERRMSG=$$UPDU(.XUARR,XUDUZ)
+32 ;
+33 ;duz of new person
QUIT XUDUZ
+34 ;
ADDU(XUNAME) ;Add new name to the New Person File
+1 NEW DD,DO,DIC,DA,X,Y
+2 KILL ^TMP("DIERR",$JOB)
+3 SET DIC="^VA(200,"
SET DIC(0)="F"
SET X=XUNAME
+4 ; Get a LOCK. Block if can't get.
+5 LOCK +^VA(200,0):10
if '$TEST
QUIT "-1^Addition of new users is blocked"
+6 DO FILE^DICN
+7 LOCK -^VA(200,0)
+8 QUIT Y
+9 ;
UPDU(XUARR,XUDUZ) ;Update user in the New Person File with Enterprise View
+1 NEW DIC,FDA,IEN,IENS,X,XUKEY,Y
+2 KILL ^TMP("DIERR",$JOB)
+3 SET IENS=+XUDUZ_","
+4 ;
+5 ;**724 - STORY 1201071 (dri) populate additional new person fields
+6 ;by populating NPI in EFFECTIVE DATE (#42) multiple, the trigger automatically
+7 ;files AUTHORIZE RELEASE OF NPI (#41.97), NPI ENTRY STATUS (#41.98), and NPI (#41.99)
+8 ;effective date/time
SET FDA(200.042,"+1,"_IENS,.01)=$$NOW^XLFDT
+9 ;status - active
SET FDA(200.042,"+1,"_IENS,.02)=1
+10 ;NPI
SET FDA(200.042,"+1,"_IENS,.03)=XUARR("NPI")
+11 ;
+12 ;file data
DO UPDATE^DIE(,"FDA")
+13 ;
+14 ;by populating KEY (#.01) in KEYS (#51) multiple, the trigger
+15 ;automatically files GIVEN BY (#1) and DATE GIVEN (#2)
+16 ;give user XUORES & PROVIDER keys
FOR XUKEY="XUORES","PROVIDER"
KILL DIC
SET DIC="^DIC(19.1,"
SET DIC(0)="MZ"
SET X=XUKEY
DO ^DIC
if Y<0
QUIT
Begin DoDot:1
+17 ;user already has key
IF $DATA(^VA(200,XUDUZ,51,"B",+Y))
QUIT
+18 ;key - pass IEN(1) since key is DINUM'd
SET (FDA(200.051,"+1,"_IENS,.01),IEN(1))=+Y
+19 ;file data
DO UPDATE^DIE(,"FDA","IEN")
End DoDot:1
+20 ;
+21 QUIT ""
+22 ;