BQIPDSC2 ;GDHD/HCS/ALA-Panel descriptions continued ; 04 Nov 2016 8:53 AM
;;2.6;ICARE MANAGEMENT SYSTEM;;Jul 07, 2017;Build 72
;;
;
POV ;EP - POVs
S PORD=$$PORD^BQIDCDF(FSOURCE,"POV")
I PORD="" S PORD=$$PORD^BQIDCDF(FSOURCE,"POVS")
;S PORD=$$PORD^BQIDCDF(FSOURCE,"PVNOT") Q:PORD=""
;
I FNAME="POV" D
. S VALUE=$G(FPARMS("VAL","POV"))
. Q:VALUE=""
. S DSC=$S($G(FPARMS(PORD,"PVNOT"))="Y":"without",1:"with")_" POV ICD "_VALUE
I FNAME="POVTX" D
. S VALUE=$G(FPARMS("VAL","POVTX"))
. S DSC=$S($G(FPARMS(PORD,"PVNOT"))="Y":"without",1:"with")_" POV ICDs found in taxonomy "_VALUE
I FNAME="POVS" D
. S VALUE=$G(FPARMS("VAL","POVS"))
. Q:VALUE=""
. NEW TXT,BSIEN
. S BSIEN=$O(^BSTS(9002318.4,"C",36,VALUE,""))
. S TXT=$S(BSIEN'="":$G(^BSTS(9002318.4,BSIEN,1)),1:"")
. S DSC=$S($G(FPARMS(PORD,"PVNOT"))="Y":"without",1:"with")_" POV SNOMED Concept ID "_VALUE_" "_TXT
I FNAME="POVSB" D
. S VALUE=$G(FPARMS("VAL","POVSB"))
. S DSC=$S($G(FPARMS(PORD,"PVNOT"))="Y":"without",1:"with")_" POV SNOMED Concept IDs found in subset "_VALUE
S PORD=$$PORD^BQIDCDF(FSOURCE,"POV")
I PORD="" S PORD=$$PORD^BQIDCDF(FSOURCE,"POVS")
Q
;
PDAT ;EP - POV Dates
S PORD=$$PORD^BQIDCDF(FSOURCE,"POV")
I PORD="" S PORD=$$PORD^BQIDCDF(FSOURCE,"POVS")
I PORD="" Q
I FNAME="PVFROM" D
. NEW PVFROM,PVTHRU
. S PVFROM=$$GETVAL(OWNR,PLIEN,"PVFROM")
. I PVFROM]"" S VALUE="(Range from date "_$$FMTE^BQIUL1(PVFROM)
. S PVTHRU=$$GETVAL(OWNR,PLIEN,"PVTHRU")
. I PVTHRU]"" S VALUE=VALUE_$S(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(PVTHRU)
. I VALUE["(" S VALUE=VALUE_")"
. S DSC="for "_VALUE
I FNAME="PVRANGE" D
. NEW PVRANGE,RFROM,RTHRU
. S PVRANGE=$$GETVAL(OWNR,PLIEN,"PVRANGE")
. I $G(PPIEN)'="" D RANGE^BQIDCAH1(PVRANGE,PPIEN,"PVRANGE")
. I PVRANGE'["Ever" S VALUE=PVRANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
. I PVRANGE["Ever" S VALUE=PVRANGE
. S DSC="for timeframe "_VALUE
Q
;
GETVAL(OWNR,PLIEN,FLD) ;EP - Retrieve Single field value
N DECIEN,DA,IEN,IENS
S IEN=$O(^BQICARE(OWNR,1,PLIEN,15,"B",FLD,"")) Q:IEN="" ""
S DA(2)=OWNR,DA(1)=PLIEN,DA=IEN,IENS=$$IENS^DILF(.DA)
Q $$GET1^DIQ(90505.115,IENS,.02,"I")
;
MEAS ; EP - Measurements
S PORD=$$PORD^BQIDCDF(FSOURCE,"MSNOT") Q:PORD=""
;
I FNAME="MEAS" D
. S VALUE=$G(FPARMS("VAL","MEAS"))
. Q:VALUE=""
. S DSC=$S($G(FPARMS(PORD,"MSNOT"))="Y":"without",1:"with")_" Measurement "_VALUE
S PORD=$$PORD^BQIDCDF(FSOURCE,"MEAS")
Q
;
MDAT ;EP - Measurement Dates
S PORD=$$PORD^BQIDCDF(FSOURCE,"MEAS") Q:PORD=""
I FNAME="MSFROM" D
. NEW MSFROM,MSTHRU
. S MSFROM=$$GETVAL(OWNR,PLIEN,"MSFROM")
. I MSFROM]"" S VALUE=VALUE_" (Range from date "_$$FMTE^BQIUL1(MSFROM)
. S MSTHRU=$$GETVAL(OWNR,PLIEN,"MSTHRU")
. I MSTHRU]"" S VALUE=VALUE_$S(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(MSTHRU)
. I VALUE["(" S VALUE=VALUE_")"
. S DSC="for "_VALUE
I FNAME="MSRANGE" D
. NEW MSRANGE,RFROM,RTHRU
. S MSRANGE=$$GETVAL(OWNR,PLIEN,"MSRANGE")
. I $G(PPIEN)'="" D RANGE^BQIDCAH1(MSRANGE,PPIEN,"MSRANGE")
. I MSRANGE'["Ever" S VALUE=MSRANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
. I MSRANGE["Ever" S VALUE=MSRANGE
. S DSC="for timeframe "_VALUE
Q
;
MSRS(MSVAL) ;EP - Measurement result
NEW STR,N1,FND,N2,V,STR
S STR=""
S MSVAL=$P(MSVAL,"NUMMEAS",2)
S MSVAL1=MSVAL,MSVAL2=""
I MSVAL["~" S MSVAL1=$P(MSVAL,"~",1)
S (N1,FND)="" F I=1:1:$L(MSVAL1) Q:FND=1 D
. I $E(MSVAL1,I)?1N S N1=N1_$E(MSVAL1,I,$L(MSVAL1)),FND=1
. ;I $E(MSVAL,I)?1N,$E(MSVAL,I-1)'="." S N1=N1_$E(MSVAL,I),FND=1
. ;I $E(MSVAL,I)?1N,$E(MSVAL,I-1)="." S N1=N1_$E(MSVAL,I-1,I),FND=1
Q:N1=""
I MSVAL["~" S MSVAL2=$P(MSVAL,"~",2)
S (N2,FND)="" F I=1:1:$L(MSVAL2) Q:FND=1 D
. I $E(MSVAL2,I)?1N S N2=N2_$E(MSVAL2,I,$L(MSVAL2)),FND=1
. ;I $E(MSVAL,I)?1N,$E(MSVAL,I-1)'="." S N2=N2_$E(MSVAL,I),FND=1 Q
. ;I $E(MSVAL,I)?1N,$E(MSVAL,I-1)="." S N2=N2_$E(MSVAL,I-1,I),FND=1
S V=MSVAL
I V["~",V["'" S STR=STR_" in range (inclusive) "_N1_" thru "_N2
E I V["~" S STR=STR_" out of range (exclusive) less than "_N1_" or greater than "_N2
E I V["'<" S STR=STR_" greater than or equal to "_N1
E I V["'>" S STR=STR_" less than or equal to "_N1
E I V["<" S STR=STR_" less than "_N1
E I V[">" S STR=STR_" greater than "_N1
E S STR=STR_" equal to "_N1
S MSVAL=STR
Q MSVAL
BQIPDSC2 ;GDHD/HCS/ALA-Panel descriptions continued ; 04 Nov 2016 8:53 AM
+1 ;;2.6;ICARE MANAGEMENT SYSTEM;;Jul 07, 2017;Build 72
+2 ;;
+3 ;
POV ;EP - POVs
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"POV")
+2 IF PORD=""
SET PORD=$$PORD^BQIDCDF(FSOURCE,"POVS")
+3 ;S PORD=$$PORD^BQIDCDF(FSOURCE,"PVNOT") Q:PORD=""
+4 ;
+5 IF FNAME="POV"
Begin DoDot:1
+6 SET VALUE=$GET(FPARMS("VAL","POV"))
+7 IF VALUE=""
QUIT
+8 SET DSC=$SELECT($GET(FPARMS(PORD,"PVNOT"))="Y":"without",1:"with")_" POV ICD "_VALUE
End DoDot:1
+9 IF FNAME="POVTX"
Begin DoDot:1
+10 SET VALUE=$GET(FPARMS("VAL","POVTX"))
+11 SET DSC=$SELECT($GET(FPARMS(PORD,"PVNOT"))="Y":"without",1:"with")_" POV ICDs found in taxonomy "_VALUE
End DoDot:1
+12 IF FNAME="POVS"
Begin DoDot:1
+13 SET VALUE=$GET(FPARMS("VAL","POVS"))
+14 IF VALUE=""
QUIT
+15 NEW TXT,BSIEN
+16 SET BSIEN=$ORDER(^BSTS(9002318.4,"C",36,VALUE,""))
+17 SET TXT=$SELECT(BSIEN'="":$GET(^BSTS(9002318.4,BSIEN,1)),1:"")
+18 SET DSC=$SELECT($GET(FPARMS(PORD,"PVNOT"))="Y":"without",1:"with")_" POV SNOMED Concept ID "_VALUE_" "_TXT
End DoDot:1
+19 IF FNAME="POVSB"
Begin DoDot:1
+20 SET VALUE=$GET(FPARMS("VAL","POVSB"))
+21 SET DSC=$SELECT($GET(FPARMS(PORD,"PVNOT"))="Y":"without",1:"with")_" POV SNOMED Concept IDs found in subset "_VALUE
End DoDot:1
+22 SET PORD=$$PORD^BQIDCDF(FSOURCE,"POV")
+23 IF PORD=""
SET PORD=$$PORD^BQIDCDF(FSOURCE,"POVS")
+24 QUIT
+25 ;
PDAT ;EP - POV Dates
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"POV")
+2 IF PORD=""
SET PORD=$$PORD^BQIDCDF(FSOURCE,"POVS")
+3 IF PORD=""
QUIT
+4 IF FNAME="PVFROM"
Begin DoDot:1
+5 NEW PVFROM,PVTHRU
+6 SET PVFROM=$$GETVAL(OWNR,PLIEN,"PVFROM")
+7 IF PVFROM]""
SET VALUE="(Range from date "_$$FMTE^BQIUL1(PVFROM)
+8 SET PVTHRU=$$GETVAL(OWNR,PLIEN,"PVTHRU")
+9 IF PVTHRU]""
SET VALUE=VALUE_$SELECT(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(PVTHRU)
+10 IF VALUE["("
SET VALUE=VALUE_")"
+11 SET DSC="for "_VALUE
End DoDot:1
+12 IF FNAME="PVRANGE"
Begin DoDot:1
+13 NEW PVRANGE,RFROM,RTHRU
+14 SET PVRANGE=$$GETVAL(OWNR,PLIEN,"PVRANGE")
+15 IF $GET(PPIEN)'=""
DO RANGE^BQIDCAH1(PVRANGE,PPIEN,"PVRANGE")
+16 IF PVRANGE'["Ever"
SET VALUE=PVRANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
+17 IF PVRANGE["Ever"
SET VALUE=PVRANGE
+18 SET DSC="for timeframe "_VALUE
End DoDot:1
+19 QUIT
+20 ;
GETVAL(OWNR,PLIEN,FLD) ;EP - Retrieve Single field value
+1 NEW DECIEN,DA,IEN,IENS
+2 SET IEN=$ORDER(^BQICARE(OWNR,1,PLIEN,15,"B",FLD,""))
IF IEN=""
QUIT ""
+3 SET DA(2)=OWNR
SET DA(1)=PLIEN
SET DA=IEN
SET IENS=$$IENS^DILF(.DA)
+4 QUIT $$GET1^DIQ(90505.115,IENS,.02,"I")
+5 ;
MEAS ; EP - Measurements
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"MSNOT")
IF PORD=""
QUIT
+2 ;
+3 IF FNAME="MEAS"
Begin DoDot:1
+4 SET VALUE=$GET(FPARMS("VAL","MEAS"))
+5 IF VALUE=""
QUIT
+6 SET DSC=$SELECT($GET(FPARMS(PORD,"MSNOT"))="Y":"without",1:"with")_" Measurement "_VALUE
End DoDot:1
+7 SET PORD=$$PORD^BQIDCDF(FSOURCE,"MEAS")
+8 QUIT
+9 ;
MDAT ;EP - Measurement Dates
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"MEAS")
IF PORD=""
QUIT
+2 IF FNAME="MSFROM"
Begin DoDot:1
+3 NEW MSFROM,MSTHRU
+4 SET MSFROM=$$GETVAL(OWNR,PLIEN,"MSFROM")
+5 IF MSFROM]""
SET VALUE=VALUE_" (Range from date "_$$FMTE^BQIUL1(MSFROM)
+6 SET MSTHRU=$$GETVAL(OWNR,PLIEN,"MSTHRU")
+7 IF MSTHRU]""
SET VALUE=VALUE_$SELECT(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(MSTHRU)
+8 IF VALUE["("
SET VALUE=VALUE_")"
+9 SET DSC="for "_VALUE
End DoDot:1
+10 IF FNAME="MSRANGE"
Begin DoDot:1
+11 NEW MSRANGE,RFROM,RTHRU
+12 SET MSRANGE=$$GETVAL(OWNR,PLIEN,"MSRANGE")
+13 IF $GET(PPIEN)'=""
DO RANGE^BQIDCAH1(MSRANGE,PPIEN,"MSRANGE")
+14 IF MSRANGE'["Ever"
SET VALUE=MSRANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
+15 IF MSRANGE["Ever"
SET VALUE=MSRANGE
+16 SET DSC="for timeframe "_VALUE
End DoDot:1
+17 QUIT
+18 ;
MSRS(MSVAL) ;EP - Measurement result
+1 NEW STR,N1,FND,N2,V,STR
+2 SET STR=""
+3 SET MSVAL=$PIECE(MSVAL,"NUMMEAS",2)
+4 SET MSVAL1=MSVAL
SET MSVAL2=""
+5 IF MSVAL["~"
SET MSVAL1=$PIECE(MSVAL,"~",1)
+6 SET (N1,FND)=""
FOR I=1:1:$LENGTH(MSVAL1)
IF FND=1
QUIT
Begin DoDot:1
+7 IF $EXTRACT(MSVAL1,I)?1N
SET N1=N1_$EXTRACT(MSVAL1,I,$LENGTH(MSVAL1))
SET FND=1
+8 ;I $E(MSVAL,I)?1N,$E(MSVAL,I-1)'="." S N1=N1_$E(MSVAL,I),FND=1
+9 ;I $E(MSVAL,I)?1N,$E(MSVAL,I-1)="." S N1=N1_$E(MSVAL,I-1,I),FND=1
End DoDot:1
+10 IF N1=""
QUIT
+11 IF MSVAL["~"
SET MSVAL2=$PIECE(MSVAL,"~",2)
+12 SET (N2,FND)=""
FOR I=1:1:$LENGTH(MSVAL2)
IF FND=1
QUIT
Begin DoDot:1
+13 IF $EXTRACT(MSVAL2,I)?1N
SET N2=N2_$EXTRACT(MSVAL2,I,$LENGTH(MSVAL2))
SET FND=1
+14 ;I $E(MSVAL,I)?1N,$E(MSVAL,I-1)'="." S N2=N2_$E(MSVAL,I),FND=1 Q
+15 ;I $E(MSVAL,I)?1N,$E(MSVAL,I-1)="." S N2=N2_$E(MSVAL,I-1,I),FND=1
End DoDot:1
+16 SET V=MSVAL
+17 IF V["~"
IF V["'"
SET STR=STR_" in range (inclusive) "_N1_" thru "_N2
+18 IF '$TEST
IF V["~"
SET STR=STR_" out of range (exclusive) less than "_N1_" or greater than "_N2
+19 IF '$TEST
IF V["'<"
SET STR=STR_" greater than or equal to "_N1
+20 IF '$TEST
IF V["'>"
SET STR=STR_" less than or equal to "_N1
+21 IF '$TEST
IF V["<"
SET STR=STR_" less than "_N1
+22 IF '$TEST
IF V[">"
SET STR=STR_" greater than "_N1
+23 IF '$TEST
SET STR=STR_" equal to "_N1
+24 SET MSVAL=STR
+25 QUIT MSVAL