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

BQITDRUN.m

Go to the documentation of this file.
BQITDRUN ;PRXM/HC/ALA-Diag Tag Run RPC ; 04 Sep 2007  5:15 PM
 ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
 ;
 Q
 ;
EN(DATA,BQIDFN) ; EP - BQI GET LAST DX CAT RUN
 ;
 ; Input
 ;  BQIDFN - Patient IEN
 ;  
 ;  Get the beginning and ending times of the Diagnosis Tag run for this patient
 NEW UID,II,LUPDT,X,DA,BUDT,BUEDT,HDR,DTLCHK
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQITDRUN",UID))
 K @DATA
 S BQIDFN=$G(BQIDFN,"")
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQITDRUN D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 ;
 S HDR="D00030LAST_UPDATE_DATETIME"
 ;S HDR="D00030PATIENT_LAST_UPDATE^D00030LAST_UPDATE_START_DATETIME^D00030LAST_UPDATE_END_DATETIME^"
 S @DATA@(II)=HDR_$C(30)
 ;
 S DA=$O(^BQI(90508,0)) I 'DA G DONE
 ;
 S BUEDT=$$GET1^DIQ(90508,DA_",",4.02,"I")
 ;
 I BQIDFN="" S DTLCHK=BUEDT
 I BQIDFN'="" D
 . I $G(^BQIPAT(BQIDFN,0))="" S DTLCHK="" Q
 . S DTLCHK=$S($P(^BQIPAT(BQIDFN,0),U,6)\1>(BUEDT\1):$P(^BQIPAT(BQIDFN,0),U,6),1:BUEDT)
 ;
FIN S II=II+1,@DATA@(II)=$$FMTE^BQIUL1(DTLCHK)_$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
 ;
GLOS(DATA,FAKE) ;EP - BQI GET DX CAT GLOSSARY
 ;
 NEW UID,II,DXCN,DXN,DXCAT,DC
 ;
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP("BQIDXHLP",UID))
 K @DATA
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQITDRUN D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S @DATA@(II)="T00010DIAG_IEN^T00040DIAG_CAT^T00015DX_CAT^T01024DESC_TEXT"_$C(30)
 ;
 S DXCN=""
 F  S DXCN=$O(^BQI(90506.2,"B",DXCN)) Q:DXCN=""  D
 . S DXN=""
 . F  S DXN=$O(^BQI(90506.2,"B",DXCN,DXN)) Q:DXN=""  D
 .. I $P(^BQI(90506.2,DXN,0),"^",3)=1 Q
 .. I $P(^BQI(90506.2,DXN,0),"^",5)=1 Q
 .. S DXCAT=$$GET1^DIQ(90506.2,DXN_",",.07,"E")
 .. S DC=0
 .. S II=II+1
 .. S @DATA@(II)=DXN_"^"_DXCN_"^"_DXCAT_"^"
 .. F  S DC=$O(^BQI(90506.2,DXN,2,DC)) Q:'DC  D
 ... S II=II+1,@DATA@(II)=^BQI(90506.2,DXN,2,DC,0)_$C(10)
 .. S II=II+1,@DATA@(II)=$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 Q