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

BQIDCMDP.m

Go to the documentation of this file.
  1. BQIDCMDP ;PRXM/HC/ALA-"MY PATIENTS-DPCP" ; 19 Oct 2005 5:49 PM
  1. ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
  1. ;
  1. Q
  1. ;
  1. FND(DATA,PARMS,MPARMS) ;EP - Find all patients
  1. ;
  1. ;Description
  1. ; Executable to find all patients who has the designated primary provider
  1. ;Input
  1. ; PARMS = Array of parameters and their values
  1. ; MPARMS = Multiple array of a parameter (not currently used for this definition)
  1. ;Expected to return DATA
  1. ;
  1. NEW UID
  1. S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
  1. S DATA=$NA(^TMP("BQIDCMDP",UID))
  1. K @DATA
  1. ;
  1. NEW NM
  1. I '$D(PARMS) Q
  1. ;
  1. S NM=""
  1. F S NM=$O(PARMS(NM)) Q:NM="" S @NM=PARMS(NM)
  1. ;
  1. ; If the DSPM package is installed
  1. I $$VERSION^XPDUTL("BDP")'="" D DSPM Q
  1. ;
  1. ; If the DSPM package is NOT installed, use the alternate
  1. ; primary provider definition
  1. NEW IEN
  1. S IEN=""
  1. F S IEN=$O(^AUPNPAT("AK",PROV,IEN)) Q:IEN="" D
  1. . ; If patient is deceased, quit
  1. . I $P($G(^DPT(IEN,.35)),U,1)'="" Q
  1. . ; If patient has no active HRNs, quit
  1. . I '$$HRN^BQIUL1(IEN) Q
  1. . ; If patient has no visit in last 3 years, quit
  1. . ;I '$$VTHR^BQIUL1(IEN) Q
  1. . S @DATA@(IEN)=""
  1. Q
  1. ;
  1. DSPM ; Find the internal entry number
  1. NEW DFN,CAT,DIC,IEN,Y,X
  1. S DIC="^BDPTCAT("
  1. S DIC(0)="Z",X="DESIGNATED PRIMARY PROVIDER" D ^DIC
  1. S CAT=+Y I CAT=-1 Q
  1. ;
  1. S IEN=""
  1. F S IEN=$O(^BDPRECN("AC",PROV,IEN)) Q:IEN="" D
  1. . I $$GET1^DIQ(90360.1,IEN_",",.01,"I")'=CAT Q
  1. . S DFN=$$GET1^DIQ(90360.1,IEN_",",.02,"I") I DFN="" Q
  1. . ; If patient is deceased, quit
  1. . I $P($G(^DPT(DFN,.35)),U,1)'="" Q
  1. . ; If patient has no active HRNs, quit
  1. . I '$$HRN^BQIUL1(DFN) Q
  1. . ; If patient has no visit in last 3 years, quit
  1. . ;I '$$VTHR^BQIUL1(DFN) Q
  1. . S @DATA@(DFN)=""
  1. . ;
  1. ; Also check patient file
  1. NEW IEN
  1. S IEN=""
  1. F S IEN=$O(^AUPNPAT("AK",PROV,IEN)) Q:IEN="" D
  1. . ; If patient is deceased, quit
  1. . I $P($G(^DPT(IEN,.35)),U,1)'="" Q
  1. . ; If patient has no active HRNs, quit
  1. . I '$$HRN^BQIUL1(IEN) Q
  1. . ; If patient has no visit in last 3 years, quit
  1. . ;I '$$VTHR^BQIUL1(IEN) Q
  1. . S @DATA@(IEN)=""
  1. Q