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

DGQEUT2.m

Go to the documentation of this file.
  1. DGQEUT2 ;ALB/RPM - VIC REPLACEMENT UTILITIES #2 ; 3/13/06 11:12am
  1. ;;5.3;Registration;**571,641,679,1015**;Aug 13, 1993;Build 21
  1. ;
  1. ; This routine contains the following VIC Redesign API's:
  1. ; CPRSTAT - determine Card Print Release Status
  1. ; $$PENDDT - checks for pending requests and returns request date
  1. ; $$REQFLD - checks for required fields
  1. ; $$HOLD - checks for pending ICN and/or Enrollment
  1. ; $$VICELIG - determines applicant's VIC eligibility
  1. ;
  1. Q ;no direct entry
  1. ;
  1. ;
  1. CPRSTAT(DGVIC) ;determine card print release status
  1. ; This procedure is used to determine Card Print Release Status from
  1. ; the data contained in the input array (DGVIC). Once determined, the
  1. ; status and remarks are placed into the VIC data array.
  1. ;
  1. ; Input:
  1. ; DGVIC - VIC data array (pass by reference)
  1. ;
  1. ; Output: None
  1. ;
  1. N DGERR
  1. ;
  1. D ;drop out of DO block when DGVIC("STAT") is known
  1. . ;
  1. . ;check if DFN is valid
  1. . ;set card print release status="C"ancel if not valid
  1. . I '$D(^DPT(+$G(DGVIC("DFN")),0)) D
  1. . . S DGVIC("STAT")="C"
  1. . . S DGVIC("REMARKS")="Unable to find veteran in the database"
  1. . Q:DGVIC("STAT")]""
  1. . ;
  1. . ;check for required fields
  1. . ;set card print release status="C"ancel if req field is missing
  1. . I '$$REQFLD(.DGVIC,.DGERR) D
  1. . . S DGVIC("STAT")="C"
  1. . . S DGVIC("REMARKS")=$G(DGERR)
  1. . Q:DGVIC("STAT")]""
  1. . ;
  1. . ;check for pending conditions
  1. . ;set card print release status="H"old if pending conditions exist
  1. . I $$HOLD(.DGVIC,.DGERR) D
  1. . . S DGVIC("STAT")="H"
  1. . . S DGVIC("REMARKS")=$G(DGERR)
  1. . Q:DGVIC("STAT")]""
  1. . ;
  1. . ;check if pt is eligible for VIC
  1. . ;set card print release status="P"rint if eligible, else "I"neligible
  1. . I $$VICELIG(.DGVIC) S DGVIC("STAT")="P"
  1. . E D
  1. . . S DGVIC("STAT")="I"
  1. . . S DGVIC("REMARKS")="Veteran does not meet VIC eligibility requirements."
  1. ;
  1. Q
  1. ;
  1. ;
  1. PENDDT(DGDFN) ;check for pending request date
  1. ;
  1. ; Input:
  1. ; DGDFN - pointer to patient in PATIENT (#2) file
  1. ;
  1. ; Output:
  1. ; Function value - FM format request date on success, 0 on failure
  1. ;
  1. N DGDAT ;function value
  1. N DGRIEN ;VIC REQUEST pointer
  1. N DGREQ ;array of request data
  1. ;
  1. S DGDAT=0
  1. ;
  1. ;get last request
  1. S DGRIEN=$$FINDLST^DGQEREQ(DGDFN)
  1. I DGRIEN D
  1. . Q:'$$GETREQ^DGQEREQ(DGRIEN,.DGREQ)
  1. . ;
  1. . ;check Card Print Release Status
  1. . I $G(DGREQ("CPRSTAT"))="H" S DGDAT=+$G(DGREQ("REQDT"))
  1. ;
  1. Q DGDAT
  1. ;
  1. ;
  1. REQFLD(DGVIC,DGERR) ;required field check
  1. ; This function is used to check for required fields in the VIC data
  1. ; array.
  1. ;
  1. ; Input:
  1. ; DGVIC - VIC data array (pass by reference)
  1. ;
  1. ; Output:
  1. ; Function value - returns 1 on success, 0 on failure.
  1. ; DGERR - error msg returned on failure
  1. ;
  1. N DGTYPE ;mailing address type
  1. N DGSUB ;array subscript
  1. ;
  1. D ;quit DO block on first error
  1. . ;
  1. . ;check for required SSN
  1. . I $G(DGVIC("SSN"))="" S DGERR="Unable to determine veteran's Social Security Number"
  1. . Q:$D(DGERR)
  1. . ;
  1. . ;check for required DOB to include month and day
  1. . I +$G(DGVIC("DOB"))>0 D
  1. . . I +$E(DGVIC("DOB"),1,2)<1!(+$E(DGVIC("DOB"),3,4)<1) S DGERR="Unable to determine veteran's complete Date of Birth"
  1. . E S DGERR="Unable to determine veteran's Date of Birth"
  1. . Q:$D(DGERR)
  1. . ;
  1. . ;check for required name components
  1. . F DGSUB="NAME","LAST" D Q:$D(DGERR)
  1. . . I $G(DGVIC(DGSUB))="" S DGERR="Unable to determine veteran's Name"
  1. . . ;
  1. . . ;prevent submission of incomplete patient merges
  1. . . I DGSUB="NAME",DGVIC(DGSUB)["MERGING INTO" S DGERR="Incomplete patient record merge"
  1. . Q:$D(DGERR)
  1. . ;
  1. . ;check for address selection type
  1. . I '$G(DGVIC("ADRTYPE")) S DGERR="Unable to determine a mailing address"
  1. . Q:$D(DGERR)
  1. . ;
  1. . ;check for required pt address components
  1. . F DGSUB="STREET1","CITY","STATE","ZIP" D Q:$D(DGERR)
  1. . . I $G(DGVIC(DGSUB))="" D
  1. . . . S DGTYPE=$S(DGVIC("ADRTYPE")=1:"permanent",DGVIC("ADRTYPE")=2:"temporary",DGVIC("ADRTYPE")=3:"confidential",1:"facility")
  1. . . . S DGERR="Unable to determine the "_DGSUB_" field of the "_DGTYPE_" mailing address"
  1. . Q:$D(DGERR)
  1. . ;
  1. . ;check for required VIC eligibility factors
  1. . F DGSUB="SC" D Q:$D(DGERR)
  1. . . I $G(DGVIC(DGSUB))="" S DGERR="Unable to determine veteran's Service Connected Indicator"
  1. . Q:$D(DGERR)
  1. . ;
  1. . ;check for required facility data elements
  1. . F DGSUB="FACNUM","FACNAME","VISN" D Q:$D(DGERR)
  1. . . I $G(DGVIC(DGSUB))="" S DGERR="Unable to determine a source facility"
  1. ;
  1. Q $S($D(DGERR):0,1:1)
  1. ;
  1. ;
  1. HOLD(DGVIC,DGMSG) ;check for pending ICN, Enrollment Status, Purple Heart
  1. ; This function checks for a pending ICN, Enrollment Status, and/or
  1. ; Purple Heart confirmation and builds the appropriate message text
  1. ; when a pending condition exists.
  1. ;
  1. ; Input:
  1. ; DGVIC - VIC data array, pass by reference
  1. ; Array subscripts are:
  1. ; "ICN" - integration control number
  1. ; Note: Must be in format returned by $$GETICN^DGQEDEMO
  1. ; "ENRSTAT" - enrollment status
  1. ; Note: Must be in format returned by $$STATUS^DGENA
  1. ; "PH" - purple heart status
  1. ; Note: Must be in format returned by $$GETPH^DGQEUT1
  1. ;
  1. ; Output:
  1. ; Function value - returns 1 when a pending condition exists;
  1. ; otherwise, returns 0
  1. ;
  1. ; DGMSG - Message text returned when function value=1 listing
  1. ; pending data items; pass by reference
  1. ;
  1. N DGI ;generic index
  1. N DGENRST ;enrollment status value
  1. N DGCNT ;pending item count
  1. N DGRSLT ;function value
  1. ;
  1. S DGRSLT=0
  1. S DGCNT=0
  1. S DGENRST=+$G(DGVIC("ENRSTAT"))
  1. ;
  1. ;is national ICN missing
  1. I '+$G(DGVIC("ICN")) D
  1. . S DGRSLT=1
  1. . S DGCNT=DGCNT+1
  1. . S DGMSG(DGCNT)="Veteran does not have a National ICN"
  1. ;
  1. ;is enrollment status
  1. I $$ISENRPND^DGQEUT1(DGENRST) D
  1. . S DGRSLT=1
  1. . S DGCNT=DGCNT+1
  1. . S DGMSG(DGCNT)="Veteran is pending verification"
  1. ;
  1. ;is purple heart pending
  1. I $G(DGVIC("PH"))="P" D
  1. . S DGRSLT=1
  1. . S DGCNT=DGCNT+1
  1. . S DGMSG(DGCNT)="Veteran's Purple Heart status is pending confirmation"
  1. ;
  1. ;format message text
  1. I DGCNT D
  1. . S DGMSG=""
  1. . F DGI=1:1:DGCNT S DGMSG=DGMSG_$S(DGI>1&(DGI<DGCNT):", ",DGI>1&(DGI=DGCNT):" and ",1:"")_DGMSG(DGI)
  1. . S DGMSG=DGMSG_"."
  1. ;
  1. Q DGRSLT
  1. ;
  1. ;
  1. VICELIG(DGELG) ;is applicant eligible for a Veteran ID Card?
  1. ; This function determines if an applicant is eligible for a Veteran
  1. ; Identification Card (VIC).
  1. ;
  1. ; Input:
  1. ; DGELG - eligibility data object array
  1. ;
  1. ; Output:
  1. ; Function Value - returns 1 if the applicant is eligible for VIC,
  1. ; 0 if not eligible
  1. ;
  1. N DGRSLT ;function result
  1. ;
  1. ;set default, not eligible
  1. S DGRSLT=0
  1. ;
  1. D ;apply VIC eligibilty rules
  1. . I (DGELG("ENRSTAT")=2)!(DGELG("ENRSTAT")=21) S DGRSLT=1 Q
  1. . ;
  1. . I (DGELG("ENRSTAT")=7)!(DGELG("ENRSTAT")=19)!(DGELG("ENRSTAT")=20) D Q:DGRSLT
  1. . . Q:DGELG("ELIGSTAT")'="V"
  1. . . I DGELG("MST")="Y" S DGRSLT=1 Q
  1. . . I DGELG("SC")=1 S DGRSLT=1 Q
  1. . ;
  1. . I (DGELG("ENRSTAT")=11)!(DGELG("ENRSTAT")=12)!(DGELG("ENRSTAT")=13)!(DGELG("ENRSTAT")=14)!(DGELG("ENRSTAT")=22) D Q:DGRSLT
  1. . . Q:DGELG("ELIGSTAT")'="V"
  1. . . I DGELG("COMBVET")=1 S DGRSLT=1 Q
  1. . . I DGELG("SC")=1 S DGRSLT=1 Q
  1. . . I DGELG("MST")="Y" S DGRSLT=1 Q
  1. ;
  1. Q DGRSLT