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

APSPDUE.m

Go to the documentation of this file.
  1. APSPDUE ; IHS/DSD/ENM - ENTER DUE'S IN DRUG FILE ; [ 09/03/97 1:30 PM ]
  1. ;;6.0;IHS PHARMACY MODIFICATIONS;;09/03/97
  1. ;
  1. ; This routine will add DUE Criteria Names to the DUE Multiple
  1. ; of the Drug File. It will only add it to those drugs that
  1. ; do not already contain an Criteria Name of the same name.
  1. ; It is also used to delete Criteria names from the Drug File
  1. ; by calling APSPDUED
  1. ;
  1. ; Local Variables: APSPDUE array,%,I
  1. ; Global Variables: ^PSDRUG(, ^TMP("APSPDUE",$J,
  1. ; External calls: DIC,DIE,YN^DICN,APSPDUED
  1. ;----------------------------------------------------------
  1. START ;
  1. K ^TMP("APSPDUE",$J)
  1. D DUE ;Select Criteria Name
  1. D:$D(APSPDUE("NAME"))#2 ASK ;Ask whether the user wants to add or delete
  1. I $D(APSPDUE)#2 D:APSPDUE=2 ^APSPDUED ;Delete DUE entries from multiple
  1. I $D(APSPDUE)#2 D:APSPDUE=1 DRUG ;Select Drugs
  1. D:$D(APSPDUE("DRUGS"))#2 ADD ;Add to DUE Multiple of Drug File
  1. END D EOJ ;Clean up variables
  1. Q
  1. ;
  1. ;-------------------------------------------------------------
  1. DUE ; Do lookup of DUE Criteria name
  1. S DIC(0)="QEMA",DIC="^APSPDUE(32.1,"
  1. S DIC("A")="Select DUE Criteria Name : "
  1. D ^DIC
  1. I Y="-1" G:X=""!(X="^") DUEX G DUE
  1. S APSPDUE("NAME")=+Y
  1. D DISP ; Displays Drugs that are already marked as part of the study
  1. W !
  1. DUEX ; Exit point from DUE subroutine
  1. K DIC,DA K:X="^" APSPDUE("NAME") K X,Y
  1. Q
  1. DISP ;
  1. G:'$D(^PSDRUG("APSPCN",APSPDUE("NAME"))) DISPX
  1. W !!,"The following drugs have been marked to be part of this study",!
  1. S APSPDUE("CNT")=0
  1. F APSPDUEI=0:0 S APSPDUEI=$O(^PSDRUG("APSPCN",APSPDUE("NAME"),APSPDUEI)) Q:'APSPDUEI I $D(^PSDRUG(APSPDUEI,0)) W:'APSPDUE("CNT") ! W:APSPDUE("CNT") ?45 W $P(^(0),U,1) S APSPDUE("CNT")=(APSPDUE("CNT")+1) S:APSPDUE("CNT")=2 APSPDUE("CNT")=0
  1. W !
  1. K APSPDUEI
  1. DISPX Q
  1. ;
  1. ASK ; Ask if want to delete or add
  1. S DIR(0)="SO^1:Select Drugs to include in DUE;2:Delete DUE tags from all drugs"
  1. S DIR("B")="1"
  1. S DIR("?")=" "
  1. S DIR("?",1)="If you enter a '1' you will then be prompted to select drugs to include in your DUE "
  1. S DIR("?",2)="If you enter a '2' then all DUE tags for the selected DUE will be removed from your drug file"
  1. D ^DIR
  1. S:'$D(DTOUT)&('$D(DUOUT)) APSPDUE=$S(Y=1:"1",1:"2")
  1. ASKX ; Exit point from ASK subroutine
  1. Q
  1. ;
  1. DRUG ; Do lookup of DRUG names
  1. S DIC(0)="QEMA",DIC="^PSDRUG("
  1. S DIC("A")="Select the Drug you wish to include : "
  1. D ^DIC
  1. I Y="-1" G:X=""!(X="^") DRUGX G DRUG
  1. S %=2 W !,"Do you want to include all drugs beginning with this name "
  1. D YN^DICN
  1. I %=0 W !!,"If you enter Yes, all drugs in the drug file beginning with the first part of",!,"the drug name you selected will automatically be included.",!! G DRUG
  1. S APSPDUE("DRUGS")=$S(%=1&($D(^PSDRUG(+Y,0))#2):$P(^(0)," ",1),1:+Y)
  1. S:APSPDUE("DRUGS")]0 ^TMP("APSPDUE",$J,APSPDUE("DRUGS"))=""
  1. G DRUG
  1. DRUGX ; Exit point from DRUG subroutine
  1. K DIC,DA K:X="^" APSPDUE("DRUGS") K Y,X
  1. Q
  1. ;
  1. ADD ; Add to DUR multiple in Drug File
  1. S APSPDUE("DRUGS")=0
  1. F I=0:0 S APSPDUE("DRUGS")=$O(^TMP("APSPDUE",$J,APSPDUE("DRUGS"))) Q:APSPDUE("DRUGS")="" D:APSPDUE("DRUGS")]"@" NAMES I "@"]APSPDUE("DRUGS") D
  1. . S DIE="^PSDRUG(",DA=APSPDUE("DRUGS")
  1. . S DR="9999999.11///"_"`"_APSPDUE("NAME")
  1. . D ^DIE K DO,DA,X,Y,DIE
  1. . W "."
  1. W "Done"
  1. Q
  1. ;
  1. NAMES ; Add to DUR multiple in Drug File for Multiple Drug Entires
  1. S APSPDUE("DFN")=""
  1. S APSPDUE("CLASS")=APSPDUE("DRUGS")
  1. F I=0:0 S APSPDUE("CLASS")=$O(^PSDRUG("B",APSPDUE("CLASS"))) Q:APSPDUE("CLASS")'[APSPDUE("DRUGS") S APSPDUE("DFN")=$O(^PSDRUG("B",APSPDUE("CLASS"),"")) D
  1. . I '$D(^PSDRUG("APSPCN",APSPDUE("NAME"),APSPDUE("DFN"))),$D(^PSDRUG(APSPDUE("DFN"),0))#2 D
  1. .. S DIE="^PSDRUG(",DR="9999999.11///"_"`"_APSPDUE("NAME")
  1. .. S DA=APSPDUE("DFN")
  1. .. D ^DIE K DA,DO,DR,X,Y,DIE
  1. .. W "."
  1. Q
  1. ;
  1. EOJ ; Clean up local variables
  1. K DIC,DA,X,Y,APSPDUE,^TMP("APSPDUE",$J),%,I,DIR,DTOUT,DUOUT
  1. K APSPDUEI
  1. Q