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

ATXPVT.m

Go to the documentation of this file.
ATXPVT ; IHS/OHPRD/TMJ -  CREATES A TEMPLATE LINKED TO V POV FILE FOR ALL ENTRIES ; 
 ;;5.1;TAXONOMY;**11**;FEB 04, 1997;Build 48
 ;IN THE V POV FILE FOR A GIVEN TAXONOMY
 ;
 S U="^",ATXFIL=9000010.07 ;ATXFIL IS IN THE INPUT TEMPLATE ATXEARCH (FILE #)
 D DT^DICRW
 D START I '$D(ATXTP) S Y="" F ATXL=0:0 Q:Y]""  D SORTEMP
 I '$D(ATXTP) D DATES
 D EOJ
 Q
 ;
START ;
 S DIC="^ATXAX(",DIC(0)="AEMQ",DIC("DR")="" D ^DIC K DIC
 I Y<1 S ATXTP=1 Q
 I $D(^TMP("ATXTAX",+Y)) W !,$C(7),"Taxonomy currently",^(+Y)," Try later.",! G START
 I '$O(^ATXAX(+Y,21,0)) W !,$C(7),"No ICD codes entered in this taxonomy!" G START
 S ATXX=+Y
 Q
 ;
SORTEMP ; ENTRY POINT - CREATES SORT TEMPLATE
 W ! S DIC="^DIBT(",DIC("DR")="[ATXEARCH]",DIC(0)="AEMQL",DLAYGO=.401,DIC("A")="Select SEARCH TEMPLATE: ",DIC("S")="I $P(^(0),U,5)=DUZ&($P(^(0),U,4)=ATXFIL)" D ^DIC K DIC I Y<0 S ATXTP="" Q
 S ATXTMP=+Y ;SAVE DFN OF TEMPLATE CHOSEN OR CREATED BY USER
 I $D(^DIBT(ATXTMP,2)) W !!,$C(7),"You cannot store results in a template used only for sort purposes." S Y="" Q
 I '$D(^DIBT(ATXTMP,1))&('$D(^DIBT(ATXTMP,"DIS"))) Q  ;NO RESULTS, NO FM SEARCH CODE
 I $D(^DIBT(ATXTMP,1)) W !!,$C(7),"Results already stored in this template.  Do you want to have",!,"the stored data deleted" S %=1 D YN^DICN
 I '$D(^DIBT(ATXTMP,1)) S %=1 ;IF A SEARCH TEMPLATE WITH NO RESULTS STORED
 I %=2 S Y="" Q
 I %=1 S DIE="^DIBT(",DA=ATXTMP,DR="[ATXDEL]" D ^DIE K DIE D TEST Q
 S Y=""
 Q
 ;
TEST ;SEE IF USER HATTED OUT OF [ATXDEL]
 I $D(ATXY) S Y="" K ATXY Q
 E  K ^DIBT(ATXTMP,1),^("DIS"),^("O") S Y=1
 Q
 ;
DATES ;ENTER RANGE OF VISIT DATES
 W !!,"Enter a range of visit dates from which to extract entries:"
ASKBD S %DT="AEX",%DT("A")="Enter beginning visit date: FIRST// " D ^%DT G:X=U A S ATXBDT=$S(X="":0,1:Y) I Y<0,X]"" G ASKBD
ASKED S %DT="AEX",%DT("A")="Enter ending visit date: LAST// " D ^%DT G:X=U A S ATXEDT=$S(X="":9999999,1:Y) I Y<0,X]"" G ASKED
 I ATXBDT>ATXEDT!(ATXEDT>DT&(ATXEDT'=9999999)) W !,"Beginning and ending dates must be prior to today, and beginning date",!,"must precede ending date.",! G ASKBD
 D ^ATXTSK
 I 'ATXTSK,'$D(ATXTP) D DFNS
A Q
 ;
ZTM ;ENTRY POINT FOR TASKMAN
 D DFNS
 I $D(ZTQUEUED) S ZTREQ="@"
 D EOJ
 Q
 ;
DFNS ;GET LO AND HIGH DFNS FOR THIS TAXONOMY
 S ATXSS=0 F ATXL=0:0 S ATXSS=$O(^ATXAX(ATXX,21,ATXSS)) Q:ATXSS'=+ATXSS  S ATXLOV=$P(^(ATXSS,0),U)_" ",ATXHIV=$P(^(0),U,2)_" " D GETVAL
 S (ATXCNT,ATXDOLO)=0 F L=0:0 S ATXDOLO=$O(^DIBT(ATXTMP,1,ATXDOLO)) Q:ATXDOLO=""  S ATXCNT=ATXCNT+1
 W !!,"There ",$S(ATXCNT'=1:"were ",1:"was "),ATXCNT,$S(ATXCNT'=1:" entries",1:" entry")," in the ",$P(^DIBT(ATXTMP,0),U)," template."
 S ^DIBT(ATXTMP,1,0)=ATXCNT
 K ^TMP("ATXSEARCH",$J)
 D:$D(ATXPAT) EOJ
 Q
 ;
GETVAL ;GET RANGE OF DFNS
 K ^TMP("ATXSEARCH",$J)
 S ATXDFN=$O(^ICD9("BA",ATXLOV,"")),^TMP("ATXSEARCH",$J,ATXDFN)=""
 I ATXHIV=ATXLOV D LOOP Q
 F ATXL=0:0 S ATXLOV=$O(^ICD9("BA",ATXLOV)) Q:ATXLOV](ATXHIV)!(ATXLOV="")  S ATXDFN=$O(^ICD9("BA",ATXLOV,""))
 D LOOP
 Q
 ;
LOOP ;GET DFNS FROM V POV FILE FOR THIS ICD CODE DFN
 ;STORE IN APPROPRIATE TEMPLATE
 S ATXPV=0
 S ATXVIS=(ATXBDT-1)_.999999
 F ATXL=0:0 S ATXVIS=$O(^AUPNVSIT("B",ATXVIS)) Q:ATXVIS>(ATXEDT_.9999)!(ATXVIS="")  S ATXVDFN=$O(^(ATXVIS,"")),ATXPV=$O(^AUPNVPOV("AD",ATXVDFN,"")) I ATXPV,$D(^TMP("ATXSEARCH",$J,+^AUPNVPOV(ATXPV,0))) D @$S($D(ATXPAT):"PAT",1:"POV")
 Q
 ;
POV ;CREATES NODES FOR LINKAGE TO V POV FILE
 W:'ATXTSK "."
 S ^DIBT(ATXTMP,1,ATXPV)=""
 Q
 ;
PAT ;CREATES NODES FOR LINKAGE TO V POV FILE
 W:'ATXTSK "."
 S ATXPAT=$P(^AUPNVPOV(ATXPV,0),U,2) S:ATXPAT]"" ^DIBT(ATXTMP,1,ATXPAT)=""
 Q
 ;
EOJ ;
 K ATXFIL,ATXL,ATXTP,ATXSTP,ATXTMP,ATXX,ATXHI,ATXLOV,ATXLO,ATXPV,ATXDFN,ATXBDT,ATXEDT,ATXDTE,ATXCNT,ATXTSK,ATXDOLO,ATXSS,ATXVDFN
 K %,%DT
 Q
 ;