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

LRSORA1.m

Go to the documentation of this file.
  1. LRSORA1 ;SLC/KCM - CREATE SEARCH LOGIC ; 8/5/87 11:40 ;
  1. ;;5.2;LAB SERVICE;;Sep 27, 1994
  1. EN W ! F J=1:1:LRTST W !,"-",$C(64+J),"-"," ",$P(LRTST(J,2),U,1) W:$P(LRTST(J,2),U,2)]"" " (",$P(LRTST(J,2),U,2),")" W " ",$P(LRTST(J,2),U,3)
  1. S LRA="A" F I=1:1:LRTST-1 S LRA=LRA_" OR "_$C(65+I)
  1. S Y=-1 F I=0:0 W !!,"Enter SEARCH LOGIC: ",LRA,"// " R X:DTIME S:'$T X="^" S:X["^" LREND=1 D:X["?" HLP0 S:'$L(X) X=LRA D:(X'["?")&(X'["^") PLOG Q:Y'<0!LREND
  1. S LRTST(0)=Y Q
  1. PLOG F %=1:1 S T=$T(SWAP+%) Q:$P(T,";",3)="ZZZZ" S LROLD=$P(T,";",3),LRNEW=$P(T,";",4) D PARSE
  1. S Y="" F %=1:1:$L(X) S:$E(X,%)'=" " Y=Y_$E(X,%)
  1. F %=1:1:$L(Y) S T=$A(Y,%) S LROK=0 D TSTLIM I 'LROK S Y=-1 Q
  1. I Y'=-1 S X="I "_Y D ^DIM S:'$D(X) Y=-1
  1. STOP W:Y<0 " ??" K LRPNT,LROLD,LRNEW,LROK,LRI,LRJ,X,T,% Q
  1. TSTLIM F LRJ=33,38,39,40,41,65:1:64+LRTST S:T=LRJ LROK=1
  1. Q
  1. PARSE F LRI=1:1:$L(LROLD)-$L(LRNEW) S LRNEW=LRNEW_" "
  1. S LRPNT(0)=0 F LRI=1:1 S LRPNT(LRI)=$F(X,LROLD,LRPNT(LRI-1)) Q:LRPNT(LRI)=0
  1. F LRJ=1:1:LRI-1 S X=$E(X,1,LRPNT(LRJ)-$L(LROLD)-1)_LRNEW_$E(X,LRPNT(LRJ),99)
  1. Q
  1. SWAP ;;LROLD;LRNEW; NOTE: $L(LROLD) MUST BE >= $L(LRNEW)
  1. ;;AND;&
  1. ;;OR;!
  1. ;;NOT;'
  1. ;;,;&
  1. ;;ZZZZ
  1. HLP0 W !!,"Enter a logical expression (i.e., A AND B OR C or A&B!C)."
  1. W !," NOTE: AND will compare only values from the -same- accession."
  1. W !," To print all results that fall within the search criteria,"
  1. W !," accept the default search logic (OR)."
  1. SUMMARY ;
  1. Q
  1. SORTBY ;
  1. K DIR S DIR("B")="P",DIR("A")="Sort by PATIENT or by LOCATION"
  1. S DIR(0)="S^P:PATIENT;L:LOCATION",DIR("?")="Choose print sorting order."
  1. D ^DIR S:($D(DUOUT))!($D(DTOUT)) LREND=1 S:'LREND LRSRT=Y Q
  1. PATS ;
  1. S LRPTS=0
  1. K DIC S DIC="^DPT(",DIC(0)="AEMQ",DIC("A")="Select PATIENT NAME: All//"
  1. F I=1:1 D ^DIC Q:Y=-1 S LRPTS(+Y)=$P(Y,U,2),DIC("A")="Select another PATIENT: ",LRPTS=I
  1. S:($D(DUOUT))!($D(DTOUT)) LREND=1 Q
  1. LOCS ;
  1. S LRLCS=0
  1. K DIC S DIC="^SC(",DIC(0)="AEMQZ",DIC("A")="Select LOCATION: All//"
  1. F I=1:1 D ^DIC Q:Y=-1 D
  1. .S DIC("A")="Select another LOCATION: "
  1. .I $P(Y(0),U,2)="" D NOABRV Q:%'=1
  1. .S LRLCS($S($L($P(Y(0),U,2)):$P(Y(0),U,2),1:"NO ABRV"))=+Y,LRLCS=I
  1. S:($D(DUOUT))!($D(DTOUT)) LREND=1 K %,%Y Q
  1. NOABRV ;
  1. W !!,"The location you have selected does not have an abbreviation."
  1. W !,"If you use this location, the report will list all records without"
  1. W " location",!,"abbreviations (as long as they also meet the date and"
  1. W " patient selections)",!,"This may include data from several "
  1. W "locations, with no way to be sure which is",!,"which. They will be "
  1. W "listed with the abbreviation of 'NO ABRV' or 'UNK'."
  1. S %=1 W !!,"Do you still want to select this location (Y/N)?//"
  1. D YN^DICN
  1. Q