BQIPDSC1 ;GDIT/HS/ALA-Panel descriptions continued ; 10 Apr 2013 4:54 PM
;;2.6;ICARE MANAGEMENT SYSTEM;;Jul 07, 2017;Build 72
;
CPT ;EP - CPTs
S PORD=$$PORD^BQIDCDF(FSOURCE,"CNOT") Q:PORD=""
;
I FNAME="CPT" D
. S VALUE=$G(FPARMS("VAL","CPT"))
. Q:VALUE=""
. S DSC=$S($G(FPARMS(PORD,"CNOT"))="Y":"without",1:"with")_" CPT "_VALUE
I FNAME="CPTTX" D
. S VALUE=$G(FPARMS("VAL","CPTTX"))
. S DSC=$S($G(FPARMS(PORD,"CNOT"))="Y":"without",1:"with")_" CPTs found in taxonomy "_VALUE
S PORD=$$PORD^BQIDCDF(FSOURCE,"CPT")
Q
;
CDAT ;EP - CPT Dates
S PORD=$$PORD^BQIDCDF(FSOURCE,"CPT") Q:PORD=""
I FNAME="CFROM" D
. NEW CFROM,CTHRU
. S CFROM=$$GETVAL(OWNR,PLIEN,"CFROM")
. I CFROM]"" S VALUE="(Range from date "_$$FMTE^BQIUL1(CFROM)
. S CTHRU=$$GETVAL(OWNR,PLIEN,"CTHRU")
. I CTHRU]"" S VALUE=VALUE_$S(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(CTHRU)
. I VALUE["(" S VALUE=VALUE_")"
. S DSC="for "_VALUE
I FNAME="CRANGE" D
. NEW CRANGE,RFROM,RTHRU
. S CRANGE=$$GETVAL(OWNR,PLIEN,"CRANGE")
. I $G(PPIEN)'="" D RANGE^BQIDCAH1(CRANGE,PPIEN,"CRANGE")
. I CRANGE'["Ever" S VALUE=CRANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
. I CRANGE["Ever" S VALUE=CRANGE
. 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")
;
ED ;EP - education
S PORD=$$PORD^BQIDCDF(FSOURCE,"EDUNOT") Q:PORD=""
S DSC="Education "_$S($G(FPARMS(PORD,"EDUNOT"))="Y":"not found for",1:"found for")
I FNAME="EDUPICK" D
. S DSC=DSC_" EHR pick list "_$G(FPARMS("VAL","EDUPICK"))
I FNAME="EDUTOP" D
. S DSC=DSC_" topic "_$G(FPARMS("VAL","EDUTOP"))
I FNAME="EDUTX" D
. S DSC=DSC_" taxonomy "_$G(FPARMS("VAL","EDUTX"))
I FNAME="EDUC" D
. S DSC=DSC_$G(FPARMS("VAL","EDUC"))
S PORD=$$PORD^BQIDCDF(FSOURCE,"EDUC")
Q
;
EDDT ;EP-education
S PORD=$$PORD^BQIDCDF(FSOURCE,"EDUC") Q:PORD=""
I FNAME="EDUFROM" D
. NEW EFROM,ETHRU
. S EFROM=$$GETVAL(OWNR,PLIEN,"EDUFROM")
. I EFROM]"" S VALUE="(Range from date "_$$FMTE^BQIUL1(EFROM)
. S ETHRU=$$GETVAL(OWNR,PLIEN,"EDUTHRU")
. I ETHRU]"" S VALUE=VALUE_$S(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(ETHRU)
. I VALUE["(" S VALUE=VALUE_")"
. S DSC="for "_VALUE
I FNAME="EDURANGE" D
. NEW EDURANGE,RFROM,RTHRU
. S EDURANGE=$$GETVAL(OWNR,PLIEN,"EDURANGE")
. I $G(PPIEN)'="" D RANGE^BQIDCAH1(EDURANGE,PPIEN,"EDURANGE")
. I EDURANGE'["Ever" S VALUE=EDURANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
. I EDURANGE["Ever" S VALUE=EDURANGE
. S DSC="for timeframe "_VALUE
Q
;
LAB ;EP
S PORD=$$PORD^BQIDCDF(FSOURCE,"LNOT") Q:PORD=""
I FNAME="LAB" D
. S VALUE=$G(FPARMS("VAL","LAB"))
. Q:VALUE=""
. S VALUE=$$STRIP^XLFSTR(VALUE,$C(28))
. S DSC=$S($G(FPARMS(PORD,"LNOT"))="Y":"who did NOT have the following lab test(s) ",1:"who had the following lab test(s) ")_VALUE
I FNAME="LABTX" D
. S VALUE=$G(FPARMS("VAL","LABTX"))
. S DSC=$S($G(FPARMS(PORD,"LNOT"))="Y":"who did NOT have the following lab test(s) ",1:"who had the following lab test(s)")_" found in "_VALUE
S PORD=$$PORD^BQIDCDF(FSOURCE,"LAB")
Q
;
LBDT ;EP
S PORD=$$PORD^BQIDCDF(FSOURCE,"LAB") Q:PORD=""
I FNAME="LFROM" D
. NEW LFROM,LTHRU
. S LFROM=$$GETVAL(OWNR,PLIEN,"LFROM")
. I LFROM]"" S VALUE="(Range from date "_$$FMTE^BQIUL1(LFROM)
. S LTHRU=$$GETVAL(OWNR,PLIEN,"LTHRU")
. I LTHRU]"" S VALUE=VALUE_$S(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(LTHRU)
. I VALUE["(" S VALUE=VALUE_")"
. S DSC="for "_VALUE
I FNAME="LRANGE" D
. NEW LRANGE,RFROM,RTHRU
. S LRANGE=$$GETVAL(OWNR,PLIEN,"LRANGE")
. I $G(PPIEN)'="" D RANGE^BQIDCAH1(LRANGE,PPIEN,"LRANGE")
. I LRANGE'["Ever" S VALUE=LRANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
. I LRANGE["Ever" S VALUE=LRANGE
. S DSC="for timeframe "_VALUE
Q
;
LBRS(LBVAL) ;EP - Lab result
NEW STR,N1,FND,N2,V,STR
S STR=""
S LBVAL=$P(LBVAL,"NUMLAB",2)
S LBVAL1=LBVAL,LBVAL2=""
I LBVAL["~" S LBVAL1=$P(LBVAL,"~",1)
S (N1,FND)="" F I=1:1:$L(LBVAL1) Q:FND=1 D
. I $E(LBVAL1,I)?1N S N1=N1_$E(LBVAL1,I,$L(LBVAL1)),FND=1
. ;I $E(LBVAL,I)?1N,$E(LBVAL,I-1)'="." S N1=N1_$E(LBVAL,I),FND=1
. ;I $E(LBVAL,I)?1N,$E(LBVAL,I-1)="." S N1=N1_$E(LBVAL,I-1,I),FND=1
Q:N1=""
I LBVAL["~" S LBVAL2=$P(LBVAL,"~",2)
S (N2,FND)="" F I=1:1:$L(LBVAL2) Q:FND=1 D
. I $E(LBVAL2,I)?1N S N2=N2_$E(LBVAL2,I,$L(LBVAL2)),FND=1
. ;I $E(LBVAL,I)?1N,$E(LBVAL,I-1)'="." S N2=N2_$E(LBVAL,I),FND=1 Q
. ;I $E(LBVAL,I)?1N,$E(LBVAL,I-1)="." S N2=N2_$E(LBVAL,I-1,I),FND=1
S V=LBVAL
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 LBVAL=STR
Q LBVAL
;
MED ;EP
S PORD=$$PORD^BQIDCDF(FSOURCE,"MNOT") Q:PORD=""
I FNAME="MED" D
. S VALUE=$G(FPARMS("VAL","MED"))
. Q:VALUE=""
. S VALUE=$$STRIP^XLFSTR(VALUE,$C(28))
. S DSC=$S($G(FPARMS(PORD,"MNOT"))="Y":"who did NOT have the following medication(s) ",1:"who had the following medication(s) ")_VALUE
I FNAME="MEDTX" D
. S VALUE=$G(FPARMS("VAL","MEDTX"))
. S DSC=$S($G(FPARMS(PORD,"MNOT"))="Y":"who did NOT have the following medication(s) ",1:"who had the following medication(s)")_" found in "_VALUE
S PORD=$$PORD^BQIDCDF(FSOURCE,"MED")
Q
;
MDDT ;EP
S PORD=$$PORD^BQIDCDF(FSOURCE,"MED") Q:PORD=""
I FNAME="MFROM" D
. NEW MFROM,MTHRU
. S MFROM=$$GETVAL(OWNR,PLIEN,"MFROM")
. I MFROM]"" S VALUE="(Range from date "_$$FMTE^BQIUL1(MFROM)
. S MTHRU=$$GETVAL(OWNR,PLIEN,"MTHRU")
. I MTHRU]"" S VALUE=VALUE_$S(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(MTHRU)
. I VALUE["(" S VALUE=VALUE_")"
. S DSC="for "_VALUE
I FNAME="MRANGE" D
. NEW MRANGE,RFROM,RTHRU
. S MRANGE=$$GETVAL(OWNR,PLIEN,"MRANGE")
. I $G(PPIEN)'="" D RANGE^BQIDCAH1(MRANGE,PPIEN,"MRANGE")
. I MRANGE'["Ever" S VALUE=MRANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
. I MRANGE["Ever" S VALUE=MRANGE
. S DSC="for timeframe "_VALUE
Q
;
PRB ;EP
S PORD=$$PORD^BQIDCDF(FSOURCE,"PROB") Q:PORD=""
I FNAME="PROB" D
. S VALUE=$G(FPARMS("VAL","PROB"))
. Q:VALUE=""
. S VALUE=$$STRIP^XLFSTR(VALUE,$C(28))
. S DSC="with the following problem(s) "_VALUE
I FNAME="PROBTX" D
. S VALUE=$G(FPARMS("VAL","PROBTX"))
. S DSC="with the following problem(s) found in "_VALUE
I FNAME="PRSTAT" D
. I $G(FPARMS("VAL","PRSTAT"))'="" S DSC="with a status of "_$G(FPARMS("VAL","PRSTAT"))
S PORD=$$PORD^BQIDCDF(FSOURCE,"PROB")
Q
;
PRDT ;EP
S PORD=$$PORD^BQIDCDF(FSOURCE,"PROB") Q:PORD=""
I FNAME="PPFROM" D
. NEW PPFROM,PPTHRU
. S PPFROM=$$GETVAL(OWNR,PLIEN,"PPFROM")
. I PPFROM]"" S VALUE="(Range from date "_$$FMTE^BQIUL1(PPFROM)
. S PPTHRU=$$GETVAL(OWNR,PLIEN,"PPTHRU")
. I PPTHRU]"" S VALUE=VALUE_$S(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(PPTHRU)
. I VALUE["(" S VALUE=VALUE_")"
. S DSC="for "_VALUE
I FNAME="PRANGE" D
. NEW PRANGE,RFROM,RTHRU
. S PRANGE=$$GETVAL(OWNR,PLIEN,"PRANGE")
. I $G(PPIEN)'="" D RANGE^BQIDCAH1(PRANGE,PPIEN,"PRANGE")
. I PRANGE'["Ever" S VALUE=PRANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
. I PRANGE["Ever" S VALUE=PRANGE
. S DSC="for timeframe "_VALUE
Q
;
ERV(VALUE) ;EP
S VAL=$P(^AMER(3,VALUE,0),U,1)
S VALUE=VAL
Q
;
ADAT ;EP
I $G(PARMS("APRANGE"))'="" S DSC="appointment timeframe is "_$G(PARMS("APRANGE")) K PARMS("APRANGE")
I $G(PARMS("FROM"))'="" S DSC="appointments are for "_$G(PARMS("FROM"))_"-"_$G(PARMS("THRU")) K PARMS("FROM"),PARMS("THRU")
I $G(PARMS("RFROM"))'="" S DSC="appointments are for "_$G(PARMS("RFROM"))_"-"_$G(PARMS("RTHRU")) K PARMS("RFROM"),PARMS("RTHRU")
Q
;
RDAT ; EP
I $G(PARMS("RMDRANGE"))="" S DSC="."
I $G(PARMS("RMDRANGE"))'="" S DSC=" and where the Due date range is "_$G(PARMS("RMDRANGE"))_"."
Q
;
RMDR ;EP
S PORD=$$PORD^BQIDCDF(FSOURCE,"REMCODE") Q:PORD=""
I FNAME="REMCODE" D
. S VALUE=$G(FPARMS("VAL","REMCODE")) Q:VALUE=""
. S DSC="for reminder "_$$VAL^BQIRMDR1(VALUE)
I FNAME="OVD" D
. S VALUE=$G(FPARMS("VAL","OVD"))
. I VALUE="Y" S DSC="which is overdue"
I FNAME="FUT" D
. S VALUE=$G(FPARMS("VAL","FUT"))
. I VALUE="Y" S DSC="which is due"
S PORD=$$PORD^BQIDCDF(FSOURCE,"REMCODE") Q:PORD=""
Q
;
RMDT ;EP
S PORD=$$PORD^BQIDCDF(FSOURCE,"REMCODE") Q:PORD=""
I FNAME="RMDFROM" D
. NEW RMDFROM,RMDTHRU
. S RMDFROM=$$GETVAL(OWNR,PLIEN,"RMDFROM")
. I RMDFROM]"" S VALUE="(Range from date "_$$FMTE^BQIUL1(RMDFROM)
. S RMDTHRU=$$GETVAL(OWNR,PLIEN,"RMDTHRU")
. I RMDTHRU]"" S VALUE=VALUE_$S(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(RMDTHRU)
. I VALUE["(" S VALUE=VALUE_")"
. S DSC="for "_VALUE
I FNAME="RMDRANGE" D
. NEW RMDRANGE,RFROM,RTHRU
. S RMDRANGE=$$GETVAL(OWNR,PLIEN,"RMDRANGE")
. I $G(PPIEN)'="" D RANGE^BQIDCAH1(RMDRANGE,PPIEN,"RMDRANGE")
. I RMDRANGE'["Ever" S VALUE=RMDRANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
. I RMDRANGE["Ever" S VALUE=RMDRANGE
. S DSC="for timeframe "_VALUE
Q
;
COMMTX(VALUE) ;EP
NEW X,DIC,Y,IEN,VAL,COMMT,CTST,CM,FILE
I VALUE="" Q
;
S DIC(0)="NXZ"
S X=VALUE,DIC="^ATXAX(" D ^DIC
S VALUE="Taxonomy "_VALUE_" containing"
I Y="-1" Q
S IEN=+Y_",",VAL=""
D GETS^DIQ(9002226,IEN,".15;2101*","IE","COMMT")
S FILE=$G(COMMT(9002226,IEN,.15,"I")) Q:FILE=""
S CTST="" F S CTST=$O(COMMT(9002226.02101,CTST)) Q:CTST="" D
. S CM=$G(COMMT(9002226.02101,CTST,".01","E")) Q:CM=""
. I CM?.N S CM=$$GET1^DIQ(FILE,CM_",",.01,"E")
. S VAL=VAL_$S(VAL="":" (Communities ",1:", ")_CM
S:VAL["(" VAL=VAL_")"
S VALUE=VALUE_VAL
Q
BQIPDSC1 ;GDIT/HS/ALA-Panel descriptions continued ; 10 Apr 2013 4:54 PM
+1 ;;2.6;ICARE MANAGEMENT SYSTEM;;Jul 07, 2017;Build 72
+2 ;
CPT ;EP - CPTs
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"CNOT")
IF PORD=""
QUIT
+2 ;
+3 IF FNAME="CPT"
Begin DoDot:1
+4 SET VALUE=$GET(FPARMS("VAL","CPT"))
+5 IF VALUE=""
QUIT
+6 SET DSC=$SELECT($GET(FPARMS(PORD,"CNOT"))="Y":"without",1:"with")_" CPT "_VALUE
End DoDot:1
+7 IF FNAME="CPTTX"
Begin DoDot:1
+8 SET VALUE=$GET(FPARMS("VAL","CPTTX"))
+9 SET DSC=$SELECT($GET(FPARMS(PORD,"CNOT"))="Y":"without",1:"with")_" CPTs found in taxonomy "_VALUE
End DoDot:1
+10 SET PORD=$$PORD^BQIDCDF(FSOURCE,"CPT")
+11 QUIT
+12 ;
CDAT ;EP - CPT Dates
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"CPT")
IF PORD=""
QUIT
+2 IF FNAME="CFROM"
Begin DoDot:1
+3 NEW CFROM,CTHRU
+4 SET CFROM=$$GETVAL(OWNR,PLIEN,"CFROM")
+5 IF CFROM]""
SET VALUE="(Range from date "_$$FMTE^BQIUL1(CFROM)
+6 SET CTHRU=$$GETVAL(OWNR,PLIEN,"CTHRU")
+7 IF CTHRU]""
SET VALUE=VALUE_$SELECT(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(CTHRU)
+8 IF VALUE["("
SET VALUE=VALUE_")"
+9 SET DSC="for "_VALUE
End DoDot:1
+10 IF FNAME="CRANGE"
Begin DoDot:1
+11 NEW CRANGE,RFROM,RTHRU
+12 SET CRANGE=$$GETVAL(OWNR,PLIEN,"CRANGE")
+13 IF $GET(PPIEN)'=""
DO RANGE^BQIDCAH1(CRANGE,PPIEN,"CRANGE")
+14 IF CRANGE'["Ever"
SET VALUE=CRANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
+15 IF CRANGE["Ever"
SET VALUE=CRANGE
+16 SET DSC="for timeframe "_VALUE
End DoDot:1
+17 QUIT
+18 ;
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 ;
ED ;EP - education
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"EDUNOT")
IF PORD=""
QUIT
+2 SET DSC="Education "_$SELECT($GET(FPARMS(PORD,"EDUNOT"))="Y":"not found for",1:"found for")
+3 IF FNAME="EDUPICK"
Begin DoDot:1
+4 SET DSC=DSC_" EHR pick list "_$GET(FPARMS("VAL","EDUPICK"))
End DoDot:1
+5 IF FNAME="EDUTOP"
Begin DoDot:1
+6 SET DSC=DSC_" topic "_$GET(FPARMS("VAL","EDUTOP"))
End DoDot:1
+7 IF FNAME="EDUTX"
Begin DoDot:1
+8 SET DSC=DSC_" taxonomy "_$GET(FPARMS("VAL","EDUTX"))
End DoDot:1
+9 IF FNAME="EDUC"
Begin DoDot:1
+10 SET DSC=DSC_$GET(FPARMS("VAL","EDUC"))
End DoDot:1
+11 SET PORD=$$PORD^BQIDCDF(FSOURCE,"EDUC")
+12 QUIT
+13 ;
EDDT ;EP-education
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"EDUC")
IF PORD=""
QUIT
+2 IF FNAME="EDUFROM"
Begin DoDot:1
+3 NEW EFROM,ETHRU
+4 SET EFROM=$$GETVAL(OWNR,PLIEN,"EDUFROM")
+5 IF EFROM]""
SET VALUE="(Range from date "_$$FMTE^BQIUL1(EFROM)
+6 SET ETHRU=$$GETVAL(OWNR,PLIEN,"EDUTHRU")
+7 IF ETHRU]""
SET VALUE=VALUE_$SELECT(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(ETHRU)
+8 IF VALUE["("
SET VALUE=VALUE_")"
+9 SET DSC="for "_VALUE
End DoDot:1
+10 IF FNAME="EDURANGE"
Begin DoDot:1
+11 NEW EDURANGE,RFROM,RTHRU
+12 SET EDURANGE=$$GETVAL(OWNR,PLIEN,"EDURANGE")
+13 IF $GET(PPIEN)'=""
DO RANGE^BQIDCAH1(EDURANGE,PPIEN,"EDURANGE")
+14 IF EDURANGE'["Ever"
SET VALUE=EDURANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
+15 IF EDURANGE["Ever"
SET VALUE=EDURANGE
+16 SET DSC="for timeframe "_VALUE
End DoDot:1
+17 QUIT
+18 ;
LAB ;EP
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"LNOT")
IF PORD=""
QUIT
+2 IF FNAME="LAB"
Begin DoDot:1
+3 SET VALUE=$GET(FPARMS("VAL","LAB"))
+4 IF VALUE=""
QUIT
+5 SET VALUE=$$STRIP^XLFSTR(VALUE,$CHAR(28))
+6 SET DSC=$SELECT($GET(FPARMS(PORD,"LNOT"))="Y":"who did NOT have the following lab test(s) ",1:"who had the following lab test(s) ")_VALUE
End DoDot:1
+7 IF FNAME="LABTX"
Begin DoDot:1
+8 SET VALUE=$GET(FPARMS("VAL","LABTX"))
+9 SET DSC=$SELECT($GET(FPARMS(PORD,"LNOT"))="Y":"who did NOT have the following lab test(s) ",1:"who had the following lab test(s)")_" found in "_VALUE
End DoDot:1
+10 SET PORD=$$PORD^BQIDCDF(FSOURCE,"LAB")
+11 QUIT
+12 ;
LBDT ;EP
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"LAB")
IF PORD=""
QUIT
+2 IF FNAME="LFROM"
Begin DoDot:1
+3 NEW LFROM,LTHRU
+4 SET LFROM=$$GETVAL(OWNR,PLIEN,"LFROM")
+5 IF LFROM]""
SET VALUE="(Range from date "_$$FMTE^BQIUL1(LFROM)
+6 SET LTHRU=$$GETVAL(OWNR,PLIEN,"LTHRU")
+7 IF LTHRU]""
SET VALUE=VALUE_$SELECT(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(LTHRU)
+8 IF VALUE["("
SET VALUE=VALUE_")"
+9 SET DSC="for "_VALUE
End DoDot:1
+10 IF FNAME="LRANGE"
Begin DoDot:1
+11 NEW LRANGE,RFROM,RTHRU
+12 SET LRANGE=$$GETVAL(OWNR,PLIEN,"LRANGE")
+13 IF $GET(PPIEN)'=""
DO RANGE^BQIDCAH1(LRANGE,PPIEN,"LRANGE")
+14 IF LRANGE'["Ever"
SET VALUE=LRANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
+15 IF LRANGE["Ever"
SET VALUE=LRANGE
+16 SET DSC="for timeframe "_VALUE
End DoDot:1
+17 QUIT
+18 ;
LBRS(LBVAL) ;EP - Lab result
+1 NEW STR,N1,FND,N2,V,STR
+2 SET STR=""
+3 SET LBVAL=$PIECE(LBVAL,"NUMLAB",2)
+4 SET LBVAL1=LBVAL
SET LBVAL2=""
+5 IF LBVAL["~"
SET LBVAL1=$PIECE(LBVAL,"~",1)
+6 SET (N1,FND)=""
FOR I=1:1:$LENGTH(LBVAL1)
IF FND=1
QUIT
Begin DoDot:1
+7 IF $EXTRACT(LBVAL1,I)?1N
SET N1=N1_$EXTRACT(LBVAL1,I,$LENGTH(LBVAL1))
SET FND=1
+8 ;I $E(LBVAL,I)?1N,$E(LBVAL,I-1)'="." S N1=N1_$E(LBVAL,I),FND=1
+9 ;I $E(LBVAL,I)?1N,$E(LBVAL,I-1)="." S N1=N1_$E(LBVAL,I-1,I),FND=1
End DoDot:1
+10 IF N1=""
QUIT
+11 IF LBVAL["~"
SET LBVAL2=$PIECE(LBVAL,"~",2)
+12 SET (N2,FND)=""
FOR I=1:1:$LENGTH(LBVAL2)
IF FND=1
QUIT
Begin DoDot:1
+13 IF $EXTRACT(LBVAL2,I)?1N
SET N2=N2_$EXTRACT(LBVAL2,I,$LENGTH(LBVAL2))
SET FND=1
+14 ;I $E(LBVAL,I)?1N,$E(LBVAL,I-1)'="." S N2=N2_$E(LBVAL,I),FND=1 Q
+15 ;I $E(LBVAL,I)?1N,$E(LBVAL,I-1)="." S N2=N2_$E(LBVAL,I-1,I),FND=1
End DoDot:1
+16 SET V=LBVAL
+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 LBVAL=STR
+25 QUIT LBVAL
+26 ;
MED ;EP
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"MNOT")
IF PORD=""
QUIT
+2 IF FNAME="MED"
Begin DoDot:1
+3 SET VALUE=$GET(FPARMS("VAL","MED"))
+4 IF VALUE=""
QUIT
+5 SET VALUE=$$STRIP^XLFSTR(VALUE,$CHAR(28))
+6 SET DSC=$SELECT($GET(FPARMS(PORD,"MNOT"))="Y":"who did NOT have the following medication(s) ",1:"who had the following medication(s) ")_VALUE
End DoDot:1
+7 IF FNAME="MEDTX"
Begin DoDot:1
+8 SET VALUE=$GET(FPARMS("VAL","MEDTX"))
+9 SET DSC=$SELECT($GET(FPARMS(PORD,"MNOT"))="Y":"who did NOT have the following medication(s) ",1:"who had the following medication(s)")_" found in "_VALUE
End DoDot:1
+10 SET PORD=$$PORD^BQIDCDF(FSOURCE,"MED")
+11 QUIT
+12 ;
MDDT ;EP
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"MED")
IF PORD=""
QUIT
+2 IF FNAME="MFROM"
Begin DoDot:1
+3 NEW MFROM,MTHRU
+4 SET MFROM=$$GETVAL(OWNR,PLIEN,"MFROM")
+5 IF MFROM]""
SET VALUE="(Range from date "_$$FMTE^BQIUL1(MFROM)
+6 SET MTHRU=$$GETVAL(OWNR,PLIEN,"MTHRU")
+7 IF MTHRU]""
SET VALUE=VALUE_$SELECT(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(MTHRU)
+8 IF VALUE["("
SET VALUE=VALUE_")"
+9 SET DSC="for "_VALUE
End DoDot:1
+10 IF FNAME="MRANGE"
Begin DoDot:1
+11 NEW MRANGE,RFROM,RTHRU
+12 SET MRANGE=$$GETVAL(OWNR,PLIEN,"MRANGE")
+13 IF $GET(PPIEN)'=""
DO RANGE^BQIDCAH1(MRANGE,PPIEN,"MRANGE")
+14 IF MRANGE'["Ever"
SET VALUE=MRANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
+15 IF MRANGE["Ever"
SET VALUE=MRANGE
+16 SET DSC="for timeframe "_VALUE
End DoDot:1
+17 QUIT
+18 ;
PRB ;EP
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"PROB")
IF PORD=""
QUIT
+2 IF FNAME="PROB"
Begin DoDot:1
+3 SET VALUE=$GET(FPARMS("VAL","PROB"))
+4 IF VALUE=""
QUIT
+5 SET VALUE=$$STRIP^XLFSTR(VALUE,$CHAR(28))
+6 SET DSC="with the following problem(s) "_VALUE
End DoDot:1
+7 IF FNAME="PROBTX"
Begin DoDot:1
+8 SET VALUE=$GET(FPARMS("VAL","PROBTX"))
+9 SET DSC="with the following problem(s) found in "_VALUE
End DoDot:1
+10 IF FNAME="PRSTAT"
Begin DoDot:1
+11 IF $GET(FPARMS("VAL","PRSTAT"))'=""
SET DSC="with a status of "_$GET(FPARMS("VAL","PRSTAT"))
End DoDot:1
+12 SET PORD=$$PORD^BQIDCDF(FSOURCE,"PROB")
+13 QUIT
+14 ;
PRDT ;EP
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"PROB")
IF PORD=""
QUIT
+2 IF FNAME="PPFROM"
Begin DoDot:1
+3 NEW PPFROM,PPTHRU
+4 SET PPFROM=$$GETVAL(OWNR,PLIEN,"PPFROM")
+5 IF PPFROM]""
SET VALUE="(Range from date "_$$FMTE^BQIUL1(PPFROM)
+6 SET PPTHRU=$$GETVAL(OWNR,PLIEN,"PPTHRU")
+7 IF PPTHRU]""
SET VALUE=VALUE_$SELECT(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(PPTHRU)
+8 IF VALUE["("
SET VALUE=VALUE_")"
+9 SET DSC="for "_VALUE
End DoDot:1
+10 IF FNAME="PRANGE"
Begin DoDot:1
+11 NEW PRANGE,RFROM,RTHRU
+12 SET PRANGE=$$GETVAL(OWNR,PLIEN,"PRANGE")
+13 IF $GET(PPIEN)'=""
DO RANGE^BQIDCAH1(PRANGE,PPIEN,"PRANGE")
+14 IF PRANGE'["Ever"
SET VALUE=PRANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
+15 IF PRANGE["Ever"
SET VALUE=PRANGE
+16 SET DSC="for timeframe "_VALUE
End DoDot:1
+17 QUIT
+18 ;
ERV(VALUE) ;EP
+1 SET VAL=$PIECE(^AMER(3,VALUE,0),U,1)
+2 SET VALUE=VAL
+3 QUIT
+4 ;
ADAT ;EP
+1 IF $GET(PARMS("APRANGE"))'=""
SET DSC="appointment timeframe is "_$GET(PARMS("APRANGE"))
KILL PARMS("APRANGE")
+2 IF $GET(PARMS("FROM"))'=""
SET DSC="appointments are for "_$GET(PARMS("FROM"))_"-"_$GET(PARMS("THRU"))
KILL PARMS("FROM"),PARMS("THRU")
+3 IF $GET(PARMS("RFROM"))'=""
SET DSC="appointments are for "_$GET(PARMS("RFROM"))_"-"_$GET(PARMS("RTHRU"))
KILL PARMS("RFROM"),PARMS("RTHRU")
+4 QUIT
+5 ;
RDAT ; EP
+1 IF $GET(PARMS("RMDRANGE"))=""
SET DSC="."
+2 IF $GET(PARMS("RMDRANGE"))'=""
SET DSC=" and where the Due date range is "_$GET(PARMS("RMDRANGE"))_"."
+3 QUIT
+4 ;
RMDR ;EP
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"REMCODE")
IF PORD=""
QUIT
+2 IF FNAME="REMCODE"
Begin DoDot:1
+3 SET VALUE=$GET(FPARMS("VAL","REMCODE"))
IF VALUE=""
QUIT
+4 SET DSC="for reminder "_$$VAL^BQIRMDR1(VALUE)
End DoDot:1
+5 IF FNAME="OVD"
Begin DoDot:1
+6 SET VALUE=$GET(FPARMS("VAL","OVD"))
+7 IF VALUE="Y"
SET DSC="which is overdue"
End DoDot:1
+8 IF FNAME="FUT"
Begin DoDot:1
+9 SET VALUE=$GET(FPARMS("VAL","FUT"))
+10 IF VALUE="Y"
SET DSC="which is due"
End DoDot:1
+11 SET PORD=$$PORD^BQIDCDF(FSOURCE,"REMCODE")
IF PORD=""
QUIT
+12 QUIT
+13 ;
RMDT ;EP
+1 SET PORD=$$PORD^BQIDCDF(FSOURCE,"REMCODE")
IF PORD=""
QUIT
+2 IF FNAME="RMDFROM"
Begin DoDot:1
+3 NEW RMDFROM,RMDTHRU
+4 SET RMDFROM=$$GETVAL(OWNR,PLIEN,"RMDFROM")
+5 IF RMDFROM]""
SET VALUE="(Range from date "_$$FMTE^BQIUL1(RMDFROM)
+6 SET RMDTHRU=$$GETVAL(OWNR,PLIEN,"RMDTHRU")
+7 IF RMDTHRU]""
SET VALUE=VALUE_$SELECT(VALUE["Range":" thru date ",1:" (Range thru date ")_$$FMTE^BQIUL1(RMDTHRU)
+8 IF VALUE["("
SET VALUE=VALUE_")"
+9 SET DSC="for "_VALUE
End DoDot:1
+10 IF FNAME="RMDRANGE"
Begin DoDot:1
+11 NEW RMDRANGE,RFROM,RTHRU
+12 SET RMDRANGE=$$GETVAL(OWNR,PLIEN,"RMDRANGE")
+13 IF $GET(PPIEN)'=""
DO RANGE^BQIDCAH1(RMDRANGE,PPIEN,"RMDRANGE")
+14 IF RMDRANGE'["Ever"
SET VALUE=RMDRANGE_" ("_$$FMTE^BQIUL1(RFROM)_"-"_$$FMTE^BQIUL1(RTHRU)_")"
+15 IF RMDRANGE["Ever"
SET VALUE=RMDRANGE
+16 SET DSC="for timeframe "_VALUE
End DoDot:1
+17 QUIT
+18 ;
COMMTX(VALUE) ;EP
+1 NEW X,DIC,Y,IEN,VAL,COMMT,CTST,CM,FILE
+2 IF VALUE=""
QUIT
+3 ;
+4 SET DIC(0)="NXZ"
+5 SET X=VALUE
SET DIC="^ATXAX("
DO ^DIC
+6 SET VALUE="Taxonomy "_VALUE_" containing"
+7 IF Y="-1"
QUIT
+8 SET IEN=+Y_","
SET VAL=""
+9 DO GETS^DIQ(9002226,IEN,".15;2101*","IE","COMMT")
+10 SET FILE=$GET(COMMT(9002226,IEN,.15,"I"))
IF FILE=""
QUIT
+11 SET CTST=""
FOR
SET CTST=$ORDER(COMMT(9002226.02101,CTST))
IF CTST=""
QUIT
Begin DoDot:1
+12 SET CM=$GET(COMMT(9002226.02101,CTST,".01","E"))
IF CM=""
QUIT
+13 IF CM?.N
SET CM=$$GET1^DIQ(FILE,CM_",",.01,"E")
+14 SET VAL=VAL_$SELECT(VAL="":" (Communities ",1:", ")_CM
End DoDot:1
+15 IF VAL["("
SET VAL=VAL_")"
+16 SET VALUE=VALUE_VAL
+17 QUIT