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

VPSMRAR9.m

Go to the documentation of this file.
  1. VPSMRAR9 ;WOIFO/BT - Get the last MRAR data for a patient;01/29/15 15:30
  1. ;;1.0;VA POINT OF SERVICE (KIOSKS);**3**;Jan 29, 2015;Build 64
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. Q
  1. ;IA #10103 - supported use of XLFDT functions
  1. ;IA #10104 - supported use of XLFSTR function
  1. ;
  1. GET(VPSMRAR,VPSNUM,VPSTYP) ; RPC: VPS GET LAST MRAR
  1. ; INPUT
  1. ; VPSNUM : Parameter Value - patient SSN OR DFN OR ICN OR VIC/CAC (REQUIRED)
  1. ; VPSTYP : Parameter TYPE - SSN or DFN OR ICN OR VIC/CAC (REQUIRED)
  1. ; OUTPUT
  1. ; VPSMRAR: local array contains all field names/values for the last mrar
  1. ; WITH ERROR -> VPSMRAR(0) = -1 ^ error message
  1. ; SUCCESS -> VPSMRAR(0) = 1
  1. ; -> VPSMRAR(1..n) = FIELD NAME^SUBS^DATA
  1. ;
  1. ; -- validate input parameters
  1. S VPSNUM=$G(VPSNUM)
  1. S VPSTYP=$G(VPSTYP)
  1. N VPSDFN S VPSDFN=$$VALIDATE^VPSRPC1(VPSTYP,VPSNUM)
  1. I VPSDFN<1 S VPSMRAR(0)=-1_U_$P(VPSDFN,U,2) QUIT
  1. ;
  1. ; -- get last mrar ien for the patient
  1. N LASTMRAR S LASTMRAR=$O(^VPS(853.5,VPSDFN,"MRAR","B",""),-1)
  1. I 'LASTMRAR S VPSMRAR(0)=-1_U_"This patient has no MRAR transaction." QUIT
  1. ;
  1. ; -- retrieve transaction level fields and store them in VPSMRAR
  1. D TRANS^VPSMR51(.VPSMRAR,VPSDFN,LASTMRAR)
  1. ;
  1. ; -- retrieve conducted with level fields and store them in VPSMRAR
  1. D CNDWTH^VPSMR51(.VPSMRAR,VPSDFN,LASTMRAR)
  1. ;
  1. ; -- retrieve Allergy level fields and store them in VPSMRAR
  1. D ALLERGY^VPSMR52(.VPSMRAR,VPSDFN,LASTMRAR)
  1. ;
  1. ; -- retrieve Additional Allergy level fields and store them in VPSMRAR
  1. D ADDALLER^VPSMR52(.VPSMRAR,VPSDFN,LASTMRAR)
  1. ;
  1. ; -- retrieve Medication level fields and store them in VPSMRAR
  1. D MEDS^VPSMR54(.VPSMRAR,VPSDFN,LASTMRAR)
  1. ;
  1. ; -- retrieve Additional Medication level fields and store them in VPSMRAR
  1. D ADDMEDS^VPSMR54(.VPSMRAR,VPSDFN,LASTMRAR)
  1. ;
  1. S VPSMRAR(0)=1
  1. QUIT
  1. ;
  1. ADD(VPSMRAR,FLDNAM,SUBS,INVAL,EXVAL) ;Add the record to VPSMRAR
  1. ; INPUT
  1. ; FLDNAM : Field name to store
  1. ; SUBS : Subscript (unique identifier for multiple values)
  1. ; INVAL : Fileman Internal Value
  1. ; EXVAL : Fileman Externall Value
  1. ; OUTPUT
  1. ; VPSMRAR: local array contains all field names/values for the last mrar
  1. ;
  1. QUIT:INVAL=""&(EXVAL="")
  1. N LAST S LAST=$O(VPSMRAR(""),-1)+1
  1. I (EXVAL=INVAL) S INVAL=""
  1. S VPSMRAR(LAST)=FLDNAM_U_SUBS_U_EXVAL_$S(INVAL="":"",1:U_INVAL)
  1. QUIT
  1. ;
  1. WP(REC,FIL,SUBS,FLD) ;return word-processing value
  1. QUIT:$G(REC(FIL,SUBS,FLD,"E"))="" ""
  1. ;
  1. N WP S WP=""
  1. N LF S LF=$C(13,10)
  1. N IDX S IDX=0
  1. ;
  1. F S IDX=$O(REC(FIL,SUBS,FLD,IDX)) Q:'IDX D
  1. . S WP=WP_REC(FIL,SUBS,FLD,IDX)_LF
  1. ;
  1. QUIT $P(WP,LF,1,$L(WP,LF)-1)