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

AGTX0.m

Go to the documentation of this file.
AGTX0 ; IHS/ASDS/EFG - EXPORT REG DATA CONT'D ; 
 ;;7.1;PATIENT REGISTRATION;;AUG 25,2005
SETCHDFN ;EP -
 W !!?10,"NOW PROCESSING REGISTRATION TRANSACTIONS..." S DX=$X,DY=$Y+1
 S %DT="",X="T" D ^%DT S (AGDT,DT)=Y
 S:'$G(AGTXSITE) AGTXSITE=$P(^AUTTSITE(1,0),"^")
 D AGR1^AGTXST ;find last completed transmission, returned in AGLIEN
 S AGR1=$S($G(AGLIEN):$P(^AGTXST(AGTXSITE,1,AGLIEN,0),U,3),1:0)
 I AGR1,$D(AG("REGEN")) S AGR1=($P(AG("REGEN"),U,2)-.1),AGDT=$P(AG("REGEN"),U,3)+.000001
S1 K AGFDATE,AGTEMP S ^AGTXER(0)="",^AGCHDFN(0)=""
 ;WHY ARE THE ABOVE SET THEN KILLED IN THE VERY NEXT LINE?? IHS/ITSC/TPF 5/31/05 ADDED DURING ALPHA TESTING
 ;F AGTMP="^AGTXER","^AGCHDFN","^AGTXDATA" K @AGTMP
 S AGTMP="^AGTXDATA" K @AGTMP
 ;END CHANGE
 S AGTXBDT=AGR1
 S AGTXRGSV=$P(^AUTTAREA($P(^AUTTLOC($P(^AUTTSITE(1,0),U),0),U,4),0),U,3)
 X XY W "Scanning Past Errors",! H 2
 D ^AGTXPER ;>SCAN PAST ERRORS
 X XY W "Completed Past Errors",! H 2 X XY W "                         ",!
 S AGR1C=0
S1A S AGR1=$O(^AGPATCH(AGR1)),AGR1C=AGR1C+1 I ('AGR1!(AGR1'<AGDT)) K AGTXBDT Q  ;----
 I '(AGR1C#200) X XY W "FM date=",AGR1,! ;do not report every node
 S AG("SITE")=0,AGRR1=AGR1,AGDTS=AGR1
S1AA S AG("SITE")=$O(^AGPATCH(AGR1,AG("SITE"))) G S1A:AG("SITE")="",S1AA:$P(^AUTTAREA($P(^AUTTLOC(AG("SITE"),0),U,4),0),U,3)'=AGTXRGSV
 S AGR2=0
S1B S AGR2=$O(^AGPATCH(AGR1,AG("SITE"),AGR2)) G S1AA:AGR2="",S1B:$D(^(AGR2))=10,S1B:'$D(^DPT(AGR2)),S1B:$L($P(^AGPATCH(AGR1,AG("SITE"),AGR2),U,2))>6
 S DFN=AGR2
TXPER ;EP - ;>Single Pat
 I '$D(^AUPNPAT(DFN,0)) K ^AGPATCH(AGR1,AG("SITE"),AGR2) G S1B
 I $D(^AGCHDFN(DFN,"CK")) G CK ;skip if already passed AGDATCK
 S AGSITE=DUZ(2),DUZ(2)=AG("SITE") ;flip duz(2) for use with AGDATCK
 K AG("ER") S AG("DTOT")=0 I ($P(^AGPATCH(AGR1,AG("SITE"),AGR2),U,6)="") D ^AGDATCK I '$D(AG("ER")) S ^AGCHDFN(DFN,"CK")="" ;do check except for merged patients, mark if passed check
 S DUZ(2)=AGSITE ;unflip duz(2)
 I '+^AGPATCH(AGR1,AG("SITE"),AGR2),$P(^DPT(AGR2,0),U,19) K AG("ER") G S1B ;>SKIP EDIT ON MERGED PAT
 I +^AGPATCH(AGR1,AG("SITE"),AGR2),$P(^(AGR2),U,3)="",$P(^DPT(AGR2,0),U,19) K AG("ER") G S1B ;>skip del hrn trans on a merged patient
 I $G(AGTXPER),$D(AG("ER",14)) K AG("ER"),^AGPATCH("ER",AGR1,AG("SITE"),AGR2) G SA1 ;if scanning past errors and patient inactive; kill past error flag
 I $D(AG("ER")),+^AGPATCH(AGR1,AG("SITE"),AGR2) K AG("ER") ;> send HRN d/c/m
 ;I AG("DTOT")>0!($D(AG("ER"))) S:'$D(^AGTXER(AG("SITE"),DFN)) ^AGTXER(0)=^AGTXER(0)+1 S ^AGTXER(AG("SITE"),DFN)="",^AGPATCH("ER",AGDTS,AG("SITE"),DFN)="" G SA1
 ;IHS/ITSC/TPF 5/31/2005 ADDED $G TO INCREMENTING OF ^AGTXER(0) - RELATES TO CHANGE MADE TO S1+2 ABOVE
 I AG("DTOT")>0!($D(AG("ER"))) S:'$D(^AGTXER(AG("SITE"),DFN)) ^AGTXER(0)=$G(^AGTXER(0))+1 S ^AGTXER(AG("SITE"),DFN)="",^AGPATCH("ER",AGDTS,AG("SITE"),DFN)="" G SA1
 ;END CHANGE
CK S:$D(^AGPATCH("ER",AGR1,AG("SITE"),DFN)) ^(DFN)=1 ;past error was corrected and is marked for removal after tape/file is made
S1C G S1E:'$D(^AGCHDFN(AGR2,AG("SITE"),AGDTS)),SA:^AGCHDFN(AGR2,AG("SITE"),AGDTS)["^"&($P(^(AGDTS),U,3)="")
S1D I ^AGCHDFN(AGR2,AG("SITE"),AGDTS)="NEW",^AGPATCH(AGR1,AG("SITE"),AGR2)="" G SA1
S1E S ^AGCHDFN(AGR2,AG("SITE"),AGDTS)=^AGPATCH(AGR1,AG("SITE"),AGR2)
SA S AG("SUB")=$O(^AGPATCH(AGR1,AG("SITE"),AGR2,"")) F AGZ("I")=1:1 Q:((AG("SUB")="")!(AG("SUB")]"Z"))  S ^AGCHDFN(AGR2,AG("SITE"),AGDTS,AG("SUB"))=^AGPATCH(AGR1,AG("SITE"),AGR2,AG("SUB")),AG("SUB")=$O(^AGPATCH(AGR1,AG("SITE"),AGR2,AG("SUB")))
 I $D(^AGCHDFN(AGR2,AG("SITE"),AGDTS))=10 K ^AGCHDFN(AGR2,AG("SITE"),AGDTS)
SA1 I '$D(AGFDATE) S AGFDATE=$O(^AGPATCH(AGTXBDT))
 Q:$D(AGTXPER)  ;>past error
 G S1B