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

ATXENP.m

Go to the documentation of this file.
ATXENP ; IHS/OHPRD/TMJ -  CREATES AND ENTERS PTS INTO PT TAXONOMY FILE ; 
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;
 D INIT
 D START
 D EOJ
 Q
 ;
INIT ;
 D ^XBKVAR
 S U="^"
 Q
 ;
START ;
 K ATXTRT
 S DIC="^ATXAX(",DIC(0)="AEMQ",DIC("S")="I $P(^(0),U,8)" D ^DIC K DIC
 I Y<1 Q
 I $O(^ATXPAT(+Y,11,0)) W !,$C(7),"Patients already entered under this taxonomy in the Pt Taxonomy file!" G START
 I '$O(^ATXAX(+Y,21,0)) W !,$C(7),"ICD Codes have not been entered into this taxonomy!" G START
 S ATXX=+Y
 I $D(^TMP("ATXTAX",ATXX)) W !,$C(7),"Taxonomy now",^(ATXX)," Try later." G START
 I $P(^ATXAX(ATXX,0),U,6)=""!('$O(^ATXPAT(+Y,11,0))) S DIE="^ATXAX(",DR=".06;.18",DA=ATXX D ^DIE K DIE,DR,DA
 I '$P(^ATXAX(ATXX,0),U,6) W !,$C(7),"You have no date for entries to be added to the PT TAXONOMY file.",!,"Entries will not be made until a date is indicated." Q
 I $D(Y) Q
 I '$D(^ATXPAT(ATXX,0))#2 S DIADD="",DIC="^ATXPAT(",DIC(0)="L",X="`"_ATXX,DIC("DR")=".02////"_DT_";.03////"_DUZ D ^DIC K DIADD,DIC,DR S ^ATXPAT(ATXX,11,0)="^9002227.01101PA^0^0"
 I $P(^ATXAX(ATXX,0),U,6)'<(DT+1) Q
 D TSKMN
 Q
 ;
TSKMN ;EP
 W !!,$C(7),"Entries for this taxonomy into the Pt Taxonomy file, will now occur via Taskman",!,"in background!"
 S ^TMP("ATXTAX",ATXX)=" having patients entered into the Pt Taxonomy file."
 K ZTSAVE F %="ATXX" S ZTSAVE(%)=""
 S ZTRTN="ZTM^ATXENP",ZTDESC="ENTER PTS INTO PT TAX FILE",ZTIO="",ZTDTH=DT D ^%ZTLOAD K ZTSK
 Q
 ;
ZTM ;ENTRY POINT FOR TASKMAN
 D DFNS
 K ^TMP("ATXTAX",ATXX)
 I $D(ZTQUEUED) S ZTREQ="@"
 D EOJ
 Q
 ;
DFNS ;
 S ATXSS=0 F ATXL=0:0 S ATXSS=$O(^ATXAX(ATXX,21,ATXSS)) Q:ATXSS'=+ATXSS  S ATXLOV=$P(^(ATXSS,0),U) S:ATXLOV'[" " ATXLOV=ATXLOV_" " S ATXHIV=$P(^(0),U,2) S:ATXHIV'[" " ATXHIV=ATXHIV_" " D GETVAL ;ACC 1/20/94 PUT IN CHECKS FOR " "
 Q
 ;
GETVAL ;GET RANGE OF DFNS
 S ATXDFN=$O(^ICD9("BA",ATXLOV,"")) D LOOP
 Q:ATXHIV=ATXLOV
 F ATXL=0:0 S ATXLOV=$O(^ICD9("BA",ATXLOV)) Q:ATXLOV](ATXHIV)  S ATXDFN=$O(^ICD9("BA",ATXLOV,"")) D LOOP
 Q
 ;
LOOP ;GET PTS FROM V POV FILE FOR THIS ICD CODE DFN
 Q:ATXDFN=""
 S ATXPV=0
 F ATXL=0:0 S ATXPV=$O(^AUPNVPOV("B",ATXDFN,ATXPV)) Q:ATXPV'=+ATXPV  S ATXPD=$P(^AUPNVPOV(ATXPV,0),U,2) D ADD
 Q
 ;
ADD ;ADDS PTS TO TAXONOMY IN PT TAXONOMY FILE
 Q:'$D(^ATXPAT(ATXX,0))#2
 S ATXVIS=$P(^AUPNVPOV(ATXPV,0),U,3),ATXVIS=$P($P(^AUPNVSIT(ATXVIS,0),U),".") Q:ATXVIS<$P(^ATXAX(ATXX,0),U,6)
 I $D(^ATXPAT(ATXX,11,ATXPD)) S $P(^(0),U,2)=$P(^(ATXPD,0),U,2)+1 Q
 S ^ATXPAT(ATXX,11,ATXPD,0)=ATXPD_"^1"
 S $P(^ATXPAT(ATXX,11,0),U,3)=AT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