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

BCHDLA.m

Go to the documentation of this file.
  1. BCHDLA ; IHS/TUCSON/LAB - DOWNLOAD PATIENT DATA TO REMOTE ; [ 06/17/02 7:27 AM ]
  1. ;;1.0;IHS RPMS CHR SYSTEM;**16**;OCT 28, 1996
  1. ;
  1. ;Routine to create a file of records containing patient
  1. ;demographic information to be downloaded to a remote computer.
  1. ;See START sub-routine for explanation.
  1. ;
  1. START ;EP
  1. W:$D(IOF) @IOF
  1. W !!?9,"**** DOWNLOAD NEW AND CHANGED PATIENT DEMOGRAPHIC DATA TO REMOTE ****",!!
  1. W !,"This option is used to download new and changed patient demographic"
  1. W !,"data to the CHR remote computer. This routine is to be run"
  1. W !,"periodically and in coordination with the CHR program."
  1. W !,"This file will be placed in the same directory that all export"
  1. W !,"files are placed. In most cases, that will be /usr/spool/uucppublic."
  1. W !,"See your site manager for assistance in finding the file once it has"
  1. W !,"been created.",!!,"Once you get the file it needs to be forwarded"
  1. W !,"to the CHR."
  1. ;
  1. S BCHDLDT=$P($G(^BCHSITE(DUZ(2),0)),U,15)
  1. I BCHDLDT="" W !!,"A first time patient download has never been done for" D D XIT Q
  1. .W !,$P(^DIC(4,DUZ(2),0),U)," before. Please use the first time download"
  1. .W !,"option to download the patient data."
  1. W !!!,"Patients entered or changed after "_$$FMTE^XLFDT($P($G(^BCHSITE(DUZ(2),0)),U,15))," will be downloaded.",!
  1. CONT ;
  1. K DIR S DIR(0)="Y",DIR("A")="Do you wish to continue and create a download patient file",DIR("B")="N" K DA D ^DIR K DIR
  1. G:$D(DIRUT) XIT
  1. G:'Y XIT
  1. FACHRN ;
  1. ;W !!
  1. ;W !,"Only patients who have an HRN at the facility you select below will",!,"be downloaded.",!
  1. ;S DIC=9999999.06,DIC(0)="AEMQ",DIC("A")="Which FACILITY's HRN should pass to the remote? ",DIC("B")=$P(^DIC(4,DUZ(2),0),U) D ^DIC K DIC,DA,DR
  1. ;I Y=-1 G START
  1. ;S BCHFAC=+Y
  1. CHR ;
  1. ;S BCHCHR=""
  1. ;S DIR(0)="90002,.03",DIR("A")="For which CHR is the file being created" K DA D ^DIR K DIR
  1. ;G:$D(DIRUT) XIT
  1. ;I Y="" G XIT
  1. ;S BCHCHR=+Y
  1. ADD ;
  1. D ADD1^BCHRL01
  1. I $D(BCHQUIT) G XIT
  1. D SCREEN
  1. I $D(BCHQUIT) D DEL^BCHRL G XIT
  1. CONFIRM ;
  1. W !!,"The file(s) created will be placed in the ",$S($P(^AUTTSITE(1,0),U,21)=1:"/usr/spool/uucppublic",1:"C:\EXPORT")," directory."
  1. W !,"The file will be called: ",BCHFILE,!
  1. W !!,"It may be several hours (or overnight) before your flat file is finished.",!
  1. W !,"As a reminder, the records that are generated and placed in the file(s)"
  1. W !,"are in a standard, pre-defined record format. For a definition of the format",!,"please see your user manual.",!
  1. K DIR 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 BCHQUIT=1 G XIT
  1. S DA=BCHRPT,DR=".12///"_BCHFILE,DIE="^BCHTRPT(" D ^DIE
  1. K DIE,DA,DR
  1. ZIS ;call to xbdbque
  1. D XIT
  1. QUEUE ;EP
  1. K ZTSK
  1. S DIR(0)="Y",DIR("A")="Do you want to QUEUE this to run at a later time",DIR("B")="Y" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I Y=1 D QUEUE1,XIT,XIT1 Q
  1. I $D(DIRUT) W !,"Okay .. you '^'ed or timed out ..Goodbye" D XIT,XIT1 Q
  1. D WAIT^DICD,^BCHDLA1,XIT,XIT1
  1. Q
  1. QUEUE1 ;
  1. S XBRC="^BCHDLA1",XBRX="XIT^BCHDLA",XBNS="BCH;IO*",XBIOP="HOME",XBFQ=1
  1. D ^XBDBQUE
  1. D XIT,XIT1
  1. Q
  1. SCREEN ;EP
  1. S X2=$E(DT,1,3)_"0101",X1=DT D ^%DTC S BCHJD=X+1
  1. S BCHPTVS="P",BCHTYPE="P",BCHFILE="bchpts"_$TR($$NOW^XLFDT,".","")_".txt"
  1. D SMENU
  1. S DIR(0)="LO^1:"_BCHHIGH,DIR("A")="Select Patients based on which of the above" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. G:Y="" XIT
  1. I $D(DIRUT) G XIT
  1. ;process all items in Y
  1. D SELECT^BCHRL0
  1. D SHOW^BCHRLS
  1. W !! S DIR(0)="Y",DIR("A")=" Would you like to select additional "_$S(BCHPTVS="P":"PATIENT",1:"CHR RECORD")_" criteria",DIR("B")="NO" D ^DIR K DIR
  1. S:$D(DUOUT) DIRUT=1
  1. I $D(DIRUT) S BCHQUIT=1 Q
  1. Q:Y=0
  1. G SCREEN
  1. ;
  1. SMENU ;EP
  1. K BCHDISP,BCHSEL,BCHHIGH
  1. I $Y>(IOSL-8) W:$D(IOF) @IOF
  1. W !!,"The Patients downloaded can be selected based on any of the following criteria:",!
  1. S BCHHIGH=0,X=0 F S X=$O(^BCHSORT("AD",1,X)) Q:X'=+X S BCHHIGH=BCHHIGH+1,BCHSEL(BCHHIGH)=X
  1. S BCHCUT=((BCHHIGH/2)+.5)\1
  1. S I=0,J=1 F S I=$O(BCHSEL(I)) Q:I'=+I!($D(BCHDISP(I))) D
  1. .W !?5,I,") ",$E($P(^BCHSORT(BCHSEL(I),0),U),1,30) S BCHDISP(I)=""
  1. .S J=I+BCHCUT I $D(BCHSEL(J)),'$D(BCHDISP(J)) W ?40,J,") ",$E($P(^BCHSORT(BCHSEL(J),0),U),1,30) S BCHDISP(J)=""
  1. W !!?9,"<Enter a list or a range. E.g. 1-4,5,20 or 10,12,20,30>"
  1. W !?9,"<<HIT RETURN to conclude selections or bypass screens>>"
  1. Q
  1. XIT ;clean up and exit
  1. K BCHSEL,BCHHIGH,BCHDISP,BCHQUIT,BCHANS,BCHCRIT,BCHCUT,BCHGBD,BCHGDE,BCHGDS,BCHI,BCHRAR,BCHTEXT,BCHY,BCHCNT
  1. K AMQQTAX
  1. K BCHFOUN,BCHJD,BCHPCNT,BCHPROC,BCHR,BCHSKIP,BCHX
  1. K D,D0,DIC,DFN,DI,DQ,J,XBFLG,Y
  1. Q
  1. XIT1 ;
  1. K BCHRPT,BCHPTVS,BCHTYPE,BCHCHR,BCHFILE
  1. Q