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

VPSRPC3.m

Go to the documentation of this file.
  1. VPSRPC3 ;DALOI/KML - VPS Pre-registration RPC ;4/26/2012
  1. ;;1.0;VA POINT OF SERVICE (KIOSKS);**2**;Oct 21, 2011;Build 41
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. Q
  1. ; the procedures for this RPC were taken from the routine that supports the DGPRE PRE-REGISTER OPTION
  1. ; to update the various files when a Vetlink Kiosk Preregister event occurs
  1. PREREG(RESULT,DFN,PRESTAT) ; Pre-Register a patient
  1. ; RPC=VPS PATIENT PRE-REGISTRATION
  1. ; input variables
  1. ; DFN - patient IEN, required
  1. ; PRESTAT - code for the call such as 'C' = 'CONTACTED' or
  1. ; 'X' = 'CHANGE INFORMATION', required
  1. ; output variable
  1. ; RESULT - variable that returns the result of the RPC, includes a
  1. ; a number (1 or 0) followed by a short message
  1. N VALID
  1. K RESULT
  1. ; check for required parameters coming in
  1. I $G(DFN)="" S RESULT="0,DFN not sent." Q
  1. I +DFN=0 S RESULT="0,invalid DFN." Q
  1. I '$D(^DPT(DFN,0)) S RESULT="0,Patient not found." Q
  1. ; validate code for call status
  1. I $G(PRESTAT)="" S RESULT="0,call STATUS code not sent." Q
  1. S VALID=$$CHKST(PRESTAT) I 'VALID S RESULT="0,Invalid code for call status." Q
  1. N PIEN,PDIV,PIDX,NEW,LOCK
  1. S (PIDX,LOCK)=0,NEW=1
  1. ; PREREGISTRATION Nightly BACKGROUND JOB (SCHEDULED TASK) adds new entries to 41.42.
  1. ; VistA preregistration option allows processing to continue if there isn't a patient entry in 41.42.
  1. I $D(^DGS(41.42,"B",DFN)) D ; ICR 5817
  1. . S NEW=0
  1. . S PIDX=$O(^DGS(41.42,"B",DFN,PIDX))
  1. . S PDIV=$P($G(^DGS(41.42,PIDX,0)),U,2)
  1. . I PIDX]"" L +^DGS(41.42,PIDX):2 I $T S LOCK=1
  1. I 'LOCK&('NEW) S RESULT="0,Another user is editing this patient. Preregistration cannot be performed at this time." Q
  1. I $G(PDIV)']"" S PDIV=$$PRIM^VASITE ; ICR#10112 - $$PRIM^VASITE
  1. D UPDLOG(DFN,PRESTAT,PDIV)
  1. ; update pre-registration audit log
  1. ; need to include ICR #
  1. N TMSTMP S TMSTMP=$$NOW^XLFDT ; ICR 10103
  1. ; add an entry to PRE-REGISTRATION AUDIT file
  1. ; ICR # 5797
  1. S DIC="^DGS(41.41,",DIC(0)="L",X=DFN
  1. S DIC("DR")="1///^S X=TMSTMP;2////^S X=DUZ"
  1. D FILE^DICN
  1. ; need to update the PRE-REGISTRATION CALL LIST file
  1. I 'NEW,PIDX D
  1. . K DA,DIE,DR
  1. . S DA=PIDX,DIE="^DGS(41.42,"
  1. . S DR="4///Y" S DR=DR_";3///^S X=TMSTMP"
  1. . D ^DIE
  1. . L -^DGS(41.42,PIDX)
  1. S RESULT="1,Pre-Registration completed."
  1. ;
  1. Q
  1. UPDLOG(DFN,STATUS,DIVIEN) ; Update PRE-REGISTRATION CALL File, #41.43
  1. ; ICR # 5798 - allows VPS package to add and edit an entry in the PRE-REGISTRATION CALL file
  1. ; Input:
  1. ; DFN - The IEN of the patient being called
  1. ; STATUS - Status of the call attempt
  1. ; DIVIEN - Division IEN (used for sorting)
  1. ;
  1. N DIC,X,Y,DIE,DR,DA,DIK
  1. S DIC="^DGS(41.43,"
  1. S DIC(0)="L"
  1. S X=$$NOW^XLFDT
  1. D FILE^DICN
  1. Q:Y<0 ; VistA option notifies user when an entry cannot be added to 41.43, but continues with processing the preregistration session.
  1. S DA=+Y
  1. L +^DGS(41.43,+Y):2 I '$T S DIK="^DGS(41.43," D ^DIK K DIK Q ; remove stub entry if entry cannot be locked
  1. S DIE="^DGS(41.43,"
  1. S DR="1////^S X=DFN;2////^S X=DUZ;3///^S X=STATUS;5////^S X=$S(+DIVIEN>0:DIVIEN,1:"""")"
  1. D ^DIE K DIE
  1. L -^DGS(41.43,DA)
  1. Q
  1. ;
  1. CHKST(CODE) ; determine if status code is valid
  1. ; input -
  1. ; CODE = status of pre-registration call - this code is sent to the RPC from the Vetlink Kiosk
  1. ; output -
  1. ; FOUND = result of the validation which determines if the incoming kiosk code was matched against one of the valid VistA codes
  1. N LIST,VALUE,FOUND
  1. S VALUE="",FOUND=0
  1. D BLDCODES(.LIST)
  1. F S VALUE=$O(LIST(VALUE)) Q:VALUE="" Q:FOUND I VALUE=CODE S FOUND=1
  1. Q FOUND
  1. ;
  1. BLDCODES(ARRAY) ;build array of valid statuses that represent the outcome of the call to the patient
  1. ; valid codes can be located at the STATUS field of the PRE-REGISTRATION CALL LOG (#41.43,3).
  1. ;input/output - ARRAY passed in by reference
  1. N LN,LINE,STRING
  1. F LN=1:1 S LINE=$T(CODELST+LN),STRING=$P(LINE,";;",2) Q:STRING="" S ARRAY($P(STRING,U))=""
  1. Q
  1. ;
  1. CODELST ; list of codes
  1. ;;B^BUSY
  1. ;;C^CONNECTED
  1. ;;D^DEATH
  1. ;;K^CALL BACK
  1. ;;M^LEFT CALLBACK MESSAGE
  1. ;;N^NO ANSWER
  1. ;;P^NO PHONE
  1. ;;T^DON'T CALL
  1. ;;U^UNCOOPERATIVE
  1. ;;V^PREVIOUSLY UPDATED
  1. ;;W^WRONG NUMBER
  1. ;;X^CHANGE INFORMATION
  1. ;;