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

BQIPTFLG.m

Go to the documentation of this file.
BQIPTFLG ;PRXM/HC/ALA-Patient Flag Indicator ; 14 Dec 2006  1:34 PM
 ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
 ;
GET(DATA,PDFN) ;EP -- BQI GET FLAG IND BY DFN
 ;Description
 ;  Returns all flag indicators by panel and owner for a patient
 ;Input
 ;   PDFN - Patient internal entry number
 ;   
 ;Assumes DUZ
 ;
 NEW UID,II,BQIFLAG,PPDFN,BQIPREF,QFL,OWNR,PLIEN
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIPTFLG",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPTFLG D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 D RET^BQIFLAG(DUZ,.BQIPREF)
 S @DATA@(II)="I00010OWNER^I00010PANEL_IEN^T00001FLAG_INDICATOR^T00015PANEL_ID"_$C(30)
 S PLIEN=""
 F  S PLIEN=$O(^BQICARE("AB",PDFN,DUZ,PLIEN)) Q:PLIEN=""  D
 . I $P(^BQICARE(DUZ,1,PLIEN,40,PDFN,0),"^",2)="R" Q
 . S PPDFN=0,QFL=0
 . F  S PPDFN=$O(^BQICARE(DUZ,1,PLIEN,40,PPDFN)) Q:'PPDFN  D  Q:QFL
 .. I $P(^BQICARE(DUZ,1,PLIEN,40,PPDFN,0),"^",2)="R" Q
 .. S BQIFLAG=$$FPAT^BQIFLAG(PPDFN,DUZ,.BQIPREF)
 .. I BQIFLAG S QFL=1
 . S II=II+1,@DATA@(II)=DUZ_"^"_PLIEN_"^"_$S(QFL:"Y",1:"")_"^"_$$PLID^BQIUG1(DUZ,PLIEN)_$C(30)
 ;
 ; Check for shared panels
 S OWNR=""
 F  S OWNR=$O(^BQICARE("C",DUZ,OWNR)) Q:OWNR=""  D
 . S PLIEN=""
 . F  S PLIEN=$O(^BQICARE("C",DUZ,OWNR,PLIEN)) Q:PLIEN=""  D
 .. I $G(^BQICARE(OWNR,1,PLIEN,40,PDFN,0))="" Q
 .. I $P(^BQICARE(OWNR,1,PLIEN,40,PDFN,0),"^",2)="R" Q
 .. S PPDFN=0,QFL=0
 .. F  S PPDFN=$O(^BQICARE(OWNR,1,PLIEN,40,PPDFN)) Q:'PPDFN  D  Q:QFL
 ... S BQIFLAG=$$FPAT^BQIFLAG(PPDFN,DUZ,.BQIPREF)
 ... I BQIFLAG S QFL=1
 .. S II=II+1,@DATA@(II)=OWNR_"^"_PLIEN_"^"_$S(QFL:"Y",1:"")_"^"_$$PLID^BQIUG1(OWNR,PLIEN)_$C(30)
 ;
DONE S II=II+1,@DATA@(II)=$C(31)
 Q
ERR ;
 D ^%ZTER
 NEW Y,ERRDTM
 S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
 S BMXSEC="Recording that an error occurred at "_ERRDTM
 I $D(II),$D(DATA) S II=II+1,@DATA@(II)=$C(31)
 Q