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

AGVALID.m

Go to the documentation of this file.
AGVALID ; IHS/ASDS/EFG - PATIENTS WITH INVALID PRIMARY DATA ;    
 ;;7.1;PATIENT REGISTRATION;**5**;AUG 25,2005
 ;
 S AGIO=IO,AG("HAT")=""
DEV S %ZIS="OPQ" D ^%ZIS I POP S IOP=ION D ^%ZIS Q
 G:'$D(IO("Q")) START K IO("Q") I $D(IO("S"))!($E(IOST)'="P") W *7,!,"Please queue to system printers." D ^%ZISC G DEV
 X ^%ZOSF("UCI") S ZTRTN="START^AGVALID",ZTUCI=Y,ZTDESC="PATIENTS WITH INVALID DATA for "_$P(^AUTTLOC(DUZ(2),0),U,2)_".",ZTSAVE=""
 D ^%ZTLOAD G:'$D(ZTSK) DEV K AG,AGIO,ZTDESC,ZTRTN,ZTSK,ZTUCI D ^%ZISC
 Q
START ;EP - From TaskMan.
 S (DFN,AGPGPG,AGTOTAL)=0
 S X=$P(^DIC(4,DUZ(2),0),U) D CTR^AG
 S AG("LOC")=X,AG("USR")=$P(^VA(200,DUZ,0),U)
 S AG("LINE")="="
 S AGBM=IOSL-10
 I $D(AGIO),AGIO=IO S AGBM=IOSL-4
 X ^%ZOSF("UCI") S X="UCI: "_$P(Y,",") D CTR^AG S AGUCI=X
 U IO D NOW^AG S X="as of "_AGTIME D CTR^AG S AGTIME=X D HDR
B2 S DFN=$O(^DPT(DFN))
 G END:DFN]"@",B2:'$D(^AUPNPAT(DFN,41,DUZ(2),0)),B2:$P(^(0),U,3)]""
 S DA=DFN
 F AG=1,6,12,19,28,36,51,57,64,71 S AGTAB(AG)=1
 I $D(^DPT(DFN,0)) D
 .S:$P(^(0),U,3)]"" AGTAB(1)=0
 .S:$P(^(0),U,2)]"" AGTAB(6)=0 ;DOB & SEX
 I $D(^AUPNPAT(DFN,11)) D
 .I $P(^AUPNPAT(DFN,11),U,8)]"",$D(^AUTTTRI($P(^AUPNPAT(DFN,11),U,8))) D
 ..S AGTAB(12)=0 ;Tribe Of Membership
 I $D(^AUPNPAT(DFN,11)) D
 .;Indian Blood Quantum & Current Community
 .S:$P(^(11),U,10)]"" AGTAB(19)=0
 .S:$P(^(11),U,18)]"" AGTAB(28)=0
 I $D(^AUPNPAT(DFN,11)),$P(^(11),U,11)]"",$D(^AUTTBEN($P(^(11),U,11))) D
 .S AGTAB(36)=0 ;Classification/Beneficiary
 ;mailing address
 I $D(^DPT(DFN,.11)) D
 .S AGR=$G(^DPT(DFN,.11))
 .I $P(AGR,U)]"",$P(AGR,U,4)]"",$P(AGR,U,5)]"",$P(AGR,U,6)]"" S AGTAB(64)=0
 ;emergency contact
 I $D(^DPT(DFN,.33)) D
 .S AGR=$G(^DPT(DFN,.33))
 .S $P(AGR,U,2)=$P($G(^AUPNPAT(DFN,31)),U,2)  ;IHS/SD/TPF 5/13/2009 AG*7.1*5 H4639  
 .I $P(AGR,U)]"",$P(AGR,U,2)]"",$P(AGR,U,3)]"",$P(AGR,U,6)]"",$P(AGR,U,7)]"",$P(AGR,U,8)]"",$P(AGR,U,9)]"" S AGTAB(57)=0
 ;next of kin
 I $D(^DPT(DFN,.21)) D
 .S AGR=$G(^DPT(DFN,.21))
 .I $P(AGR,U)]"" S AGTAB(51)=0
 ;home phone
 I $D(^DPT(DFN,.13)) D
 .I $P(^DPT(DFN,.13),U)]"" S AGTAB(71)=0
WRITE ;
 S (AG,AGFLAG)=""
 F  S AG=$O(AGTAB(AG)) Q:AG=""  I $G(AGTAB(AG))=1 S AGFLAG=1 Q
 F AG=1,6,12,19,28,36 D
 .I $G(AGTAB(AG))="1" W ?AG,"*"
 I AGFLAG W ?40,$P(^AUPNPAT(DFN,41,DUZ(2),0),U,2)
 F AG=51,57,64,71 D
 .I $G(AGTAB(AG))="1" W ?AG,"*"
 .S AGTOTAL=AGTOTAL+1
 I $G(AGFLAG)=1 W !
 I $Y>AGBM D RTRN^AG G:$D(DUOUT)!$D(DTOUT)!$D(DTOUT) KILL D HDR
 G B2
END W !!,"AGTOTAL FILES WITH INVALID DATA: ",AGTOTAL K AG("HAT") D RTRN^AG W $$S^AGVDF("IOF")
KILL D ^%ZISC K AG,AGBM,AGIO,AGTIME,DA,DFN,DIC,DLOUT,DR,AG("LOC"),AGPGPG,AGTAB,AGTOTAL,AGUCI,AG("USR"),X,Y D:$D(ZTQUEUED) KILL^%ZTLOAD
 Q
HDR S AGPGPG=AGPGPG+1 W $$S^AGVDF("IOF"),!!,AG("USR"),?72,"page ",AGPGPG
 W !,AG("LOC"),!?22,"INVALID DATA ENTRIES - PATIENT FILES",!,AGUCI,!,AGTIME
 W !!!!?17,"INDIAN",?25,"CURRENT",?34,"BENEF.",?49,"NOK",?55,"EMER",?62,"MAIL",?69,"HOME",!,"DOB  SEX  TRIBE  QUANT.  COMMUN.  CODE  CHART",?55,"CONT",?62,"ADDR",?69,"PHONE",!
 D LINE^AG
 Q