- BQIDCMSP ;VNGT/HS/ALA-MY PATIENTS-SPECIALTY PROVIDER ; 12 Dec 2008 1:42 PM
- ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
- ;
- Q
- ;
- FND(DATA,PARMS,MPARMS) ;EP - Find records
- ;
- ;Description
- ; Executable that finds all patients who has a designated case manager
- ;Input
- ; PARMS = Array of parameters and their values
- ; MPARMS = Multiple array of a parameter (not currently used for this definition)
- ;Expected to return DATA
- ;
- ; If the DSPM package is not installed, quit as there is no other case manager
- ; alternative
- I $$VERSION^XPDUTL("BDP")="" Q
- ;
- NEW UID,NM,PSPEC,SPEC,DFN,PROV
- S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
- S DATA=$NA(^TMP("BQIDCMCM",UID))
- K @DATA
- ;
- ; Set the parameters into variables
- I '$D(PARMS),'$D(MPARMS) Q
- ;
- S NM=""
- F S NM=$O(PARMS(NM)) Q:NM="" D
- . S @NM=$P(PARMS(NM),U,1)
- . F I=2:1:$L(PARMS(NM),U) S @($P(PARMS(NM),U,I))
- ;
- ; Go through the BDP DESG SPECIALTY PROVIDER File to find any patient
- ; with the specified case manager
- ;
- S IEN=""
- F S IEN=$O(^BDPRECN("AC",PROV,IEN)) Q:IEN="" D
- . S PSPEC=$$GET1^DIQ(90360.1,IEN_",",.01,"I")
- . I $G(SPEC)'="",PSPEC'=SPEC Q
- . I $D(MPARMS("SPEC")),'$D(MPARMS("SPEC",PSPEC)) Q
- . S DFN=$$GET1^DIQ(90360.1,IEN_",",.02,"I") I DFN="" Q
- . ; User may now select Living, Deceased or both as a filter so
- . ; if no filters defined assume living patients otherwise let filter decide
- . I $O(^BQICARE(OWNR,1,PLIEN,15,0))="",$P($G(^DPT(DFN,.35)),U,1)'="" Q
- . ; If patient has no active HRNs, quit
- . I '$$HRN^BQIUL1(DFN) Q
- . ; If patient has no visit in last 3 years, quit
- . ;I '$$VTHR^BQIUL1(DFN) Q
- . S @DATA@(DFN)=""
- Q
- BQIDCMSP ;VNGT/HS/ALA-MY PATIENTS-SPECIALTY PROVIDER ; 12 Dec 2008 1:42 PM
- +1 ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
- +2 ;
- +3 QUIT
- +4 ;
- FND(DATA,PARMS,MPARMS) ;EP - Find records
- +1 ;
- +2 ;Description
- +3 ; Executable that finds all patients who has a designated case manager
- +4 ;Input
- +5 ; PARMS = Array of parameters and their values
- +6 ; MPARMS = Multiple array of a parameter (not currently used for this definition)
- +7 ;Expected to return DATA
- +8 ;
- +9 ; If the DSPM package is not installed, quit as there is no other case manager
- +10 ; alternative
- +11 IF $$VERSION^XPDUTL("BDP")=""
- QUIT
- +12 ;
- +13 NEW UID,NM,PSPEC,SPEC,DFN,PROV
- +14 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
- +15 SET DATA=$NAME(^TMP("BQIDCMCM",UID))
- +16 KILL @DATA
- +17 ;
- +18 ; Set the parameters into variables
- +19 IF '$DATA(PARMS)
- IF '$DATA(MPARMS)
- QUIT
- +20 ;
- +21 SET NM=""
- +22 FOR
- SET NM=$ORDER(PARMS(NM))
- IF NM=""
- QUIT
- Begin DoDot:1
- +23 SET @NM=$PIECE(PARMS(NM),U,1)
- +24 FOR I=2:1:$LENGTH(PARMS(NM),U)
- SET @($PIECE(PARMS(NM),U,I))
- End DoDot:1
- +25 ;
- +26 ; Go through the BDP DESG SPECIALTY PROVIDER File to find any patient
- +27 ; with the specified case manager
- +28 ;
- +29 SET IEN=""
- +30 FOR
- SET IEN=$ORDER(^BDPRECN("AC",PROV,IEN))
- IF IEN=""
- QUIT
- Begin DoDot:1
- +31 SET PSPEC=$$GET1^DIQ(90360.1,IEN_",",.01,"I")
- +32 IF $GET(SPEC)'=""
- IF PSPEC'=SPEC
- QUIT
- +33 IF $DATA(MPARMS("SPEC"))
- IF '$DATA(MPARMS("SPEC",PSPEC))
- QUIT
- +34 SET DFN=$$GET1^DIQ(90360.1,IEN_",",.02,"I")
- IF DFN=""
- QUIT
- +35 ; User may now select Living, Deceased or both as a filter so
- +36 ; if no filters defined assume living patients otherwise let filter decide
- +37 IF $ORDER(^BQICARE(OWNR,1,PLIEN,15,0))=""
- IF $PIECE($GET(^DPT(DFN,.35)),U,1)'=""
- QUIT
- +38 ; If patient has no active HRNs, quit
- +39 IF '$$HRN^BQIUL1(DFN)
- QUIT
- +40 ; If patient has no visit in last 3 years, quit
- +41 ;I '$$VTHR^BQIUL1(DFN) Q
- +42 SET @DATA@(DFN)=""
- End DoDot:1
- +43 QUIT