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

EASUER.m

Go to the documentation of this file.
  1. EASUER ;ALB/CKN - GEOGRAPHIC MEANS TEST PHASE II ; 03-MAR-2003
  1. ;;1.0;ENROLLMENT APPLICATION SYSTEM;**25,37,50,55**;Mar 15, 2001
  1. ;This routine contains several APIs that will be called from
  1. ;different packages like Scheduling, PCE and Fee basis to notify
  1. ;Enrollment package whenever any inpatient/outpatient encounter occurs,
  1. ;or any appointment made or any changes made to fee basis authorization.
  1. Q
  1. SCHED ;This API will be called from SDAM APPOINTMENT EVENTS via EAS UE SCHED
  1. ;EVENT protocol whenever any changes made to veteran's appointment.
  1. ;Input variables used in this api:
  1. ; SDATA - piece 1 - ien of multiple entry of the
  1. ; APPOINTMENTS multiple of the
  1. ; HOSPITAL LOCATION file.
  1. ; piece 2 - ien of PATIENT file (DFN)
  1. ; piece 3 - internal Date/time of appt.
  1. ; piece 4 - ien of clinic in the HOSPITAL
  1. ; LOCATION file.
  1. ; SDAMEVT - ien pointing to an entry in the APPOINTMENT
  1. ; TRANSACTION file (#409.66).
  1. ;
  1. N DFN,APT,APTDT
  1. S DFN=$P($G(SDATA),"^",2) Q:DFN="" ;Veteran's IEN
  1. I $G(SDAMEVT)=1 D ;if new appointment is made
  1. . S APTDT=$P($G(SDATA),"^",3),APTDT=$$FY(APTDT)
  1. . ;check current User Enrollee data and update it if necessary.
  1. . I $$UPDCHK(DFN,APTDT) D FILE(DFN,APTDT)
  1. Q
  1. ENC ;This API will be called from PXK VISIT DATA EVENT via EAS UE PCE EVENT
  1. ;whenever any inpatient/outpatient encounter occurs.
  1. ;Input:
  1. ;^TMP("PXKCO",$J,VISIT,"V FILE STRING",V FILE RECORD,DDSUBSCRIPT,"AFTER/BEFORE")=DATA
  1. ;where: subscript piece 1 - string notation representing package "PXKCO"
  1. ; subscript piece 2 - Job number ($J)
  1. ; subscript piece 3 - ien of VISIT file
  1. ; subscript piece 4 - string representing the VISIT or V file
  1. ; data category
  1. ; subscript piece 5 - ien of the entry in the file represented in
  1. ; subscript #4
  1. ; subscript piece 6 - subscript or DD node on which the data is stored.
  1. ; subscript piece 7 - string designating whether or not the data
  1. ; is an "after" or "before" reflection of data.
  1. ;
  1. N VSIT,NODE,DFN,VDT
  1. I '$D(^TMP("PXKCO",$J)) Q
  1. S VSIT=$O(^TMP("PXKCO",$J,"")) Q:VSIT="" ;ien of VISIT file
  1. S NODE=$G(^AUPNVSIT(VSIT,0))
  1. ;get Veteran's IEN and encounter date
  1. S DFN=$P($G(NODE),"^",5),VDT=$P($G(NODE),"^",1)
  1. S VDT=$$FY(VDT)
  1. ;check current User Enrollee data and update if necessary
  1. I $$UPDCHK(DFN,VDT) D FILE(DFN,VDT)
  1. Q
  1. FBAUTH(FBDFN,FBTODT) ;This Enrollment api will be called from Fee basis
  1. ;applications at the time of any fee basis authorization changes.
  1. ;Input: FBDFN - Veteran's ien
  1. ; FBTODT - Latest date of authorization.
  1. ;
  1. N XDT
  1. S XDT=$$FY(FBTODT)
  1. I $$UPDCHK(FBDFN,XDT) D FILE(FBDFN,XDT)
  1. Q
  1. INP ;This Enrollment api will be called from DGPM MOVEMENT EVENT via
  1. ;EAS UE INP EVENT protocol whenever inpatient veteran is admitted,
  1. ;transfered,discharged or any movement.
  1. ;supported variables of this event:
  1. ; DFN - Pointer to patient in PATIENT file (#2)
  1. ; DGPMDA - Pointer to primary movement in PATIENT MOVEMENT file.
  1. ; DGPMP - Zero node of primary movement prior to add/edit/del
  1. ; DGPMA - Zero node of primary movement after add/edit/delete
  1. ;
  1. N XDT
  1. I '$G(DFN)!'$G(DGPMDA) Q
  1. S XDT=$P($G(^DGPM(DGPMDA,0)),"^") ;Date of movement
  1. S XDT=$$FY(XDT) I $$UPDCHK(DFN,XDT) D FILE(DFN,XDT)
  1. Q
  1. UESTAT(DFN) ;This api will be called at the time of Annual MT renewal
  1. ;process to check if veteran has UE status for current FY.
  1. N UESTAT,UESITE,UESTN,CURSTN,PRNT,CHILD,CIEN
  1. I '$G(DFN) Q 0 ;No DFN
  1. S UESTAT=$P($G(^DPT(DFN,.361)),"^",7)
  1. I UESTAT="" Q 0 ;Not User Enrollee
  1. I UESTAT<$$FY(DT) Q 0 ;Not User Enrollee for current FY
  1. S UESITE=$P($G(^DPT(DFN,.361)),"^",8) Q:+UESITE=0 0
  1. ; *** Modifications for patch 55 to handle VISN or HCS UE Sites
  1. S UESTN=$$STA^XUAF4(UESITE)
  1. S CURSTN=$P($$SITE^VASITE,"^",3)
  1. ;
  1. I UESTN']"" D
  1. . D CHILDREN^XUAF4("CHILD","`"_UESITE,"PARENT FACILITY")
  1. . S CIEN=0 F S CIEN=$O(CHILD("C",CIEN)) Q:'CIEN I CIEN=CURSTN S UESTN=$$STA^XUAF4(CIEN) Q
  1. . I UESTN']"" D
  1. . . D CHILDREN^XUAF4("CHILD","`"_UESITE,"VISN")
  1. . . S CIEN=0 F S CIEN=$O(CHILD("C",CIEN)) Q:'CIEN I CIEN=CURSTN S UESTN=$$STA^XUAF4(CIEN) Q
  1. ;
  1. S PRNT=$$PSITE(CURSTN),CURSTN=$$STA^XUAF4(PRNT)
  1. I UESTN'=CURSTN Q 2 ;Not same site
  1. Q 1
  1. UPDCHK(DFN,APTDT) ;This api will determine whether to update User Enrollee data.
  1. I '$G(DFN) Q 0 ;No DFN
  1. I $P($G(^DPT(DFN,"VET")),"^")="N" Q 0 ;Quit if Non veteran
  1. I APTDT<3030000 Q 0 ;Quit if APTDT is less than FY 2003
  1. N CURSTAT
  1. S CURSTAT=$P($G(^DPT(DFN,.361)),"^",7)
  1. I APTDT>CURSTAT Q 1
  1. Q 0
  1. FY(XDATE) ;Returns a fiscal year for the date
  1. N ENFY S ENFY=""
  1. I $G(XDATE)?7N.E S ENFY=$S($E(XDATE,4,5)<10:$E(XDATE,1,3),1:$E(XDATE,1,3)+1)
  1. Q ENFY_"0000"
  1. ;
  1. PSITE(STA) ;Get parent site IEN
  1. N PRNT,PRNTYP
  1. ;
  1. S PRNT=0
  1. ; First pass, get the parent facility, then get the facility type for the parent
  1. ; If the parent is a VAMC, then quit returning parent
  1. ; If the parent is either a VISN or HCS type, then return the current station, not the parent
  1. ;
  1. S PRNT=+$$PRNT^XUAF4(STA)
  1. I PRNT>0 D
  1. . S PRNTYP=$$GET1^DIQ(4,PRNT,13)
  1. . I PRNTYP="VAMC" Q
  1. . I "HCS,VISN"[PRNTYP S PRNT=STA Q
  1. E D
  1. . I $$GET1^DIQ(4,STA,13)="VAMC" S PRNT=STA Q
  1. . E S REVSTA=$E(STA,1,3),PRNT=+$$PRNT^XUAF4(REVSTA) D
  1. . . I $$GET1^DIQ(4,PRNT,13)="VAMC" Q
  1. . . S PRNT=+$O(^DIC(4,"D",REVSTA,""))
  1. Q PRNT
  1. ;
  1. CHKPRNT(PRNT) ; Check if parent is a VISN entity, removed with Patch 50
  1. Q 0
  1. ;
  1. FILE(XIEN,XDT) ;Update User Enrollee fields and queue Z07
  1. N DATA,FILEUPD,SITE,PRNT,EVENT,IYR
  1. S SITE=$$SITE^VASITE,SITE=$P($G(SITE),"^",3)
  1. S PRNT=$$PSITE(SITE) Q:'+$G(PRNT)
  1. S DATA(.3617)=XDT,DATA(.3618)=PRNT
  1. I '$$UPD^DGENDBS(2,.XIEN,.DATA) Q
  1. S IYR=$$INCYR(XIEN)
  1. S EVENT("ENROLL")=1 I $$LOG^IVMPLOG(XIEN,IYR,.EVENT)
  1. Q
  1. INCYR(XIEN) ;Get valid income year
  1. ;N INCYR,LMT,R3015,I,TEMP
  1. I $D(^IVM(301.5,"APT",XIEN)) D Q INCYR
  1. . S INCYR=$O(^IVM(301.5,"APT",XIEN,""),-1)
  1. F I=1,2,4 D
  1. . S LMT=$$LST^DGMTU(XIEN,,I)
  1. . I +$G(LMT) S TEMP($P(LMT,"^",2))=""
  1. I $D(TEMP) S LMT=$O(TEMP(""),-1),INCYR=($E(LMT,1,3)-1)_"0000" Q INCYR
  1. S INCYR=($E(DT,1,3)-1)_"0000"
  1. Q INCYR