DGENUPL8 ;ISA/KWP,RTK,PHH - PROCESS INCOMING (Z11 EVENT TYPE) HL7 MESSAGES ; 4/25/03 9:21am ;;5.3;REGISTRATION;**232,266,327,314,365,417,514**;Aug 13,1993 ;Moved ENRUPLD from DGENUPL3 ; ENRUPLD(DGENR,DGPAT) ; ;Description: uploads an enrollment receieved from HEC. The consistency ;checks are assumed to have been done, the other patient and eligibility ;data filed already. ; ;Inputs: ; DGENR - enrollment array (pass by reference) ; DGPAT - patient array (pass by reference) ; ;Output: none ; ;Phase II if HEC sends enrollment statuses VERIFIED(2),UNVERIFIED(1),REJECTED-FISCAL YEAR(11),REJECTED-MID-CYCLE(12),REJECTED-STOP ENROLLING NEW APPLiCANTS(13),PENDING-NO ELIGIBILITY CODE IN VIVA(15) ; PENDING-ELIGIBILITY UNVERIFIED(17),PENDING MEANS TEST REQUIRED(16),PENDING-OTHER(18),NOT ELIGIBLE; REFUSED TO PAY COPAY(19) ; NOT ELIGIBLE; INELIGIBLE DATE(20),PENDING PURPLE HEART UNCONFIRMED(21),DECEASED(6),CANCELED/DECLINED(7),REJECTED-INITIAL APPLICATION BY VAMC(14),REJECTED BELOW EGT THRESHOLD(22) then store enrollment (SRS6.5.1.2 f) ; N CURIEN,CURENR ; ;source should not be VAMC, since it is not a local enrollment I DGENR("SOURCE")=1 S DGENR("SOURCE")=2 ; ;is there a local enrollment? S CURIEN=$$FINDCUR^DGENA(DGENR("DFN")) ; ;if there is no current enrollment, store HEC enrollment and quit I 'CURIEN D G EXIT .;Phase II (SRS 6.5.1.2 f) .I "^1^2^6^7^11^12^13^14^15^16^17^18^19^20^21^22^"[("^"_DGENR("STATUS")_"^") I $$STORECUR^DGENA1(.DGENR,1) I '$$GET^DGENA(CURIEN,.CURENR) D G EXIT .;Phase II (SRS 6.5.1.2 f) .I "^1^2^6^7^11^12^13^14^15^16^17^18^19^20^21^22^"[("^"_DGENR("STATUS")_"^") I $$STORECUR^DGENA1(.DGENR,1) ; ;check for duplicate Q:$$DUP(.DGENR,.CURENR) ; ;if there is no local enrollment, HEC enrollment becomes current I CURENR("SOURCE")'=1 D G EXIT .;Phase II (SRS 6.5.1.2 f) .I "^1^2^6^7^11^12^13^14^15^16^17^18^19^20^21^22^"[("^"_DGENR("STATUS")_"^") I $$STORECUR^DGENA1(.DGENR,1) ;******************************************************************** ;check for exceptions to making HEC enrollment the patient's current enrollment,i.e.,cases in which local enrollment remains the current enrollment ;******************************************************************** ; ;if local enrollment has status of Deceased, if the patient is dead and HEC's enrollment doesn't have status of Deceased reject upload I (CURENR("STATUS")=6),DGENR("STATUS")'=6,DGPAT("DEATH") D G EXIT .D ADDERROR^DGENUPL(MSGID,DGPAT("SSN"),"LOCAL SITE REQUESTED TO VERIFY PATIENT DEATH",.ERRCOUNT) .D ADDMSG^DGENUPL3(.MSGS,"ELIBILITY UPLOAD DOESN'T CONTAINED DATE OF DEATH AND WAS REJECTED, PLEASE VERIFY PATIENT DEATH",1) .D NOTIFY^DGENUPL3(.DGPAT,.MSGS) .S ERROR=1 ; ;Phase II if local enrollment has status UNVERIFIED(1),REJECTED-INITIAL APPLICATION BY VAMC(14),PENDING(9) ;and HEC sends status of REJECTED-FISCAL YEAR(11),REJECTED-MID-CYCLE(12),REJECTED-STOP ENROLLING APPLICATIONS(13),PENDING-NO ELIGIBILITY CODE in VIVA(15),REJECTED BELOW EGT THRESHOLD ;PENDING-ELIGIBILITY UNVERIFIED(17),PENDING-MEANS TEST REQUIRED(16),PENDING-OTHER(18) ;CANCELED/DECLINED(7) accept upload (SRS 6.5.1.2 h) I "^1^9^14^"[("^"_CURENR("STATUS")_"^"),"^7^11^12^13^15^16^17^18^19^20^21^22^"[("^"_DGENR("STATUS")_"^") D G EXIT .I $$STORECUR^DGENA1(.DGENR,1) ; ;if local enrollment has status of Canceled/Declined, HEC enrollment has status of Verified or Unverified, HEC enrollment has an earlier or same effective date accept upload I (CURENR("STATUS")=7),"^1^2^"[("^"_DGENR("STATUS")_"^"),(CURENR("EFFDATE")'