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

AMQQ1.m

Go to the documentation of this file.
  1. AMQQ1 ; IHS/CMI/THL - AMQQ SUBROUTINE...GETS GOAL OF QUERY; ; 26 Oct 2010 9:07 AM
  1. ;;2.0;IHS PCC SUITE;**5**;MAY 14, 2009
  1. ;IHS/CMI/LAB - added ability to choose a CMS register
  1. ;-----
  1. GOAL I '$D(AMQQOPT) S AMQQOPT="SEARCH"
  1. I $D(AMQQEN31),AMQQEN31=+AMQQEN31 D SWAP Q
  1. G1 W !,$S(AMQQOPT="FAST":"Tell me what you want: ",1:"What is the subject of your search? LIVING PATIENTS // ")
  1. R X:DTIME E S AMQQQUIT=1 Q
  1. I X[" " W " ??",*7 G GOAL
  1. I $L(X," ")>4 S AMQQQSTG=X D ^AMQQN S AMQQQUIT="" K AMQQXX G EXIT
  1. I $G(AMQQOPT)="FAST",$E(X)'="?" S:"^"[X AMQQQUIT=1 G:"^"[X EXIT S AMQQQSTG=X D ^AMQQN S AMQQQUIT="" K AMQQXX G EXIT
  1. I X="",AMQQOPT="QUICK" S X=U
  1. I X="HELP" S X="?"
  1. I X="??" D LISTG^AMQQHELP G GOAL
  1. I $E(X)=U S AMQQQUIT=1 G EXIT
  1. I X?1."?" N %A,%B S XQH=$O(^DIC(9.2,"B","AMQQSUBJECT","")) D EN1^XQH G GOAL
  1. I X="" S X="LIVING PATIENTS"
  1. I $E(X)'?1UN W " ??",*7 G GOAL
  1. ;I X="LIVING PATIENTS"!(X="REGISTER") D QAPT^AMQQAPT W !! S X="LIVING PATIENTS"
  1. D AUTO
  1. I Y'=-1 D Q
  1. .NEW AMQQLLLL S AMQQLLLL=""
  1. .I $P(^AMQQ(5,+Y,0),U,9)="P" S AMQQLLLL=Y D QAPT^AMQQAPT W !! S Y=AMQQLLLL
  1. .D NEW Q
  1. D ^AMQQ2
  1. AUTO1 ; ENTRY POINT FOR DFN SUBJECT
  1. N X
  1. I $D(AMQQFAIL) K AMQQFAIL G GOAL
  1. D PERSON
  1. Q
  1. ;
  1. EXIT K X,%,I
  1. Q
  1. ;
  1. AUTO ; ENTRY POINT FROM AMQQQ
  1. S DIC(0)="E"
  1. S DIC="^AMQQ(5,"
  1. S DIC("S")="I $P(^(0),U,9)'="""""
  1. S D="C"
  1. I $D(AMQQNECO) S DIC(0)=""
  1. E I $D(AMQQXX) S DIC(0)="ES"
  1. D IX^DIC
  1. K DIC
  1. Q
  1. ;
  1. LISTG S DIC="^AMQQ(5,"
  1. S DIC(0)="E"
  1. S D="GOAL"
  1. S DZ="??"
  1. D DQ^DICQ
  1. K DIC,DZ,D,DIX,DIY,DD,%H,%,DO,X,Y
  1. Q
  1. ;
  1. PERSON ; ENTRY POINT FROM AMQQN1 THE NATURAL LANGUAGE ROUTINE
  1. S X=$P(Y,U,3)
  1. S Y=$P(Y,U,4)
  1. S Y=$P(Y,",",2)_" "_$P(Y,",")
  1. S AMQQQ="8^NAME^L^^9^1^EQUAL TO^=^"_X_"^^100^W ?6,""NAME = "","""_Y_"""^1^0^=;"_X_";"
  1. S ^UTILITY("AMQQ",$J,"Q",1)=AMQQQ
  1. S AMQQUATN=2
  1. S AMQQUNBC=1
  1. I '$D(AMQQXX) S ^UTILITY("AMQQ",$J,"LIST",2)="W ?6,""NAME = "_Y_""""
  1. S ^UTILITY("AMQQ",$J,"WEIGHT",-99,1)=""
  1. S AMQQONE=Y
  1. S Y="1^PATIENT"
  1. D NEW
  1. I $D(AMQQXX) Q
  1. S AMQQILIN=2
  1. D LIST^AMQQ
  1. Q
  1. ;
  1. NEW ; ENTRY POINT FROM AMQQN1
  1. I $D(^AMQQ(5,+Y,2)) S AMQQATN=+Y,AMQQCCLS=$P(^AMQQ(5,+Y,0),U,9) D SCRIPT Q
  1. N1 S AMQQCNAM=$P(Y,U,2)
  1. S (X,AMQQCCLS)=$P(^AMQQ(5,+Y,0),U,9)
  1. I AMQQCNAM["RANDOM" S AMQQRSAF=""
  1. I $D(AMQQXX) Q
  1. I AMQQCNAM="REGISTER" D ^AMQQREG Q
  1. S AMQQILIN=1
  1. S X=$S(X="P":"PATIENTS",X="H":"PROVIDER",X="V":"VISIT",1:"CLINICAL DATA")
  1. I $D(AMQQONE),AMQQONE'="" S X=AMQQONE
  1. S %="W ?3"
  1. S %=%_",@AMQQRV,""Subject of search: "_X_""",@AMQQNV" G SETNG
  1. S %=%_","""_X_""""
  1. SETNG S ^UTILITY("AMQQ",$J,"LIST",.1)=%
  1. Q
  1. ;
  1. SCRIPT ; ENTRY POINT FROM AMQQATA
  1. S Z=0
  1. I ^AMQQ(5,AMQQATN,2,1,0)?1U S X=^(0),Z=1 D N1
  1. SCR1 ; ENTRY POINT FROM AMQQATA
  1. S AMQQI=Z
  1. F S AMQQI=$O(^AMQQ(5,AMQQATN,2,AMQQI)) Q:'AMQQI S AMQQQ=^(AMQQI,0) D:$P(AMQQQ,U,3)="D" SCRDT D ^AMQQATR,^AMQQATL,^AMQQATS S AMQQUATN=AMQQUATN+1,AMQQUNBC=AMQQUNBC+1
  1. K AMQQATN,Z,AMQQI
  1. D LIST^AMQQ
  1. Q
  1. ;
  1. SCRDT N %,X,Y,Z,A,B S %=$P(AMQQQ,U,9)
  1. I %["NULL"!(%["ANY")!(%["ALL")!(%["EXIST") Q
  1. S Y=$P(%,";"),Z=$P(%,";",2)
  1. D SCRDT1
  1. I B'="" S A=A_";"_B
  1. S $P(AMQQQ,U,9)=A
  1. Q
  1. ;
  1. SCRDT1 S A=Y
  1. S B=Z
  1. I 'Y S X=Y D ^%DT S A=Y
  1. I Z=""!(+Z) Q
  1. S X=Z
  1. D ^%DT
  1. S B=Y
  1. Q
  1. ;
  1. SWAP S AMQQCCLS="P"
  1. S AMQQCNAM="PATIENTS"
  1. S AMQQUATN=2
  1. S AMQQILIN=0
  1. S ^UTILITY("AMQQ",$J,"LIST",.1)="W ?3,@AMQQRV,""Subject of search: PATIENTS in the COHORT"",@AMQQNV"
  1. S ^UTILITY("AMQQ",$J,"WEIGHT",-99,1)=""
  1. S %=AMQQEN31
  1. S ^UTILITY("AMQQ",$J,"Q",1)="40^COHORT^C^0^238^1^^^"_%_"^^99^^^0^"_%_";;^0"
  1. W !!,"You will now enter criteria for conducting a search on a preexisting cohort"
  1. W !,"of patients."
  1. W !!
  1. Q
  1. ;