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

BQIPLDF.m

Go to the documentation of this file.
BQIPLDF ;PRXM/HC/DLS - Get Panel Definition ; 23 Nov 2005  11:13 AM
 ;;2.3;ICARE MANAGEMENT SYSTEM;;Apr 18, 2012;Build 59
 ;
 Q
 ;
EN(DATA,OWNER,PLIEN) ; EP -- BQI GET PANEL DEF
 ;
 ;Description
 ;  Given a Panel Owner IEN and a Panel IEN, generates the panel definition.
 ;
 ;Input
 ;  OWNER - Panel Owner IEN
 ;  PLIEN - IEN of the panel within the Owner's file.
 ;
 ;Output
 ;  DATA - Name of global in which data is stored(^TMP("BQIPLDF"))
 ;
 N UID,X,BQII,DA,IENS,PCAT
 N THDR,PLID,OWNRNM,PLNAME,PLDESC,PLDTCR,PLSTYP,DFUPBY,ASSOC,STATUS,IPCPL
 N PDTDFUP,AUPPFL,PDTPOPD,PTLSUP,DTLSUP,TOTPAT,SRCNAM,GDESC,FSRCNAM,POPBY
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIPLDF",UID))
 K @DATA
 ;
 S BQII=0
 ;
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIPLDF D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 D HDR
 ;
 ; Get PLID and Owner Name
 S DA=OWNER,IENS=$$IENS^DILF(.DA)
 S PLID=$$PLID^BQIUG1(OWNER,PLIEN)           ;PLID(Owner IEN + Panel IEN)
 S OWNRNM=$$GET1^DIQ(90505,IENS,.01,"E")     ;Owner Name
 ;
 ; Get Panel Information
 S DA(1)=OWNER,DA=PLIEN,IENS=$$IENS^DILF(.DA)
 S PLNAME=$$GET1^DIQ(90505.01,IENS,.01,"E")  ;Panel Name
 S PLDESC=$$GET1^DIQ(90505.01,IENS,1,"E")    ;Panel Descripton
 S PLDTCR=$$GET1^DIQ(90505.01,IENS,.02,"I")  ;Date Panel Created
 I PLDTCR S PLDTCR=$$FMTE^BQIUL1(PLDTCR)
 S PLSTYP=$$GET1^DIQ(90505.01,IENS,.03,"I")  ;Panel Source Type
 S DFUPBY=$$GET1^DIQ(90505.01,IENS,.04,"E")  ;Panel Def Last Updated By
 S PDTDFUP=$$GET1^DIQ(90505.01,IENS,.05,"I")  ;Date Panel Def Last Updated
 I PDTDFUP S PDTDFUP=$$FMTE^BQIUL1(PDTDFUP)
 S AUPPFL=$$GET1^DIQ(90505.01,IENS,.06,"I")  ;Autopopulate Flag
 S PDTPOPD=$$GET1^DIQ(90505.01,IENS,.07,"I")  ;Date Panel Last Populated
 S POPBY=$$GET1^DIQ(90505.01,IENS,3.5,"E")  ;Populated by
 I PDTPOPD S PDTPOPD=$$FMTE^BQIUL1(PDTPOPD)
 S PTLSUP=$$GET1^DIQ(90505.01,IENS,.08,"E")  ;Patient List Updated By
 S DTLSUP=$$GET1^DIQ(90505.01,IENS,.09,"I")  ;Date Patient List Last Updated
 I DTLSUP S DTLSUP=$$FMTE^BQIUL1(DTLSUP)
 S TOTPAT=$$GET1^DIQ(90505.01,IENS,.1,"E")   ;Total Patients
 S SRCNAM=$$GET1^DIQ(90505.01,IENS,.11,"E")  ;Source Name
 S FSRCNAM=$$GET1^DIQ(90505.01,IENS,.14,"E") ;Filter Source Name
 S STATUS=$$GET1^DIQ(90505.01,IENS,.13,"I")  ;Status
 S ASSOC=$$GET1^DIQ(90505.01,IENS,.15,"E")   ;Associated Panel IEN
 S IPCPL=$$GET1^DIQ(90505.01,IENS,2.1,"I")   ;IPC Panel Flag
 I IPCPL=1 S IPCPL="Y"
 S PCAT=$$PCAT(OWNER,PLIEN) ;Panel Category
 ; Generated description 
 S GDESC="" D
 . NEW TEXT,TN
 . D GETS^DIQ(90505.01,IENS,5,"","TEXT")
 . S TN=0 F  S TN=$O(TEXT(90505.01,IENS,5,TN)) Q:'TN  I TEXT(90505.01,IENS,5,TN)'="" D
 .. I TEXT(90505.01,IENS,5,TN)'["Panel Category:" S GDESC=GDESC_TEXT(90505.01,IENS,5,TN)_$C(10) Q
 .. NEW CDESC
 .. D CATIPC^BQIPDSCM(OWNER,PLIEN,.CDESC)
 .. I $D(CDESC(1,0)) S GDESC=GDESC_CDESC(1,0)_$C(10)
 ; 
 S BQII=BQII+1
 S @DATA@(BQII)=OWNER_"^"_OWNRNM_"^"_PLIEN_"^"_PLID_"^"_PLNAME_"^"_PLDESC_"^"_PLDTCR_"^"
 S @DATA@(BQII)=@DATA@(BQII)_PLSTYP_"^"_DFUPBY_"^"_PDTDFUP_"^"_AUPPFL_"^"_PDTPOPD_"^"_POPBY_"^"_PTLSUP_"^"_DTLSUP_"^"
 S @DATA@(BQII)=@DATA@(BQII)_TOTPAT_"^"_SRCNAM_"^"_GDESC_"^"_FSRCNAM_"^"_STATUS_"^"_ASSOC_"^"_IPCPL_"^"_PCAT_$C(30)
 ;
DONE ; -- exit
 S BQII=BQII+1,@DATA@(BQII)=$C(31)
 Q
 ;
HDR ; -- header
 S THDR="I00010OWNER^T00050OWNER_NAME^I00010PANEL_IEN^T00020PANEL_ID^T00120PANEL_NAME^T00250PANEL_DESCRIPTION^D00015DT_CREATED^"
 S THDR=THDR_"T00010SOURCE_TYPE^T00050DEF_LAST_UPDATED_BY^D00015DT_DEF_LAST_UPDATED^T00001AUTOPOPULATE_FLAG^D00015DT_LAST_POPULATED^"
 S THDR=THDR_"T00035POPULATED_BY^T00050PATIENT_LIST_UPDATED_BY^D00015DT_PATIENT_LIST_UPDATED^I00010TOTAL_PATIENTS^T00030SOURCE_NAME^"
 S THDR=THDR_"T00250GENERATED_DESCRIPTION^T00030FILTER_SOURCE_NAME^T00001STATUS^I00010ASSOCIATED_PANEL_IEN^T00001IPC_PANEL^"
 S THDR=THDR_"T00030PANEL_CATEGORY"_$C(30)
 S @DATA@(BQII)=THDR
 Q
 ;
PCAT(OWNR,PLIEN) ;EP - Retrieve panel category
 ;
 ;If panel owner equals DUZ
 NEW DA,IENS
 S DA(1)=OWNR,DA=PLIEN,IENS=$$IENS^DILF(.DA)
 I DUZ=OWNR Q $$GET1^DIQ(90505.01,IENS,2.2,"E")
 K DA,IENS
 ;
 ;Otherwise pull from share node
 NEW DA,IENS
 S DA(2)=OWNR,DA(1)=PLIEN,DA=DUZ,IENS=$$IENS^DILF(.DA)
 Q $$GET1^DIQ(90505.03,IENS,.06,"E")
 ;
ERR ; -- error trapping
 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(BQII),$D(DATA) S BQII=BQII+1,@DATA@(BQII)=$C(31)
 Q