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

BQIFLFLG.m

Go to the documentation of this file.
  1. BQIFLFLG ;PRXM/HC/ALA-Determine Flag Indicator ; 15 Dec 2005 2:33 PM
  1. ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
  1. ;
  1. Q
  1. ;
  1. FND(BQIUSR,PDFN,ADIEN) ;EP - Find for each iCare user whether their patient has active flags
  1. ;
  1. ;Processing variables
  1. ; BQIUSR = User signed into the system
  1. ; PDFN = Patient internal entry number (DFN)
  1. ; ADN = User Flag definition internal entry number
  1. ; ADESC = Flag definition description
  1. ; ADIEN = iCare definition internal entry number
  1. ;
  1. NEW VALUE,FLAGG,BQIFLAG
  1. I $G(DT)="" D DT^DICRW
  1. ; For each user and their flag definitions
  1. S FLAGG=0
  1. D RET^BQIFLAG(BQIUSR,.BQIPREF)
  1. S ADIEN=""
  1. F S ADIEN=$O(BQIPREF(ADIEN)) Q:ADIEN="" D
  1. . ; For each patient in all of a user's panels, see if there are active flags
  1. . S FDT=$P(BQIPREF(ADIEN),U,1),TDT=$P(BQIPREF(ADIEN),U,2)
  1. . I PDFN'="" D
  1. .. I '$$PAT(PDFN,ADIEN,FDT,TDT,BQIUSR) D FLG("R") Q
  1. .. ;
  1. .. ; If the patient has active alerts based on the user's criteria, set the alert flag
  1. .. ; for each panel belonging to the user that the patient is found.
  1. .. I $$PAT(PDFN,ADIEN,FDT,TDT,BQIUSR) D FLG("A")
  1. . ;
  1. . I PDFN="",PLIEN'="" D
  1. .. S PDFN=0,BQIFLAG=0
  1. .. F S PDFN=$O(^BQICARE(BQIUSR,1,PLIEN,40,PDFN)) Q:'PDFN D Q:BQIFLAG
  1. ... I '$$PAT(PDFN,ADIEN,FDT,TDT,BQIUSR) D FLG("R") Q
  1. ... I $$PAT(PDFN,ADIEN,FDT,TDT,BQIUSR) D FLG("A") S BQIFLAG=1
  1. ;
  1. K ADESC,ADIEN,ADN,ADTM,AIEN,ALIEN,BQIUSR,FDT,FLAG,NAME,NM
  1. K PARMS,PDFN,PIEN,PMIEN,PTYP,SOURCE,STAT,TDT,TMFRAME,X,Y,%DT
  1. Q
  1. ;
  1. PAT(DFN,ADIEN,SDT,EDT,USR) ;EP - Check for active flags
  1. ;
  1. ;Input
  1. ; DFN = Patient internal entry number
  1. ; ADIEN = iCare definition internal entry number
  1. ; SDT = Start date range for the user preferences time frame
  1. ; EDT = End date (which is today)
  1. ; USR = User whose flag preferences are being checked
  1. ;Output
  1. ; FLAG = If flag is 1, then active; if 0, is not active for this user (opposite of STAT)
  1. ;Processing Variables
  1. ; ADTM = Time Frame starting date
  1. ; EDT = Time Frame ending date
  1. ; ALIEN = Patient flag record internal entry number
  1. ; STAT = Status of the record by this user. If the user has set the
  1. ; status to 1=Don't Show, then it is considered no longer active.
  1. ;
  1. ;Check in the ICARE PATIENT INDEX File (#90507.5) for any flags that meet
  1. ;the user's defined criteria
  1. ;
  1. S ADTM=SDT,FLAG=0
  1. F S ADTM=$O(^BQIPAT(DFN,10,ADIEN,5,"AC",ADTM)) Q:ADTM=""!(ADTM\1>EDT) D Q:FLAG
  1. . S ALIEN=0
  1. . F S ALIEN=$O(^BQIPAT(DFN,10,ADIEN,5,"AC",ADTM,ALIEN)) Q:'ALIEN D Q:FLAG
  1. .. Q:'$D(^BQIPAT(DFN,10,ADIEN,5,ALIEN,1,USR))
  1. .. S STAT=+$P(^BQIPAT(DFN,10,ADIEN,5,ALIEN,1,USR,0),U,2)
  1. .. I STAT'=1 S FLAG=1
  1. Q FLAG
  1. ;
  1. FLG(ACT) ;EP - Set or Remove flag indicator
  1. ;
  1. ;Input
  1. ; ACT = Action flag "R" is remove flag and "A" is add flag
  1. ;
  1. NEW PLIEN
  1. S PLIEN=0
  1. F S PLIEN=$O(^BQICARE(BQIUSR,1,"AB",PDFN,PLIEN)) Q:'PLIEN D
  1. . I $G(^BQICARE(BQIUSR,1,PLIEN,40,PDFN,0))="" K ^BQICARE(BQIUSR,1,"AB",PDFN,PLIEN) Q
  1. . NEW DA,IENS
  1. . S DA(2)=BQIUSR,DA(1)=PLIEN,DA=PDFN,IENS=$$IENS^DILF(.DA)
  1. . ;
  1. . ; Set patient record in panel with 1=Yes, has active flags or 0=No, has no active flags
  1. . I ACT="R" S BQIUPD(90505.04,IENS,.08)=0 Q
  1. . I ACT="A" S BQIUPD(90505.04,IENS,.08)=1
  1. I '$D(BQIUPD(90505.04)) D ; Check shared panels if patient is not in owner's panel
  1. . N BQISHR
  1. . S (BQISHR,PLIEN)=""
  1. . F S BQISHR=$O(^BQICARE("C",BQIUSR,BQISHR)) Q:BQISHR="" D Q:$D(BQIUPD(90505.04))
  1. .. F S PLIEN=$O(^BQICARE("C",BQIUSR,BQISHR,PLIEN)) Q:PLIEN="" D Q:$D(BQIUPD(90505.04))
  1. ... I $D(^BQICARE(BQISHR,1,PLIEN,40,PDFN)) D
  1. .... NEW DA,IENS
  1. .... S DA(2)=BQISHR,DA(1)=PLIEN,DA=PDFN,IENS=$$IENS^DILF(.DA)
  1. .... ;
  1. .... ; Set patient record in panel with 1=Yes, has active flags or 0=No, has no active flags
  1. .... I ACT="R" S BQIUPD(90505.04,IENS,.08)=0 Q
  1. .... I ACT="A" S BQIUPD(90505.04,IENS,.08)=1
  1. D FILE^DIE("","BQIUPD","ERROR")
  1. K BQIUPD
  1. Q
  1. ;
  1. PMS(USER,FLGN,PDFN) ;EP - Get parameter values
  1. ;
  1. ;Input Parameters
  1. ; USER - User
  1. ; FLGN - Flag internal entry number
  1. ; For each user and their flag definition
  1. NEW ADIEN,BQIPREF
  1. D RET^BQIFLAG(USER,.BQIPREF)
  1. S ADIEN=FLGN
  1. S FDT=$P(BQIPREF(ADIEN),U,1),TDT=$P(BQIPREF(ADIEN),U,2)
  1. ;
  1. I $$PAT(PDFN,ADIEN,FDT,TDT,USER) Q 1
  1. Q 0