VPSMRAR5 ;DALOI/KML,WOIFO/BT - Cont. Update of VPS MRAR PDO file ;1/15/15 15:30
;;1.0;VA POINT OF SERVICE (KIOSKS);**3**;Jan 15, 2015;Build 64
;;Per VHA Directive 2004-038, this routine should not be modified.
;
Q
;
SUB55(PTIEN,INTERFC,DTIEN,FLD,DIEFLAG,DATA,REQFLDS) ; file the ADDITIONAL MEDICATIONS multiple (853.55)
; INPUTS
; PTIEN : Patient DFN for 853.5 entry
; INTERFC : value of 'S' indicates that the entries in VPSMRAR coming from Staff-facing interface module.
; : value of 'P' indicates that the entries in VPSMRAR coming from Patient-facing interface module.
; DTIEN : transaction date/time ien for 853.51 sub-entry
; FLD : Field # where the data will be filed
; DIEFLAG : Filing Type (I = Internal, E = External)
; DATA : composite string assigned to a subscript in the local array passed in by Vecna for the specific field
; REQFLDS : Array of required fields by fieldname and entry number
;
; OUTPUT
; success : RESULT = Field Name^IENS^Field Value^1
; failed : RESULT = Field Name^IENS^Field Value^99^error text describing why data did not get filed
;
N RESULT S RESULT=""
;
; -- Check requried Additional Medication fields
S RESULT=$$CHKADMED(INTERFC,.REQFLDS,DATA)
Q:RESULT'="" RESULT
;
; -- Add Medication sub entry if it doesn't exist
N MEDID S MEDID=$P($P(DATA,U,2),",",2) ;MEDICATIONS Entry #
I '$D(^VPS(853.5,PTIEN,"MRAR",DTIEN,"MEDSADD","B",MEDID)) D ; ADD MEDS sub-entry does not exist yet so create stub entry
. N ADDOK S ADDOK=$$ADDMRAR^VPSMRAR0(853.55,DTIEN_","_PTIEN,MEDID,DIEFLAG)
. I 'ADDOK S RESULT=$$RESULT^VPSMRAR0(DATA,99,"Data was not filed into MRAR PDO. Failed to add Medications entry")
Q:RESULT'="" RESULT
;
; -- Get Additional Medication IEN
N MEDIEN S MEDIEN=$O(^VPS(853.5,PTIEN,"MRAR",DTIEN,"MEDSADD","B",MEDID,""))
Q:MEDIEN="" $$RESULT^VPSMRAR0(DATA,99,"Data was not filed into MRAR PDO")
;
; -- Store 853.55 field entries
N WP S WP=FLD=7!(FLD=12)
N IENS S IENS=MEDIEN_","_DTIEN_","_PTIEN_","
S RESULT=$$FILE^VPSMRAR0(853.55,WP,IENS,FLD,DIEFLAG,DATA)
;
Q RESULT
;
CHKADMED(INTERFC,REQFLDS,DATA) ;Check required Additional Medication fields
; INPUTS
; INTERFC : value of 'S' indicates that the entries in VPSMRAR coming from Staff-facing interface module.
; : value of 'P' indicates that the entries in VPSMRAR coming from Patient-facing interface module.
; REQFLDS : Array of required fields by fieldname and entry number
; DATA : Field Name^IENS^Field Value
;
; OUTPUT
; success : RESULT = Field Name^IENS^Field Value^1
; failed : RESULT = Field Name^IENS^Field Value^99^error text describing why data did not get filed
;
N RESULT S RESULT=""
; -- Get Additional Medication Entry #
N MEDID S MEDID=$P($P(DATA,U,2),",",2) ;MEDICATIONS Entry #
I 'MEDID S RESULT=$$RESULT^VPSMRAR0(DATA,99,"Additional Medications Entry # is required")
Q:RESULT'="" RESULT
;
; -- Additional Medication Name must exist
I INTERFC="P",'$D(REQFLDS("PATIENT-FACING ADD MEDICATION",MEDID)) S RESULT=$$RESULT^VPSMRAR0(DATA,99,"Additional Medication Name (Patient Interface) is required")
I INTERFC="S",'$D(REQFLDS("STAFF VIEW ADD MEDICATION",MEDID))&'$D(REQFLDS("VET VIEW ADD MEDICATION",MEDID)) S RESULT=$$RESULT^VPSMRAR0(DATA,99,"Additional Medication Name (Staff Interface) is required")
Q RESULT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVPSMRAR5 3418 printed Nov 22, 2024@17:53:03 Page 2
VPSMRAR5 ;DALOI/KML,WOIFO/BT - Cont. Update of VPS MRAR PDO file ;1/15/15 15:30
+1 ;;1.0;VA POINT OF SERVICE (KIOSKS);**3**;Jan 15, 2015;Build 64
+2 ;;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 QUIT
+5 ;
SUB55(PTIEN,INTERFC,DTIEN,FLD,DIEFLAG,DATA,REQFLDS) ; file the ADDITIONAL MEDICATIONS multiple (853.55)
+1 ; INPUTS
+2 ; PTIEN : Patient DFN for 853.5 entry
+3 ; INTERFC : value of 'S' indicates that the entries in VPSMRAR coming from Staff-facing interface module.
+4 ; : value of 'P' indicates that the entries in VPSMRAR coming from Patient-facing interface module.
+5 ; DTIEN : transaction date/time ien for 853.51 sub-entry
+6 ; FLD : Field # where the data will be filed
+7 ; DIEFLAG : Filing Type (I = Internal, E = External)
+8 ; DATA : composite string assigned to a subscript in the local array passed in by Vecna for the specific field
+9 ; REQFLDS : Array of required fields by fieldname and entry number
+10 ;
+11 ; OUTPUT
+12 ; success : RESULT = Field Name^IENS^Field Value^1
+13 ; failed : RESULT = Field Name^IENS^Field Value^99^error text describing why data did not get filed
+14 ;
+15 NEW RESULT
SET RESULT=""
+16 ;
+17 ; -- Check requried Additional Medication fields
+18 SET RESULT=$$CHKADMED(INTERFC,.REQFLDS,DATA)
+19 if RESULT'=""
QUIT RESULT
+20 ;
+21 ; -- Add Medication sub entry if it doesn't exist
+22 ;MEDICATIONS Entry #
NEW MEDID
SET MEDID=$PIECE($PIECE(DATA,U,2),",",2)
+23 ; ADD MEDS sub-entry does not exist yet so create stub entry
IF '$DATA(^VPS(853.5,PTIEN,"MRAR",DTIEN,"MEDSADD","B",MEDID))
Begin DoDot:1
+24 NEW ADDOK
SET ADDOK=$$ADDMRAR^VPSMRAR0(853.55,DTIEN_","_PTIEN,MEDID,DIEFLAG)
+25 IF 'ADDOK
SET RESULT=$$RESULT^VPSMRAR0(DATA,99,"Data was not filed into MRAR PDO. Failed to add Medications entry")
End DoDot:1
+26 if RESULT'=""
QUIT RESULT
+27 ;
+28 ; -- Get Additional Medication IEN
+29 NEW MEDIEN
SET MEDIEN=$ORDER(^VPS(853.5,PTIEN,"MRAR",DTIEN,"MEDSADD","B",MEDID,""))
+30 if MEDIEN=""
QUIT $$RESULT^VPSMRAR0(DATA,99,"Data was not filed into MRAR PDO")
+31 ;
+32 ; -- Store 853.55 field entries
+33 NEW WP
SET WP=FLD=7!(FLD=12)
+34 NEW IENS
SET IENS=MEDIEN_","_DTIEN_","_PTIEN_","
+35 SET RESULT=$$FILE^VPSMRAR0(853.55,WP,IENS,FLD,DIEFLAG,DATA)
+36 ;
+37 QUIT RESULT
+38 ;
CHKADMED(INTERFC,REQFLDS,DATA) ;Check required Additional Medication fields
+1 ; INPUTS
+2 ; INTERFC : value of 'S' indicates that the entries in VPSMRAR coming from Staff-facing interface module.
+3 ; : value of 'P' indicates that the entries in VPSMRAR coming from Patient-facing interface module.
+4 ; REQFLDS : Array of required fields by fieldname and entry number
+5 ; DATA : Field Name^IENS^Field Value
+6 ;
+7 ; OUTPUT
+8 ; success : RESULT = Field Name^IENS^Field Value^1
+9 ; failed : RESULT = Field Name^IENS^Field Value^99^error text describing why data did not get filed
+10 ;
+11 NEW RESULT
SET RESULT=""
+12 ; -- Get Additional Medication Entry #
+13 ;MEDICATIONS Entry #
NEW MEDID
SET MEDID=$PIECE($PIECE(DATA,U,2),",",2)
+14 IF 'MEDID
SET RESULT=$$RESULT^VPSMRAR0(DATA,99,"Additional Medications Entry # is required")
+15 if RESULT'=""
QUIT RESULT
+16 ;
+17 ; -- Additional Medication Name must exist
+18 IF INTERFC="P"
IF '$DATA(REQFLDS("PATIENT-FACING ADD MEDICATION",MEDID))
SET RESULT=$$RESULT^VPSMRAR0(DATA,99,"Additional Medication Name (Patient Interface) is required")
+19 IF INTERFC="S"
IF '$DATA(REQFLDS("STAFF VIEW ADD MEDICATION",MEDID))&'$DATA(REQFLDS("VET VIEW ADD MEDICATION",MEDID))
SET RESULT=$$RESULT^VPSMRAR0(DATA,99,"Additional Medication Name (Staff Interface) is required")
+20 QUIT RESULT