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

BMEMFALL.m

Go to the documentation of this file.
  1. BMEMFALL ; IHS/PHXAO/TMJ - Roster Fall Offs ;
  1. ;;1.0T1;MEDICAID ELIGIBILITY DOWNLOAD;;JUN 25, 2003
  1. ;
  1. ;This routine $ORDER's through the RPMS Master File &
  1. ;checks for all records who's Still Active Date is not
  1. ;equal to the current month's Download Date. If these
  1. ;patients also do not have a Fall Off Date Recorded
  1. ;The MEDICAID ELIGIBILITY File will be populated/updated
  1. ;with an ending date ONLY if one does not exist for the
  1. ;last entry.
  1. ;
  1. ;
  1. START ;
  1. S BMEFCNT=0
  1. D GETLOG ;Get Last Download Log IEN #
  1. D MAST
  1. D LOG
  1. D END
  1. Q
  1. ;
  1. ;
  1. ;
  1. GETLOG ; -- this sets up the device and sets the file name
  1. S BMELSTN="" ;Last Log IEN # for Last File processed
  1. S BMELSTNM="" ;Actual File Name in Log
  1. S BMELSTN=$P($G(^BMEMLOG(0)),U,3)
  1. I BMELSTN="" W !,"No Date Exists on Last Download Run",! G END
  1. S BMELOGDT=$P($G(^BMEMLOG(BMELSTN,0)),U,2) ;Run Stop Date
  1. S BMELOGDT=$P(BMELOGDT,".",1) ;Strip Time off Date
  1. ;S BMELSTNM=$P($G(^BMEMLOG(BMELSTN,0)),U,8)
  1. ;I BMELSTNM="" W !!,"Last File Name does NOT exist in Log. Contact Site Manager!" S BMEERROR=1 Q
  1. S BMEMSTDT=$P($G(^BMEMLOG(BMELSTN,0)),U,1) ;START DT/TIME
  1. Q:'$G(BMEMSTDT)
  1. S BMEMSTDT=$P(BMEMSTDT,".",1) ;Strip Time off Start Date
  1. Q:BMEMSTDT'=BMELOGDT ;Quit if Start and Stop Date do not match
  1. ;
  1. ;
  1. Q
  1. ;
  1. ;
  1. ;
  1. MAST ;Begin $O through RPMS Master File ^BMEMASTR(
  1. S BMEMAIEN=0 F S BMEMAIEN=$O(^BMEMASTR(BMEMAIEN)) Q:'BMEMAIEN D
  1. . S BMEMREC=^BMEMASTR(BMEMAIEN,0)
  1. . S BMESTILL=$P(BMEMREC,U,4) ;Still Eligible Date
  1. . Q:'BMESTILL
  1. . S DFN=$P(BMEMREC,U,1) ;Patient DFN #
  1. . Q:'DFN
  1. . S BMEFALL=$P(BMEMREC,U,5) ; Fall Off Date
  1. . Q:BMEFALL'="" ;Quit if a Fall Date already exists
  1. . S BMELSTDT=$P(BMEMREC,U,6) ;Last Roster End Date
  1. . S BMELSTDT=$S(BMELSTDT'="":BMELSTDT,1:DT) ;If No Roster End Date - End with Todays Date
  1. . I BMESTILL'=BMELOGDT D MED
  1. ;
  1. ;
  1. MED ; -- add eligiblity date(s)/data
  1. S IEN=$O(^AUPNMCD("B",DFN,0)) Q:'IEN
  1. Q:'$D(^AUPNMCD(IEN,11,0)) ;Quit if Multiple Zero Node does not exist
  1. S BMELEBD=$P($G(^AUPNMCD(IEN,11,0)),U,3) ;Last Beg Date IEN entered
  1. I BMELEBD'="" D
  1. . S BMELEED=$P($G(^AUPNMCD(IEN,11,BMELEBD,0)),U,2) ;End Date
  1. . I BMELEED="" S DR=".02///"_BMELSTDT S DIE="^AUPNMCD("_IEN_",11,",DA(1)=IEN,DA=BMELEBD D ^DIE K DIE,DR,DA,DINUM D FALL^BMEMSTR S BMEFCNT=BMEFCNT+1
  1. Q
  1. ;
  1. ;
  1. LOG ;Populate Download Run Log with # of Fall Off's
  1. ;
  1. Q:BMELSTN=""
  1. Q:BMEFCNT<0
  1. S DIE="^BMEMLOG(",DA=BMELSTN,DR="2////"_BMEFCNT
  1. D ^DIE K DIE,DA,DR
  1. Q
  1. ;
  1. ;
  1. END ;End of Run
  1. K BMELSTN,BMELSTNM,BMELOGDT,BMEMAIEN,BMEMREC,BMESTILL,DFN,BMEFALL,BMELEBD,BMELEED,BMEFCNT
  1. Q