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

AMHRSTMP.m

Go to the documentation of this file.
  1. AMHRSTMP ; IHS/CMI/LAB - CREATE SEARCH TEMPLATE FOR REPORTS ;
  1. ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
  1. ;
  1. EN ;EP - ENTRY POINT
  1. D EN1
  1. EXIT K AMHRSDIC,AMHRSNAM,AMHRSTN,DHD
  1. Q
  1. EN1 ;EP Help
  1. K AMHRQUIT
  1. W !
  1. W ?10,"*** You may enter an existing Template Name ***",! W ?30,"OR",! W ?12,"*** Save results in a New Template ***",! W ?30,"OR",! W ?25,"'^' to Exit",!!
  1. EN2 K DIC,DLAYGO S DLAYGO=.401,DIC="^DIBT(",DIC(0)="AELMQZ",DIC("A")="Patient Search Template: ",DIC("S")="I $P(^(0),U,4)=9000001&($P(^(0),U,5)=DUZ)"
  1. W !
  1. D ^DIC K DIC,DLAYGO
  1. I +Y<1 W !!,"No Search Template selected." H 2 S AMHRQUIT=1 Q
  1. S AMHRSTMP=+Y,AMHRSNAM=$P(^DIBT(AMHRSTMP,0),U)
  1. DUP I '$P(Y,U,3) D I Q K AMHRSTMP,Y G EN2
  1. .S Q=""
  1. .W !!,$C(7),$C(7)
  1. .S DIR(0)="Y",DIR("A")="That template already exists!! Do you want to overwrite it",DIR("B")="N" K DA D ^DIR K DIR
  1. .I $D(DIRUT) S Q=1 Q
  1. .I 'Y S Q=1 Q
  1. .L +^DIBT(AMHRSTMP):10
  1. .S AMHRSTN=$P(^DIBT(AMHRSTMP,0),U) S DA=AMHRSTMP,DIK="^DIBT(" D ^DIK
  1. .S ^DIBT(AMHRSTMP,0)=AMHRSNAM,DA=AMHRSTMP,DIK="^DIBT(" D IX1^DIK
  1. .L -^DIBT(AMHRSTMP)
  1. .Q
  1. I AMHRSTMP,$D(^DIBT(AMHRSTMP)) D
  1. .W !!,?5,"An unduplicated PATIENT list resulting from this report",!,?5,"will be stored in the.........>",!!?18,"** ",AMHRSNAM," ** Search Template."
  1. .K ^DIBT(AMHRSTMP,1)
  1. .S DHIT="S ^DIBT("_AMHRSTMP_",1,DFN)="""""
  1. .S DIE="^DIBT(",DA=AMHRSTMP,DR="2////"_DT_";3////M;4////9000001;5////"_DUZ_";6////M"
  1. .D ^DIE
  1. .K DIE,DA,DR
  1. Q