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
BQIPLDF ;PRXM/HC/DLS - Get Panel Definition ; 23 Nov 2005 11:13 AM
+1 ;;2.3;ICARE MANAGEMENT SYSTEM;;Apr 18, 2012;Build 59
+2 ;
+3 QUIT
+4 ;
EN(DATA,OWNER,PLIEN) ; EP -- BQI GET PANEL DEF
+1 ;
+2 ;Description
+3 ; Given a Panel Owner IEN and a Panel IEN, generates the panel definition.
+4 ;
+5 ;Input
+6 ; OWNER - Panel Owner IEN
+7 ; PLIEN - IEN of the panel within the Owner's file.
+8 ;
+9 ;Output
+10 ; DATA - Name of global in which data is stored(^TMP("BQIPLDF"))
+11 ;
+12 NEW UID,X,BQII,DA,IENS,PCAT
+13 NEW THDR,PLID,OWNRNM,PLNAME,PLDESC,PLDTCR,PLSTYP,DFUPBY,ASSOC,STATUS,IPCPL
+14 NEW PDTDFUP,AUPPFL,PDTPOPD,PTLSUP,DTLSUP,TOTPAT,SRCNAM,GDESC,FSRCNAM,POPBY
+15 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+16 SET DATA=$NAME(^TMP("BQIPLDF",UID))
+17 KILL @DATA
+18 ;
+19 SET BQII=0
+20 ;
+21 ; SAC 2006 2.2.3.3.2
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^BQIPLDF D UNWIND^%ZTER"
+22 ;
+23 DO HDR
+24 ;
+25 ; Get PLID and Owner Name
+26 SET DA=OWNER
SET IENS=$$IENS^DILF(.DA)
+27 ;PLID(Owner IEN + Panel IEN)
SET PLID=$$PLID^BQIUG1(OWNER,PLIEN)
+28 ;Owner Name
SET OWNRNM=$$GET1^DIQ(90505,IENS,.01,"E")
+29 ;
+30 ; Get Panel Information
+31 SET DA(1)=OWNER
SET DA=PLIEN
SET IENS=$$IENS^DILF(.DA)
+32 ;Panel Name
SET PLNAME=$$GET1^DIQ(90505.01,IENS,.01,"E")
+33 ;Panel Descripton
SET PLDESC=$$GET1^DIQ(90505.01,IENS,1,"E")
+34 ;Date Panel Created
SET PLDTCR=$$GET1^DIQ(90505.01,IENS,.02,"I")
+35 IF PLDTCR
SET PLDTCR=$$FMTE^BQIUL1(PLDTCR)
+36 ;Panel Source Type
SET PLSTYP=$$GET1^DIQ(90505.01,IENS,.03,"I")
+37 ;Panel Def Last Updated By
SET DFUPBY=$$GET1^DIQ(90505.01,IENS,.04,"E")
+38 ;Date Panel Def Last Updated
SET PDTDFUP=$$GET1^DIQ(90505.01,IENS,.05,"I")
+39 IF PDTDFUP
SET PDTDFUP=$$FMTE^BQIUL1(PDTDFUP)
+40 ;Autopopulate Flag
SET AUPPFL=$$GET1^DIQ(90505.01,IENS,.06,"I")
+41 ;Date Panel Last Populated
SET PDTPOPD=$$GET1^DIQ(90505.01,IENS,.07,"I")
+42 ;Populated by
SET POPBY=$$GET1^DIQ(90505.01,IENS,3.5,"E")
+43 IF PDTPOPD
SET PDTPOPD=$$FMTE^BQIUL1(PDTPOPD)
+44 ;Patient List Updated By
SET PTLSUP=$$GET1^DIQ(90505.01,IENS,.08,"E")
+45 ;Date Patient List Last Updated
SET DTLSUP=$$GET1^DIQ(90505.01,IENS,.09,"I")
+46 IF DTLSUP
SET DTLSUP=$$FMTE^BQIUL1(DTLSUP)
+47 ;Total Patients
SET TOTPAT=$$GET1^DIQ(90505.01,IENS,.1,"E")
+48 ;Source Name
SET SRCNAM=$$GET1^DIQ(90505.01,IENS,.11,"E")
+49 ;Filter Source Name
SET FSRCNAM=$$GET1^DIQ(90505.01,IENS,.14,"E")
+50 ;Status
SET STATUS=$$GET1^DIQ(90505.01,IENS,.13,"I")
+51 ;Associated Panel IEN
SET ASSOC=$$GET1^DIQ(90505.01,IENS,.15,"E")
+52 ;IPC Panel Flag
SET IPCPL=$$GET1^DIQ(90505.01,IENS,2.1,"I")
+53 IF IPCPL=1
SET IPCPL="Y"
+54 ;Panel Category
SET PCAT=$$PCAT(OWNER,PLIEN)
+55 ; Generated description
+56 SET GDESC=""
Begin DoDot:1
+57 NEW TEXT,TN
+58 DO GETS^DIQ(90505.01,IENS,5,"","TEXT")
+59 SET TN=0
FOR
SET TN=$ORDER(TEXT(90505.01,IENS,5,TN))
IF 'TN
QUIT
IF TEXT(90505.01,IENS,5,TN)'=""
Begin DoDot:2
+60 IF TEXT(90505.01,IENS,5,TN)'["Panel Category:"
SET GDESC=GDESC_TEXT(90505.01,IENS,5,TN)_$CHAR(10)
QUIT
+61 NEW CDESC
+62 DO CATIPC^BQIPDSCM(OWNER,PLIEN,.CDESC)
+63 IF $DATA(CDESC(1,0))
SET GDESC=GDESC_CDESC(1,0)_$CHAR(10)
End DoDot:2
End DoDot:1
+64 ;
+65 SET BQII=BQII+1
+66 SET @DATA@(BQII)=OWNER_"^"_OWNRNM_"^"_PLIEN_"^"_PLID_"^"_PLNAME_"^"_PLDESC_"^"_PLDTCR_"^"
+67 SET @DATA@(BQII)=@DATA@(BQII)_PLSTYP_"^"_DFUPBY_"^"_PDTDFUP_"^"_AUPPFL_"^"_PDTPOPD_"^"_POPBY_"^"_PTLSUP_"^"_DTLSUP_"^"
+68 SET @DATA@(BQII)=@DATA@(BQII)_TOTPAT_"^"_SRCNAM_"^"_GDESC_"^"_FSRCNAM_"^"_STATUS_"^"_ASSOC_"^"_IPCPL_"^"_PCAT_$CHAR(30)
+69 ;
DONE ; -- exit
+1 SET BQII=BQII+1
SET @DATA@(BQII)=$CHAR(31)
+2 QUIT
+3 ;
HDR ; -- header
+1 SET THDR="I00010OWNER^T00050OWNER_NAME^I00010PANEL_IEN^T00020PANEL_ID^T00120PANEL_NAME^T00250PANEL_DESCRIPTION^D00015DT_CREATED^"
+2 SET THDR=THDR_"T00010SOURCE_TYPE^T00050DEF_LAST_UPDATED_BY^D00015DT_DEF_LAST_UPDATED^T00001AUTOPOPULATE_FLAG^D00015DT_LAST_POPULATED^"
+3 SET THDR=THDR_"T00035POPULATED_BY^T00050PATIENT_LIST_UPDATED_BY^D00015DT_PATIENT_LIST_UPDATED^I00010TOTAL_PATIENTS^T00030SOURCE_NAME^"
+4 SET THDR=THDR_"T00250GENERATED_DESCRIPTION^T00030FILTER_SOURCE_NAME^T00001STATUS^I00010ASSOCIATED_PANEL_IEN^T00001IPC_PANEL^"
+5 SET THDR=THDR_"T00030PANEL_CATEGORY"_$CHAR(30)
+6 SET @DATA@(BQII)=THDR
+7 QUIT
+8 ;
PCAT(OWNR,PLIEN) ;EP - Retrieve panel category
+1 ;
+2 ;If panel owner equals DUZ
+3 NEW DA,IENS
+4 SET DA(1)=OWNR
SET DA=PLIEN
SET IENS=$$IENS^DILF(.DA)
+5 IF DUZ=OWNR
QUIT $$GET1^DIQ(90505.01,IENS,2.2,"E")
+6 KILL DA,IENS
+7 ;
+8 ;Otherwise pull from share node
+9 NEW DA,IENS
+10 SET DA(2)=OWNR
SET DA(1)=PLIEN
SET DA=DUZ
SET IENS=$$IENS^DILF(.DA)
+11 QUIT $$GET1^DIQ(90505.03,IENS,.06,"E")
+12 ;
ERR ; -- error trapping
+1 DO ^%ZTER
+2 NEW Y,ERRDTM
+3 SET Y=$$NOW^XLFDT()
XECUTE ^DD("DD")
SET ERRDTM=Y
+4 SET BMXSEC="Recording that an error occurred at "_ERRDTM
+5 IF $DATA(BQII)
IF $DATA(DATA)
SET BQII=BQII+1
SET @DATA@(BQII)=$CHAR(31)
+6 QUIT