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

AMQQTX.m

Go to the documentation of this file.
AMQQTX ; IHS/CMI/THL - MAKES AD HOC TAXONOMY ;
 ;;2.0;IHS PCC SUITE;**11**;MAY 14, 2009;Build 58
VAR S AMQQURGN=AMQQURGN+1
 S AMQQTTOT=0
 S AMQQTAX=AMQQURGN
 S AMQQTAXT=$P(^AMQQ(5,AMQQATN,0),U,14)
 S AMQQCTXS=0
 S AMQQTGBL=$P(AMQQTLOK,"(")
 S AMQQHILO="^UTILITY(""AMQQ"",$J,""HILO"")"
 I AMQQTLOK["," S AMQQTGBL=$P(AMQQTLOK,",")_")"
 K AMQQISYS
 I $P(^AMQQ(1,AMQQLINK,0),U,7) S AMQQMULT="",AMQQCTXS=1
 K AMQQTXTR
 I $D(^AMQQ(1,AMQQLINK,4,1,1)) S AMQQTXTR=^(1)
 I '$D(AMQQMULT),$G(AMQQONE)'="" S AMQQTAX=AMQQURGN,AMQQCOMP=";;;"_AMQQTAX_";ALL",^UTILITY("AMQQ TAX",$J,AMQQURGN,"*")="" G EXIT
GET K AMQQSCMP
 I AMQQTAXT=4 S %=^AMQQ(1,AMQQLINK,0),%=$P(%,U,6),%=^DD(+%,$P(%,",",2),0),%=";"_$P(%,U,3),AMQQSSET=%
 D @("EN"_AMQQTAXT_"^AMQQTXG")
 I $D(AMQQQUIT) G EXIT
 I $D(AMQQSCMP) D SCMP G EXIT
 I '$D(^UTILITY("AMQQ TAX",$J,AMQQURGN)) K AMQQTAX S AMQQURGN=AMQQURGN-1 W !! G EXIT
SAVE I AMQQTTOT<2 S %="" F I=0:1 S %=$O(^UTILITY("AMQQ TAX",$J,AMQQURGN,%)) Q:%=""  I I=2 S AMQQTTOT=I Q
 I AMQQTTOT>1 D ^AMQQTX0 I $D(AMQQQUIT) G EXIT
 S AMQQTAX=AMQQURGN
 I $D(AMQQTLFL) K AMQQTLFL G EXIT
 S $P(AMQQCOMP,";",4)=AMQQURGN
EXIT I $G(AMQQTAX)="" K AMQQTAX,AMQQTXGR,AMQQCOMP,AMQQB
 S X=$G(AMQQATNM)
 K AMQQTNAR,AMQQTTX,AMQQTTOT,AMQQTDIC,AMQQTGNO
 K AMQQPOV1,AMQQPOV2,AMQQTLOK,AMQQTGNA,AMQQTGNO,AMQQTAXT,AMQQTXTR,DIPGM,^UTILITY("AMQQ RANGE",$J),^UTILITY("AMQQ DELETE",$J),@AMQQHILO,AMQQTGBL,AMQQSCMP,AMQQSSET,AMQQHILO,%,%Y,A,B,I,Z
 I $D(AMQQDF) S AMQQQUIT=""
 Q
 ;
SCMP ; ENTRY POINT FROM AMQQ0
 I AMQQSCMP'="NULL",AMQQSCMP'="INVERSE" K ^UTILITY("AMQQ TAX",$J,AMQQURGN) S ^(AMQQURGN,"*")=""
 S AMQQCOMP=";;;"_AMQQURGN_";"_AMQQSCMP
 S AMQQTAX=AMQQURGN
 F %="NULL","INVERSE" I AMQQSCMP=% S ^UTILITY("AMQQ TAX",$J,AMQQURGN,$S(%="NULL":"-",1:"--"))="" Q
 Q
 ;
WHATG ; ENTRY POINT FROM AMQQTX SUBROUTINES
 N DIC,DZ,D,A,B
 S DIC="^ATXAX("
 S DIC(0)=""
 S D="B"
 S DIC("S")="I $P(^(0),U,12)=AMQQLINK"
 S DZ="??"
 D DQ^DICQ
 Q
 ;
LIST ; ENTRY POINT FROM AMQQTX SUBROUTINES
 I $O(^UTILITY("AMQQ TAX",$J,AMQQURGN,""))="" W !!,?($D(AMQQZNM)*5),"  You have not made a selection yet...Try again",!! Q
 S %="The following have been selected =>"
 W !!,%,!
 S (%,X)=""
 F I=1:1 S %=$O(^UTILITY("AMQQ TAX",$J,AMQQURGN,%)) Q:%=""  W ! D:'(I#(IOSL-4)) LIST1 Q:X=U  S X=% D
 .I $G(AMQQTTX)="" X:$D(AMQQTXTR) AMQQTXTR W ?5,X Q
 .I $G(AMQQTTX)]"" X AMQQTTX W ?5,X
 S AMQQTTOT=AMQQTTOT+I
 W !!
 Q
 ;
LIST1 W "<>"
 R X:DTIME
 W $C(13),?5,$C(13)
 Q
 ;
SET ; ENTRY POINT FROM AMQQTX SUBROUTINES
 S Y=1
 I $D(AMQQTXEX) W "  (DELETED)" K AMQQTXEX,^UTILITY("AMQQ TAX",$J,AMQQURGN,X) Q
 S ^UTILITY("AMQQ TAX",$J,AMQQURGN,X)=""
 I AMQQTLOK="^PSDRUG(" D DCLASS
 I AMQQTLOK="^AUTTREFT(" D REFT
 Q
 ;
DCLASS ; Handles drug classes
 N AMQQCLAS,I
 I $D(^PSDRUG(X,"ND")) S AMQQCLAS=$P(^("ND"),U,6) I AMQQCLAS
 E  Q
 I '$D(^UTILITY("AMQQ DRUG CLASS",$J,AMQQURGN,AMQQCLAS))
 E  Q
 W !
 S DIR("A")="Do you want meds that are members of the same class as this medication"
 S DIR(0)="Y"
 D ^DIR
 K DIR
 W !
 I Y=1
 E  Q
 S ^UTILITY("AMQQ DRUG CLASS",$J,AMQQURGN,AMQQCLAS)=""
 S I=0
 F  S I=$O(^PSDRUG("VAC",AMQQCLAS,I)) Q:'I  I '$D(^UTILITY("AMQQ TAX",$J,AMQQURGN,I)) S ^(I)=""
 Q
 ;
NULL ; ENTRY POINT FROM AMQQTX SUBROUTINES
 N AMQQNNAM
 S AMQQNNAM=$S($E(AMQQCNAM,$L(AMQQCNAM))="S":$E(AMQQCNAM,1,$L(AMQQCNAM)-1),1:AMQQCNAM)
 I $D(^UTILITY("AMQQ TAX",$J,AMQQURGN)) G N0
 W !,"Do you want me to find all ",AMQQNNAM,"S with no ",AMQQTNAR," entered"
 S %=1
 D YN^DICN
 I $D(DTOUT) S %Y=U
 I $E(%Y)=U S AMQQQUIT="" K DTOUT,DUOUT Q
 I "Yy"[$E(%Y) S AMQQSCMP="NULL" Q
 W !,"Well then..."
N0 I AMQQCTXS W !,"I take it you want me to search for only those ",AMQQNNAM,"S who DO NOT have",!,"any ",AMQQTNAR,"S in this taxonomy" G N1
 W !,"I take it you want me to find only those ",AMQQNNAM,"S whose",!,AMQQTNAR," is NOT in this taxonomy"
N1 S %=1
 D YN^DICN
 I $D(DTOUT) S %Y=U
 I $E(%Y)=U S AMQQQUIT="" Q
 I %Y="" S %Y="Y"
 I "yY"[$E(%Y) S AMQQSCMP="INVERSE"
 W !
 Q
 ;
EN1 ; PROGRAMMER ENTRY POINT FOR TAXONOMY SYSTEM
 N %,A,AMQQ,AMQQA,AMQQATN,AMQQB,AMQQCASE,AMQQCLAS,AMQQCNT,AMQQCOMP,AMQQCTXS,AMQQDF,AMQQDFN,AMQQDONE,AMQQECHO,AMQQHEL1,AMQQHELP,AMQQHILO,AMQQI,AMQQLINK,AMQQLKUP,AMQQLMOR,AMQQMULT,AMQQNDB,AMQQNDBC,AMQQNECO,AMQQNEXT,AMQQNNAM,AMQQNTAX
 N AMQQONE,AMQQPOV1,AMQQPOV2,AMQQQUIT,AMQQR,AMQQSAVE,AMQQSCMP,AMQQSHNO,AMQQSQSJ,AMQQSSET,AMQQSTP,AMQQSUB,AMQQTAXI,AMQQTAXT,AMQQTDIC,AMQQTGBL,AMQQTGFG,AMQQTGNA,AMQQTGNO,AMQQTJMP,AMQQTLFL,AMQQTLOK,AMQQTNAR,AMQQTTOT,AMQQTTX,AMQQTXEX
 I '$D(APCLCRIT) NEW AMQQSQNM
 N AMQQTXGR,AMQQTXTR,AMQQTYP,AMQQVAL,AMQQX,AMQQXX,AMQQXXN,AMQQXXTT,AMQQZNM,B,C,D,DA,DIADD,DIC,DIE,DIK,DINUM,DIPGM,DIR,DLAYGO,DR,DTOUT,DUOUT,DZ,I,N,T,Y,Z,ATXFLG,AMQQATNM
 S AMQQATN=X
 S %=^AMQQ(5,X,0)
 S AMQQTTX=$G(^(3))
 S AMQQLINK=$P(%,U,5)
 S AMQQTNAR=$P(%,U,15)
 S AMQQTDIC=U_$P(%,U,16)
 S AMQQTLOK=U_$P(%,U,18)
 S AMQQATNM=$P(%,U)
 S AMQQURGN=+$G(AMQQURGN)
 K ^UTILITY("AMQQ TAX",$J,AMQQURGN+1)
 I '$G(IOSL) S IOSL=24
 D AMQQTX
 I +$G(AMQQTAX),'$D(^UTILITY("AMQQ TAX",$J,AMQQTAX)) K AMQQTAX
 Q
 ;
REFT ;FIND SPECFIC TYPE OF REFUSAL
 W !!
 N REFT
 S REFT=X
 N AMQQQUIT,X,Y
 F  D REFT1 Q:$D(AMQQQUIT)
 W !!
 Q
REFT1 N GLDA,GL,GLNAM
 S GLDA=$P($G(^AUTTREFT(REFT,0)),U,2)
 S GL=$G(^DIC(+GLDA,0,"GL"))
 S GLNAM=$P($G(^DIC(+GLDA,0)),U)
 S GLN=$S($E(GL,$L(GL))="(":$E(GL,1,$L(GL)-1),1:$E(GL,1,$L(GL)-1)_")")
 Q:GL=""
 N DIC
 S DIC=GL
 S DIC(0)="AEMQZ"
 S DIC("A")="Select "_GLNAM_" refused: "
 S DIC("S")="I $D(^AUPNPREF(""AE"",+GLDA,+Y))"
 D ^DIC
 I Y<1 S AMQQQUIT="" Q
 S ^UTILITY("AMQQ TAX",$J,AMQQURGN,REFT,"REFUSAL",+Y)=""
 S ^UTILITY("AMQQ TAX",$J,AMQQURGN)="REFUSAL"
 Q