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

BQIUTB6.m

Go to the documentation of this file.
BQIUTB6 ;GDIT/HCSD/ALA-Table Utility ; 13 Jul 2015  8:00 AM
 ;;2.6;ICARE MANAGEMENT SYSTEM;;Jul 07, 2017;Build 72
 ;
 ;
TIME(DATA,PARM) ;EP - BQI GET TIMEFRAMES
 NEW UID,II,X
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP(UID,"BQITABLE"))
 K @DATA
 I $G(DT)=""!($G(U)="") D DT^DICRW
 S PARM=$G(PARM,"") I PARM="" Q
 ;
 S II=0
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIUTB D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 NEW LN,BZ,ORD,VAL
 K BZ
 S II=0,LN=""
 S @DATA@(II)="T00010CODE^T00060DESC"_$C(30)
 S ORD=""
 F  S ORD=$O(^BQI(90506.9,"D",PARM,ORD)) Q:ORD=""  D
 . S LN=$O(^BQI(90506.9,"D",PARM,ORD,""))
 . I LN'="" S VAL=$P(^BQI(90506.9,LN,0),U,3)
 . I $E(PARM,1,3)="IPM"!($E(PARM,1,3)="IPW") S VAL=""
 . S II=II+1,@DATA@(II)=VAL_"^"_$P(^BQI(90506.9,LN,0),U,1)_$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
MEAS(DATA) ;EP - Measurements
 NEW RN,COD,TYPE,VALUE
 S II=0,RN=0
 S @DATA@(II)="I00010IEN^T00030^T00010TYPE^T00030VALUE^T00003PARENT_IEN"_$C(30)
 F  S RN=$O(^BQI(90507.2,RN)) Q:'RN  D
 . S MN=$P(^BQI(90507.2,RN,0),"^",3)
 . I $G(^AUTTMSR(MN,0))="" Q
 . I $P(^AUTTMSR(MN,0),U,4)=1 Q
 . ;I $P(^BQI(90507.2,RN,0),"^",1)="BLOOD PRESSURE"!($P(^BQI(90507.2,RN,0),"^",1)="ANKLE BLOOD PRESSURE") Q
 . ;I $P(^BQI(90507.2,RN,0),"^",5)'="" Q
 . S TYPE=$$GET1^DIQ(90507.2,RN_",",.04,"E"),VALUE=""
 . S COD=$P(^BQI(90507.2,RN,0),"^",2),DESC=$P(^(0),"^",1)
 . I TYPE["SET" S VALUE=$G(^BQI(90507.2,RN,2))
 . S II=II+1,@DATA@(II)=RN_U_DESC_" ("_$E(TYPE,1,1)_")"_U_TYPE_U_VALUE_U_$P(^BQI(90507.2,RN,0),"^",5)_$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
MEASD(DATA,MIEN) ;EP - BQI GET MEASUREMENT DETAIL
 NEW UID,II,X,RN,MAX,MIN,HDR,COD,TYPE,VALUE,NDEC,TOOL
 S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
 S DATA=$NA(^TMP(UID,"BQIMEASD"))
 K @DATA
 I $G(DT)=""!($G(U)="") D DT^DICRW
 NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIUTB D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
 S II=0
 S HDR="T00010IEN^T00030DESC^T00010TYPE^T00030VALUE^I00010NBOX^I00010B1MIN^I00010B1MAX^"
 S HDR=HDR_"I00010B2MIN^I00010B2MAX^I00010NDEC^T00070TOOLTIP"
 S @DATA@(II)=HDR_$C(30)
 S MIEN=$G(MIEN,"")
 I MIEN="" D
 . S RN=0
 . F  S RN=$O(^BQI(90507.2,RN)) Q:'RN  D
 .. S MN=$P(^BQI(90507.2,RN,0),"^",3),COD=$P(^(0),U,2)
 .. I $G(^AUTTMSR(MN,0))="" Q
 .. I $P(^AUTTMSR(MN,0),U,4)=1 Q
 .. ;I $P(^BQI(90507.2,RN,0),"^",1)["BLOOD PRESSURE" Q
 .. I $P(^BQI(90507.2,RN,0),"^",5)'="" Q
 .. S TOOL=$P($G(^BQI(90507.2,RN,3)),"^",1)
 .. D MD(RN)
 .. S II=II+1,@DATA@(II)=RN_U_COD_U_TYPE_U_VALUE_U_NBOX_U_BOX1MIN_U_BOX1MAX_U_BOX2MIN_U_BOX2MAX_U_NDEC_U_TOOL_$C(30)
 .. I $D(SUB) S N="" F  S N=$O(SUB(N)) Q:N=""  S II=II+1,@DATA@(II)=SUB(N)
 .. K SUB
 ;
 I MIEN'="" D
 . S COD=$P(^BQI(90507.2,MIEN,0),"^",2)
 . D MD(MIEN)
 . S TOOL=$P($G(^BQI(90507.2,MIEN,3)),"^",1)
 . S II=II+1,@DATA@(II)=MIEN_U_COD_U_TYPE_U_VALUE_U_NBOX_U_BOX1MIN_U_BOX1MAX_U_BOX2MIN_U_BOX2MAX_U_NDEC_U_TOOL_$C(30)
 . I $D(SUB) S N="" F  S N=$O(SUB(N)) Q:N=""  S II=II+1,@DATA@(II)=SUB(N)
 . K SUB
 ;
 S II=II+1,@DATA@(II)=$C(31)
 K TYPE,VALUE,NBOX,BOX1MIN,BOX1MAX,BOX2MIN,BOX2MAX,NDEC
 Q
 ;
MD(RN) ;EP
 NEW MDATA,MN,CT
 S (TYPE,VALUE,NBOX,BOX1MIN,BOX2MIN,BOX1MAX,BOX2MAX,NDEC)=""
 S TYPE=$$GET1^DIQ(90507.2,RN_",",.04,"E")
 I TYPE["SET" S VALUE=$G(^BQI(90507.2,RN,2))
 S MDATA=$G(^BQI(90507.2,RN,1))
 S TOOL=$P($G(^BQI(90507.2,RN,3)),"^",1)
 S NBOX=$P(MDATA,"^",1),NDEC=$P(MDATA,"^",18)
 I NBOX=1 S BOX1MIN=$P(MDATA,"^",2),BOX1MAX=$P(MDATA,"^",3)
 I NBOX=2 S BOX1MIN=$P(MDATA,"^",2),BOX1MAX=$P(MDATA,"^",3),BOX2MIN=$P(MDATA,"^",4),BOX2MAX=$P(MDATA,"^",5)
 S MN="",CT=0 F  S MN=$O(^BQI(90507.2,"AD",RN,MN)) Q:MN=""  D
 . S CT=CT+1,SUB(CT)=MN_U_$P(^BQI(90507.2,MN,0),"^",2)_U_$$GET1^DIQ(90507.2,MN_",",.04,"E")_U_$G(^BQI(90507.2,MN,2))_"^^^^^^"_U_TOOL_$C(30)
 Q
 ;
MON(DATA) ;EP - Month
 NEW BI,TEXT
 K @DATA
 S II=0
 S @DATA@(II)="T00010CODE^T00030"_$C(30)
 F BI=1:1 S TEXT=$T(MLS+BI) Q:TEXT=" Q"  D
 . S TEXT=$P(TEXT,";;",2) I TEXT="" Q
 . S II=II+1,@DATA@(II)=$P(TEXT,U,1)_U_$P(TEXT,U,2)_$C(30)
 S II=II+1,@DATA@(II)=$C(31)
 Q
 ;
MLS ;
 ;;01^January^Jan
 ;;02^February^Feb
 ;;03^March^Mar
 ;;04^April^Apr
 ;;05^May^May
 ;;06^June^Jun
 ;;07^July^Jul
 ;;08^August^Aug
 ;;09^September^Sep
 ;;10^October^Oct
 ;;11^November^Nov
 ;;12^December^Dec
 Q