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

AMQQCMPM.m

Go to the documentation of this file.
  1. AMQQCMPM ; IHS/CMI/THL - RESOLVES DISPLAY OF MULTIPLE MULTIPLES ; 12 Mar 2015 1:09 PM
  1. ;;2.0;IHS PCC SUITE;**4,5,11**;MAY 14, 2009;Build 58
  1. MM N N,X,Y,Z,%,DIC,A,B,I
  1. K AMQQDVQU
  1. D ALL
  1. I $D(AMQQQUIT) G EXIT
  1. F I=1:1:($L(AMQQMULX,U)-2) S N=$P(AMQQMULX,U,I) D MM1
  1. EXIT K AMQQMULX
  1. Q
  1. ;
  1. MM1 ;
  1. I $D(^UTILITY("AMQQ",$J,"Q",N))=1 D Q
  1. .S %=$P(^UTILITY("AMQQ",$J,"Q",N),U,9)
  1. .S:+^UTILITY("AMQQ",$J,"Q",N)'=758 $P(^UTILITY("AMQQ",$J,"Q",N),U,14)=1
  1. .Q:%["NULL"!(%["INVERSE")
  1. .S $P(%,";",4)="EXISTS",$P(^UTILITY("AMQQ",$J,"Q",N),U,9)=%
  1. F %=0:0 S %=$O(^UTILITY("AMQQ",$J,"Q",N,%)) Q:'% S Z=%
  1. S ^UTILITY("AMQQ",$J,"Q",N,Z+1)=Y_"^U^EXIST^AMQQF^3^^0^0",$P(^UTILITY("AMQQ",$J,"Q",N),U,14)=1
  1. Q
  1. ;
  1. ALL S %=$L(AMQQMULX,U)
  1. S %=$P(AMQQMULX,U,%-1)
  1. S AMQQMULN=%
  1. S AMQQOBJ=$P(^UTILITY("AMQQ",$J,"Q",%),U,2)
  1. S AMQQOBJS=AMQQOBJ_$S($E(AMQQOBJ,$L(AMQQOBJ))?1P!($E(AMQQOBJ,$L(AMQQOBJ))="S"):"",1:"S")
  1. S AMQQMULL=AMQQMULN
  1. I AMQQCCLS="V" G ALLEXIT
  1. F %="NULL","INVERSE" I $P(^UTILITY("AMQQ",$J,"Q",AMQQMULN),U,9)[% D SPEC G ALLEXIT
  1. I $D(AMQQXX) S X=$S($D(AMQQXX("FORMAT")):AMQQXX("FORMAT"),1:2) G X1
  1. S %=$G(AMQV("OPTION"))
  1. S %=$S(%="MAIL":2,%="HSUM":2,%="WORK":1,%="WORK":1,%="TIME":1,%="MONTH":1,1:0)
  1. I % S X=% G @("X"_X)
  1. I $D(^UTILITY("AMQQ",$J,"SQXQ",AMQQMULN)) S Z=$O(^(AMQQMULN,"")) I Z F %="NULL","ALL","EXISTS","ANY","INVERSE" I $D(^UTILITY("AMQQ",$J,"SQ",Z,%)) S X=2 S:Z'="ALL"&(Z'="ANY") $P(^UTILITY("AMQQ",$J,"Q",AMQQMULN),U,14)=1 G ALLEXIT
  1. I $D(^UTILITY("AMQQ",$J,"Q",AMQQMULN,1)),$P(^(1),U,2)="NULL" G ALLEXIT
  1. I $P(^UTILITY("AMQQ",$J,"Q",AMQQMULN),U,9)["ANY" G ALLEXIT
  1. I $P(^UTILITY("AMQQ",$J,"Q",AMQQMULN),U,3)="I" S %=$P(^(AMQQMULN),U,9) I $P(%,";",5)=2 G ALLEXIT
  1. S %=$P(^UTILITY("AMQQ",$J,"Q",AMQQMULN),U,13)
  1. I %,%'=4 G ALLEXIT
  1. S X=+$G(^UTILITY("AMQQ",$J,"Q",AMQQMULN))
  1. I X,$D(^AMQQ(1,X,9)),$P(^(9),U)'="" S AMQQN=^(9) D MULT G ALLEXIT
  1. I $D(AMQQONE) S X=1 G X1
  1. I AMQV("OPTION")="COHORT" S X=2 G X2
  1. S A="@AMQQRV,""PATIENTS"",@AMQQNV"
  1. S B="@AMQQRV,"""_AMQQOBJS_""",@AMQQNV"
  1. S %="list"
  1. I $G(AMQV("OPTION"))="COUNT" S %="count"
  1. W !!,"You have 2 options for ",%,"ing ",AMQQOBJS," =>",!
  1. W !?5,"1) For ea. patient, ",%," all ",@B," which match your",!?8,"criteria"
  1. W !?5,"2) ",$S(AMQV("OPTION")="COUNT":"Count",1:"List")," all ",@A," with ",AMQQOBJS," meeting your criteria,",!?8,"but do not ",%," the individual values of ea. ",AMQQOBJ,!
  1. ALLQ W !,"Your choice (1 or 2): 1// "
  1. R X:DTIME E S X=U
  1. I $E(X)=U S AMQQQUIT="" G ALLEXIT
  1. I X="" S X=1 W " (1)"
  1. I X?1."?" D HELP G ALL
  1. X1 I X=1 D:$D(^UTILITY("AMQQ",$J,"Q",AMQQMULN)) X11 G ALLEXIT
  1. X2 I X=2 S AMQQMULX=AMQQMULX_AMQQMULN_U G ALLEXIT
  1. W " ??",*7
  1. G ALLQ
  1. ALLEXIT K AMQQMULN,AMQQOBJ,AMQQOBJS,A,B,AMQQN,AMQQNO3
  1. Q
  1. ;
  1. CD W !!,"You have 2 options for counting ",AMQQN(1)," =>",!
  1. W !?5,"1) Count all specified ",AMQQN(2)," for all patients"
  1. S AMQQI=0
  1. F S AMQQI=$O(^UTILITY("AMQQ",$J,"LIST",AMQQI)) Q:'AMQQI!($D(AMQQSTP)) I ^(AMQQI)[$E(AMQQN(1),1,($L(AMQQN(1))-2)) S:$D(AMQQHIT) AMQQSTP="" S AMQQHIT=""
  1. W !?5,"2) Count PATIENTS with at least one of the ",$S('$D(AMQQSTP):AMQQN(1),1:AMQQN(1)_" in each query"),!,?7," you specified",!
  1. K AMQQSTP,AMQQHIT
  1. CDQ W !,"Your choice (1-2): 1// "
  1. R X:DTIME E S X=U
  1. I X=2 S X=3 Q
  1. I X="" Q
  1. I X=1 Q
  1. I X?1."?" D HELP G CD
  1. I $E(X)=U Q
  1. W " ??",*7
  1. G CDQ
  1. ;
  1. HELP N %A,%B
  1. S XQH=$O(^DIC(9.2,"B","AMQQLIST",""))
  1. D EN1^XQH
  1. Q
  1. ;
  1. MULT F I=1:1:3 S AMQQN(I)=$P(AMQQN,U,I)
  1. I AMQV("OPTION")="COHORT" S X=3 G X3
  1. S %=$P(^UTILITY("AMQQ",$J,"Q",AMQQMULN),U,15)
  1. S %=$P(%,";",4)
  1. I %,$D(^UTILITY("AMQQ TAX",$J,%,"--"))!$D(^UTILITY("AMQQ TAX",$J,%,"-")) Q
  1. I AMQV("OPTION")="COUNT" D CD G DXQA
  1. I $D(AMQQONE) S X=2 G DXQA
  1. W !!,"You have ",$S('$D(AMQQNO3):3,1:2)," options for listing ",AMQQN(1)," =>",!
  1. W !?5,"1) List every ",$S(AMQQN(2)="ICD9 CODES":"DIAGNOSIS",AMQQN(2)="ICD CODES":"ICD CODE",1:AMQQN(2))," meeting search criteria."
  1. W !?5,"2) List every ",$S(AMQQN(2)="ICD9 CODES":"DIAGNOSIS",AMQQN(2)="ICD CODES":"ICD CODE",1:AMQQN(2))," and ",$S(AMQQN(3)="PROVIDER NARRATIVES":"PROVIDER NARRATIVE",1:AMQQN(3))," meeting search criteria." I $D(AMQQNO3) W !
  1. I '$D(AMQQNO3) W !?5,"3) List all PATIENTS with ",$S(AMQQN(2)="ICD9 CODES":"DIAGNOSIS",1:AMQQN(2))," you specified, but DO NOT list",!?8,"individual ",$S(AMQQN(2)="ICD9 CODES":"ICD CODES",1:AMQQN(2))," or ",AMQQN(3)," (FASTEST OPTION!!)",!
  1. W ?8,"(Displays UNDUPLICATED list of PATIENTS)",!
  1. DXQ W !,"Your choice (1-",(3-$D(AMQQNO3)),"): 1// "
  1. R X:DTIME E S X=U
  1. DXQA I $E(X)=U S AMQQQUIT="" G DXEXIT
  1. I X="" S X=1 W " (1)"
  1. I X?1."?" D HELP G MULT
  1. DXQA1 I X=2 S %=+^UTILITY("AMQQ",$J,"Q",AMQQMULN) D Q
  1. .I %>999 D EXP Q
  1. .S:$D(^AMQQ(1,%+.1)) $P(^UTILITY("AMQQ",$J,"Q",AMQQMULN),U,1)=%+.1 S $P(^(AMQQMULN),U,18)=1,$P(^(AMQQMULN),U,14)=3
  1. .Q
  1. X11 ;IHS/CMI/LAB - addded question about qualifiers
  1. ;I X=1 S $P(^UTILITY("AMQQ",$J,"Q",AMQQMULN),U,18)=1 Q ;,$P(^(AMQQMULN),U,14)=2 Q
  1. K AMQQDVQU
  1. I X=1 S $P(^UTILITY("AMQQ",$J,"Q",AMQQMULN),U,18)=1
  1. I $P(^AMQQ(1,+$G(^UTILITY("AMQQ",$J,"Q",AMQQMULL)),0),U,3)=9000010.01 D
  1. .NEW X
  1. .K DIR,AMQQDVQU
  1. .S DIR(0)="Y",DIR("A")="Do you want to display associated measurement qualifiers with each "_AMQQOBJS,DIR("B")="N",DIR("?")="If you want to display the qualifiers (e.g. Oral, Left Arm, etc) enter Y for Yes." KILL DA D ^DIR KILL DIR
  1. .I $D(DIRUT) K AMQQDVQU Q
  1. .I 'Y K AMQQDVQU Q
  1. .S AMQQDVQU=1
  1. .Q
  1. I X=1 Q
  1. X3 I '$D(AMQQNO3),X=3 S $P(^UTILITY("AMQQ",$J,"Q",AMQQMULN),U,18)=2,AMQQMULX=AMQQMULX_AMQQMULN_U Q
  1. W " ??",*7
  1. G DXQ
  1. DXEXIT K X
  1. Q
  1. ;
  1. SPEC I $G(AMQV("OPTION"))'="COHORT",%="ALL"!(%="ANY"),$D(^AMQQ(1,+$G(^UTILITY("AMQQ",$J,"Q",AMQQMULN)),9)) S:%="ANY" AMQQNO3="" S AMQQN=^(9) D MULT Q
  1. S X=2-((%="ALL")!(%="ANY"))
  1. D DXQA1
  1. Q
  1. ;
  1. EXP ; EXPANDED LAB OUTPUT
  1. N X,Y,Z
  1. S $P(^AMQQ(1,%,4,1,0),U,5,6)="30^30",^(1)="D EXP^AMQQDO"
  1. Q
  1. ;