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

BTPWPDSP.m

Go to the documentation of this file.
  1. BTPWPDSP ;VNGT/HS/BEE - Display CMET Queued Records ; 17 Jul 2008 1:24 PM
  1. ;;1.2;CARE MANAGEMENT EVENT TRACKING;;Jul 07, 2017;Build 71
  1. ;
  1. ;
  1. RET(DATA,CNT,SRC,PARMS) ; EP - BTPW GET QUEUED EVENTS
  1. ; Input parameters
  1. ; CNT - Count of # of records to return
  1. ; SRC - Values to continue search on
  1. ; PARMS - Delimited list of input variables
  1. ; -> STATUS - Status
  1. ; -> TMFRAME - Time frame
  1. ; -> CAT - Category
  1. ; -> COMM - Community
  1. ; -> COMMTX - Community Taxonomy
  1. ;
  1. NEW UID,CII,STATUS,TMFRAME,CAT,COMM,COMMTX,BQ,CIN,BDT,QFL,CATLST,EDT,OSTAT,CMIEN
  1. S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
  1. S DATA=$NA(^TMP("BTPWPDSP",UID))
  1. K @DATA
  1. I $G(DT)=""!($G(U)="") D DT^DICRW
  1. ;
  1. S CII=0
  1. NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BTPWPDSP D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
  1. ;
  1. ;Re-Assemble parameter list if in an array
  1. S PARMS=$G(PARMS,"")
  1. I PARMS="" D
  1. . N LIST,BN
  1. . S LIST="",BN=""
  1. . F S BN=$O(PARMS(BN)) Q:BN="" S LIST=LIST_PARMS(BN)
  1. . K PARMS
  1. . S PARMS=LIST
  1. . K LIST
  1. ;
  1. ;Set up incoming variables
  1. S (CAT,STATUS,TMFRAME,COMM,COMMTX,CMIEN)=""
  1. F BQ=1:1:$L(PARMS,$C(28)) D Q:$G(BMXSEC)'=""
  1. .N PDATA,NAME,VALUE,BP,BV
  1. .S PDATA=$P(PARMS,$C(28),BQ) Q:PDATA=""
  1. .S NAME=$P(PDATA,"=",1) Q:NAME=""
  1. .S VALUE=$P(PDATA,"=",2,99) Q:VALUE=""
  1. .F BP=1:1:$L(VALUE,$C(29)) S BV=$P(VALUE,$C(29),BP),@NAME=@NAME_$S(BP=1:"",1:$C(29))_BV
  1. ;
  1. ;Initialize/save original values
  1. S OSTAT=STATUS
  1. S SRC=$G(SRC,"")
  1. S CNT=+$G(CNT)
  1. ;
  1. ;Handle blank status
  1. S:STATUS="" STATUS="P"_$C(29)_"N"_$C(29)_"S"_$C(29)_"T"
  1. ;
  1. ;Set up search beginning/end dates
  1. S (BDT,EDT)=""
  1. I TMFRAME'="" D
  1. . I $E(TMFRAME,1)=">" S TMFRAME=$E(TMFRAME,2,99),EDT=$$DATE^BQIUL1(TMFRAME) Q
  1. . S BDT=$$DATE^BQIUL1(TMFRAME)
  1. ;
  1. ;Set up Community Taxonomy
  1. I COMMTX'="" D
  1. . N CM,TREF
  1. . S TREF="COMM" K @TREF
  1. . D BLD^BQITUTL(COMMTX,TREF)
  1. . S CM="" F S CM=$O(COMM(CM)) Q:CM="" S COMM=$G(COMM)_$S($G(COMM)]"":$C(29),1:"")_CM K COMM(CM)
  1. ;
  1. ;Set up Category List Array
  1. I CAT'="",CAT'=0 D
  1. . F BQ=1:1:$L(CAT,$C(29)) S CIN=$P(CAT,$C(29),BQ),CATLST(CIN)=""
  1. ;
  1. ;Set up Community List Array
  1. S:'$D(COMM) COMM=""
  1. I COMM'="",COMM'=0 D
  1. . F BQ=1:1:$L(COMM,$C(29)) S CIN=+$P(COMM,$C(29),BQ),COMM(CIN)=$P(^AUTTCOM(CIN,0),U,1)
  1. ;
  1. S @DATA@(CII)="I00010HIDE_DFN^T00001SENS_FLAG^T00035PATIENT_NAME^T00030HRN^D00015DOB^T00001SEX^"
  1. S @DATA@(CII)=@DATA@(CII)_"T00040CATEGORY^I00010HIDE_CMET_IEN^T00010STATUS^I00010HIDE_EVENTTYPE_IEN^T00060EVENT^D00015EVNT_DATE^I00010HIDE_VISIT_IEN^T01024EXP_EVENT^"
  1. S @DATA@(CII)=@DATA@(CII)_"T00001COMM_FLAG^D00030RESULT^T01024HIDE_RESULT^T00050COMMUNITY^T00035DPCP^T00120DCAT^T00070FINDING^T01024FIND_COMM^"
  1. S @DATA@(CII)=@DATA@(CII)_"T00010AGE^D00030LAST_MODIFIED_DT^T00030LAST_MODIFIED_BY^T01024STATUS_COMMENT^T01024HIDE_SEARCH^T01024EXP_RESULT"_$C(30)
  1. ;
  1. S QFL=0
  1. ;
  1. ;Search 0 - List of CMIENs
  1. I $G(CMIEN)'="" D CMIEN(CMIEN,.COMM,SRC) G DONE
  1. ;
  1. ;Search 2 - CATEGORY, STATUS, VISIT DATE
  1. I CAT'="",TMFRAME'="" D CSVD(CAT,STATUS,.COMM,BDT,EDT,SRC) G DONE
  1. ;
  1. ;Search 3 - STATUS, VISIT DATE
  1. I OSTAT'="",TMFRAME'="" D SV(STATUS,.COMM,BDT,EDT,SRC) G DONE
  1. ;
  1. ;Search 4 - VISIT DATE
  1. I TMFRAME'="" D VD(.COMM,BDT,EDT,SRC) G DONE
  1. ;
  1. ;Search 5 - Default search on STATUS
  1. D ST(.COMM,.CATLST,STATUS,SRC)
  1. ;
  1. DONE ;
  1. S CII=CII+1,@DATA@(CII)=$C(31)
  1. Q
  1. ;
  1. CAT(PIEN,TYP) ; EP - Get Procedure Category
  1. NEW PCAT
  1. S TYP=$G(TYP,0)
  1. I 'TYP S PCAT=$$GET1^DIQ(90621,PIEN_",",.1,"E")
  1. I TYP S PCAT=$$GET1^DIQ(90621,PIEN_",",.1,"I")
  1. Q PCAT
  1. ;
  1. REC(SQIEN,COMM) ; EP - Assemble Single Record
  1. NEW TDATA,PROC,PROCNM,ECAT,VISIT,PRCDT,STAT,DFN,PTNAME,DOB,HRN,PCOM,PTAGE,LMDT,LMBY,SCOMM
  1. NEW SIEN,SEX,TIEN,RES,DPCP,DXTG,HRES,FULLR,RCIEN,RCFILE,FULLE,TAB,LIEN,FCOMM,FC
  1. S TDATA=^BTPWQ(SQIEN,0)
  1. S DFN=$P(TDATA,U,2)
  1. ;
  1. ;Community Check
  1. S PCOM=$$GET1^DIQ(9000001,DFN_",",1117,"I")
  1. I COMM'="",PCOM'="",'$D(COMM(PCOM)) Q
  1. I PCOM'="" S PCOM=$$GET1^DIQ(9000001,DFN_",",1117,"E")
  1. ;
  1. S PROC=$P(TDATA,U,1),PROCNM=$P(^BTPW(90621,PROC,0),U,1)
  1. S ECAT=$$CAT(PROC)
  1. S VISIT=$P(TDATA,U,4)
  1. S PRCDT=$$FMTE^BQIUL1($P(TDATA,U,3))
  1. S STAT=$$GET1^DIQ(90629,SQIEN_",",.08,"E")
  1. S HRN=$TR($$HRNL^BQIULPT(DFN),";",$C(10))
  1. S PTNAME=$$GET1^DIQ(2,DFN_",",.01,"E")
  1. S SEX=$$GET1^DIQ(2,DFN_",",.02,"I")
  1. S DOB=$$FMTE^BQIUL1($$GET1^DIQ(2,DFN_",",.03,"I"))
  1. S TIEN=$P(TDATA,U,14),FULLR=""
  1. S FULLE="Event obtained from: "_$C(13)_$C(10) D
  1. . S RCIEN=$P(TDATA,U,5),RCFILE=$P(TDATA,U,6)
  1. . S FULLE=FULLE_$P(^BTPW(90621.1,RCFILE,0),"^",1)_" - "
  1. . NEW FIL,FLD
  1. . S FIL=$P(^BTPW(90621.1,RCFILE,0),"^",2),FLD=$P(^(0),"^",3),TAB=$P(^(0),"^",8)
  1. . S FULLE=FULLE_$$GET1^DIQ(FIL,RCIEN_",",FLD,"E")
  1. . S LIEN=$$GET1^DIQ(FIL,RCIEN_",",FLD,"I")
  1. . I TAB=80!(TAB=80.1)!(TAB=81) D
  1. . I TAB=80 S FULLE=FULLE_" "_$$ICD9^BQIUL3(LIEN,,4)_$C(13)_$C(10) Q
  1. . I TAB=80.1 S FULLE=FULLE_" "_$$ICD0^BQIUL3(LIEN,,5)_$C(13)_$C(10) Q
  1. . I TAB=81 S FULLE=FULLE_" "_$$ICPT^BQIUL3(LIEN,"",3)
  1. ;
  1. ;Result
  1. S RES=$$QLNK^BTPWPTRG(SQIEN,.06),HRES=$P(RES,$C(28),2,3),FULLR=$P(RES,$C(28),4),RES=$P(RES,$C(28))
  1. ;
  1. ;DPCP/Active DX Tags
  1. S DPCP=$P($$DPCP^BQIULPT(DFN),U,2)
  1. S DXTG=$$DCAT^BQIULPT(DFN)
  1. ;
  1. S PTAGE=$$AGE^BQIAGE(DFN,,1)
  1. S LMDT=$$FMTE^BQIUL1($P(TDATA,U,11))
  1. S LMBY=$P(TDATA,U,12)
  1. S FIND=$$GET1^DIQ(90629,SQIEN_",",1.02,"E")
  1. S FCOMM="",FC=0 F S FC=$O(^BTPWQ(SQIEN,4,FC)) Q:FC="" S FCOMM=FCOMM_^BTPWQ(SQIEN,4,FC,0)_$C(10)_$C(13)
  1. S FCOMM=$$TKO^BQIUL1(FCOMM,$C(10)_$C(13))
  1. ;
  1. ;Retrieve Status Comments
  1. S SCOMM=$$SCOMM^BTPWPDS1(SQIEN)
  1. ;
  1. S CII=CII+1,@DATA@(CII)=DFN_U_$$SENS^BQIULPT(DFN)_U_PTNAME_U_HRN_U_DOB_U_SEX_U_ECAT_U_SQIEN_U_STAT_U_PROC_U_PROCNM_U_PRCDT_U_VISIT_U
  1. S @DATA@(CII)=@DATA@(CII)_FULLE_U_$$CALR^BQIULPT(DFN)_U_RES_U_HRES_U_PCOM_U_DPCP_U_DXTG_U_FIND_U_FCOMM_U_PTAGE_U_LMDT_U_LMBY_U
  1. S @DATA@(CII)=@DATA@(CII)_SCOMM_U_SRC_U_FULLR_$C(30)
  1. Q
  1. ;
  1. ST(COMM,CTLST,STATUS,OSRC) ;EP - Search 5 - Default search on STATUS
  1. N IEN,CT,LII,STS,STSP,SRC,SFND,SSTRT
  1. ;
  1. ;Pull the last record info
  1. S SSTRT=1,STS=$P(OSRC,$C(29),2) I STS]"" F SFND=1:1:$L(STATUS,$C(29)) I $P(STATUS,$C(29),SFND)=STS S SSTRT=SFND
  1. S IEN=$P(OSRC,$C(29),1)
  1. ;
  1. S CT=0
  1. ;
  1. ;Loop through index (at selected point) and retrieve records
  1. F STSP=SSTRT:1:$L(STATUS,$C(29)) S STS=$P(STATUS,$C(29),STSP) D Q:QFL
  1. . F S IEN=$O(^BTPWQ("AC",STS,IEN)) Q:IEN="" D Q:QFL
  1. .. S LII=CII,SRC=IEN_$C(29)_STS
  1. .. ;
  1. .. ;Check for CATEGORY - if passed
  1. .. N CTG,CTGCHK S CTGCHK=1
  1. .. I $D(CTLST) D Q:'CTGCHK
  1. ... S CTG=$$GET1^DIQ(90629,IEN_",",.13,"I")
  1. ... I CTG]"",$D(CTLST(CTG)) Q
  1. ... S CTGCHK=0
  1. .. K CTG,CTGCHK
  1. .. ;
  1. .. D REC(IEN,.COMM)
  1. .. I LII=CII Q
  1. .. S CT=CT+1 I CNT,CT=CNT S QFL=1 Q
  1. Q
  1. ;
  1. CMIEN(CMIEN,COMM,OSRC) ; EP - Search 0 - List of IENs
  1. N IEN,CT,LII,ISTRT,IFND,ILST,ITSP,SRC
  1. ;
  1. ;Pull the last record info
  1. S IEN=$G(OSRC)
  1. ;
  1. S CT=0
  1. ;
  1. ;Loop through the CMIEN list (at selected point) and retrieve records
  1. S ISTRT=1 I IEN]"" F IFND=1:1:$L(CMIEN,$C(29)) I $P(CMIEN,$C(29),IFND)=IEN S ISTRT=IFND
  1. F ITSP=ISTRT:1:$L(CMIEN,$C(29)) S IEN=$P(CMIEN,$C(29),ITSP) D Q:QFL
  1. . S LII=CII,SRC=IEN
  1. . D REC(IEN,.COMM)
  1. . I LII=CII Q
  1. . S CT=CT+1 I CNT,CT=CNT S QFL=1 Q
  1. Q
  1. ;
  1. VD(COMM,BDT,EDT,OSRC) ; EP - Search 4 - VISIT DATE
  1. N IEN,SBDT,CT,LII,SRC
  1. ;
  1. ;Pull the last record info
  1. S:$P(OSRC,$C(29),2)'="" SBDT=$P(OSRC,$C(29),2)
  1. S IEN=$P(OSRC,$C(29),1)
  1. ;
  1. S CT=0
  1. ;
  1. ;Loop through index (at selected point) and retrieve records
  1. S SBDT=$S($G(SBDT)]"":SBDT-.001,BDT]"":BDT-.001,1:"")
  1. F S SBDT=$O(^BTPWQ("AH",SBDT)) Q:(SBDT="")!((EDT]"")&(SBDT'<EDT)) D Q:QFL
  1. . F S IEN=$O(^BTPWQ("AH",SBDT,IEN)) Q:IEN="" D Q:QFL
  1. .. S LII=CII,SRC=IEN_$C(29)_SBDT
  1. .. D REC(IEN,.COMM)
  1. .. I LII=CII Q
  1. .. S CT=CT+1 I CNT,CT=CNT S QFL=1 Q
  1. Q
  1. ;
  1. SV(STATUS,COMM,BDT,EDT,OSRC) ; EP - Search 3 - STATUS, VISIT DATE
  1. N IEN,SBDT,CT,LII,STSP,SRC,SFND,STS,SSTRT
  1. ;
  1. ;Pull the last record info
  1. S SSTRT=1,STS=$P(OSRC,$C(29),3) I STS]"" F SFND=1:1:$L(STATUS,$C(29)) I $P(STATUS,$C(29),SFND)=STS S SSTRT=SFND
  1. S:$P(OSRC,$C(29),2)'="" SBDT=$P(OSRC,$C(29),2)
  1. S IEN=$P(OSRC,$C(29),1)
  1. ;
  1. S CT=0
  1. ;
  1. ;Loop through index (at selected point) and retrieve records
  1. S SBDT=$S($G(SBDT)]"":SBDT-.001,BDT]"":BDT-.001,1:"")
  1. F STSP=SSTRT:1:$L(STATUS,$C(29)) S STS=$P(STATUS,$C(29),STSP) D Q:QFL
  1. . F S SBDT=$O(^BTPWQ("AF",STS,SBDT)) Q:(SBDT="")!((EDT]"")&(SBDT'<EDT)) D Q:QFL
  1. .. F S IEN=$O(^BTPWQ("AF",STS,SBDT,IEN)) Q:IEN="" D Q:QFL
  1. ... S LII=CII,SRC=IEN_$C(29)_SBDT_$C(29)_STS
  1. ... D REC(IEN,.COMM)
  1. ... I CII=LII Q
  1. ... S CT=CT+1 I CNT,CT=CNT S QFL=1 Q
  1. . S SBDT=$S(BDT]"":BDT-.001,1:"") ;Reset to original start date
  1. Q
  1. ;
  1. CSVD(CATS,STATUS,COMM,BDT,EDT,OSRC) ; EP - Search 2 - CATEGORY, STATUS, VISIT DATE
  1. N IEN,SBDT,CT,LII,CATP,CAT,CSTRT,CFND,STSP,STS,SRC,SFND,SSTRT,SQIEN
  1. ;
  1. ;Pull the last record info
  1. S CSTRT=1,CAT=$P(OSRC,$C(29),4) I CAT]"" F CFND=1:1:$L(CATS,$C(29)) I $P(CATS,$C(29),CFND)=CAT S CSTRT=CFND
  1. S SSTRT=1,STS=$P(OSRC,$C(29),3) I STS]"" F SFND=1:1:$L(STATUS,$C(29)) I $P(STATUS,$C(29),SFND)=STS S SSTRT=SFND
  1. S:$P(OSRC,$C(29),2)'="" SBDT=$P(OSRC,$C(29),2)
  1. S SQIEN=$P(OSRC,$C(29),1)
  1. ;
  1. S CT=0
  1. ;
  1. ;Loop through index (at selected point) and retrieve records
  1. S SBDT=$S($G(SBDT)]"":SBDT-.001,BDT]"":BDT-.001,1:"")
  1. F CATP=CSTRT:1:$L(CATS,$C(29)) S CAT=$P(CATS,$C(29),CATP) D Q:QFL
  1. . F STSP=SSTRT:1:$L(STATUS,$C(29)) S STS=$P(STATUS,$C(29),STSP) D Q:QFL
  1. ..F S SBDT=$O(^BTPWQ("AG",CAT,STS,SBDT)) Q:(SBDT="")!((EDT]"")&(SBDT'<EDT)) D Q:QFL
  1. ... F S SQIEN=$O(^BTPWQ("AG",CAT,STS,SBDT,SQIEN)) Q:SQIEN="" D Q:QFL
  1. .... S LII=CII,SRC=SQIEN_$C(29)_SBDT_$C(29)_STS_$C(29)_CAT
  1. .... D REC(SQIEN,.COMM)
  1. .... I CII=LII Q
  1. .... S CT=CT+1 I CNT,CT=CNT S QFL=1 Q
  1. .. S SBDT=$S(BDT]"":BDT-.001,1:"") ;Reset to original start date
  1. . S SSTRT=1 ;Reset to 1 for later categories
  1. Q
  1. ;
  1. CMSTVD(STATUS,BDT,EDT,COMM,CTLST,OSRC) ; EP - Search 1 - COMMUNITY, STATUS, VISIT DATE - Now INACTIVE
  1. N CM,IEN,SBDT,CT,LII,COMP,CSTRT,CFND,STSP,STS,SRC,SFND,SSTRT
  1. ;
  1. ;Pull the last record info
  1. S CSTRT=1,CM=$P(OSRC,$C(29),4) I CM]"" F CFND=1:1:$L(COMM,$C(29)) I $P(COMM,$C(29),CFND)=CM S CSTRT=CFND
  1. S SSTRT=1,STS=$P(OSRC,$C(29),3) I STS]"" F SFND=1:1:$L(STATUS,$C(29)) I $P(STATUS,$C(29),SFND)=STS S SSTRT=SFND
  1. S:$P(OSRC,$C(29),2)'="" SBDT=$P(OSRC,$C(29),2)
  1. S IEN=$P(OSRC,$C(29),1)
  1. ;
  1. S CT=0
  1. ;
  1. ;Loop through index (at selected point) and retrieve records
  1. S SBDT=$S($G(SBDT)]"":SBDT-.001,BDT]"":BDT-.001,1:"")
  1. F COMP=CSTRT:1:$L(COMM,$C(29)) S CM=$P(COMM,$C(29),COMP) D Q:QFL
  1. . F STSP=SSTRT:1:$L(STATUS,$C(29)) S STS=$P(STATUS,$C(29),STSP) D Q:QFL
  1. .. F S SBDT=$O(^BTPWQ("AI",CM,STS,SBDT)) Q:(SBDT="")!((EDT]"")&(SBDT'<EDT)) D Q:QFL
  1. ... F S IEN=$O(^BTPWQ("AI",CM,STS,SBDT,IEN)) Q:IEN="" D Q:QFL
  1. .... S LII=CII,SRC=IEN_$C(29)_SBDT_$C(29)_STS_$C(29)_CM
  1. .... ;
  1. .... ;Check for CATEGORY - if passed
  1. .... N CTG,CTGCHK S CTGCHK=1
  1. .... I $D(CTLST) D Q:'CTGCHK
  1. ..... S CTG=$$GET1^DIQ(90629,IEN_",",.13,"I")
  1. ..... I CTG]"",$D(CTLST(CTG)) Q
  1. ..... S CTGCHK=0
  1. .... K CTG,CTGCHK
  1. .... ;
  1. .... D REC(IEN,.COMM)
  1. .... I CII=LII Q
  1. .... S CT=CT+1 I CNT,CT=CNT S QFL=1 Q
  1. .. S SBDT=$S(BDT]"":BDT-.001,1:"") ;Reset to original start date
  1. . S SSTRT=1 ;Reset to 1 for later communities
  1. Q
  1. ;
  1. EVTCOM(TIEN) ;EP - Get Event Comments - called by 90506.1 - BTPWQECM
  1. N SIEN,SCOMM
  1. S SCOMM=""
  1. S SIEN=0
  1. F S SIEN=$O(^BTPWP(TIEN,4,SIEN)) Q:'SIEN D
  1. . S SCOMM=SCOMM_$S(SCOMM]"":" ",1:"")_$G(^BTPWP(TIEN,4,SIEN,0))
  1. Q SCOMM
  1. ;
  1. FNDCMT(TIEN) ;EP - Get Findings Comments - 90506.1 code BTPWTFNC
  1. N COM,CIEN,CLN,FCOM,FDATA,FIEN
  1. S COM=""
  1. ;
  1. D GETS^DIQ(90620,TIEN_",","10*","IE","FDATA")
  1. ;
  1. S FIEN=0 F S FIEN=$O(FDATA(90620.01,FIEN)) Q:FIEN="" D
  1. . ;
  1. . ;Skip ENTERED IN ERROR
  1. . I $G(FDATA(90620.01,FIEN,".08","I"))="Y" Q
  1. . ;
  1. . I COM'="" S COM=COM_$C(13)_$C(10)
  1. . ;
  1. . S CIEN=0 F CLN=1:1 S CIEN=$O(FDATA(90620.01,FIEN,1,CIEN)) Q:'CIEN D
  1. .. S FCOM=$G(FDATA(90620.01,FIEN,1,CIEN))
  1. .. I COM'="" S COM=COM_$C(13)_$C(10)
  1. .. S COM=COM_FCOM
  1. ;
  1. Q COM
  1. ;
  1. FUPCMT(TIEN) ;EP - Get Followup Comments - 90506.1 code BTPWTFUC
  1. N COM,CIEN,CLN,FCOM,FDATA,FIEN
  1. S COM=""
  1. ;
  1. D GETS^DIQ(90620,TIEN_",","12*","IE","FDATA")
  1. ;
  1. S FIEN=0 F S FIEN=$O(FDATA(90620.012,FIEN)) Q:FIEN="" D
  1. . ;
  1. . ;Skip ENTERED IN ERROR
  1. . I $G(FDATA(90620.012,FIEN,".07","I"))="Y" Q
  1. . ;
  1. . I COM'="" S COM=COM_$C(13)_$C(10)
  1. . ;
  1. . S CIEN=0 F CLN=1:1 S CIEN=$O(FDATA(90620.012,FIEN,1,CIEN)) Q:'CIEN D
  1. .. S FCOM=$G(FDATA(90620.012,FIEN,1,CIEN))
  1. .. I COM'="" S COM=COM_$C(13)_$C(10)
  1. .. S COM=COM_FCOM
  1. ;
  1. Q COM
  1. ;
  1. NOTCMT(TIEN) ;EP - Get Notification Comments - 90506.1 code BTPWTNOC
  1. N COM,CIEN,CLN,FCOM,FDATA,FIEN
  1. S COM=""
  1. ;
  1. D GETS^DIQ(90620,TIEN_",","11*","IE","FDATA")
  1. ;
  1. S FIEN=0 F S FIEN=$O(FDATA(90620.011,FIEN)) Q:FIEN="" D
  1. . ;
  1. . ;Skip ENTERED IN ERROR
  1. . I $G(FDATA(90620.011,FIEN,".09","I"))="Y" Q
  1. . ;
  1. . I COM'="" S COM=COM_$C(13)_$C(10)
  1. . ;
  1. . S CIEN=0 F CLN=1:1 S CIEN=$O(FDATA(90620.011,FIEN,1,CIEN)) Q:'CIEN D
  1. .. S FCOM=$G(FDATA(90620.011,FIEN,1,CIEN))
  1. .. I COM'="" S COM=COM_$C(13)_$C(10)
  1. .. S COM=COM_FCOM
  1. ;
  1. Q COM
  1. ;
  1. ;
  1. FLG(TIEN) ;EP - Determine if Panel View Flag Indicator should be set
  1. ;
  1. ;Check for IEN
  1. Q:$G(TIEN)="" ""
  1. ;
  1. ;Ignore Closed Events
  1. I $$GET1^DIQ(90620,TIEN_",",1.01,"I")="C" Q ""
  1. ;
  1. N FLG,FDATA,FND,FNDT,FIEN
  1. D GETS^DIQ(90620,TIEN_",","**","IE","FDATA")
  1. ;
  1. ;Set initial Flag Value to Null
  1. S FLG=""
  1. ;
  1. ;First Check Findings
  1. S FND=0 I $P($$FND^BTPWPCLO(TIEN),U)=1 S FND=1,FLG="C"
  1. I FND=0 S FNDT=FDATA(90620,TIEN_",",1.05,"I") I FNDT]"",FNDT<DT S FLG="T" Q FLG
  1. I FND=0 Q FLG
  1. ;
  1. ;Now Check Follow-ups
  1. S FND=0 I $P($$FOL^BTPWPCLO(TIEN),U)=1 S FND=1,FLG="C"
  1. I FND=0 S FNDT=FDATA(90620,TIEN_",",1.06,"I") I FNDT]"",FNDT<DT S FLG="T" Q FLG
  1. I FND=0 Q FLG
  1. ;
  1. ;Last - Check Notifications
  1. S FND=0 I $P($$NOT^BTPWPCLO(TIEN),U)=1 S FND=1,FLG="C"
  1. I FND=0 S FNDT=FDATA(90620,TIEN_",",1.07,"I") I FNDT]"",FNDT<DT S FLG="T" Q FLG
  1. ;
  1. Q FLG
  1. ;
  1. PAD(X,LEN) ;Truncate or Pad the variable with spaces
  1. N SPACE
  1. S $P(SPACE," ",LEN)=" "
  1. Q $E(X_SPACE,1,LEN)
  1. ;
  1. ERR ;
  1. D ^%ZTER
  1. NEW Y,ERRDTM
  1. S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
  1. S BMXSEC="Recording that an error occurred at "_ERRDTM
  1. S CII=CII+1,@DATA@(CII)=$C(31)
  1. Q