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

AMHRL3.m

Go to the documentation of this file.
  1. AMHRL3 ; IHS/CMI/LAB - LISTER ;
  1. ;;4.0;IHS BEHAVIORAL HEALTH;;MAY 14, 2010
  1. ;
  1. ;
  1. COUNT ;EP
  1. W !! S DIR(0)="S^T:Total Count Only;S:Sub-counts and Total Count;D:Detailed Listing"_$S(AMHPTVS="V":";F:Flat ASCII file (pre-defined record format)",1:"")
  1. S DIR("A")="Choose Type of Report",DIR("B")="D" D ^DIR K DIR W !!
  1. S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) S AMHQUIT=1 Q
  1. S AMHCTYP=Y
  1. I AMHCTYP="T" S $P(^AMHTRPT(AMHRPT,0),U,5)=1 S:AMHPTVS="V" AMHSORT=19,AMHSORV="Encounter Date" S:AMHPTVS="P" AMHSORT=70,AMHSORV="Patient Name" S:AMHPTVS="S" AMHSORT=129,AMHSORV="Date of Suicide Act" Q
  1. I AMHCTYP="D" D PRINT Q:$D(AMHQUIT) D SORT Q
  1. I AMHCTYP="F" D FLAT S:AMHPTVS="S" AMHSORT=129,AMHSORV="Date of Suicide Act" Q:$D(AMHQUIT) S $P(^AMHTRPT(AMHRPT,0),U,5)=1 S:AMHPTVS="V" AMHSORT=19,AMHSORV="Encounter Date" S:AMHPTVS="P" AMHSORT=70,AMHSORV="Patient Name" Q
  1. D SORT
  1. Q
  1. PRINT ;
  1. S AMHCNTL="P" D ^AMHRL4
  1. Q
  1. SORT ;
  1. K AMHSORT,AMHSORV,AMHQUIT
  1. I AMHCTYP="D",'$D(^AMHTRPT(AMHRPT,12)) W !!,"NO PRINT FIELDS SELECTED!!",$C(7),$C(7) S AMHQUIT=1 Q
  1. S AMHSORT=""
  1. D SHOWR^AMHRLS
  1. S AMHCNTL="R" D ^AMHRL4 K AMHCNTL
  1. I '$D(AMHSORV) S AMHQUIT=1 Q
  1. Q:AMHCTYP'="D"
  1. PAGE ;
  1. K AMHSPAG
  1. Q:AMHCTYP'="D"
  1. S DIR(0)="Y",DIR("A")="Do you want a separate page for each "_AMHSORV,DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) G SORT
  1. S AMHSPAG=Y,DIE="^AMHTRPT(",DA=AMHRPT,DR=".04///"_AMHSPAG D CALLDIE^AMHLEIN
  1. Q
  1. FLAT ;
  1. S AMHFILE="AMH"_DUZ_"."
  1. S X2=$E(DT,1,3)_"0101",X1=DT D ^%DTC S AMHJD=X+1
  1. S AMHFILE=AMHFILE_AMHJD
  1. W !!,"I am going to create a file called ",AMHFILE," which will reside in ",!,"the ",$S($P(^AUTTSITE(1,0),U,21)=1:"/usr/spool/uucppublic",1:"C:\EXPORT")," directory.",!
  1. W "Actually, the file will be placed in the same directory that the data export"
  1. W !,"globals are placed. See your site manager for assistance in finding the file",!,"after it is created. PLEASE jot down and remember the following file name:",!?15,"********** ",AMHFILE," **********",!
  1. W "It may be several hours (or overnight) before your report and flat file are ",!,"finished.",!
  1. W !,"As a reminder, the records that are generated and placed in file ",AMHFILE,!
  1. W !,"are in a standard, pre-defined record format. For a definition of the format",!,"please see your user manual.",!
  1. S DIR(0)="Y",DIR("A")="Is everything ok? Do you want to continue?",DIR("B")="Y" K DA D ^DIR K DIR
  1. I $D(DIRUT)!(Y'=1) S AMHQUIT=1 Q
  1. S DA=AMHRPT,DR=".12///"_AMHFILE,DIE="^AMHTRPT(" D ^DIE
  1. K DIE,DA,DR
  1. Q